Skip to content
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

Detailed examples memory.x files for all current STM32H7xx device families #299

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,27 @@ rt = ["stm32h7/rt"]
usb_hs = ["synopsys-usb-otg", "synopsys-usb-otg/hs"]
stm32h742 = ["stm32h7/stm32h743", "device-selected", "rm0433"]
stm32h743 = ["stm32h7/stm32h743", "device-selected", "rm0433"]
stm32h753 = ["stm32h7/stm32h753", "device-selected", "rm0433"]
stm32h750 = ["stm32h7/stm32h743", "device-selected", "rm0433"]
stm32h753 = ["stm32h7/stm32h753", "device-selected", "rm0433"]
stm32h742v = ["stm32h7/stm32h743v", "device-selected", "revision_v", "rm0433"]
stm32h743v = ["stm32h7/stm32h743v", "device-selected", "revision_v", "rm0433"]
stm32h753v = ["stm32h7/stm32h753v", "device-selected", "revision_v", "rm0433"]
stm32h750v = ["stm32h7/stm32h743v", "device-selected", "revision_v", "rm0433"]
stm32h747cm7 = ["stm32h7/stm32h747cm7", "device-selected", "revision_v", "rm0399", "cm7", "dsi", "smps"]
stm32h7b3 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"]
stm32h7b0 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"]
stm32h7a3 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"]
stm32h753v = ["stm32h7/stm32h753v", "device-selected", "revision_v", "rm0433"]
stm32h745cm7 = ["stm32h7/stm32h747cm7", "device-selected", "revision_v", "rm0399", "cm7", "smps"]
stm32h747cm7 = ["stm32h7/stm32h747cm7", "device-selected", "revision_v", "rm0399", "cm7", "smps", "dsi"]
stm32h755cm7 = ["stm32h7/stm32h747cm7", "device-selected", "revision_v", "rm0399", "cm7", "smps"]
stm32h757cm7 = ["stm32h7/stm32h747cm7", "device-selected", "revision_v", "rm0399", "cm7", "smps", "dsi"]
stm32h7a3 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455"]
stm32h7a3q = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"] # SMPS is only available on STM32H7A3xIxxQ and STM32H7A3xGxxQ versions.
stm32h7b0 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455"]
stm32h7b0q = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"] # SMPS is only available on STM32H7B0xIxxQ versions.
stm32h7b3 = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455"]
stm32h7b3q = ["stm32h7/stm32h7b3", "device-selected", "revision_v", "rm0455", "smps"] # SMPS is only available on STM32H7B3xIxxQ versions.
stm32h723 = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468"]
stm32h725 = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468", "smps"]
stm32h730 = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468"]
stm32h730q = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468", "smps"] # SMPS is only available on STM32H730xxxxQ versions.
stm32h733 = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468"]
stm32h735 = ["stm32h7/stm32h735", "device-selected", "revision_v", "rm0468", "smps"]
# Flags for examples
log-itm = []
Expand Down
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ Collaboration on this crate is highly welcome, as are pull requests!
Supported Configurations
------------------------

