Skip to content

Commit ac07156

Browse files
committed
Cleanups for test app and remove debugging.
1 parent b729229 commit ac07156

11 files changed

Lines changed: 682 additions & 464 deletions

File tree

config/examples/nxp-s32k142.config

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CORTEX_M4?=1
1111
TARGET?=s32k1xx
1212
SIGN?=ECC256
1313
HASH?=SHA256
14-
DEBUG?=1
14+
DEBUG?=0
1515
VTOR?=1
1616
NO_ASM?=0
1717
EXT_FLASH?=0
@@ -28,10 +28,10 @@ DUALBANK_SWAP?=0
2828
WOLFBOOT_NO_MPU?=1
2929

3030
# Enable hardfault debugging
31-
DEBUG_HARDFAULT?=1
31+
DEBUG_HARDFAULT?=0
3232

3333
# Debug UART on LPUART1 (PTC6=RX, PTC7=TX)
34-
DEBUG_UART?=1
34+
DEBUG_UART?=0
3535

3636
# 2KB sectors (S32K142 only - larger variants use 4KB sectors)
3737
WOLFBOOT_SECTOR_SIZE?=0x800
@@ -49,3 +49,6 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x3E000
4949
# Clock mode: Default is RUN mode with FIRC (48 MHz internal RC)
5050
# To enable HSRUN mode (112 MHz), uncomment below (requires SOSC + SPLL, not fully implemented):
5151
#CFLAGS_EXTRA+=-DS32K1XX_CLOCK_HSRUN
52+
53+
# Optionally enable watchdog
54+
#CFLAGS_EXTRA+=-DWATCHDOG

config/examples/nxp-s32k144.config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NVM_FLASH_WRITEONCE?=0
2121
WOLFBOOT_VERSION?=0
2222
V?=0
2323
SPMATH?=1
24-
RAM_CODE?=0
24+
RAM_CODE?=1
2525
DUALBANK_SWAP?=0
2626

2727
# Select S32K144 variant for correct flash size and sector size
@@ -31,10 +31,10 @@ CFLAGS_EXTRA+=-DS32K144
3131
WOLFBOOT_NO_MPU?=1
3232

3333
# Enable hardfault debugging
34-
DEBUG_HARDFAULT?=1
34+
#CFLAGS_EXTRA+=-DDEBUG_HARDFAULT
3535

3636
# Debug UART on LPUART1 (PTC6=RX, PTC7=TX)
37-
DEBUG_UART?=1
37+
DEBUG_UART?=0
3838

3939
# 4KB sectors (S32K144/146/148 with 512KB+ flash)
4040
WOLFBOOT_SECTOR_SIZE?=0x1000
@@ -53,5 +53,5 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x7C000
5353
# To enable HSRUN mode (112 MHz), uncomment below (requires SOSC + SPLL, not fully implemented):
5454
#CFLAGS_EXTRA+=-DS32K1XX_CLOCK_HSRUN
5555

56-
57-
56+
# Optionally enable watchdog
57+
#CFLAGS_EXTRA+=-DWATCHDOG

config/examples/nxp-s32k146.config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NVM_FLASH_WRITEONCE?=0
2121
WOLFBOOT_VERSION?=0
2222
V?=0
2323
SPMATH?=1
24-
RAM_CODE?=0
24+
RAM_CODE?=1
2525
DUALBANK_SWAP?=0
2626

2727
# Select S32K146 variant for correct flash size and sector size
@@ -31,10 +31,10 @@ CFLAGS_EXTRA+=-DS32K146
3131
WOLFBOOT_NO_MPU?=1
3232

3333
# Enable hardfault debugging
34-
DEBUG_HARDFAULT?=1
34+
#CFLAGS_EXTRA+=-DDEBUG_HARDFAULT
3535

3636
# Debug UART on LPUART1 (PTC6=RX, PTC7=TX)
37-
DEBUG_UART?=1
37+
DEBUG_UART?=0
3838

