This is a port of the LwIP to an ARM board without an operating system. The target machine (VersatilePB) has an ARM926EJ-S processor and LAN91C111 ethernet controller. It exists mostly because I couldn't find a working NO_SYS==1 port, but is also a good starting point for building and learning new things ~~*~
The intended execution environment is qemu-system-arm on a Linux host.
To install the required software on Debian or Ubuntu:
sudo apt install gcc-arm-none-eabi make qemu-system-arm
Or you can download a current gcc-arm compiler:
wget https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
tar xvJf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
export PATH=$PWD/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin:$PATH
To build:
git clone https://github.com/laroche/baremetal-lwip.git
cd baremetal-lwip
make
Next, use this script to bring up a TAP interface to create a bridge between Linux and QEMU's network interfaces. Change the ethernet interface name and settings in the script to match yours.
sudo ./qemu-ifup tap0
Then bring up the qemu machine (requires root to use the qemu tap backend)
sudo make run
Now you can talk to it from the Linux host:
$ ping 10.0.2.99
PING 10.0.2.99 (10.0.2.99) 56(84) bytes of data.
64 bytes from 10.0.2.99: icmp_seq=1 ttl=255 time=4.41 ms
64 bytes from 10.0.2.99: icmp_seq=2 ttl=255 time=0.549 ms
64 bytes from 10.0.2.99: icmp_seq=3 ttl=255 time=0.528 ms
Exit qemu (Ctrl-A X) and bring down the bridge when finished:
sudo ./qemu-ifdown2
- Target a more modern board and eventually real hardware..versatilepb was chosen because it is used in many QEMU tutorials
- Add an abstraction layer so swapping ethernet drivers is cleaner
- Implement system timer