Skip to content

Commit cc120f3

Browse files
authored
Merge pull request #11870 from jeromecoutant/PR_F7_LINKER
STM32F7: linker scripts updates
2 parents 04ed9c5 + 82a9628 commit cc120f3

File tree

12 files changed

+455
-119
lines changed

12 files changed

+455
-119
lines changed

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_ARM_STD/stm32f746xg.sct

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! armcc -E
22
; Scatter-Loading Description File
3+
;
4+
; SPDX-License-Identifier: BSD-3-Clause
35
;******************************************************************************
46
;* @attention
57
;*
@@ -12,18 +14,28 @@
1214
;* opensource.org/licenses/BSD-3-Clause
1315
;*
1416
;******************************************************************************
17+
#include "../cmsis_nvic.h"
1518

1619
; STM32F746xG:
17-
; FLASH: 1024K (0x100000) @0x08000000
18-
; RAM1: 256K (0x40000) @0x20010000
19-
; RAM2: 64K (0x10000) @0x20000000
20+
; FLASH: 1024K (0x100000) @0x08000000
21+
; SRAM1: 240K (0x3C000) @0x20010000
22+
; SRAM2: 16K (0x4000) @0x2004C000
23+
; DTCM-RAM: 64K (0x10000) @0x20000000
24+
; ITCM-RAM: 16K (0x3FFF) @0x00000000
25+
26+
#define MBED_ROM_START 0x8000000
27+
#define MBED_ROM_SIZE 0x100000
28+
#define MBED_RAM_START 0x20010000
29+
#define MBED_RAM_SIZE 0x40000
30+
#define MBED_RAM1_START 0x20000000
31+
#define MBED_RAM1_SIZE 0x10000
2032

2133
#if !defined(MBED_APP_START)
22-
#define MBED_APP_START 0x08000000
34+
#define MBED_APP_START MBED_ROM_START
2335
#endif
2436

2537
#if !defined(MBED_APP_SIZE)
26-
#define MBED_APP_SIZE 0x100000
38+
#define MBED_APP_SIZE MBED_ROM_SIZE
2739
#endif
2840

2941
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -32,14 +44,14 @@
3244

3345
#define Stack_Size MBED_BOOT_STACK_SIZE
3446

35-
#define MBED_RAM_START 0x20010000
36-
#define MBED_RAM_SIZE 0x40000
37-
#define MBED_VECTTABLE_RAM_START 0x20000000
38-
#define MBED_VECTTABLE_RAM_SIZE 0x1C8
47+
#define MBED_VECTTABLE_RAM_START (NVIC_RAM_VECTOR_ADDRESS)
48+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
49+
3950
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
4051
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
41-
#define MBED_RAM0_START (MBED_RAM_START)
42-
#define MBED_RAM0_SIZE (MBED_RAM_SIZE)
52+
53+
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
54+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
4355

4456
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4557

@@ -59,4 +71,3 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
5971
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
6072
}
6173
}
62-

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_GCC_ARM/STM32F746xG.ld

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,59 @@
11
/* Linker script to configure memory regions. */
2-
3-
#if !defined(MBED_BOOT_STACK_SIZE)
4-
#define MBED_BOOT_STACK_SIZE 0x400
5-
#endif
6-
7-
STACK_SIZE = MBED_BOOT_STACK_SIZE;
2+
/*
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
******************************************************************************
5+
* @attention
6+
*
7+
* Copyright (c) 2016-2019 STMicroelectronics.
8+
* All rights reserved.
9+
*
10+
* This software component is licensed by ST under BSD 3-Clause license,
11+
* the "License"; You may not use this file except in compliance with the
12+
* License. You may obtain a copy of the License at:
13+
* opensource.org/licenses/BSD-3-Clause
14+
*
15+
******************************************************************************
16+
*/
17+
#include "../cmsis_nvic.h"
18+
19+
/* STM32F746xG:
20+
FLASH: 1024K (0x100000) @0x08000000
21+
SRAM1: 240K (0x3C000) @0x20010000
22+
SRAM2: 16K (0x4000) @0x2004C000
23+
DTCM-RAM: 64K (0x10000) @0x20000000
24+
ITCM-RAM: 16K (0x3FFF) @0x00000000
25+
*/
26+
27+
#define MBED_ROM_START 0x8000000
28+
#define MBED_ROM_SIZE 0x100000
29+
#define MBED_RAM_START 0x20010000
30+
#define MBED_RAM_SIZE 0x40000
31+
#define MBED_RAM1_START 0x20000000
32+
#define MBED_RAM1_SIZE 0x10000
833

