This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi
Actually i am storing the application code in flash (Bank 0, from Sector 4) ie the normal procedure in which TMS570LS3137 works. I am trying to erase same bank of flash using F021 Flash API. I would like to know how I can achieve it:
Hi Vinayaka,
You can't erase any sector in Bank0 from the application running in Bank0. There are 2 ways to erase the sectors in Bank0:
1. copy/execute your Flash API and Flash operation related code to RAM
2. place your application code in Bank1, then erase the sectors in Bank0
Please refer to the bootloader as a reference. The bootloader copies the flash related code to SRAM and executes Flash erase/write code in RAM.
Regards,
QJ
Hi QJ,
Thank you for your reply. I am working on first step(execute Flash API to RAM). I am working with a frequency of 160MHz.When i execute code, the software hangs in sys_intvecs.asm file. I have attached .cmd file and .c file.
Regards,
Vinayaka
Vinayaka,
1. From your linker command file, flash api routines are loaded in FLASH_API memory section. You have to relocate it to the run address before you make a call to those routines.
2. Make sure that all wrapper code like what you have in main() also relocated before you operate on the same bank. You don't want to cut the branch(bank!) you are standing on!
3. You can run the code from one flash bank while operating on another bank, like what you are trying to do - run code from bank 0 and erase/ program bank 7. You don't need to load/relocate if operating on different bank.
-Joe
Dear Joe,
I have some queries regarding this project.
1. How to relocate Flash_API to run address before to call those routines?
2. We are able to erase Bank0 sectors from Bank1 and vice versa. But it is not working for erasing Bank0 sectors from Bank0 itself.
Please find the attached source code.
1. Copy 'n' bytes from load address to run address, like memcpy(&api_run, &api_load, (uint32_t) &api_size), using the variables created by linker.
2. There are multiple posts here explaining why and running API+Wrapper routines from RAM is the workaround.