Add some comments
This commit is contained in:
parent
110c82c225
commit
28fdc376b2
|
@ -160,9 +160,12 @@ Pinetime::System::SystemTask systemTask(spi,
|
||||||
heartRateApp,
|
heartRateApp,
|
||||||
fs);
|
fs);
|
||||||
|
|
||||||
|
/* Variable Declarations for variables in noinit SRAM
|
||||||
|
Increment NoInit_MagicValue upon adding variables to this area
|
||||||
|
*/
|
||||||
extern uint32_t __start_noinit_data;
|
extern uint32_t __start_noinit_data;
|
||||||
extern uint32_t __stop_noinit_data;
|
extern uint32_t __stop_noinit_data;
|
||||||
static constexpr uint32_t NoInit_MagicValue = 0xDEADBEEF;
|
static constexpr uint32_t NoInit_MagicValue = 0xDEAD0000;
|
||||||
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
|
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
|
||||||
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
|
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
|
||||||
|
|
||||||
|
@ -327,10 +330,11 @@ int main(void) {
|
||||||
// retrieve version stored by bootloader
|
// retrieve version stored by bootloader
|
||||||
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
|
||||||
|
|
||||||
// Check Magic Ram and reset lost variables
|
|
||||||
if (NoInit_MagicWord == NoInit_MagicValue) {
|
if (NoInit_MagicWord == NoInit_MagicValue) {
|
||||||
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
|
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
|
||||||
} else {
|
} else {
|
||||||
|
//Clear Memory to known state
|
||||||
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
|
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
|
||||||
NoInit_MagicWord = NoInit_MagicValue;
|
NoInit_MagicWord = NoInit_MagicValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user