2021-04-29 03:42 AM
Hello all.
I'm trying understand SBSFU source code. At this time, I meet very confuse code.
Middlewares/ST/STM32_Secure_Engine/Core/se_interface_bootloader.c
In the SE_Startup() function, there is function pointer casting code as below:
SE_StartupPtr = (SE_ErrorStatus(*)(void))((uint32_t) SE_STARTUP_REGION_ROM_START + 1U);
SE_STARTUP_REGION_ROM_START point to SE_CORE_Startup() function.
What I want know is why pointer address is "SE_STARTUP_REGION_ROM_START + 1U" rather than "SE_STARTUP_REGION_ROM_START".
Even worse, "SE_STARTUP_REGION_ROM_START + 1U" is not pointer align.
What do I miss understood about this code?
Thanks.
2021-05-04 11:00 AM
Hi,
Not 100% sure but my guess is that as we are using Thumb code, function address has bit 0 set to 1 (to distinguish from ARM code which is anyway not supported on CortexM).
Best regards
Jocelyn