Skip to content

Commit 7f06e65

Browse files
committed
debug flag passed as fqbn
1 parent a91da86 commit 7f06e65

File tree

5 files changed

+53
-43
lines changed

5 files changed

+53
-43
lines changed

tests/build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ENVIRONMENT:
1414
For Arduino CLI:
1515
ESP8266_ARDUINO_HARDWARE - path to the hardware directory (usually, containing our repo)
1616
ESP8266_ARDUINO_LIBRATIES - path to the libraries directory (external dependencies)
17-
ESP8266_ARDUINO_DEBUG - debug or nodebug
17+
ESP8266_ARDUINO_DEBUG - sketch debug level, see boards.txt for exact FQBN value
1818
ESP8266_ARDUINO_LWIP - v4 or v6
1919
2020
USAGE:
@@ -61,8 +61,8 @@ fi
6161

6262
case "$ESP8266_ARDUINO_BUILDER" in
6363
"arduino")
64-
install_arduino "$ESP8266_ARDUINO_DEBUG"
65-
build_sketches_with_arduino "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
64+
install_arduino
65+
build_sketches_with_arduino "$ESP8266_ARDUINO_DEBUG" "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
6666
;;
6767
"platformio")
6868
install_platformio nodemcuv2

tests/common.sh

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,41 @@ function format_fqbn()
109109
local board_name=$1
110110
local flash_size=$2
111111
local lwip=$3
112+
local debug=$4
112113

113-
echo $"esp8266com:esp8266:${board_name}:
114-
eesz=${flash_size},
115-
ip=${lwip}"
114+
printf 'esp8266com:esp8266:%s:eesz=%s,ip=%s,lvl=%s' \
115+
"$board_name" \
116+
"$flash_size" \
117+
"$lwip" \
118+
"$debug"
119+
}
120+
121+
function format_cli()
122+
{
123+
local cli_path=$1
124+
local warnings=$2
125+
local fqbn=$3
126+
local libraries=$4
127+
local output_dir=$5
128+
129+
printf "%s compile --warnings=%s --fqbn=%s --libraries=%s --output-dir=%s" \
130+
"$cli_path" \
131+
"$warnings" \
132+
"$fqbn" \
133+
"$libraries" \
134+
"$output_dir"
116135
}
117136

118137
function build_sketches()
119138
{
120139
local core_path=$1
121140
local cli_path=$2
122141
local library_path=$3
123-
local lwip=$4
124-
local build_mod=$5
125-
local build_rem=$6
126-
local build_cnt=$7
142+
local debug=$4
143+
local lwip=$5
144+
local build_mod=$6
145+
local build_rem=$7
146+
local build_cnt=$8
127147

128148
local build_dir="$cache_dir"/build
129149
mkdir -p "$build_dir"
@@ -132,16 +152,11 @@ function build_sketches()
132152
mkdir -p "$build_out"
133153

134154
local fqbn
135-
fqbn=$(format_fqbn "generic" "4M1M" "$lwip")
155+
fqbn=$(format_fqbn "generic" "4M1M" "$lwip" "$debug")
136156
echo "FQBN: $fqbn"
137157

138158
local build_cmd
139-
build_cmd=$''"${cli_path}"'
140-
compile
141-
--warnings=all
142-
--fqbn '"$fqbn"'
143-
--libraries '"$library_path"'
144-
--output-dir '"$build_out"''
159+
build_cmd=$(format_cli "$cli_path" "all" "$fqbn" "$library_path" "$build_out")
145160

146161
print_size_info_header >"$cache_dir"/size.log
147162

@@ -300,30 +315,19 @@ function install_core()
300315
local hardware_core_path=$2
301316
local debug=$3
302317

303-
pushd "${core_path}"
304-
305-
local debug_flags=""
306-
if [ "$debug" = "debug" ]; then
307-
debug_flags=$'-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM
308-
-DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI
309-
-DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM'
310-
fi
311-
312318
# Set our custom warnings for all builds
313319
printf "%s\n" \
314-
"compiler.c.extra_flags=-Wall -Wextra $debug_flags" \
315-
"compiler.cpp.extra_flags=-Wall -Wextra $debug_flags" \
320+
"compiler.c.extra_flags=-Wall -Wextra" \
321+
"compiler.cpp.extra_flags=-Wall -Wextra" \
316322
"recipe.hooks.prebuild.1.pattern=\"{runtime.tools.python3.path}/python3\" -I \"{runtime.tools.makecorever}\" --git-root \"{runtime.platform.path}\" --version \"{version}\" \"{runtime.platform.path}/cores/esp8266/core_version.h\"" \
317323
> "${core_path}"/platform.local.txt
318324
echo -e "\n----platform.local.txt----"
319-
cat platform.local.txt
325+
cat "${core_path}"/platform.local.txt
320326
echo -e "\n----\n"
321327

322328
# Fetch toolchain & filesystem utils
323-
pushd tools
329+
pushd "${core_path}"/tools
324330
python3 get.py -q
325-
326-
popd
327331
popd
328332

329333
# todo: windows runners are using copied tree
@@ -341,11 +345,10 @@ function install_core()
341345
function install_arduino()
342346
{
343347
echo ${ci_group}Install arduino
344-
local debug=$1
345348

346349
local hardware_core_path="$ESP8266_ARDUINO_HARDWARE/esp8266com/esp8266"
347350
test -d "$hardware_core_path" \
348-
|| install_core "$ESP8266_ARDUINO_BUILD_DIR" "$hardware_core_path" "$debug"
351+
|| install_core "$ESP8266_ARDUINO_BUILD_DIR" "$hardware_core_path"
349352

350353
command -v "${ESP8266_ARDUINO_CLI}" \
351354
|| install_arduino_cli "${ESP8266_ARDUINO_CLI}" "$hardware_core_path"
@@ -364,6 +367,9 @@ function arduino_lwip_menu_option()
364367
"IPv6")
365368
echo "lm6f"
366369
;;
370+
*)
371+
echo "unknown"
372+
;;
367373
esac
368374
}
369375

@@ -415,17 +421,19 @@ function arduino_mkbuildoptglobals_cleanup()
415421

416422
function build_sketches_with_arduino()
417423
{
424+
local debug=$1
425+
418426
local lwip
419-
lwip=$(arduino_lwip_menu_option $1)
427+
lwip=$(arduino_lwip_menu_option "$2")
420428

421-
local build_mod=$2
422-
local build_rem=$3
423-
local build_cnt=$4
429+
local build_mod=$3
430+
local build_rem=$4
431+
local build_cnt=$5
424432

425433
build_sketches "$ESP8266_ARDUINO_BUILD_DIR" \
426434
"$ESP8266_ARDUINO_CLI" \
427435
"$ESP8266_ARDUINO_LIBRARIES" \
428-
"$lwip" "$build_mod" "$build_rem" "$build_cnt"
436+
"$debug" "$lwip" "$build_mod" "$build_rem" "$build_cnt"
429437
step_summary "Size report" "$cache_dir/size.log"
430438
}
431439

tests/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ESP8266_ARDUINO_BUILDER=${ESP8266_ARDUINO_BUILDER:-arduino}
44
ESP8266_ARDUINO_PRESERVE_CACHE=${ESP8266_ARDUINO_PRESERVE_CACHE:-}
55

66
# sketch build options
7-
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:-nodebug}
7+
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:-None}
88
ESP8266_ARDUINO_LWIP=${ESP8266_ARDUINO_LWIP:-default}
99
ESP8266_ARDUINO_SKETCHES=${ESP8266_ARDUINO_SKETCHES:-}
1010

tests/run_CI_locally.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export HOME="${TMPCI}"
8585
export ESP8266_ARDUINO_BUILD_DIR="${TMPCI}"
8686
export BUILD_TYPE="$BUILD_TYPE"
8787

88+
DEBUG_ALL="SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOMMDNSHWDT_NOEXTRA4K"
89+
8890
if [ "$BUILD_TYPE" = "build" ]; then
8991
tests/build.sh
9092

@@ -95,10 +97,10 @@ elif [ "$BUILD_TYPE" = "build_odd" ]; then
9597
tests/build.sh odd
9698

9799
elif [ "$BUILD_TYPE" = "debug_even" ]; then
98-
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh even
100+
env ESP8266_ARDUINO_DEBUG="$DEBUG_ALL" tests/build.sh even
99101

100102
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
101-
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh odd
103+
env ESP8266_ARDUINO_DEBUG="$DEBUG_ALL" tests/build.sh odd
102104

103105
elif [ "$BUILD_TYPE" = "build6" ]; then
104106
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh

tests/test_mkbuildoptglobals.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function build_esp8266_example()
8383
local name="$1"
8484

8585
ESP8266_ARDUINO_SKETCHES="$root/libraries/esp8266/examples/${name}/${name}.ino"
86-
build_sketches_with_arduino "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
86+
build_sketches_with_arduino "$ESP8266_ARDUINO_DEBUG" "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
8787
}
8888

8989
function make_commonh_stat()

0 commit comments

Comments
 (0)