Debug bisect toggles: STENO_DEBUG_NO_GATT, STENO_DEBUG_NO_EMBED

This commit is contained in:
afiqzudinhadi 2026-07-03 11:02:34 +08:00
parent 9bf21c9db2
commit 404cd2a334
3 changed files with 28 additions and 1 deletions

View file

@ -95,6 +95,11 @@ if(CONFIG_STENO_DICT_V4)
steno_fetch_dict(plover ${STENO_PLOVER_JSON})
steno_fetch_dict(lapwing ${STENO_LAPWING_JSON})
if(CONFIG_STENO_DEBUG_NO_EMBED)
# Bisect aid: no blob, dict_embed.S falls back to a 4-byte stub.
set(STENO_DICT_BIN "")
else()
# Single run produces both blobs. The compiler FAILS the build if
# either half exceeds its budget — entries are never trimmed.
add_custom_command(
@ -116,6 +121,8 @@ if(CONFIG_STENO_DICT_V4)
add_custom_target(steno_dict_gen DEPENDS ${STENO_DICT_BIN})
add_dependencies(app steno_dict_gen)
endif() # CONFIG_STENO_DEBUG_NO_EMBED
# ── Legacy MPHF format (STENO_DICT_V4=n fallback) ────
else()
@ -228,10 +235,15 @@ endif() # CONFIG_STENO_DICT_V4
if(STENO_DICT_BIN)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/steno_dict_path.h
"#define STENO_DICT_BIN_PATH \"${STENO_DICT_BIN}\"\n")
target_include_directories(app PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/dict_embed.S
TARGET_DIRECTORY app
PROPERTIES OBJECT_DEPENDS ${STENO_DICT_BIN})
else()
# Debug no-embed: header exists but defines no blob path;
# dict_embed.S falls back to a 4-byte stub.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/steno_dict_path.h
"/* STENO_DEBUG_NO_EMBED: no dictionary blob */\n")
endif()
target_include_directories(app PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
endif() # CONFIG_STENO_ENGINE

13
Kconfig
View file

@ -54,6 +54,19 @@ config STENO_CUSTOM_KEYMAP
bool "Custom steno keymap"
default n
config STENO_DEBUG_NO_GATT
bool "Debug: omit the split-dict GATT service"
default n
help
Bisect aid: compile split_dict.c without BT_GATT_SERVICE_DEFINE.
config STENO_DEBUG_NO_EMBED
bool "Debug: skip dictionary blob embed"
default n
help
Bisect aid: embed a 4-byte placeholder instead of the compiled
dictionary blob. Lookups fail cleanly at runtime.
choice STENO_UNICODE_MODE
prompt "Unicode output mode"
default STENO_UNICODE_MODE_NONE

View file

@ -186,6 +186,7 @@ static uint8_t notify_cb(struct bt_conn *conn,
/* --- GATT Service Definition --- */
#ifndef CONFIG_STENO_DEBUG_NO_GATT
BT_GATT_SERVICE_DEFINE(steno_dict_svc,
BT_GATT_PRIMARY_SERVICE(STENO_UUID_SERVICE),
@ -196,6 +197,7 @@ BT_GATT_SERVICE_DEFINE(steno_dict_svc,
NULL, dict_req_write_cb, NULL),
BT_GATT_CCC(NULL, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
);
#endif /* !CONFIG_STENO_DEBUG_NO_GATT */
/* --- Central-side API --- */