Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf draft] twister: prototyping support for CMakePresets.json files. #469

Draft
wants to merge 76 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
654ac08
[nrf noup] ci: Add Jenkins-based CI for zephyr
thst-nordic Nov 30, 2018
59a3564
[nrf noup] bluetooth: controller: default to SPLIT architecture
ioannisg Nov 19, 2019
38a90a7
[nrf noup] include: net: add NCS extensions
Rallare Oct 1, 2018
23d4adb
[nrf noup] net: lib: mqtt: Provide option to enable TLS session caching
jtguggedal May 18, 2020
3ebae53
[nrf noup] net: l2: Kconfig: Add option for Zigbee L2 layer
maciekfabia Sep 18, 2020
6f5b6f4
[nrf noup] dts: add compatibles for CC310 NS access
mbolivar-nordic Apr 24, 2020
a8e3347
[nrf noup] dts: prefer CC310 for zephyr,entropy
mbolivar-nordic May 14, 2020
7bedae6
[nrf noup] doc: Share Kconfig documentation between repos
ulfalizer Oct 8, 2019
399915c
[nrf noup] tree-wide: support NCS Partition Manager (PM) definitions
sigvartmh May 3, 2019
0ab7df7
[nrf noup] drivers: ieee802154: Use nRF Secure Services to read EUI64
czeslawmakarski Nov 30, 2020
2ddfb47
[nrf noup] samples: smp_svr: Increase stack size for overlay-bt.conf
Jan 7, 2021
09b7569
[nrf temphack] runners: nrfjprog: hackaround NCSDK-7327
mbolivar-nordic Dec 3, 2020
10202d4
[nrf temphack] boards: arm: nrf5340: disable TF-M on non-secure builds
de-nordic Jan 5, 2021
0332aac
[nrf temphack] Revert "modules: tfm: cleanup redundant Kconfig...
hakonfam Jan 6, 2021
429476d
[nrf temphack] setting `ZEPHYR_<MODULE_NAME>_KCONFIG` for NCS modules
tejlmand Jan 26, 2021
508e036
[nrf fromtree] sensor: nrf5: temp: Allow alternative temp driver
rugeGerritsen Dec 14, 2020
668a4be
[nrf fromtree] include: power: include missing header for slist
jfischer-no Jan 21, 2021
b1a8a4a
[nrf fromtree] Bluetooth: controller: radio: Fix compilation error
ppryga-nordic Jan 22, 2021
9d38812
[nrf fromtree] west.yml: Update hal_nordic revision
Jan 25, 2021
04dcc88
[nrf fromtree] scripts: compliance.py updated to support KconfigBasic
tejlmand Jan 27, 2021
2a548c8
[nrf fromtree] include: Add missing extern "C" to spinlock.h
MarekPieta Jan 28, 2021
b67f9af
[nrf fromtree] samples/subsys/mcumgr/smp_svr: disable log over shell
nvlsianpu Jan 26, 2021
909219e
[nrf fromtree] doc: supporting module Kconfig code in module ext root
tejlmand Jan 22, 2021
33bcfb3
[nrf fromtree] drivers: clock_control: Clock calibration depends on RC
rugeGerritsen Dec 14, 2020
a542f00
[nrf fromtree] drivers: clock_control: Clock calibtration with alt dr…
mbolivar-nordic Jan 30, 2021
ae0e993
[nrf toup] clock_control: nrf: Change CLOCK_CONTROL_NRF_FORCE_ALT
nordic-krch Jan 30, 2021
a2dfd93
[nrf toup] clock_control: nrf: modify Kconfig accuracy
nordic-krch Jan 30, 2021
7317a1c
[nrf toup] drivers: clock_control: nrf: Add assert on unexpected event
nordic-krch Sep 21, 2020
8d7fe0b
[nrf fromtree]: scripts: modules: support west group feature
tejlmand Jan 7, 2021
a6c6ced
[nrf fromlist] boards: Clean up signing code for nrf53 and nrf91
oyvindronningstad Jan 11, 2021
b94fc2b
[nrf fromtree] boards: Fix usage of srec_cat -> ${SREC_CAT} in nrf
oyvindronningstad Feb 1, 2021
a7ebc9d
[nrf fromtree] Revert "boards: arm: nrf5340: default to build TFM...
oyvindronningstad Jan 29, 2021
a4e4399
[nrf fromtree] manifest: openthread update with latest upmerge
edmont Jan 26, 2021
a7c1078
[nrf fromtree] net: openthread: configure required masterkey
edmont Jan 26, 2021
009b065
[nrf fromtree] net: openthread: add SRP Kconfig options
edmont Jan 26, 2021
cc47c54
[nrf fromtree] ci: compliance: fail on errors
nashif Jan 20, 2021
e18c99d
[nrf noup] ci: Compliance workflow downstream tweaks
carlescufi Feb 1, 2021
21713af
[nrf fromtree] Bluetooth: host: Fail pairing with identical public key
joerchan Jan 25, 2021
a86ac1f
[nrf fromtree] drivers: gpio_nrfx: Allocate GPIOTE channels with nrfx
Jan 25, 2021
1650798
[nrf fromlist] nrfx_glue: Reserve PPI/DPPI used by 802.15.4 driver
AdamZelikNS Jan 18, 2021
85b46fb
[nrf fromlist] west.yml: Update hal_nordic revision
czeslawmakarski Jan 21, 2021
2f5ed5f
[nrf fromlist] modules: Change serialized radio init priority
pkwiek Jan 19, 2021
ef264bd
[nrf fromlist] drivers: ieee802154: Enable CSMA-CA on serialized host
pkwiek Jan 20, 2021
17948b7
[nrf noup] drivers: ieee802154: Fix build error on nRF5340
pkwiek Jan 19, 2021
5627192
[nrf fromtree] api: remove unnecessary parentheses in DEVICE_NAME_GET.
r2r0 Jan 21, 2021
60a9e7c
[nrf fromtree] cmake: modules: remove Zephyr module duplicates from ...
tejlmand Jan 26, 2021
9ae8e24
[nrf fromtree]: settings: Handle unhandled error
lmaciejonczyk Feb 2, 2021
73a419c
[nrf fromtree] drivers: sensor: adxl362: Fix unused variable warnings
jtguggedal Feb 4, 2021
028c223
[nrf fromlist] west.yml: Update hal_nordic revision
Feb 8, 2021
c2feee4
[nrf fromlist] samples: 802154_rpmsg: Remove redundant kconfig
czeslawmakarski Feb 8, 2021
92e598e
[nrf fromlist] samples: 802154_rpmsg: Add SL fault handler
czeslawmakarski Feb 8, 2021
c0dbb81
[nrf fromlist] Kconfig.tfm: Add TFM_MCUBOOT_IMAGE_NUMBER config
oyvindronningstad Jan 29, 2021
3b3f0c5
[nrf fromlist] Kconfig.tfm: Add TFM_CMAKE_BUILD_TYPE config
oyvindronningstad Jan 29, 2021
c916001
[nrf fromlist] drivers/flash/soc_flash_nrf: support in-progress abort
nvlsianpu Jan 19, 2021
861871f
[nrf fromlist] drivers/flash/soc_flash_nrf: suspend POFWARN before en…
nvlsianpu Jan 19, 2021
edeeebc
[nrf fromtree] drivers: serial: nrfx_uarte: Fix power management
nordic-krch Feb 4, 2021
dbdd371
[nrf fromtree] serial: uart_nrfx_uarte: update state when enabled
Feb 4, 2021
a670696
[nrf fromtree] serial: uart_nrfx_uarte: graceful async power down
Feb 4, 2021
1ed8873
[nrf fromlist] drivers: ieee802154: load EUI64 from UICR
edmont Feb 11, 2021
d09f04c
[nrf noup] drivers: ieee802154: SPM load EUI64 from UICR
edmont Feb 10, 2021
6a0acf9
[nrf fromtree] Bluetooth: Mesh: Verify network buffer max len
trond-snekvik Feb 3, 2021
5be3b6a
[nrf fromtree] Bluetooth: Mesh: Store network at the end of provisioning
trond-snekvik Feb 8, 2021
c7cbf18
[nrf fromtree] Bluetooth: controller: Fix missing advertising PDU len…
cvinayak Feb 10, 2021
ece0b04
[nrf fromtree] Bluetooth: Mesh: Initialize msg_ctx when re-encrypting...
trond-snekvik Feb 8, 2021
92f6600
[nrf fromtree] Bluetooth: Mesh: Update seqnum when re-encrypting for ...
trond-snekvik Feb 8, 2021
21587d3
[nrf fromtree] cmake: Look for revision specific overlays also in ...
tejlmand Feb 2, 2021
4b6e779
[nrf fromtree] doc: dts: improve the DTS overlay file description ...
tejlmand Feb 2, 2021
e0fb65b
[nrf fromtree] scripts: kconfig: Fix uses of edt.compat2okay in ...
anangl Feb 3, 2021
284f333
[nrf fromlist] boards: nrf9160dk: Move board control configuration ...
anangl Jan 26, 2021
d5c04f9
[nrf fromlist] boards: nrf9160dk: Add support for newer revisions ...
anangl Jan 26, 2021
a27a09c
[nrf fromlist] drivers: gpio: Add support for PCAL6408A I/O expander
anangl Jan 29, 2021
c90bc89
[nrf fromlist] boards: nrf9160dk: Add DT node for I/O expander ...
anangl Jan 29, 2021
bf19820
[nrf fromtree] drivers: serial: nrfx_uarte: Add missing check
nordic-krch Feb 11, 2021
46e99f3
[nrf temphack] cmake: exclude print-ot-config for target ALL
tejlmand Feb 17, 2021
7598e62
[nrf fromlist] boards: Consolidate all TFM signing code
oyvindronningstad Feb 5, 2021
3237110
[nrf draft] twister: prototyping support for CMakePresets.json files.
tejlmand Feb 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Backport
on:
pull_request_target:
pull_request:
types:
- closed
- labeled
Expand All @@ -10,7 +10,10 @@ jobs:
runs-on: ubuntu-18.04
name: Backport
steps:
- name: Backport
uses: zephyrproject-rtos/action-backport@v1.1.99
- name: Backport Bot
uses: Gaurav0/backport@v1.0.24
with:
bot_username: NordicBuilder
bot_token: 151a9b45052f9ee8be5a59963d31ad7b92c3ecb5
bot_token_key: 67bb1f1f998d546859786a4088917c65415c0ebd
github_token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
west update

