Skip to content

Commit 76827c3

Browse files
author
Cruz Monrreal
authored
Merge pull request #7971 from JammuKekkonen/fix_softdevice_memory_reservation_for_nrf52dk
Fix memory reservation for Softdevice in NRF52_DK
2 parents 4c996f0 + 1a99997 commit 76827c3

File tree

7 files changed

+26
-21
lines changed

7 files changed

+26
-21
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#define MBED_APP_SIZE 0x80000
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 0x10000
16-
#else
12+
/* If softdevice is present, set aside space for it */
13+
#if defined(SOFTDEVICE_PRESENT)
1714
#define MBED_RAM_START 0x200031D0
1815
#define MBED_RAM_SIZE 0xCE30
16+
#else
17+
#define MBED_RAM_START 0x20000000
18+
#define MBED_RAM_SIZE 0x10000
1919
#endif
2020

2121
#define MBED_RAM0_START MBED_RAM_START

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
#define MBED_APP_SIZE 0x80000
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 0x10000
32-
#else
28+
/* If softdevice is present, set aside space for it */
29+
#if defined(SOFTDEVICE_PRESENT)
3330
#define MBED_RAM_START 0x200031D0
3431
#define MBED_RAM_SIZE 0xCE30
32+
#else
33+
#define MBED_RAM_START 0x20000000
34+
#define MBED_RAM_SIZE 0x10000
3535
#endif
3636

3737
#define MBED_RAM0_START MBED_RAM_START

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
1111
define symbol MBED_APP_SIZE = 0x80000;
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 = 0x10000;
18-
} else {
14+
/* If softdevice is present, set aside space for it */
15+
if (isdefinedsymbol(SOFTDEVICE_PRESENT)) {
1916
define symbol MBED_RAM_START = 0x200031D0;
2017
define symbol MBED_RAM_SIZE = 0xCE30;
18+
} else {
19+
define symbol MBED_RAM_START = 0x20000000;
20+
define symbol MBED_RAM_SIZE = 0x10000;
2121
}
2222

2323
define symbol MBED_RAM0_START = MBED_RAM_START;

tools/toolchains/__init__.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,8 @@ def _add_all_regions(self, region_list, active_region_name):
706706
self._add_defines_from_region(region)
707707
if region.active:
708708
for define in [
709-
("%s_START" % active_region_name, region.start),
710-
("%s_SIZE" % active_region_name, region.size)
709+
("%s_START" % active_region_name, "0x%x" % region.start),
710+
("%s_SIZE" % active_region_name, "0x%x" % region.size)
711711
]:
712712
define_string = self.make_ld_define(*define)
713713
self.ld.append(define_string)
@@ -747,6 +747,11 @@ def set_config_data(self, config_data):
747747
self.config_data = config_data
748748
# new configuration data can change labels, so clear the cache
749749
self.labels = None
750+
# pass info about softdevice presence to linker (see NRF52)
751+
if "SOFTDEVICE_PRESENT" in config_data[1]:
752+
define_string = self.make_ld_define("SOFTDEVICE_PRESENT", config_data[1]["SOFTDEVICE_PRESENT"].macro_value)
753+
self.ld.append(define_string)
754+
self.flags["ld"].append(define_string)
750755
self.add_regions()
751756

752757
# Creates the configuration header if needed:

tools/toolchains/arm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def name_mangle(name):
325325

326326
@staticmethod
327327
def make_ld_define(name, value):
328-
return "--predefine=\"-D%s=0x%x\"" % (name, value)
328+
return "--predefine=\"-D%s=%s\"" % (name, value)
329329

330330
@staticmethod
331331
def redirect_symbol(source, sync, build_dir):
@@ -426,7 +426,7 @@ def __init__(self, target, *args, **kwargs):
426426
self.flags["ld"] += ["--import_cmse_lib_out=%s" % secure_file]
427427
# Add linking time preprocessor macro __DOMAIN_NS
428428
if target.core == "Cortex-M23-NS" or self.target.core == "Cortex-M33-NS":
429-
define_string = self.make_ld_define("__DOMAIN_NS", 1)
429+
define_string = self.make_ld_define("__DOMAIN_NS", "0x1")
430430
self.flags["ld"].append(define_string)
431431

432432
asm_cpu = {

tools/toolchains/gcc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def name_mangle(name):
293293

294294
@staticmethod
295295
def make_ld_define(name, value):
296-
return "-D%s=0x%x" % (name, value)
296+
return "-D%s=%s" % (name, value)
297297

298298
@staticmethod
299299
def redirect_symbol(source, sync, build_dir):

tools/toolchains/iar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def name_mangle(name):
273273

274274
@staticmethod
275275
def make_ld_define(name, value):
276-
return "--config_def %s=0x%x" % (name, value)
276+
return "--config_def %s=%s" % (name, value)
277277

278278
@staticmethod
279279
def redirect_symbol(source, sync, build_dir):

0 commit comments

Comments
 (0)