* __stm32h743v__ (Revision V: stm32h743, stm32h742, stm32h750)
* __stm32h753v__
* __stm32h747cm7__ (stm32h747, stm32h757)
* __stm32h7b3__
* __stm32h7b0__
* __stm32h743v__ (Revision V: stm32h742, stm32h743, stm32h750)
* __stm32h753v__ (Revision V: stm32h753
* __stm32h747cm7__ (stm32h745, stm32h747, stm32h755, stm32h757)
* __stm32h7a3__
* __stm32h735__ (stm32h725, stm32h735)
* __stm32h7b0__
* __stm32h7b3__
* __stm32h735__ (stm32h723, stm32h725, stm32h730, stm32h733, stm32h735)

#### Old revision STM32H742/743/750/753 parts

Expand All @@ -46,8 +46,37 @@ revision (Revision Y) are supported by feature gates without the 'v'
suffix. (__stm32h743__, __stm32h753__)

#### Dual core parts (Cortex M7 + Cortex M4)

On dual core parts, currently only the Cortex M7 core is supported.

#### Family-specific memory.x

Each H7 device family has a somewhat different memory layout. To make starting
a project easier, a specific example memory.x file is included for each family.
You can use these to replace the memory.x included in this crate for the examples.

The memory layout for each device family is specified in their respective
reference manual (RM). The table below relates the various parts to their
applicable memory.x and reference manual.

RM | memory.x | Applicable devices
-------|------------------------------|----------------------------------------
RM0399 | memory_745_747_755_757.x | stm32h745, stm32h747, stm32h755, stm32h757
RM0433 | memory_742.x | stm32h742
RM0433 | memory_743_750_753.x | stm32h743, stm32h750, stm32h753
RM0455 | memory_7A3_7B0_7B3.x | stm32h7a3, stm32h7b0, stm32h7b3
RM0468 | memory_723_725_730_733_735.x | stm32h723, stm32h725, stm32h730, stm32h733, stm32h735

To use these files, substitute memory.x by the applicable one and update the
flash memory size as indicated below.

⚠️: If you use [flip-link](https://github.com/knurling-rs/flip-link) for stack
overflow protection, there is one more change to make. Flip-link does not (yet)
support the use of region aliases and expects an entry called RAM in the MEMORY
block. The work-around is to comment-out the "REGION_ALIAS(RAM, DTCM)" line and
manually substitute the RAM label in the respective MEMORY entry. Eg: replace
DTCM by RAM.

#### Flash memory size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this little "Flash memory size" section, I think it's sufficiently covered by the new memory__.x files now


By default this crate assumes a 2Mbyte flash size. To set a smaller limit for
Expand Down
106 changes: 106 additions & 0 deletions memory_723_725_730_733_735.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
MEMORY
{
/* This file is intended for parts in the STM32H735 family. (RM0468) */
/* - FLASH and RAM are mandatory memory sections. */
/* - The sum of all non-FLASH sections must add to 564k total device RAM. */
/* - The FLASH section size must match your device, see table below. */

/* FLASH */
/* Select the appropriate FLASH size for your device. */
/* - STM32H730xB 128K */
/* - STM32H723xE/725xE 512K */
/* - STM32H723xG/725xG/733xG/735xG 1M */
FLASH1 : ORIGIN = 0x08000000, LENGTH = 1M

/* Data TCM */
/* - Two contiguous 64KB RAMs. */
/* - Used for interrupt handlers, stacks and general RAM. */
/* - Zero wait-states. */
/* - The DTCM is taken as the origin of the base ram. (See below.) */
/* This is also where the interrupt table and such will live, */
/* which is required for deterministic performance. */
DTCM : ORIGIN = 0x20000000, LENGTH = 128K

/* Instruction TCM */
/* - More memory can be assigned to ITCM. See AXI SRAM notes, below. */
/* - Used for latency-critical interrupt handlers etc. */
/* - Zero wait-states. */
ITCM : ORIGIN = 0x00000000, LENGTH = 64K + 0K

/* AXI SRAM */
/* - AXISRAM is in D1 and accessible by all system masters except BDMA. */
/* - Suitable for application data not stored in DTCM. */
/* - Zero wait-states. */
/* - The 192k of extra shared RAM is fully allotted to the AXI SRAM by default. */
/* As a result: 64k (64k + 0k) for ITCM and 320k (128k + 192k) for AXI SRAM. */
/* This can be re-configured via the TCM_AXI_SHARED[1,0] register when more */
/* ITCM is required. */
AXISRAM : ORIGIN = 0x24000000, LENGTH = 128K + 192K

/* AHB SRAM */
/* - SRAM1-2 are in D2 and accessible by all system masters except BDMA, LTDC */
/* and SDMMC1. Suitable for use as DMA buffers. */
/* - SRAM4 is in D3 and additionally accessible by the BDMA. Used for BDMA */
/* buffers, for storing application data in lower-power modes. */
/* - Zero wait-states. */
SRAM1 : ORIGIN = 0x30000000, LENGTH = 16K
SRAM2 : ORIGIN = 0x30040000, LENGTH = 16K
SRAM4 : ORIGIN = 0x38000000, LENGTH = 16K

/* Backup SRAM */
/* Used to store data during low-power sleeps. */
BSRAM : ORIGIN = 0x38800000, LENGTH = 4K
}

/*
/* Assign the memory regions defined above for use. */
/*

/* Provide the mandatory FLASH and RAM definitions for cortex-m-rt's linker script. */
REGION_ALIAS(FLASH, FLASH1);
REGION_ALIAS(RAM, DTCM);

/* The location of the stack can be overridden using the `_stack_start` symbol. */
/* - Set the stack location at the end of RAM, using all remaining space. */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);

/* The location of the .text section can be overridden using the */
/* `_stext` symbol. By default it will place after .vector_table. */
/* _stext = ORIGIN(FLASH) + 0x40c; */

/* Define sections for placing symbols into the extra memory regions above. */
/* This makes them accessible from code. */
/* - ITCM, DTCM and AXISRAM connect to a 64-bit wide bus -> align to 8 bytes. */
/* - All other memories connect to a 32-bit wide bus -> align to 4 bytes. */
SECTIONS {
.itcm (NOLOAD) : ALIGN(8) {
*(.itcm .itcm.*);
. = ALIGN(8);
} > ITCM

.axisram (NOLOAD) : ALIGN(8) {
*(.axisram .axisram.*);
. = ALIGN(8);
} > AXISRAM

.sram1 (NOLOAD) : ALIGN(4) {
*(.sram1 .sram1.*);
. = ALIGN(4);
} > SRAM1

.sram2 (NOLOAD) : ALIGN(4) {
*(.sram2 .sram2.*);
. = ALIGN(4);
} > SRAM2

.sram4 (NOLOAD) : ALIGN(4) {
*(.sram4 .sram4.*);
. = ALIGN(4);
} > SRAM4

.bsram (NOLOAD) : ALIGN(4) {
*(.bsram .bsram.*);
. = ALIGN(4);
} > BSRAM

};
107 changes: 107 additions & 0 deletions memory_742.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
MEMORY
{
/* This file is intended for parts in the STM32H742/742v families. (RM0433) */
/* - FLASH and RAM are mandatory memory sections. */
/* - The sum of all non-FLASH sections must add to 692K total device RAM. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only family that supports re-assigning memory around the map is STM32H735, so I don't think there's any value in stating this sum for the other families

/* - The FLASH section size must match your device, see table below. */

/* FLASH */
/* Flash is divided in two independent banks. */
/* Select the appropriate FLASH size for your device. */
/* - STM32H742xG 1M (512K + 512K) */
/* - STM32H742xI 2M ( 1M + 1M) */
FLASH1 : ORIGIN = 0x08000000, LENGTH = 1M
FLASH2 : ORIGIN = 0x08100000, LENGTH = 1M

/* Data TCM */
/* - Two contiguous 64KB RAMs. */
/* - Used for interrupt handlers, stacks and general RAM. */
/* - Zero wait-states. */
/* - The DTCM is taken as the origin of the base ram. (See below.) */
/* This is also where the interrupt table and such will live, */
/* which is required for deterministic performance. */
DTCM : ORIGIN = 0x20000000, LENGTH = 128K

/* Instruction TCM */
/* - Used for latency-critical interrupt handlers etc. */
/* - Zero wait-states. */
ITCM : ORIGIN = 0x00000000, LENGTH = 64K

/* AXI SRAM */
/* - AXISRAM is in D1 and accessible by all system masters except BDMA. */
/* - Suitable for application data not stored in DTCM. */
/* - Zero wait-states. */
AXISRAM : ORIGIN = 0x24000000, LENGTH = 384K

/* AHB SRAM */
/* - SRAM1-2 are in D2 and accessible by all system masters except BDMA. */
/* Suitable for use as DMA buffers. */
/* - SRAM4 is in D3 and additionally accessible by the BDMA. Used for BDMA */
/* buffers, for storing application data in lower-power modes. */
/* - Zero wait-states. */
SRAM1 : ORIGIN = 0x30000000, LENGTH = 32K
SRAM2 : ORIGIN = 0x30020000, LENGTH = 16K
SRAM4 : ORIGIN = 0x38000000, LENGTH = 64K

/* Backup SRAM */
/* Used to store data during low-power sleeps. */
BSRAM : ORIGIN = 0x38800000, LENGTH = 4K
}

/*
/* Assign the memory regions defined above for use. */
/*

/* Provide the mandatory FLASH and RAM definitions for cortex-m-rt's linker script. */
REGION_ALIAS(FLASH, FLASH1);
REGION_ALIAS(RAM, DTCM);

/* The location of the stack can be overridden using the `_stack_start` symbol. */
/* - Set the stack location at the end of RAM, using all remaining space. */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);

