SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total novice

Discussion around AT91RM9200 and SAM9 Series Products.

Moderator: nferre

caspelin
Posts: 1
Joined: Mon May 07, 2012 8:48 am

SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total novice

Mon May 07, 2012 8:54 am

Hello,

Beginners (well, total novice at the moment) questios about flashing SAM9x35-ek with SAM-BA (via USB).

My current setup includes the Atmel's SAM9x35-ek board, Keil uVision 4.5 (with the Atmel's SW package: SAM9X35-EK MDK Software Package for Keil uVision4, 1) ) and the SAM-BA 2.11 to program the board using USB.

I started my experiments by installing different linux packages from the "Getting Started page for AT91SAM9x5 family" 2), and everything works as planned. I am able to flash the Angstrom to the NAND flash, and run it. But how I can test some sample codes provided by Atmel as standalone applications, without any OS on the board?

For example the getting-started project provided by Atmel on their SW package. On the comments, in section "Usage" they state, that "Build the program and download it inside the evaluation board"... And this is the point, where I'm stuck. I am able to build the program, but I'm not sure how to download it to the board, or how to run standalone applications on this board. I found some information about SAM9 MPU boot solution, and if I have understood correctly, the first level boot loader copies second level boot loader (AT91Bootstrap) from DATAFlash (0x0000 ?) to SRAM (0x300000 ?), which should copy the application (0x8400, again ? ) itself to the SDRAM (0x20000000)? Is it so? Do I really need all these boot loaders to run simple code on the board? Do I need the AT91Bootstrap from 3), or from 4), since the package from 3) doesn't mentioned SAM9x35 (or SAM9x5)... Besides, can I use NandFlash, SerialFlash or even SD card for this?

To make a long story short: What is the simplest way to download & run a simple standalone application provided by Atmel on the SAM9x35-ek board? I would really appreciate some links, tutorials and of course direct comments & help!

Thank you very much in advance!

- Chris



1) SAM9x35-ek SW package for Keil uVision4
http://www.atmel.com/tools/SAM9X35-EK.aspx
2) getting-started project from this SAM9x35-ek SW package
linux4sam/bin/view/Linux4SAM/GettingStarted_9x5
3) AT91Bootstrap
http://www.atmel.com/products/microcont ... ?tab=tools
4) linux4sam/bin/view/Linux4SAM/SAM9x5Page#AT91Bootstrap
manuelk
Posts: 9
Joined: Thu Feb 09, 2012 9:29 am

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Tue May 29, 2012 11:59 am

Hi,

I have the same problem... you have found out meanwhile something?!?

With a Bootstraploader is absent for 9x35 in general, have you already found one?

Because support from Atmel has said me that I may not take the Version for Linux?!? reason?

Anyhow a "getting started" without Linux would be quite nice.
gadneia
Posts: 3
Joined: Sun May 13, 2012 5:07 am

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Tue May 29, 2012 2:38 pm

hi
The AT91Bootstrap code is used to load the u-boot code to sdram ,and the u-boot is used to load a linux image to the sdam. So if you only want to test simple code without os , You do not need the AT91Bootstrap. That means the application code without os can down to the EV board and run normal through SAMBA

the example code for at91samG45 link
http://www.atmel.com/tools/SAM9M10-G45S ... CKAGE.aspx
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Wed May 30, 2012 5:50 am

With Keil you can build code that locates in Internal SRAM or External SDRAM. You can then download them onto the board and execute via SAM-BA. ie Initialize memory, download, go. SAM-BA is workable via Serial, USB or JTAG.

Basically you can define the memory used by "Options for Target -> Target" and defining the "ROM" and RAM addresses. Now both of these can actually point to different SDRAM addresses/regions. This is what ends up in the scatter file or linker script.

