Skip to content

Commit b5c3075

Browse files
LMESTM0xc0170
authored andcommitted
NUCLEO_WB55RG: IAR, ARM and GCC linker files alignment
Align all scatter BLE shared memory declarations.
1 parent f913a31 commit b5c3075

File tree

4 files changed

+122
-41
lines changed

4 files changed

+122
-41
lines changed

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xG/device/TOOLCHAIN_ARM_MICRO/stm32wb55xx.sct

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
#! armcc -E
2+
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3-
; mbed Microcontroller Library
4-
; Copyright (c) 2006-2013 ARM Limited
4+
; Copyright (c) 2015, STMicroelectronics
5+
; All rights reserved.
56
;
6-
; Licensed under the Apache License, Version 2.0 (the "License");
7-
; you may not use this file except in compliance with the License.
8-
; You may obtain a copy of the License at
7+
; Redistribution and use in source and binary forms, with or without
8+
; modification, are permitted provided that the following conditions are met:
99
;
10-
; http://www.apache.org/licenses/LICENSE-2.0
10+
; 1. Redistributions of source code must retain the above copyright notice,
11+
; this list of conditions and the following disclaimer.
12+
; 2. Redistributions in binary form must reproduce the above copyright notice,
13+
; this list of conditions and the following disclaimer in the documentation
14+
; and/or other materials provided with the distribution.
15+
; 3. Neither the name of STMicroelectronics nor the names of its contributors
16+
; may be used to endorse or promote products derived from this software
17+
; without specific prior written permission.
1118
;
12-
; Unless required by applicable law or agreed to in writing, software
13-
; distributed under the License is distributed on an "AS IS" BASIS,
14-
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
; See the License for the specific language governing permissions and
16-
; limitations under the License.
19+
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1729
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30+
1831
#if !defined(MBED_APP_START)
19-
#define MBED_APP_START 0x08000000
32+
#define MBED_APP_START 0x08000000
2033
#endif
2134

2235
#if !defined(MBED_APP_SIZE)
2336
; 512KB FLASH
24-
#define MBED_APP_SIZE 0x80000
37+
#define MBED_APP_SIZE 0x80000
38+
#endif
39+
40+
#if !defined(MBED_BOOT_STACK_SIZE)
41+
#define MBED_BOOT_STACK_SIZE 0x400
2542
#endif
2643

44+
#define Stack_Size MBED_BOOT_STACK_SIZE
45+
46+
; 512KB FLASH (0x80000) + 192KB SRAM (0x30000) + Shared mem
2747
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
2848

2949
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -32,11 +52,19 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3252
.ANY (+RO)
3353
}
3454

35-
; SRAM1 192KB (0x30000)
3655
; Total: 79 vectors = 316 bytes (0x13C) to be reserved in RAM
37-
RW_IRAM1 (0x20000000+0x13C) (0x30000-0x13C) { ; RW data
38-
.ANY (+RW +ZI)
56+
RW_IRAM1 (0x20000000+0x13C) (0x30000-0x13C-Stack_Size) { ; RW data
57+
.ANY (+RW +ZI)
58+
}
59+
ARM_LIB_STACK (0x20000000+0x30000) EMPTY -Stack_Size { ; stack
3960
}
4061

62+
; SRAM2 - Shared memory
63+
RW_IRAM2a 0x20030000 0x00002800 { ; RW data
64+
*(MAPPING_TABLE, +First)
65+
*(MB_MEM1)
66+
}
67+
RW_IRAM2b 0x20038000 0x00005000 { ; RW data
68+
*(MB_MEM2)
69+
}
4170
}
42-

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xG/device/TOOLCHAIN_ARM_STD/stm32wb55xx.sct

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
#! armcc -E
2+
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3-
; mbed Microcontroller Library
4-
; Copyright (c) 2006-2013 ARM Limited
4+
; Copyright (c) 2015, STMicroelectronics
5+
; All rights reserved.
56
;
6-
; Licensed under the Apache License, Version 2.0 (the "License");
7-
; you may not use this file except in compliance with the License.
8-
; You may obtain a copy of the License at
7+
; Redistribution and use in source and binary forms, with or without
8+
; modification, are permitted provided that the following conditions are met:
99
;
10-
; http://www.apache.org/licenses/LICENSE-2.0
10+
; 1. Redistributions of source code must retain the above copyright notice,
11+
; this list of conditions and the following disclaimer.
12+
; 2. Redistributions in binary form must reproduce the above copyright notice,
13+
; this list of conditions and the following disclaimer in the documentation
14+
; and/or other materials provided with the distribution.
15+
; 3. Neither the name of STMicroelectronics nor the names of its contributors
16+
; may be used to endorse or promote products derived from this software
17+
; without specific prior written permission.
1118
;
12-
; Unless required by applicable law or agreed to in writing, software
13-
; distributed under the License is distributed on an "AS IS" BASIS,
14-
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
; See the License for the specific language governing permissions and
16-
; limitations under the License.
19+
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1729
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30+
1831
#if !defined(MBED_APP_START)
1932
#define MBED_APP_START 0x08000000
2033
#endif
@@ -24,6 +37,13 @@
2437
#define MBED_APP_SIZE 0x80000
2538
#endif
2639

