常见问答
- M051 系列(95)
- M0518 系列(97)
- M0519 系列(43)
- M0564 系列(1)
- Mini51 系列(90)
- Nano100 / 102 系列(101)
- Nano103 Base 系列(10)
- Nano110 / 112 LCD 系列(100)
- Nano120 USB 系列(111)
- Nano130 USB+LCD 系列(110)
- NUC029 系列(94)
- NUC100 / 200 系列(102)
- NUC120 / 122 / 123 / 220 USB 系列(116)
- NUC121/125 系列(1)
- NUC126 USB 系列(2)
- NUC130 / 230 CAN 系列(103)
- NUC131/NUC1311 CAN 系列(98)
- NUC140 / 240 USB+CAN 系列(114)
- M451 Base 系列(118)
- M451M 系列(117)
- M452 USB 系列(130)
- M4521 USB 系列(1)
- M453 CAN 系列(128)
- M463 CAN FD/USB HS 系列(1)
- M467 Ethernet/Crypto 系列(1)
- M471 系列(1)
- M479 Motor Control Series(1)
- M481 Base 系列(4)
- M482 USB FS OTG 系列(4)
- M483 CAN 系列(4)
- M484 USB HS OTG 系列(4)
- M485 Crypto 系列(4)
- M487 Ethernet 系列(4)
- M4TK 触摸 IC 系列(25)
- NUC442 / 472 系列(130)
- NUC472 Series(1)
- NUC505 系列(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) |