RCU2 Software Development Firmware: Difference between revisions

From ift
No edit summary
No edit summary
Line 47: Line 47:
  Saving Environment to SPI Flash...
  Saving Environment to SPI Flash...
  Erasing SPI flash...Writing to SPI flash...done
  Erasing SPI flash...Writing to SPI flash...done
=== Kermit mode ===
It is also possible to update the Linux image on the board through kermit mode (file transfer over serial link).
In Linux you need a kermit client, e.g. ckermit or gkermit. To setup the client, create a config file (~/.kermrc) that should look something like this:
set line /dev/ttyUSB0
define sz !sz \%0 > /dev/ttyUSB0 < /dev/ttyUSB0
set speed 115200
set carrier-watch off
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
set flow-control none
set prompt "Linux Kermit> "
Connect to the board by typing in a shell '''kermit''' then after kermit has started, type '''connect'''. If you are in Linux now, you reboot the board to get to the u-boot prompt.
Once at the u-boot prompt, type
M2S-SOM> loadb
U-boot is now waiting for an image
## Ready for binary (kermit) download to 0xA0007FC0 at 115200 bps...
Go back to kermit (''ctrl-\'' and ''ctrl-c'') then send the image
Linux Kermit> send /home/lars/work/TPCRCU2/trunk/Firmware/Linux_image/rculinux.uImage
Once finished (this takes about 3.5 minutes) go back to the board either by closing kermit and using your favorite serial client or by doing
Linux Kermit> connect
Connecting to /dev/ttyUSB0, speed 115200
  Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x001c8640 = 1869376 Bytes
## Start Addr      = 0xA0007FC0
M2S-SOM> flashboot
The new image should now be booted.


== Development ==
== Development ==

Revision as of 10:30, 10 March 2014

Programming

A FlashPro project including a STAPL programming file with firmware and u-boot images can be found here[1]. The firmware is compiled for the SmartFusion2 Starter Kit and the device MS2050T_ES. The Libero project will be made available on the Subversion directory ASAP in case you have other devices (for now, find the project here (11.1) or here (11.2)).

Usage:

  1. Open FlashPro software
  2. Select Open Project and find the file rcu2_linux_fw.pro
  3. Make sure the FlashPro programmer is inserted and that it has been selected by pressing View Programmers. If necessary, hit Refresh/Rescan for Programmers
  4. Now hit PROGRAM, wait for it to finish and then power cycle the board.

For more information on FlashPro, check the user guide[2].

Setup of the SmartFusion2 Target

Boot Linux Image

The Linux image is fetched from a network and can be booted directly from the network as well as loaded into the external Flash memory on the board. This requires a TFTP server to host the Linux image, for help on setting up a server, check the TFTP page. If you would like to quickly test the boot process, a Linux image can be fetched from Github.

For now, the U-Boot enviroment has to be set manually.

  • Log in to the board through serial, baud rate 115200, 1 stop bit, no parity
  • Reset board and hit a key to stop boot sequence
  • Define the IP addresses for the target board and the TFTP server, as well as the name for the boot image.
setenv ipaddr 192.168.1.11
setenv serverip 192.168.1.10
setenv image rculinux.uImage
saveenv

To run the image over the network, reset the board and stop the autoboot sequence, then type

run netboot

To load the image into the Flash, type

run update

You should see something like this

M2S-SOM> run update
Using M2S_MAC device
TFTP from server 192.168.1.10; our IP address is 192.168.1.11
Filename 'rculinux/rculinux.uImage'.
Load address: 0xa0007fc0
Loading: #################################################################
	 #################################################################
	 ################################################################# 
	 #################################################################
	 ################################################################# 
	 #########################################
done
Bytes transferred = 1869376 (1c8640 hex)
16384 KiB S25FL128S_64K at 0:0 is now current device
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done

Kermit mode

It is also possible to update the Linux image on the board through kermit mode (file transfer over serial link). In Linux you need a kermit client, e.g. ckermit or gkermit. To setup the client, create a config file (~/.kermrc) that should look something like this:

set line /dev/ttyUSB0
define sz !sz \%0 > /dev/ttyUSB0 < /dev/ttyUSB0
set speed 115200
set carrier-watch off
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
set flow-control none
set prompt "Linux Kermit> "

Connect to the board by typing in a shell kermit then after kermit has started, type connect. If you are in Linux now, you reboot the board to get to the u-boot prompt. Once at the u-boot prompt, type

M2S-SOM> loadb

U-boot is now waiting for an image

## Ready for binary (kermit) download to 0xA0007FC0 at 115200 bps...

Go back to kermit (ctrl-\ and ctrl-c) then send the image

Linux Kermit> send /home/lars/work/TPCRCU2/trunk/Firmware/Linux_image/rculinux.uImage 

Once finished (this takes about 3.5 minutes) go back to the board either by closing kermit and using your favorite serial client or by doing

Linux Kermit> connect
Connecting to /dev/ttyUSB0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x001c8640 = 1869376 Bytes
## Start Addr      = 0xA0007FC0
M2S-SOM> flashboot

The new image should now be booted.


Development

Download the Linux BSP and software development environment as well as the GNU tool-chain from EmcraftEmcraft SF2 Starter kit downloads.

  1. Extract linux-M2S-1.11.0.tar.bz2 to a preferred directory
  2. Extract GNU toolchain arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2 to directory ./linux-cortexm-1.11.0/tools
  3. Make sure that the information in ACTIVATE.sh is correct and that the file is executable.
  4. Source ACTIVATE.sh: . ACTIVATE.sh

You are now ready for doing development.

To create a new project, you can clone the developer project:

lars@borg-2:~/work/linux-cortexm-1.11.0/projects/developer$ make clone new=test
New project created in /home/lars/work/linux-cortexm-1.11.0/projects/test
lars@borg-2:~/work/linux-cortexm-1.11.0/projects/developer$ cd ../test/

Or you can clone this project from Github and copy it to the projects folder in your development enviroment.

Network and development

The startup script of the SF2 should be updated such that you can mount a directory from the development host onto the target board. This way you can compile any software you are working on, and run it straight away from the mount on the board. Add something along the following lines to local/rc in your project directory:

mount -o nolock,rsize=1024 192.168.1.10:/home/lars/work/linux-cortexm-1.11.0/projects /mnt

The mount directory needs to be added to the ramfs table, so add to rculinux.initramfs:

dir /mnt 755 0 0

After this is done, the image has to be recompiled and loaded to the board.


Known Problems

  • In Libero, the path for the u-boot flash image is hard-linked, so if you are trying to run any of the project in the first section of this page, Libero might tell you that it did not find the flash file. If this should occur, it is needed to redefine the path to the image.
    • 11.1 -- Go to the MSS configurator tab and double-click the eNVM part, in the configuration window for the eNVM, change to the correct path.
    • 11.2 -- In Design Flow tab: Configure Security and Programming Options --> Update eNVM Memory Content.


References