40+
#if !defined(MBED_BOOT_STACK_SIZE)
41+
#define MBED_BOOT_STACK_SIZE 0x400
42+
#endif
43+
44+
#define Stack_Size MBED_BOOT_STACK_SIZE
45+
46+
; 512KB FLASH (0x80000) + 192KB SRAM (0x30000) + Shared mem
2747
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
2848

2949
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -32,11 +52,19 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3252
.ANY (+RO)
3353
}
3454

35-
; SRAM1 192KB (0x30000)
3655
; Total: 79 vectors = 316 bytes (0x13C) to be reserved in RAM
37-
RW_IRAM1 (0x20000000+0x13C) (0x30000-0x13C) { ; RW data
38-
.ANY (+RW +ZI)
56+
RW_IRAM1 (0x20000000+0x13C) (0x30000-0x13C-Stack_Size) { ; RW data
57+
.ANY (+RW +ZI)
58+
}
59+
ARM_LIB_STACK (0x20000000+0x30000) EMPTY -Stack_Size { ; stack
3960
}
4061

62+
; SRAM2 - Shared memory
63+
RW_IRAM2a 0x20030000 0x00002800 { ; RW data
64+
*(MAPPING_TABLE, +First)
65+
*(MB_MEM1)
66+
}
67+
RW_IRAM2b 0x20038000 0x00005000 { ; RW data
68+
*(MB_MEM2)
69+
}
4170
}
42-

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xG/device/TOOLCHAIN_GCC_ARM/stm32wb55xx.ld

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@
66
#define MBED_APP_SIZE 512K
77
#endif
88

9+
#if !defined(MBED_BOOT_STACK_SIZE)
10+
#define MBED_BOOT_STACK_SIZE 0x400
11+
#endif
12+
13+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
14+
915
/* Linker script to configure memory regions. */
1016
/* Total: 79 vectors = 316 bytes (0x13C) to be reserved in RAM1 (192K) */
1117
MEMORY
1218
{
1319
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
1420
RAM1 (rwx) : ORIGIN = 0x2000013C, LENGTH = 192K - 0x13C
21+
RAM2a (rw) : ORIGIN = 0x20030000, LENGTH = 10K
22+
RAM2b (rw) : ORIGIN = 0x20038000, LENGTH = 20K
1523
}
1624

1725
/* Linker script to place sections and symbol values. Should be used together
@@ -93,28 +101,28 @@ SECTIONS
93101
*(vtable)
94102
*(.data*)
95103

96-
. = ALIGN(4);
104+
. = ALIGN(8);
97105
/* preinit data */
98106
PROVIDE_HIDDEN (__preinit_array_start = .);
99107
KEEP(*(.preinit_array))
100108
PROVIDE_HIDDEN (__preinit_array_end = .);
101109