3939
# 4KB sectors (S32K144/146/148 with 512KB+ flash)
4040
WOLFBOOT_SECTOR_SIZE?=0x1000
@@ -53,5 +53,5 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xF4000
5353
# To enable HSRUN mode (112 MHz), uncomment below (requires SOSC + SPLL, not fully implemented):
5454
#CFLAGS_EXTRA+=-DS32K1XX_CLOCK_HSRUN
5555

56-
57-
56+
# Optionally enable watchdog
57+
#CFLAGS_EXTRA+=-DWATCHDOG

config/examples/nxp-s32k148.config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NVM_FLASH_WRITEONCE?=0
2121
WOLFBOOT_VERSION?=0
2222
V?=0
2323
SPMATH?=1
24-
RAM_CODE?=0
24+
RAM_CODE?=1
2525
DUALBANK_SWAP?=0
2626

2727
# Select S32K148 variant for correct flash size and sector size
@@ -31,10 +31,10 @@ CFLAGS_EXTRA+=-DS32K148
3131
WOLFBOOT_NO_MPU?=1
3232

3333
# Enable hardfault debugging
34-
DEBUG_HARDFAULT?=1
34+
#CFLAGS_EXTRA+=-DDEBUG_HARDFAULT
3535

3636
# Debug UART on LPUART1 (PTC6=RX, PTC7=TX)
37-
DEBUG_UART?=1
37+
DEBUG_UART?=0
3838

3939
# 4KB sectors (S32K144/146/148 with 512KB+ flash)
4040
WOLFBOOT_SECTOR_SIZE?=0x1000
@@ -53,5 +53,5 @@ WOLFBOOT_PARTITION_SWAP_ADDRESS?=0x1EC000
5353
# To enable HSRUN mode (112 MHz), uncomment below (requires SOSC + SPLL, not fully implemented):
5454
#CFLAGS_EXTRA+=-DS32K1XX_CLOCK_HSRUN
5555

56-
57-
56+
# Optionally enable watchdog
57+
#CFLAGS_EXTRA+=-DWATCHDOG

docs/Targets.md

Lines changed: 78 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,10 +2856,14 @@ The default memory layout for S32K142 (256KB Flash):
28562856

28572857
### NXP S32K1XX: Configuration
28582858

2859-
Example configuration file: [/config/examples/nxp-s32k142.config](/config/examples/nxp-s32k142.config)
2859+
Example configuration files:
2860+
- [/config/examples/nxp-s32k142.config](/config/examples/nxp-s32k142.config) - S32K142 (256KB Flash, 32KB SRAM)
2861+
- [/config/examples/nxp-s32k144.config](/config/examples/nxp-s32k144.config) - S32K144 (512KB Flash, 64KB SRAM)
2862+
- [/config/examples/nxp-s32k146.config](/config/examples/nxp-s32k146.config) - S32K146 (1MB Flash, 128KB SRAM)
2863+
- [/config/examples/nxp-s32k148.config](/config/examples/nxp-s32k148.config) - S32K148 (2MB Flash, 256KB SRAM)
28602864

28612865
```sh
2862-
# Copy configuration
2866+
# Copy configuration (example for S32K142)
28632867
cp config/examples/nxp-s32k142.config .config
28642868

28652869
# Build wolfBoot
@@ -2870,7 +2874,6 @@ make
28702874
make test-app/image.bin
28712875
```
28722876

2873-
28742877
### NXP S32K1XX: Configuration Options
28752878

28762879
The following build options are available for the S32K1xx HAL:
@@ -2891,6 +2894,8 @@ The following build options are available for the S32K1xx HAL:
28912894

28922895
### NXP S32K1XX: Debug UART
28932896

