Skip to content

Commit 71a68a6

Browse files
committed
sketch_utils.sh: Remove the individual flash options and replace them
with only one option take is supposed to take any extra FQBN addition. Signed-off-by: Abdelatif Guettouche <[email protected]>
1 parent 011a52c commit 71a68a6

File tree

1 file changed

+22
-35
lines changed

1 file changed

+22
-35
lines changed

Diff for: .github/scripts/sketch_utils.sh

+22-35
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
#!/bin/bash
22

33
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]
4-
# Options default values
5-
6-
local fm_opt="qio"
7-
local ff_opt="80"
8-
local fs_opt="4M"
9-
local partition_opt="huge_app"
10-
11-
local options=0
12-
134
while [ ! -z "$1" ]; do
145
case "$1" in
156
-ai )
@@ -28,24 +19,13 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
2819
shift
2920
fqbn=$1
3021
;;
31-
-s )
32-
shift
33-
sketchdir=$1
34-
;;
35-
-ff )
22+
-o )
3623
shift
37-
ff_opt=$1
38-
options=1
24+
options=$1
3925
;;
40-
-fm )
41-
shift
42-
fm_opt=$1
43-
options=1
44-
;;
45-
-fs )
26+
-s )
4627
shift
47-
fs_opt=$1
48-
options=1
28+
sketchdir=$1
4929
;;
5030
* )
5131
break
@@ -76,7 +56,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
7656
# precedence. Note that the following logic also falls to the default
7757
# parameters if no arguments were passed and no file was found.
7858

79-
if [ $options -eq 0 ] && [ -f $sketchdir/cfg.json ]; then
59+
if [ -z $options ] && [ -f $sketchdir/cfg.json ]; then
8060
# The config file could contain multiple FQBNs for one chip. If
8161
# that's the case we build one time for every FQBN.
8262

@@ -88,26 +68,33 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
8868

8969
len=1
9070

71+
# Default FQBN options if none were passed in the command line.
72+
73+
esp32_opts="PSRAM=enabled,PartitionScheme=huge_app"
74+
esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app"
75+
esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
76+
esp32c3_opts="PartitionScheme=huge_app"
77+
9178
# Select the common part of the FQBN based on the target. The rest will be
9279
# appended depending on the passed options.
9380

9481
case "$target" in
95-
"esp32") fqbn="espressif:esp32:esp32:"
82+
"esp32")
83+
fqbn="espressif:esp32:esp32:${options:-$esp32_opts}"
9684
;;
97-
"esp32s2") fqbn="espressif:esp32:esp32s2:"
85+
"esp32s2")
86+
fqbn="espressif:esp32:esp32s2:${options:-$esp32s2_opts}"
9887
;;
99-
"esp32c3") fqbn="espressif:esp32:esp32c3:"
88+
"esp32c3")
89+
fqbn="espressif:esp32:esp32c3:${options:-$esp32c3_opts}"
10090
;;
101-
"esp32s3") fqbn="espressif:esp32:esp32s3:"
91+
"esp32s3")
92+
fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}"
10293
;;
10394
esac
10495

105-
partition="PartitionScheme=$partition_opt"
106-
ff="FlashFreq=$ff_opt"
107-
fm="FlashMode=$fm_opt"
108-
fs="FlashSize=$fs_opt"
109-
opts=$fm,$ff,$fs,$partition
110-
fqbn+=$opts
96+
# Make it look like a JSON array.
97+
11198
fqbn="[\"$fqbn\"]"
11299
fi
113100
else

0 commit comments

Comments
 (0)