Skip to content

Commit a48b185

Browse files
committed
DISABLE_DEBUG=1 env variable to build.sh
1 parent 5b7f667 commit a48b185

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ $ sh build.sh build-repeater-firmwares
2929
3030
Build all chat room server firmwares
3131
$ sh build.sh build-room-server-firmwares
32+
33+
Environment Variables:
34+
DISABLE_DEBUG=1: Disables all debug logging flags (MESH_DEBUG, MESH_PACKET_LOGGING, etc.)
35+
If not set, debug flags from variant platformio.ini files are used.
36+
37+
Examples:
38+
Build without debug logging:
39+
$ export FIRMWARE_VERSION=v1.0.0
40+
$ export DISABLE_DEBUG=1
41+
$ sh build.sh build-firmware RAK_4631_repeater
42+
43+
Build with debug logging (default, uses flags from variant files):
44+
$ export FIRMWARE_VERSION=v1.0.0
45+
$ sh build.sh build-firmware RAK_4631_repeater
3246
EOF
3347
}
3448

@@ -68,6 +82,13 @@ get_pio_envs_ending_with_string() {
6882
done
6983
}
7084

85+
# disable all debug logging flags if DISABLE_DEBUG=1 is set
86+
disable_debug_flags() {
87+
if [ "$DISABLE_DEBUG" == "1" ]; then
88+
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -UMESH_DEBUG -UBLE_DEBUG_LOGGING -UWIFI_DEBUG_LOGGING -UBRIDGE_DEBUG -UGPS_NMEA_DEBUG -UCORE_DEBUG_LEVEL -UESPNOW_DEBUG_LOGGING -UDEBUG_RP2040_WIRE -UDEBUG_RP2040_SPI -UDEBUG_RP2040_CORE -UDEBUG_RP2040_PORT -URADIOLIB_DEBUG_SPI -UCFG_DEBUG -URADIOLIB_DEBUG_BASIC -URADIOLIB_DEBUG_PROTOCOL"
89+
fi
90+
}
91+
7192
# build firmware for the provided pio env in $1
7293
build_firmware() {
7394

@@ -94,6 +115,9 @@ build_firmware() {
94115
# add firmware version info to end of existing platformio build flags in environment vars
95116
export PLATFORMIO_BUILD_FLAGS="${PLATFORMIO_BUILD_FLAGS} -DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'"
96117

118+
# disable debug flags if requested
119+
disable_debug_flags
120+
97121
# build firmware target
98122
pio run -e $1
99123

0 commit comments

Comments
 (0)