diff --git a/cpu/esp32/bootloader/Makefile b/cpu/esp32/bootloader/Makefile index 54b0c7bb92..1cf29cd21d 100644 --- a/cpu/esp32/bootloader/Makefile +++ b/cpu/esp32/bootloader/Makefile @@ -18,15 +18,16 @@ BOOTLOADER_BAUD ?= $(BAUD) ESP_SDK_BOOTLOADER_SRCS = \ components/bootloader/subproject/main/bootloader_start.c \ components/bootloader/subproject/components/micro-ecc/uECC_verify_antifault.c \ + components/bootloader_support/bootloader_flash/src/bootloader_flash.c \ + components/bootloader_support/bootloader_flash/src/bootloader_flash_config_$(CPU_FAM).c \ + components/bootloader_support/bootloader_flash/src/flash_qio_mode.c \ components/bootloader_support/src/bootloader_clock_init.c \ components/bootloader_support/src/bootloader_clock_loader.c \ components/bootloader_support/src/bootloader_common.c \ components/bootloader_support/src/bootloader_common_loader.c \ components/bootloader_support/src/bootloader_console.c \ components/bootloader_support/src/bootloader_console_loader.c \ - components/bootloader_support/src/bootloader_efuse_$(CPU_FAM).c \ - components/bootloader_support/src/bootloader_flash.c \ - components/bootloader_support/src/bootloader_flash_config_$(CPU_FAM).c \ + components/bootloader_support/src/bootloader_efuse.c \ components/bootloader_support/src/bootloader_init.c \ components/bootloader_support/src/bootloader_mem.c \ components/bootloader_support/src/bootloader_panic.c \ @@ -39,7 +40,6 @@ ESP_SDK_BOOTLOADER_SRCS = \ components/bootloader_support/src/esp_image_format.c \ components/bootloader_support/src/flash_encrypt.c \ components/bootloader_support/src/flash_partitions.c \ - components/bootloader_support/src/flash_qio_mode.c \ components/bootloader_support/src/secure_boot.c \ components/efuse/$(CPU_FAM)/esp_efuse_fields.c \ components/efuse/$(CPU_FAM)/esp_efuse_table.c \ @@ -47,82 +47,131 @@ ESP_SDK_BOOTLOADER_SRCS = \ components/efuse/src/esp_efuse_api.c \ components/efuse/src/esp_efuse_fields.c \ components/efuse/src/esp_efuse_utility.c \ + components/esp_bootloader_format/esp_bootloader_desc.c \ components/esp_common/src/esp_err_to_name.c \ - components/esp_hw_support/compare_set.c \ - components/esp_hw_support/cpu_util.c \ + components/esp_hw_support/cpu.c \ + components/esp_hw_support/esp_memory_utils.c \ components/esp_hw_support/port/$(CPU_FAM)/chip_info.c \ + components/esp_hw_support/port/$(CPU_FAM)/cpu_region_protect.c \ + components/esp_hw_support/port/$(CPU_FAM)/esp_cpu_intr.c \ components/esp_hw_support/port/$(CPU_FAM)/rtc_clk.c \ components/esp_hw_support/port/$(CPU_FAM)/rtc_clk_init.c \ components/esp_hw_support/port/$(CPU_FAM)/rtc_init.c \ - components/esp_hw_support/port/$(CPU_FAM)/rtc_pm.c \ components/esp_hw_support/port/$(CPU_FAM)/rtc_sleep.c \ components/esp_hw_support/port/$(CPU_FAM)/rtc_time.c \ components/esp_rom/patches/esp_rom_crc.c \ + components/esp_rom/patches/esp_rom_efuse.c \ + components/esp_rom/patches/esp_rom_gpio.c \ + components/esp_rom/patches/esp_rom_print.c \ + components/esp_rom/patches/esp_rom_spiflash.c \ components/esp_rom/patches/esp_rom_sys.c \ - components/esp_rom/patches/esp_rom_tjpgd.c \ components/esp_rom/patches/esp_rom_uart.c \ components/esp_system/esp_err.c \ - components/hal/cpu_hal.c \ - components/hal/mpu_hal.c \ - components/hal/wdt_hal_iram.c \ - components/log/log_buffers.c \ - components/log/log.c \ - components/log/log_noos.c \ - components/newlib/syscalls.c \ + components/hal/efuse_hal.c \ + components/hal/$(CPU_FAM)/efuse_hal.c \ + components/hal/hal_utils.c \ + components/hal/mmu_hal.c \ + components/log/src/log_timestamp_common.c \ + components/log/src/noos/log_lock.c \ + components/log/src/noos/log_timestamp.c \ + components/soc/dport_access_common.c \ components/soc/$(CPU_FAM)/adc_periph.c \ components/soc/$(CPU_FAM)/gpio_periph.c \ components/soc/$(CPU_FAM)/i2c_periph.c \ components/soc/$(CPU_FAM)/i2s_periph.c \ components/soc/$(CPU_FAM)/interrupts.c \ components/soc/$(CPU_FAM)/ledc_periph.c \ + components/soc/$(CPU_FAM)/mpi_periph.c \ components/soc/$(CPU_FAM)/rmt_periph.c \ - components/soc/$(CPU_FAM)/sigmadelta_periph.c \ + components/soc/$(CPU_FAM)/sdm_periph.c \ components/soc/$(CPU_FAM)/spi_periph.c \ components/soc/$(CPU_FAM)/timer_periph.c \ + components/soc/$(CPU_FAM)/twai_periph.c \ components/soc/$(CPU_FAM)/uart_periph.c \ + components/soc/$(CPU_FAM)/wdt_periph.c \ components/soc/lldesc.c \ - components/spi_flash/$(CPU_FAM)/spi_flash_rom_patch.c \ + components/spi_flash/spi_flash_wrap.c \ # ifneq (,$(filter xtensa%,$(TARGET_ARCH))) - ESP_SDK_BOOTLOADER_SRCS += components/esp_hw_support/port/$(CPU_FAM)/rtc_wdt.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/lcd_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/pcnt_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/rtc_io_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/touch_sensor_periph.c + ESP_SDK_BOOTLOADER_ASMSRC = components/esp_rom/patches/esp_rom_longjmp.S ESP_SDK_BOOTLOADER_SRCS += components/xtensa/eri.c ESP_SDK_BOOTLOADER_SRCS += components/xtensa/xt_trax.c else - ESP_SDK_BOOTLOADER_SRCS += components/esp_hw_support/port/$(CPU_FAM)/cpu_util_$(CPU_FAM).c -endif - -ifneq (,$(filter esp32 esp32s2,$(CPU_FAM))) - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/dac_periph.c -endif - -ifneq (,$(filter esp32 esp32s3,$(CPU_FAM))) - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/mcpwm_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/sdio_slave_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/sdmmc_periph.c -endif - -ifneq (,$(filter esp32c3 esp32h2 esp32s3,$(CPU_FAM))) - ESP_SDK_BOOTLOADER_SRCS += components/efuse/$(CPU_FAM)/esp_efuse_rtc_calib.c endif ifneq (,$(filter esp32,$(CPU_FAM))) - ESP_SDK_BOOTLOADER_SRCS += components/efuse/src/esp_efuse_api_key_esp32.c - ESP_SDK_BOOTLOADER_ASMSRC = components/esp_rom/patches/esp_rom_longjmp.S + ESP_SDK_BOOTLOADER_SRCS += \ + components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c \ + components/hal/$(CPU_FAM)/cache_hal_$(CPU_FAM).c \ + components/hal/mpu_hal.c \ + components/hal/wdt_hal_iram.c \ + components/soc/$(CPU_FAM)/dac_periph.c \ + components/soc/$(CPU_FAM)/dport_access.c \ + components/soc/$(CPU_FAM)/emac_periph.c \ + components/soc/$(CPU_FAM)/lcd_periph.c \ + components/soc/$(CPU_FAM)/mcpwm_periph.c \ + components/soc/$(CPU_FAM)/pcnt_periph.c \ + components/soc/$(CPU_FAM)/rtc_io_periph.c \ + components/soc/$(CPU_FAM)/sdio_slave_periph.c \ + components/soc/$(CPU_FAM)/sdmmc_periph.c \ + components/soc/$(CPU_FAM)/touch_sensor_periph.c \ + # else ifneq (,$(filter esp32s2,$(CPU_FAM))) - ESP_SDK_BOOTLOADER_SRCS += components/efuse/src/esp_efuse_api_key_esp32xx.c - ESP_SDK_BOOTLOADER_SRCS += components/esp_hw_support/port/$(CPU_FAM)/regi2c_ctrl.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/dedic_gpio_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/soc_include_legacy_warn.c + ESP_SDK_BOOTLOADER_SRCS += \ + components/efuse/$(CPU_FAM)/esp_efuse_rtc_calib.c \ + components/efuse/$(CPU_FAM)/esp_efuse_rtc_table.c \ + components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c \ + components/esp_rom/$(CPU_FAM)/usb_patches.c \ + components/esp_rom/patches/esp_rom_cache_esp32s2_esp32s3.c \ + components/esp_rom/patches/esp_rom_regi2c_$(CPU_FAM).c \ + components/hal/cache_hal.c \ + components/hal/mpu_hal.c \ + components/hal/wdt_hal_iram.c \ + components/esp_rom/patches/esp_rom_systimer.c \ + components/soc/$(CPU_FAM)/dedic_gpio_periph.c \ + components/soc/$(CPU_FAM)/lcd_periph.c \ + components/soc/$(CPU_FAM)/pcnt_periph.c \ + components/soc/$(CPU_FAM)/rtc_io_periph.c \ + components/soc/$(CPU_FAM)/temperature_sensor_periph.c \ + components/soc/$(CPU_FAM)/touch_sensor_periph.c \ + components/soc/$(CPU_FAM)/usb_dwc_periph.c \ + # +else ifneq (,$(filter esp32s3,$(CPU_FAM))) + ESP_SDK_BOOTLOADER_ASMSRC += \ + components/esp_rom/patches/esp_rom_cache_writeback_$(CPU_FAM).S + ESP_SDK_BOOTLOADER_SRCS += \ + components/efuse/$(CPU_FAM)/esp_efuse_rtc_calib.c \ + components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c \ + components/esp_rom/patches/esp_rom_cache_esp32s2_esp32s3.c \ + components/esp_rom/patches/esp_rom_systimer.c \ + components/esp_rom/patches/esp_rom_wdt.c \ + components/hal/cache_hal.c \ + components/hal/mpu_hal.c \ + components/soc/$(CPU_FAM)/dedic_gpio_periph.c \ + components/soc/$(CPU_FAM)/gdma_periph.c \ + components/soc/$(CPU_FAM)/lcd_periph.c \ + components/soc/$(CPU_FAM)/mcpwm_periph.c \ + components/soc/$(CPU_FAM)/pcnt_periph.c \ + components/soc/$(CPU_FAM)/rtc_io_periph.c \ + components/soc/$(CPU_FAM)/sdmmc_periph.c \ + components/soc/$(CPU_FAM)/temperature_sensor_periph.c \ + components/soc/$(CPU_FAM)/touch_sensor_periph.c \ + components/soc/$(CPU_FAM)/usb_dwc_periph.c \ + # +else ifneq (,$(filter esp32c3,$(CPU_FAM))) + ESP_SDK_BOOTLOADER_SRCS += \ + components/efuse/$(CPU_FAM)/esp_efuse_rtc_calib.c \ + components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c \ + components/esp_rom/patches/esp_rom_systimer.c \ + components/hal/cache_hal.c \ + components/hal/wdt_hal_iram.c \ + components/soc/$(CPU_FAM)/dedic_gpio_periph.c \ + components/soc/$(CPU_FAM)/gdma_periph.c \ + components/soc/$(CPU_FAM)/temperature_sensor_periph.c \ + # else - ESP_SDK_BOOTLOADER_SRCS += components/efuse/src/esp_efuse_api_key_esp32xx.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/dedic_gpio_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/$(CPU_FAM)/gdma_periph.c - ESP_SDK_BOOTLOADER_SRCS += components/soc/soc_include_legacy_warn.c + $(error Missing make configuration for ESP32x SoC variant (family): $(CPU_FAM)) endif # Bootloader sdkconfig.h defined in CURDIR directory. @@ -134,18 +183,25 @@ INCLUDES = \ -I$(ESP32_SDK_DIR)/components/bootloader/subproject/components/micro-ecc/micro-ecc \ -I$(ESP32_SDK_DIR)/components/bootloader_support/bootloader_flash/include \ -I$(ESP32_SDK_DIR)/components/bootloader_support/include \ - -I$(ESP32_SDK_DIR)/components/bootloader_support/include_bootloader \ + -I$(ESP32_SDK_DIR)/components/bootloader_support/private_include \ -I$(ESP32_SDK_DIR)/components/efuse/include \ -I$(ESP32_SDK_DIR)/components/efuse/private_include \ -I$(ESP32_SDK_DIR)/components/efuse/$(CPU_FAM)/include \ -I$(ESP32_SDK_DIR)/components/efuse/$(CPU_FAM)/private_include \ + -I$(ESP32_SDK_DIR)/components/esp_app_format/include \ + -I$(ESP32_SDK_DIR)/components/esp_bootloader_format/include \ -I$(ESP32_SDK_DIR)/components/esp_common/include \ -I$(ESP32_SDK_DIR)/components/esp_hw_support/include \ + -I$(ESP32_SDK_DIR)/components/esp_hw_support/include/esp_private \ -I$(ESP32_SDK_DIR)/components/esp_hw_support/include/soc \ -I$(ESP32_SDK_DIR)/components/esp_hw_support/include/soc/$(CPU_FAM) \ + -I$(ESP32_SDK_DIR)/components/esp_hw_support/port/include \ -I$(ESP32_SDK_DIR)/components/esp_hw_support/port/$(CPU_FAM) \ + -I$(ESP32_SDK_DIR)/components/esp_hw_support/port/$(CPU_FAM)/include/ \ -I$(ESP32_SDK_DIR)/components/esp_hw_support/port/$(CPU_FAM)/private_include \ -I$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM) \ + -I$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/include \ + -I$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/include/$(CPU_FAM) \ -I$(ESP32_SDK_DIR)/components/esp_rom/include \ -I$(ESP32_SDK_DIR)/components/esp_rom/include/$(CPU_FAM) \ -I$(ESP32_SDK_DIR)/components/hal/$(CPU_FAM)/include \ @@ -153,8 +209,9 @@ INCLUDES = \ -I$(ESP32_SDK_DIR)/components/hal/platform_port/include \ -I$(ESP32_SDK_DIR)/components/log/include \ -I$(ESP32_SDK_DIR)/components/newlib/platform_include \ - -I$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM)/. \ + -I$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM) \ -I$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM)/include \ + -I$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM)/register \ -I$(ESP32_SDK_DIR)/components/soc/include \ -I$(ESP32_SDK_DIR)/components/spi_flash/include \ -I$(ESP32_SDK_DIR)/components/spi_flash/include/spi_flash \ @@ -171,10 +228,9 @@ CFLAGS += -Wno-format ifneq (,$(filter riscv32%,$(TARGET_ARCH))) INCLUDES += -I$(ESP32_SDK_DIR)/components/riscv/include CFLAGS += -DCONFIG_IDF_TARGET_ARCH_RISCV - CFLAGS += -march=rv32imc + CFLAGS += -march=rv32imc_zicsr_zifencei CFLAGS += -Wno-error=format= CFLAGS += -nostartfiles - CFLAGS += -Wno-format GCC_NEW_RISCV_ISA ?= $(shell echo "typedef int dont_be_pedantic;" | \ $(TARGET_ARCH)-gcc -march=rv32imac -mabi=ilp32 \ -misa-spec=2.2 -E - > /dev/null 2>&1 && \ @@ -187,53 +243,88 @@ endif ifneq (,$(filter xtensa%,$(TARGET_ARCH))) INCLUDES += -I$(ESP32_SDK_DIR)/components/xtensa/include INCLUDES += -I$(ESP32_SDK_DIR)/components/xtensa/$(CPU_FAM)/include - CFLAGS += -mlongcalls -mtext-section-literals + CFLAGS += -DCONFIG_IDF_TARGET_ARCH_XTENSA + CFLAGS += -mlongcalls + CFLAGS += -mtext-section-literals + CFLAGS += -fno-builtin-memcpy + CFLAGS += -fno-builtin-memset + CFLAGS += -fno-builtin-bzero + CFLAGS += -fno-builtin-stpcpy + CFLAGS += -fno-builtin-strncpy +endif + +ifneq (,$(filter esp32,$(CPU_FAM))) + CFLAGS += -Wno-frame-address endif # BOOTLOADER_BUILD=1 signals to the SDK that's a bootloader build. CFLAGS += \ - -Wno-frame-address \ - -ffunction-sections \ - -fdata-sections \ -Wall \ + -Wextra \ -Werror=all \ + -Wno-error=deprecated-declarations \ + -Wno-error=unused-but-set-variable \ -Wno-error=unused-function \ -Wno-error=unused-variable \ - -Wno-error=deprecated-declarations \ - -Wextra \ - -Wno-unused-parameter \ + -Wno-old-style-declaration \ -Wno-sign-compare \ - -ggdb \ - -Os \ - -freorder-blocks \ - -fstrict-volatile-bitfields \ - -Wno-error=unused-but-set-variable \ + -Wno-unused-parameter \ + -fdata-sections \ + -ffunction-sections \ + -fdiagnostics-color=always \ -fno-jump-tables \ -fno-tree-switch-conversion \ -fno-stack-protector \ + -freorder-blocks \ + -fstrict-volatile-bitfields \ + -ggdb \ + -Os \ -std=gnu99 \ - -Wno-old-style-declaration \ -D_GNU_SOURCE \ -DESP_PLATFORM \ -DBOOTLOADER_BUILD=1 \ + -DNON_OS_BUILD=1 \ + -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE \ + -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ \ + -D_GLIBCXX_HAVE_POSIX_SEMAPHORE \ + -D_GLIBCXX_USE_POSIX_SEMAPHORE \ -DRIOT_BOOTLOADER_BAUD=$(BOOTLOADER_BAUD) \ -DRIOT_FLASH_SIZE=$(FLASH_SIZE) \ - -DWITH_POSIX \ -DHAVE_CONFIG_H \ -MD \ -MT \ # ifneq (,$(filter xtensa%,$(TARGET_ARCH))) - LINKFLAGS = -mlongcalls + LINKFLAGS += -mlongcalls ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS += -L$(ESP32_SDK_DIR)/components/xtensa/$(CPU_FAM) -lxt_hal endif -ifneq (,$(filter esp32 esp32s2,$(CPU_FAM))) - LINKFLAGS = +ifneq (,$(filter esp32,$(CPU_FAM))) ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS += \ -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-funcs.ld \ - -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.spiflash.ld \ + # +else ifneq (,$(filter esp32s2,$(CPU_FAM))) + ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS += \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-funcs.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.spiflash_legacy.ld \ + # +else ifneq (,$(filter esp32s3,$(CPU_FAM))) + ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS += \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.wdt.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.bt_funcs.ld \ + # +else ifneq (,$(filter esp32c3,$(CPU_FAM))) + LINKFLAGS += -nostartfiles + LINKFLAGS += --specs=nosys.specs + ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS += \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.bt_funcs.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.eco3.ld \ + -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.eco3_bt_funcs.ld \ # endif @@ -255,7 +346,6 @@ LINKFLAGS += \ $(ESP_SDK_BOOTLOADER_OBJS) \ $(ESP_SDK_BOOTLOADER_ADDOBJS) \ $(ESP_SDK_BOOTLOADER_ASMOBJS) \ - -Lgcc \ $(ESP_SDK_BOOTLOADER_ADD_LINK_FLAGS) \ -T$(ESP32_SDK_DIR)/components/bootloader/subproject/main/ld/$(CPU_FAM)/bootloader.ld \ -T$(ESP32_SDK_DIR)/components/bootloader/subproject/main/ld/$(CPU_FAM)/bootloader.rom.ld \ @@ -265,6 +355,7 @@ LINKFLAGS += \ -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld \ -Wl,--end-group \ -Wl,-EL \ + # # Build the bootloader on the application directory as it depends on the current # app settings from riotbuild.h. @@ -278,7 +369,6 @@ ESP_SDK_BOOTLOADER_ELF = $(ESP_SDK_BOOTLOADER_DIR)/bootloader.elf ESP_SDK_BOOTLOADER_OBJ_FILTER = \ components/bootloader/subproject/components/micro-ecc/uECC_verify_antifault.o \ components/bootloader_support/src/secure_boot.o \ - components/bootloader_support/src/flash_encrypt.o \ # ESP_SDK_BOOTLOADER_OBJS = \ @@ -310,7 +400,8 @@ $(ESP_SDK_BOOTLOADER_DIR)/%.o: $(ESP32_SDK_DIR)/%.c $(OBJ_DEPS) $(ESP_SDK_BOOTLOADER_ASMOBJS): \ $(ESP_SDK_BOOTLOADER_DIR)/%.o: $(ESP32_SDK_DIR)/%.S $(Q)mkdir -p $(dir $@) - $(Q)$(AS) $(ASFLAGS) -o $@ $(abspath $<) + $(Q)$(CCACHE) $(CC) \ + $(CFLAGS) $(INCLUDES) -MMD -MP -c $(abspath $<) -o $@ $(ESP_SDK_BOOTLOADER_ADDOBJS): \ $(ESP_SDK_BOOTLOADER_DIR)/%.o: $(CURDIR)/stub.c $(OBJ_DEPS) diff --git a/cpu/esp32/bootloader/sdkconfig.h b/cpu/esp32/bootloader/sdkconfig.h index 9d16694813..8902e481c8 100644 --- a/cpu/esp32/bootloader/sdkconfig.h +++ b/cpu/esp32/bootloader/sdkconfig.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2021 iosabi + * Copyright (C) 2024 Gunar Schorcht * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level @@ -24,6 +25,7 @@ * bootloader. * * @author iosabi + * @author Gunar Schorcht */ #ifndef DOXYGEN @@ -48,8 +50,10 @@ extern "C" { #endif +#define CONFIG_BOOTLOADER_PROJECT_VER 1 + #if MODULE_ESP_LOG_COLORED -#define CONFIG_LOG_COLORS 1 +# define CONFIG_BOOTLOADER_LOG_COLORS 1 #endif #ifndef CONFIG_BOOTLOADER_LOG_LEVEL @@ -104,6 +108,10 @@ extern "C" { #define CONFIG_ESP_CONSOLE_UART_NUM 0 #endif +#define CONFIG_ESP_CONSOLE_ROM_SERIAL_PORT_NUM CONFIG_ESP_CONSOLE_UART_NUM + +#define CONFIG_LOG_TAG_LEVEL_IMPL_CACHE_AND_LINKED_LIST 1 + #ifdef __cplusplus } #endif diff --git a/cpu/esp32/bootloader/sdkconfig_default_common.h b/cpu/esp32/bootloader/sdkconfig_default_common.h index 203ffc090f..7abc18945e 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_common.h +++ b/cpu/esp32/bootloader/sdkconfig_default_common.h @@ -25,7 +25,6 @@ extern "C" { #endif #define CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE 1 -#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_BOOTLOADER_WDT_ENABLE 1 #define CONFIG_BOOTLOADER_WDT_TIME_MS 9000 #define CONFIG_BOOTLOADER_RESERVE_RTC_SIZE 0x0 diff --git a/cpu/esp32/bootloader/sdkconfig_default_esp32.h b/cpu/esp32/bootloader/sdkconfig_default_esp32.h index 5897cdd34d..cfda5ff06f 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_esp32.h +++ b/cpu/esp32/bootloader/sdkconfig_default_esp32.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Gunar Schorcht + * Copyright (C) 2024 Gunar Schorcht * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level @@ -24,17 +24,26 @@ extern "C" { #endif -#ifndef CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ -#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 160 +#ifndef CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ +# define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ 160 #endif -#define CONFIG_ESP32_DEBUG_OCDAWARE 1 -#define CONFIG_ESP32_XTAL_FREQ 0 +#define CONFIG_XTAL_FREQ 40 + +#define CONFIG_ESP_DEBUG_OCDAWARE 1 #define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x1000 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4 1 #define CONFIG_EFUSE_MAX_BLK_LEN 192 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0000 +#define CONFIG_MMU_PAGE_SIZE 0x10000 + +#define CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4 1 + +#define CONFIG_ESP_INT_WDT 1 +#define CONFIG_ESP_INT_WDT_TIMEOUT_MS 300 +#define CONFIG_ESP_INT_WDT_CHECK_CPU 1 #ifdef __cplusplus } diff --git a/cpu/esp32/bootloader/sdkconfig_default_esp32c3.h b/cpu/esp32/bootloader/sdkconfig_default_esp32c3.h index 4b4003bfe4..4224be7bc6 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_esp32c3.h +++ b/cpu/esp32/bootloader/sdkconfig_default_esp32c3.h @@ -24,16 +24,20 @@ extern "C" { #endif -#ifndef CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ -#define CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ 160 +#define CONFIG_ESP32C3_REV_MIN 3 + +#ifndef CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ +# define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ 160 #endif -#define CONFIG_ESP32C3_DEBUG_OCDAWARE 1 -#define CONFIG_ESP32C3_REV_MIN 3 +#define CONFIG_XTAL_FREQ 40 + +#define CONFIG_ESP_DEBUG_OCDAWARE 1 #define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0 #define CONFIG_EFUSE_MAX_BLK_LEN 256 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0005 +#define CONFIG_MMU_PAGE_SIZE 0x10000 #define CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG 1 diff --git a/cpu/esp32/bootloader/sdkconfig_default_esp32s2.h b/cpu/esp32/bootloader/sdkconfig_default_esp32s2.h index 9c9dc5d263..96d369011b 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_esp32s2.h +++ b/cpu/esp32/bootloader/sdkconfig_default_esp32s2.h @@ -24,15 +24,19 @@ extern "C" { #endif -#ifndef CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ -#define CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ 160 +#ifndef CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ +# define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ 160 #endif -#define CONFIG_ESP32S2_DEBUG_OCDAWARE 1 +#define CONFIG_XTAL_FREQ 40 + +#define CONFIG_ESP_DEBUG_OCDAWARE 1 #define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x1000 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_EFUSE_MAX_BLK_LEN 256 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0002 +#define CONFIG_MMU_PAGE_SIZE 0x10000 #ifdef __cplusplus } diff --git a/cpu/esp32/bootloader/sdkconfig_default_esp32s3.h b/cpu/esp32/bootloader/sdkconfig_default_esp32s3.h index 69995fdf62..baabd7185a 100644 --- a/cpu/esp32/bootloader/sdkconfig_default_esp32s3.h +++ b/cpu/esp32/bootloader/sdkconfig_default_esp32s3.h @@ -24,15 +24,19 @@ extern "C" { #endif -#ifndef CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ -#define CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ 160 +#ifndef CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ +# define CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ 160 #endif -#define CONFIG_ESP32S3_DEBUG_OCDAWARE 1 +#define CONFIG_XTAL_FREQ 40 + +#define CONFIG_ESP_DEBUG_OCDAWARE 1 #define CONFIG_BOOTLOADER_OFFSET_IN_FLASH 0x0 +#define CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V 1 #define CONFIG_EFUSE_MAX_BLK_LEN 256 #define CONFIG_IDF_FIRMWARE_CHIP_ID 0x0009 +#define CONFIG_MMU_PAGE_SIZE 0x10000 #define CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG 1