How can I place a variable at an absolute address? Pass value between bootloader hook and application.
Posted: Mon Mar 07, 2022 1:53 am
Hi,
I've been reading through various posts for a few hours now and I'm not really getting anywhere so hoping someone can give me some pointers.
I've written a custom bootloader (using hooks in IDF4.4) for ESP32 that allows me to still write/erase (but not read) everything other than the bootloader itself. This is for a commercial project and we need to be able to reprogram the devices even when encrypted and using secure boot (V2).
All I want to do is set a global at a fixed address in both the custom BL and the APP so that the app can read and store the BL version to present this to the associated cloud platform etc. I need the version in case we discover a vulnerability and I have to disable it (I've added an efuse for this).
I've looked at the docs for linker fragments and can't figure out if its possible to specify a section address. It sort of doesn't look like it will allow it? I'm trying to put it in the RTC slow memory, but don't really care where it is to be honest.
For example, I think I'm after something similar to this in my linker file (sorry, not an expert at linker stuff):
I'd appreciate any pointers anyone has! Preferably ones that don't involve modifying my IDF repo so it's not standard...
Thanks
I've been reading through various posts for a few hours now and I'm not really getting anywhere so hoping someone can give me some pointers.
I've written a custom bootloader (using hooks in IDF4.4) for ESP32 that allows me to still write/erase (but not read) everything other than the bootloader itself. This is for a commercial project and we need to be able to reprogram the devices even when encrypted and using secure boot (V2).
All I want to do is set a global at a fixed address in both the custom BL and the APP so that the app can read and store the BL version to present this to the associated cloud platform etc. I need the version in case we discover a vulnerability and I have to disable it (I've added an efuse for this).
I've looked at the docs for linker fragments and can't figure out if its possible to specify a section address. It sort of doesn't look like it will allow it? I'm trying to put it in the RTC slow memory, but don't really care where it is to be honest.
For example, I think I'm after something similar to this in my linker file (sorry, not an expert at linker stuff):
Code: Select all
.bl_meta 0x50000000 (NOLOAD):
{
. = ALIGN(4);
_bl_meta_start = ABSOLUTE(.);
*(.bl_meta)
. = ALIGN(4) ;
_bl_meta_end = ABSOLUTE(.);
} > rtc_data_location
Thanks