@@ -9,6 +9,14 @@ zephyr_sources(
9
9
loader.c
10
10
)
11
11
12
+ # get code-partition slot0 address
13
+ dt_nodelabel(dts_partition_path NODELABEL "slot0_partition" )
14
+ dt_reg_addr(img_0_off PATH ${dts_partition_path} )
15
+
16
+ # get code-partition boot address
17
+ dt_nodelabel(dts_partition_path NODELABEL "boot_partition" )
18
+ dt_reg_addr(boot_off PATH ${dts_partition_path} )
19
+
12
20
if (CONFIG_BOOTLOADER_ESP_IDF)
13
21
include (ExternalProject)
14
22
@@ -45,14 +53,14 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
45
53
CONFIGURE_COMMAND ""
46
54
BUILD_COMMAND
47
55
${PYTHON_EXECUTABLE} ${ESP_IDF_PATH} /components/partition_table/gen_esp32part.py -q
48
- --offset 0x8000 --flash-size 4MB ${ESP_IDF_PATH} /components/partition_table/partitions_singleapp.csv ${espidf_build_dir} /partitions_singleapp.bin
56
+ --offset 0x8000 --flash-size ${CONFIG_ESPTOOLPY_FLASHSIZE} ${ESP_IDF_PATH} /components/partition_table/partitions_singleapp.csv ${espidf_build_dir} /partitions_singleapp.bin
49
57
INSTALL_COMMAND ""
50
58
)
51
59
52
60
if (CONFIG_BUILD_OUTPUT_BIN)
53
61
set_property (GLOBAL APPEND PROPERTY extra_post_build_commands
54
62
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH} /components/esptool_py/esptool/esptool.py
55
- ARGS --chip esp32c3 elf2image --flash_mode dio --flash_freq 40m
63
+ ARGS --chip ${CONFIG_SOC} elf2image --flash_mode dio --flash_freq 40m --flash_size ${CONFIG_ESPTOOLPY_FLASHSIZE}
56
64
-o ${CMAKE_BINARY_DIR} /zephyr/${CONFIG_KERNEL_BIN_NAME} .bin
57
65
${CMAKE_BINARY_DIR} /zephyr/${CONFIG_KERNEL_BIN_NAME} .elf)
58
66
endif ()
@@ -65,20 +73,10 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
65
73
66
74
board_finalize_runner_args(esp32 "--esp-flash-partition_table=${espidf_build_dir} /partitions_singleapp.bin" )
67
75
68
- board_finalize_runner_args(esp32 "--esp-boot-address=0x0000" )
69
-
70
76
board_finalize_runner_args(esp32 "--esp-partition-table-address=0x8000" )
71
77
72
- board_finalize_runner_args(esp32 "--esp-app-address=0x10000" )
73
-
74
78
endif ()
75
79
76
- if (CONFIG_BOOTLOADER_MCUBOOT )
80
+ board_finalize_runner_args(esp32 "--esp-boot-address= ${boot_off} " )
77
81
78
- # get code-partition slot0 address
79
- dt_nodelabel(dts_partition_path NODELABEL "slot0_partition" )
80
- dt_reg_addr(img_0_off PATH ${dts_partition_path} )
81
-
82
- board_finalize_runner_args(esp32 "--esp-app-address=${img_0_off} " )
83
-
84
- endif ()
82
+ board_finalize_runner_args(esp32 "--esp-app-address=${img_0_off} " )
0 commit comments