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.
Hello. I want to relocate some function’s from Flash to a different position in PSRAM for a bootloader.
The problem is: Keil generates absolute jumps in the original function. With relative jumps whould it work.
I have copied the original functions to the RAM like this: ------------ Flash function a at 0xC01000 ------------ Flash function b at 0xC02000 ------------ Flash function c at 0xC02800 ->(to copy in RAM at 0xE00000) ------------
Now I copy the c-function from 0xC02800 to RAM at 0xE00000.
The Problem: In the function c is a IF cause, that jumps to the end of the function at 0xC02872:
JMPA cc_UC, 0xC02872 ( +72 Bytes)
If i execute this copied function at the new position (E00000), the jump is located to E02872
JMPA cc_UC, 0xE02872 ( + 2872 Bytes)
and not to 0xE00072 ( + 72 Bytes).
Is there a compiler switch to generate relative jumps (JMPR, CALLR) instead to absolute Jumps (JMPA+,JMPA-,CALLA)?
Or is there a other solution for this problem?
(I need to use the HCompact model, to access all functions and the whole address-space for variables.)
Thanks
Maybe the APNT_138 will solve your problem (http://www.keil.com/appnotes/files/apnt_138.pdf). A few years ago i programmed a flashbootloader for the ST10F27x series. While programming the flash this controller is not able to fetch code from it. That's why the flash routines must run in RAM.
I used the L166 SECTION dircetive. With this directive you can configure seperate execution and storage adress for your code. Before execution of the code you must manually copy this code into RAM.