The slickest way however is to use the "SAM9260 Ext SDRAM - SAMICE" (or equivalent for your target). Build with one button, Debug and run with another. The debugger comes with a script (.INI) file that initializes the target memory by poking at the various registers in the CPU. If you reconfigure the debugger, you should be able to use a Keil U-Link to do this also. The SAM-ICE/J-LINK has the advantage as also being useable as a JTAG connection for SAM-BA.

You should look at the Blinky examples in Keil\ARM\Boards\Atmel\AT91SAMxxx-EK. If a specific target board does not exist, one could be built/cobbled together from a close neighbour.
manuelk
Posts: 9
Joined: Thu Feb 09, 2012 9:29 am

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Thu May 31, 2012 10:36 am

Hi,

thx for your fast answers =),

Have I misunderstood the whole one?

The Sam9x35 has inside only 32 K SRam. (the application must be smaller, still a little bit ram needs to work...)

Now he load the code (if he finde some code) with the Startup from the Flash (Nand or SPI.) in the internal SRAM.

If the code is bigger than ~ 24K, I must have a Bootstrap Loader (in the internal SRAM) to load my application in the external Ram.

I need a fast Boot Time (cant wait 5 - xxx Sek for a Linux), so i would run my Applikation with a Free Rtos Nativ in my Arm ...

I Use for my Application an IAR, but i think for the Bootstraploader this is insignificant.
Or am I wrong?

Thanks 4 Help =)
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Thu May 31, 2012 5:03 pm

There are several ways of addressing this, I'm not an IAR user, and I am more familiar with other SAM9xxx parts, but the techniques are generally applicable.

The 32KB of SRAM should be totally usable for CODE and STACK, initializing SDRAM for data storage shouldn't require much code. The 9260's AT91BootStrap can do this, and load NAND blocks in less than 4KB. The SDRAM could be set up in the C startup code, prior to copying the static allocations, etc, and then you could just tell the compiler/linker what address/size it has to work with.

On the SAM9x35 you have 32KB to work with as either the application if it fits, or a boot loader. This code can fit in a single NAND block (zero), and be loaded and run by RomBOOT.

ATMEL's demonstration of this is AT91BootStrap which can be built with a GCC/GNU tool chain, or as a Keil project. This typically initializes the SDRAM and copies two blocks from NAND (2x 128KB = 256KB) in SDRAM. This is the uBoot code, but could just as easily be your user application, and could be loaded at an address you code into the boot loader, and be of a size of your choosing, which could be quite significant. Several MB shouldn't be an issue, but the more you load, the longer it will take.

Realistically on a SAM9x35 you could almost certainly build a single step loader to pull in the entire linux kernel and execute it without using uBoot at all. Admittedly it wouldn't be feature rich, but would be serviceable.
jkrupp
Posts: 1
Joined: Fri Jun 01, 2012 7:30 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Fri Jun 01, 2012 10:15 pm

Yes, I too need a solution that doesn't take 1 minute to boot with an overblown OS.

I can run Atmel's examples in RAM, but need to see things run without the SAM-ICE attached!

Any bootloader gurus willing to submit a project that runs an Atmel example right after bootup?

Thanks in advance.
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Fri Jun 01, 2012 10:40 pm

jkrupp wrote:Any bootloader gurus willing to submit a project that runs an Atmel example right after bootup?
Sure I'm game, get me an SAM9X35-EK to play with.

CptTitanic@gmail.com
manuelk
Posts: 9
Joined: Thu Feb 09, 2012 9:29 am

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Mon Jun 04, 2012 5:09 pm

Hi CptTitanic,

thanks for your fast answer =),

aahhh .. okey so i can use the "Linux" Bootstrap with a littl change.

It is real pity that there is not already an Example from Atmel for those processors...

But okey, then I'll try it. As well as you have described it, this does not sound elaborately.

Thank you very much!
CptTitanic
Posts: 877
Joined: Sat Oct 30, 2010 6:04 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Mon Jun 04, 2012 5:49 pm

