Skip to content

Commit 2938705

Browse files
committed
Implement memory variants on all chips to fix flash modes
1 parent d953301 commit 2938705

File tree

4 files changed

+69
-41
lines changed

4 files changed

+69
-41
lines changed

Diff for: CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION)
1111

1212
add_custom_command(
1313
OUTPUT "idf_libs"
14-
COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_ESPTOOLPY_OCT_FLASH}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}"
14+
COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-libs.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}" "${CONFIG_IDF_TARGET_ARCH_XTENSA}"
1515
DEPENDS ${elf}
1616
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
1717
VERBATIM
@@ -29,7 +29,7 @@ add_custom_target(copy-bootloader DEPENDS "copy_bootloader")
2929

3030
add_custom_command(
3131
OUTPUT "mem_variant"
32-
COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-mem-variant.sh ${IDF_TARGET} "${CONFIG_ESPTOOLPY_OCT_FLASH}" "${CONFIG_SPIRAM_MODE_OCT}"
32+
COMMAND ${CMAKE_SOURCE_DIR}/tools/copy-mem-variant.sh ${IDF_TARGET} "${CONFIG_LIB_BUILDER_FLASHMODE}" "${CONFIG_SPIRAM_MODE_OCT}"
3333
DEPENDS ${elf}
3434
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
3535
VERBATIM

Diff for: configs/builds.json

+40-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
{
22
"mem_variants_files":[
3-
{
4-
"file":"libbootloader_support.a",
5-
"src":"build/esp-idf/bootloader_support/libbootloader_support.a",
6-
"out":"lib/libbootloader_support.a"
7-
},
8-
{
9-
"file":"libesp_hw_support.a",
10-
"src":"build/esp-idf/esp_hw_support/libesp_hw_support.a",
11-
"out":"lib/libesp_hw_support.a"
12-
},
133
{
144
"file":"libspi_flash.a",
155
"src":"build/esp-idf/spi_flash/libspi_flash.a",
16-
"out":"lib/libspi_flash.a"
6+
"out":"lib/libspi_flash.a",
7+
"targets":["esp32","esp32c3","esp32s2","esp32s3"]
8+
},
9+
{
10+
"file":"libesp_system.a",
11+
"src":"build/esp-idf/esp_system/libesp_system.a",
12+
"out":"lib/libesp_system.a",
13+
"targets":["esp32s3"]
1714
},
1815
{
1916
"file":"libfreertos.a",
2017
"src":"build/esp-idf/freertos/libfreertos.a",
21-
"out":"lib/libfreertos.a"
18+
"out":"lib/libfreertos.a",
19+
"targets":["esp32s3"]
2220
},
2321
{
24-
"file":"libesp_system.a",
25-
"src":"build/esp-idf/esp_system/libesp_system.a",
26-
"out":"lib/libesp_system.a"
22+
"file":"libbootloader_support.a",
23+
"src":"build/esp-idf/bootloader_support/libbootloader_support.a",
24+
"out":"lib/libbootloader_support.a",
25+
"targets":["esp32s3"]
26+
},
27+
{
28+
"file":"libesp_hw_support.a",
29+
"src":"build/esp-idf/esp_hw_support/libesp_hw_support.a",
30+
"out":"lib/libesp_hw_support.a",
31+
"targets":["esp32s3"]
2732
},
2833
{
2934
"file":"sections.ld",
3035
"src":"build/esp-idf/esp_system/ld/sections.ld",
31-
"out":"ld/sections.ld"
36+
"out":"ld/sections.ld",
37+
"targets":["esp32s3"]
3238
}
3339
],
3440
"targets":[
@@ -44,6 +50,8 @@
4450
],
4551
"mem_variants":[
4652
["qio","80m","opi_ram"],
53+
["dio","80m","qio_ram"],
54+
["dio","80m","opi_ram"],
4755
["opi","80m","opi_ram"],
4856
["opi","80m","qio_ram"]
4957
]
@@ -62,7 +70,11 @@
6270
["dio","40m"],
6371
["dout","40m"]
6472
],
65-
"mem_variants":[]
73+
"mem_variants":[
74+
["qout","80m"],
75+
["dio","80m"],
76+
["dout","80m"]
77+
]
6678
},
6779
{
6880
"target": "esp32c3",
@@ -78,12 +90,16 @@
7890
["dio","40m"],
7991
["dout","40m"]
8092
],
81-
"mem_variants":[]
93+
"mem_variants":[
94+
["qout","80m"],
95+
["dio","80m"],
96+
["dout","80m"]
97+
]
8298
},
8399
{
84100
"target": "esp32",
85101
"features":["qio_ram"],
86-
"idf_libs":["dio","40m"],
102+
"idf_libs":["qio","80m"],
87103
"bootloaders":[
88104
["qio","80m"],
89105
["qout","80m"],
@@ -94,7 +110,11 @@
94110
["dio","40m"],
95111
["dout","40m"]
96112
],
97-
"mem_variants":[]
113+
"mem_variants":[
114+
["qout","80m"],
115+
["dio","80m"],
116+
["dout","80m"]
117+
]
98118
}
99119
]
100120
}

