Skip to content

Commit

Permalink
nrf52840_hic: Fix MCUBoot configuration for Thingy:91
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
  • Loading branch information
maxd-nordic authored and mbrossard committed Aug 17, 2023
1 parent dd894f4 commit 0d8259c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions records/board/thingy91.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
common:
macros:
- THINGY91
- NRF_SECURE_BOOTLOADER
- NRF_SECURE_BOOTLOADER_OFFSET=0x12200
sources:
board:
- source/board/thingy91.c
2 changes: 2 additions & 0 deletions source/daplink/drag-n-drop/iap_flash_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "crc.h"
#include "info.h"

#if !defined(DISABLE_FLASH_INTF_CHECKS)
// Application start must be aligned to page write
COMPILER_ASSERT(DAPLINK_ROM_APP_START % DAPLINK_MIN_WRITE_SIZE == 0);
// Application size must be a multiple of write size
Expand All @@ -42,6 +43,7 @@ COMPILER_ASSERT(DAPLINK_ROM_APP_START % DAPLINK_SECTOR_SIZE == 0);
COMPILER_ASSERT(DAPLINK_ROM_UPDATE_START % DAPLINK_SECTOR_SIZE == 0);
// Update size must be a multiple of sector size
COMPILER_ASSERT(DAPLINK_ROM_UPDATE_SIZE % DAPLINK_SECTOR_SIZE == 0);
#endif

typedef enum {
STATE_CLOSED,
Expand Down
12 changes: 5 additions & 7 deletions source/hic_hal/nordic/nrf52840/daplink_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
#define DAPLINK_ROM_START 0x00000000
#define DAPLINK_ROM_SIZE 0x00040000 // 256 KiB


#define DAPLINK_RAM_START 0x20000000
#define DAPLINK_RAM_SIZE 0x00010000 // 64 KiB

/* ROM sizes */



#define DAPLINK_ROM_BL_START 0x00000000

#if !defined(NRF_SECURE_BOOTLOADER)
Expand All @@ -51,12 +48,13 @@

#else // NRF_SECURE_BOOTLOADER

#define DAPLINK_ROM_BL_SIZE 0x00013000 // 76 KiB MCUBOOT
#define DAPLINK_ROM_IF_START 0x00013000
#define DAPLINK_ROM_IF_SIZE 0x0002C000
#define DISABLE_FLASH_INTF_CHECKS
#define DAPLINK_ROM_BL_SIZE NRF_SECURE_BOOTLOADER_OFFSET // MCUBOOT
#define DAPLINK_ROM_IF_START NRF_SECURE_BOOTLOADER_OFFSET
#define DAPLINK_ROM_IF_SIZE (0x00040000-NRF_SECURE_BOOTLOADER_OFFSET)

#define NON_CONTIGUOUS_USER_CONFIG
#define DAPLINK_ROM_CONFIG_USER_START 0x000F7000
#define DAPLINK_ROM_CONFIG_USER_START 0x000FE000
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000

#endif
Expand Down
7 changes: 7 additions & 0 deletions source/hic_hal/nordic/nrf52840/gcc/gcc_startup_nrf52840.S
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ Reset_Handler:
.L_loop1_done:
#endif

#ifdef NRF_SECURE_BOOTLOADER
movs r3, #0
msr CONTROL, r3
msr PSP, r3
msr PRIMASK, r3
#endif

/* 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.
Expand Down

0 comments on commit 0d8259c

Please sign in to comment.