2897+
For UART debug output, connect a USB-to-serial adapter to LPUART1 pins (PTC6=RX, PTC7=TX) and open a terminal at 115200 baud.
2898+
28942899
Debug output uses LPUART1 on pins:
28952900
- **TX**: PTC7
28962901
- **RX**: PTC6
@@ -2918,26 +2923,83 @@ arm-none-eabi-gdb --nx wolfboot.elf
29182923
target remote :7224
29192924
monitor reset halt
29202925
load
2921-
# Flash the signed application to boot partition
2922-
monitor programbin test-app/image_v1_signed.bin 0xc000
29232926
monitor reset run
29242927
```
29252928

2926-
### NXP S32K1XX: Debugging Tips
2929+
### NXP S32K1XX: USB Mass Storage Programming
2930+
2931+
The S32K EVB boards include an OpenSDA debugger that exposes a USB mass storage interface for easy programming. Simply copy the `.srec` file to the mounted USB drive.
2932+
2933+
**Steps:**
2934+
2935+
1. Connect the S32K EVB board via USB (OpenSDA port)
2936+
2. The board will mount as a USB drive (e.g., `S32K142EVB`)
2937+
3. Build the factory image:
29272938

2928-
When debugging with GDB:
29292939
```sh
2930-
arm-none-eabi-gdb
2931-
target remote :7224
2932-
add-symbol-file wolfboot.elf 0x0
2933-
add-symbol-file test-app/image.elf 0xC100
2934-
set mem inaccessible-by-default off
2935-
monitor reset halt
2936-
b main
2937-
c
2940+
make factory.srec
29382941
```
29392942

2940-
For UART debug output, connect a USB-to-serial adapter to LPUART1 pins (PTC6=RX, PTC7=TX) and open a terminal at 115200 baud.
2943+
4. Copy the `.srec` file to the mounted drive:
2944+
2945+
```sh
2946+
cp factory.srec /media/<user>/S32K142EVB/
2947+
```
2948+
2949+
The board will automatically program the flash and reset.
2950+
2951+
### NXP S32K1XX: Test Application
2952+
2953+
The S32K1xx test application (`test-app/app_s32k1xx.c`) provides a feature-rich demo application for testing wolfBoot functionality.
2954+
2955+
**Features:**
2956+
- **LED Indicators**: Green LED for firmware v1, Blue LED for firmware v2+
2957+
- **Interactive Console**: UART-based command interface
2958+
- **XMODEM Firmware Update**: Upload new firmware images via XMODEM protocol
2959+
- **Partition Information**: Display boot/update partition status and versions
2960+
- **Keystore Display**: Show public key information from the bootloader
2961+
2962+
**Console Commands:**
2963+
2964+
| Command | Description |
2965+
|---------|-------------|
2966+
| `help` or `?` | Show available commands |
2967+
| `info` | Display system and partition information |
2968+
| `success` | Mark current firmware as successful (wolfBoot_success) |
2969+
| `update` | Trigger firmware update (wolfBoot_update_trigger) |
2970+
| `reset` | Perform software reset |
2971+
| `xmodem` | Receive firmware image via XMODEM protocol |
2972+
2973+
**UART Configuration:**
2974+
- LPUART1: PTC7 (TX), PTC6 (RX)
2975+
- Baud rate: 115200, 8N1
2976+
2977+
**Example Output:**
2978+
2979+
```
2980+
========================================
2981+
S32K1xx wolfBoot Test Application
2982+
Copyright 2025 wolfSSL Inc.
2983+
========================================
2984+
Firmware Version: 1
2985+
2986+
=== Partition Information ===
2987+
Boot Partition:
2988+
Address: 0x0000C000
2989+
Version: 1
2990+
State: SUCCESS
2991+
Update Partition:
2992+
Address: 0x00025000
2993+
Version: 0
2994+
State: SUCCESS
2995+
Swap Partition:
2996+
Address: 0x0003E000
2997+
Size: 2048 bytes
2998+
2999+
Type 'help' for available commands.
3000+
3001+
cmd>
3002+
```
29413003

29423004
### NXP S32K1XX: Flash Configuration Field (FCF)
29433005

0 commit comments

Comments
 (0)