Browse Source

update

master
zhaohe 1 year ago
parent
commit
493b3ffbbe
  1. 158
      bootloader/main.c
  2. 58
      bootloader/nrf_crypto_allocator.h
  3. 379
      bootloader/pca10100_s140_ble/arm5_no_packs/RTE/Device/nRF52833_xxAA/arm_startup_nrf52833.s
  4. 329
      bootloader/pca10100_s140_ble/arm5_no_packs/RTE/Device/nRF52833_xxAA/system_nrf52.c
  5. 1860
      bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvguix.h_zha
  6. 1321
      bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvoptx
  7. 8533
      bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvprojx
  8. 5360
      bootloader/pca10100_s140_ble/config/sdk_config.h
  9. 58
      bootloader/pca10100_s140_ble/ses/flash_placement.xml
  10. 151
      bootloader/pca10100_s140_ble/ses/secure_bootloader_ble_s140_pca10100.emProject
  11. 7
      bootloader/pca10100_s140_ble/ses/secure_bootloader_ble_s140_pca10100.emSession
  12. 12
      bootloader_security/dfu_public_key.c
  13. 5
      bootloader_security/priv.pem
  14. BIN
      sample_bin_parser/0.bin
  15. 8193
      sample_bin_parser/0.csv
  16. BIN
      tools/nrfutil.exe

158
bootloader/main.c

@ -0,0 +1,158 @@
/**
* Copyright (c) 2016 - 2021, 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.
*
*/
/** @file
*
* @defgroup bootloader_secure_ble main.c
* @{
* @ingroup dfu_bootloader_api
* @brief Bootloader project main file for secure DFU.
*
*/
#include <stdint.h>
#include "boards.h"
#include "nrf_mbr.h"
#include "nrf_bootloader.h"
#include "nrf_bootloader_app_start.h"
#include "nrf_bootloader_dfu_timers.h"
#include "nrf_dfu.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "app_error.h"
#include "app_error_weak.h"
#include "nrf_bootloader_info.h"
#include "nrf_delay.h"
static void on_error(void)
{
NRF_LOG_FINAL_FLUSH();
#if NRF_MODULE_ENABLED(NRF_LOG_BACKEND_RTT)
// To allow the buffer to be flushed by the host.
nrf_delay_ms(100);
#endif
#ifdef NRF_DFU_DEBUG_VERSION
NRF_BREAKPOINT_COND;
#endif
NVIC_SystemReset();
}
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
NRF_LOG_ERROR("%s:%d", p_file_name, line_num);
on_error();
}
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
NRF_LOG_ERROR("Received a fault! id: 0x%08x, pc: 0x%08x, info: 0x%08x", id, pc, info);
on_error();
}
void app_error_handler_bare(uint32_t error_code)
{
NRF_LOG_ERROR("Received an error: 0x%08x!", error_code);
on_error();
}
/**
* @brief Function notifies certain events in DFU process.
*/
static void dfu_observer(nrf_dfu_evt_type_t evt_type)
{
switch (evt_type)
{
case NRF_DFU_EVT_DFU_FAILED:
case NRF_DFU_EVT_DFU_ABORTED:
case NRF_DFU_EVT_DFU_INITIALIZED:
bsp_board_init(BSP_INIT_LEDS);
bsp_board_led_on(BSP_BOARD_LED_0);
bsp_board_led_on(BSP_BOARD_LED_1);
bsp_board_led_off(BSP_BOARD_LED_2);
break;
case NRF_DFU_EVT_TRANSPORT_ACTIVATED:
bsp_board_led_off(BSP_BOARD_LED_1);
bsp_board_led_on(BSP_BOARD_LED_2);
break;
case NRF_DFU_EVT_DFU_STARTED:
break;
default:
break;
}
}
/**@brief Function for application main entry. */
int main(void)
{
uint32_t ret_val;
// Must happen before flash protection is applied, since it edits a protected page.
nrf_bootloader_mbr_addrs_populate();
// Protect MBR and bootloader code from being overwritten.
ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE);
APP_ERROR_CHECK(ret_val);
ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE);
APP_ERROR_CHECK(ret_val);
(void) NRF_LOG_INIT(nrf_bootloader_dfu_timer_counter_get);
NRF_LOG_DEFAULT_BACKENDS_INIT();
NRF_LOG_INFO("Inside main");
ret_val = nrf_bootloader_init(dfu_observer);
APP_ERROR_CHECK(ret_val);
NRF_LOG_FLUSH();
NRF_LOG_ERROR("After main, should never be reached.");
NRF_LOG_FLUSH();
APP_ERROR_CHECK_BOOL(false);
}
/**
* @}
*/

58
bootloader/nrf_crypto_allocator.h

@ -0,0 +1,58 @@
/**
* Copyright (c) 2019 - 2021, 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.
*
*/
#ifndef NRF_CRYPTO_ALLOCATOR_H__
#define NRF_CRYPTO_ALLOCATOR_H__
#include "nrf_assert.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Crypto library in bootloader case does not use dynamic allocation */
#define NRF_CRYPTO_ALLOC(size) NULL; ASSERT(0)
#define NRF_CRYPTO_ALLOC_ON_STACK(size) NULL; ASSERT(0)
#define NRF_CRYPTO_FREE(ptr) (void)ptr;
#ifdef __cplusplus
}
#endif
#endif /* NRF_CRYPTO_ALLOCATOR_H__ */

379
bootloader/pca10100_s140_ble/arm5_no_packs/RTE/Device/nRF52833_xxAA/arm_startup_nrf52833.s

