diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a5c38a16..1ca6c0f8 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -47,6 +47,7 @@ "IO_SEPROXYHAL_BUFFER_SIZE_B=128", "HAVE_UX_FLOW", "DEBUG=1", + "DEBUG_BUILD=1", "HAVE_PRINTF", "PRINTF=screen_printf", "_DEFAULT_SOURCE" diff --git a/Makefile b/Makefile index 003de6cf..b13c223f 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,10 @@ VARIANT_VALUES = ERGO # Enabling DEBUG flag will enable PRINTF and disable optimizations #DEBUG = 1 -# Enabling stack canary -HAVE_BOLOS_APP_STACK_CANARY = 1 +# Enabling stack canary in debug mode and setting debug flag +ifeq ($(DEBUG), 1) + DEFINES += DEBUG_BUILD=1 HAVE_BOLOS_APP_STACK_CANARY=1 +endif ######################################## # Application custom permissions # diff --git a/src/commands/app_version.c b/src/commands/app_version.c index 64059956..245d70e7 100644 --- a/src/commands/app_version.c +++ b/src/commands/app_version.c @@ -15,7 +15,7 @@ int handler_get_version() { _Static_assert(PATCH_VERSION >= 0 && PATCH_VERSION <= UINT8_MAX, "PATCH version must be between 0 and 255!"); uint8_t version[APPVERSION_LEN] = {MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION, 0}; -#ifdef HAVE_PRINTF +#ifdef DEBUG_BUILD version[APPVERSION_LEN - 1] = 1; #endif