Skip to content

Commit f4d1c02

Browse files
committed
Fixed flash driver, added documentation, tested
1 parent 354df34 commit f4d1c02

File tree

5 files changed

+101
-29
lines changed

5 files changed

+101
-29
lines changed

arch.mk

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,13 @@ ifeq ($(TARGET),mcxa)
617617
-I$(MCUXPRESSO)/drivers \
618618
-I$(MCUXPRESSO)/drivers/common \
619619
-I$(MCUXPRESSO_CMSIS)/Include \
620-
-I$(MCUXPRESSO_CMSIS)/Core/Include
620+
-I$(MCUXPRESSO_CMSIS)/Core/Include \
621+
-I$(MCUXPRESSO)/drivers/flash \
622+
-I$(MCUXPRESSO)/drivers/mcx_spc \
623+
-I$(MCUXPRESSO)/drivers/sysmpu \
624+
-I$(MCUXPRESSO)/drivers/ltc \
625+
-I$(MCUXPRESSO)/drivers/port \
626+
-I$(MCUXPRESSO)/drivers/gpio
621627
CFLAGS+=-DCPU_$(MCUXPRESSO_CPU) -DDEBUG_CONSOLE_ASSERT_DISABLE=1
622628
CFLAGS+=-DWOLFSSL_SP_NO_UMAAL
623629
CFLAGS+=-Wno-old-style-declaration
@@ -627,14 +633,6 @@ ifeq ($(TARGET),mcxa)
627633
$(MCUXPRESSO_DRIVERS)/drivers/fsl_clock.o \
628634
$(MCUXPRESSO)/drivers/mcx_spc/fsl_spc.o \
629635
$(MCUXPRESSO_DRIVERS)/project_template/clock_config.o
630-
631-
CFLAGS+=\
632-
-I$(MCUXPRESSO)/drivers/flash \
633-
-I$(MCUXPRESSO)/drivers/mcx_spc \
634-
-I$(MCUXPRESSO)/drivers/sysmpu \
635-
-I$(MCUXPRESSO)/drivers/ltc \
636-
-I$(MCUXPRESSO)/drivers/port \
637-
-I$(MCUXPRESSO)/drivers/gpio
638636
endif
639637

640638
ifeq ($(TARGET),mcxw)
@@ -648,7 +646,13 @@ ifeq ($(TARGET),mcxw)
648646
-I$(MCUXPRESSO)/drivers/ccm32k \
649647
-I$(MCUXPRESSO)/drivers/common \
650648
-I$(MCUXPRESSO_CMSIS)/Include \
651-
-I$(MCUXPRESSO_CMSIS)/Core/Include
649+
-I$(MCUXPRESSO_CMSIS)/Core/Include \
650+
-I$(MCUXPRESSO)/drivers/flash \
651+
-I$(MCUXPRESSO)/drivers/spc \
652+
-I$(MCUXPRESSO)/drivers/sysmpu \
653+
-I$(MCUXPRESSO)/drivers/ltc \
654+
-I$(MCUXPRESSO)/drivers/port \
655+
-I$(MCUXPRESSO)/drivers/gpio
652656
CFLAGS+=-DCPU_$(MCUXPRESSO_CPU) -DDEBUG_CONSOLE_ASSERT_DISABLE=1
653657
CFLAGS+=-DWOLFSSL_SP_NO_UMAAL
654658
CFLAGS+=-Wno-old-style-declaration
@@ -660,15 +664,6 @@ ifeq ($(TARGET),mcxw)
660664
$(MCUXPRESSO_DRIVERS)/project_template/clock_config.o \
661665
$(MCUXPRESSO)/drivers/ccm32k/fsl_ccm32k.o \
662666
$(MCUXPRESSO_DRIVERS)/drivers/fsl_romapi.o
663-
664-
CFLAGS+=\
665-
-I$(MCUXPRESSO)/drivers/flash \
666-
-I$(MCUXPRESSO)/drivers/spc \
667-
-I$(MCUXPRESSO)/drivers/sysmpu \
668-
-I$(MCUXPRESSO)/drivers/ltc \
669-
-I$(MCUXPRESSO)/drivers/port \
670-
-I$(MCUXPRESSO)/drivers/gpio
671-
672667
endif
673668

674669
ifeq ($(TARGET),imx_rt)

config/examples/mcxa.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ ARCH?=ARM
22
TARGET?=mcxa
33
SIGN?=ECC256
44
HASH?=SHA256
5-
MCUXSDK?=0
6-
MCUXPRESSO?=$(PWD)/../NXP/MCXA153
7-
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS
5+
MCUXSDK?=1
6+
MCUXPRESSO?=$(PWD)/../NXP/mcux-sdk
7+
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS
88
MCUXPRESSO_CPU?=MCXA153VLH
99
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MCXA153
1010
DEBUG?=0

