Hello! I'm working on a In Application Programming solution for an STR711 Microcontroller. There are some reasons for me, to execute the routines, which will write the flash banks from RAM. So here is my question: I compiled this routines for executing them in RAM. I reserved some space for this code by defining a new memory range in the linker script ( .ld ) MEMORY { IntCodeRAM (rx) : ORIGIN = 0x00000000, LENGTH = 256k ReservedRAM (rw) : ORIGIN = 0x20000000, LENGTH = 2k IntDataRAM (rw) : ORIGIN = 0x20000200, LENGTH = 62k } It works, but does someone knows a more flexible method? The main Problem is, i think, to find an empty space in RAM. Thanks, Stefan
> IntCodeRAM (rx) : ORIGIN = 0x00000000, LENGTH = 256k > ReservedRAM (rw) : ORIGIN = 0x20000000, LENGTH = 2k > IntDataRAM (rw) : ORIGIN = 0x20000200, LENGTH = 62k 0x200 is 512, not 2048 (2K).
A.K. wrote: >> IntCodeRAM (rx) : ORIGIN = 0x00000000, LENGTH = 256k >> ReservedRAM (rw) : ORIGIN = 0x20000000, LENGTH = 2k >> IntDataRAM (rw) : ORIGIN = 0x20000200, LENGTH = 62k > > 0x200 is 512, not 2048 (2K). Thanks, just a little typing error. But this isn't the Problem. Regards, Stefan
To permanently place some functions in RAM, you do not have to define a separate memory region. The linker script can place them the into the same RAM memory region as the data.
As already mentioned by A.K. an extra entry in "MEMORY" is not needed. You could simple try use this function attribute: _attribute_ ((long_call, section (".data"))) This will assign the function declared with the attribute to the ".data". No modification in the linker-script should be needed for this. An addtional section (i.e. ".fastrun") might be useful later since the locations of such extra sections can be changed easily in the linker-script without side-effect on the "real" .data. May serve as examples: http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index.html#gcc_ramfunc http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_gamma both not for STR711 but the method is not target-dependent Martin Thomas
Martin Thomas wrote: > As already mentioned by A.K. an extra entry in "MEMORY" is not needed. > > You could simple try use this function attribute: > _attribute_ ((long_call, section (".data"))) > This will assign the function declared with the attribute to the > ".data". No modification in the linker-script should be needed for this. > > An addtional section (i.e. ".fastrun") might be useful later since the > locations of such extra sections can be changed easily in the > linker-script without side-effect on the "real" .data. > > May serve as examples: > http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index.html#gcc_ramfunc > http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_gamma > both not for STR711 but the method is not target-dependent > > Martin Thomas Hello! At first, thanks for all your help. I read and tried the examples above. The Problem is, that i don't want to place the code permamently in RAM. I don't want to wast 3kB of RAM, if I don't need the functions. Sorry guys, im very new to programming ARM. Regards, Stefan
If you have several functions to execute in RAM, but need only one at a time placed there, look for the "Overlay" command in the GNU LD documentation: http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_chapter/ld_3.html
Martin Thomas wrote: > As already mentioned by A.K. an extra entry in "MEMORY" is not needed. > > You could simple try use this function attribute: > _attribute_ ((long_call, section (".data"))) > This will assign the function declared with the attribute to the > ".data". No modification in the linker-script should be needed for this. > > An addtional section (i.e. ".fastrun") might be useful later since the > locations of such extra sections can be changed easily in the > linker-script without side-effect on the "real" .data. > > May serve as examples: > http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index.html#gcc_ramfunc > http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_gamma > both not for STR711 but the method is not target-dependent > > Martin Thomas Dear Martin, I have a quiestion about the function attribute, i want to write some bytes to flash. My function is located in RAM, this works only with functions without function arguments. Suppose you have a flash write function with address and data arguments. Can we pass this arguments as well. Regards, Bram Dobbelaar #define FASTRUN _attribute_ ((long_call, section (".data"))) FASTRUN void Erase_sector1(void); FASTRUN void Word_program(void); FASTRUN void FLASH_WWrite(u32 XtargetAdd, u32 Xdata); u32 Addres,data;
Bram Dobbelaar wrote: > I have a quiestion about the function attribute, i want to write some > bytes to flash. My function is located in RAM, this works only with > functions without function arguments. Suppose you have a flash write > function with address and data arguments. Can we pass this arguments as > well. I have not noticed this before. Can you step though the code with a debugger to see what is going on?
Martin Thomas wrote: > Bram Dobbelaar wrote: >> I have a quiestion about the function attribute, i want to write some >> bytes to flash. My function is located in RAM, this works only with >> functions without function arguments. Suppose you have a flash write >> function with address and data arguments. Can we pass this arguments as >> well. > > I have not noticed this before. Can you step though the code with a > debugger to see what is going on? Thanks for you're answer. I have an another probably related problem. I can erase flash and write word in flash memory (i use the attribute as mentioned ). It only works one time after programming the flash. After a power down and up the copied function in RAM are not working. Do i need to change the linker script to be sure the ram functions are loaded in memory. I want to make a flash table that can be changed (error correction for a sensor application). Probably i will do this in eeprom, but my eeprom was to small, so i thought maybe a table in flash is possible. Regards, Bram Dobbelaar
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.