- name: Run Compliance Tests
continue-on-error: true
id: compliance
env:
BASE_REF: ${{ github.base_ref }}
Expand All @@ -48,7 +49,7 @@ jobs:
# debug
ls -la
git log --pretty=oneline | head -n 10
./scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m Kconfig -c origin/${BASE_REF}.. || true
./scripts/ci/check_compliance.py -m Codeowners -m Devicetree -m Gitlint -m Identity -m Nits -m pylint -m checkpatch -m KconfigBasic -c origin/${BASE_REF}..

- name: upload-results
uses: actions/upload-artifact@master
Expand All @@ -58,7 +59,14 @@ jobs:
path: compliance.xml

- name: check-warns
env:
BASE_REF: ${{ github.base_ref }}
run: |
git log --oneline --first-parent origin/${BASE_REF}..HEAD | grep -E -v "\[nrf (mergeup|fromlist|toup|noup|temphack|fromtree)\]" && { echo 'Sauce tag missing'; exit 1; }
if [[ ! -s "compliance.xml" ]]; then
exit 1;
fi

for file in Nits.txt checkpatch.txt Identity.txt Gitlint.txt pylint.txt Devicetree.txt Kconfig.txt Codeowners.txt; do
if [[ -s $file ]]; then
errors=$(cat $file)
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,14 @@ endforeach()
set(ZEPHYR_CURRENT_MODULE_DIR)
set(ZEPHYR_CURRENT_CMAKE_DIR)

