Question
Writing to address 0 prevents from entering shutdown mode
If I write to address 0, it prevents from entering shutdown mode.
The vector table is relocated to code.
As far as I understand, writing to address 0 in this case is not illegal. For sure it does not generates a fault.
The following code enters shutdown mode successfully:
#include "stm32wlxx_hal.h"
int main(void)
{
HAL_Init();
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_HIGH);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF1);
HAL_PWREx_EnterSHUTDOWNMode();
while (1)
{
}
}The following code fails entering shutdown mode:
#include "stm32wlxx_hal.h"
int main(void)
{
HAL_Init();
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_HIGH);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF1);
*(int *)0 = 0x20008000; // End of SRAM
HAL_PWREx_EnterSHUTDOWNMode();
while (1)
{
}
}I believe the second snippet should enter shutdown mode, or I missed something.
Regards