Просмотр исходного кода

adding toolchain file from sdk

hathach 8 лет назад
Родитель
Сommit
64c43634e2

+ 22 - 20
examples/device/nrf52840/segger/nrf52840.emProject

@@ -19,7 +19,7 @@
       arm_target_device_name="nRF52840_xxAA"
       arm_target_interface_type="SWD"
       c_preprocessor_definitions="NRF52840_XXAA;__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;BOARD_PCA10056"
-      c_user_include_directories="$(ProjectDir)/CMSIS_4/CMSIS/Include;$(ProjectDir)/nRF/CMSIS/Device/Include;$(RepoDir)/hw/cmsis/Include;$(RepoDir)/hw;$(McuDir)/hal;$(RepoDir)/tinyusb;$(McuDir)/sdk;$(McuDir)/sdk/drivers_nrf/hal;$(McuDir)/sdk/drivers_nrf/systick;$(McuDir)/sdk/drivers_nrf/uart;$(McuDir)/sdk/drivers_nrf/usbd;$(McuDir)/sdk/drivers_nrf/common;$(McuDir)/sdk/drivers_nrf/delay;$(McuDir)/sdk/drivers_nrf/power;$(McuDir)/sdk/drivers_nrf/clock;$(McuDir)/sdk/external/fprintf;$(McuDir)/sdk/libraries/util;$(McuDir)/sdk/libraries/strerror;$(McuDir)/sdk/libraries/atomic;$(McuDir)/sdk/libraries/balloc;$(McuDir)/sdk/libraries/experimental_log/src;$(McuDir)/sdk/libraries/experimental_log;$(McuDir)/sdk/libraries/experimental_section_vars;$(McuDir)/sdk/libraries/experimental_memobj;$(McuDir)/sdk/softdevice/s140/headers;$(McuDir)/sdk/softdevice/s140/headers/nrf52;$(McuDir)/sdk/softdevice/common;../src"
+      c_user_include_directories="$(ProjectDir)/nRF/CMSIS/Device/Include;$(RepoDir)/hw/cmsis/Include;$(RepoDir)/hw;$(McuDir)/hal;$(RepoDir)/tinyusb;$(McuDir)/sdk;$(McuDir)/sdk/device;$(McuDir)/sdk/drivers_nrf/hal;$(McuDir)/sdk/drivers_nrf/systick;$(McuDir)/sdk/drivers_nrf/uart;$(McuDir)/sdk/drivers_nrf/usbd;$(McuDir)/sdk/drivers_nrf/common;$(McuDir)/sdk/drivers_nrf/delay;$(McuDir)/sdk/drivers_nrf/power;$(McuDir)/sdk/drivers_nrf/clock;$(McuDir)/sdk/external/fprintf;$(McuDir)/sdk/libraries/util;$(McuDir)/sdk/libraries/strerror;$(McuDir)/sdk/libraries/atomic;$(McuDir)/sdk/libraries/balloc;$(McuDir)/sdk/libraries/experimental_log/src;$(McuDir)/sdk/libraries/experimental_log;$(McuDir)/sdk/libraries/experimental_section_vars;$(McuDir)/sdk/libraries/experimental_memobj;$(McuDir)/sdk/softdevice/s140/headers;$(McuDir)/sdk/softdevice/s140/headers/nrf52;$(McuDir)/sdk/softdevice/common;../src"
       debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml"
       debug_target_connection="J-Link"
       gcc_entry_point="Reset_Handler"
@@ -31,15 +31,6 @@
       target_reset_script="Reset();"
       target_script_file="$(ProjectDir)/nRF_Target.js"
       target_trace_initialize_script="EnableTrace("$(TraceInterfaceType)")" />
-    <folder Name="CMSIS Files">
-      <file file_name="nrf.h" />
-      <file file_name="system_nrf52840.c">
-        <configuration
-          Name="Common"
-          default_code_section=".init"
-          default_const_section=".init_rodata" />
-      </file>
-    </folder>
     <folder Name="RTT Files">
       <file file_name="SEGGER_RTT.c" />
       <file file_name="SEGGER_RTT.h" />