934
#if !defined(MBED_APP_START)
10-
#define MBED_APP_START 0x08000000
35+
#define MBED_APP_START MBED_ROM_START
1136
#endif
1237

1338
#if !defined(MBED_APP_SIZE)
14-
#define MBED_APP_SIZE 1024K
39+
#define MBED_APP_SIZE MBED_ROM_SIZE
1540
#endif
1641

1742
M_CRASH_DATA_RAM_SIZE = 0x100;
1843

44+
#if !defined(MBED_BOOT_STACK_SIZE)
45+
#define MBED_BOOT_STACK_SIZE 0x400
46+
#endif
47+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
48+
49+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
50+
#define MBED_RAM0_START (MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE)
51+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE)
52+
1953
MEMORY
2054
{
2155
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
22-
RAM (rwx) : ORIGIN = 0x200001C8, LENGTH = 320K - 0x1C8
56+
RAM (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
2357
}
2458

2559
/* Linker script to place sections and symbol values. Should be used together
@@ -93,7 +127,7 @@ SECTIONS
93127

94128
__etext = .;
95129
_sidata = .;
96-
130+
97131
.crash_data_ram :
98132
{
99133
. = ALIGN(8);

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/TOOLCHAIN_IAR/stm32f746xg.icf

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
1-
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
2-
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; }
1+
/* Linker script to configure memory regions.
2+
*
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
******************************************************************************
5+
* @attention
6+
*
7+
* Copyright (c) 2016-2019 STMicroelectronics.
8+
* All rights reserved.
9+
*
10+
* This software component is licensed by ST under BSD 3-Clause license,
11+
* the "License"; You may not use this file except in compliance with the
12+
* License. You may obtain a copy of the License at:
13+
* opensource.org/licenses/BSD-3-Clause
14+
*
15+
******************************************************************************
16+
*/
17+
18+
/* STM32F746xG:
19+
FLASH: 1024K (0x100000) @0x08000000
20+
SRAM1: 240K (0x3C000) @0x20010000
21+
SRAM2: 16K (0x4000) @0x2004C000
22+
DTCM-RAM: 64K (0x10000) @0x20000000
23+
ITCM-RAM: 16K (0x3FFF) @0x00000000
24+
*/
25+
26+
if (!isdefinedsymbol(MBED_ROM_START)) { define symbol MBED_ROM_START = 0x8000000; }
27+
if (!isdefinedsymbol(MBED_ROM_SIZE)) { define symbol MBED_ROM_SIZE = 0x200000; }
28+
if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_START = 0x20010000; }
29+
if (!isdefinedsymbol(MBED_RAM_START)) { define symbol MBED_RAM_SIZE = 0x40000; }
30+
if (!isdefinedsymbol(MBED_RAM1_START)) { define symbol MBED_RAM1_START = 0x20000000; }
31+
if (!isdefinedsymbol(MBED_RAM1_SIZE)) { define symbol MBED_RAM1_SIZE = 0x10000; }
32+
33+
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = MBED_ROM_START; }
34+
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = MBED_ROM_SIZE; }
335

4-
/* [ROM = 1024kb = 0x100000] */
536
define symbol __intvec_start__ = MBED_APP_START;
637
define symbol __region_ROM_start__ = MBED_APP_START;
738
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
839