@ -0,0 +1,379 @@
; Copyright (c) 2009-2021 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.
IF :DEF: __STARTUP_CONFIG
#ifdef __STARTUP_CONFIG
#include "startup_config.h"
#ifndef __STARTUP_CONFIG_STACK_ALIGNEMENT
#define __STARTUP_CONFIG_STACK_ALIGNEMENT 3
#endif
#endif
ENDIF
IF :DEF: __STARTUP_CONFIG
Stack_Size EQU __STARTUP_CONFIG_STACK_SIZE
ELIF :DEF: __STACK_SIZE
Stack_Size EQU __STACK_SIZE
ELSE
Stack_Size EQU 8192
ENDIF
IF :DEF: __STARTUP_CONFIG
Stack_Align EQU __STARTUP_CONFIG_STACK_ALIGNEMENT
ELSE
Stack_Align EQU 3
ENDIF
AREA STACK, NOINIT, READWRITE, ALIGN=Stack_Align
Stack_Mem SPACE Stack_Size
__initial_sp
IF :DEF: __STARTUP_CONFIG
Heap_Size EQU __STARTUP_CONFIG_HEAP_SIZE
ELIF :DEF: __HEAP_SIZE
Heap_Size EQU __HEAP_SIZE
ELSE
Heap_Size EQU 8192
ENDIF
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler
DCD NMI_Handler
DCD HardFault_Handler
DCD MemoryManagement_Handler
DCD BusFault_Handler
DCD UsageFault_Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler
DCD DebugMon_Handler
DCD 0 ; Reserved
DCD PendSV_Handler
DCD SysTick_Handler
; External Interrupts
DCD POWER_CLOCK_IRQHandler
DCD RADIO_IRQHandler
DCD UARTE0_UART0_IRQHandler
DCD SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
DCD SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
DCD NFCT_IRQHandler
DCD GPIOTE_IRQHandler
DCD SAADC_IRQHandler
DCD TIMER0_IRQHandler
DCD TIMER1_IRQHandler
DCD TIMER2_IRQHandler
DCD RTC0_IRQHandler
DCD TEMP_IRQHandler
DCD RNG_IRQHandler
DCD ECB_IRQHandler
DCD CCM_AAR_IRQHandler
DCD WDT_IRQHandler
DCD RTC1_IRQHandler
DCD QDEC_IRQHandler
DCD COMP_LPCOMP_IRQHandler
DCD SWI0_EGU0_IRQHandler
DCD SWI1_EGU1_IRQHandler
DCD SWI2_EGU2_IRQHandler
DCD SWI3_EGU3_IRQHandler
DCD SWI4_EGU4_IRQHandler
DCD SWI5_EGU5_IRQHandler
DCD TIMER3_IRQHandler
DCD TIMER4_IRQHandler
DCD PWM0_IRQHandler
DCD PDM_IRQHandler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD MWU_IRQHandler
DCD PWM1_IRQHandler
DCD PWM2_IRQHandler
DCD SPIM2_SPIS2_SPI2_IRQHandler
DCD RTC2_IRQHandler
DCD I2S_IRQHandler
DCD FPU_IRQHandler
DCD USBD_IRQHandler
DCD UARTE1_IRQHandler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD PWM3_IRQHandler
DCD 0 ; Reserved
DCD SPIM3_IRQHandler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
AREA |.text|, CODE, READONLY
; Reset Handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT SystemInit
IMPORT __main
LDR R0, =SystemInit
BLX R0
LDR R0, =__main
BX R0
ENDP
; Dummy Exception Handlers (infinite loops which can be modified)
NMI_Handler PROC
EXPORT NMI_Handler [WEAK]
B .
ENDP
HardFault_Handler\
PROC
EXPORT HardFault_Handler [WEAK]
B .
ENDP
MemoryManagement_Handler\
PROC
EXPORT MemoryManagement_Handler [WEAK]
B .
ENDP
BusFault_Handler\
PROC
EXPORT BusFault_Handler [WEAK]
B .
ENDP
UsageFault_Handler\
PROC
EXPORT UsageFault_Handler [WEAK]
B .
ENDP
SVC_Handler PROC
EXPORT SVC_Handler [WEAK]
B .
ENDP
DebugMon_Handler\
PROC
EXPORT DebugMon_Handler [WEAK]
B .
ENDP
PendSV_Handler PROC
EXPORT PendSV_Handler [WEAK]
B .
ENDP
SysTick_Handler PROC
EXPORT SysTick_Handler [WEAK]
B .
ENDP
Default_Handler PROC
EXPORT POWER_CLOCK_IRQHandler [WEAK]
EXPORT RADIO_IRQHandler [WEAK]
EXPORT UARTE0_UART0_IRQHandler [WEAK]
EXPORT SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler [WEAK]
EXPORT SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler [WEAK]
EXPORT NFCT_IRQHandler [WEAK]
EXPORT GPIOTE_IRQHandler [WEAK]
EXPORT SAADC_IRQHandler [WEAK]
EXPORT TIMER0_IRQHandler [WEAK]
EXPORT TIMER1_IRQHandler [WEAK]
EXPORT TIMER2_IRQHandler [WEAK]
EXPORT RTC0_IRQHandler [WEAK]
EXPORT TEMP_IRQHandler [WEAK]
EXPORT RNG_IRQHandler [WEAK]
EXPORT ECB_IRQHandler [WEAK]
EXPORT CCM_AAR_IRQHandler [WEAK]
EXPORT WDT_IRQHandler [WEAK]
EXPORT RTC1_IRQHandler [WEAK]
EXPORT QDEC_IRQHandler [WEAK]
EXPORT COMP_LPCOMP_IRQHandler [WEAK]
EXPORT SWI0_EGU0_IRQHandler [WEAK]
EXPORT SWI1_EGU1_IRQHandler [WEAK]
EXPORT SWI2_EGU2_IRQHandler [WEAK]
EXPORT SWI3_EGU3_IRQHandler [WEAK]
EXPORT SWI4_EGU4_IRQHandler [WEAK]
EXPORT SWI5_EGU5_IRQHandler [WEAK]
EXPORT TIMER3_IRQHandler [WEAK]
EXPORT TIMER4_IRQHandler [WEAK]
EXPORT PWM0_IRQHandler [WEAK]
EXPORT PDM_IRQHandler [WEAK]
EXPORT MWU_IRQHandler [WEAK]
EXPORT PWM1_IRQHandler [WEAK]
EXPORT PWM2_IRQHandler [WEAK]
EXPORT SPIM2_SPIS2_SPI2_IRQHandler [WEAK]
EXPORT RTC2_IRQHandler [WEAK]
EXPORT I2S_IRQHandler [WEAK]
EXPORT FPU_IRQHandler [WEAK]
EXPORT USBD_IRQHandler [WEAK]
EXPORT UARTE1_IRQHandler [WEAK]
EXPORT PWM3_IRQHandler [WEAK]
EXPORT SPIM3_IRQHandler [WEAK]
POWER_CLOCK_IRQHandler
RADIO_IRQHandler
UARTE0_UART0_IRQHandler
SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
NFCT_IRQHandler
GPIOTE_IRQHandler
SAADC_IRQHandler
TIMER0_IRQHandler
TIMER1_IRQHandler
TIMER2_IRQHandler
RTC0_IRQHandler
TEMP_IRQHandler
RNG_IRQHandler
ECB_IRQHandler
CCM_AAR_IRQHandler
WDT_IRQHandler
RTC1_IRQHandler
QDEC_IRQHandler
COMP_LPCOMP_IRQHandler
SWI0_EGU0_IRQHandler
SWI1_EGU1_IRQHandler
SWI2_EGU2_IRQHandler
SWI3_EGU3_IRQHandler
SWI4_EGU4_IRQHandler
SWI5_EGU5_IRQHandler
TIMER3_IRQHandler
TIMER4_IRQHandler
PWM0_IRQHandler
PDM_IRQHandler
MWU_IRQHandler
PWM1_IRQHandler
PWM2_IRQHandler
SPIM2_SPIS2_SPI2_IRQHandler
RTC2_IRQHandler
I2S_IRQHandler
FPU_IRQHandler
USBD_IRQHandler
UARTE1_IRQHandler
PWM3_IRQHandler
SPIM3_IRQHandler
B .
ENDP
ALIGN
; User Initial Stack & Heap
IF :DEF:__MICROLIB
EXPORT __initial_sp
EXPORT __heap_base
EXPORT __heap_limit
ELSE
IMPORT __use_two_region_memory
EXPORT __user_initial_stackheap
__user_initial_stackheap PROC
LDR R0, = Heap_Mem
LDR R1, = (Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem
BX LR
ENDP
ALIGN
ENDIF
END

329
bootloader/pca10100_s140_ble/arm5_no_packs/RTE/Device/nRF52833_xxAA/system_nrf52.c

@ -0,0 +1,329 @@
/*
Copyright (c) 2009-2021 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.
*/
/* NOTE: Template files (including this one) are application specific and therefore expected to
be copied into the application project folder prior to its use! */
#include <stdint.h>
#include <stdbool.h>
#include "nrf.h"
#include "nrf_peripherals.h"
#include "nrf52_erratas.h"
#include "system_nrf52.h"
#include "system_nrf52_approtect.h"
#define __SYSTEM_CLOCK_64M (64000000UL)
#if defined ( __CC_ARM )
uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M;
#elif defined ( __ICCARM__ )
__root uint32_t SystemCoreClock = __SYSTEM_CLOCK_64M;
#elif defined ( __GNUC__ )
uint32_t SystemCoreClock __attribute__((used)) = __SYSTEM_CLOCK_64M;
#endif
/* Select correct reset pin */
/* Handle DEVELOP_IN-targets first as they take precedence over the later macros */
#if defined (DEVELOP_IN_NRF52805) \
|| defined (DEVELOP_IN_NRF52810) \
|| defined (DEVELOP_IN_NRF52811) \
|| defined (DEVELOP_IN_NRF52832)
#define RESET_PIN 21
#elif defined (DEVELOP_IN_NRF52820) \
|| defined (DEVELOP_IN_NRF52833) \
|| defined (DEVELOP_IN_NRF52840)
#define RESET_PIN 18
#elif defined (NRF52805_XXAA) \
|| defined (NRF52810_XXAA) \
|| defined (NRF52811_XXAA) \
|| defined (NRF52832_XXAA) \
|| defined (NRF52832_XXAB)
#define RESET_PIN 21
#elif defined (NRF52820_XXAA) \
|| defined (NRF52833_XXAA) \
|| defined (NRF52840_XXAA)
#define RESET_PIN 18
#else
#error "A supported device macro must be defined."
#endif
/* -- NVMC utility functions -- */
/* Waits until NVMC is done with the current pending action */
void nvmc_wait(void)
{
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
}
/* Configure the NVMC to "mode".
Mode must be an enumerator of field NVMC_CONFIG_WEN */
void nvmc_config(uint32_t mode)
{
NRF_NVMC->CONFIG = mode << NVMC_CONFIG_WEN_Pos;
nvmc_wait();
}
void SystemCoreClockUpdate(void)
{
SystemCoreClock = __SYSTEM_CLOCK_64M;
}
void SystemInit(void)
{
/* Enable SWO trace functionality. If ENABLE_SWO is not defined, SWO pin will be used as GPIO (see Product
Specification to see which one). */
#if defined (ENABLE_SWO) && defined(CLOCK_TRACECONFIG_TRACEMUX_Pos)
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Serial << CLOCK_TRACECONFIG_TRACEMUX_Pos;
NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
#endif
/* Enable Trace functionality. If ENABLE_TRACE is not defined, TRACE pins will be used as GPIOs (see Product
Specification to see which ones). */
#if defined (ENABLE_TRACE) && defined(CLOCK_TRACECONFIG_TRACEMUX_Pos)
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
NRF_CLOCK->TRACECONFIG |= CLOCK_TRACECONFIG_TRACEMUX_Parallel << CLOCK_TRACECONFIG_TRACEMUX_Pos;
NRF_P0->PIN_CNF[14] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_P0->PIN_CNF[15] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_P0->PIN_CNF[16] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_P0->PIN_CNF[18] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
NRF_P0->PIN_CNF[20] = (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos) | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
#endif
#if NRF52_ERRATA_12_ENABLE_WORKAROUND
/* Workaround for Errata 12 "COMP: Reference ladder not correctly calibrated" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_12()){
*(volatile uint32_t *)0x40013540 = (*(uint32_t *)0x10000324 & 0x00001F00) >> 8;
}
#endif
#if NRF52_ERRATA_16_ENABLE_WORKAROUND
/* Workaround for Errata 16 "System: RAM may be corrupt on wakeup from CPU IDLE" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_16()){
*(volatile uint32_t *)0x4007C074 = 3131961357ul;
}
#endif
#if NRF52_ERRATA_31_ENABLE_WORKAROUND
/* Workaround for Errata 31 "CLOCK: Calibration values are not correctly loaded from FICR at reset" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_31()){
*(volatile uint32_t *)0x4000053C = ((*(volatile uint32_t *)0x10000244) & 0x0000E000) >> 13;
}
#endif
#if NRF52_ERRATA_32_ENABLE_WORKAROUND
/* Workaround for Errata 32 "DIF: Debug session automatically enables TracePort pins" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_32()){
CoreDebug->DEMCR &= ~CoreDebug_DEMCR_TRCENA_Msk;
}
#endif
#if NRF52_ERRATA_36_ENABLE_WORKAROUND
/* Workaround for Errata 36 "CLOCK: Some registers are not reset when expected" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_36()){
NRF_CLOCK->EVENTS_DONE = 0;
NRF_CLOCK->EVENTS_CTTO = 0;
NRF_CLOCK->CTIV = 0;
}
#endif
#if NRF52_ERRATA_37_ENABLE_WORKAROUND
/* Workaround for Errata 37 "RADIO: Encryption engine is slow by default" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_37()){
*(volatile uint32_t *)0x400005A0 = 0x3;
}
#endif
#if NRF52_ERRATA_57_ENABLE_WORKAROUND
/* Workaround for Errata 57 "NFCT: NFC Modulation amplitude" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_57()){
*(volatile uint32_t *)0x40005610 = 0x00000005;
*(volatile uint32_t *)0x40005688 = 0x00000001;
*(volatile uint32_t *)0x40005618 = 0x00000000;
*(volatile uint32_t *)0x40005614 = 0x0000003F;
}
#endif
#if NRF52_ERRATA_66_ENABLE_WORKAROUND
/* Workaround for Errata 66 "TEMP: Linearity specification not met with default settings" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_66()){
NRF_TEMP->A0 = NRF_FICR->TEMP.A0;
NRF_TEMP->A1 = NRF_FICR->TEMP.A1;
NRF_TEMP->A2 = NRF_FICR->TEMP.A2;
NRF_TEMP->A3 = NRF_FICR->TEMP.A3;
NRF_TEMP->A4 = NRF_FICR->TEMP.A4;
NRF_TEMP->A5 = NRF_FICR->TEMP.A5;
NRF_TEMP->B0 = NRF_FICR->TEMP.B0;
NRF_TEMP->B1 = NRF_FICR->TEMP.B1;
NRF_TEMP->B2 = NRF_FICR->TEMP.B2;
NRF_TEMP->B3 = NRF_FICR->TEMP.B3;
NRF_TEMP->B4 = NRF_FICR->TEMP.B4;
NRF_TEMP->B5 = NRF_FICR->TEMP.B5;
NRF_TEMP->T0 = NRF_FICR->TEMP.T0;
NRF_TEMP->T1 = NRF_FICR->TEMP.T1;
NRF_TEMP->T2 = NRF_FICR->TEMP.T2;
NRF_TEMP->T3 = NRF_FICR->TEMP.T3;
NRF_TEMP->T4 = NRF_FICR->TEMP.T4;
}
#endif
#if NRF52_ERRATA_98_ENABLE_WORKAROUND
/* Workaround for Errata 98 "NFCT: Not able to communicate with the peer" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_98()){
*(volatile uint32_t *)0x4000568Cul = 0x00038148ul;
}
#endif
#if NRF52_ERRATA_103_ENABLE_WORKAROUND && defined(CCM_MAXPACKETSIZE_MAXPACKETSIZE_Pos)
/* Workaround for Errata 103 "CCM: Wrong reset value of CCM MAXPACKETSIZE" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_103()){
NRF_CCM->MAXPACKETSIZE = 0xFBul;
}
#endif
#if NRF52_ERRATA_108_ENABLE_WORKAROUND
/* Workaround for Errata 108 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_108()){
*(volatile uint32_t *)0x40000EE4ul = *(volatile uint32_t *)0x10000258ul & 0x0000004Ful;
}
#endif
#if NRF52_ERRATA_115_ENABLE_WORKAROUND
/* Workaround for Errata 115 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_115()){
*(volatile uint32_t *)0x40000EE4 = (*(volatile uint32_t *)0x40000EE4 & 0xFFFFFFF0) | (*(uint32_t *)0x10000258 & 0x0000000F);
}
#endif
#if NRF52_ERRATA_120_ENABLE_WORKAROUND
/* Workaround for Errata 120 "QSPI: Data read or written is corrupted" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_120()){
*(volatile uint32_t *)0x40029640ul = 0x200ul;
}
#endif
#if NRF52_ERRATA_136_ENABLE_WORKAROUND
/* Workaround for Errata 136 "System: Bits in RESETREAS are set when they should not be" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_136()){
if (NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk){
NRF_POWER->RESETREAS = ~POWER_RESETREAS_RESETPIN_Msk;
}
}
#endif
#if NRF52_ERRATA_182_ENABLE_WORKAROUND
/* Workaround for Errata 182 "RADIO: Fixes for anomalies #102, #106, and #107 do not take effect" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_182()){
*(volatile uint32_t *) 0x4000173C |= (0x1 << 10);
}
#endif
#if NRF52_ERRATA_217_ENABLE_WORKAROUND
/* Workaround for Errata 217 "RAM: RAM content cannot be trusted upon waking up from System ON Idle or System OFF mode" found at the Errata document
for your device located at https://infocenter.nordicsemi.com/index.jsp */
if (nrf52_errata_217()){
*(volatile uint32_t *)0x40000EE4ul |= 0x0000000Ful;
}
#endif
/* Enable the FPU if the compiler used floating point unit instructions. __FPU_USED is a MACRO defined by the
* compiler. Since the FPU consumes energy, remember to disable FPU use in the compiler if floating point unit
* operations are not used in your code. */
#if (__FPU_USED == 1)
SCB->CPACR |= (3UL << 20) | (3UL << 22);
__DSB();
__ISB();
#endif
nrf52_handle_approtect();
#if NRF52_CONFIGURATION_249_ENABLE && (defined(NRF52805_XXAA) || defined(NRF52810_XXAA) || defined(NRF52811_XXAA))
if (nrf52_configuration_249() && (NRF_UICR->NRFMDK[0] == 0xFFFFFFFF || NRF_UICR->NRFMDK[1] == 0xFFFFFFFF))
{
nvmc_config(NVMC_CONFIG_WEN_Wen);
NRF_UICR->NRFMDK[0] = 0;
nvmc_wait();
NRF_UICR->NRFMDK[1] = 0;
nvmc_wait();
nvmc_config(NVMC_CONFIG_WEN_Ren);
}
#endif
/* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
normal GPIOs. */
#if defined (CONFIG_NFCT_PINS_AS_GPIOS) && defined(NFCT_PRESENT)
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
nvmc_config(NVMC_CONFIG_WEN_Wen);
NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
nvmc_wait();
nvmc_config(NVMC_CONFIG_WEN_Ren);
NVIC_SystemReset();
}
#endif
/* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
reserved for PinReset and not available as normal GPIO. */
#if defined (CONFIG_GPIO_AS_PINRESET)
if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
nvmc_config(NVMC_CONFIG_WEN_Wen);
NRF_UICR->PSELRESET[0] = RESET_PIN;
nvmc_wait();
NRF_UICR->PSELRESET[1] = RESET_PIN;
nvmc_wait();
nvmc_config(NVMC_CONFIG_WEN_Ren);
NVIC_SystemReset();
}
#endif
/* When developing for nRF52810 on an nRF52832, or nRF52811 on an nRF52840,
make sure NFC pins are mapped as GPIO. */
#if defined (DEVELOP_IN_NRF52832) && defined(NRF52810_XXAA) \
|| defined (DEVELOP_IN_NRF52840) && defined(NRF52811_XXAA)
if ((*((uint32_t *)0x1000120C) & (1 << 0)) != 0){
nvmc_config(NVMC_CONFIG_WEN_Wen);
*((uint32_t *)0x1000120C) = 0;
nvmc_wait();
nvmc_config(NVMC_CONFIG_WEN_Ren);
NVIC_SystemReset();
}
#endif
SystemCoreClockUpdate();
}

