diff --git a/arch/xtensa/src/esp32s3/Bootloader.mk b/arch/xtensa/src/esp32s3/Bootloader.mk index 015e54229d0..c675f76fdb6 100644 --- a/arch/xtensa/src/esp32s3/Bootloader.mk +++ b/arch/xtensa/src/esp32s3/Bootloader.mk @@ -36,6 +36,7 @@ BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif MCUBOOT_URL = https://github.com/mcu-tools/mcuboot +MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake $(BOOTLOADER_DIR): $(Q) mkdir -p $(BOOTLOADER_DIR) &>/dev/null @@ -105,7 +106,8 @@ $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_ -c esp32s3 \ -f $(BOOTLOADER_CONFIG) \ -p $(BOOTLOADER_DIR) \ - -e $(HALDIR) + -e $(HALDIR) \ + -d $(MCUBOOT_TOOLCHAIN) $(call COPYFILE, $(BOOTLOADER_DIR)/$(BOOTLOADER_OUTDIR)/mcuboot-esp32s3.bin, $(TOPDIR)) bootloader: $(BOOTLOADER_CONFIG) $(BOOTLOADER_BIN) diff --git a/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake b/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake new file mode 100644 index 00000000000..6ea93ddc558 --- /dev/null +++ b/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake @@ -0,0 +1,40 @@ +# ############################################################################## +# tools/esp32s3/mcuboot_toolchain_esp32s3.cmake +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for +# additional information regarding copyright ownership. The ASF licenses this +# file to you under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +# ############################################################################## + +set(CMAKE_SYSTEM_NAME Generic) + +set(CMAKE_C_COMPILER xtensa-esp32s3-elf-gcc) +set(CMAKE_CXX_COMPILER xtensa-esp32s3-elf-g++) +set(CMAKE_ASM_COMPILER xtensa-esp32s3-elf-gcc) +set(_CMAKE_TOOLCHAIN_PREFIX xtensa-esp32s3-elf-) + +set(CMAKE_C_FLAGS + "-mlongcalls" + CACHE STRING "C Compiler Base Flags" FORCE) +set(CMAKE_CXX_FLAGS + "-mlongcalls" + CACHE STRING "C++ Compiler Base Flags" FORCE) +set(CMAKE_ASM_FLAGS + "${UNIQ_CMAKE_ASM_FLAGS}" + CACHE STRING "ASM Compiler Base Flags" FORCE) + +set(CMAKE_EXE_LINKER_FLAGS + "-Wl,--gc-sections" + CACHE STRING "Linker Base Flags")