summaryrefslogtreecommitdiff
path: root/src/SystemTask
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-05-24 16:36:04 +0200
committerJF <jf@codingfield.com>2020-05-24 16:36:04 +0200
commit331481cd0c6ba804860f7cdbd5110a87ff0160fe (patch)
treeaf1212ec3e3982e24f6109c29d7785e88560e63d /src/SystemTask
parent3cc76d7673f6a3b8b5253d04b358b440e550fdb4 (diff)
Refactor CMake files to allow building 2 binaries : one standalone and one compatible with mcuboot bootloader (the offset in memory is different).
Add documentation about mcuboot image generation and OTA. Re-enable watchdog
Diffstat (limited to 'src/SystemTask')
-rw-r--r--src/SystemTask/SystemTask.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp
index 021bac3d..84392c7d 100644
--- a/src/SystemTask/SystemTask.cpp
+++ b/src/SystemTask/SystemTask.cpp
@@ -60,19 +60,19 @@ void nrf52_nvmc_write_word(uint32_t address, uint32_t value) {
}
void SystemTask::Work() {
-// watchdog.Setup(7);
-// watchdog.Start();
+ watchdog.Setup(7);
+ watchdog.Start();
NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason()));
APP_GPIOTE_INIT(2);
spi.Init();
spiNorFlash.Init();
- // TODO write magic only if it's not already 1
- nrf52_nvmc_write_word(0x7BFE8, 1);
-
uint32_t* magicptr = reinterpret_cast<uint32_t *>(0x7BFE8);
uint32_t magic = *magicptr;
+ if(magic != 1)
+ nrf52_nvmc_write_word(0x7BFE8, 1);
+
NRF_LOG_INFO("MAGIC : %d", magic);
nimbleController.Init();