9-
/* [RAM = 320kb = 0x50000] Vector table dynamic copy: 114 vectors = 456 bytes (0x1C8) to be reserved in RAM */
10-
define symbol __NVIC_start__ = 0x20000000;
11-
define symbol __NVIC_end__ = 0x200001C7; /* Aligned on 8 bytes */
12-
define symbol __region_CRASH_DATA_RAM_start__ = 0x200001C8;
13-
define symbol __region_CRASH_DATA_RAM_end__ = 0x200002C7;
14-
define symbol __region_RAM_start__ = 0x200002C8;
15-
define symbol __region_RAM_end__ = 0x2004FFFF;
40+
define symbol NVIC_NUM_VECTORS = 114; /* This value must match NVIC_NUM_VECTORS in ../cmsis_nvic.h */
41+
define symbol MBED_VECTTABLE_RAM_SIZE = ((NVIC_NUM_VECTORS * 4) + 7) & ~7;
42+
define symbol M_CRASH_DATA_RAM_SIZE = 0x100;
43+
44+
define symbol __NVIC_start__ = MBED_RAM1_START;
45+
define symbol __region_CRASH_DATA_RAM_start__ = MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE;
46+
define symbol __NVIC_end__ = __region_CRASH_DATA_RAM_start__ - 1;
47+
define symbol __region_RAM_start__ = __region_CRASH_DATA_RAM_start__ + M_CRASH_DATA_RAM_SIZE;
48+
define symbol __region_CRASH_DATA_RAM_end__ = __region_RAM_start__ - 1;
49+
define symbol __region_RAM_end__ = MBED_RAM1_START + MBED_RAM_SIZE + MBED_RAM1_SIZE - 1;
1650

1751
define symbol __region_ITCMRAM_start__ = 0x00000000;
1852
define symbol __region_ITCMRAM_end__ = 0x00003FFF;
1953

2054
/* Memory regions */
2155
define memory mem with size = 4G;
2256
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
23-
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
2457
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
58+
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
2559
define region ITCMRAM_region = mem:[from __region_ITCMRAM_start__ to __region_ITCMRAM_end__];
2660

2761
/* Define Crash Data Symbols */

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_ARM_STD/stm32f756xg.sct

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#! armcc -E
22
; Scatter-Loading Description File
3+
;
4+
; SPDX-License-Identifier: BSD-3-Clause
35
;******************************************************************************
46
;* @attention
57
;*
@@ -12,18 +14,28 @@
1214
;* opensource.org/licenses/BSD-3-Clause
1315
;*
1416
;******************************************************************************
17+
#include "../cmsis_nvic.h"
1518

1619
; STM32F756xG:
17-
; FLASH: 1024K (0x100000) @0x08000000
18-
; RAM1: 256K (0x40000) @0x20010000
19-
; RAM2: 64K (0x10000) @0x20000000
20+
; FLASH: 1024K (0x100000) @0x08000000
21+
; SRAM1: 240K (0x3C000) @0x20010000
22+
; SRAM2: 16K (0x4000) @0x2004C000
23+
; DTCM-RAM: 64K (0x10000) @0x20000000
24+
; ITCM-RAM: 16K (0x3FFF) @0x00000000
25+
26+
#define MBED_ROM_START 0x8000000
27+
#define MBED_ROM_SIZE 0x100000
28+
#define MBED_RAM_START 0x20010000
29+
#define MBED_RAM_SIZE 0x40000
30+
#define MBED_RAM1_START 0x20000000
31+
#define MBED_RAM1_SIZE 0x10000
2032

2133
#if !defined(MBED_APP_START)
22-
#define MBED_APP_START 0x08000000
34+
#define MBED_APP_START MBED_ROM_START
2335
#endif
2436

