nrf52: hodiny přežijí warm reset v .noinit (#5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-18 22:17:40 +02:00
1 parent 99656142f1
commit 8b55e36f95
5 files changed
+94 -114

No files matched your search

+12
View File
@@ -1,5 +1,17 @@
#if defined(NRF52_PLATFORM)
#include "NRF52Board.h"
#if !defined(NO_RETAINED_CLOCK)
// CUSTOM (TeTeHacko): the wall-clock record VolatileRTCClock carries across a warm
// reset (ArduinoHelpers.h). .noinit: the startup code neither copies nor zeroes it.
extern "C" {
uint32_t g_retained_clock[3] __attribute__((section(".noinit")));
uint8_t g_retained_clock_status = 0;
// `clkreboot` (CommonCLI.cpp, weak) -- otherwise the record would put the
// clock it is throwing away straight back after the reboot.
void retainedClockInvalidate() { g_retained_clock[0] = 0; }
}
#endif
#include <target.h>
#include <bluefruit.h>