Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
122 changes: 122 additions & 0 deletions .github/workflows/test-build-mcux-sdk-manifests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Wolfboot Reusable Build Workflow for west-based MCUXpresso SDK

on:

workflow_call:
inputs:
arch:
required: true
type: string
config-file:
required: true
type: string
board-name:
required: true
type: string
make-args:
required: false
type: string

jobs:

build:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/checkout@main
with:
repository: nxp-mcuxpresso/CMSIS_5
path: CMSIS_5

- name: Workaround for sources.list
run: |
# Replace sources

set -euxo pipefail

# Peek (what repos are active now)
apt-cache policy
grep -RInE '^(deb|Types|URIs)' /etc/apt || true

# Enable nullglob so *.list/*.sources that don't exist don't break sed
shopt -s nullglob

echo "Replace sources.list (legacy)"
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
/etc/apt/sources.list || true

echo "Replace sources.list.d/*.list (legacy)"
for f in /etc/apt/sources.list.d/*.list; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
"$f"
done

echo "Replace sources.list.d/*.sources (deb822)"
for f in /etc/apt/sources.list.d/*.sources; do
sudo sed -i \
-e "s|https\?://azure\.archive\.ubuntu\.com/ubuntu/?|http://mirror.arizona.edu/ubuntu/|g" \
-e "s|https\?://azure\.archive\.ubuntu\.com|http://mirror.arizona.edu|g" \
"$f"
done

echo "Fix /etc/apt/apt-mirrors.txt (used by URIs: mirror+file:...)"
if grep -qE '^[[:space:]]*https?://azure\.archive\.ubuntu\.com/ubuntu/?' /etc/apt/apt-mirrors.txt; then
# Replace azure with our mirror (idempotent)
sudo sed -i 's|https\?://azure\.archive\.ubuntu\.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/apt-mirrors.txt
fi

# Peek (verify changes)
grep -RIn "azure.archive.ubuntu.com" /etc/apt || true
grep -RInE '^(deb|Types|URIs)' /etc/apt || true
echo "--- apt-mirrors.txt ---"
cat /etc/apt/apt-mirrors.txt || true

- name: Update repository
run: sudo apt-get update

- name: Install software
run: |
sudo apt-get install -y gcc-arm-none-eabi

- name: Cache MCUXpresso SDK
id: cache-mcuxpresso
uses: actions/cache@v4
with:
path: |
mcuxpresso-sdk
venv
key: mcuxpresso-sdk-${{inputs.board-name}}-${{hashFiles('.github/workflows/test-build-mcux-sdk-manifests.yml')}}

- name: Setup MCUXpresso SDK
if: steps.cache-mcuxpresso.outputs.cache-hit != 'true'
run: |
python -m venv venv
source venv/bin/activate
pip install west
west init -m https://github.com/nxp-mcuxpresso/mcuxsdk-manifests.git mcuxpresso-sdk
cd mcuxpresso-sdk
sed -i '/se_hostlib\|emwin/d' manifests/boards/${{inputs.board-name}}.yml
west update_board --set board ${{inputs.board-name}}

- name: make distclean
run: |
make distclean

- name: Select config
run: |
cp ${{inputs.config-file}} .config && make include/target.h

- name: Build tools
run: |
make -C tools/keytools && make -C tools/bin-assemble

- name: Build wolfboot
run: |
make MCUXSDK=1 MCUXPRESSO="$GITHUB_WORKSPACE/mcuxpresso-sdk/mcuxsdk" MCUXPRESSO_CMSIS="$GITHUB_WORKSPACE/CMSIS_5/CMSIS" ${{inputs.make-args}} V=1
14 changes: 14 additions & 0 deletions .github/workflows/test-configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,20 @@ jobs:
arch: arm
config-file: ./config/examples/mcxw-tz.config

nxp_mcxn_test:
uses: ./.github/workflows/test-build-mcux-sdk-manifests.yml
with:
arch: arm
config-file: ./config/examples/mcxn.config
board-name: frdmmcxn947

nxp_mcxn_tz_test:
uses: ./.github/workflows/test-build-mcux-sdk-manifests.yml
with:
arch: arm
config-file: ./config/examples/mcxn-tz.config
board-name: frdmmcxn947

nxp_s32k142_test:
uses: ./.github/workflows/test-build.yml
with:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ if(NOT DEFINED ARM_TARGETS)
lpc54606j512
mcxa
mcxw
mcxn
nrf52
nrf52840
nrf5340
Expand Down
38 changes: 38 additions & 0 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ else
CORTEXM_ARM_EXTRA_OBJS=
CORTEXM_ARM_EXTRA_CFLAGS=
SECURE_OBJS+=./src/wc_callable.o
WOLFCRYPT_OBJS+=$(WOLFBOOT_LIB_WOLFSSL)/wolfcrypt/src/random.o
CFLAGS+=-DWOLFCRYPT_SECURE_MODE
SECURE_LDFLAGS+=-Wl,--cmse-implib -Wl,--out-implib=./src/wc_secure_calls.o
endif
Expand Down Expand Up @@ -732,6 +733,43 @@ ifeq ($(TARGET),mcxw)
$(MCUXPRESSO_DRIVERS)/drivers/fsl_romapi.o
endif

ifeq ($(TARGET),mcxn)
CORTEX_M33=1
ifneq ($(TZEN),1)
LSCRIPT_IN=hal/$(TARGET)-ns.ld
endif
CFLAGS+=\
-I$(MCUXPRESSO_DRIVERS) \
-I$(MCUXPRESSO_DRIVERS)/drivers \
-I$(MCUXPRESSO_DRIVERS)/drivers/romapi/flash \
-I$(MCUXPRESSO_DRIVERS)/../periph \
-I$(MCUXPRESSO) \
-I$(MCUXPRESSO)/drivers \
-I$(MCUXPRESSO)/drivers/gpio \
-I$(MCUXPRESSO)/drivers/port \
-I$(MCUXPRESSO)/drivers/common \
-I$(MCUXPRESSO)/drivers/lpflexcomm \
-I$(MCUXPRESSO)/drivers/lpuart \
-I$(MCUXPRESSO_PROJECT_TEMPLATE) \
-I$(MCUXPRESSO_CMSIS)/Include \
-I$(MCUXPRESSO_CMSIS)/Core/Include
CFLAGS+=-DCPU_$(MCUXPRESSO_CPU) -DDEBUG_CONSOLE_ASSERT_DISABLE=1
CFLAGS+=-Wno-old-style-declaration
CFLAGS+=-mcpu=cortex-m33 -DCORTEX_M33 -U__ARM_FEATURE_DSP
LDFLAGS+=-mcpu=cortex-m33
OBJS+=\
$(MCUXPRESSO_DRIVERS)/drivers/fsl_clock.o \
$(MCUXPRESSO_PROJECT_TEMPLATE)/clock_config.o \
$(MCUXPRESSO_DRIVERS)/drivers/romapi/flash/src/fsl_flash.o

ifeq ($(DEBUG_UART),1)
OBJS+=\
$(MCUXPRESSO)/drivers/lpflexcomm/fsl_lpflexcomm.o \
$(MCUXPRESSO)/drivers/lpuart/fsl_lpuart.o \
$(MCUXPRESSO_DRIVERS)/drivers/fsl_reset.o
endif
endif

ifeq ($(TARGET),nrf5340)
ifneq ($(TZEN), 1)
LSCRIPT_IN=hal/$(TARGET)-ns.ld
Expand Down
55 changes: 55 additions & 0 deletions config/examples/mcxn-tz.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
ARCH?=ARM
TZEN?=1
TARGET?=mcxn
SIGN?=ECC384
HASH?=SHA384
MCUXSDK?=1
MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS
MCUXPRESSO_CPU?=MCXN947VDF_cm33_core0
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MCX/MCXN/MCXN947
MCUXPRESSO_PROJECT_TEMPLATE?=$(MCUXPRESSO)/examples/_boards/frdmmcxn947/project_template
DEBUG?=0
DEBUG_UART?=1
VTOR?=1
CORTEX_M0?=0
CORTEX_M33?=1
NO_ASM?=0
NO_MPU=1
EXT_FLASH?=0
SPI_FLASH?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=1
NO_ARM_ASM=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=1
WOLFCRYPT_TZ?=1

# 8KB sectors
WOLFBOOT_SECTOR_SIZE?=0x2000

# Default configuration
# 64KB boot, 80KB keyvault, 8KB NSC, 60KB partitions, 8KB swap
WOLFBOOT_KEYVAULT_ADDRESS?=0x10000
WOLFBOOT_KEYVAULT_SIZE?=0x14000
WOLFBOOT_NSC_ADDRESS?=0x24000
WOLFBOOT_NSC_SIZE?=0x2000
WOLFBOOT_PARTITION_SIZE?=0xF000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x26000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x35000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x44000

# Alternate larger configuration for debugging or ARMASM
# 128KB boot, 80KB keyvault, 8KB NSC, 60KB partitions, 8KB swap
#WOLFBOOT_KEYVAULT_ADDRESS?=0x20000
#WOLFBOOT_KEYVAULT_SIZE?=0x14000
#WOLFBOOT_NSC_ADDRESS?=0x34000
#WOLFBOOT_NSC_SIZE?=0x2000
#WOLFBOOT_PARTITION_SIZE?=0xF000
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x36000
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x45000
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x54000
46 changes: 46 additions & 0 deletions config/examples/mcxn.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ARCH?=ARM
TZEN?=0
TARGET?=mcxn
SIGN?=ECC384
HASH?=SHA384
MCUXSDK?=1
MCUXPRESSO?=$(PWD)/../NXP/mcuxpresso-sdk/mcuxsdk
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS
MCUXPRESSO_CPU?=MCXN947VDF_cm33_core0
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MCX/MCXN/MCXN947
MCUXPRESSO_PROJECT_TEMPLATE?=$(MCUXPRESSO)/examples/_boards/frdmmcxn947/project_template
DEBUG?=0
DEBUG_UART?=1
VTOR?=1
CORTEX_M0?=0
CORTEX_M33?=1
NO_ASM?=0
NO_MPU=1
EXT_FLASH?=0
SPI_FLASH?=0
ALLOW_DOWNGRADE?=0
NVM_FLASH_WRITEONCE?=1
NO_ARM_ASM=1
WOLFBOOT_VERSION?=0
V?=0
SPMATH?=1
RAM_CODE?=1
DUALBANK_SWAP?=0
PKA?=1

# 8KB sectors
WOLFBOOT_SECTOR_SIZE?=0x2000

# Default configuration
# 40KB boot, 44KB partitions, 8KB swap
WOLFBOOT_PARTITION_SIZE?=0xB000
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xA000
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x15000
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x20000

# Alternate larger configuration for debugging or ARMASM
# 64KB boot, 64KB partitions, 8KB swap
#WOLFBOOT_PARTITION_SIZE?=0x10000
#WOLFBOOT_PARTITION_BOOT_ADDRESS?=0x12000
#WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0x22000
#WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x32000
Loading