soc: riscv: esp32c3: fixes flash size reference

replacing usage of the ESPTOOLPY_FLASHSIZE config
by the equivalent dt property path

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
This commit is contained in:
Glauber Maroto Ferreira 2022-02-04 11:20:51 -03:00 committed by Anas Nashif
parent 695bdd1ba2
commit c545729c40
2 changed files with 5 additions and 10 deletions

View file

@ -17,6 +17,9 @@ dt_reg_addr(img_0_off PATH ${dts_partition_path})
dt_nodelabel(dts_partition_path NODELABEL "boot_partition")
dt_reg_addr(boot_off PATH ${dts_partition_path})
# get flash size to use in esptool as string
math(EXPR esptoolpy_flashsize "${CONFIG_FLASH_SIZE} / 0x100000")
if(CONFIG_BOOTLOADER_ESP_IDF)
include(ExternalProject)
@ -53,14 +56,14 @@ if(CONFIG_BOOTLOADER_ESP_IDF)
CONFIGURE_COMMAND ""
BUILD_COMMAND
${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q
--offset 0x8000 --flash-size ${CONFIG_ESPTOOLPY_FLASHSIZE} ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin
--offset 0x8000 --flash-size ${esptoolpy_flashsize}MB ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin
INSTALL_COMMAND ""
)
if(CONFIG_BUILD_OUTPUT_BIN)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
ARGS --chip ${CONFIG_SOC} elf2image --flash_mode dio --flash_freq 40m --flash_size ${CONFIG_ESPTOOLPY_FLASHSIZE}
ARGS --chip ${CONFIG_SOC} elf2image --flash_mode dio --flash_freq 40m --flash_size ${esptoolpy_flashsize}MB
-o ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.bin
${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf)
endif()

View file

@ -27,12 +27,4 @@ config FLASH_BASE_ADDRESS
hex
default $(dt_node_reg_addr_hex,/soc/flash-controller@60002000/flash@0)
config ESPTOOLPY_FLASHSIZE
string
default "1MB" if FLASH_SIZE = 0x100000
default "2MB" if FLASH_SIZE = 0x200000
default "4MB" if FLASH_SIZE = 0x400000
default "8MB" if FLASH_SIZE = 0x800000
default "16MB" if FLASH_SIZE = 0x1000000
endif