@@ -53,10 +44,6 @@
     </folder>
     <folder Name="System Files">
       <file file_name="thumb_crt0.s" />
-      <file file_name="ses_nRF_Startup.s" />
-      <file file_name="ses_nrf52840_Vectors.s">
-        <configuration Name="Common" file_type="Assembly" />
-      </file>
     </folder>
     <folder
       Name="tinyusb"
@@ -85,12 +72,27 @@
               <file file_name="../../../../hw/mcu/nordic/nrf52/tusb_port/dcd_nrf52.c" />
               <file file_name="../../../../hw/mcu/nordic/nrf52/tusb_port/dcd_nrf52.h" />
             </folder>
-            <folder
-              Name="sdk"
-              exclude=""
-              filter="*.c;*.h"
-              path="../../../../hw/mcu/nordic/nrf52/sdk"
-              recurse="Yes" />
+            <folder Name="sdk">
+              <file file_name="../../../../hw/mcu/nordic/nrf52/sdk/sdk_config.h" />
+              <folder
+                Name="device"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/device" />
+              <folder
+                Name="documentation"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/documentation" />
+              <folder
+                Name="drivers_nrf"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/drivers_nrf" />
+              <folder
+                Name="libraries"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/libraries" />
+              <folder
+                Name="softdevice"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/softdevice" />
+              <folder
+                Name="toolchain"
+                path="../../../../hw/mcu/nordic/nrf52/sdk/toolchain" />
+            </folder>
           </folder>
         </folder>
       </folder>

+ 307 - 0
hw/mcu/nordic/nrf52/sdk/toolchain/gcc/Makefile.common

