Chibi/OS

Using NetBeans and Gnu ARM tools, I was able to build and run the ChibiOS/RT demos for the STM32F4 discovery board.  I downloaded the zip file containing the latest version of ChibiOS/RT and extracted it to my NetBeansProjects folder.  To build a project:

  • File -> New Project -> C/C++ -> C/C++ Project with Existing Sources
  • Browse to the appropriate directory e.g:
    • …./NetBeansProjects/ChibiOS_2.6.7/demos/ARMCM4-STM32F407-DISCOVERY
  • Select Tool Collection as GNU ARM
  • Select Automatic Configuration Mode

That’s it, the project is imported and automatically builds!  You can load it onto the target using st-flash and debug it (if desired) using st-util:

  • st-flash write \Users\dalbert\Documents\NetBeansProjects\ChibiOS_2.6.7\demos\ARMCM4-STM32F407-DISCOVERY\build\ch.bin 0x8000000
  • st-util  (make sure you’ve configured build/ch.elf as the project Properties->Build->Make->Build Result)

I’ve built and tested the three STM32F4-DISCOVERY demos and they all ran successfully including the VCP USB comm port with command interpreter in the MEMS demo.

I’ve also built the ChibiOS/RT + lwIP + PPP application here which required a few fixes and must be linked with ChibiOS/RT 3.x but then runs nicely using the serial port (PA2, PA3) to serve a PPP connection.  I have two directories under NetBeansProjects:
stm32f4-chibios-lwip-pppos-master
ChibiOS_3.0.x
Then I create a symlink under stm32f4-chibi-…-master/lib called ChibiOS-RT that links to ../../ChibiOS_3.0.x.

On the remote terminal (linux box) side, I configured /etc/ppp/options including the serial port I was connected to (/dev/ttyUSB0) and the baudrate (38400); the whole file looks like this:

# Prevent pppd from forking into the background
-detach
debug
/dev/ttyUSB0
38400
# wait for connection if none initially found
passive
# no hardware flow control
nocrtscts
# don’t use modem control lines
local
# create a default route for this connection in the routing table
defaultroute
# no authorization required
noauth
# ensure exclusive access to the serial device
lock
# do not set up any escaped control sequences
asyncmap 0
# use a maximum transmission packet size of 552 bytes
mtu 552
# use a maximum receive packet size of 552 bytes
mru 552
# IP stack configuration
netmask 255.255.255.0
noipdefault
:

Launch pppd specifying localip:remoteip: which generate the ppp0 network interface (shows on ifconfig):

sudo pppd 172.30.1.98:172.30.1.99

Reset the discovery board and the PPP connection is up!  You can ping the discovery board (ping 172.30.1.99) and can bring up a remote shell connection using netcat: nc 172.30.1.99 25  (note to send a CR requires Ctrl-V <enter><enter>).