2537
#if !defined(MBED_APP_SIZE)
26-
#define MBED_APP_SIZE 0x100000
38+
#define MBED_APP_SIZE MBED_ROM_SIZE
2739
#endif
2840

2941
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -32,14 +44,14 @@
3244

3345
#define Stack_Size MBED_BOOT_STACK_SIZE
3446

35-
#define MBED_RAM_START 0x20010000
36-
#define MBED_RAM_SIZE 0x40000
37-
#define MBED_VECTTABLE_RAM_START 0x20000000
38-
#define MBED_VECTTABLE_RAM_SIZE 0x1C8
47+
#define MBED_VECTTABLE_RAM_START (NVIC_RAM_VECTOR_ADDRESS)
48+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
49+
3950
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
4051
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
41-
#define MBED_RAM0_START (MBED_RAM_START)
42-
#define MBED_RAM0_SIZE (MBED_RAM_SIZE)
52+
53+
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
54+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
4355

4456
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4557

@@ -59,4 +71,3 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
5971
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
6072
}
6173
}
62-

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/device/TOOLCHAIN_GCC_ARM/STM32F756xG.ld

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,59 @@
11
/* Linker script to configure memory regions. */
2-
3-
#if !defined(MBED_BOOT_STACK_SIZE)
4-
#define MBED_BOOT_STACK_SIZE 0x400
5-
#endif
6-
7-
STACK_SIZE = MBED_BOOT_STACK_SIZE;
2+
/*
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
******************************************************************************
5+
* @attention
6+
*
7+
* Copyright (c) 2016-2019 STMicroelectronics.
8+
* All rights reserved.
9+
*
10+
* This software component is licensed by ST under BSD 3-Clause license,
11+
* the "License"; You may not use this file except in compliance with the
12+
* License. You may obtain a copy of the License at:
13+
* opensource.org/licenses/BSD-3-Clause
14+
*
15+
******************************************************************************
16+
*/
17+
#include "../cmsis_nvic.h"
18+
19+
/* STM32F756xG:
20+
FLASH: 1024K (0x100000) @0x08000000
21+
SRAM1: 240K (0x3C000) @0x20010000
22+
SRAM2: 16K (0x4000) @0x2004C000
23+
DTCM-RAM: 64K (0x10000) @0x20000000
24+
ITCM-RAM: 16K (0x3FFF) @0x00000000
25+
*/
26+
27+
#define MBED_ROM_START 0x8000000
28+
#define MBED_ROM_SIZE 0x100000
29+
#define MBED_RAM_START 0x20010000
30+
#define MBED_RAM_SIZE 0x40000
31+
#define MBED_RAM1_START 0x20000000
32+
#define MBED_RAM1_SIZE 0x10000
833

934
#if !defined(MBED_APP_START)
10-
#define MBED_APP_START 0x08000000
35+
#define MBED_APP_START MBED_ROM_START
1136
#endif
1237

1338
#if !defined(MBED_APP_SIZE)
14-
#define MBED_APP_SIZE 1024K
39+
#define MBED_APP_SIZE MBED_ROM_SIZE
1540
#endif
1641

1742
M_CRASH_DATA_RAM_SIZE = 0x100;
1843

44+
#if !defined(MBED_BOOT_STACK_SIZE)
45+
#define MBED_BOOT_STACK_SIZE 0x400
46+
#endif
47+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
48+
49+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
50+
#define MBED_RAM0_START (MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE)
51+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE)
52+
1953
MEMORY
2054
{
2155
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
22-
RAM (rwx) : ORIGIN = 0x200001C8, LENGTH = 320K - 0x1C8
56+
RAM (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
2357
}
2458

2559
/* Linker script to place sections and symbol values. Should be used together
@@ -93,7 +127,7 @@ SECTIONS
93127

94128
__etext = .;
95129
_sidata = .;
96-
130+
97131
.crash_data_ram :
98132
{
99133
. = ALIGN(8);

0 commit comments

Comments
 (0)