Hot!Compiling loadable modules + UART bootloader.

Starting Member
  • Total Posts : 48
  • Reward points : 0
  • Joined: 2017/01/01 18:46:27
  • Location: 0
  • Status: offline
2018/01/10 17:13:56 (permalink)

Compiling loadable modules + UART bootloader.

Hello, I have an interest in developing a bootloader to be run off UART(I have a wireless serial link). 
I was wondering what the process of compiling a position independent module is in XC32 and getting it into a hex file to be loaded by the loader(I assume a hex file format would be the correct one for this right?)?
I would like to be able to selectively upload different modules which will be run by a scheduler. 
Has done something similar to this? 

1 Reply Related Threads

    Super Member
    • Total Posts : 350
    • Reward points : 0
    • Joined: 2011/09/19 22:01:53
    • Location: Rockledge, FL
    • Status: offline
    Re: Compiling loadable modules + UART bootloader. 2018/01/13 20:24:14 (permalink)
    never done this in an MCU, but if you look at what Windows does with DLL's (and I assume Linux SO are the same), the external access to the module is through function pointers and the beginning of the module is a list of names and function pointers.  In your case, the function pointers would be relative to start of module and the external code would need to assemble a function pointer from the module base address and encoded offset.
    You would need to make ALL of your jumps and calls use relative addressing - assuming that is possible.
    So your module would have:
    Module code...............
    Not sure what you can get away with in MPLabX, but I'll bet dimes to dollars this is not a standard setting for the linker :)   I am pretty sure that hex file outputs are based on loading to an absolute address.  Unsure what elf format might buy you.
    I am resisting the flippant "why would you want to do that?" answer, but let me ask if it is good enough to always load at a fixed flash target address and use absolute memory/function pointers?
    Jump to:
    © 2018 APG vNext Commercial Version 4.5