Skip to content

Commit 25c3072

Browse files
LucasTamboralmir-okato
authored andcommitted
mcuboot: build MCUboot Espressif Port with Zephyr sysbuild
Skip building the hal sources from zephyr/<SOC>/CMakeLists.txt when building MCUboot Espressif port from Zephyr's sysbuild as it already have it's own way for integrating the Espressif hal. Signed-off-by: Lucas Tamborrino <[email protected]> Signed-off-by: Almir Okato <[email protected]>
1 parent 202c595 commit 25c3072

File tree

23 files changed

+69
-12
lines changed

23 files changed

+69
-12
lines changed

components/bootloader_support/include/esp_flash_partitions.h

+4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include "esp_err.h"
99
#include "esp_types.h"
1010
#include "sdkconfig.h"
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include <zephyr/storage/flash_map.h>
13+
#endif
1214

1315
#ifdef __cplusplus
1416
extern "C" {
@@ -38,7 +40,9 @@ extern "C" {
3840
/* The md5sum value is found this many bytes after the ESP_PARTITION_MAGIC_MD5 offset */
3941
#define ESP_PARTITION_MD5_OFFSET 16
4042

43+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4144
#define CONFIG_BOOTLOADER_OFFSET_IN_FLASH FIXED_PARTITION_OFFSET(boot_partition) /* Offset of bootloader image. */
45+
#endif
4246

4347
/* Pre-partition table fixed flash offsets */
4448
#define ESP_BOOTLOADER_DIGEST_OFFSET 0x0

components/bootloader_support/src/bootloader_console_loader.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
#include "esp32s3/rom/usb/cdc_acm.h"
2626
#include "esp32s3/rom/usb/usb_persist.h"
2727
#endif
28+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
2829
#include "stubs.h"
29-
30+
#endif
3031
#ifdef CONFIG_ESP_CONSOLE_USB_CDC
3132
/* The following functions replace esp_rom_uart_putc, esp_rom_uart_tx_one_char,
3233
* and uart_tx_one_char_uart ROM functions. The main difference is that

components/bootloader_support/src/esp32/bootloader_esp32.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
#include "esp_rom_sys.h"
3737
#include "esp_rom_spiflash.h"
3838
#include "esp_efuse.h"
39+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
3940
#include "esp_flash_internal.h"
41+
#endif
4042

4143
static const char *TAG = "boot.esp32";
4244

@@ -211,7 +213,7 @@ esp_err_t bootloader_init(void)
211213
// print 2nd bootloader banner
212214
bootloader_print_banner();
213215

214-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
216+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
215217
spi_flash_init_chip_state();
216218
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
217219
return ret;

components/bootloader_support/src/esp32c2/bootloader_esp32c2.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "esp_efuse.h"
4040
#include "hal/mmu_hal.h"
4141
#include "hal/cache_hal.h"
42-
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
42+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4343
#include "esp_flash_internal.h"
4444
#endif
4545

@@ -124,7 +124,7 @@ esp_err_t bootloader_init(void)
124124
/* print 2nd bootloader banner */
125125
bootloader_print_banner();
126126

127-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
127+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
128128
spi_flash_init_chip_state();
129129
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
130130
return ret;

components/bootloader_support/src/esp32c3/bootloader_esp32c3.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "hal/mmu_hal.h"
4545
#include "hal/cache_hal.h"
4646
#include "hal/efuse_hal.h"
47-
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
47+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4848
#include "esp_flash_internal.h"
4949
#endif
5050

@@ -163,7 +163,7 @@ esp_err_t bootloader_init(void)
163163
/* print 2nd bootloader banner */
164164
bootloader_print_banner();
165165

166-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
166+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
167167
spi_flash_init_chip_state();
168168
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
169169
return ret;

components/bootloader_support/src/esp32c6/bootloader_esp32c6.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include "soc/lp_wdt_reg.h"
4646
#include "hal/efuse_hal.h"
4747
#include "modem/modem_lpcon_reg.h"
48-
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
48+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4949
#include "esp_flash_internal.h"
5050
#endif
5151

@@ -145,7 +145,7 @@ esp_err_t bootloader_init(void)
145145
/* print 2nd bootloader banner */
146146
bootloader_print_banner();
147147

148-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
148+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
149149
spi_flash_init_chip_state();
150150
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
151151
return ret;

components/bootloader_support/src/esp32s2/bootloader_esp32s2.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "esp_efuse.h"
3939
#include "hal/mmu_hal.h"
4040
#include "hal/cache_hal.h"
41-
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
41+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4242
#include "esp_flash_internal.h"
4343
#endif
4444

@@ -147,7 +147,7 @@ esp_err_t bootloader_init(void)
147147
/* print 2nd bootloader banner */
148148
bootloader_print_banner();
149149

150-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
150+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
151151
spi_flash_init_chip_state();
152152
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
153153
return ret;

components/bootloader_support/src/esp32s3/bootloader_esp32s3.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "hal/cache_hal.h"
4141
#include "xtensa/config/core.h"
4242
#include "xt_instr_macros.h"
43-
#if !defined(CONFIG_BOOTLOADER_MCUBOOT)
43+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
4444
#include "esp_flash_internal.h"
4545
#endif
4646

@@ -181,7 +181,7 @@ esp_err_t bootloader_init(void)
181181
/* print 2nd bootloader banner */
182182
bootloader_print_banner();
183183

184-
#ifndef CONFIG_BOOTLOADER_MCUBOOT
184+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
185185
spi_flash_init_chip_state();
186186
if ((ret = esp_flash_init_default_chip()) != ESP_OK) {
187187
return ret;

components/esp_common/include/esp_compiler.h

+2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
#pragma once
88

9+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
910
#include <zephyr/toolchain.h>
11+
#endif
1012

1113
/*
1214
* Utility macros used for designated initializers, which work differently

components/esp_hw_support/include/esp_cpu.h

+10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
#pragma once
88

9+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
910
#include <zephyr/kernel.h>
11+
#endif
1012

1113
#include "sdkconfig.h"
1214
#include <stdbool.h>
@@ -373,7 +375,11 @@ FORCE_INLINE_ATTR void *esp_cpu_intr_get_handler_arg(int intr_num)
373375
FORCE_INLINE_ATTR void esp_cpu_intr_enable(uint32_t intr_mask)
374376
{
375377
#ifdef __XTENSA__
378+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
376379
z_xt_ints_on(intr_mask);
380+
#else
381+
xt_ints_on(intr_mask);
382+
#endif
377383
#else
378384
rv_utils_intr_enable(intr_mask);
379385
#endif
@@ -387,7 +393,11 @@ FORCE_INLINE_ATTR void esp_cpu_intr_enable(uint32_t intr_mask)
387393
FORCE_INLINE_ATTR void esp_cpu_intr_disable(uint32_t intr_mask)
388394
{
389395
#ifdef __XTENSA__
396+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
390397
z_xt_ints_off(intr_mask);
398+
#else
399+
xt_ints_off(intr_mask);
400+
#endif
391401
#else
392402
rv_utils_intr_disable(intr_mask);
393403
#endif

components/soc/esp32/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdbool.h>
99
#include <stddef.h>
1010
#include <stdint.h>
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include "stubs.h"
13+
#endif
1214
#include "soc/soc.h"
1315
#include "soc/rtc_periph.h"
1416
#include "soc/clk_tree_defs.h"

components/soc/esp32c2/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdbool.h>
99
#include <stddef.h>
1010
#include <stdint.h>
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include "stubs.h"
13+
#endif
1214
#include "soc/soc.h"
1315
#include "soc/clk_tree_defs.h"
1416

components/soc/esp32c2/include/soc/soc.h

+2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
#include "esp_bit_defs.h"
1515
#include "reg_base.h"
16+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1617
#include "stubs.h"
18+
#endif
1719

1820
#define PRO_CPU_NUM (0)
1921

components/soc/esp32c3/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdbool.h>
99
#include <stddef.h>
1010
#include <stdint.h>
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include "stubs.h"
13+
#endif
1214
#include "soc/soc.h"
1315
#include "soc/clk_tree_defs.h"
1416

components/soc/esp32c6/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdbool.h>
99
#include <stddef.h>
1010
#include <stdint.h>
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include "stubs.h"
13+
#endif
1214
#include "soc/soc.h"
1315
#include "soc/clk_tree_defs.h"
1416

components/soc/esp32s2/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include <stdbool.h>
99
#include <stddef.h>
1010
#include <stdint.h>
11+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1112
#include "stubs.h"
13+
#endif
1214
#include "soc/soc.h"
1315
#include "soc/clk_tree_defs.h"
1416

components/soc/esp32s3/include/soc/rtc.h

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include <stdbool.h>
1010
#include <stddef.h>
1111
#include <stdint.h>
12+
#ifndef CONFIG_MCUBOOT_ESPRESSIF
1213
#include "stubs.h"
14+
#endif
1315
#include "soc/soc.h"
1416
#include "soc/clk_tree_defs.h"
1517

zephyr/esp32/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

zephyr/esp32c2/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32C2)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

zephyr/esp32c3/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32C3)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

zephyr/esp32c6/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32C6)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

zephyr/esp32s2/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32S2)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

zephyr/esp32s3/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
if(CONFIG_MCUBOOT_ESPRESSIF)
4+
return()
5+
endif()
6+
37
if(CONFIG_SOC_SERIES_ESP32S3)
48

59
zephyr_compile_options(-fstrict-volatile-bitfields)

0 commit comments

Comments
 (0)