FAQ
- M051 Base Series(95)
- M0518 Series(97)
- M0519 Series(43)
- M0564 Series(1)
- Mini51 Base Series(90)
- Nano100/102 Base Series(101)
- Nano103 Base Series(10)
- Nano110/112 LCD Series(100)
- Nano120 USB Series(111)
- Nano130 Advanced Series(110)
- NUC029 Series(94)
- NUC100/200 Advanced Series(102)
- NUC120/122/123/220 USB Series(116)
- NUC121/125 Series(1)
- NUC126 USB Series(2)
- NUC130/230 CAN Series(103)
- NUC131/NUC1311 CAN Series(98)
- NUC140/240 Connectivity Series(114)
- M451 Base Series(118)
- M451M Series(117)
- M452 USB Series(130)
- M4521 USB Series(1)
- M453 CAN Series(128)
- M463 CAN FD/USB HS Series(1)
- M467 Ethernet/Crypto Series(1)
- M471 Series(1)
- M479 Motor Control Series(1)
- M481 Base Series(4)
- M482 USB FS OTG Series(4)
- M483 CAN Series(4)
- M484 USB HS OTG Series(4)
- M485 Crypto Series(4)
- M487 Ethernet Series(4)
- M4TK Touch Key Series(25)
- NUC442/472 Series(130)
- NUC472 Series(1)
- NUC505 Series(138)
FAQ
How to keep the status of SRAM and do not initialize it when chip is reset? Issue Date:2020-02-07
To take the watchdog reset of M031 as an example.
When chip is reset, CPU will start to run code from “startup_M031Series.s”. In this code, program counter will jump to “startup_M031Series.c” and execute the System_Init function. After executing, the program counter will jump to __main function.
LDR R0, =SystemInit // Setting R0 as the address of SystemInit
BLX R0 // Jump to address of R0 and execute Thumb command
LDR R0, =__main // Setting R0 as address of __main
BX R0 // Jump to address of R0
__main function is built from compiler automatically. This function will initialize the SRAM. This initialization includes copy RW-data and ZI-data to SRAM, initialize the ZI-data to 0 and so on. After executing the __main, the program counter will jump to __rt_entry function.
__rt_entry function is built from compiler automatically, too. This function will setup the environment of executing the program. The setup includes initialize the Stack, Heap, Library and so on. After executing the __rt_entry, the program founter will jump to main() function.
If user wants to keep the SRAM status when chip is reset, it just needs to jump to main() function before entry __main function.
extern int32_t main(void);
void SystemInit(void)
{
/* If the last reset source is WDT Reset, do not reset SRAM */
if(SYS->RSTSRC & SYS_RSTSRC_RSTS_WDT_Msk)
{
main();
}
……
}
Note: This flow chart is quoted from KEIL website.
For detailed description of Startup flow, please refer to KEIL website: http://www.keil.com/support/man/docs/armclang_intro/armclang_intro_
asa1505906246660.htm
Products: | Microcontrollers ,8bit 8051 MCUs ,Arm Cortex-M0 MCUs ,Arm Cortex-M23 MCUs ,Arm Cortex-M4 MCUs |
---|---|
Applications: | |
Function: | Peripherals,Memory,SRAM,System Operation,Reset,Timer and PWM,Watchdog Timer (WDT) |