2025-02-13 02:22 AM - edited 2025-02-13 02:46 AM
Hello all.
I'm writing an application using an STM32WL33 device, actually facing continuous problems related to the documentation and SDK, that seems to suffer (understandable) youth issues.
After having solved many, I came now to several problem I can't solve, related to the embedded bootloader and the startup sequence:
- Reference manual (RM0511 rev 3) states: "ST provides a boot loader executed after each CPU reboot. This boot loader has its own documentation. ". Can't find that documentation.
- Reference manual (RM0511 rev 3) states about the ResetReason (address 0x20000010):
Copy of last reset reason from register RCC_CSR. The register is read, copied to this location by the bootloader code and finally cleared. As a consequence, software reading the register always reads 0. Users should read this location to know the last reset reason |
That address is pointed by the mirror variable RAM_VR.ResetReason..
Even if the boot loader should clear RCC_CSR, the first row of Systeminit (called by startup....s) is:
"if ((RCC->CSR == 0) && ((PWR->IWUF != 0) || (PWR->WUFA != 0) || (PWR->WUFB != 0)))"
why does it check for (RCC->CSR == 0)? is this the error, or actually BootLoader is not clearing?
- Again, about WakeUpFromSleepFlag (0x2000000C0), the reference manual states:
Used by the LPMmodule. Indicates whether the system has been woken up from Deepstop mode |
But that location is not initialised or starts from an unspecified value, and it is set to 1 by startup in the previous "if" statement block. Ho can I use it if it is normally uninitialised?
- In the startup Systeminit, I find these two rows:
SCB->VTOR = (uint32_t) (__vector_table);
RAM_VR.AppBase = (uint32_t) SCB->VTOR;
Where __vector_talbe points to that row:
__vector_table:
.word _estack
Reference manual states for AppBase memory address::
Relocation of application base. The Bootloader jumps to the location pointed to by this value when a wakeup from DeepStop occurs. |
this seems to say that, after a deep stop, the Bootloader should eventually jump to
.word _estack, that does not look like an executable instruction so....how the hell??
All that said, the final question is: I need to udnerstand the resetreason as my product must behave in a totally different way according to that, how can I get the information I need?
thank you for all the help you can give
regards
Cristiano