Loswy Loswy - 1 year ago 49
C Question

Function call by address from map file of another project

Hi everyone here is my issue.

I have two distincts projects, first has a linker file mapped as the following:

MEMORY
{
rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x0000C400
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}


Second a linker file as the following:

MEMORY
{
rom (rx) : ORIGIN = 0x0800C400, LENGTH = 0x00019CFC
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}


Both of the projects runs on the same MCU and are burned in flash separatly. In my second project I would like to map pointers on functions declared in the first project. I tried the code below but it doesn't work, at execution debugger tels me that the symbol could not be found, but according to the .map file of the first project the address (0x0800458C) is mapped on the function I want to use.

uint32_t (*Myfunction)(void);

int main(void)
{
Myfunction = ((uint32_t(*) (void)) 0x0800458C); // address in the first project
Myfunction();
}


Does anybody have experienced this ?
Thanks !!

EDIT: It seems to work with Keil IDE when in directly include .symbols file in project. But with CoIDE (eclipse based) it doesn't work. I'm still trying to figure out this issue.

Answer Source

Did you try this: Linker script: insert absolute address of the function to the generated code

I think the last answer might be what your looking for.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download