We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi!
I hope that you still fine.
I use the LPC2138,and i know that all functions which i write stay in ROM. Now i triying to copy one of these functions to the RAM,but i don't find the solution. I have triying with memcpy,but unsuccessfully. Can anyone help me?
Thanks Best regard
I have found a example how to define a function in RAM(C:\Keil\ARM\RV30\Examples\RAM_Function). But after debuggging when i look in the map.file i realise that this function still stay in ROM. and i don't have her adress in RAM so that i would be able to use the IAP function(copy RAM to flash).
please help me to get a solution.
Best regard
Note that when you need initialized data or code in RAM, the linker has to place he information in ROM and the initialization code can then copy the information to RAM when the system is booting.
When a compiler + linker supports placing initialized data in RAM, it will generate all address references in the code as if the data was in RAM, but will store a copy of the data in ROM. After the init code have moved the data, you will access it just as if it had been in RAM from the beginning - your program will not know that there is a (possibly compressed) copy of the data somewhere in the ROM image.
If the information was immediately placed in RAM, you would be able to send the information to the chip using a JTAG interface or similar, but you would loose that information as soon as the chip lost power or was reset.
Thank you so much for this important information.
If the information was immediately placed in RAM, you would be able to send the information to the chip using a JTAG interface or similar
Until now i can't see the function in the RAM and that blocks me for using IAP function, because i need the address of the function in RAM so that i will be able to use IAP command: copy RAM to flash.
I am thankfull for any help.
Best regards.
Hallo every body!
Can somebody tell me whether i need the RAM address of the function for IAP programming in this example? And the definition of the function from sector number i don't realy understand that.Can you try to explain to me?.
unsigned int get_secnum (unsigned int addr) { unsigned int n; n = ((unsigned int) addr >> 13) & 0x1F; // pseudo sector number if (n >= (0x30000 >> 13)) { n -= 14; // high small 8kB Sectors ( } else if (n >= (0x10000 >> 13)) { n = 7 + (n >> 3); // large 64kB Sectors } return (n); // sector number }
unsigned int program (unsigned int flash_addr, unsigned char *data, unsigned int size) { struct iap_in iap; // IAP input parameters unsigned int result[16]; // IAP results unsigned int save_VicInt; // for saving of interrupt enable register save_VicInt = VICIntEnable; // save interrupt enable status VICIntEnClr = 0xFFFFFFFF; // disable all interrupts #ifdef BYPASS_IAP stop_pll(); // IAP requires to run without PLL #endif iap.cmd = 50; // IAP Command: Prepare Sectors for Write iap.par[0] = get_secnum (flash_addr); // start sector iap.par[1] = iap.par[0]; // end Sektor iap_entry (&iap, result); // call IAP function if (result[0]) goto exit; // an error occured? iap.cmd = 51; // IAP Command: Copy RAM to Flash iap.par[0] = (unsigned int) flash_addr; // destination-addr iap.par[1] = (unsigned int) data; // source-addr iap.par[2] = size; // number of bytes iap.par[3] = 12000; // CPU clock in kHZ iap_entry (&iap, result); // call IAP function exit:
char var[512];
int main(void){ erase (0x30000, 0x31FFF); program (0x30000, var, sizeof (var)); }
please i realy need your Help.
tanks.
Somebody tall me that it is not possible to use IAP programming with the evalution version of the RealView.Is that true?
Best regards
Theirs should not be any problem in using IAP function in evaluation version. You dont need to copy any code to RAM for IAP.
Just be sure your IAP execute routine is their. If its in assembly normally it will hve .
Store your present registers along with return address.
a call to location (0x7FFFFFF1). This will give a call in thumb mode.*** This is a branch to the IAP function.
Relaoad values of registers from stack Return to mail program.
Also be sure your buffer (RAM) is word alligned.
Suvidh