Skip to content

Commit f18d2d8

Browse files
authored
Merge pull request #5091 from theotherjimmy/fix-nordic-concat
Correct booting on Nordic devices with ARMC6
2 parents a0d5503 + ca41a0f commit f18d2d8

File tree

9 files changed

+21
-16
lines changed

9 files changed

+21
-16
lines changed

targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822_UNIFIED/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NORDIC_32K/nRF51822.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LR_IROM1 0x1B000 0x0025000 {
1919
.ANY (+RO)
2020
}
2121
RW_IRAM0 0x20002ef8 UNINIT 0x000000c0 { ;no init section
22-
*(noinit)
22+
*(*noinit)
2323
}
2424
RW_IRAM1 0x20002FB8 0x00005048 {
2525
.ANY (+RW +ZI)

targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822_UNIFIED/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NRF51_16K_S110/nRF51822.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LR_IROM1 0x18000 0x0028000 {
1919
.ANY (+RO)
2020
}
2121
RW_IRAM0 0x20002000 UNINIT 0x000000c0 { ;no init section
22-
*(noinit)
22+
*(*noinit)
2323
}
2424
RW_IRAM1 0x200020C0 0x00001F40 {
2525
.ANY (+RW +ZI)

targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF51822_UNIFIED/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NRF51_16K_S130/nRF51822.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LR_IROM1 0x0001B000 0x0025000 {
1919
.ANY (+RO)
2020
}
2121
RW_IRAM0 0x20002ef8 UNINIT 0x000000c0 { ;no init section
22-
*(noinit)
22+
*(*noinit)
2323
}
2424
RW_IRAM1 0x20002FB8 0x00001048 {
2525
.ANY (+RW +ZI)

targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LR_IROM1 0x1C000 0x0064000 {
1919
.ANY (+RO)
2020
}
2121
RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section
22-
*(noinit)
22+
*(*noinit)
2323
}
2424
RW_IRAM1 0x20002FD0 0x0000D030 {
2525
.ANY (+RW +ZI)

targets/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52832.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LR_IROM1 0x21000 0x00DF000 {
55
.ANY (+RO)
66
}
77
RW_IRAM0 0x20003288 UNINIT 0x000000F8 { ;no init section
8-
*(noinit)
8+
*(*noinit)
99
}
1010
RW_IRAM1 0x20003380 0x0003cc80 {
1111
.ANY (+RW +ZI)

targets/TARGET_NORDIC/TARGET_NRF5/reloc_vector_table.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
#include "nrf_sdm.h"
4343
#include "section_vars.h"
4444

45-
#if defined(__CC_ARM)
46-
__attribute__ ((section("noinit"),zero_init))
45+
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
46+
__attribute__ ((section(".bss.noinit"),zero_init))
4747
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
4848
#elif defined(__GNUC__)
4949
__attribute__ ((section(".noinit")))

tools/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(self, target, toolchain):
6565
_HOOKS.clear()
6666
self._cmdline_hooks = {}
6767
self.toolchain = toolchain
68-
target.init_hooks(self, toolchain.__class__.__name__)
68+
target.init_hooks(self, toolchain)
6969

7070
# Hook various functions directly
7171
@staticmethod

tools/targets/__init__.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import inspect
2323
import sys
2424
from copy import copy
25+
from inspect import getmro
2526
from collections import namedtuple, Mapping
2627
from tools.targets.LPC import patch
2728
from tools.paths import TOOLS_BOOTLOADERS
@@ -310,10 +311,14 @@ def labels(self):
310311
labels.append("UVISOR_UNSUPPORTED")
311312
return labels
312313

313-
def init_hooks(self, hook, toolchain_name):
314+
def init_hooks(self, hook, toolchain):
314315
"""Initialize the post-build hooks for a toolchain. For now, this
315316
function only allows "post binary" hooks (hooks that are executed
316317
after the binary image is extracted from the executable file)
318+
319+
Positional Arguments:
320+
hook - the hook object to add post-binary-hooks to
321+
toolchain - the toolchain object for inspection
317322
"""
318323

319324
# If there's no hook, simply return
@@ -329,7 +334,7 @@ def init_hooks(self, hook, toolchain_name):
329334
("Invalid format for hook '%s' in target '%s'"
330335
% (hook_data["function"], self.name)) +
331336
" (must be 'class_name.function_name')")
332-
class_name, function_name = temp[0], temp[1]
337+
class_name, function_name = temp
333338
# "class_name" must refer to a class in this file, so check if the
334339
# class exists
335340
mdata = self.get_module_data()
@@ -349,10 +354,11 @@ def init_hooks(self, hook, toolchain_name):
349354
("required by '%s' " % hook_data["function"]) +
350355
("in target '%s' " % self.name) +
351356
("not found in class '%s'" % class_name))
352-
# Check if the hook specification also has target restrictions
353-
toolchain_restrictions = hook_data.get("toolchains", [])
357+
# Check if the hook specification also has toolchain restrictions
358+
toolchain_restrictions = set(hook_data.get("toolchains", []))
359+
toolchain_labels = set(c.__name__ for c in getmro(toolchain.__class__))
354360
if toolchain_restrictions and \
355-
(toolchain_name not in toolchain_restrictions):
361+
not toolchain_labels.intersection(toolchain_restrictions):
356362
return
357363
# Finally, hook the requested function
358364
hook.hook_add_binary("post", getattr(cls, function_name))

tools/toolchains/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from itertools import chain
2727
from inspect import getmro
2828
from copy import deepcopy
29-
from tools.config import Config
3029
from abc import ABCMeta, abstractmethod
3130
from distutils.spawn import find_executable
3231

@@ -1257,7 +1256,7 @@ def get_config_header(self):
12571256
else:
12581257
prev_data = None
12591258
# Get the current configuration data
1260-
crt_data = Config.config_to_header(self.config_data) if self.config_data else None
1259+
crt_data = self.config.config_to_header(self.config_data) if self.config_data else None
12611260
# "changed" indicates if a configuration change was detected
12621261
changed = False
12631262
if prev_data is not None: # a previous mbed_config.h exists
@@ -1553,7 +1552,7 @@ def redirect_symbol(source, sync, build_dir):
15531552

15541553
# Return the list of macros geenrated by the build system
15551554
def get_config_macros(self):
1556-
return Config.config_to_macros(self.config_data) if self.config_data else []
1555+
return self.config.config_to_macros(self.config_data) if self.config_data else []
15571556

15581557
@property
15591558
def report(self):

0 commit comments

Comments
 (0)