Sign in

username:

password:



Not a member?

Search AT91SAM



Search tips

Subscribe to AT91SAM



Ads

Discussion Groups

Discussion Groups | AT91SAM ARM | final steps to getting my own boot loader to work

For users of the Atmel AT91SAM7 and AT91SAM9 ARM CPU chips. Atmel has taken a new direction by combining on chip flash and ram with the ARM CPU on a single die. This provides low cost devices for small systems using the ARM CPU. This group is to exchange information to help users get started and learn how to use the devices.

final steps to getting my own boot loader to work - fa50_pilot - Feb 3 23:42:55 2008

I've written my own USB bootloader and it is ALMOST working. I'd like to describe my
approach and ask for any ideas on what is wrong.

First, I'm using IAR C-compiler, my own hardware with an AT81SAM7S256 mpu with USB.

All bootloader and USB stack code is located at 3B000 (top 16 k of the 256 flash), and will
only allow updating of the lower 240k (more than enough for my application). My
application starts running from 0 (reset vector) and run the normal C-startup code from
IAR. (this works fine).

To update my application, the app passes control to my bootloader which reads an Intel
Hex formatted file via usb and flash each page as it is received. (Remember I will only write
flash that is below 3B000 so as to not change my bootloader while running). (this works
fine and successfully re-writes all flash).

An interesting case is that I delay writing page 0 of the flash until the very last moment
(because of the interrupt and reset vectors located there). I know it must be delayed
because my loader crashes early on if I write page 0 as it is received.... but by only writing
page 0 as the final task before trying to restart, it all seems OK).

So - the problem is that after flashing everything and then page 0, my 'new' code does not
run! Hitting my reset button does not seem to init the processor, leading me to believe
there are some steps I am missing. The 'new' code does of course contain a full image
including IAR's startup code which is what I am expecting to start running when I hit my
hardware reset.

Any ideas? Thanks much. -steve-



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )


Re: final steps to getting my own boot loader to work - Foltos - Feb 4 2:41:12 2008

Hi,

updating any page (your case page 0) which has mission critical content
for the boot-loader is risky. What happens if there is a power failure
while you are reprogramming page 0? The boot-loader is dead, and you
loose access to the chip (ok other means like JTAG will still work, but
you can not use these on the filed).
So why don't you put your boot loader to the first sector and remap the
vector table?

Foltos

fa50_pilot wrote:
>
> I've written my own USB bootloader and it is ALMOST working. I'd like
> to describe my
> approach and ask for any ideas on what is wrong.
>
> First, I'm using IAR C-compiler, my own hardware with an AT81SAM7S256
> mpu with USB.
>
> All bootloader and USB stack code is located at 3B000 (top 16 k of the
> 256 flash), and will
> only allow updating of the lower 240k (more than enough for my
> application). My
> application starts running from 0 (reset vector) and run the normal
> C-startup code from
> IAR. (this works fine).
>
> To update my application, the app passes control to my bootloader
> which reads an Intel
> Hex formatted file via usb and flash each page as it is received.
> (Remember I will only write
> flash that is below 3B000 so as to not change my bootloader while
> running). (this works
> fine and successfully re-writes all flash).
>
> An interesting case is that I delay writing page 0 of the flash until
> the very last moment
> (because of the interrupt and reset vectors located there). I know it
> must be delayed
> because my loader crashes early on if I write page 0 as it is
> received.... but by only writing
> page 0 as the final task before trying to restart, it all seems OK).
>
> So - the problem is that after flashing everything and then page 0, my
> 'new' code does not
> run! Hitting my reset button does not seem to init the processor,
> leading me to believe
> there are some steps I am missing. The 'new' code does of course
> contain a full image
> including IAR's startup code which is what I am expecting to start
> running when I hit my
> hardware reset.
>
> Any ideas? Thanks much. -steve-
>
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )

Re: final steps to getting my own boot loader to work - fa50_pilot - Feb 10 15:03:15 2008

Good suggestion! I am currently working on moving main() (and C-startup) to the
bootloader (protected) area which will check to see if its bootloading or running the
application, and then dispatch accordingly. That way I will NOT be changing page 0 (its
become part of my 'protected' area) and if the load fails a reset should re-run the boot
loader. Thanks

--- In A...@yahoogroups.com, Foltos wrote:
>
> Hi,
>
> updating any page (your case page 0) which has mission critical content
> for the boot-loader is risky. What happens if there is a power failure
> while you are reprogramming page 0? The boot-loader is dead, and you
> loose access to the chip (ok other means like JTAG will still work, but
> you can not use these on the filed).
> So why don't you put your boot loader to the first sector and remap the
> vector table?
>
> Foltos
>



(You need to be a member of AT91SAM -- send a blank email to AT91SAM-subscribe@yahoogroups.com )