This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Building hex file with external function

Hello,

I want to build a system where all the standard functions are already in FLASH (something like a BIOS), this is no problem to generate this.

But, how can I build and link/locate an other application without having the functions which are already in the flash.

So how can I tell the linker/locator that the library functions are available and are at there addreses?

Regards Mark,

  • I think that you will not be able to build your application with unresolved objects. I have not tried (just compiled) but I think you just can define your functions using the addresses as follows:

    #define MY_FUNC_ADDR 0x1000000
    typedef void (*func_t) (void);
    func_t my_func = (func_t) MY_FUNC_ADDR;
    ...
    my_func();
    


    Thomas

  • As Thomas suggested, you should be able to locate the BIOS functions at certain addresses and call them using those addresses. It can be done with macros:

    #define bios_func ((void (*)(void))0x123456)
    ...
    bios_func();
    


    If the BIOS uses any static variables, you must make sure they don't clash with the main program's variables.