Skip to content

Correct booting on Nordic devices with ARMC6 #5091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LR_IROM1 0x1B000 0x0025000 {
.ANY (+RO)
}
RW_IRAM0 0x20002ef8 UNINIT 0x000000c0 { ;no init section
*(noinit)
*(*noinit)
}
RW_IRAM1 0x20002FB8 0x00005048 {
.ANY (+RW +ZI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LR_IROM1 0x18000 0x0028000 {
.ANY (+RO)
}
RW_IRAM0 0x20002000 UNINIT 0x000000c0 { ;no init section
*(noinit)
*(*noinit)
}
RW_IRAM1 0x200020C0 0x00001F40 {
.ANY (+RW +ZI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LR_IROM1 0x0001B000 0x0025000 {
.ANY (+RO)
}
RW_IRAM0 0x20002ef8 UNINIT 0x000000c0 { ;no init section
*(noinit)
*(*noinit)
}
RW_IRAM1 0x20002FB8 0x00001048 {
.ANY (+RW +ZI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LR_IROM1 0x1C000 0x0064000 {
.ANY (+RO)
}
RW_IRAM0 0x20002EF8 UNINIT 0x000000D8 { ;no init section
*(noinit)
*(*noinit)
}
RW_IRAM1 0x20002FD0 0x0000D030 {
.ANY (+RW +ZI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LR_IROM1 0x21000 0x00DF000 {
.ANY (+RO)
}
RW_IRAM0 0x20003288 UNINIT 0x000000F8 { ;no init section
*(noinit)
*(*noinit)
}
RW_IRAM1 0x20003380 0x0003cc80 {
.ANY (+RW +ZI)
Expand Down
4 changes: 2 additions & 2 deletions targets/TARGET_NORDIC/TARGET_NRF5/reloc_vector_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "nrf_sdm.h"
#include "section_vars.h"

#if defined(__CC_ARM)
__attribute__ ((section("noinit"),zero_init))
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
__attribute__ ((section(".bss.noinit"),zero_init))
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
#elif defined(__GNUC__)
__attribute__ ((section(".noinit")))
Expand Down
2 changes: 1 addition & 1 deletion tools/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, target, toolchain):
_HOOKS.clear()
self._cmdline_hooks = {}
self.toolchain = toolchain
target.init_hooks(self, toolchain.__class__.__name__)
target.init_hooks(self, toolchain)

# Hook various functions directly
@staticmethod
Expand Down
16 changes: 11 additions & 5 deletions tools/targets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import inspect
import sys
from copy import copy
from inspect import getmro
from collections import namedtuple, Mapping
from tools.targets.LPC import patch
from tools.paths import TOOLS_BOOTLOADERS
Expand Down Expand Up @@ -310,10 +311,14 @@ def labels(self):
labels.append("UVISOR_UNSUPPORTED")
return labels

def init_hooks(self, hook, toolchain_name):
def init_hooks(self, hook, toolchain):
"""Initialize the post-build hooks for a toolchain. For now, this
function only allows "post binary" hooks (hooks that are executed
after the binary image is extracted from the executable file)

Positional Arguments:
hook - the hook object to add post-binary-hooks to
toolchain - the toolchain object for inspection
"""

# If there's no hook, simply return
Expand All @@ -329,7 +334,7 @@ def init_hooks(self, hook, toolchain_name):
("Invalid format for hook '%s' in target '%s'"
% (hook_data["function"], self.name)) +
" (must be 'class_name.function_name')")
class_name, function_name = temp[0], temp[1]
class_name, function_name = temp
# "class_name" must refer to a class in this file, so check if the
# class exists
mdata = self.get_module_data()
Expand All @@ -349,10 +354,11 @@ def init_hooks(self, hook, toolchain_name):
("required by '%s' " % hook_data["function"]) +
("in target '%s' " % self.name) +
("not found in class '%s'" % class_name))
# Check if the hook specification also has target restrictions
toolchain_restrictions = hook_data.get("toolchains", [])
# Check if the hook specification also has toolchain restrictions
toolchain_restrictions = set(hook_data.get("toolchains", []))
toolchain_labels = set(c.__name__ for c in getmro(toolchain.__class__))
if toolchain_restrictions and \
(toolchain_name not in toolchain_restrictions):
not toolchain_labels.intersection(toolchain_restrictions):
return
# Finally, hook the requested function
hook.hook_add_binary("post", getattr(cls, function_name))
Expand Down
5 changes: 2 additions & 3 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from itertools import chain
from inspect import getmro
from copy import deepcopy
from tools.config import Config
from abc import ABCMeta, abstractmethod
from distutils.spawn import find_executable

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

# Return the list of macros geenrated by the build system
def get_config_macros(self):
return Config.config_to_macros(self.config_data) if self.config_data else []
return self.config.config_to_macros(self.config_data) if self.config_data else []

@property
def report(self):
Expand Down