ARM MDK 3.4: module / function startadress. I would like to have a flash programming function on a specified address (0xf000) from where the normal program can be updated. This would be a simplified approach for ISP. If something goes wrong, JTAG will solve this problem. I could not find a linker control which would allow this. I already searched forum, with no success.
Functionality: a) first installed program (0x0000..<0xf000) contains ISP function on 0xf000 b) updated program (0x0000..<0xf000) does not contain ISP function, only absolut call to it.
Thanks for any hints Werner
www.keil.com/.../armccref_bcfjbabb.htm
that was quick: I define a section in the source code (Module ISP.C)
void CANLoadFlash(void) __attribute__((section("ISP_SECTION"))); void CANLoadFlash(void) { ISP code... }
then I get lost in the scatter loading file syntax, can't find an example for what I need.
right now it looks like this:
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x00000000 0x00020000 { ; load region size_region ER_IROM1 0x00000000 0x00020000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00008000 { ; RW data .ANY (+RW +ZI) } }
how do I locate my ISP_SECTION to 0x0000f000?
The are a few examples here: http://www.keil.com/support/man/docs/armlink/armlink_ccheecgi.htm Have a look at the Automatic placement section, it could be it.
thank you again. Tried to apply what I read there. Just don't know how to dig in, so I understand the concepts. Scatter Loading for Dummys would be nice:-)
void CANLoadFlash(void) __attribute__((section("ISP_SECTION __at_(0xf000)")));
does not do anything, maybe it would locate constants to this section but not the actual code of CANLoadFlash().
you can place your function(s) in a separate module, and map that module to a specific location via the scatter file, for example :
RW_RAM1 0xA0000000 0xA0FFFFFF { ; RW data SYS_IO.o (+ZI +RW) SYS_DEF_EXT_RAM.o (+ZI +RW) . .
Thank you, I still feel "in the dark". Is there a step by step explanation of the therms used for this scatter script language ie:
LR_IROM1 is this a reserved word? I can guess IROM1 means internal ROM, LR is not clear to me.
using the help system and it's examples just leads me to places, where experts that already know most of it understand it's full meaning, the introductional is too abstact/generic for me. Maybe I'm the only one here, maybe I'm getting old..
> Thank you, I still feel "in the dark". Is there a step by step > explanation of the therms used for this scatter script language ie:
LR_IROM1 0x00000000 0x00020000 { ; load region size_region
A load region describes the memory map before reloction, usually in a non-volatile memory.
The execution regions define both, the contents of the load region, as well as the memory map after relocation.
ER_IROM1 0x00000000 0x00020000 { ; load address = execution address
ER_IROM1 describes what can stay in flash for proper operation.
*.o (RESET, +First)
That would be the startup code including vectors. +FIRST means that this has got to be first in the region. The order in the scatter loading file has no impact on the actual order of elements.
*(InRoot$$Sections)
Some portions of the C-library have to be in flash as well. As a short hand, these are refered to by the name "InRoot$$Sections".
.ANY (+RO)
Any other read-only portions of the image (code, literal pools) go here.
} RW_IRAM1 0x20000000 0x00008000 { ; RW data .ANY (+RW +ZI) }
All variable go into RAM.
}
To get what you want, you'd have to divide your flash into two regions:
LR_IROM1 0x00000000 0x00020000 { ; load region size_region ER_IROM1 0x00000000 0x0000f000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } ER_IROM2 +0 (0x00020000-0x0000f000) { *.o (ISP_SECTION, +RO) } RW_IRAM1 0x20000000 0x00008000 { ; RW data .ANY (+RW +ZI) } }
Now all flash space between 0x0000f000 and 0x00020000 can be used for ISP. You will have to adapt this to your requirements.
> LR_IROM1 is this a reserved word? I can guess IROM1 means internal > ROM, LR is not clear to me.
The region names are just identifiers. Only some names have a special meaning (not reserved, though).
> Using the help system and it's examples just leads me to places, > where experts that already know most of it understand it's full > meaning, the introductional is too abstact/generic for me.
infocenter.arm.com/.../Degxrsh.html
And don't forget to tell MDK not to clobber your scatter file! Or give it a different name.
Regards Marcus http://www.doulos.com/arm/
An alternative to scatterfiles is using the Keil IDE to place your flash programming function.
- Place the function in a separate file flash_prog.c
- Under project > Options for Target > Specify a memory range starting at 0xF000
- Under Project â€" Option for File/Group, set the memory area 0xF000 for flash_prog.c under Memory Assignment â€" Code/Const.
An similar thing is done here:
http://www.keil.com/support/docs/3195.htm
> An alternative to scatterfiles is using the Keil IDE > to place your flash programming function.
This changes the scatter file, too. It's just that the dialog hides the details from the user. Being a GUI option it is not quite as flexible as hand coding. For simple cases definitely easier to use. Thanks.
thanks for your help. Using memory assignment in File / Group does work, and creates a sct file, where I see how it works. Somehow the default location except for startup becomes IROM2, so the standard group source and the libraries must be defined to belong to IROM1 otherwise they end up in the wrong place. Werner
Thanks Marcus, your extensive explanations gave me a good starting point. Checking out doulos.com made me order the C und C++ für Embedded Systems book.
Werner