Hi,
I have one question about Cortexm3 from smartfusion device from actel. Could you pls help me?
from <keil uvision and actel smartfuison>, I know how to implement Flash target and RAM target.
Flash target mode: download and run from inner flash memory and RW data are placed in inner ram space. Ram target mode: run from inner ram space and RW data are placed in inner ram space.
However the two modes will result from below two potential problems:
(1) flash target modes will bring up speed limits. You know max speed is only 80Mhz when the program runs from inner flash memory.and speed will become to be up to 100Mhz when program runs from inner ram.
(2) ram target modes can't make programs work when the board are re-power-cycled.
I'd like to implement following function to overcome the above problems:
(1) all executed codes are downloaded to flash memory space firstly (2) then these codes are copied to inner ram space automatically (3) PC are pointed to new RAM address so as to program runs from inner ram.
I don't know how to implement it. Anybody can help me to get one example? or guidelines?
Thank you very much.
BR
Fisher
http://www.keil.com/support/docs/3228.htm
thanks for your reply.
I checked with your linker. it works. however, when I close keil GUI firstly and power off and then power on my board again , I find that the program doesn't run. In other words, your link only enable it work in debug mode of Keil IDE. I need it still work when my board are at my customer's hand as normal production.
Looking forward to help. Thanks.
BR, Fisher
1) It isn't "my" linker. This is not an official Keil support forum. This is an end-user forum.
2) The Keil linker can link functions so that they are stored in flash, and copied to RAM when the program starts - all accesses to the function will be made into RAM. This is quite commonly used for individual ISR or maybe code that needs to reprogram flash sectors.
However, the solution described in the link won't work when keil-mkd is closed, board is re-power cycled or ulink2 emulator is plugged out. Anybody knows how to enable it work even in above circumstances? I don't want it work in debug mode only.
BR,
Look, you don't understand any of this - what you want have nothing to do with the debugger but with scatter loading. The linker user manual clearly indicates how to load code into RAM as part of scatter loading. Have you bothered to read the user manual?
As I need everything run from inner ram, I set up scatter file as following. However it doesn't work.
LR_IROM1 0x00000000 0x00040000 { ; load region size_region RW_IRAM1 0x20000000 0x00010000 { ; execute region size_region *(InRoot$$Sections) .ANY (+RO) .ANY (+RW +ZI) } }
Here is error information, .\f\Blinky.axf: Error: L6202E: __main.o(!!!main) cannot be assigned to non-root region 'RW_IRAM1'
How can I remove it?
Please use the proper tags when posting source code !
LR_IROM1 0x00000 0x40000 { ; load region size_region ER_IROM1 +0 0x1000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } IRAM 0x40000000 0xE000 { ; RW data RT_EVENT.o (+RO) } }
Assuming you want the code in "rt_event.c" to be loaded in RAM upon startup.
LR_IROM1 0x00000 0x40000 { ; load region size_region ER_IROM1 +0 0x40000 { ; load address = execution address *.o (RESET, +First) *(InRoot$Sections) .ANY (+RO) } IRAM 0x40000000 0xE000 { ; RW data RT_EVENT.o (+RO) } }
Assuming you have an LPC2478. The addresses for your device will differ!
However your scatter file makes codes run from 0x0 address, which belongs to flash address space in my devices. it actually violate my thoughts: everything run from inner ram address space.
Post your file here, USING THE PROPER TAGS
I should have said: the addresses of internal RAM will differ!
in my device: Inner Flash address space : 0x0 to 0x00040000 Inner ram address space : 0X20000000 to 0x20010000
Below is my scatter file. It doesn't work actually.
LR_IROM1 0x00000000 0x00040000 { ; load region size_region ER_IROM1 0x20000000 0x00008000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20008000 0x00008000 { ; RW data .ANY (+RW +ZI) } }
Thanks.
This statement ".ANY (+RW +ZI)" should be replaced by something like this:
"<module name.o> (+RO)"
where module name is the name of the C file containing your code (see above example). You can use linker sections to place certain functions in RAM, not all the code in a module (see manual).
(1)I find when load region start address is different from execute region start address (here LMA start address is 0x0 and EMA start address is 0x20000000), below error information will occur:
\f\Blinky.axf: Error: L6202E: __main.o(!!!main) cannot be assigned to non-root region 'RW_IRAM1'
(2) according to your reply, only part of codes or certain functions can be copied to ram space automatically rather than all. right?
Right.