I have the need to relocate some code to RAM for execution but also need to execute the same code at its load address. I believe that this is possible with ARM ISA and PC relative addressing. I tried to use CODE_SECTION pragma with load and run addresses in the linker.
Linker script
.foo {} load > FLASH run > RAM
palign (4)
LOAD_START(FooLoadStart)
RUN_START(FooRun)
RUN_SIZE(FooSize)
in C code load address is used as
extern void FooLoadStart(void);
FooLoadStart();
and run address call uses direct Foo() call.
Original Foo code"
#pragma CODE_SECTION (Foo, ".foo")
void Foo(void) {}
The issue is that trampoline which was generated for load address call with 4.6.4 was incorrect (jumps to 0) run trampoline is correct. What is missing?
Thanks,
Eugene