/* The location of the .text section can be overridden using the */
/* `_stext` symbol. By default it will place after .vector_table. */
/* _stext = ORIGIN(FLASH) + 0x40c; */

/* Define sections for placing symbols into the extra memory regions above. */
/* This makes them accessible from code. */
/* - ITCM, DTCM and AXISRAM connect to a 64-bit wide bus -> align to 8 bytes. */
/* - All other memories connect to a 32-bit wide bus -> align to 4 bytes. */
SECTIONS {
.flash2 (NOLOAD) : ALIGN(4) {
*(.flash2 .flash2.*);
. = ALIGN(4);
} > FLASH2

.itcm (NOLOAD) : ALIGN(8) {
*(.itcm .itcm.*);
. = ALIGN(8);
} > ITCM

.axisram (NOLOAD) : ALIGN(8) {
*(.axisram .axisram.*);
. = ALIGN(8);
} > AXISRAM

.sram1 (NOLOAD) : ALIGN(8) {
*(.sram1 .sram1.*);
. = ALIGN(4);
} > SRAM1

.sram2 (NOLOAD) : ALIGN(8) {
*(.sram2 .sram2.*);
. = ALIGN(4);
} > SRAM2

.sram4 (NOLOAD) : ALIGN(4) {
*(.sram4 .sram4.*);
. = ALIGN(4);
} > SRAM4

.bsram (NOLOAD) : ALIGN(4) {
*(.bsram .bsram.*);
. = ALIGN(4);
} > BSRAM

};
Loading