Hi Stefano Voulaz,
Some test result on my side.
In the previous time, I use the __ramfunc at the BOARD_BootClockRUN, and the internal related API, it's not working.
Then, I modify the BOARD_BootClockRUN function, copy the whole and the internal related API to the flash address 0x60005000, in the IAR linker file, divide one flash section to put these API.
Use the following code to put in the specific flash area
#pragma default_function_attributes = @ ".xtal24mhz"
Related API
#pragma default_function_attributes =
Linker file related code:
define symbol m_text1_start = 0x60005000;
define symbol m_text1_end = 0x60FFFFFF;
place at address mem:m_text1_start { section .xtal24mhz };
In the MCUbootUtility OTFAD side, I just secure the no BOARD_BootClockRUN code.

Then modify the led_blinky code:
int main(void)
{
unsigned int i, j;
BOARD_InitPins();
Flash_bootclockrun();
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}
while (1)
{
SysTick_DelayTicks(1000U);
if (g_pinSet)
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 0U);
g_pinSet = false;
}
else
{
GPIO_PinWrite(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, 1U);
g_pinSet = true;
}
}
}
After the OTFAD secure, the led is blinking now.
I share you the related led_blinky.c and the linker file, you can test it on your SDK led_blinky code in the IAR version.
But, to be honest, I find it still has some issues, eg, if I add BOARD_InitDebugConsole(); then the OTFAD secure even failed, I am still trying to find the root issues.
Because our internal expert is really busy, then the talk and reply will have delay, anyway, I will do more testing on my own side.
This time, I think you can use my code and method to test it on your side, whether it also works for you or not?
Any updated information, please kindly let me know.
Thanks so much for your effort and patient.
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------