I've got a project which includes separate OTA bootloader (Fixed Stack) and bootloadable / application code. I'm trying to implement some mechanism such that the application code can know the version of the bootloader code that's on the device.
Inside the OTA bootloader code, I've added the following code
#define FIRMWARE_VERSION_MAJOR 0x00
#define FIRMWARE_VERSION_MINOR 0x01
#define FIRMWARE_VERSION_BUILD 0x02
bootloader_firmware.major = FIRMWARE_VERSION_MAJOR;
bootloader_firmware.minor = FIRMWARE_VERSION_MINOR;
bootloader_firmware.build = FIRMWARE_VERSION_BUILD;
And then I've updated the linker file (cm0gcc.ld) to include the following two lines:
After making those updates, I've compiled the bootloader project and run the mk.bat script without any problems/errors/warnings. Then I've updated my application code to include the following:
In the header file:
extern BTL_FIRMWARE_VERSION GetBootloaderVersion(void);
In the .c file
BTL_FIRMWARE_VERSION bootloader_firmware = GetBootloaderVersion();
However, when I compile the application code, I get an error on the line above in my .c file which states "Build error: undefined reference to 'GetBootloaderVersion'.
This leads me to believe that I am doing something wrong with the linker script and the function is getting optimized out of the bootloader, but I'm not sure what else I should try, as I'm having NO problem sharing all the relevant BLE stack functions between the bootloader and the application with the linker script in the same fashion.
Any insight or suggestions on how I can easily achieve this would be greatly appreciated! Thanks in advance!