From 58f50045d93d1f0ae45e664506b376eecbf1b77e Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:36:09 +0100 Subject: [PATCH] Add the possibility to set global compile time settings (#20013) --- platformio.ini | 10 +++++++--- platformio_override_sample.ini | 5 +++++ platformio_tasmota_cenv_sample.ini | 6 ++++++ tasmota/my_user_config.h | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index f45cd00f5..de12bf4a9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -55,7 +55,6 @@ lib_extra_dirs = lib/lib_div [tasmota] -; *** Settings here do NOT affect firmware building *** ; Uncomment if you do NOT want gzipped map file(s) ;disable_map_gz = 1 ; Uncomment and specify a folder where to place the map file(s) (default set to folder build_output) @@ -66,6 +65,9 @@ lib_extra_dirs = ;enable_esp32_gz = 1 ; Uncomment and specify a folder where to place the firmware file(s) (default set to folder build_output) ;bin_dir = /tmp/bin_files/ +; Global build flags (used for all env) can be overriden in "platformio_override.ini" +build_unflags = +build_flags = [scripts_defaults] extra_scripts = pre:pio-tools/pre_source_dir.py @@ -81,10 +83,12 @@ extra_scripts = post:pio-tools/name-firmware.py ; post:pio-tools/obj-dump.py ${scripts_defaults.extra_scripts} ; *** remove undesired all warnings -build_unflags = -Wall +build_unflags = ${tasmota.build_unflags} + -Wall ; -mtarget-align -Wdeprecated-declarations -build_flags = -DCORE_DEBUG_LEVEL=0 +build_flags = ${tasmota.build_flags} + -DCORE_DEBUG_LEVEL=0 -Wl,-Map,firmware.map -Wno-deprecated-declarations ; -mno-target-align diff --git a/platformio_override_sample.ini b/platformio_override_sample.ini index c1572ab5e..e00872a6b 100644 --- a/platformio_override_sample.ini +++ b/platformio_override_sample.ini @@ -65,6 +65,11 @@ default_envs = ; tasmota32c6-safeboot ; tasmota32c6cdc-safeboot +[tasmota] +; *** Global build / unbuild compile time flags for ALL Tasmota / Tasmota32 [env] +;build_unflags = +build_flags = -DUSE_BERRY_PARTITION_WIZARD + [env] ;build_unflags = ${common.build_unflags} ; -Wswitch-unreachable diff --git a/platformio_tasmota_cenv_sample.ini b/platformio_tasmota_cenv_sample.ini index dcfd705d2..ce8387b60 100644 --- a/platformio_tasmota_cenv_sample.ini +++ b/platformio_tasmota_cenv_sample.ini @@ -1,3 +1,9 @@ +[tasmota] +; Reset global build / unbuild compile time flags for ALL Tasmota / Tasmota32 [env] +; since custom env are designed to enable options individual +build_unflags = +build_flags = + [env:tasmota-rangeextender] build_flags = ${env.build_flags} -DFIRMWARE_RANGE_EXTENDER diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 7e918a675..2f5543e15 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -1141,7 +1141,7 @@ // Note that only one cipher is enabled: ECDHE_RSA_WITH_AES_128_GCM_SHA256 which is very commonly used and highly secure #define USE_BERRY_WEBCLIENT_USERAGENT "TasmotaClient" // default user-agent used, can be changed with `wc.set_useragent()` #define USE_BERRY_WEBCLIENT_TIMEOUT 2000 // Default timeout in milliseconds - #define USE_BERRY_PARTITION_WIZARD // Add a button to dynamically load the Partion Wizard from a bec file online (+1.3KB Flash) + //#define USE_BERRY_PARTITION_WIZARD // Add a button to dynamically load the Partion Wizard from a bec file online (+1.3KB Flash) #define USE_BERRY_PARTITION_WIZARD_URL "http://ota.tasmota.com/tapp/partition_wizard.bec" #define USE_BERRY_TCPSERVER // Enable TCP socket server (+0.6k) // #define USE_BERRY_ULP // Enable ULP (Ultra Low Power) support (+4.9k)