1860
bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvguix.h_zha
File diff suppressed because it is too large
View File

1321
bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvoptx
File diff suppressed because it is too large
View File

8533
bootloader/pca10100_s140_ble/arm5_no_packs/secure_bootloader_ble_s140_pca10100.uvprojx
File diff suppressed because it is too large
View File

5360
bootloader/pca10100_s140_ble/config/sdk_config.h
File diff suppressed because it is too large
View File

58
bootloader/pca10100_s140_ble/ses/flash_placement.xml

@ -0,0 +1,58 @@
<!DOCTYPE Linker_Placement_File>
<Root name="Flash Section Placement">
<MemorySegment name="FLASH1" start="$(FLASH_PH_START)" size="$(FLASH_PH_SIZE)">
<ProgramSection load="no" name=".reserved_flash" start="$(FLASH_PH_START)" size="$(FLASH_START)-$(FLASH_PH_START)" />
<ProgramSection alignment="0x100" load="Yes" name=".vectors" start="$(FLASH_START)" />
<ProgramSection alignment="4" load="Yes" name=".init" />
<ProgramSection alignment="4" load="Yes" name=".init_rodata" />
<ProgramSection alignment="4" load="Yes" name=".text" size="0x4" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".crypto_data" inputsections="*(SORT(.crypto_data*))" address_symbol="__start_crypto_data" end_symbol="__stop_crypto_data" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_const_data" inputsections="*(SORT(.log_const_data*))" address_symbol="__start_log_const_data" end_symbol="__stop_log_const_data" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_queue" inputsections="*(.nrf_queue*)" address_symbol="__start_nrf_queue" end_symbol="__stop_nrf_queue" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".dfu_trans" inputsections="*(SORT(.dfu_trans*))" address_symbol="__start_dfu_trans" end_symbol="__stop_dfu_trans" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".nrf_balloc" inputsections="*(.nrf_balloc*)" address_symbol="__start_nrf_balloc" end_symbol="__stop_nrf_balloc" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".svc_data" inputsections="*(.svc_data*)" address_symbol="__start_svc_data" end_symbol="__stop_svc_data" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_ble_observers" inputsections="*(SORT(.sdh_ble_observers*))" address_symbol="__start_sdh_ble_observers" end_symbol="__stop_sdh_ble_observers" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_req_observers" inputsections="*(SORT(.sdh_req_observers*))" address_symbol="__start_sdh_req_observers" end_symbol="__stop_sdh_req_observers" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_state_observers" inputsections="*(SORT(.sdh_state_observers*))" address_symbol="__start_sdh_state_observers" end_symbol="__stop_sdh_state_observers" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_stack_observers" inputsections="*(SORT(.sdh_stack_observers*))" address_symbol="__start_sdh_stack_observers" end_symbol="__stop_sdh_stack_observers" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".sdh_soc_observers" inputsections="*(SORT(.sdh_soc_observers*))" address_symbol="__start_sdh_soc_observers" end_symbol="__stop_sdh_soc_observers" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections" address_symbol="__start_nrf_sections" />
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_dynamic_data" inputsections="*(SORT(.log_dynamic_data*))" runin=".log_dynamic_data_run"/>
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".log_filter_data" inputsections="*(SORT(.log_filter_data*))" runin=".log_filter_data_run"/>
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".fs_data" inputsections="*(.fs_data*)" runin=".fs_data_run"/>
<ProgramSection alignment="4" load="Yes" name=".dtors" />
<ProgramSection alignment="4" load="Yes" name=".ctors" />
<ProgramSection alignment="4" load="Yes" name=".rodata" size="0x4" />
<ProgramSection alignment="4" load="Yes" name=".ARM.exidx" address_symbol="__exidx_start" end_symbol="__exidx_end" />
<ProgramSection alignment="4" load="Yes" runin=".fast_run" name=".fast" />
<ProgramSection alignment="4" load="Yes" runin=".data_run" name=".data" />
<ProgramSection alignment="4" load="Yes" runin=".tdata_run" name=".tdata" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".mbr_params_page" address_symbol="__start_mbr_params_page" end_symbol="__stop_mbr_params_page" start = "0x0007E000" size="0x1000" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".bootloader_settings_page" address_symbol="__start_bootloader_settings_page" end_symbol="__stop_bootloader_settings_page" start = "0x0007F000" size="0x1000" />
</MemorySegment>
<MemorySegment name="RAM1" start="$(RAM_PH_START)" size="$(RAM_PH_SIZE)">
<ProgramSection load="no" name=".reserved_ram" start="$(RAM_PH_START)" size="$(RAM_START)-$(RAM_PH_START)" />
<ProgramSection alignment="0x100" load="No" name=".vectors_ram" start="$(RAM_START)" address_symbol="__app_ram_start__"/>
<ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run" address_symbol="__start_nrf_sections_run" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".log_dynamic_data_run" address_symbol="__start_log_dynamic_data" end_symbol="__stop_log_dynamic_data" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".log_filter_data_run" address_symbol="__start_log_filter_data" end_symbol="__stop_log_filter_data" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".fs_data_run" address_symbol="__start_fs_data" end_symbol="__stop_fs_data" />
<ProgramSection alignment="4" keep="Yes" load="No" name=".nrf_sections_run_end" address_symbol="__end_nrf_sections_run" />
<ProgramSection alignment="4" load="No" name=".fast_run" />
<ProgramSection alignment="4" load="No" name=".data_run" />
<ProgramSection alignment="4" load="No" name=".tdata_run" />
<ProgramSection alignment="4" load="No" name=".bss" />
<ProgramSection alignment="4" load="No" name=".tbss" />
<ProgramSection alignment="4" load="No" name=".non_init" />
<ProgramSection alignment="4" size="__HEAPSIZE__" load="No" name=".heap" />
<ProgramSection alignment="8" size="__STACKSIZE__" load="No" place_from_segment_end="Yes" name=".stack" address_symbol="__StackLimit" end_symbol="__StackTop"/>
<ProgramSection alignment="8" size="__STACKSIZE_PROCESS__" load="No" name=".stack_process" />
</MemorySegment>
<MemorySegment name="uicr_bootloader_start_address" start="0x10001014" size="0x4">
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_bootloader_start_address" address_symbol="__start_uicr_bootloader_start_address" end_symbol="__stop_uicr_bootloader_start_address" start = "0x10001014" size="0x4" />
</MemorySegment>
<MemorySegment name="uicr_mbr_params_page" start="0x10001018" size="0x4">
<ProgramSection alignment="4" keep="Yes" load="Yes" name=".uicr_mbr_params_page" address_symbol="__start_uicr_mbr_params_page" end_symbol="__stop_uicr_mbr_params_page" start = "0x10001018" size="0x4" />
</MemorySegment>
</Root>

