Add some comments

This commit is contained in:
Tim Keller 2021-09-02 23:01:12 +00:00
parent 110c82c225
commit 28fdc376b2

View File

@ -160,9 +160,12 @@ Pinetime::System::SystemTask systemTask(spi,
heartRateApp,
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 __stop_noinit_data;
static constexpr uint32_t NoInit_MagicValue = 0xDEADBEEF;
static constexpr uint32_t NoInit_MagicValue = 0xDEAD0000;
uint32_t NoInit_MagicWord __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
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
// Check Magic Ram and reset lost variables
if (NoInit_MagicWord == NoInit_MagicValue) {
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
} else {
//Clear Memory to known state
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
NoInit_MagicWord = NoInit_MagicValue;
}