Skip to main content
Visitor II
March 26, 2025
Question

jump function

  • March 26, 2025
  • 1 reply
  • 304 views

I have jump function this like that but this method don't work. Please I need help immedietly

void jumpToAddress(uint32_t jump_address)
{
void (*jumpFunction)(void);
static constexpr uint32_t SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER = 4;
static constexpr uint8_t NVIC_REGISTER_LENGTH = 8;

SCB_DisableDCache();
SCB_DisableICache();

__disable_irq();

SysTick->CTRL = 0;

HAL_RCC_DeInit();

for (uint8_t i = 0; i < NVIC_REGISTER_LENGTH; i++)
{
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
}

SCB->VTOR = jump_address;

__set_MSP(*((uint32_t *)jump_address + SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER));

jumpFunction = (void (*)(void))(*((uint32_t *)((jump_address + SHIFTED_JUMP_ADDRESS_DUE_TO_RESET_HANDLER))));
__enable_irq();
jumpFunction();

while (1);
}

 

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    March 26, 2025

    Hello,

    Please use </> button to share your code.

    See the tips on this link. I'm editing your post.

    Thank you for your understanding.