151
bootloader/pca10100_s140_ble/ses/secure_bootloader_ble_s140_pca10100.emProject

@ -0,0 +1,151 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="secure_bootloader_ble_s140_pca10100" target="8" version="2">
<project Name="secure_bootloader_ble_s140_pca10100">
<configuration
Name="Common"
arm_architecture="v7EM"
arm_core_type="Cortex-M4"
arm_endian="Little"
arm_fp_abi="Hard"
arm_fpu_type="FPv4-SP-D16"
arm_linker_heap_size="0"
arm_linker_process_stack_size="0"
arm_linker_stack_size="2048"
arm_linker_treat_warnings_as_errors="No"
arm_simulator_memory_simulation_parameter="RWX 00000000,00100000,FFFFFFFF;RWX 20000000,00010000,CDCDCDCD"
arm_target_device_name="nRF52833_xxAA"
arm_target_interface_type="SWD"
c_user_include_directories="../../config;../../../../../components/ble/common;../../../../../components/boards;../../../../../components/libraries/atomic;../../../../../components/libraries/atomic_fifo;../../../../../components/libraries/balloc;../../../../../components/libraries/bootloader;../../../../../components/libraries/bootloader/ble_dfu;../../../../../components/libraries/bootloader/dfu;../../../../../components/libraries/crc32;../../../../../components/libraries/crypto;../../../../../components/libraries/crypto/backend/cc310;../../../../../components/libraries/crypto/backend/cc310_bl;../../../../../components/libraries/crypto/backend/cifra;../../../../../components/libraries/crypto/backend/mbedtls;../../../../../components/libraries/crypto/backend/micro_ecc;../../../../../components/libraries/crypto/backend/nrf_hw;../../../../../components/libraries/crypto/backend/nrf_sw;../../../../../components/libraries/crypto/backend/oberon;../../../../../components/libraries/crypto/backend/optiga;../../../../../components/libraries/delay;../../../../../components/libraries/experimental_section_vars;../../../../../components/libraries/fstorage;../../../../../components/libraries/log;../../../../../components/libraries/log/src;../../../../../components/libraries/mem_manager;../../../../../components/libraries/memobj;../../../../../components/libraries/queue;../../../../../components/libraries/ringbuf;../../../../../components/libraries/scheduler;../../../../../components/libraries/sha256;../../../../../components/libraries/stack_info;../../../../../components/libraries/strerror;../../../../../components/libraries/svc;../../../../../components/libraries/util;../../../../../components/softdevice/common;../../../../../components/softdevice/s140/headers;../../../../../components/softdevice/s140/headers/nrf52;../../../../../components/toolchain/cmsis/include;../..;../../../../../external/micro-ecc/micro-ecc;../../../../../external/nano-pb;../../../../../external/nrf_oberon;../../../../../external/nrf_oberon/include;../../../../../integration/nrfx;../../../../../modules/nrfx;../../../../../modules/nrfx/hal;../../../../../modules/nrfx/mdk;../config;"
c_preprocessor_definitions="BLE_STACK_SUPPORT_REQD;BOARD_PCA10100;CONFIG_GPIO_AS_PINRESET;FLOAT_ABI_HARD;INITIALIZE_USER_SECTIONS;NO_VTOR_CONFIG;NRF52833_XXAA;NRF_DFU_SETTINGS_VERSION=2;NRF_DFU_SVCI_ENABLED;NRF_SD_BLE_API_VERSION=7;S140;SOFTDEVICE_PRESENT;SVC_INTERFACE_CALL_AS_NORMAL_FUNCTION;uECC_ENABLE_VLI_API=0;uECC_OPTIMIZATION_LEVEL=3;uECC_SQUARE_FUNC=0;uECC_SUPPORT_COMPRESSED_POINT=0;uECC_VLI_NATIVE_LITTLE_ENDIAN=1;"
debug_target_connection="J-Link"
gcc_entry_point="Reset_Handler"
macros="CMSIS_CONFIG_TOOL=../../../../../external_tools/cmsisconfig/CMSIS_Configuration_Wizard.jar"
debug_register_definition_file="../../../../../modules/nrfx/mdk/nrf52833.svd"
debug_additional_load_file="../../../../../components/softdevice/s140/hex/s140_nrf52_7.2.0_softdevice.hex"
debug_start_from_entry_point_symbol="No"
gcc_debugging_level="Level 3" linker_output_format="hex"
linker_printf_width_precision_supported="Yes"
linker_printf_fmt_level="long"
linker_scanf_fmt_level="long"
linker_section_placement_file="flash_placement.xml"
linker_section_placement_macros="FLASH_PH_START=0x0;FLASH_PH_SIZE=0x80000;RAM_PH_START=0x20000000;RAM_PH_SIZE=0x20000;FLASH_START=0x78000;FLASH_SIZE=0x6000;RAM_START=0x20002ae8;RAM_SIZE=0x1d518"
linker_section_placements_segments="FLASH1 RX 0x0 0x80000;RAM1 RWX 0x20000000 0x20000;mbr_params_page RX 0x0007E000 0x1000;bootloader_settings_page RX 0x0007F000 0x1000;uicr_bootloader_start_address RX 0x10001014 0x4;uicr_mbr_params_page RX 0x10001018 0x4"
project_directory=""
project_type="Executable" />
<folder Name="Segger Startup Files">
<file file_name="$(StudioDir)/source/thumb_crt0.s" />
</folder>
<folder Name="nRF_Libraries">
<file file_name="../../../../../components/libraries/util/app_error_weak.c" />
<file file_name="../../../../../components/libraries/scheduler/app_scheduler.c" />
<file file_name="../../../../../components/libraries/util/app_util_platform.c" />
<file file_name="../../../../../components/libraries/crc32/crc32.c" />
<file file_name="../../../../../components/libraries/mem_manager/mem_manager.c" />
<file file_name="../../../../../components/libraries/util/nrf_assert.c" />
<file file_name="../../../../../components/libraries/atomic_fifo/nrf_atfifo.c" />
<file file_name="../../../../../components/libraries/atomic/nrf_atomic.c" />
<file file_name="../../../../../components/libraries/balloc/nrf_balloc.c" />
<file file_name="../../../../../components/libraries/fstorage/nrf_fstorage.c" />
<file file_name="../../../../../components/libraries/fstorage/nrf_fstorage_nvmc.c" />
<file file_name="../../../../../components/libraries/fstorage/nrf_fstorage_sd.c" />
<file file_name="../../../../../components/libraries/queue/nrf_queue.c" />
<file file_name="../../../../../components/libraries/ringbuf/nrf_ringbuf.c" />
<file file_name="../../../../../components/libraries/experimental_section_vars/nrf_section_iter.c" />
<file file_name="../../../../../components/libraries/strerror/nrf_strerror.c" />
<file file_name="../../../../../components/libraries/sha256/sha256.c" />
</folder>
<folder Name="nRF_Crypto backend uECC">
<file file_name="../../../../../components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecc.c" />
<file file_name="../../../../../components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdh.c" />
<file file_name="../../../../../components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdsa.c" />
</folder>
<folder Name="nano-pb">
<file file_name="../../../../../external/nano-pb/pb_common.c" />
<file file_name="../../../../../external/nano-pb/pb_decode.c" />
</folder>
<folder Name="Board Definition">
<file file_name="../../../../../components/boards/boards.c" />
</folder>
<folder Name="nRF_Drivers">
<file file_name="../../../../../modules/nrfx/hal/nrf_nvmc.c" />
<file file_name="../../../../../modules/nrfx/soc/nrfx_atomic.c" />
</folder>
<folder Name="nRF_Oberon_Crypto">
<file file_name="../../../../../external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.8.a" />
</folder>
<folder Name="nRF_Crypto">
<file file_name="../../../../../components/libraries/crypto/nrf_crypto_ecc.c" />
<file file_name="../../../../../components/libraries/crypto/nrf_crypto_ecdsa.c" />
<file file_name="../../../../../components/libraries/crypto/nrf_crypto_hash.c" />
<file file_name="../../../../../components/libraries/crypto/nrf_crypto_init.c" />
<file file_name="../../../../../components/libraries/crypto/nrf_crypto_shared.c" />
</folder>
<folder Name="Application">
<file file_name="../../../dfu_public_key.c" />
<file file_name="../../main.c" />
<file file_name="../config/sdk_config.h" />
</folder>
<folder Name="nRF_micro-ecc">
<file file_name="../../../../../external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a" />
</folder>
<folder Name="nRF_BLE">
<file file_name="../../../../../components/ble/common/ble_srv_common.c" />
</folder>
<folder Name="nRF_Bootloader">
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_app_start.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_app_start_final.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_dfu_timers.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_fw_activation.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_info.c" />
<file file_name="../../../../../components/libraries/bootloader/nrf_bootloader_wdt.c" />
</folder>
<folder Name="None">
<file file_name="../../../../../modules/nrfx/mdk/ses_startup_nrf52833.s" />
<file file_name="../../../../../modules/nrfx/mdk/ses_startup_nrf_common.s" />
<file file_name="../../../../../modules/nrfx/mdk/system_nrf52833.c" />
</folder>
<folder Name="nRF_Crypto backend nRF sw">
<file file_name="../../../../../components/libraries/crypto/backend/nrf_sw/nrf_sw_backend_hash.c" />
</folder>
<folder Name="nRF_DFU">
<file file_name="../../../../../components/libraries/bootloader/dfu/dfu-cc.pb.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu.c" />
<file file_name="../../../../../components/libraries/bootloader/ble_dfu/nrf_dfu_ble.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_flash.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_handling_error.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_mbr.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_req_handler.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_settings.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_settings_svci.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_transport.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_utils.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_validation.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_ver_validation.c" />
</folder>
<folder Name="nRF_SVC">
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_svci.c" />
<file file_name="../../../../../components/libraries/bootloader/dfu/nrf_dfu_svci_handler.c" />
<file file_name="../../../../../components/libraries/svc/nrf_svc_handler.c" />
</folder>
<folder Name="nRF_SoftDevice">
<file file_name="../../../../../components/softdevice/common/nrf_sdh.c" />
<file file_name="../../../../../components/softdevice/common/nrf_sdh_ble.c" />
<file file_name="../../../../../components/softdevice/common/nrf_sdh_soc.c" />
</folder>
<folder Name="nRF_Crypto backend Oberon">
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_chacha_poly_aead.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_ecc.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_ecdh.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_ecdsa.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_eddsa.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_hash.c" />
<file file_name="../../../../../components/libraries/crypto/backend/oberon/oberon_backend_hmac.c" />
</folder>
</project>
<configuration Name="Release"
c_preprocessor_definitions="NDEBUG"
link_time_optimization="No" gcc_optimization_level="Optimize For Size" />
</solution>

