简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM