@@ -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
118137function 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()
341345function 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
416422function 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
0 commit comments