Repeater, room server, sensor (nRF52): get chip tells the silicon and whether SWD can read the flash

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-19 20:42:59 +01:00
1 parent ac49cd6621
commit b30cda7936
2 files changed
+15

No files matched your search

+14
View File
@@ -936,6 +936,20 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
strcpy(reply, "Error: locked build");
return;
}
#endif
#if defined(NRF52_PLATFORM)
// CUSTOM (TeTeHacko): which silicon, and whether SWD can read the flash
// (docs/locked-bootloader.md, point 5). Variant xxF0 and later = rev3, where
// the hardware closes the debug port unless the firmware opens it on every
// boot -- ours never does; rev1/rev2 obey UICR.APPROTECT alone (0xFF = open).
if (memcmp(config, "chip", 4) == 0 && config[4] == 0) {
uint32_t v = NRF_FICR->INFO.VARIANT;
uint32_t ap = NRF_UICR->APPROTECT;
sprintf(reply, "> nRF%lx %c%c%c%c, uicr.approtect %08lx (%s)", (unsigned long)NRF_FICR->INFO.PART,
(char)(v >> 24), (char)(v >> 16), (char)(v >> 8), (char)v, (unsigned long)ap,
(ap & 0xFF) == 0xFF ? "open" : "protected");
return;
}
#endif
if (memcmp(config, "allow.read.only", 15) == 0) {
sprintf(reply, "> %s", _prefs->allow_read_only ? "on" : "off");