AnsweredAssumed Answered

Unable to understand the logic in Bootloader to test if user code is present at application address

Question asked by ramya on Feb 24, 2016
Latest reply on Feb 24, 2016 by Clive One

In the examples provided for STM32(STM32L476G_EVAL), there is a logic written to test whether user code is present in the application address before jumping.

    /* Test if user code is programmed starting from address "APPLICATION_ADDRESS" */
    if (((*(__IO uint32_t*)APPLICATION_ADDRESS) & 0x2FFE0000 ) == 0x20000000)
    {
      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);
      JumpToApplication = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);
      JumpToApplication();
    }

I am unable to understand why 0x2FFE0000 is used to AND with the value of the APPLICATION_ADDRESS. Can someone help me with this?

Outcomes