Use SAM-BA

Programming a demo can be done by using the .bat or .sh scripts provided or by using the SAM-BA GUI. We'll focus on the latest solution. The components of the demo are configured to be stored in nand flash so we'll use this media.

Connecting to the board

Start SAM-BA, you'll have the following pop-up:

sam-ba_01.jpg

1. Select the connection to the board.

2. Select the board to connect to.

3. Click on Connect.

Enabling the media

First of all, you have to load the nand flash applet:

sam-ba_02.jpg

1. Select the tab corresponding to the media you want to use. By default, our demo is in nand flash.

2. Select the Enable NandFlash choice in the drop down list, usually it is the default choice.

3. Click on Execute.

Erasing the memory

Before programming components, it is strongly recommended to erase the memory. You can erase the whole memory if you want to start from scratch or you can erase only some parts of the memory. This latest solution is useful if you want to update a component, for instance you want to update the kernel but you don't want to loose your u-boot environment and your rootfs.

Erasing the whole memory

To erase the whole nand flash:

sam-ba_03.jpg

1. Select Erase all in the drop down list.

2. Click on Execute.

Partial erase of the memory

To erase only a part of the memory, you will have to use the NANDFLASH::EraseBlocks command. Its first parameter is the offset from which erase will start, the second one is the size to erase.

If you want to erase a specific component for instance the rootfs, have a look to nand flash memory map to get the offset and size value.

Here is an example to erase the rootfs on a 256 MB nand flash:

sam-ba_04.jpg

1. Type NANDFLASH::EraseBlocks 0x800000 0xF800000 in the console and press Enter.

Configuring ECC

With some devices, you can use PMECC. In this case, components have been compiled to use it.

To configure and enable PMECC, follow these steps:

sam-ba_05.jpg

1. Select Enable OS PMECC parameters in the drop down list.

2. Click on Execute.

You will have a configuration pop-up whose field values depend on the board reference (1):

SAMA5D3X-EK AT91SAM9X5-EK and AT91SAM9N12-EK Others
sam-ba_pmecc_sama5d3x.jpg sam-ba_pmecc_sam9x5.jpg sam-ba_pmecc_others.jpg

Flashing AT91Bootstrap

To flash AT91Bootstrap, do as following:

sam-ba_06.jpg

1. Select Send Boot File in the drop down list.

2. Click on Execute.

3. A pop-up will ask you to select the AT91Bootstrap binary. Once done, click on Open.

Flashing U-Boot or barebox, the Linux kernel, the device tree binary and the rootfs

Warning, important If you are using PMECC you have to redo the ECC configuration step and to select the trimffs option before flashing the rootfs. Warning, important

Then you can follow this:

sam-ba_07.jpg

1. Click on the open file button and select the appropriate binary.

2. Set the address according to the nand flash memory map. In this case, we are flashing U-Boot.

3. Click on Send File.

Note There is an extra step for U-Boot: the setup of the environment. When you are using the scripts, the U-Boot environment is generated and stored into a file which will be flashed into the nand. Here we don't have the U-boot environment binary so you have to run U-Boot on the board and to enter these commands (replace dtbSize and kernelSize by appropriate values):

setenv bootargs 'console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs'
setenv bootcmd 'nand read 0x21000000 0x00180000 dtbSize; nand read 0x22000000 0x00200000 kernelSize; bootm 0x22000000 - 0x21000000'
save

Notes

1 : In fact, it doesn't depend on the board but on the nand flash device. We are assuming that the nand flash device used is always the same for a given SAM family.


Topic attachments
I Attachment Action Size Date Who Comment
JPEGjpg sam-ba_01.jpg manage 25.0 K 2013-02-04 - 14:51 LudovicDesroches sam-ba connection screenshot
JPEGjpg sam-ba_02.jpg manage 149.1 K 2013-02-04 - 14:51 LudovicDesroches sam-ba enable nand flash screenshot
JPEGjpg sam-ba_03.jpg manage 148.3 K 2013-02-04 - 14:52 LudovicDesroches sam-ba erase all screenshot
JPEGjpg sam-ba_04.jpg manage 162.5 K 2013-02-04 - 15:29 LudovicDesroches sam-ba partial erase screenshot
JPEGjpg sam-ba_05.jpg manage 151.5 K 2013-02-04 - 15:51 LudovicDesroches sam-ba enable pmecc screenshot
JPEGjpg sam-ba_06.jpg manage 147.9 K 2013-02-04 - 17:00 LudovicDesroches sam-ba flashing at91bootstrap screenshot
JPEGjpg sam-ba_07.jpg manage 141.6 K 2013-02-04 - 17:00 LudovicDesroches sam-ba flashing a binary screenshot
JPEGjpg sam-ba_pmecc_others.jpg manage 23.3 K 2013-02-05 - 10:42 LudovicDesroches sam-ba pmecc conf for devices without pmecc
JPEGjpg sam-ba_pmecc_sam9x5.jpg manage 32.8 K 2013-02-04 - 17:24 LudovicDesroches sam-ba pmecc conf for sam9x5 screenshot
JPEGjpg sam-ba_pmecc_sama5d3x.jpg manage 33.0 K 2013-02-04 - 17:25 LudovicDesroches sam-ba pmecc conf for sama5d3x screenshot
r4 - 05 Feb 2013 - 17:00:49 - LudovicDesroches
 
Linux & Open Source related information for AT91 Smart ARM Microcontrollers

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Atmel® and others, are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. This site is powered by the TWiki collaboration platform

ARM® and others are registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM