LwIP port based on STM32CubeMX generated code and ChibiOS

Makefile template for STM32Cube generated HAL code linked with ChibiOS and lwIP, running on varios STM32 boards


Project motivation

Based on my improved STM32 makefile template, I've created some lwIP demo projects running on various STM32 nucleo boards.

Common features

  • STM32Cube MX generated initialization code
  • STM32Cube HAL firmware library
  • ChibiOS 16.1.4 used as RTOS
  • lwIP configured in DHCP mode
  • A simple debug messages server on target port 40000
  • Blinking LED
  • printf() messages routed to an onboard uart and to a simple TCP server on port 40000
  • Run "make" to compile
  • Run "make flash" to flash your board using openocd
  • Watch the uart output to see what IP address is assigned from your DHCP server
  • Telnet to port 40000 to see the debug message output
  • Supported boards

  • Nucleo-F746ZG (large Nucleo-144 board)
  • Nucleo-F429ZI (large Nucleo-144 board)
  • Nucleo-F207ZG (large Nucleo-144 board)
  • Olimex P107 (tested with Rev. A)
  • Olimex E407 (tested with Rev. B)
  • STM3210C-Eval board
  • Xynergy board
  • These examples are intended as a simple starting point for your own projects. You've got the choice to use the HAL provided drivers or write your own and still use the STM32Cube generated initialization like I did for the uart driver. For each board, I've provided a STM32CubeMX project file (*.ioc), a top level Makefile and a simple main() demo.

    If you want to create a new project, take a deeper look at the code generation settings in one of the example projects. You'll have to clone them manually in your new project to make everything work as expected.

    The top level Makefile includes several other makefiles:

  • A common project header, initializing some variables
  • A target specific makefile setting up the whole make process
  • Makefiles for the libraries (HAL, ChibiOS, LwIP)
  • Makefiles for commonly used sources (hard fault handler, simple bsp)
  • A target specific makefile implementing the openocd parameters
  • A common makefile that runs the compiler, linker etc.
  • Download

    here: lwip-simple-bsp.tar.gz

    All neccessary library files are included in the tarball. You do not need to download or install additional sources to compile the examples. The included sources might not be complete in terms of their original source, get the full Cube HAL sources from STmicro. Some of the HAL source files were modified from their original state to make my uart driver work.

    If you don't like the STM32CubeMX approach, try ChibiOS HAL. The ChibiOS package contains quite a lot of readily compileable examples for many STM32 discovery and nucleo boards, including a LwIP port. I've used the ChibiOS LwIP port and their ethernet MAC driver for my LwIP port.

    System requirements

  • A recent Linux or Cygwin system (I don't mind native windows, I guess it'll just won't work)
  • The usual collection of GNU/Linux standard utilities (sed, gawk, find, ...)
  • A recent arm-none-eabi toolchain, recommended GCC ARM Embedded
  • A recent version of OpenOCD
  • Links

    Download the full ChibiOS source code here: Chibios Homepage
    Get the most recent version of LwIP here: LwIP project homepage

    Look here: The STM32 files for my other STM32 related pages. ... und ein Zaehlpixel hab ich auch :-)