[PATCH 5/7] bsps/stm32h7: provide linkcmds for SRAM, FLASH+SDRAM and SRAM+SDRAM linking
Karel Gardas
karel at functional.vision
Mon May 16 12:12:52 UTC 2022
Sponsored-By: Precidata
---
spec/build/bsps/arm/stm32h7/grp.yml | 6 +++
.../bsps/arm/stm32h7/linkcmdsflashsdram.yml | 49 +++++++++++++++++++
spec/build/bsps/arm/stm32h7/linkcmdssram.yml | 49 +++++++++++++++++++
.../bsps/arm/stm32h7/linkcmdssramsdram.yml | 49 +++++++++++++++++++
spec/build/bsps/arm/stm32h7/optlinkcmds.yml | 5 +-
5 files changed, 156 insertions(+), 2 deletions(-)
create mode 100644 spec/build/bsps/arm/stm32h7/linkcmdsflashsdram.yml
create mode 100644 spec/build/bsps/arm/stm32h7/linkcmdssram.yml
create mode 100644 spec/build/bsps/arm/stm32h7/linkcmdssramsdram.yml
diff --git a/spec/build/bsps/arm/stm32h7/grp.yml b/spec/build/bsps/arm/stm32h7/grp.yml
index 401b8b415a..6e7036b6aa 100644
--- a/spec/build/bsps/arm/stm32h7/grp.yml
+++ b/spec/build/bsps/arm/stm32h7/grp.yml
@@ -117,6 +117,12 @@ links:
uid: linkcmds
- role: build-dependency
uid: linkcmdssdram
+- role: build-dependency
+ uid: linkcmdssram
+- role: build-dependency
+ uid: linkcmdssramsdram
+- role: build-dependency
+ uid: linkcmdsflashsdram
- role: build-dependency
uid: ../../bspopts
type: build
diff --git a/spec/build/bsps/arm/stm32h7/linkcmdsflashsdram.yml b/spec/build/bsps/arm/stm32h7/linkcmdsflashsdram.yml
new file mode 100644
index 0000000000..8b24c939bf
--- /dev/null
+++ b/spec/build/bsps/arm/stm32h7/linkcmdsflashsdram.yml
@@ -0,0 +1,49 @@
+build-type: script
+do-build: |
+ bld.install_as("${BSP_LIBDIR}/linkcmds.flash+sdram", "linkcmds.flash+sdram")
+do-configure: |
+ content = """INCLUDE linkcmds.memory
+
+ REGION_ALIAS ("REGION_START", FLASH);
+ REGION_ALIAS ("REGION_VECTOR", FLASH);
+ REGION_ALIAS ("REGION_TEXT", FLASH);
+ REGION_ALIAS ("REGION_TEXT_LOAD", FLASH);
+ REGION_ALIAS ("REGION_RODATA", FLASH);
+ REGION_ALIAS ("REGION_RODATA_LOAD", FLASH);
+ REGION_ALIAS ("REGION_DATA", SRAM_AXI);
+ REGION_ALIAS ("REGION_DATA_LOAD", FLASH);
+ REGION_ALIAS ("REGION_FAST_TEXT", ITCM);
+ REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ITCM);
+ REGION_ALIAS ("REGION_FAST_DATA", DTCM);
+ REGION_ALIAS ("REGION_FAST_DATA_LOAD", DTCM);
+ REGION_ALIAS ("REGION_BSS", SRAM_AXI);
+ REGION_ALIAS ("REGION_WORK", SDRAM_2);
+ REGION_ALIAS ("REGION_STACK", SRAM_AXI);
+ REGION_ALIAS ("REGION_NOCACHE", SRAM_1);
+ REGION_ALIAS ("REGION_NOCACHE_LOAD", FLASH);
+
+ bsp_vector_table_in_start_section = 1;
+ """
+
+ if conf.env.STM32H7_ENABLE_MPU_ALIGNMENT:
+ content += """
+ bsp_align_text_and_rodata_end_to_power_of_2 = 1;
+ """
+
+ content += """
+ INCLUDE linkcmds.armv7m
+ """
+ f = conf.bldnode.make_node(
+ conf.env.VARIANT + "/linkcmds.flash+sdram"
+ )
+ f.parent.mkdir()
+ f.write(content)
+ conf.env.append_value("cfg_files", f.abspath())
+enabled-by: true
+links: []
+prepare-build: null
+prepare-configure: null
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/stm32h7/linkcmdssram.yml b/spec/build/bsps/arm/stm32h7/linkcmdssram.yml
new file mode 100644
index 0000000000..808bff3627
--- /dev/null
+++ b/spec/build/bsps/arm/stm32h7/linkcmdssram.yml
@@ -0,0 +1,49 @@
+build-type: script
+do-build: |
+ bld.install_as("${BSP_LIBDIR}/linkcmds.sram", "linkcmds.sram")
+do-configure: |
+ content = """INCLUDE linkcmds.memory
+
+ REGION_ALIAS ("REGION_START", SRAM_AXI);
+ REGION_ALIAS ("REGION_VECTOR", SRAM_AXI);
+ REGION_ALIAS ("REGION_TEXT", SRAM_AXI);
+ REGION_ALIAS ("REGION_TEXT_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_RODATA", SRAM_AXI);
+ REGION_ALIAS ("REGION_RODATA_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_DATA", SRAM_AXI);
+ REGION_ALIAS ("REGION_DATA_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_FAST_TEXT", ITCM);
+ REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ITCM);
+ REGION_ALIAS ("REGION_FAST_DATA", DTCM);
+ REGION_ALIAS ("REGION_FAST_DATA_LOAD", DTCM);
+ REGION_ALIAS ("REGION_BSS", SRAM_AXI);
+ REGION_ALIAS ("REGION_WORK", SRAM_AXI);
+ REGION_ALIAS ("REGION_STACK", SRAM_AXI);
+ REGION_ALIAS ("REGION_NOCACHE", SRAM_1);
+ REGION_ALIAS ("REGION_NOCACHE_LOAD", SRAM_AXI);
+
+ bsp_vector_table_in_start_section = 1;
+ """
+
+ if conf.env.STM32H7_ENABLE_MPU_ALIGNMENT:
+ content += """
+ bsp_align_text_and_rodata_end_to_power_of_2 = 1;
+ """
+
+ content += """
+ INCLUDE linkcmds.armv7m
+ """
+ f = conf.bldnode.make_node(
+ conf.env.VARIANT + "/linkcmds.sram"
+ )
+ f.parent.mkdir()
+ f.write(content)
+ conf.env.append_value("cfg_files", f.abspath())
+enabled-by: true
+links: []
+prepare-build: null
+prepare-configure: null
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/stm32h7/linkcmdssramsdram.yml b/spec/build/bsps/arm/stm32h7/linkcmdssramsdram.yml
new file mode 100644
index 0000000000..a1122d6551
--- /dev/null
+++ b/spec/build/bsps/arm/stm32h7/linkcmdssramsdram.yml
@@ -0,0 +1,49 @@
+build-type: script
+do-build: |
+ bld.install_as("${BSP_LIBDIR}/linkcmds.sram+sdram", "linkcmds.sram+sdram")
+do-configure: |
+ content = """INCLUDE linkcmds.memory
+
+ REGION_ALIAS ("REGION_START", SRAM_AXI);
+ REGION_ALIAS ("REGION_VECTOR", SRAM_AXI);
+ REGION_ALIAS ("REGION_TEXT", SRAM_AXI);
+ REGION_ALIAS ("REGION_TEXT_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_RODATA", SRAM_AXI);
+ REGION_ALIAS ("REGION_RODATA_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_DATA", SRAM_AXI);
+ REGION_ALIAS ("REGION_DATA_LOAD", SRAM_AXI);
+ REGION_ALIAS ("REGION_FAST_TEXT", ITCM);
+ REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ITCM);
+ REGION_ALIAS ("REGION_FAST_DATA", DTCM);
+ REGION_ALIAS ("REGION_FAST_DATA_LOAD", DTCM);
+ REGION_ALIAS ("REGION_BSS", SRAM_AXI);
+ REGION_ALIAS ("REGION_WORK", SDRAM_2);
+ REGION_ALIAS ("REGION_STACK", SRAM_AXI);
+ REGION_ALIAS ("REGION_NOCACHE", SRAM_1);
+ REGION_ALIAS ("REGION_NOCACHE_LOAD", SRAM_AXI);
+
+ bsp_vector_table_in_start_section = 1;
+ """
+
+ if conf.env.STM32H7_ENABLE_MPU_ALIGNMENT:
+ content += """
+ bsp_align_text_and_rodata_end_to_power_of_2 = 1;
+ """
+
+ content += """
+ INCLUDE linkcmds.armv7m
+ """
+ f = conf.bldnode.make_node(
+ conf.env.VARIANT + "/linkcmds.sram+sdram"
+ )
+ f.parent.mkdir()
+ f.write(content)
+ conf.env.append_value("cfg_files", f.abspath())
+enabled-by: true
+links: []
+prepare-build: null
+prepare-configure: null
+type: build
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
diff --git a/spec/build/bsps/arm/stm32h7/optlinkcmds.yml b/spec/build/bsps/arm/stm32h7/optlinkcmds.yml
index a7281addd8..d767ade48c 100644
--- a/spec/build/bsps/arm/stm32h7/optlinkcmds.yml
+++ b/spec/build/bsps/arm/stm32h7/optlinkcmds.yml
@@ -13,8 +13,9 @@ format: '{}'
links: []
name: STM32H7_DEFAULT_LINKCMDS
description: |
- The default linker command file. Must be either linkcmds.flash or
- linkcmds.sdram.
+ The default linker command file. Must be either linkcmds.flash,
+ linkcmds.sdram, linkcmds.sram, linkcmds.sram+sdram
+ or linkcmds.flash+sdram
type: build
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
--
2.25.1
More information about the devel
mailing list