Changes between Initial Version and Version 1 of TBR/BSP/Milkymist


Ignore:
Timestamp:
08/16/10 14:02:46 (14 years ago)
Author:
Fallenou
Comment:

first commit

Legend:

Unmodified
Added
Removed
Modified
  • TBR/BSP/Milkymist

    v1 v1  
     1= Milkymist =
     2
     3
     4This is a tutorial on how to build and run RTEMS on the Milkymist One board.
     5
     6Questions about the Milkymist BSP for RTEMS ?
     7
     8GO ask them on irc.freenode.net on #milkymist
     9
     10I (Yann Sionneau aka Fallenou on IRC) or lekernel or mwalle will try to answer :)
     11=  Build an RTEMS toolchain  =
     12
     13
     14 *  You can follow the following tutorial on RTEMS's wiki : [http://www.rtems.org/wiki/index.php/Building_the_RTEMS_toolset_on_Ubuntu http://www.rtems.org/wiki/index.php/Building_the_RTEMS_toolset_on_Ubuntu]
     15 *  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.
     16 *  So basically doing the following should be ok :
     17
     18  # aptitude install m4 patch  build-essential texinfo cvs libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev autoconf autotools-dev
     19
     20 *  Then download the sources of gcc-core, newlib, gdb, g++ and binutils and the corresponding patches (.diff files) on this page : [http://ftp.rtems.org/ftp/pub/rtems/SOURCES/4.11/ http://ftp.rtems.org/ftp/pub/rtems/SOURCES/4.11/]
     21
     22 *  Follow the steps of the "Phase 2." of RTEMS' wiki page to configure and build the toolchain.
     23  *  Do not forget that you are building the toolchain for RTEMS 4.11 and not 4.9
     24  *  Your target is not powerpc-rtems4.9 but lm32-rtems4.11
     25  *  Do not forget to apply the patches, and follow the build order indicated in the RTEMS wiki, you must build gcc against newlib.
     26=  Checkout the RTEMS port to Milkymist  =
     27
     28
     29Yann 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 !
     30
     31The BSP is available on his git repository hosted on github : [http://github.com/fallen/rtems-milkymist http://github.com/fallen/rtems-milkymist]
     32
     33
     34 *  Be sure to have the git tool installed in your computer
     35
     36 *  Git can be installed this way under debian (and ubuntu) :
     37
     38  # aptitude update && aptitude install git-core
     39
     40 *  Clone the git repository of the RTEMS port to Milkymist :
     41
     42  ~$ git clone git://github.com/fallen/rtems-milkymist.git
     43=  Building RTEMS port to Milkymist  =
     44
     45
     46 *  Go to the root of the source tree :
     47
     48  ~$ cd rtems
     49
     50 *  Put your lm32-rtems4.11 toolchain in your PATH environment variable :
     51
     52  ~$ export PATH=/opt/rtems-4.11/bin:$PATH
     53
     54 *  Run bootstrap (to generate the Makefile.in and other autotools related files) :
     55
     56  ~/rtems$ ./bootstrap
     57
     58 *  Go make some coffee, drink the coffee, refill your mug and drink again ... ok you're done !
     59
     60 *  Create a directory to host the binaries you're going to create :
     61
     62  $ cd ~/
     63  ~$ mkdir bsp-milkymist
     64
     65 *  Do configure and make !
     66
     67  ~$ cd bsp-milkymist
     68  ~/bsp-milkymist$ ../rtems/configure --target=lm32-rtems4.11 --enable-rtemsbsp=milkymist \
     69                   --enable-testsuites=samples --enable-posix --disable-itron --enable-networking --disable-multiprocessing
     70  ~/bsp-milkymist$ make all
     71  ~/bsp-milkymist$ sudo -s (or simply su in debian)
     72  ~/bsp-milkymist# export PATH=$PATH:/opt/rtems-4.11/bin
     73  ~/bsp-milkymist# make install
     74
     75 *  You can go drink some more coffee !
     76=  Run the sample applications on the Milkymist One board  =
     77
     78
     79Go to the bsp-milkymist directory, say we wanna test the "hello world" sample :
     80
     81  ~$ cd bsp-milkymist/
     82  ~/bsp-milkymist$ cd lm32-rtems4.11/c/milkymist/testsuites/samples/hello
     83  ~/bsp-milkymist/lm32-rtems4.11/c/milkymist/testsuites/samples/hello$ lm32-rtems4.11-objcopy -Obinary hello.exe
     84
     85 *  Plug your RS-232 serial usb wire to your computer and to the Serial port of the board
     86
     87 *  Install flterm (the software for uploading the application into on-board Flash through RS-232 line) :
     88  *  This software is available in milkymist's debian repository (works for ubuntu too), just do :
     89
     90  # echo "deb http://www.milkymist.org/debian ./" >> /etc/apt/sources.list
     91  # aptitude update && aptitude install flterm
     92
     93 *  Power-on the board
     94
     95 *  Then upload the sample application hello.exe to the board :
     96 
     97  ~/bsp-milkymist/lm32-rtems4.11/c/milkymist/testsuites/samples/hello$ flterm --kernel hello.exe --port /dev/ttyUSB0
     98
     99 *  If nothing is uploading then push two push-buttons, then push the third and release it, then release the two others. (in this order)
     100=  Run Genode-FX on the Milkymist One board  =
     101
     102
     103Genode-FX is a graphic toolkit for embedded systems like FPGA based ones, just like Milkymist :)
     104
     105 *  Checkout the git repository of the Genode-FX port
     106
     107  ~$ git clone git://github.com/lekernel/genode-fx.git
     108
     109 *  Compile Genode-FX against RTEMS kernel
     110
     111  ~$ cd genode-fx/dope-embedded
     112  ~/genode-fx/dope-embedded$ RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist make milkymist
     113
     114 *  Put the binary into the correct format to be sent to the board
     115
     116  ~/genode-fx/dope-embedded$ cd test/milkymist
     117  ~/genode-fx/dope-embedded/test/milkymist$ lm32-rtems4.11-objcopy -Obinary dopetest
     118
     119 *  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"
     120=  Another example of application built against RTEMS : tftpclient  =
     121
     122
     123tftpclient is an example application that you can build against RTEMS kernel.
     124
     125This application downloads a file from a tftp server and prints it's content to the serial console.
     126
     127This application has been added to the network-demos provided by RTEMS as a CVS module, it is available on Yann's github
     128
     129 *  Checkout the github repo of network-demos :
     130
     131  ~$ git clone git://github.com/fallen/network-demos.git
     132
     133 *  Compile the applications against RTEMS kernel :
     134
     135  ~$ cd network-demos
     136  ~$ export PATH=$PATH:/opt/rtems-4.11/bin
     137  ~/network-demos$ RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist make all
     138
     139 *  Install a tftpd server on your computer :
     140
     141  ~# aptitude install tftpd
     142
     143 *  Configure it :
     144
     145  ~# touch /etc/xinetd.d/tftp
     146  ~# vim /etc/xinetd.d/tftp
     147
     148 *  Put this in the file :
     149
     150  service tftp
     151  {
     152    protocol    = udp
     153    port        = 69
     154    socket_type = dgram
     155    wait        = yes
     156    user        = nobody
     157    server      = /usr/sbin/in.tftpd
     158    server_args = /tftpboot
     159    disable     = no
     160  }
     161
     162 *  Create the tftp root directory and put your file in it
     163
     164  ~# mkdir /tftpboot
     165  ~# cp yourfile /tftpboot/sample.data
     166  ~# chown -R nobody /tftpboot
     167  ~# chmod -R 777 /tftpboot
     168
     169 *  Restart xinetd :
     170
     171  ~# /etc/init.d/xinetd restart
     172
     173 *  Upload the file to the board using the procedure described previously :
     174
     175  ~/network-demos$ cd tftpclient/o-optimize
     176  ~/network-demos/tftpclient/o-optimize$ lm32-rtems4.11-objcopy -Obinary tftpclient.exe
     177  ~/network-demos/tftpclient/o-optimize$ flterm --kernel tftpclient.exe --port /dev/ttyUSB0
     178
     179 *  While uploading the binary into the board, set-up your network configuration :
     180
     181  ~# ifconfig eth0 192.168.101.254 netmask 255.255.255.0
     182
     183You 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