7
bootloader/pca10100_s140_ble/ses/secure_bootloader_ble_s140_pca10100.emSession

@ -0,0 +1,7 @@
<!DOCTYPE CrossStudio_Session_File>
<session>
<ARMCrossStudioWindow activeProject="secure_bootloader_ble_s140_pca10100" buildConfiguration="Release"/>
<Files>
<SessionOpenFile codecName="Default" debugPath="../../main.c" left="0" name="unnamed" path="../../main.c" selected="1" top="0" useBinaryEdit="0" useTextEdit="1" x="0" y="0"/>
</Files>
</session>

12
bootloader_security/dfu_public_key.c

@ -0,0 +1,12 @@
/* This file was automatically generated by nrfutil on 2024-02-02 (YY-MM-DD) at 17:15:45 */
#include "stdint.h"
#include "compiler_abstraction.h"
/** @brief Public key used to verify DFU images */
__ALIGN(4) const uint8_t pk[64] =
{
0xfb, 0x37, 0x98, 0x4b, 0x72, 0xc1, 0x53, 0x7b, 0x86, 0xfb, 0xa6, 0x69, 0x8c, 0x90, 0xbc, 0x63, 0xe6, 0x1c, 0xbc, 0x46, 0x94, 0x1e, 0x3c, 0x01, 0x9c, 0x20, 0xb0, 0x13, 0x01, 0x12, 0xee, 0x2c,
0x42, 0x6f, 0x19, 0xbd, 0xbb, 0xdc, 0x97, 0x35, 0xc5, 0xcb, 0x0d, 0xd4, 0x45, 0xd7, 0x21, 0x1c, 0xa3, 0xc5, 0x66, 0xfd, 0x95, 0x52, 0x62, 0x1f, 0xb0, 0xb7, 0x86, 0xb8, 0x3e, 0x09, 0xf2, 0x2b
};

5
bootloader_security/priv.pem

@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIDte4CCgbOzdpfLs0vct4MY64Er/HEeCLRs9gmwh1p28oAoGCCqGSM49
AwEHoUQDQgAELO4SAROwIJwBPB6URrwc5mO8kIxppvuGe1PBckuYN/sr8gk+uIa3
sB9iUpX9ZsWjHCHXRdQNy8U1l9y7vRlvQg==
-----END EC PRIVATE KEY-----

BIN
sample_bin_parser/0.bin

8193
sample_bin_parser/0.csv
File diff suppressed because it is too large
View File

BIN
tools/nrfutil.exe

Loading…
Cancel
Save