Skip to content

Commit 3972496

Browse files
committed
STM32F7: linker scripts updates
- license header - DTCM RAM use - alignment within the STM32F7 family
1 parent d556bf6 commit 3972496

File tree

12 files changed

+435
-119
lines changed

12 files changed

+435
-119
lines changed

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,28 @@
1212
;* opensource.org/licenses/BSD-3-Clause
1313
;*
1414
;******************************************************************************
15+
#include "../cmsis_nvic.h"
1516

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

2131
#if !defined(MBED_APP_START)
22-
#define MBED_APP_START 0x08000000
32+
#define MBED_APP_START MBED_ROM_START
2333
#endif
2434

2535
#if !defined(MBED_APP_SIZE)
26-
#define MBED_APP_SIZE 0x100000
36+
#define MBED_APP_SIZE MBED_ROM_SIZE
2737
#endif
2838

2939
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -32,14 +42,14 @@
3242

3343
#define Stack_Size MBED_BOOT_STACK_SIZE
3444

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
45+
#define MBED_VECTTABLE_RAM_START (NVIC_RAM_VECTOR_ADDRESS)
46+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
47+
3948
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
4049
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
41-
#define MBED_RAM0_START (MBED_RAM_START)
42-
#define MBED_RAM0_SIZE (MBED_RAM_SIZE)
50+
51+
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
52+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
4353

4454
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4555

@@ -59,4 +69,3 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
5969
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
6070
}
6171
}
62-

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

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,58 @@
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+
******************************************************************************
4+
* @attention
5+
*
6+
* Copyright (c) 2016-2019 STMicroelectronics.
7+
* All rights reserved.
8+
*
9+
* This software component is licensed by ST under BSD 3-Clause license,
10+
* the "License"; You may not use this file except in compliance with the
11+
* License. You may obtain a copy of the License at:
12+
* opensource.org/licenses/BSD-3-Clause
13+
*
14+
******************************************************************************
15+
*/
16+
#include "../cmsis_nvic.h"
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+
#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
832

933
#if !defined(MBED_APP_START)
10-
#define MBED_APP_START 0x08000000
34+
#define MBED_APP_START MBED_ROM_START
1135
#endif
1236

1337
#if !defined(MBED_APP_SIZE)
14-
#define MBED_APP_SIZE 1024K
38+
#define MBED_APP_SIZE MBED_ROM_SIZE
1539
#endif
1640

1741
M_CRASH_DATA_RAM_SIZE = 0x100;
1842

43+
#if !defined(MBED_BOOT_STACK_SIZE)
44+
#define MBED_BOOT_STACK_SIZE 0x400
45+
#endif
46+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
47+
48+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
49+
#define MBED_RAM0_START (MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE)
50+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE)
51+
1952
MEMORY
2053
{
2154
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
22-
RAM (rwx) : ORIGIN = 0x200001C8, LENGTH = 320K - 0x1C8
55+
RAM (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
2356
}
2457

2558
/* Linker script to place sections and symbol values. Should be used together
@@ -93,7 +126,7 @@ SECTIONS
93126

94127
__etext = .;
95128
_sidata = .;
96-
129+
97130
.crash_data_ram :
98131
{
99132
. = ALIGN(8);

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

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

4-
/* [ROM = 1024kb = 0x100000] */
534
define symbol __intvec_start__ = MBED_APP_START;
635
define symbol __region_ROM_start__ = MBED_APP_START;
736
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
837

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;
38+
define symbol NVIC_NUM_VECTORS = 114; /* This value must match NVIC_NUM_VECTORS in ../cmsis_nvic.h */
39+
define symbol MBED_VECTTABLE_RAM_SIZE = ((NVIC_NUM_VECTORS * 4) + 7) & ~7;
40+
define symbol M_CRASH_DATA_RAM_SIZE = 0x100;
41+
42+
define symbol __NVIC_start__ = MBED_RAM1_START;
43+
define symbol __region_CRASH_DATA_RAM_start__ = MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE;
44+
define symbol __NVIC_end__ = __region_CRASH_DATA_RAM_start__ - 1;
45+
define symbol __region_RAM_start__ = __region_CRASH_DATA_RAM_start__ + M_CRASH_DATA_RAM_SIZE;
46+
define symbol __region_CRASH_DATA_RAM_end__ = __region_RAM_start__ - 1;
47+
define symbol __region_RAM_end__ = MBED_RAM1_START + MBED_RAM_SIZE + MBED_RAM1_SIZE - 1;
1648

1749
define symbol __region_ITCMRAM_start__ = 0x00000000;
1850
define symbol __region_ITCMRAM_end__ = 0x00003FFF;
1951

2052
/* Memory regions */
2153
define memory mem with size = 4G;
2254
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__];
2455
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
56+
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
2557
define region ITCMRAM_region = mem:[from __region_ITCMRAM_start__ to __region_ITCMRAM_end__];
2658

