cancel
Showing results for 
Search instead for 
Did you mean: 

On SBSFU, Secure Engine's SE_CORE_Startup() function pointer question.

SKim.24
Associate

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.

1 REPLY 1
Jocelyn RICARD
ST Employee

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