# The OpenThread module creates a print-ot-config that uses an echo command
# which fails on Windows, see more: https://github.com/openthread/openthread/pull/6175
# This code disable the target from `ALL` but the target can still be manually
# called by the user. All the target does is printing the current OpenThread configuration.
if(TARGET print-ot-config)
set_property(TARGET print-ot-config PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()

set(syscall_list_h ${CMAKE_CURRENT_BINARY_DIR}/include/generated/syscall_list.h)
set(syscalls_json ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/syscalls.json)
set(struct_tags_json ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/struct_tags.json)
Expand Down Expand Up @@ -1071,6 +1079,10 @@ set(logical_target_for_zephyr_elf ${logical_target_for_zephyr_elf} PARENT_SCOPE)
# 2. it can be defined in Kconfig
set_target_properties(${logical_target_for_zephyr_elf} PROPERTIES OUTPUT_NAME ${KERNEL_NAME})

if (ZEPHYR_NRF_MODULE_DIR)
include(${ZEPHYR_NRF_MODULE_DIR}/cmake/s1.cmake)
endif()

set(post_build_commands "")
set(post_build_byproducts "")

Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# * @galak @nashif

/.known-issues/ @nashif
/.github/ @nashif
/.github/workflows/ @galak @nashif
/.github/ @thst-nordic
/.buildkite/ @galak
/MAINTAINERS.yml @ioannisg @MaureenHelm
/arch/arc/ @abrodkin @ruuddw
Expand Down Expand Up @@ -451,6 +450,7 @@
/include/toolchain.h @andrewboie @andyross @nashif
/include/toolchain/ @andrewboie @andyross
/include/zephyr.h @andrewboie @andyross
/Jenkinsfile @thst-nordic
/kernel/ @andrewboie @andyross
/lib/fnmatch/ @carlescufi
/lib/gui/ @vanwinkeljan
Expand Down
5 changes: 5 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@Library("CI_LIB") _

def pipeline = new ncs.sdk_zephyr.Main()

pipeline.run(JOB_NAME)
4 changes: 1 addition & 3 deletions Kconfig.zephyr
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ config FLASH_LOAD_SIZE
endif # HAS_FLASH_LOAD_OFFSET

config ROM_START_OFFSET
hex
prompt "ROM start offset" if !BOOTLOADER_MCUBOOT
default 0x200 if BOOTLOADER_MCUBOOT
hex "ROM start offset"
default 0
help
If the application is built for chain-loading by a bootloader this
Expand Down
87 changes: 0 additions & 87 deletions boards/arm/lpcxpresso55s69/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,93 +11,6 @@ if(CONFIG_PINMUX_MCUX_LPC)
zephyr_library_sources(pinmux.c)
endif()

if (CONFIG_BUILD_WITH_TFM)
# Set default image versions if not defined elsewhere
if (NOT DEFINED TFM_IMAGE_VERSION_S)
set(TFM_IMAGE_VERSION_S 0.0.0+0)
endif()

if (NOT DEFINED TFM_IMAGE_VERSION_NS)
set(TFM_IMAGE_VERSION_NS 0.0.0+0)
endif()

if (NOT CONFIG_TFM_BL2_FALSE)
set(PREPROCESSED_FILE_S "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o")
set(PREPROCESSED_FILE_NS "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o")
set(TFM_MCUBOOT_DIR "${ZEPHYR_TFM_MODULE_DIR}/trusted-firmware-m/bl2/ext/mcuboot")
endif()

# Configure which format (full or hash) to include the public key in
# the image manifest
set(TFM_PUBLIC_KEY_FORMAT "full")

# Set srec_cat binary name
find_program(SREC_CAT srec_cat)
if(${SREC_CAT} STREQUAL SREC_CAT-NOTFOUND)
message(FATAL_ERROR "'srec_cat' not found. Please install it, or add it to $PATH.")
endif()

if (CONFIG_TFM_BL2_FALSE)
#merge tfm_s and zephyr_ns to a single image
#offset needs to be the same value as flash_layout.h in TFM
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${SREC_CAT}
ARGS $<TARGET_PROPERTY:tfm,TFM_S_BIN_FILE> -Binary
${CMAKE_BINARY_DIR}/zephyr/${KERNEL_BIN_NAME} -Binary
-offset ${CONFIG_FLASH_LOAD_OFFSET}
-o ${CMAKE_BINARY_DIR}/tfm_merged.bin -Binary
)
else()
#Create and sign for concatenated binary image, should align with the TF-M BL2
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands

