Re: Confused about Flash
- From: "Arlet" <usenet+5@xxxxxxxxxxxxxxxxx>
- Date: 4 Nov 2006 08:01:25 -0800
Rene Tschaggelar wrote:
yes, the hard part is to have the Code in the RAM while
doing the flash and hope the power stays on. Copy the
code from Flash to the RAM, jump to it, and when it is
done, whatever was done, do a clean reset. Since the code
copied from the flash to the RAM is on a different adress,
the code shouldn't contain any absolute jumps. Hmm, yes,
the interrupts... This procedure used be done 20 years ago.
This is easily done by adding an appropriate section in the linker
script file. You'll have to set the address to a RAM address, and the
storage to somewhere in the flash. During code init, you initialize the
RAM by copying the code, using symbolic labels that the linker
provides, or that you add to the linker script yourself. The exact
mechanism depends on the tool chain. It is very similar to the section
that hold the initialized data in RAM, so it could be just a matter of
copy/paste a few lines in the existing linker script, and make a few
modifications.
This way, you can use absolute addresses, and just call the functions
as normal code. The compiler/linker will take care of the details.
Vital interrupt handlers can be programmed in RAM, or another available
memory area in the same way. Less critical interrupts can be disabled
during flash programming/erasing.
If the CPU has cache support, you may be able to run the code from
flash, as long as you can guarantee all the code is actually in the
cache (some CPUs allow code to be locked in the cache).
.
- Follow-Ups:
- Re: Confused about Flash
- From: John Larkin
- Re: Confused about Flash
- From: Rene Tschaggelar
- Re: Confused about Flash
- References:
- Confused about Flash
- From: John Larkin
- Re: Confused about Flash
- From: Rene Tschaggelar
- Confused about Flash
- Prev by Date: Re: Another fine Republican Evangelist
- Next by Date: Re: curved mosfet idea
- Previous by thread: Re: Confused about Flash
- Next by thread: Re: Confused about Flash
- Index(es):
Relevant Pages
|