Skip to content

OS-free port of LwIP stack to ARM board with lan91c111 ethernet controller

License

Notifications You must be signed in to change notification settings

laroche/baremetal-lwip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Baremetal LwIP

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 ~~*~

Setup

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

TODO

  • 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

Sources

About

OS-free port of LwIP stack to ARM board with lan91c111 ethernet controller

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 91.9%
  • C# 5.0%
  • CMake 2.3%
  • Makefile 0.6%
  • HTML 0.1%
  • Shell 0.1%