Skip to content

Commit

Permalink
ci: build MCUBoot image for Thingy:91
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Deubel <[email protected]>
  • Loading branch information
maxd-nordic committed Apr 13, 2023
1 parent 2d6a3d5 commit 3bc0c4b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt install -y ccache ninja-build
sudo apt install -y ccache ninja-build wget
export PATH=/usr/lib/ccache:${{ runner.temp }}/arm-gcc/bin/:/home/runner/.local/bin:$PATH
for i in ${{ runner.temp }}/arm-gcc/bin/* ; do sudo ln -s /usr/bin/ccache /usr/lib/ccache/$(basename $i); done
ccache --set-config=cache_dir="$GITHUB_WORKSPACE"
Expand All @@ -79,6 +79,12 @@ jobs:
mkdir bootloaders
cp projectfiles/make_gcc_arm/*_bl/build/*_crc.{bin,hex} bootloaders
- name: Create Thingy:91 MCUBoot image
run: |
wget https://raw.githubusercontent.com/mcu-tools/mcuboot/v1.9.0/root-rsa-2048.pem
export VERSION=$(echo firmware_* | sed 's/firmware_//g' -)
imgtool sign --key root-rsa-2048.pem --header-size 0x200 --align 4 --version 0.0.0+0 --pad-header --slot-size 0x76000 projectfiles/make_gcc_arm/nrf52840_thingy91_if/build/nrf52840_thingy91_if.hex firmware_$VERSION/${VERSION}_nrf52840_thingy91_0x12000.hex
- name: Upload test artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
1 change: 1 addition & 0 deletions records/board/thingy91.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
common:
macros:
- NRF_SECURE_BOOTLOADER
- NRF_SECURE_BOOTLOADER_OFFSET=0x12200
sources:
board:
- source/board/thingy91.c
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ pyelftools
fuzzywuzzy
jsonschema
pyyaml>=6.0,<7.0
imgtool==1.9.0
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(NRF_SECURE_BOOTLOADER)
// 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
8 changes: 4 additions & 4 deletions source/hic_hal/nordic/nrf52840/daplink_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@

#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 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 3bc0c4b

Please sign in to comment.