Skip to content

Commit 0d8259c

Browse files
maxd-nordicmbrossard
authored andcommitted
nrf52840_hic: Fix MCUBoot configuration for Thingy:91
Signed-off-by: Maximilian Deubel <[email protected]>
1 parent dd894f4 commit 0d8259c

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

records/board/thingy91.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
common:
22
macros:
3+
- THINGY91
34
- NRF_SECURE_BOOTLOADER
5+
- NRF_SECURE_BOOTLOADER_OFFSET=0x12200
46
sources:
57
board:
68
- source/board/thingy91.c

source/daplink/drag-n-drop/iap_flash_intf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "crc.h"
3131
#include "info.h"
3232

33+
#if !defined(DISABLE_FLASH_INTF_CHECKS)
3334
// Application start must be aligned to page write
3435
COMPILER_ASSERT(DAPLINK_ROM_APP_START % DAPLINK_MIN_WRITE_SIZE == 0);
3536
// Application size must be a multiple of write size
@@ -42,6 +43,7 @@ COMPILER_ASSERT(DAPLINK_ROM_APP_START % DAPLINK_SECTOR_SIZE == 0);
4243
COMPILER_ASSERT(DAPLINK_ROM_UPDATE_START % DAPLINK_SECTOR_SIZE == 0);
4344
// Update size must be a multiple of sector size
4445
COMPILER_ASSERT(DAPLINK_ROM_UPDATE_SIZE % DAPLINK_SECTOR_SIZE == 0);
46+
#endif
4547

4648
typedef enum {
4749
STATE_CLOSED,

source/hic_hal/nordic/nrf52840/daplink_addr.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@
2424
#define DAPLINK_ROM_START 0x00000000
2525
#define DAPLINK_ROM_SIZE 0x00040000 // 256 KiB
2626

27-
2827
#define DAPLINK_RAM_START 0x20000000
2928
#define DAPLINK_RAM_SIZE 0x00010000 // 64 KiB
3029

3130
/* ROM sizes */
3231

33-
34-
3532
#define DAPLINK_ROM_BL_START 0x00000000
3633

3734
#if !defined(NRF_SECURE_BOOTLOADER)
@@ -51,12 +48,13 @@
5148

5249
#else // NRF_SECURE_BOOTLOADER
5350

54-
#define DAPLINK_ROM_BL_SIZE 0x00013000 // 76 KiB MCUBOOT
55-
#define DAPLINK_ROM_IF_START 0x00013000
56-
#define DAPLINK_ROM_IF_SIZE 0x0002C000
51+
#define DISABLE_FLASH_INTF_CHECKS
52+
#define DAPLINK_ROM_BL_SIZE NRF_SECURE_BOOTLOADER_OFFSET // MCUBOOT
53+
#define DAPLINK_ROM_IF_START NRF_SECURE_BOOTLOADER_OFFSET
54+
#define DAPLINK_ROM_IF_SIZE (0x00040000-NRF_SECURE_BOOTLOADER_OFFSET)
5755

5856
#define NON_CONTIGUOUS_USER_CONFIG
59-
#define DAPLINK_ROM_CONFIG_USER_START 0x000F7000
57+
#define DAPLINK_ROM_CONFIG_USER_START 0x000FE000
6058
#define DAPLINK_ROM_CONFIG_USER_SIZE 0x00001000
6159

6260
#endif

source/hic_hal/nordic/nrf52840/gcc/gcc_startup_nrf52840.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ Reset_Handler:
197197
.L_loop1_done:
198198
#endif
199199

200+
#ifdef NRF_SECURE_BOOTLOADER
201+
movs r3, #0
202+
msr CONTROL, r3
203+
msr PSP, r3
204+
msr PRIMASK, r3
205+
#endif
206+
200207
/* This part of work usually is done in C library startup code. Otherwise,
201208
* define __STARTUP_CLEAR_BSS to enable it in this startup. This section
202209
* clears the RAM where BSS data is located.

0 commit comments

Comments
 (0)