I have a Raspberry Pi that I use as a local network router to isolate my lab from the rest of the network. It has a Raspberry Pi 3 with wireless built in and an Ethernet hub locally on the test bench in the lab. I'd like to use that as my compile machine. The machine has the latest versions of binutils and gcc but the instructions from here indicate that support for the 68K was discontinued in the past so it's better to install older versions of binutils and gcc.
Dave Shepperd reported that the last binutils version to support the m68k-coff target is 2.16.1. Using GCC >= 4.3 also seems to be a bit trickier as it requires additional software to be installed (e.g. GMP).
I followed these instructions to free up space in the Raspberry Pi (it had libre office and other things I don't use on the machine). I have a bit under 1GB of free space left.
I am running Raspbian version:
pi@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)" NAME="Raspbian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" VERSION_CODENAME=stretch ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
My Pi was already set up for SFTP so I used FileZilla to connect to the Pi. Downloaded to:
/home/pi/Downloads tar -xjf binutils-2.16.1a.tar.bz2 tar -xjf gcc-4.2.4.tar.bz2 rm *bz2
The binutils made fine but the gcc had a build error. The assembler does look like it's present:
pi@raspberrypi:/opt/m68k/m68k-coff/bin $ ls -al total 14528 drwxr-xr-x 2 root root 4096 Aug 12 08:15 . drwxr-xr-x 4 root root 4096 Aug 12 08:15 .. -rwxr-xr-x 2 root root 1597980 Aug 12 08:15 ar -rwxr-xr-x 2 root root 2697432 Aug 12 08:15 as -rwxr-xr-x 2 root root 2372272 Aug 12 08:15 ld -rwxr-xr-x 2 root root 1699616 Aug 12 08:15 nm -rwxr-xr-x 2 root root 2541904 Aug 12 08:15 objdump -rwxr-xr-x 2 root root 1597988 Aug 12 08:15 ranlib -rwxr-xr-x 2 root root 2343228 Aug 12 08:15 strip pi@raspberrypi:/opt/m68k/m68k-coff/bin $ as -version GNU assembler (GNU Binutils for Raspbian) 2.28 Copyright (C) 2017 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `arm-linux-gnueabihf'.
Note, this is the wrong assembler! The correct path is:
pi@raspberrypi:/opt/m68k/bin $ ls m68k-coff-addr2line m68k-coff-ld m68k-coff-ranlib m68k-coff-strip m68k-coff-ar m68k-coff-nm m68k-coff-readelf m68k-coff-as m68k-coff-objcopy m68k-coff-size m68k-coff-c++filt m68k-coff-objdump m68k-coff-strings pi@raspberrypi:/opt/m68k/bin $ ./m68k-coff-as -version GNU assembler 2.16.1 Copyright 2005 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. This assembler was configured for a target of `m68k-coff'.
Create a simple file:
pi@raspberrypi:/opt/m68k/bin $ more test.asm nop
sudo ./m68k-coff-as test.asm
Produces a.out file.
pi@raspberrypi:/opt/m68k/bin $ ls -al total 23472 drwxr-xr-x 2 root root 4096 Aug 12 13:12 . drwxr-xr-x 8 root root 4096 Aug 12 08:15 .. -rw-r--r-- 1 root root 286 Aug 12 13:12 a.out
Assembling with list option.
sudo ./m68k-coff-as test.asm -a=test.lst
List file is:
more test.lst 68K GAS test.asm page 1 1 0000 4E71 nop 2 ^L68K GAS test.asm page 2 DEFINED SYMBOLS e0:00000000 .text e1:00000002 .data e2:00000002 .bss NO UNDEFINED SYMBOLS
Still fits on the 8GB SD card.
pi@raspberrypi:/opt/m68k/bin $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 7.2G 6.5G 407M 95% / devtmpfs 465M 0 465M 0% /dev tmpfs 469M 0 469M 0% /dev/shm tmpfs 469M 19M 451M 4% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 469M 0 469M 0% /sys/fs/cgroup /dev/mmcblk0p1 44M 23M 22M 52% /boot tmpfs 94M 0 94M 0% /run/user/1000
Now, onto rebuilding TUTOR.