Skip to content

Commit a0d7d4e

Browse files
committed
nrf: allow target.mbed_ram_start and target.mbed_ram_size to override settings in linker
1 parent 340f0a6 commit a0d7d4e

File tree

6 files changed

+52
-40
lines changed

6 files changed

+52
-40
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
#endif
1111

1212
/* If softdevice is present, set aside space for it */
13-
#if defined(SOFTDEVICE_PRESENT)
14-
#define MBED_RAM_START 0x200031D0
15-
#define MBED_RAM_SIZE 0xCE30
16-
#else
17-
#define MBED_RAM_START 0x20000000
18-
#define MBED_RAM_SIZE 0x10000
13+
#if !defined(MBED_RAM_START)
14+
#if defined(SOFTDEVICE_PRESENT)
15+
#define MBED_RAM_START 0x200031D0
16+
#define MBED_RAM_SIZE 0xCE30
17+
#else
18+
#define MBED_RAM_START 0x20000000
19+
#define MBED_RAM_SIZE 0x10000
20+
#endif
1921
#endif
2022

2123
#define MBED_RAM0_START MBED_RAM_START

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
#endif
2727

2828
/* If softdevice is present, set aside space for it */
29-
#if defined(SOFTDEVICE_PRESENT)
30-
#define MBED_RAM_START 0x200031D0
31-
#define MBED_RAM_SIZE 0xCE30
32-
#else
33-
#define MBED_RAM_START 0x20000000
34-
#define MBED_RAM_SIZE 0x10000
29+
#if !defined(MBED_RAM_START)
30+
#if defined(SOFTDEVICE_PRESENT)
31+
#define MBED_RAM_START 0x200031D0
32+
#define MBED_RAM_SIZE 0xCE30
33+
#else
34+
#define MBED_RAM_START 0x20000000
35+
#define MBED_RAM_SIZE 0x10000
36+
#endif
3537
#endif
3638

3739
#define MBED_RAM0_START MBED_RAM_START
@@ -189,7 +191,7 @@ SECTIONS
189191
PROVIDE(__start_fs_data = .);
190192
KEEP(*(.fs_data))
191193
PROVIDE(__stop_fs_data = .);
192-
194+
193195
*(.jcr)
194196
. = ALIGN(4);
195197
/* All data end */

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
1212
}
1313

1414
/* If softdevice is present, set aside space for it */
15-
if (isdefinedsymbol(SOFTDEVICE_PRESENT)) {
16-
define symbol MBED_RAM_START = 0x200031D0;
17-
define symbol MBED_RAM_SIZE = 0xCE30;
18-
} else {
19-
define symbol MBED_RAM_START = 0x20000000;
20-
define symbol MBED_RAM_SIZE = 0x10000;
15+
if (!isdefinedsymbol(MBED_RAM_START)) {
16+
if (isdefinedsymbol(SOFTDEVICE_PRESENT)) {
17+
define symbol MBED_RAM_START = 0x200031D0;
18+
define symbol MBED_RAM_SIZE = 0xCE30;
19+
} else {
20+
define symbol MBED_RAM_START = 0x20000000;
21+
define symbol MBED_RAM_SIZE = 0x10000;
22+
}
2123
}
2224

2325
define symbol MBED_RAM0_START = MBED_RAM_START;

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
#define MBED_APP_SIZE 0x100000
1010
#endif
1111

12-
/* If app_start is 0, do not set aside space for the softdevice */
13-
#if MBED_APP_START == 0
14-
#define MBED_RAM_START 0x20000000
15-
#define MBED_RAM_SIZE 0x40000
16-
#else
17-
#define MBED_RAM_START 0x20003188
18-
#define MBED_RAM_SIZE 0x3CE78
12+
/* If softdevice is present, set aside space for it */
13+
#if !defined(MBED_RAM_START)
14+
#if defined(SOFTDEVICE_PRESENT)
15+
#define MBED_RAM_START 0x20003188
16+
#define MBED_RAM_SIZE 0x3CE78
17+
#else
18+
#define MBED_RAM_START 0x20000000
19+
#define MBED_RAM_SIZE 0x40000
20+
#endif
1921
#endif
2022

2123
#define MBED_RAM0_START MBED_RAM_START

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
#define MBED_APP_SIZE 0x100000
2626
#endif
2727

28-
/* If app_start is 0, do not set aside space for the softdevice */
29-
#if MBED_APP_START == 0
30-
#define MBED_RAM_START 0x20000000
31-
#define MBED_RAM_SIZE 0x40000
32-
#else
33-
#define MBED_RAM_START 0x20003188
34-
#define MBED_RAM_SIZE 0x3CE78
28+
/* If softdevice is present, set aside space for it */
29+
#if !defined(MBED_RAM_START)
30+
#if defined(SOFTDEVICE_PRESENT)
31+
#define MBED_RAM_START 0x20003188
32+
#define MBED_RAM_SIZE 0x3CE78
33+
#else
34+
#define MBED_RAM_START 0x20000000
35+
#define MBED_RAM_SIZE 0x40000
36+
#endif
3537
#endif
3638

3739
#define MBED_RAM0_START MBED_RAM_START

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
1111
define symbol MBED_APP_SIZE = 0x100000;
1212
}
1313

14-
/* If app_start is 0, do not set aside space for the softdevice */
15-
if (MBED_APP_START == 0) {
16-
define symbol MBED_RAM_START = 0x20000000;
17-
define symbol MBED_RAM_SIZE = 0x40000;
18-
} else {
19-
define symbol MBED_RAM_START = 0x20003188;
20-
define symbol MBED_RAM_SIZE = 0x3CE78;
14+
/* If softdevice is present, set aside space for it */
15+
if (!isdefinedsymbol(MBED_RAM_START)) {
16+
if (isdefinedsymbol(SOFTDEVICE_PRESENT)) {
17+
define symbol MBED_RAM_START = 0x20003188;
18+
define symbol MBED_RAM_SIZE = 0x3CE78;
19+
} else {
20+
define symbol MBED_RAM_START = 0x20000000;
21+
define symbol MBED_RAM_SIZE = 0x40000;
22+
}
2123
}
2224

2325
define symbol MBED_RAM0_START = MBED_RAM_START;

0 commit comments

Comments
 (0)