Version 14 (modified by Lekernel, on Apr 12, 2011 at 10:27:29 PM) (diff)


{{Infobox BSP |BSP_name = milkymist |Manufacturer = Sharism at Work Ltd. |Board_URL = |image = mmone.jpg |Architecture = LM32 |CPU_model = Milkymist SoC |RAM = 128MB 32-bit DDR400 SDRAM |Simulator = Yes. QEMU? |Serial = One 3.3V RS232 |Video = VGA up to 140MHz pixel clock. CVBS, S-Video and digital HD coming soon. |NVMEM = 32MB NOR flash, micro memory card }}

This is a tutorial on how to build and run RTEMS on the Milkymist One board.

Questions about the Milkymist BSP for RTEMS ?

GO ask them on on #milkymist

I (Yann Sionneau aka Fallenou on IRC) or lekernel or mwalle will try to answer :)

Build an RTEMS toolchain

  • If you are under ubuntu 10.04 i guess you do not need to compile autoconf and automake from sources, the version provided by ubuntu is recent enough.
  • So basically doing the following should be ok :

# aptitude install m4 patch build-essential texinfo cvs libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev autoconf autotools-dev

  • Follow the steps of the "Phase 2." of RTEMS' wiki page to configure and build the toolchain.
    • Do not forget that you are building the toolchain for RTEMS 4.11 and not 4.9
    • Your target is not powerpc-rtems4.9 but lm32-rtems4.11
    • Do not forget to apply the patches, and follow the build order indicated in the RTEMS wiki, you must build gcc against newlib.

Checkout the RTEMS port to Milkymist

Yann Sionneau developped as part of a Google Summer of Code (2010) a Board Support Package (BSP) for the Milkymist One board which makes it possible to run RTEMS on Milkymist One board using Milkymist SoC !

The BSP is available on his git repository hosted on github :

  • Be sure to have the git tool installed in your computer
  • Git can be installed this way under debian (and ubuntu) :

# aptitude update && aptitude install git-core

  • Clone the git repository of the RTEMS port to Milkymist :

~$ git clone git://

Building RTEMS port to Milkymist

  • Go to the root of the source tree :

~$ cd rtems

  • Put your lm32-rtems4.11 toolchain in your PATH environment variable :

~$ export PATH=/opt/rtems-4.11/bin:$PATH

  • Run bootstrap (to generate the and other autotools related files) :

~/rtems$ ./bootstrap

  • Go make some coffee, drink the coffee, refill your mug and drink again ... ok you're done !
  • Create a directory to host the binaries you're going to create :

$ cd ~/ ~$ mkdir bsp-milkymist

  • Do configure and make !

~$ cd bsp-milkymist ~/bsp-milkymist$ ../rtems/configure --target=lm32-rtems4.11 --enable-rtemsbsp=milkymist \

--enable-testsuites=samples --enable-posix --disable-itron --enable-networking --disable-multiprocessing

~/bsp-milkymist$ make all ~/bsp-milkymist$ sudo -s (or simply su in debian) ~/bsp-milkymist# export PATH=$PATH:/opt/rtems-4.11/bin ~/bsp-milkymist# make install

  • You can go drink some more coffee !

Run the sample applications on the Milkymist One board

Go to the bsp-milkymist directory, say we wanna test the "hello world" sample :

~$ cd bsp-milkymist/ ~/bsp-milkymist$ cd lm32-rtems4.11/c/milkymist/testsuites/samples/hello ~/bsp-milkymist/lm32-rtems4.11/c/milkymist/testsuites/samples/hello$ lm32-rtems4.11-objcopy -Obinary hello.exe

  • Plug your RS-232 serial usb wire to your computer and to the Serial port of the board
  • Install flterm (the software for uploading the application into on-board Flash through RS-232 line) :
    • This software is available in milkymist's debian repository (works for ubuntu too), just do :

# echo "deb ./" >> /etc/apt/sources.list # aptitude update && aptitude install flterm

  • Power-on the board
  • Then upload the sample application hello.exe to the board :

~/bsp-milkymist/lm32-rtems4.11/c/milkymist/testsuites/samples/hello$ flterm --kernel hello.exe --port /dev/ttyUSB0

  • If nothing is uploading then push two push-buttons, then push the third and release it, then release the two others. (in this order)

Run Genode-FX on the Milkymist One board

Genode-FX is a graphic toolkit for embedded systems like FPGA based ones, just like Milkymist :)

  • Checkout the git repository of the Genode-FX port

~$ git clone git://

  • Compile Genode-FX against RTEMS kernel

~$ cd genode-fx/dope-embedded ~/genode-fx/dope-embedded$ RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist make milkymist

  • Put the binary into the correct format to be sent to the board

~/genode-fx/dope-embedded$ cd test/milkymist ~/genode-fx/dope-embedded/test/milkymist$ lm32-rtems4.11-objcopy -Obinary dopetest

  • Upload the binary (dopetest) to the board, using the procedure as described in the previous section named "Run the sample applications on the Milkymist One board"

Another example of application built against RTEMS : tftpclient

tftpclient is an example application that you can build against RTEMS kernel.

This application downloads a file from a tftp server and prints it's content to the serial console.

This application has been added to the network-demos provided by RTEMS as a CVS module, it is available on Yann's github

  • Checkout the github repo of network-demos :

~$ git clone git://

  • Compile the applications against RTEMS kernel :

~$ cd network-demos ~$ export PATH=$PATH:/opt/rtems-4.11/bin ~/network-demos$ RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist make all

  • Install a tftpd server on your computer :

~# aptitude install tftpd

  • Configure it :

~# touch /etc/xinetd.d/tftp ~# vim /etc/xinetd.d/tftp

  • Put this in the file :

service tftp {

protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in.tftpd server_args = /tftpboot disable = no


  • Create the tftp root directory and put your file in it

~# mkdir /tftpboot ~# cp yourfile /tftpboot/ ~# chown -R nobody /tftpboot ~# chmod -R 777 /tftpboot

  • Restart xinetd :

~# /etc/init.d/xinetd restart

  • Upload the file to the board using the procedure described previously :

~/network-demos$ cd tftpclient/o-optimize ~/network-demos/tftpclient/o-optimize$ lm32-rtems4.11-objcopy -Obinary tftpclient.exe ~/network-demos/tftpclient/o-optimize$ flterm --kernel tftpclient.exe --port /dev/ttyUSB0

  • While uploading the binary into the board, set-up your network configuration :

~# ifconfig eth0 netmask

You can change the ip address taken by the board, the ip address of the gateway it's supposed to use, the ip address of the tftp server, the port of the tftp server and the name of the file tftpclient is supposed to download and print in the network-demos/networkconfig.h and directly into network-demos/tftpclient/init.c