-
Notifications
You must be signed in to change notification settings - Fork 772
Xip mcuboot #2323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Xip mcuboot #2323
Changes from all commits
09fc970
2cf744b
bbe0c73
b2d16e6
e3b8bd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y | ||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n | ||
CONFIG_BOOT_MAX_IMG_SECTORS=1024 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2025 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* | ||
* Define the device, controller and partition to be the external memory | ||
* for running the application in external NOR from MCUboot | ||
*/ | ||
|
||
/delete-node/ &slot0_partition; | ||
/delete-node/ &slot1_partition; | ||
/delete-node/ &scratch_partition; | ||
/delete-node/ &storage_partition; | ||
|
||
&mx25lm51245 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
slot0_partition: partition@0 { | ||
label = "image-0"; | ||
reg = <0x00000000 DT_SIZE_K(416)>; | ||
}; | ||
slot1_partition: partition@68000 { | ||
label = "image-1"; | ||
reg = <0x00068000 DT_SIZE_K(416)>; | ||
}; | ||
scratch_partition: partition@d0000 { | ||
label = "image-scratch"; | ||
reg = <0x000d00000 DT_SIZE_K(64)>; | ||
}; | ||
Comment on lines
+31
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and unless you have different sector sizes or variable sector sizes, scratch should not be present |
||
storage_partition: partition@e0000 { | ||
label = "storage"; | ||
reg = <0x000e0000 DT_SIZE_K(64)>; | ||
}; }; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y | ||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n | ||
CONFIG_BOOT_MAX_IMG_SECTORS=4096 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y | ||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n | ||
CONFIG_BOOT_MAX_IMG_SECTORS=4096 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y | ||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n | ||
CONFIG_BOOT_MAX_IMG_SECTORS=256 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y | ||
CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n | ||
CONFIG_BOOT_MAX_IMG_SECTORS=4096 |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -20,7 +20,23 @@ | |||||||||||
|
||||||||||||
BOOT_LOG_MODULE_DECLARE(mcuboot); | ||||||||||||
|
||||||||||||
#if (!defined(CONFIG_XTENSA) && DT_HAS_CHOSEN(zephyr_flash_controller)) | ||||||||||||
#if defined(CONFIG_STM32_MEMMAP) | ||||||||||||
/* MEMORY MAPPED for XiP on external NOR flash takes the sspi-nor or ospi-nor or qspi-nor device */ | ||||||||||||
#define FLASH_DEVICE_ID SPI_FLASH_0_ID | ||||||||||||
#if DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_xspi_nor), okay) | ||||||||||||
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_xspi_nor) | ||||||||||||
#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, st_stm32_xspi),1) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instance 0 of
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just ran into this exact issue on my STM32H7S78-DK, see zephyrproject-rtos/zephyr#88052 (comment) This is because the flash for XiP is on XSPI2, and there is a PSRAM on XSPI1 which is therefore enabled in the device tree. Consequently, the macro being reviewed here is mistakenly using the XSPI1 (PSRAM) address space instead of XSPI2. I solved the issue with the following change:
Suggested change
I think we could do the same for ospi/qspi as well |
||||||||||||
#elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_ospi_nor), okay) | ||||||||||||
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_ospi_nor) | ||||||||||||
#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_ospi_nor)) | ||||||||||||
#elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_qspi_nor), okay) | ||||||||||||
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_qspi_nor) | ||||||||||||
#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_qspi_nor)) | ||||||||||||
#else | ||||||||||||
#error "FLASH_DEVICE_NODE could not be determined" | ||||||||||||
#endif | ||||||||||||
|
||||||||||||
#elif (!defined(CONFIG_XTENSA) && DT_HAS_CHOSEN(zephyr_flash_controller)) | ||||||||||||
#define FLASH_DEVICE_ID SOC_FLASH_0_ID | ||||||||||||
#define FLASH_DEVICE_BASE CONFIG_FLASH_BASE_ADDRESS | ||||||||||||
#define FLASH_DEVICE_NODE DT_CHOSEN(zephyr_flash_controller) | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I said in the other PR, adding this here is pointless, this should go in your base board file in zephyr otherwise you will have completely different partitions for mcuboot vs every application, and the applications will not boot because of that