config/examples/mcxw.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ ARCH?=ARM
22
TARGET?=mcxw
33
SIGN?=ECC256
44
HASH?=SHA256
5-
MCUXSDK?=0
6-
MCUXPRESSO?=$(PWD)/../NXP/MCXW71
7-
MCUXPRESSO_CMSIS?=$(MCUXPRESSO)/CMSIS
5+
MCUXSDK?=1
6+
MCUXPRESSO?=$(PWD)/../NXP/mcux-sdk
7+
MCUXPRESSO_CMSIS?=$(PWD)/../NXP/CMSIS_5/CMSIS
88
MCUXPRESSO_CPU?=MCXW716CMFTA
99
MCUXPRESSO_DRIVERS?=$(MCUXPRESSO)/devices/MCXW716C
1010
DEBUG?=0
@@ -15,7 +15,7 @@ NO_MPU=1
1515
EXT_FLASH?=0
1616
SPI_FLASH?=0
1717
ALLOW_DOWNGRADE?=0
18-
NVM_FLASH_WRITEONCE?=0
18+
NVM_FLASH_WRITEONCE?=1
1919
NO_ARM_ASM=1
2020
WOLFBOOT_VERSION?=0
2121
V?=0

docs/Targets.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This README describes configuration of supported targets.
1919
* [NXP LPC54xxx](#nxp-lpc54xxx)
2020
* [NXP LS1028A](#nxp-ls1028a)
2121
* [NXP MCXA153](#nxp-mcxa153)
22+
* [NXP MCXW716C](#nxp-mcxw716c)
2223
* [NXP P1021 PPC](#nxp-qoriq-p1021-ppc)
2324
* [NXP T1024 PPC](#nxp-qoriq-t1024-ppc)
2425
* [NXP T2080 PPC](#nxp-qoriq-t2080-ppc)
@@ -2241,6 +2242,85 @@ mon reset
22412242
c
22422243
```
22432244

2245+
## NXP MCXW716
2246+
2247+
NXP MCXW716 is a Cortex-M33 microcontroller running at 96MHz.
2248+
The support has been tested using FRDM-MCXW716 with the onboard MCU-Link configured in JLink mode.
2249+
2250+
This requires the MCXW SDK from the NXP MCUXpresso SDK Builder. We tested using [mcux-sdk](https://github.com/nxp-mcuxpresso/mcux-sdk) and [CMSIS_5](https://github.com/nxp-mcuxpresso/CMSIS_5)`
2251+
placed under "../NXP". Adjust the MCUXPRESSO and MCUXPRESSO_CMSIS variables in your .config file according to your paths.
2252+
2253+
### MCX W: Configuring and compiling
2254+
2255+
Copy the example configuration file and build with make:
2256+
2257+
```sh
2258+
cp config/examples/mcxw.config .config`
2259+
make
2260+
```
2261+
2262+
### MCX W: Loading the firmware
2263+
2264+
The NXP Freedom MCX W board debugger comes loaded with MCU Link, but it can be updated to JLink. See https://docs.nxp.com/bundle/UM12012/page/topics/Updating_MCU_Link_firmware.html
2265+
2266+
Use JLinkExe tool to upload the initial firmware: `JLinkExe -if swd -Device MCXW716`
2267+
2268+
At the Jlink prompt, type:
2269+
2270+
```
2271+
loadbin factory.bin 0
2272+
Downloading file [factory.bin]...
2273+
J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
2274+
O.K.
2275+
```
2276+
2277+
Reset or power cycle board.
2278+
2279+
Once wolfBoot has performed validation of the partition and booted the D15 Green LED on P3_13 will illuminate.
2280+
2281+
### MCX W: Testing firmware update
2282+
2283+
1) Sign the test-app with version 2:
2284+
2285+
```sh
2286+
./tools/keytools/sign --ecc256 test-app/image.bin wolfboot_signing_private_key.der 2
2287+
```
2288+
2289+
2) Create a bin footer with wolfBoot trailer "BOOT" and "p" (ASCII for 0x70 == IMG_STATE_UPDATING):
2290+
2291+
```sh
2292+
echo -n "pBOOT" > trigger_magic.bin
2293+
```
2294+
2295+
3) Assembly new factory update.bin:
2296+
2297+
```sh
2298+
./tools/bin-assemble/bin-assemble \
2299+
update.bin \
2300+
0x0 test-app/image_v2_signed.bin \
2301+
0xAFFB trigger_magic.bin
2302+
```
2303+
2304+
4) Flash update.bin to 0x13000 (`loadbin update.bin 0x13000`). The D15 RGB LED Blue P3_0 will show if version is > 1.
2305+
2306+
Note: For alternate larger scheme flash `update.bin` to `0x14000` and place trigger_magic.bin at `0x9FFB`.
2307+
2308+
### MCX W: Debugging
2309+
2310+
Debugging with JLink:
2311+
2312+
Note: We include a `.gdbinit` in the wolfBoot root that loads the wolfboot and test-app elf files.
2313+
2314+
In one terminal: `JLinkGDBServer -if swd -Device MCXW716 -port 3333`
2315+
2316+
In another terminal use `gdb`:
2317+
2318+
```
2319+
b main
2320+
mon reset
2321+
c
2322+
```
2323+
22442324

22452325
## TI Hercules TMS570LC435
22462326

hal/mcxw.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ void hal_init(void)
7575
/* Clock setting */
7676
BOARD_BootClockRUN();
7777
#endif
78-
79-
/* Flash driver init */
80-
flash_config_t pflash;
8178
/* Clear the FLASH configuration structure */
8279
memset(&pflash, 0, sizeof(pflash));
8380
/* FLASH driver init */

0 commit comments

Comments
 (0)