How to create a warm reset

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a warm reset

799 Views
kamal1
Contributor III

I am currently running a custom project using a board based of the MIMXRT1050 Corext M7 involving a bootloader stored at the start of flash at 0x6000_0000 and a external sdram project stored at 0x8000_0000. When I put power to my board, it will start in bootloader in flash then jump to external ram for execution. External ram is its own project and bootloader is its own project, this is all working fine.

 

Now I am attempting to add a warm_reset function to my external ram project so that it will jump back to the beginning of SDRAM at 0x8000_0000. The issue is that when I attempt to jump, my program hangs. I am also running RTX5 RTOS in my SDRAM project.

 

I found this function, NVIC_SystemReset(), but this will reset my board back to flash bootloader.

I have tried adding these functions to my warm_reset function but nothing seems to be working:

__DSB()

__ISB()

__disable_irq()

SCB_InvalidateDCache()

SCB_EnableDCache()

SCB_CleanDCache()

SCB_InvalidateICache()

SCB_EnableICache()

SysTick->CTRL &= ~0x00000002; // disable SysTick interrupt

SCB->VTOR; // change the Vector table offset register

osKernelSuspend()

osThreadSuspend(main_thread)

 

__asm void warm_reset(void) {

MOV r0,#0x80000000 //load address of reset vector

BX r0 //branch to start of code }

 

The goal is to jump back to the beginning of SDRAM execution and avoid going back into bootlader in Flash.

My questions are:

Do I need to stop the RTOS before attempting to jump back to the start of SDRAM?

What are the correct commands to jump back to main and restart the program?

Any examples of a warm_reset using a bootloader?

Labels (1)
0 Kudos
3 Replies

772 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @kamal1,

I'm not entirely sure about this implementation since usually when needing a software reset and to not waste to much time in the debugger a direct boot flag could be enabled to let the bootloader know that it need to execute the image immediately.

In the case you want to do the warm reset that you mention, I think the implementation would be pretty similar to when in the bootloader the image is called:

  • Shutdown and clean all the peripherals and clocks.
  • Create an API that points to the address you want to jump.
  • Move the Process Stack Pointer
  • Move the Main Stack Pointer
  • Called the API created.

Best Regards,
Alexis Andalon

0 Kudos

767 Views
kamal1
Contributor III

@Alexis_A 

Do you have any example code or write ups on how to accomplish each step?

I know how to create and call an API that points to the address I want to jump to, but I cannot find any information on the rest of the steps specifically shutdown and cleaning of all the peripherals and clocks.

0 Kudos

763 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @kamal1,

In the RT1050 SDK there's a example called flashloader in the bootloader section, the API is called jump_to_application.

Best Regards,

Alexis Andalon

0 Kudos