💾 Archived View for gemini.f4grx.net › hc11-toolchain.gmi captured on 2024-07-08 at 22:56:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-14)

-=-=-=-=-=-=-

Date: 20221109

68HC11 toolchain

Developing for the 68hc11 is a pleasure. Up to now, I have programmed my sys11 board in pure assembly. I could not find a satisfactory C compiler even if I know that gcc supported this cpu at some point.

However, after having a look at FUZIX, I noticed that Alan Cox did a port to the 68hc11 in 2021, and this project is obviously developed in C. Alan was nice enough to give me some clues on twitter (thank you!) so I'm glad to share a recipe with you to get a working gcc for hc11.

The main information is: The latest binutils still supports the hc11 (despite a bug in the simulator that cannot remap IO registers), but the latest gcc version to support the hc11 is 3.4.6.

The recipe

I have used this procedure on a 64-bit intel laptop with Linux Mint 21, and on a Raspberry Pi 4 with debian.

Upstream server

Local mirror

$ wget https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.gz
$ tar zxvf binutils-2.39.tar.gz
$ mv binutils-2.39 binutils-m68hc11-elf-2.39
$ cd binutils-m68hc11-elf-2.39
$ ./configure --prefix=$HOME/.local --target=m68hc11-elf
$ make
$ make install
$ ls ~/.local/bin
m68hc11-elf-addr2line  m68hc11-elf-c++filt  m68hc11-elf-ld      m68hc11-elf-objcopy  m68hc11-elf-readelf  m68hc11-elf-strip
m68hc11-elf-ar         m68hc11-elf-elfedit  m68hc11-elf-ld.bfd  m68hc11-elf-objdump  m68hc11-elf-size
m68hc11-elf-as         m68hc11-elf-gprof    m68hc11-elf-nm      m68hc11-elf-ranlib   m68hc11-elf-strings

Upstream server

Local mirror

$ wget https://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-core-3.4.6.tar.gz
$ tar zxvf gcc-core-3.4.6.tar.gz
$ mv gcc-3.4.6 gcc-m68hc11-elf-3.4.6
$ cd gcc-m68hc11-elf-3.4.6
$ cp ../binutils-m68hc11-elf-2.39/config.guess .
(S_IRUSR|S_IWUSR)

as third parameter to open (required with the O_CREAT flag). See here for the error you get without patching:

https://wiki.ubuntu.com/ToolChain/CompilerFlags?action=show&redirect=CompilerFlags#-D_FORTIFY_SOURCE=2

.space 2

instead of :

.dc.w 1

in order to reserve uninitialized space for the virtual registers.

$ ./configure --prefix=$HOME/.local --target=m68hc11-elf
$ make
$ make install
$ $ ls ~/.local/bin/
m68hc11-elf-addr2line  m68hc11-elf-c++filt  m68hc11-elf-gcc        m68hc11-elf-gcov   m68hc11-elf-ld.bfd   m68hc11-elf-objdump  m68hc11-elf-size
m68hc11-elf-ar         m68hc11-elf-cpp      m68hc11-elf-gcc-3.4.6  m68hc11-elf-gprof  m68hc11-elf-nm       m68hc11-elf-ranlib   m68hc11-elf-strings
m68hc11-elf-as         m68hc11-elf-elfedit  m68hc11-elf-gccbug     m68hc11-elf-ld     m68hc11-elf-objcopy  m68hc11-elf-readelf  m68hc11-elf-strip
$ ~/.local/bin/m68hc11-elf-gcc -v
Reading specs from /home/grx/.local/lib/gcc/m68hc11-elf/3.4.6/specs
Configured with: ./configure --prefix=/home/grx/.local --target=m68hc11-elf
Thread model: single
gcc version 3.4.6

And that's it, you can explore the 68hc11 in C! We appreciate the fact that this old gcc has no complex dependency!