0

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.

5
  • 3
    So where did you get the map file from? Why can't you call the function directly, assuming the map file and your main() are in the same project (which seems to make sense)? Confusing. Commented May 19, 2017 at 12:49
  • The map file comes from an other project that is in memory of my MCU. I'm building a second project that needs to use functions created in my first project. That's why I can't call the function directly. Commented May 19, 2017 at 12:54
  • 2
    If you're writing for a freestanding MCU implementation, then it seems to me that you would want to build your whole image as a unit, and to load the whole thing as a unit. I see a wide variety of problems that might arise from trying to load two separate images or trying to merge multiple images into one before loading them. Commented May 19, 2017 at 14:32
  • Why not create a table which contains pointers to all functions, and then place that table in well defined address? That way you don't have to care where each function is, just read the address from the table. Commented May 22, 2017 at 6:30
  • I'm not sure to see how to do it. Can you provide me an example ? Commented May 22, 2017 at 7:53

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot ! Last answer was what I was exepecting, it seems to work as I was expecting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.