Diff for: tools/copy-libs.sh

+14-9
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33

44
IDF_TARGET=$1
55
IS_XTENSA=$4
6-
OCT_FLASH=
6+
OCT_FLASH="$2"
77
OCT_PSRAM=
8-
if [ "$2" = "y" ]; then
9-
OCT_FLASH="opi"
10-
else
11-
OCT_FLASH="qspi"
12-
fi
8+
139
if [ "$3" = "y" ]; then
1410
OCT_PSRAM="opi"
1511
else
@@ -514,9 +510,18 @@ done
514510
mkdir -p "$AR_SDK/$MEMCONF/include"
515511
mv "$PWD/build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
516512
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
517-
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
518-
out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"')
519-
mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file"
513+
skip_file=1
514+
for file_target in $(echo "$mem_variant" | jq -c '.targets[]' | tr -d '"'); do
515+
if [ "$file_target" == "$IDF_TARGET" ]; then
516+
skip_file=0
517+
break
518+
fi
519+
done
520+
if [ $skip_file -eq 0 ]; then
521+
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
522+
out=$(echo "$mem_variant" | jq -c '.out' | tr -d '"')
523+
mv "$AR_SDK/$out" "$AR_SDK/$MEMCONF/$file"
524+
fi
520525
done;
521526

522527
# Add IDF versions to sdkconfig

Diff for: tools/copy-mem-variant.sh

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
#!/bin/bash
22
IDF_TARGET=$1
3-
OCT_FLASH=
3+
OCT_FLASH="$2"
44
OCT_PSRAM=
55

6-
if [ "$2" = "y" ]; then
7-
OCT_FLASH="opi"
8-
else
9-
OCT_FLASH="qspi"
10-
fi
11-
126
if [ "$3" = "y" ]; then
137
OCT_PSRAM="opi"
148
else
@@ -30,7 +24,16 @@ rm -rf "$AR_SDK/$MEMCONF"
3024
mkdir -p "$AR_SDK/$MEMCONF/include"
3125
mv "build/config/sdkconfig.h" "$AR_SDK/$MEMCONF/include/sdkconfig.h"
3226
for mem_variant in `jq -c '.mem_variants_files[]' configs/builds.json`; do
33-
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
34-
src=$(echo "$mem_variant" | jq -c '.src' | tr -d '"')
35-
cp "$src" "$AR_SDK/$MEMCONF/$file"
27+
skip_file=1
28+
for file_target in $(echo "$mem_variant" | jq -c '.targets[]' | tr -d '"'); do
29+
if [ "$file_target" == "$IDF_TARGET" ]; then
30+
skip_file=0
31+
break
32+
fi
33+
done
34+
if [ $skip_file -eq 0 ]; then
35+
file=$(echo "$mem_variant" | jq -c '.file' | tr -d '"')
36+
src=$(echo "$mem_variant" | jq -c '.src' | tr -d '"')
37+
cp "$src" "$AR_SDK/$MEMCONF/$file"
38+
fi
3639
done;

0 commit comments

Comments
 (0)