@@ -75,41 +75,48 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
75
75
exit 1
76
76
fi
77
77
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
-
92
78
# The options are either stored in the test directory, for a per test
93
79
# customization or passed as parameters. Command line options take
94
80
# precedence. Note that the following logic also falls to the default
95
81
# parameters if no arguments were passed and no file was found.
96
82
97
83
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`
99
89
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
+
100
109
partition=" PartitionScheme=$partition_opt "
101
110
ff=" FlashFreq=$ff_opt "
102
111
fm=" FlashMode=$fm_opt "
103
112
fs=" FlashSize=$fs_opt "
104
113
opts=$fm ,$ff ,$fs ,$partition
114
+ fqbn+=$opts
115
+ fqbn=" [\" $fqbn \" ]"
105
116
fi
106
-
107
- fqbn+=$opts
108
117
fi
109
118
110
- echo $fqbn
111
-
112
- if [ -z $fqbn ]; then
119
+ if [ -z " $fqbn " ]; then
113
120
echo " No FQBN passed or unvalid chip: $target "
114
121
exit 1
115
122
fi
@@ -121,21 +128,26 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
121
128
build_dir=" $ARDUINO_BUILD_DIR "
122
129
fi
123
130
124
- rm -rf " $build_dir "
125
- mkdir -p " $build_dir "
126
131
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
139
151
}
140
152
141
153
function count_sketches(){ # count_sketches <path> [target]
0 commit comments