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// Debug Mode (disables lockouts, useful for development)
39#ifndef DEBUG_MODE
40#define DEBUG_MODE 1
41#endif
42
43// Build profile byte. A mismatch between the byte stored in NVS and the
44// byte compiled into the running firmware triggers a complete factory wipe
45// (NVS partition + TROPIC01 R-Memory + ECC slots) at the next boot. This
46// is the beta-phase software guard; bypass-resistant enforcement against an
47// active attacker requires Secure Boot v2 with anti-rollback and is on the
48// 1.0 roadmap (see docs/SECURITY.md).
49#define BUILD_PROFILE_BYTE \
50 ((FEATURE_SECURE_SERIAL ? 0x02 : 0x00) | (DEBUG_MODE ? 0x01 : 0x00))