ESPHome 2026.5.3
Loading...
Searching...
No Matches
debug_zephyr.cpp
Go to the documentation of this file.
1#include "debug_component.h"
2#ifdef USE_ZEPHYR
3#include <climits>
4#include "esphome/core/log.h"
6#include <zephyr/drivers/hwinfo.h>
7#include <hal/nrf_power.h>
8#include <cstdint>
9#include <zephyr/storage/flash_map.h>
10
11#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
12
13namespace esphome::debug {
14
15static const char *const TAG = "debug";
16constexpr std::uintptr_t MBR_PARAM_PAGE_ADDR = 0xFFC;
17constexpr std::uintptr_t MBR_BOOTLOADER_ADDR = 0xFF8;
18
19static inline uint32_t read_mem_u32(uintptr_t addr) {
20 // NOLINTNEXTLINE(performance-no-int-to-ptr,clang-analyzer-core.FixedAddressDereference)
21 return *reinterpret_cast<volatile uint32_t *>(addr);
22}
23
24static inline uint8_t read_mem_u8(uintptr_t addr) {
25 // NOLINTNEXTLINE(performance-no-int-to-ptr,clang-analyzer-core.FixedAddressDereference)
26 return *reinterpret_cast<volatile uint8_t *>(addr);
27}
28
29// defines from https://github.com/adafruit/Adafruit_nRF52_Bootloader which prints those information
30constexpr uint32_t SD_MAGIC_NUMBER = 0x51B1E5DB;
31constexpr uintptr_t MBR_SIZE = 0x1000;
32constexpr uintptr_t SOFTDEVICE_INFO_STRUCT_OFFSET = 0x2000;
33constexpr uintptr_t SD_ID_OFFSET = SOFTDEVICE_INFO_STRUCT_OFFSET + 0x10;
35
36static inline bool is_sd_present() {
37 return read_mem_u32(SOFTDEVICE_INFO_STRUCT_OFFSET + MBR_SIZE + 4) == SD_MAGIC_NUMBER;
38}
39static inline uint32_t sd_id_get() {
41 return read_mem_u32(MBR_SIZE + SD_ID_OFFSET);
42 }
43 return 0;
44}
45static inline uint32_t sd_version_get() {
47 return read_mem_u32(MBR_SIZE + SD_VERSION_OFFSET);
48 }
49 return 0;
50}
51
52const char *DebugComponent::get_reset_reason_(std::span<char, RESET_REASON_BUFFER_SIZE> buffer) {
53 const char *buf = zephyr::get_reset_reason(buffer);
54 ESP_LOGD(TAG, "Reset Reason: %s", buf);
55 return buf;
56}
57
58const char *DebugComponent::get_wakeup_cause_(std::span<char, WAKEUP_CAUSE_BUFFER_SIZE> buffer) {
59 // Zephyr doesn't have detailed wakeup cause like ESP32
60 return "";
61}
62
63uint32_t DebugComponent::get_free_heap_() { return INT_MAX; }
64
65static void fa_cb(const struct flash_area *fa, void *user_data) {
66#if CONFIG_FLASH_MAP_LABELS
67 const char *fa_label = flash_area_label(fa);
68
69 if (fa_label == nullptr) {
70 fa_label = "-";
71 }
72 ESP_LOGCONFIG(TAG, "%2d 0x%0*" PRIxPTR " %-26s %-24.24s 0x%-10x 0x%-12x", (int) fa->fa_id,
73 sizeof(uintptr_t) * 2, (uintptr_t) fa->fa_dev, fa->fa_dev->name, fa_label, (uint32_t) fa->fa_off,
74 fa->fa_size);
75#else
76 ESP_LOGCONFIG(TAG, "%2d 0x%0*" PRIxPTR " %-26s 0x%-10x 0x%-12x", (int) fa->fa_id, sizeof(uintptr_t) * 2,
77 (uintptr_t) fa->fa_dev, fa->fa_dev->name, (uint32_t) fa->fa_off, fa->fa_size);
78#endif
79}
80
82#if CONFIG_FLASH_MAP_LABELS
83 ESP_LOGCONFIG(TAG, "ID | Device | Device Name "
84 "| Label | Offset | Size");
85 ESP_LOGCONFIG(TAG, "--------------------------------------------"
86 "-----------------------------------------------");
87#else
88 ESP_LOGCONFIG(TAG, "ID | Device | Device Name "
89 "| Offset | Size");
90 ESP_LOGCONFIG(TAG, "-----------------------------------------"
91 "------------------------------");
92#endif
93 flash_area_foreach(fa_cb, nullptr);
94}
95
96#ifdef ESPHOME_LOG_HAS_VERBOSE
97// Check if an nRF peripheral's ENABLE register indicates it is enabled.
98// periph: peripheral register prefix (e.g. USBD, UARTE, SPI)
99// reg: register block pointer (e.g. NRF_USBD, NRF_UARTE0)
100#define NRF_PERIPH_ENABLED(periph, reg) \
101 YESNO(((reg)->ENABLE & periph##_ENABLE_ENABLE_Msk) == (periph##_ENABLE_ENABLE_Enabled << periph##_ENABLE_ENABLE_Pos))
102
103// NOLINTBEGIN(clang-analyzer-core.FixedAddressDereference) -- nRF peripheral registers are MMIO at fixed addresses
104static void log_peripherals_info() {
105 // most peripherals are enabled only when in use so ESP_LOGV is enough
106 ESP_LOGV(TAG, "Peripherals status:");
107 ESP_LOGV(TAG, " USBD: %-3s| UARTE0: %-3s| UARTE1: %-3s| UART0: %-3s", //
108 NRF_PERIPH_ENABLED(USBD, NRF_USBD), NRF_PERIPH_ENABLED(UARTE, NRF_UARTE0),
109 NRF_PERIPH_ENABLED(UARTE, NRF_UARTE1), NRF_PERIPH_ENABLED(UART, NRF_UART0));
110 ESP_LOGV(TAG, " TWIS0: %-3s| TWIS1: %-3s| TWIM0: %-3s| TWIM1: %-3s", //
111 NRF_PERIPH_ENABLED(TWIS, NRF_TWIS0), NRF_PERIPH_ENABLED(TWIS, NRF_TWIS1),
112 NRF_PERIPH_ENABLED(TWIM, NRF_TWIM0), NRF_PERIPH_ENABLED(TWIM, NRF_TWIM1));
113 ESP_LOGV(TAG, " TWI0: %-3s| TWI1: %-3s| COMP: %-3s| CCM: %-3s", //
114 NRF_PERIPH_ENABLED(TWI, NRF_TWI0), NRF_PERIPH_ENABLED(TWI, NRF_TWI1), NRF_PERIPH_ENABLED(COMP, NRF_COMP),
115 NRF_PERIPH_ENABLED(CCM, NRF_CCM));
116 ESP_LOGV(TAG, " PDM: %-3s| SPIS0: %-3s| SPIS1: %-3s| SPIS2: %-3s", //
117 NRF_PERIPH_ENABLED(PDM, NRF_PDM), NRF_PERIPH_ENABLED(SPIS, NRF_SPIS0), NRF_PERIPH_ENABLED(SPIS, NRF_SPIS1),
118 NRF_PERIPH_ENABLED(SPIS, NRF_SPIS2));
119 ESP_LOGV(TAG, " SPIM0: %-3s| SPIM1: %-3s| SPIM2: %-3s| SPIM3: %-3s", //
120 NRF_PERIPH_ENABLED(SPIM, NRF_SPIM0), NRF_PERIPH_ENABLED(SPIM, NRF_SPIM1),
121 NRF_PERIPH_ENABLED(SPIM, NRF_SPIM2), NRF_PERIPH_ENABLED(SPIM, NRF_SPIM3));
122 ESP_LOGV(TAG, " SPI0: %-3s| SPI1: %-3s| SPI2: %-3s| SAADC: %-3s", //
123 NRF_PERIPH_ENABLED(SPI, NRF_SPI0), NRF_PERIPH_ENABLED(SPI, NRF_SPI1), NRF_PERIPH_ENABLED(SPI, NRF_SPI2),
124 NRF_PERIPH_ENABLED(SAADC, NRF_SAADC));
125 ESP_LOGV(TAG, " QSPI: %-3s| QDEC: %-3s| LPCOMP: %-3s| I2S: %-3s", //
126 NRF_PERIPH_ENABLED(QSPI, NRF_QSPI), NRF_PERIPH_ENABLED(QDEC, NRF_QDEC),
127 NRF_PERIPH_ENABLED(LPCOMP, NRF_LPCOMP), NRF_PERIPH_ENABLED(I2S, NRF_I2S));
128 ESP_LOGV(TAG, " PWM0: %-3s| PWM1: %-3s| PWM2: %-3s| PWM3: %-3s", //
129 NRF_PERIPH_ENABLED(PWM, NRF_PWM0), NRF_PERIPH_ENABLED(PWM, NRF_PWM1), NRF_PERIPH_ENABLED(PWM, NRF_PWM2),
130 NRF_PERIPH_ENABLED(PWM, NRF_PWM3));
131 ESP_LOGV(TAG, " AAR: %-3s| QSPI deep power-down:%-3s| CRYPTOCELL: %-3s", NRF_PERIPH_ENABLED(AAR, NRF_AAR),
132 YESNO((NRF_QSPI->IFCONFIG0 & QSPI_IFCONFIG0_DPMENABLE_Msk) ==
133 (QSPI_IFCONFIG0_DPMENABLE_Enable << QSPI_IFCONFIG0_DPMENABLE_Pos)),
134 YESNO((NRF_CRYPTOCELL->ENABLE & CRYPTOCELL_ENABLE_ENABLE_Msk) ==
135 (CRYPTOCELL_ENABLE_ENABLE_Enabled << CRYPTOCELL_ENABLE_ENABLE_Pos)));
136}
137// NOLINTEND(clang-analyzer-core.FixedAddressDereference)
138#undef NRF_PERIPH_ENABLED
139#endif
140
141static const char *regout0_to_str(uint32_t value) {
142 switch (value) {
143 case (UICR_REGOUT0_VOUT_DEFAULT):
144 return "1.8V (default)";
145 case (UICR_REGOUT0_VOUT_1V8):
146 return "1.8V";
147 case (UICR_REGOUT0_VOUT_2V1):
148 return "2.1V";
149 case (UICR_REGOUT0_VOUT_2V4):
150 return "2.4V";
151 case (UICR_REGOUT0_VOUT_2V7):
152 return "2.7V";
153 case (UICR_REGOUT0_VOUT_3V0):
154 return "3.0V";
155 case (UICR_REGOUT0_VOUT_3V3):
156 return "3.3V";
157 }
158 return "???V";
159}
160
161size_t DebugComponent::get_device_info_(std::span<char, DEVICE_INFO_BUFFER_SIZE> buffer, size_t pos) {
162 constexpr size_t size = DEVICE_INFO_BUFFER_SIZE;
163 char *buf = buffer.data();
164
165 // Main supply status
166 // NOLINTNEXTLINE(clang-analyzer-core.FixedAddressDereference) -- NRF_POWER is MMIO at a fixed address
167 auto regstatus = nrf_power_mainregstatus_get(NRF_POWER);
168 const char *supply_status = (regstatus == NRF_POWER_MAINREGSTATUS_NORMAL) ? "Normal voltage." : "High voltage.";
169 ESP_LOGD(TAG, "Main supply status: %s", supply_status);
170 pos = buf_append_str(buf, size, pos, "|Main supply status: ");
171 pos = buf_append_str(buf, size, pos, supply_status);
172
173 // Regulator stage 0
174 if (nrf_power_mainregstatus_get(NRF_POWER) == NRF_POWER_MAINREGSTATUS_HIGH) {
175 const char *reg0_type = nrf_power_dcdcen_vddh_get(NRF_POWER) ? "DC/DC" : "LDO";
176 const char *reg0_voltage = regout0_to_str((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) >> UICR_REGOUT0_VOUT_Pos);
177 ESP_LOGD(TAG, "Regulator stage 0: %s, %s", reg0_type, reg0_voltage);
178 pos = buf_append_str(buf, size, pos, "|Regulator stage 0: ");
179 pos = buf_append_str(buf, size, pos, reg0_type);
180 pos = buf_append_str(buf, size, pos, ", ");
181 pos = buf_append_str(buf, size, pos, reg0_voltage);
182#ifdef USE_NRF52_REG0_VOUT
183 if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) >> UICR_REGOUT0_VOUT_Pos != USE_NRF52_REG0_VOUT) {
184 ESP_LOGE(TAG, "Regulator stage 0: expected %s", regout0_to_str(USE_NRF52_REG0_VOUT));
185 }
186#endif
187 } else {
188 ESP_LOGD(TAG, "Regulator stage 0: disabled");
189 pos = buf_append_str(buf, size, pos, "|Regulator stage 0: disabled");
190 }
191
192 // Regulator stage 1
193 const char *reg1_type = nrf_power_dcdcen_get(NRF_POWER) ? "DC/DC" : "LDO";
194 ESP_LOGD(TAG, "Regulator stage 1: %s", reg1_type);
195 pos = buf_append_str(buf, size, pos, "|Regulator stage 1: ");
196 pos = buf_append_str(buf, size, pos, reg1_type);
197
198 // USB power state
199 const char *usb_state;
200 if (nrf_power_usbregstatus_vbusdet_get(NRF_POWER)) {
201 if (nrf_power_usbregstatus_outrdy_get(NRF_POWER)) {
202 usb_state = "ready";
203 } else {
204 usb_state = "connected (regulator is not ready)";
205 }
206 } else {
207 usb_state = "disconnected";
208 }
209 ESP_LOGD(TAG, "USB power state: %s", usb_state);
210 pos = buf_append_str(buf, size, pos, "|USB power state: ");
211 pos = buf_append_str(buf, size, pos, usb_state);
212
213 // Power-fail comparator
214 bool enabled;
215 nrf_power_pof_thr_t pof_thr = nrf_power_pofcon_get(NRF_POWER, &enabled);
216 if (enabled) {
217 const char *pof_voltage;
218 switch (pof_thr) {
219 case POWER_POFCON_THRESHOLD_V17:
220 pof_voltage = "1.7V";
221 break;
222 case POWER_POFCON_THRESHOLD_V18:
223 pof_voltage = "1.8V";
224 break;
225 case POWER_POFCON_THRESHOLD_V19:
226 pof_voltage = "1.9V";
227 break;
228 case POWER_POFCON_THRESHOLD_V20:
229 pof_voltage = "2.0V";
230 break;
231 case POWER_POFCON_THRESHOLD_V21:
232 pof_voltage = "2.1V";
233 break;
234 case POWER_POFCON_THRESHOLD_V22:
235 pof_voltage = "2.2V";
236 break;
237 case POWER_POFCON_THRESHOLD_V23:
238 pof_voltage = "2.3V";
239 break;
240 case POWER_POFCON_THRESHOLD_V24:
241 pof_voltage = "2.4V";
242 break;
243 case POWER_POFCON_THRESHOLD_V25:
244 pof_voltage = "2.5V";
245 break;
246 case POWER_POFCON_THRESHOLD_V26:
247 pof_voltage = "2.6V";
248 break;
249 case POWER_POFCON_THRESHOLD_V27:
250 pof_voltage = "2.7V";
251 break;
252 case POWER_POFCON_THRESHOLD_V28:
253 pof_voltage = "2.8V";
254 break;
255 default:
256 pof_voltage = "???V";
257 break;
258 }
259
260 if (nrf_power_mainregstatus_get(NRF_POWER) == NRF_POWER_MAINREGSTATUS_HIGH) {
261 const char *vddh_voltage;
262 switch (nrf_power_pofcon_vddh_get(NRF_POWER)) {
263 case NRF_POWER_POFTHRVDDH_V27:
264 vddh_voltage = "2.7V";
265 break;
266 case NRF_POWER_POFTHRVDDH_V28:
267 vddh_voltage = "2.8V";
268 break;
269 case NRF_POWER_POFTHRVDDH_V29:
270 vddh_voltage = "2.9V";
271 break;
272 case NRF_POWER_POFTHRVDDH_V30:
273 vddh_voltage = "3.0V";
274 break;
275 case NRF_POWER_POFTHRVDDH_V31:
276 vddh_voltage = "3.1V";
277 break;
278 case NRF_POWER_POFTHRVDDH_V32:
279 vddh_voltage = "3.2V";
280 break;
281 case NRF_POWER_POFTHRVDDH_V33:
282 vddh_voltage = "3.3V";
283 break;
284 case NRF_POWER_POFTHRVDDH_V34:
285 vddh_voltage = "3.4V";
286 break;
287 case NRF_POWER_POFTHRVDDH_V35:
288 vddh_voltage = "3.5V";
289 break;
290 case NRF_POWER_POFTHRVDDH_V36:
291 vddh_voltage = "3.6V";
292 break;
293 case NRF_POWER_POFTHRVDDH_V37:
294 vddh_voltage = "3.7V";
295 break;
296 case NRF_POWER_POFTHRVDDH_V38:
297 vddh_voltage = "3.8V";
298 break;
299 case NRF_POWER_POFTHRVDDH_V39:
300 vddh_voltage = "3.9V";
301 break;
302 case NRF_POWER_POFTHRVDDH_V40:
303 vddh_voltage = "4.0V";
304 break;
305 case NRF_POWER_POFTHRVDDH_V41:
306 vddh_voltage = "4.1V";
307 break;
308 case NRF_POWER_POFTHRVDDH_V42:
309 vddh_voltage = "4.2V";
310 break;
311 default:
312 vddh_voltage = "???V";
313 break;
314 }
315 ESP_LOGD(TAG, "Power-fail comparator: %s, VDDH: %s", pof_voltage, vddh_voltage);
316 pos = buf_append_str(buf, size, pos, "|Power-fail comparator: ");
317 pos = buf_append_str(buf, size, pos, pof_voltage);
318 pos = buf_append_str(buf, size, pos, ", VDDH: ");
319 pos = buf_append_str(buf, size, pos, vddh_voltage);
320 } else {
321 ESP_LOGD(TAG, "Power-fail comparator: %s", pof_voltage);
322 pos = buf_append_str(buf, size, pos, "|Power-fail comparator: ");
323 pos = buf_append_str(buf, size, pos, pof_voltage);
324 }
325 } else {
326 ESP_LOGD(TAG, "Power-fail comparator: disabled");
327 pos = buf_append_str(buf, size, pos, "|Power-fail comparator: disabled");
328 }
329
330 auto package = [](uint32_t value) {
331 switch (value) {
332 case 0x2004:
333 return "QIxx - 7x7 73-pin aQFN";
334 case 0x2000:
335 return "QFxx - 6x6 48-pin QFN";
336 case 0x2005:
337 return "CKxx - 3.544 x 3.607 WLCSP";
338 }
339 return "Unspecified";
340 };
341
342 char mac_pretty[MAC_ADDRESS_PRETTY_BUFFER_SIZE];
344 ESP_LOGD(TAG,
345 "nRF debug info:\n"
346 " Code page size: %u, code size: %u, device id: 0x%08x%08x\n"
347 " Encryption root: 0x%08x%08x%08x%08x, Identity Root: 0x%08x%08x%08x%08x\n"
348 " Device address type: %s, address: %s\n"
349 " Part code: nRF%x, version: %c%c%c%c, package: %s\n"
350 " RAM: %ukB, Flash: %ukB, production test: %sdone",
351 NRF_FICR->CODEPAGESIZE, NRF_FICR->CODESIZE, NRF_FICR->DEVICEID[1], NRF_FICR->DEVICEID[0], NRF_FICR->ER[0],
352 NRF_FICR->ER[1], NRF_FICR->ER[2], NRF_FICR->ER[3], NRF_FICR->IR[0], NRF_FICR->IR[1], NRF_FICR->IR[2],
353 NRF_FICR->IR[3], (NRF_FICR->DEVICEADDRTYPE & 0x1 ? "Random" : "Public"), mac_pretty, NRF_FICR->INFO.PART,
354 NRF_FICR->INFO.VARIANT >> 24 & 0xFF, NRF_FICR->INFO.VARIANT >> 16 & 0xFF, NRF_FICR->INFO.VARIANT >> 8 & 0xFF,
355 NRF_FICR->INFO.VARIANT & 0xFF, package(NRF_FICR->INFO.PACKAGE), NRF_FICR->INFO.RAM, NRF_FICR->INFO.FLASH,
356 (NRF_FICR->PRODTEST[0] == 0xBB42319F ? "" : "not "));
357 bool n_reset_enabled = NRF_UICR->PSELRESET[0] == NRF_UICR->PSELRESET[1] &&
358 (NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) == UICR_PSELRESET_CONNECT_Connected
359 << UICR_PSELRESET_CONNECT_Pos;
360 ESP_LOGD(
361 TAG, " GPIO as NFC pins: %s, GPIO as nRESET pin: %s",
362 YESNO((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)),
363 YESNO(n_reset_enabled));
364 if (n_reset_enabled) {
365 uint8_t port = (NRF_UICR->PSELRESET[0] & UICR_PSELRESET_PORT_Msk) >> UICR_PSELRESET_PORT_Pos;
366 uint8_t pin = (NRF_UICR->PSELRESET[0] & UICR_PSELRESET_PIN_Msk) >> UICR_PSELRESET_PIN_Pos;
367 ESP_LOGD(TAG, " nRESET port P%u.%02u", port, pin);
368 }
369#ifdef USE_BOOTLOADER_MCUBOOT
370 ESP_LOGD(TAG, " Bootloader: mcuboot");
371#else
372 ESP_LOGD(TAG, " Bootloader: Adafruit, version %u.%u.%u", (BOOTLOADER_VERSION_REGISTER >> 16) & 0xFF,
373 (BOOTLOADER_VERSION_REGISTER >> 8) & 0xFF, BOOTLOADER_VERSION_REGISTER & 0xFF);
374 ESP_LOGD(TAG, " MBR bootloader addr 0x%08x, UICR bootloader addr 0x%08x", read_mem_u32(MBR_BOOTLOADER_ADDR),
375 NRF_UICR->NRFFW[0]);
376 ESP_LOGD(TAG, " MBR param page addr 0x%08x, UICR param page addr 0x%08x", read_mem_u32(MBR_PARAM_PAGE_ADDR),
377 NRF_UICR->NRFFW[1]);
378 if (is_sd_present()) {
379 uint32_t const sd_id = sd_id_get();
380 uint32_t const sd_version = sd_version_get();
381
382 uint32_t ver[3];
383 ver[0] = sd_version / 1000000;
384 ver[1] = (sd_version - ver[0] * 1000000) / 1000;
385 ver[2] = (sd_version - ver[0] * 1000000 - ver[1] * 1000);
386
387 ESP_LOGD(TAG, " SoftDevice: S%u %u.%u.%u", sd_id, ver[0], ver[1], ver[2]);
388#ifdef USE_SOFTDEVICE_ID
389#ifdef USE_SOFTDEVICE_VERSION
390 if (USE_SOFTDEVICE_ID != sd_id || USE_SOFTDEVICE_VERSION != ver[0]) {
391 ESP_LOGE(TAG, "Built for SoftDevice S%u %u.x.y. It may crash due to mismatch of bootloader version.",
392 USE_SOFTDEVICE_ID, USE_SOFTDEVICE_VERSION);
393 }
394#else
395 if (USE_SOFTDEVICE_ID != sd_id) {
396 ESP_LOGE(TAG, "Built for SoftDevice S%u. It may crash due to mismatch of bootloader version.", USE_SOFTDEVICE_ID);
397 }
398#endif
399#endif
400 }
401#endif
402 auto uicr = [](volatile uint32_t *data, uint8_t size) {
403 std::string res;
404 for (size_t i = 0; i < size; i++) {
405 if (i > 0) {
406 res += ' ';
407 }
408 res += format_hex_pretty<uint32_t>(data[i], '\0', false);
409 }
410 return res;
411 };
412 ESP_LOGD(TAG, " NRFFW %s", uicr(NRF_UICR->NRFFW, 13).c_str());
413 ESP_LOGD(TAG, " NRFHW %s", uicr(NRF_UICR->NRFHW, 12).c_str());
414#ifdef ESPHOME_LOG_HAS_VERBOSE
415 log_peripherals_info();
416#endif
417 return pos;
418}
419
420void DebugComponent::update_platform_() {}
421
422} // namespace esphome::debug
423#endif
const char * get_wakeup_cause_(std::span< char, WAKEUP_CAUSE_BUFFER_SIZE > buffer)
void log_partition_info_()
Logs information about the device's partition table.
size_t get_device_info_(std::span< char, DEVICE_INFO_BUFFER_SIZE > buffer, size_t pos)
const char * get_reset_reason_(std::span< char, RESET_REASON_BUFFER_SIZE > buffer)
constexpr std::uintptr_t MBR_PARAM_PAGE_ADDR
constexpr uintptr_t SD_ID_OFFSET
constexpr std::uintptr_t MBR_BOOTLOADER_ADDR
constexpr uintptr_t MBR_SIZE
constexpr uintptr_t SOFTDEVICE_INFO_STRUCT_OFFSET
constexpr uintptr_t SD_VERSION_OFFSET
constexpr uint32_t SD_MAGIC_NUMBER
const std::vector< uint8_t > & data
const char * get_reset_reason(std::span< char, RESET_REASON_BUFFER_SIZE > buffer)
size_t buf_append_str(char *buf, size_t size, size_t pos, const char *str)
Safely append a string to buffer, returning new position (capped at size).
Definition helpers.h:1087
uint16_t size
Definition helpers.cpp:25
size_t size_t pos
Definition helpers.h:1038
const char * get_mac_address_pretty_into_buffer(std::span< char, MAC_ADDRESS_PRETTY_BUFFER_SIZE > buf)
Get the device MAC address into the given buffer, in colon-separated uppercase hex notation.
Definition helpers.cpp:751
std::string format_hex_pretty(const uint8_t *data, size_t length, char separator, bool show_length)
Format a byte array in pretty-printed, human-readable hex format.
static void uint32_t