2759
/* Define Crash Data Symbols */

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,28 @@
1212
;* opensource.org/licenses/BSD-3-Clause
1313
;*
1414
;******************************************************************************
15+
#include "../cmsis_nvic.h"
1516

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

2131
#if !defined(MBED_APP_START)
22-
#define MBED_APP_START 0x08000000
32+
#define MBED_APP_START MBED_ROM_START
2333
#endif
2434

2535
#if !defined(MBED_APP_SIZE)
26-
#define MBED_APP_SIZE 0x100000
36+
#define MBED_APP_SIZE MBED_ROM_SIZE
2737
#endif
2838

2939
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -32,14 +42,14 @@
3242

3343
#define Stack_Size MBED_BOOT_STACK_SIZE
3444

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
45+
#define MBED_VECTTABLE_RAM_START (NVIC_RAM_VECTOR_ADDRESS)
46+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
47+
3948
#define MBED_CRASH_REPORT_RAM_START (MBED_VECTTABLE_RAM_START + MBED_VECTTABLE_RAM_SIZE)
4049
#define MBED_CRASH_REPORT_RAM_SIZE 0x100
41-
#define MBED_RAM0_START (MBED_RAM_START)
42-
#define MBED_RAM0_SIZE (MBED_RAM_SIZE)
50+
51+
#define MBED_RAM0_START (MBED_CRASH_REPORT_RAM_START + MBED_CRASH_REPORT_RAM_SIZE)
52+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE - MBED_CRASH_REPORT_RAM_SIZE)
4353

4454
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
4555

@@ -59,4 +69,3 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
5969
ARM_LIB_STACK (MBED_RAM0_START+MBED_RAM0_SIZE) EMPTY -Stack_Size { ; stack
6070
}
6171
}
62-

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

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,58 @@
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+
******************************************************************************
4+
* @attention
5+
*
6+
* Copyright (c) 2016-2019 STMicroelectronics.
7+
* All rights reserved.
8+
*
9+
* This software component is licensed by ST under BSD 3-Clause license,
10+
* the "License"; You may not use this file except in compliance with the
11+
* License. You may obtain a copy of the License at:
12+
* opensource.org/licenses/BSD-3-Clause
13+
*
14+
******************************************************************************
15+
*/
16+
#include "../cmsis_nvic.h"
17+
18+
/* STM32F756xG:
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+
#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
832

933
#if !defined(MBED_APP_START)
10-
#define MBED_APP_START 0x08000000
34+
#define MBED_APP_START MBED_ROM_START
1135
#endif
1236

1337
#if !defined(MBED_APP_SIZE)
14-
#define MBED_APP_SIZE 1024K
38+
#define MBED_APP_SIZE MBED_ROM_SIZE
1539
#endif
1640

1741
M_CRASH_DATA_RAM_SIZE = 0x100;
1842

43+
#if !defined(MBED_BOOT_STACK_SIZE)
44+
#define MBED_BOOT_STACK_SIZE 0x400
45+
#endif
46+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
47+
48+
#define MBED_VECTTABLE_RAM_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
49+
#define MBED_RAM0_START (MBED_RAM1_START + MBED_VECTTABLE_RAM_SIZE)
50+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE + MBED_RAM1_SIZE - MBED_VECTTABLE_RAM_SIZE)
51+
1952
MEMORY
2053
{
2154
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
22-
RAM (rwx) : ORIGIN = 0x200001C8, LENGTH = 320K - 0x1C8
55+
RAM (rwx) : ORIGIN = MBED_RAM0_START, LENGTH = MBED_RAM0_SIZE
2356
}
2457

2558
/* Linker script to place sections and symbol values. Should be used together
@@ -93,7 +126,7 @@ SECTIONS
93126

94127
__etext = .;
95128
_sidata = .;
96-
129+
97130
.crash_data_ram :
98131
{
99132
. = ALIGN(8);

0 commit comments

Comments
 (0)