@@ -75,41 +75,48 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
7575 exit 1
7676 fi
7777
78- # Select the common part of the FQBN based on the target. The rest will be
79- # appended depending on the passed options.
80-
81- case " $target " in
82- " esp32" ) fqbn=" espressif:esp32:esp32:"
83- ;;
84- " esp32s2" ) fqbn=" espressif:esp32:esp32s2:"
85- ;;
86- " esp32c3" ) fqbn=" espressif:esp32:esp32c3:"
87- ;;
88- " esp32s3" ) fqbn=" espressif:esp32:esp32s3:"
89- ;;
90- esac
91-
9278 # The options are either stored in the test directory, for a per test
9379 # customization or passed as parameters. Command line options take
9480 # precedence. Note that the following logic also falls to the default
9581 # parameters if no arguments were passed and no file was found.
9682
9783 if [ $options -eq 0 ] && [ -f $sketchdir /cfg.json ]; then
98- opts=` jq -r --arg chip $target ' .targets[] | select(.name==$chip) | .fqbn' $sketchdir /cfg.json`
84+ # The config file could contain multiple FQBNs for one chip. If
85+ # that's the case we build one time for every FQBN.
86+
87+ len=` jq -r --arg chip $target ' .targets[] | select(.name==$chip) | .fqbn | length' $sketchdir /cfg.json`
88+ fqbn=` jq -r --arg chip $target ' .targets[] | select(.name==$chip) | .fqbn' $sketchdir /cfg.json`
9989 else
90+ # Since we are passing options, we will end up with only one FQBN to
91+ # build.
92+
93+ len=1
94+
95+ # Select the common part of the FQBN based on the target. The rest will be
96+ # appended depending on the passed options.
97+
98+ case " $target " in
99+ " esp32" ) fqbn=" espressif:esp32:esp32:"
100+ ;;
101+ " esp32s2" ) fqbn=" espressif:esp32:esp32s2:"
102+ ;;
103+ " esp32c3" ) fqbn=" espressif:esp32:esp32c3:"
104+ ;;
105+ " esp32s3" ) fqbn=" espressif:esp32:esp32s3:"
106+ ;;
107+ esac
108+
100109 partition=" PartitionScheme=$partition_opt "
101110 ff=" FlashFreq=$ff_opt "
102111 fm=" FlashMode=$fm_opt "
103112 fs=" FlashSize=$fs_opt "
104113 opts=$fm ,$ff ,$fs ,$partition
114+ fqbn+=$opts
115+ fqbn=" [\" $fqbn \" ]"
105116 fi
106-
107- fqbn+=$opts
108117 fi
109118
110- echo $fqbn
111-
112- if [ -z $fqbn ]; then
119+ if [ -z " $fqbn " ]; then
113120 echo " No FQBN passed or unvalid chip: $target "
114121 exit 1
115122 fi
@@ -121,21 +128,26 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
121128 build_dir=" $ARDUINO_BUILD_DIR "
122129 fi
123130
124- rm -rf " $build_dir "
125- mkdir -p " $build_dir "
126131 mkdir -p " $ARDUINO_CACHE_DIR "
127- $ide_path /arduino-builder -compile -logger=human -core-api-version=10810 \
128- -fqbn=\" $fqbn \" \
129- -warnings=" all" \
130- -tools " $ide_path /tools-builder" \
131- -tools " $ide_path /tools" \
132- -built-in-libraries " $ide_path /libraries" \
133- -hardware " $ide_path /hardware" \
134- -hardware " $user_path /hardware" \
135- -libraries " $user_path /libraries" \
136- -build-cache " $ARDUINO_CACHE_DIR " \
137- -build-path " $build_dir " \
138- $win_opts $xtra_opts " ${sketchdir} /$( basename ${sketchdir} ) .ino"
132+ for i in ` seq 0 $(( $len - 1 )) `
133+ do
134+ rm -rf " $build_dir$i "
135+ mkdir -p " $build_dir$i "
136+ currfqbn=` echo $fqbn | jq -r --argjson i $i ' .[$i]' `
137+ echo " Building with FQBN=$currfqbn "
138+ $ide_path /arduino-builder -compile -logger=human -core-api-version=10810 \
139+ -fqbn=\" $currfqbn \" \
140+ -warnings=" all" \
141+ -tools " $ide_path /tools-builder" \
142+ -tools " $ide_path /tools" \
143+ -built-in-libraries " $ide_path /libraries" \
144+ -hardware " $ide_path /hardware" \
145+ -hardware " $user_path /hardware" \
146+ -libraries " $user_path /libraries" \
147+ -build-cache " $ARDUINO_CACHE_DIR " \
148+ -build-path " $build_dir$i " \
149+ $win_opts $xtra_opts " ${sketchdir} /$( basename ${sketchdir} ) .ino"
150+ done
139151}
140152
141153function count_sketches(){ # count_sketches <path> [target]
0 commit comments