#Sign secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_S}
-k ${CONFIG_TFM_KEY_FILE_S}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_S}
--pad
--pad-header
${ADD_NS_IMAGE_MIN_VER}
-s auto
-H ${CONFIG_ROM_START_OFFSET}
$<TARGET_PROPERTY:tfm,TFM_S_BIN_FILE>
${CMAKE_BINARY_DIR}/tfm_s_signed.bin

#Sign non-secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_NS}
-k ${CONFIG_TFM_KEY_FILE_NS}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_NS}
-s auto
${ADD_S_IMAGE_MIN_VER}
-H ${CONFIG_ROM_START_OFFSET}
${CMAKE_BINARY_DIR}/zephyr/${KERNEL_BIN_NAME}
${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin

#Create concatenated binary image from the two independently signed binary file
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/assemble.py
--layout ${PREPROCESSED_FILE_S}
-s ${CMAKE_BINARY_DIR}/tfm_s_signed.bin
-n ${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin
-o ${CMAKE_BINARY_DIR}/tfm_sign.bin

#Copy mcuboot.bin
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:tfm,BL2_BIN_FILE> ${CMAKE_BINARY_DIR}/mcuboot.bin

#Merge mcuboot.bin and tfm_sign.bin for flashing
COMMAND ${SREC_CAT}
ARGS ${CMAKE_BINARY_DIR}/mcuboot.bin -Binary
${CMAKE_BINARY_DIR}/tfm_sign.bin -Binary
-offset 0x8000 #slot0_partition
-o ${CMAKE_BINARY_DIR}/tfm_merged.bin -Binary
)
endif()
endif()

if (CONFIG_SECOND_CORE_MCUX)
# Set srec_cat binary name
Expand Down
80 changes: 0 additions & 80 deletions boards/arm/mps2_an521/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,3 @@
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

if (CONFIG_BUILD_WITH_TFM)
# Set default image versions if not defined elsewhere
if (NOT DEFINED TFM_IMAGE_VERSION_S)
set(TFM_IMAGE_VERSION_S 0.0.0+0)
endif()

if (NOT DEFINED TFM_IMAGE_VERSION_NS)
set(TFM_IMAGE_VERSION_NS 0.0.0+0)
endif()

set(PREPROCESSED_FILE_S "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o")
set(PREPROCESSED_FILE_NS "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o")
set(TFM_MCUBOOT_DIR "${ZEPHYR_TFM_MODULE_DIR}/trusted-firmware-m/bl2/ext/mcuboot")

# Configure which format (full or hash) to include the public key in
# the image manifest
set(TFM_PUBLIC_KEY_FORMAT "full")

# Set srec_cat binary name
find_program(SREC_CAT srec_cat)
if(${SREC_CAT} STREQUAL SREC_CAT-NOTFOUND)
message(FATAL_ERROR "'srec_cat' not found. Please install it, or add it to $PATH.")
endif()

#Create and sign for concatenated binary image, should align with the TF-M BL2
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands

#Sign secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_S}
-k ${CONFIG_TFM_KEY_FILE_S}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_S}
--pad
--pad-header
${ADD_NS_IMAGE_MIN_VER}
-s auto
-H 0x400
$<TARGET_PROPERTY:tfm,TFM_S_BIN_FILE>
${CMAKE_BINARY_DIR}/tfm_s_signed.bin