@@ -0,0 +1,307 @@
+# Copyright (c) 2016 - 2017, Nordic Semiconductor ASA
+# 
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice, this
+#    list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form, except as embedded into a Nordic
+#    Semiconductor ASA integrated circuit in a product or a software update for
+#    such product, must reproduce the above copyright notice, this list of
+#    conditions and the following disclaimer in the documentation and/or other
+#    materials provided with the distribution.
+# 
+# 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+#    contributors may be used to endorse or promote products derived from this
+#    software without specific prior written permission.
+# 
+# 4. This software, with or without modification, must only be used with a
+#    Nordic Semiconductor ASA integrated circuit.
+# 
+# 5. Any software provided in binary form under this license must not be reverse
+#    engineered, decompiled, modified and/or disassembled.
+# 
+# THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# Options:
+#   VERBOSE=1 (default is 0) - print each executed command
+#   PRETTY=1  (default is 0) - show progress, in percentage
+#   ABSOLUTE_PATHS=1 (default is 0) - convert all include folders and source
+#     file paths to their absolute forms
+#   PASS_INCLUDE_PATHS_VIA_FILE=1 (default is 0) - use <target>.inc file
+#     to pass include paths to gcc
+#   PASS_LINKER_INPUT_VIA_FILE=0  (default is 1) - don't use <target>.in file
+#     to pass the list of linker input files
+VERBOSE ?= 0
+PRETTY  ?= 0
+ABSOLUTE_PATHS ?= 0
+PASS_INCLUDE_PATHS_VIA_FILE ?= 0
+PASS_LINKER_INPUT_VIA_FILE  ?= 1
+
+.SUFFIXES: # ignore built-in rules
+%.d:       # don't try to make .d files
+.PRECIOUS: %.d %.o
+
+MK := mkdir
+RM := rm -rf
+
+# echo suspend
+ifeq ($(VERBOSE),1)
+  NO_ECHO :=
+else
+  NO_ECHO := @
+endif
+
+ifneq (,$(filter clean, $(MAKECMDGOALS)))
+
+OTHER_GOALS := $(filter-out clean, $(MAKECMDGOALS))
+ifneq (, $(OTHER_GOALS))
+$(info Cannot make anything in parallel with "clean".)
+$(info Execute "$(MAKE) clean \
+  $(foreach goal, $(OTHER_GOALS),&& $(MAKE) $(goal))" instead.)
+$(error Cannot continue)
+else
+.PHONY: clean
+clean:
+	$(RM) $(OUTPUT_DIRECTORY)
+endif # ifneq(, $(OTHER_GOALS))
+
+else # ifneq (,$(filter clean, $(MAKECMDGOALS)))
+
+ifndef PROGRESS
+
+ifeq ($(PRETTY),1)
+    X     := @
+    EMPTY :=
+    SPACE := $(EMPTY) $(EMPTY)
+    TOTAL := $(subst $(SPACE),,$(filter $(X), \
+               $(shell "$(MAKE)" $(MAKECMDGOALS) --dry-run \
+                 --no-print-directory PROGRESS=$(X))))
+
+    5   := $(X)$(X)$(X)$(X)$(X)
+    25  := $(5)$(5)$(5)$(5)$(5)
+    100 := $(25)$(25)$(25)$(25)
+
+    C       :=
+    COUNTER  = $(eval C := $(C)$(100))$(C)
+    P       :=
+    count    = $(if $(filter $1%,$2),$(eval \
+                 P += 1)$(call count,$1,$(2:$1%=%)),$(eval \
+                 C := $2))
+    print    = [$(if $(word 99,$1),99,$(if $(word 10,$1),, )$(words $1))%]
+    PROGRESS = $(call count,$(TOTAL),$(COUNTER))$(call print,$(P)) $1
+else
+    PROGRESS = $1
+endif # ifeq ($(PRETTY),1)
+
+PLATFORM_SUFFIX := $(if $(filter Windows%,$(OS)),windows,posix)
+TOOLCHAIN_CONFIG_FILE := $(TEMPLATE_PATH)/Makefile.$(PLATFORM_SUFFIX)
+include $(TOOLCHAIN_CONFIG_FILE)
+
+# $1 path
+define quote
+'$(subst ','\'',$(1))'
+endef
+
+# Toolchain commands
+CC      := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-gcc)
+CXX     := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-c++)
+AS      := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-as)
+AR      := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-ar) -r
+LD      := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-ld)
+NM      := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-nm)
+OBJDUMP := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objdump)
+OBJCOPY := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objcopy)
+SIZE    := $(call quote,$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-size)
+$(if $(shell $(CC) --version),,$(info Cannot find: $(CC).) \
+  $(info Please set values in: "$(abspath $(TOOLCHAIN_CONFIG_FILE))") \
+  $(info according to the actual configuration of your system.) \
+  $(error Cannot continue))
+
+# Use ccache on linux if available
+CCACHE := $(if $(filter Windows%,$(OS)),, \
+               $(if $(wildcard /usr/bin/ccache),ccache))
+CC     := $(CCACHE) $(CC)
+
+endif # ifndef PROGRESS
+
+# $1 type of item
+# $2 items paths to check
+define ensure_exists_each
+$(foreach item, $(2), \
+  $(if $(wildcard $(item)),, $(warning Cannot find $(1): $(item))))
+endef
+
+ifeq ($(PASS_INCLUDE_PATHS_VIA_FILE),1)
+INC_PATHS = @$($@_INC)
+GENERATE_INC_FILE := 1
+else
+INC_PATHS = $(call target_specific, INC_PATHS, $($@_TGT))
+GENERATE_INC_FILE :=
+endif
+
+# $1 object file
+# $2 source file
+# $3 include paths container file
+# $4 target name
+define bind_obj_with_src
+$(eval $(1)     := $(2)) \
+$(eval $(1)_INC := $(3)) \
+$(eval $(1)_TGT := $(4)) \
+$(eval $(1): Makefile | $(dir $(1)).) \
+$(if $(GENERATE_INC_FILE), $(eval $(1): $(3)))
+endef
+
+# $1 target name
+# $2 source file name
+# Note: this additional .o for .s files is a workaround for issues with make 4.1
+#       from MinGW (it does nothing to remake .s.o files when a rule for .S.o
+#       files is defined as well).
+define get_object_file_name
+$(OUTPUT_DIRECTORY)/$(strip $(1))/$(notdir $(2:%.s=%.s.o)).o
+endef
+
+# $1 target name
+# $2 include paths container file
+# $3 list of source files
+define get_object_files
+$(call ensure_exists_each,source file, $(3)) \
+$(foreach src_file, $(3), \
+  $(eval obj_file := $(call get_object_file_name, $(1), $(src_file))) \
+  $(eval DEPENDENCIES += $(obj_file:.o=.d)) \
+  $(call bind_obj_with_src, $(obj_file), $(src_file), $(2), $(1)) \
+  $(obj_file))
+endef
+
+# $1 variable name
+# $2 target name
+define target_specific
+$($(addsuffix _$(strip $(2)), $(1)))
+endef
+
+ifeq ($(ABSOLUTE_PATHS),1)
+get_path = $(call quote,$(abspath $1))
+else
+get_path = $1
+endif
+
+# $1 list of include folders
+define get_inc_paths
+$(call ensure_exists_each,include folder,$(1)) \
+$(foreach folder,$(1),-I$(call get_path,$(folder)))
+endef
+
+# $1 target name
+# $2 include paths container file
+# $3 build goal name
+define prepare_build
+$(eval DEPENDENCIES :=) \
+$(eval $(3): \
+  $(call get_object_files, $(1), $(2), \
+    $(SRC_FILES) $(call target_specific, SRC_FILES, $(1)))) \
+$(eval -include $(DEPENDENCIES)) \
+$(eval INC_PATHS_$(strip $(1)) := \
+  $(call get_inc_paths, \
+    $(INC_FOLDERS) $(call target_specific, INC_FOLDERS, $(1))))
+endef
+
+# $1 target name
+define define_target
+$(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \
+$(eval $(1): $(OUTPUT_FILE).out $(OUTPUT_FILE).hex $(OUTPUT_FILE).bin \
+           ; @echo DONE $(strip $(1))) \
+$(call prepare_build, $(1), $(OUTPUT_FILE).inc, $(OUTPUT_FILE).out)
+endef
+
+# $1 target name
+# $2 library file name
+define define_library
+$(eval OUTPUT_FILE := $(OUTPUT_DIRECTORY)/$(strip $(1))) \
+$(eval $(1) := $(2)) \
+$(call prepare_build, $(1), $(OUTPUT_FILE).inc, $(1))
+endef
+
+# $1 content to be dumped
+# Invokes another instance of MAKE to dump the specified content to stdout,
+# which may be then redirected in shell to a file and this way stored there.
+# MAKE in version prior to 4.0 does not provide the $(file ...) function.
+define dump
+$(eval CONTENT_TO_DUMP := $(1)) \
+"$(MAKE)" -s --no-print-directory \
+  -f "$(TEMPLATE_PATH)/dump.mk" VARIABLE=CONTENT_TO_DUMP
+endef
+export CONTENT_TO_DUMP
+
+.PHONY: $(TARGETS) all
+
+all: $(TARGETS)
+
+# Create build directories
+$(OUTPUT_DIRECTORY):
+	$(MK) $@
+$(OUTPUT_DIRECTORY)/%/.: | $(OUTPUT_DIRECTORY)
+	cd $(OUTPUT_DIRECTORY) && $(MK) $*
+
+$(OUTPUT_DIRECTORY)/%.inc: Makefile | $(OUTPUT_DIRECTORY)
+	$(info Generating $@)
+	$(NO_ECHO)$(call dump, $(call target_specific, INC_PATHS, $*)) > $@
+
+# $1 command
+# $2 flags
+# $3 message
+define run
+$(info $(call PROGRESS,$(3) file: $(notdir $($@)))) \
+$(NO_ECHO)$(1) -MP -MD -c -o $@ $(call get_path,$($@)) $(2) $(INC_PATHS)
+endef
+
+# Create object files from C source files
+%.c.o:
+	$(call run,$(CC) -std=c99,$(CFLAGS),Compiling)
+
+# Create object files from C++ source files
+%.cpp.o:
+	$(call run,$(CXX),$(CFLAGS) $(CXXFLAGS),Compiling)
+
+# Create object files from assembly source files
+%.S.o %.s.o.o:
+	$(call run,$(CC) -x assembler-with-cpp,$(ASMFLAGS),Assembling)
+
+ifeq ($(PASS_LINKER_INPUT_VIA_FILE),1)
+GENERATE_LD_INPUT_FILE = $(call dump, $^ $(LIB_FILES)) > $(@:.out=.in)
+LD_INPUT               = @$(@:.out=.in)
+else
+GENERATE_LD_INPUT_FILE =
+LD_INPUT               = $^ $(LIB_FILES)
+endif
+
+# Link object files
+%.out:
+	$(info $(call PROGRESS,Linking target: $@))
+	$(NO_ECHO)$(GENERATE_LD_INPUT_FILE)
+	$(NO_ECHO)$(CC) $(LDFLAGS) $(LD_INPUT) -Wl,-Map=$(@:.out=.map) -o $@
+	$(NO_ECHO)$(SIZE) $@
+
+# Create binary .bin file from the .out file
+%.bin: %.out
+	$(info Preparing: $@)
+	$(NO_ECHO)$(OBJCOPY) -O binary $< $@
+
+# Create binary .hex file from the .out file
+%.hex: %.out
+	$(info Preparing: $@)
+	$(NO_ECHO)$(OBJCOPY) -O ihex $< $@
+
+endif # ifneq (,$(filter clean, $(MAKECMDGOALS)))

+ 3 - 0
hw/mcu/nordic/nrf52/sdk/toolchain/gcc/Makefile.posix

@@ -0,0 +1,3 @@
+GNU_INSTALL_ROOT := /usr/local/gcc-arm-none-eabi-4_9-2015q3/bin/
+GNU_VERSION := 4.9.3
+GNU_PREFIX := arm-none-eabi

+ 3 - 0
hw/mcu/nordic/nrf52/sdk/toolchain/gcc/Makefile.windows

@@ -0,0 +1,3 @@
+GNU_INSTALL_ROOT := C:/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q3/bin/
+GNU_VERSION := 4.9.3
+GNU_PREFIX := arm-none-eabi

+ 410 - 0
hw/mcu/nordic/nrf52/sdk/toolchain/gcc/gcc_startup_nrf52840.S

@@ -0,0 +1,410 @@
+/*
+ 
+Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+
+    SPDX-License-Identifier: Apache-2.0
+
+Licensed under the Apache License, Version 2.0 (the License); you may
+not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an AS IS BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+NOTICE: This file has been modified by Nordic Semiconductor ASA.
+
+*/
+
+    .syntax unified
+    .arch armv7e-m
+
+#ifdef __STARTUP_CONFIG
+#include "startup_config.h"
+#ifndef __STARTUP_CONFIG_STACK_ALIGNEMENT
+#define __STARTUP_CONFIG_STACK_ALIGNEMENT 3
+#endif
+#endif
+
+    .section .stack
+#if defined(__STARTUP_CONFIG)
+    .align __STARTUP_CONFIG_STACK_ALIGNEMENT
+    .equ    Stack_Size, __STARTUP_CONFIG_STACK_SIZE
+#elif defined(__STACK_SIZE)
+    .align 3
+    .equ    Stack_Size, __STACK_SIZE
+#else
+    .align 3
+    .equ    Stack_Size, 8192
+#endif
+    .globl __StackTop
+    .globl __StackLimit
+__StackLimit:
+    .space Stack_Size
+    .size __StackLimit, . - __StackLimit
+__StackTop:
+    .size __StackTop, . - __StackTop
+
+    .section .heap
+    .align 3
+#if defined(__STARTUP_CONFIG)
+    .equ Heap_Size, __STARTUP_CONFIG_HEAP_SIZE
+#elif defined(__HEAP_SIZE)
+    .equ Heap_Size, __HEAP_SIZE
+#else
+    .equ    Heap_Size, 8192
+#endif
+    .globl __HeapBase
+    .globl __HeapLimit
+__HeapBase:
+    .if Heap_Size
+    .space Heap_Size
+    .endif
+    .size __HeapBase, . - __HeapBase
+__HeapLimit:
+    .size __HeapLimit, . - __HeapLimit
+
+    .section .isr_vector
+    .align 2
+    .globl __isr_vector
+__isr_vector:
+    .long   __StackTop                  /* Top of Stack */
+    .long   Reset_Handler
+    .long   NMI_Handler
+    .long   HardFault_Handler
+    .long   MemoryManagement_Handler
+    .long   BusFault_Handler
+    .long   UsageFault_Handler
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   SVC_Handler
+    .long   DebugMon_Handler
+    .long   0                           /*Reserved */
+    .long   PendSV_Handler
+    .long   SysTick_Handler
+
+  /* External Interrupts */
+    .long   POWER_CLOCK_IRQHandler
+    .long   RADIO_IRQHandler
+    .long   UARTE0_UART0_IRQHandler
+    .long   SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
+    .long   SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
+    .long   NFCT_IRQHandler
+    .long   GPIOTE_IRQHandler
+    .long   SAADC_IRQHandler
+    .long   TIMER0_IRQHandler
+    .long   TIMER1_IRQHandler
+    .long   TIMER2_IRQHandler
+    .long   RTC0_IRQHandler
+    .long   TEMP_IRQHandler
+    .long   RNG_IRQHandler
+    .long   ECB_IRQHandler
+    .long   CCM_AAR_IRQHandler
+    .long   WDT_IRQHandler
+    .long   RTC1_IRQHandler
+    .long   QDEC_IRQHandler
+    .long   COMP_LPCOMP_IRQHandler
+    .long   SWI0_EGU0_IRQHandler
+    .long   SWI1_EGU1_IRQHandler
+    .long   SWI2_EGU2_IRQHandler
+    .long   SWI3_EGU3_IRQHandler
+    .long   SWI4_EGU4_IRQHandler
+    .long   SWI5_EGU5_IRQHandler
+    .long   TIMER3_IRQHandler
+    .long   TIMER4_IRQHandler
+    .long   PWM0_IRQHandler
+    .long   PDM_IRQHandler
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   MWU_IRQHandler
+    .long   PWM1_IRQHandler
+    .long   PWM2_IRQHandler
+    .long   SPIM2_SPIS2_SPI2_IRQHandler
+    .long   RTC2_IRQHandler
+    .long   I2S_IRQHandler
+    .long   FPU_IRQHandler
+    .long   USBD_IRQHandler
+    .long   UARTE1_IRQHandler
+    .long   QSPI_IRQHandler
+    .long   CRYPTOCELL_IRQHandler
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   PWM3_IRQHandler
+    .long   0                           /*Reserved */
+    .long   SPIM3_IRQHandler
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+    .long   0                           /*Reserved */
+
+    .size __isr_vector, . - __isr_vector
+
+/* Reset Handler */
+
+
+    .text
+    .thumb
+    .thumb_func
+    .align 1
+    .globl Reset_Handler
+    .type Reset_Handler, %function
+Reset_Handler:
+
+
+/* Loop to copy data from read only memory to RAM.
+ * The ranges of copy from/to are specified by following symbols:
+ *      __etext: LMA of start of the section to copy from. Usually end of text
+ *      __data_start__: VMA of start of the section to copy to.
+ *      __bss_start__: VMA of end of the section to copy to. Normally __data_end__ is used, but by using __bss_start__
+ *                    the user can add their own initialized data section before BSS section with the INTERT AFTER command.
+ *
+ * All addresses must be aligned to 4 bytes boundary.
+ */
+    ldr r1, =__etext
+    ldr r2, =__data_start__
+    ldr r3, =__bss_start__
+
+    subs r3, r2
+    ble .L_loop1_done
+
+.L_loop1:
+    subs r3, #4
+    ldr r0, [r1,r3]
+    str r0, [r2,r3]
+    bgt .L_loop1
+
+.L_loop1_done:
+
+/* This part of work usually is done in C library startup code. Otherwise,
+ * define __STARTUP_CLEAR_BSS to enable it in this startup. This section
+ * clears the RAM where BSS data is located.
+ *
+ * The BSS section is specified by following symbols
+ *    __bss_start__: start of the BSS section.
+ *    __bss_end__: end of the BSS section.
+ *
+ * All addresses must be aligned to 4 bytes boundary.
+ */
+#ifdef __STARTUP_CLEAR_BSS
+    ldr r1, =__bss_start__
+    ldr r2, =__bss_end__
+
+    movs r0, 0
+
+    subs r2, r1
+    ble .L_loop3_done
+
+.L_loop3:
+    subs r2, #4
+    str r0, [r1, r2]
+    bgt .L_loop3
+
+.L_loop3_done:
+#endif /* __STARTUP_CLEAR_BSS */
+
+/* Execute SystemInit function. */
+    bl SystemInit
+
+/* Call _start function provided by libraries.
+ * If those libraries are not accessible, define __START as your entry point.
+ */
+#ifndef __START
+#define __START _start
+#endif
+    bl __START
+
+    .pool
+    .size   Reset_Handler,.-Reset_Handler
+
+    .section ".text"
+
+
+/* Dummy Exception Handlers (infinite loops which can be modified) */
+
+    .weak   NMI_Handler
+    .type   NMI_Handler, %function
+NMI_Handler:
+    b       .
+    .size   NMI_Handler, . - NMI_Handler
+
+
+    .weak   HardFault_Handler
+    .type   HardFault_Handler, %function
+HardFault_Handler:
+    b       .
+    .size   HardFault_Handler, . - HardFault_Handler
+
+
+    .weak   MemoryManagement_Handler
+    .type   MemoryManagement_Handler, %function
+MemoryManagement_Handler:
+    b       .
+    .size   MemoryManagement_Handler, . - MemoryManagement_Handler
+
+
+    .weak   BusFault_Handler
+    .type   BusFault_Handler, %function
+BusFault_Handler:
+    b       .
+    .size   BusFault_Handler, . - BusFault_Handler
+
+
+    .weak   UsageFault_Handler
+    .type   UsageFault_Handler, %function
+UsageFault_Handler:
+    b       .
+    .size   UsageFault_Handler, . - UsageFault_Handler
+
+
+    .weak   SVC_Handler
+    .type   SVC_Handler, %function
+SVC_Handler:
+    b       .
+    .size   SVC_Handler, . - SVC_Handler
+
+
+    .weak   DebugMon_Handler
+    .type   DebugMon_Handler, %function
+DebugMon_Handler:
+    b       .
+    .size   DebugMon_Handler, . - DebugMon_Handler
+
+
+    .weak   PendSV_Handler
+    .type   PendSV_Handler, %function
+PendSV_Handler:
+    b       .
+    .size   PendSV_Handler, . - PendSV_Handler
+
+
+    .weak   SysTick_Handler
+    .type   SysTick_Handler, %function
+SysTick_Handler:
+    b       .
+    .size   SysTick_Handler, . - SysTick_Handler
+
+
+/* IRQ Handlers */
+
+    .globl  Default_Handler
+    .type   Default_Handler, %function
+Default_Handler:
+    b       .
+    .size   Default_Handler, . - Default_Handler
+
+    .macro  IRQ handler
+    .weak   \handler
+    .set    \handler, Default_Handler
+    .endm
+
+    IRQ  POWER_CLOCK_IRQHandler
+    IRQ  RADIO_IRQHandler
+    IRQ  UARTE0_UART0_IRQHandler
+    IRQ  SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
+    IRQ  SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
+    IRQ  NFCT_IRQHandler
+    IRQ  GPIOTE_IRQHandler
+    IRQ  SAADC_IRQHandler
+    IRQ  TIMER0_IRQHandler
+    IRQ  TIMER1_IRQHandler
+    IRQ  TIMER2_IRQHandler
+    IRQ  RTC0_IRQHandler
+    IRQ  TEMP_IRQHandler
+    IRQ  RNG_IRQHandler
+    IRQ  ECB_IRQHandler
+    IRQ  CCM_AAR_IRQHandler
+    IRQ  WDT_IRQHandler
+    IRQ  RTC1_IRQHandler
+    IRQ  QDEC_IRQHandler
+    IRQ  COMP_LPCOMP_IRQHandler
+    IRQ  SWI0_EGU0_IRQHandler
+    IRQ  SWI1_EGU1_IRQHandler
+    IRQ  SWI2_EGU2_IRQHandler
+    IRQ  SWI3_EGU3_IRQHandler
+    IRQ  SWI4_EGU4_IRQHandler
+    IRQ  SWI5_EGU5_IRQHandler
+    IRQ  TIMER3_IRQHandler
+    IRQ  TIMER4_IRQHandler
+    IRQ  PWM0_IRQHandler
+    IRQ  PDM_IRQHandler
+    IRQ  MWU_IRQHandler
+    IRQ  PWM1_IRQHandler
+    IRQ  PWM2_IRQHandler
+    IRQ  SPIM2_SPIS2_SPI2_IRQHandler
+    IRQ  RTC2_IRQHandler
+    IRQ  I2S_IRQHandler
+    IRQ  FPU_IRQHandler
+    IRQ  USBD_IRQHandler
+    IRQ  UARTE1_IRQHandler
+    IRQ  QSPI_IRQHandler
+    IRQ  CRYPTOCELL_IRQHandler
+    IRQ  PWM3_IRQHandler
+    IRQ  SPIM3_IRQHandler
+
+  .end

+ 0 - 0
examples/device/nrf52840/segger/ses_nRF_Startup.s → hw/mcu/nordic/nrf52/sdk/toolchain/ses/ses_nRF_Startup.s


+ 0 - 0
examples/device/nrf52840/segger/ses_nrf52840_Vectors.s → hw/mcu/nordic/nrf52/sdk/toolchain/ses/ses_nrf52840_Vectors.s


+ 0 - 0
examples/device/nrf52840/segger/system_nrf52840.c → hw/mcu/nordic/nrf52/sdk/toolchain/system_nrf52840.c


+ 61 - 0
hw/mcu/nordic/nrf52/sdk/toolchain/system_nrf52840.h

@@ -0,0 +1,61 @@
+/*
+
+Copyright (c) 2009-2017 ARM Limited. All rights reserved.
+
+    SPDX-License-Identifier: Apache-2.0
+
+Licensed under the Apache License, Version 2.0 (the License); you may
+not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an AS IS BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+NOTICE: This file has been modified by Nordic Semiconductor ASA.
+
+*/
+
+#ifndef SYSTEM_NRF52840_H
+#define SYSTEM_NRF52840_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+
+extern uint32_t SystemCoreClock;    /*!< System Clock Frequency (Core Clock)  */
+
+/**
+ * Initialize the system
+ *
+ * @param  none
+ * @return none
+ *
+ * @brief  Setup the microcontroller system.
+ *         Initialize the System and update the SystemCoreClock variable.
+ */
+extern void SystemInit (void);
+
+/**
+ * Update SystemCoreClock variable
+ *
+ * @param  none
+ * @return none
+ *
+ * @brief  Updates the SystemCoreClock with current core Clock 
+ *         retrieved from cpu registers.
+ */
+extern void SystemCoreClockUpdate (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SYSTEM_NRF52840_H */