CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
feature_flags.h
Go to the documentation of this file.
1
7
8
#pragma once
9
10
#include "sdkconfig.h"
11
12
// ============================================================================
13
// Security Features
14
// ============================================================================
15
16
// Secure Serial (require PIN for serial commands)
17
// Maps from Kconfig CONFIG_SECURE_SERIAL
18
#ifdef CONFIG_SECURE_SERIAL
19
#define FEATURE_SECURE_SERIAL 1
20
#else
21
#ifndef FEATURE_SECURE_SERIAL
22
#define FEATURE_SECURE_SERIAL 0
23
#endif
24
#endif
25
26
// NVS Editor destructive actions (privileged tool)
27
#ifndef FEATURE_NVS_EDIT
28
#define FEATURE_NVS_EDIT 0
29
#endif
30
31
// Plugin AOT (ahead-of-time native code). Default off: AOT artifacts run as
32
// native machine code and bypass the WASM bounds-checked sandbox, so only
33
// interpreted bytecode is loaded/accepted unless this is explicitly enabled.
34
#ifndef FEATURE_PLUGIN_AOT
35
#define FEATURE_PLUGIN_AOT 0
36
#endif
37
38
// Lock the on-device system folder (plugins, i18n) read-only/hidden/system at
39
// mount. Default off: an opt-in security feature so a USB-MSC host cannot modify
40
// or delete system files. Off by default so plugin upload/overwrite/delete over
41
// serial work normally without read-only attributes blocking them.
42
#ifndef FEATURE_PLUGIN_SYSTEM_LOCK
43
#define FEATURE_PLUGIN_SYSTEM_LOCK 0
44
#endif
45
46
// ============================================================================
47
// Content Viewers (image decode + Markdown rendering)
48
// ============================================================================
49
50
// Image viewer decoders. Each format is gated independently so an over-budget
51
// decoder can be dropped without code changes (flash measured via idf.py size).
52
#ifndef FEATURE_IMG_JPEG
53
#define FEATURE_IMG_JPEG 1
54
#endif
55
#ifndef FEATURE_IMG_PNG
56
#define FEATURE_IMG_PNG 1
57
#endif
58
59
// Markdown rendering in the scrollable text viewer.
60
#ifndef FEATURE_MARKDOWN
61
#define FEATURE_MARKDOWN 1
62
#endif
63
64
// ============================================================================
65
// Display / E-Paper Refresh Policy
66
// ============================================================================
67
// The panel escalates refreshes to bound ghosting while minimising visible
68
// flashing: after FEATURE_EPD_MAX_PARTIALS_BEFORE_FAST consecutive partial
69
// updates the next refresh is promoted to FAST (single flash cycle), and after
70
// FEATURE_EPD_MAX_FASTS_BEFORE_FULL fast refreshes the next one is promoted to
71
// FULL (multi-flash OTP waveform, complete clean). PARTIAL_LIGHT updates never
72
// count. A long-press on key '5' forces a manual FULL refresh at any time.
73
74
// Escalate to a FAST refresh after this many consecutive PARTIAL updates.
75
#ifndef FEATURE_EPD_MAX_PARTIALS_BEFORE_FAST
76
#define FEATURE_EPD_MAX_PARTIALS_BEFORE_FAST 50
77
#endif
78
79
// Escalate to a FULL refresh after this many FAST refreshes.
80
#ifndef FEATURE_EPD_MAX_FASTS_BEFORE_FULL
81
#define FEATURE_EPD_MAX_FASTS_BEFORE_FULL 10
82
#endif
83
84
// Enable the hardware FAST refresh waveform. 0 = FAST requests fall back to FULL.
85
#ifndef FEATURE_EPD_FAST_REFRESH
86
#define FEATURE_EPD_FAST_REFRESH 1
87
#endif
88
89
// Long-press key '5' triggers a manual FULL refresh (anti-ghosting).
90
#ifndef FEATURE_EPD_LONGPRESS_FULL_REFRESH
91
#define FEATURE_EPD_LONGPRESS_FULL_REFRESH 1
92
#endif
93
94
// Debug Mode (disables lockouts, useful for development)
95
#ifndef DEBUG_MODE
96
#define DEBUG_MODE 1
97
#endif
98
99
// Build profile byte. A mismatch between the byte stored in NVS and the
100
// byte compiled into the running firmware triggers a complete factory wipe
101
// (NVS partition + TROPIC01 R-Memory + ECC slots) at the next boot. This
102
// is the beta-phase software guard; bypass-resistant enforcement against an
103
// active attacker requires Secure Boot v2 with anti-rollback and is on the
104
// 1.0 roadmap (see website/src/content/docs/security/caveats.md).
105
#define BUILD_PROFILE_BYTE \
106
((FEATURE_SECURE_SERIAL ? 0x02 : 0x00) | (DEBUG_MODE ? 0x01 : 0x00))
components
cdc_core
include
cdc_core
feature_flags.h
Generated by
1.16.1