#Sign non-secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_NS}
-k ${CONFIG_TFM_KEY_FILE_NS}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_NS}
-s auto
${ADD_S_IMAGE_MIN_VER}
-H 0x400
${CMAKE_BINARY_DIR}/zephyr/${KERNEL_BIN_NAME}
${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin

#Create concatenated binary image from the two independently signed binary file
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/assemble.py
--layout ${PREPROCESSED_FILE_S}
-s ${CMAKE_BINARY_DIR}/tfm_s_signed.bin
-n ${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin
-o ${CMAKE_BINARY_DIR}/tfm_sign.bin

#Copy mcuboot.bin
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:tfm,BL2_BIN_FILE> ${CMAKE_BINARY_DIR}/mcuboot.bin

#Merge mcuboot.bin and tfm_sign.bin for QEMU
COMMAND ${SREC_CAT}
ARGS ${CMAKE_BINARY_DIR}/mcuboot.bin -Binary
${CMAKE_BINARY_DIR}/tfm_sign.bin -Binary
-offset 0x80000
-o ${CMAKE_BINARY_DIR}/tfm_qemu.bin -Binary

#Convert tfm_qemu.bin to .hex with an appropriate offset
COMMAND ${SREC_CAT}
ARGS ${CMAKE_BINARY_DIR}/tfm_qemu.bin -binary
-offset 0x10000000
-o ${CMAKE_BINARY_DIR}/tfm_qemu.hex -intel --line-length=44
)
endif()
101 changes: 0 additions & 101 deletions boards/arm/nrf5340dk_nrf5340/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,104 +7,3 @@ if (((CONFIG_BOARD_NRF5340PDK_NRF5340_CPUAPP OR CONFIG_BOARD_NRF5340PDK_NRF5340_
zephyr_library()
zephyr_library_sources(nrf5340_cpunet_reset.c)
endif()

if (CONFIG_BUILD_WITH_TFM)
# Set default image versions if not defined elsewhere
if (NOT DEFINED TFM_IMAGE_VERSION_S)
set(TFM_IMAGE_VERSION_S 0.0.0+0)
endif()

if (NOT DEFINED TFM_IMAGE_VERSION_NS)
set(TFM_IMAGE_VERSION_NS 0.0.0+0)
endif()

if (NOT CONFIG_TFM_BL2_FALSE)
set(PREPROCESSED_FILE_S "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o")
set(PREPROCESSED_FILE_NS "${CMAKE_BINARY_DIR}/tfm/bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o")
set(TFM_MCUBOOT_DIR "${ZEPHYR_TFM_MODULE_DIR}/trusted-firmware-m/bl2/ext/mcuboot")
endif()

# Configure which format (full or hash) to include the public key in
# the image manifest
if(NOT DEFINED TFM_PUBLIC_KEY_FORMAT)
set(TFM_PUBLIC_KEY_FORMAT "full")
endif()

if(CONFIG_BOARD_NRF5340PDK_NRF5340_CPUAPPNS)
set(TFM_INSTALL_DIR ${CMAKE_BINARY_DIR}/tfm/install/outputs/NORDIC_NRF/NRF5340PDK_NRF5340_CPUAPP)
elseif(CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPPNS)
set(TFM_INSTALL_DIR ${CMAKE_BINARY_DIR}/tfm/install/outputs/NORDIC_NRF/NRF5340DK_NRF5340_CPUAPP)
endif()

# Set srec_cat binary name
find_program(SREC_CAT srec_cat)
if(${SREC_CAT} STREQUAL SREC_CAT-NOTFOUND)
message(FATAL_ERROR "'srec_cat' not found. Please install it, or add it to $PATH.")
endif()

if (CONFIG_TFM_BL2_FALSE)
# Merge tfm_s and zephyr (NS) image to a single binary.
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${SREC_CAT}
ARGS ${CMAKE_BINARY_DIR}/tfm/bin/tfm_s.bin -Binary
${CMAKE_BINARY_DIR}/zephyr/${KERNEL_BIN_NAME} -Binary
-offset ${CONFIG_FLASH_LOAD_OFFSET}
-o ${CMAKE_BINARY_DIR}/tfm_merged.hex -intel

# Copy tfm_sign.hex to zephyr
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tfm_merged.hex ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_HEX_NAME}
)
else()
#Create and sign for concatenated binary image, should align with the TF-M BL2
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands

#Sign secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_S}
-k ${CONFIG_TFM_KEY_FILE_S}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_S}
--pad
--pad-header
${ADD_NS_IMAGE_MIN_VER}
-s auto
-H 0x400
$<TARGET_PROPERTY:tfm,TFM_S_BIN_FILE>
${CMAKE_BINARY_DIR}/tfm_s_signed.bin

#Sign non-secure binary image with public key
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/wrapper/wrapper.py
--layout ${PREPROCESSED_FILE_NS}
-k ${CONFIG_TFM_KEY_FILE_NS}
--public-key-format ${TFM_PUBLIC_KEY_FORMAT}
--align 1
-v ${TFM_IMAGE_VERSION_NS}
-s auto
${ADD_S_IMAGE_MIN_VER}
-H 0x400
${CMAKE_BINARY_DIR}/zephyr/${KERNEL_BIN_NAME}
${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin

#Create concatenated binary image from the two independently signed binary files
COMMAND ${PYTHON_EXECUTABLE} ${TFM_MCUBOOT_DIR}/scripts/assemble.py
--layout ${PREPROCESSED_FILE_S}
-s ${CMAKE_BINARY_DIR}/tfm_s_signed.bin
-n ${CMAKE_BINARY_DIR}/zephyr_ns_signed.bin
-o ${CMAKE_BINARY_DIR}/tfm_sign.bin

#Copy mcuboot.bin
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:tfm,BL2_BIN_FILE> ${CMAKE_BINARY_DIR}/mcuboot.bin

# Generate an intel hex file from the signed output binary
COMMAND srec_cat ${CMAKE_BINARY_DIR}/tfm_sign.bin
-binary
-offset 0x10000
-o ${CMAKE_BINARY_DIR}/tfm_sign.hex
-intel

# Copy tfm_sign.hex to zephyr
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/tfm_sign.hex ${CMAKE_BINARY_DIR}/zephyr/${KERNEL_HEX_NAME}
)
endif()
endif()
Loading