102-
. = ALIGN(4);
110+
. = ALIGN(8);
103111
/* init data */
104112
PROVIDE_HIDDEN (__init_array_start = .);
105113
KEEP(*(SORT(.init_array.*)))
106114
KEEP(*(.init_array))
107115
PROVIDE_HIDDEN (__init_array_end = .);
108116

109-
. = ALIGN(4);
117+
. = ALIGN(8);
110118
/* finit data */
111119
PROVIDE_HIDDEN (__fini_array_start = .);
112120
KEEP(*(SORT(.fini_array.*)))
113121
KEEP(*(.fini_array))
114122
PROVIDE_HIDDEN (__fini_array_end = .);
115123

116124
KEEP(*(.jcr*))
117-
. = ALIGN(4);
125+
. = ALIGN(8);
118126
/* All data end */
119127
__data_end__ = .;
120128
_edata = .;
@@ -149,11 +157,22 @@ SECTIONS
149157
*(.stack*)
150158
} > RAM1
151159

160+
.ble_stby_mem (NOLOAD) :
161+
{
162+
*(MAPPING_TABLE);
163+
*(MB_MEM1);
164+
} >RAM2a
165+
166+
.ble_shared_no_ret (NOLOAD) :
167+
{
168+
*(MB_MEM2);
169+
} >RAM2b
170+
152171
/* Set stack top to end of RAM1, and stack limit move down by
153172
* size of stack_dummy section */
154173
__StackTop = ORIGIN(RAM1) + LENGTH(RAM1);
155174
_estack = __StackTop;
156-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
175+
__StackLimit = __StackTop - STACK_SIZE;
157176
PROVIDE(__stack = __StackTop);
158177

159178
/* Check if data + heap + stack exceeds RAM1 limit */

targets/TARGET_STM/TARGET_STM32WB/TARGET_STM32WB55xG/device/TOOLCHAIN_IAR/stm32wb55xx.icf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x80000; }
44
/* [ROM = 512kb = 0x80000] */
55
define symbol __intvec_start__ = MBED_APP_START;
66
define symbol __region_ROM_start__ = MBED_APP_START;
7-
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE;
7+
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
88

99
/* [RAM1 = 192kb = 0x30000] */
1010
/* Total: 79 vectors = 316 bytes (0x13C) to be reserved in RAM */
@@ -26,8 +26,12 @@ define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__]
2626
define region RAM2aRet_SHARED_region = mem:[from __ICFEDIT_region_RAM2aRet_SHARED_start__ to __ICFEDIT_region_RAM2aRet_SHARED_end__];
2727
define region RAM2b_SHARED_region = mem:[from __ICFEDIT_region_RAM2b_SHARED_start__ to __ICFEDIT_region_RAM2b_SHARED_end__];
2828

29+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
30+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
31+
}
32+
2933
/* Stack and Heap */
30-
define symbol __size_cstack__ = 0x8000;
34+
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
3135
define symbol __size_heap__ = 0x10000;
3236
define block CSTACK with alignment = 8, size = __size_cstack__ { };
3337
define block HEAP with alignment = 8, size = __size_heap__ { };
@@ -36,7 +40,9 @@ define block STACKHEAP with fixed order { block HEAP, block CSTACK };
3640
initialize by copy with packing = zeros { readwrite };
3741
do not initialize { section .noinit,
3842
section MAPPING_TABLE,
39-
section MB_MEM1 };
43+
section MB_MEM1,
44+
section MB_MEM2
45+
};
4046

4147
place at address mem:__intvec_start__ { readonly section .intvec };
4248

@@ -45,4 +51,4 @@ place in RAM_region { readwrite, block STACKHEAP };
4551

4652
place in RAM2aRet_SHARED_region { first section MAPPING_TABLE};
4753
place in RAM2aRet_SHARED_region { section MB_MEM1};
48-
place in RAM2b_SHARED_region { section MB_MEM2};
54+
place in RAM2b_SHARED_region { section MB_MEM2};

0 commit comments

Comments
 (0)