-
Notifications
You must be signed in to change notification settings - Fork 750
mcuboot supports the stm32 external flash in XiP mode #2154
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?
Changes from all commits
0adf7c0
aeb7b21
438c4bf
a295ea2
8d36285
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,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
FRASTM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
}; |
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,12 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
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. this whole file shouldn't be needed since flash is already set here: https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts#L22 and code partition will be applied automatically via app.overlay |
||
zephyr,code-partition = &boot_partition; | ||
FRASTM marked this conversation as resolved.
Show resolved
Hide resolved
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.
|
||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
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,11 @@ | ||
/* | ||
* Copyright (c) 2025 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
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.
needed here (potentially for other boards as well, I only have access to this one). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
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,12 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
FRASTM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONFIG_BOOT_DIRECT_XIP=y | ||
CONFIG_STM32_MEMMAP=y |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2024 STMicroelectronics | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/ { | ||
chosen { | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &boot_partition; | ||
}; | ||
}; |
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(DT_INST(0, st_stm32_xspi_nor)) | ||
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. Shouldn't this be changed following #88646? 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. Yes, the FLASH_DEVICE_BASE is now given by the parent of the "st,stm32-xspi-nor" node. However 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. only 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. @nordicjm Following zephyrproject-rtos/zephyr#88646, we're reusing similar bindings as you or NXP do for external memories (memory mapping address of the memory provided in a second reg cell of the memoy parent node ). I would expect we could align on a common code on mcuboot for this case, but apparently 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 am checking when the CONFIG_FLASH_BASE_ADDRESS is given by the Kconfig.defconfig for any stm32 soc as follows:
The CONFIG_FLASH_BASE_ADDRESS is correctly defined = 0x90000000 which is the second reg of the xspi node:
Then build option -DCONFIG_FLASH_BASE_ADDRESS=0x90000000 is not required anymore and the application is correclty linked for external address of the NOR octo-flash |
||
#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.
this should be in the board dts in zephyr
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.
it is in each board dts for zephyr, so I think I can remove it from each overlay