1
1
#! /bin/bash
2
2
3
3
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
-
13
4
while [ ! -z " $1 " ]; do
14
5
case " $1 " in
15
6
-ai )
@@ -28,24 +19,13 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
28
19
shift
29
20
fqbn=$1
30
21
;;
31
- -s )
32
- shift
33
- sketchdir=$1
34
- ;;
35
- -ff )
22
+ -o )
36
23
shift
37
- ff_opt=$1
38
- options=1
24
+ options=$1
39
25
;;
40
- -fm )
41
- shift
42
- fm_opt=$1
43
- options=1
44
- ;;
45
- -fs )
26
+ -s )
46
27
shift
47
- fs_opt=$1
48
- options=1
28
+ sketchdir=$1
49
29
;;
50
30
* )
51
31
break
@@ -76,7 +56,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
76
56
# precedence. Note that the following logic also falls to the default
77
57
# parameters if no arguments were passed and no file was found.
78
58
79
- if [ $options -eq 0 ] && [ -f $sketchdir /cfg.json ]; then
59
+ if [ -z $options ] && [ -f $sketchdir /cfg.json ]; then
80
60
# The config file could contain multiple FQBNs for one chip. If
81
61
# that's the case we build one time for every FQBN.
82
62
@@ -88,26 +68,33 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
88
68
89
69
len=1
90
70
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
+
91
78
# Select the common part of the FQBN based on the target. The rest will be
92
79
# appended depending on the passed options.
93
80
94
81
case " $target " in
95
- " esp32" ) fqbn=" espressif:esp32:esp32:"
82
+ " esp32" )
83
+ fqbn=" espressif:esp32:esp32:${options:- $esp32_opts } "
96
84
;;
97
- " esp32s2" ) fqbn=" espressif:esp32:esp32s2:"
85
+ " esp32s2" )
86
+ fqbn=" espressif:esp32:esp32s2:${options:- $esp32s2_opts } "
98
87
;;
99
- " esp32c3" ) fqbn=" espressif:esp32:esp32c3:"
88
+ " esp32c3" )
89
+ fqbn=" espressif:esp32:esp32c3:${options:- $esp32c3_opts } "
100
90
;;
101
- " esp32s3" ) fqbn=" espressif:esp32:esp32s3:"
91
+ " esp32s3" )
92
+ fqbn=" espressif:esp32:esp32s3:${options:- $esp32s3_opts } "
102
93
;;
103
94
esac
104
95
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
+
111
98
fqbn=" [\" $fqbn \" ]"
112
99
fi
113
100
else
0 commit comments