Revert "Fix missing CUSTOM_DEFAULTS for H730/H750 targets. (#12261)" (#12333)
[betaflight.git] / src / link / stm32_ram_h750_exst.ld
blobf322122e8d7ac6f93382012508be4ca4c9bdae06
1 /*
2 *****************************************************************************
3 **
4 **  File        : stm32_flash_h750_exst.ld
5 **
6 **  Abstract    : Linker script for STM32H750xB Device with
7 **                512K AXI-RAM mapped onto AXI bus on D1 domain
8 **                128K SRAM1 mapped on D2 domain
9 **                128K SRAM2 mapped on D2 domain
10 **                 32K SRAM3 mapped on D2 domain
11 **                 64K SRAM4 mapped on D3 domain
12 **                 64K ITCM
13 **                128K DTCM
15 *****************************************************************************
18 /* Entry Point */
19 ENTRY(Reset_Handler)
22 0x00000000 to 0x0000FFFF   64K ITCM
23 0x20000000 to 0x2001FFFF  128K DTCM, main RAM
24 0x24000000 to 0x2407FFFF  512K AXI SRAM, D1 domain
25 0x30000000 to 0x3001FFFF  128K SRAM1, D2 domain
26 0x30020000 to 0x3003FFFF  128K SRAM2, D2 domain
27 0x30040000 to 0x30047FFF   32K SRAM3, D2 domain, unused
28 0x38000000 to 0x3800FFFF   64K SRAM4, D3 domain, unused
29 0x38800000 to 0x38800FFF    4K BACKUP SRAM, Backup domain, unused
31 0x08000000 to 0x0801FFFF  128K isr vector, startup code, firmware, no config! // FLASH_Sector_0
34 /* 
36 For H7 EXST (External Storage) targets a binary is built that is placed on an external device.
37 The bootloader will then copy this entire binary to RAM, at the CODE_RAM address.  The bootloader
38 then executes code at the CODE_RAM address. The address of CODE_RAM is fixed to 0x24010000
39 and must not be changed.
41 Currently, this is inefficient as there are two copies of some sections in RAM.  e.g. .tcm_code.
43 It would be technically possible to free more RAM by having a more intelligent build system
44 and bootloader which creates files for each of the sections that are usually copied from flash
45 to ram and one section for the main code.  e.g. one file for .tcm_code, one file for .data and
46 one for the main code/data, then load each to the appropriate address and adjust the usual startup
47 code which will no-longer need to duplicate code/data sections from RAM to ITCM/DTCM RAM.
49 The initial CODE_RAM is sized at 448K to enable all firmware features and to as much RAM free as 
50 possible.
54 /* see .exst section below */
55 _exst_hash_size = 64;
57 /* Specify the memory areas */
58 MEMORY
60     ITCM_RAM (rwx)    : ORIGIN = 0x00000000, LENGTH = 64K
61     DTCM_RAM (rwx)    : ORIGIN = 0x20000000, LENGTH = 128K
62     RAM (rwx)         : ORIGIN = 0x24000000, LENGTH = 64K
63     CODE_RAM (rx)     : ORIGIN = 0x24010000, LENGTH = 448K - _exst_hash_size /* hard coded start address, as required by SPRACINGH7 boot loader, don't change! */
64     EXST_HASH (rx)    : ORIGIN = 0x24010000 + LENGTH(CODE_RAM), LENGTH = _exst_hash_size
66     D2_RAM (rwx)      : ORIGIN = 0x30000000, LENGTH = 256K /* SRAM1 + SRAM2 */
68     MEMORY_B1 (rx)    : ORIGIN = 0x60000000, LENGTH = 0K
69     QUADSPI (rx)      : ORIGIN = 0x90000000, LENGTH = 0K 
72 REGION_ALIAS("STACKRAM", DTCM_RAM)
73 REGION_ALIAS("FASTRAM", DTCM_RAM)
74 REGION_ALIAS("MAIN", CODE_RAM)
76 INCLUDE "stm32_h750_common.ld"
78 SECTIONS
80   /* used during startup to initialized dmaram_data */
81   _sdmaram_idata = LOADADDR(.dmaram_data);
83   . = ALIGN(32);
84   .dmaram_data :
85   {
86     PROVIDE(dmaram_start = .);
87     _sdmaram = .;
88     _dmaram_start__ = _sdmaram;
89     _sdmaram_data = .;        /* create a global symbol at data start */
90     *(.dmaram_data)           /* .data sections */
91     *(.dmaram_data*)          /* .data* sections */
92     . = ALIGN(32);
93     _edmaram_data = .;        /* define a global symbol at data end */
94   } >RAM AT >MAIN
96   . = ALIGN(32);
97   .dmaram_bss (NOLOAD) :
98   {
99     _sdmaram_bss = .;
100     __dmaram_bss_start__ = _sdmaram_bss;
101     *(.dmaram_bss)
102     *(SORT_BY_ALIGNMENT(.dmaram_bss*))
103     . = ALIGN(32);
104     _edmaram_bss = .;
105     __dmaram_bss_end__ = _edmaram_bss;
106   } >RAM
108   . = ALIGN(32);
109   .DMA_RAM (NOLOAD) :
110   {
111     KEEP(*(.DMA_RAM))
112     PROVIDE(dmaram_end = .);
113     _edmaram = .;
114     _dmaram_end__ = _edmaram;
115   } >RAM
116   
117   .DMA_RW_D2 (NOLOAD) :
118   {
119     . = ALIGN(32);
120     PROVIDE(dmarw_start = .);
121     _sdmarw = .;
122     _dmarw_start__ = _sdmarw;
123     KEEP(*(.DMA_RW))
124     PROVIDE(dmarw_end = .);
125     _edmarw = .;
126     _dmarw_end__ = _edmarw;
127   } >D2_RAM
129   .DMA_RW_AXI (NOLOAD) :
130   {
131     . = ALIGN(32);
132     PROVIDE(dmarwaxi_start = .);
133     _sdmarwaxi = .;
134     _dmarwaxi_start__ = _sdmarwaxi;
135     KEEP(*(.DMA_RW_AXI))
136     PROVIDE(dmarwaxi_end = .);
137     _edmarwaxi = .;
138     _dmarwaxi_end__ = _edmarwaxi;
139   } >RAM
142 INCLUDE "stm32_h750_common_post.ld"
143 INCLUDE "stm32_ram_h750_exst_post.ld"