Start with the 9X5 project in this version of AT91BootStrap, rather then the 1.16 version they normally link too


ftp://ftp.linux4sam.org/pub/at91bootstr ... es_1.2.tgz
jS_868
Posts: 1
Joined: Mon Sep 05, 2016 3:11 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Wed Sep 07, 2016 3:22 pm

Hello everbody,

It has been four years since this topic has started, and I'm struggling with the same problem and I am total novice. Let me explain:

I have SAM9x35-EK Board, and I have succesfully managed to load AT91Bootstrap - uBoot - LinuxKernel - Angstrom to NandFlash using SAM-BA by following the steps in linux4sam/bin/view/Linux4SAM/LegacySAM9x5Page. It was nice to see the Angstrom logo in the display.

However, I could not make a simple standalone application work in the Serial Flash (AT25DF321) of the EK board. I'm using Keil u5 for development, and I have downloaded example software packages from (http://www.atmel.com/tools/SAM9X35-EK.aspx). I compiled the "getting-started" project (in which two leds are supposed to be blinked), and generated the BIN file.

- The first try: I loaded this BIN file directly to the SRAM (0x300000) using SAM-BA, but it did not work. (probably device does not boot)
- The second try: I tried to find a bootloader for the Serial Flash (AT25DF321) on the internet but I couldn't find. So I tried to use the bootloader example of KEIL, and I load the generated boot file using SAM-BA, and also I loaded the application code starting at 0x1000 of Serial Flash, so that the device will be boot from Serial Flash and write the Application to the SRAM but it did not work again.
- I know there is a At91Bootstrap project, and I could not figure out how I will generate a bootloader for the Serial Flash of SAM9x35 using this project.

Maybe I have mistaken at somewhere, but I am even not sure that I have the valid bootloader for Serial Flash. Therefore, I will ask the same question:

"What is the simplest way to download & run a simple standalone application on the SAM9x35-ek board without embedding OS? I would really appreciate some links, tutorials and of course direct comments & help!"

If I manage to work, than I will work on the Display, but so far it seems imposible.

Thank you in advance.
blue_z
Location: USA
Posts: 1505
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAM9x35-ek, Keil, Atmel SW package and SAM-BA, total nov

Thu Sep 08, 2016 1:17 am

jS_868 wrote:The first try: I loaded this BIN file directly to the SRAM (0x300000) using SAM-BA, but it did not work. (probably device does not boot)
"Did not work" is a worthless description of the symptoms.
"Device does not boot" is a guess on your part that does not provide any information.
You haven't described clearly what you did, and the resulting symptoms.

To verify that your u5 toolchain is producing good binaries, you should perform a sanity test by booting the getting-started...sram.bin (renamed to boot.bin) from a SDcard.
Booting from SDcard is the simplest and most direct method, according to the "Boot Strategies" section in the Atmel SoC datasheet.

Booting from SPI flash requires a valid ARM vector.
Booting from NAND flash requires an ONFI header and a valid ARM vector.
Booting from SDcard simply requires a boot.bin file.
Note that the instructions for making a bootable SDcard require a Linux host (because SDcard formatting by MS Windows is not consistent).
jS_868 wrote:"What is the simplest way to download & run a simple standalone application on the SAM9x35-ek board without embedding OS?..."
"Standalone application" and "without ... OS" are redundant descriptors.

If your app is small enough to execute in the internal SRAM of the SoC, then the solutions are simple (e.g. SDcard).
Otherwise your app must execute in the external DRAM, which requires a (second-stage) bootloader such as AT91Bootstrap.
Since this thread was started, AT91Bootstrap has been enhanced to support loading programs other than U-Boot.
An alternate configuration can have AT91Bootstrap load a standalone program to 0x20000000 in DRAM, and execute it.
Note that current versions of AT91Bootstrap (according to the README file) have only been verified with GNU GCC toolchains on a Linux host.

Regards

Return to “SAM9 ARM9 MPU”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests