Skip to content

Support for NXP T1040 RDB#714

Draft
dgarske wants to merge 2 commits intowolfSSL:masterfrom
dgarske:nxp_t1040
Draft

Support for NXP T1040 RDB#714
dgarske wants to merge 2 commits intowolfSSL:masterfrom
dgarske:nxp_t1040

Conversation

@dgarske
Copy link
Contributor

@dgarske dgarske commented Mar 5, 2026

No description provided.

@dgarske dgarske self-assigned this Mar 5, 2026
Copilot AI review requested due to automatic review settings March 5, 2026 23:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds build, HAL, linker, documentation, and Lauterbach scripting needed to bring up and program wolfBoot on the NXP QorIQ T1040 RDB.

Changes:

  • Introduces a new nxp_t1040 target (build flags, example config, link scripts, HAL wrapper).
  • Adds T1040-specific test application and updates test-app build logic.
  • Adds Lauterbach .cmm scripts and target documentation for flashing/debugging.

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tools/scripts/nxp_t1040/t1024_flash.cmm Adds a TRACE32 NOR flashing script intended for T1040.
tools/scripts/nxp_t1040/t1024_debug.cmm Adds a TRACE32 debug setup script (CPU/MMU/symbols/breakpoints).
test-app/app_nxp_t1040.c Adds a simple UART “heartbeat” test app for T1040.
test-app/Makefile Enables PPC64 build settings for nxp_t1040.
hal/nxp_t1040_stage1.ld Adds stage1 linker script for T1040 boot-from-NOR layout.
hal/nxp_t1040.ld Adds main linker script for T1040 RAM-loaded image.
hal/nxp_t1040.c Adds T1040 HAL wrapper to shared T10xx implementation.
hal/nxp_t1024.c Replaces large T1024-specific HAL with a shared T10xx wrapper include.
hal/nxp_ppc.h Adds TARGET_nxp_t1040 platform definitions.
docs/Targets.md Documents T1040 target, flash map, and build steps.
config/examples/nxp-t1040.config Adds example configuration for T1040 memory map / partitions.
arch.mk Adds compiler/linker flags and object selection for nxp_t1040.
Makefile Selects factory_wstage1.bin as main target for nxp_t1040.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +124 to +127
/* relocate to 64-bit 0xF_ */
#define CCSRBAR_PHYS_HIGH 0xFULL
#define CCSRBAR_PHYS (CCSRBAR_PHYS_HIGH + CCSRBAR_DEF)
#endif
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CCSRBAR_PHYS is constructed via addition, which does not form the intended 64-bit address (e.g., 0xF + 0xFE000000 -> 0xFE00000F, not 0xF_FE000000). If callers need a 64-bit physical value, build it using a 64-bit shift/or (or remove CCSRBAR_PHYS entirely and consistently pass (high, low) pairs to helpers like set_law).

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +6
; @Title: NXP T2080 wolfBoot Debug Script
; @Description:
; Brings up the T2080, loads wolfBoot ELF symbols, and sets breakpoints
; for source-level debugging of wolfBoot running from NOR flash (XIP).
; @Chip: T2080
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is under nxp_t1040/ but is configured and documented for T2080 (SYStem.CPU T2080, header says T2080). On a T1040 this will at best misconfigure TRACE32, and at worst apply incorrect init/TLB sequences. Update the header and SYStem.CPU to T1040 (and consider renaming the file to t1040_debug.cmm to match its purpose).

Copilot uses AI. Check for mistakes.
SYStem.RESet

SYStem.BdmClock 15.MHz
SYStem.CPU T2080
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script is under nxp_t1040/ but is configured and documented for T2080 (SYStem.CPU T2080, header says T2080). On a T1040 this will at best misconfigure TRACE32, and at worst apply incorrect init/TLB sequences. Update the header and SYStem.CPU to T1040 (and consider renaming the file to t1040_debug.cmm to match its purpose).

Copilot uses AI. Check for mistakes.
Comment on lines +113 to +121
; Verify wolfBoot code is present at expected location
&wb_first=Data.Long(D:0xEFFE0000)
PRINT "wolfBoot first word at 0xEFFE0000: &wb_first"
IF &wb_first==0xFFFFFFFF
(
PRINT %ERROR "ERROR: wolfBoot region appears erased (0xFFFFFFFF)"
PRINT " Run t2080_flash.cmm first"
STOP
)
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded wolfBoot address 0xEFFE0000 (and the instruction to run t2080_flash.cmm) conflicts with the T1040 memory map described in this PR (WOLFBOOT_ORIGIN=0xEFF40000 and stage1 at 0xEFFFC000). Update the check/prints to use the T1040 wolfBoot origin (and correct the referenced flash script name) so the debug script validates the same layout the build produces.

Copilot uses AI. Check for mistakes.
Comment on lines +188 to +190
PRINT " Address: 0xE8000000 (64 KB)"
FLASH.UNLOCK 0xE8000000--0xE800FFFF
FLASH.ReProgram 0xE8000000--0xE800FFFF /Erase
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script’s hardcoded flash layout appears inconsistent with the T1040 layout/config added in this PR: (1) RCW is described in docs as 128KB but the script erases/programs only 64KB; (2) docs/config place FMAN ucode at 0xEFF00000 and wolfBoot at 0xEFF40000, but the script writes FMAN at 0xE8020000 and wolfBoot at 0xEFFE0000; (3) the script doesn’t program stage1 at 0xEFFFC000 even though the build produces factory_wstage1.bin. Align the script’s addresses/sizes with config/examples/nxp-t1040.config and docs/Targets.md, and include stage1 programming if factory_wstage1.bin is the intended deployment artifact.

Suggested change
PRINT " Address: 0xE8000000 (64 KB)"
FLASH.UNLOCK 0xE8000000--0xE800FFFF
FLASH.ReProgram 0xE8000000--0xE800FFFF /Erase
PRINT " Address: 0xE8000000 (128 KB)"
FLASH.UNLOCK 0xE8000000--0xE801FFFF
FLASH.ReProgram 0xE8000000--0xE801FFFF /Erase

Copilot uses AI. Check for mistakes.
Comment on lines +214 to +217
PRINT "3. Programming wolfBoot bootloader..."
PRINT " Source: &basedir/wolfboot.bin"
PRINT " Address: 0xEFFE0000 (128 KB)"
FLASH.UNLOCK 0xEFFE0000--0xEFFFFFFF
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script’s hardcoded flash layout appears inconsistent with the T1040 layout/config added in this PR: (1) RCW is described in docs as 128KB but the script erases/programs only 64KB; (2) docs/config place FMAN ucode at 0xEFF00000 and wolfBoot at 0xEFF40000, but the script writes FMAN at 0xE8020000 and wolfBoot at 0xEFFE0000; (3) the script doesn’t program stage1 at 0xEFFFC000 even though the build produces factory_wstage1.bin. Align the script’s addresses/sizes with config/examples/nxp-t1040.config and docs/Targets.md, and include stage1 programming if factory_wstage1.bin is the intended deployment artifact.

Copilot uses AI. Check for mistakes.
Comment on lines +228 to +231
PRINT "4. Programming test application..."
PRINT " Source: &basedir/test-app/image_v1_signed.bin"
PRINT " Address: 0xEFEE0000 (WOLFBOOT_PARTITION_BOOT_ADDRESS, 1 MB)"
FLASH.UNLOCK 0xEFEE0000--0xEFFDFFFF
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script’s hardcoded flash layout appears inconsistent with the T1040 layout/config added in this PR: (1) RCW is described in docs as 128KB but the script erases/programs only 64KB; (2) docs/config place FMAN ucode at 0xEFF00000 and wolfBoot at 0xEFF40000, but the script writes FMAN at 0xE8020000 and wolfBoot at 0xEFFE0000; (3) the script doesn’t program stage1 at 0xEFFFC000 even though the build produces factory_wstage1.bin. Align the script’s addresses/sizes with config/examples/nxp-t1040.config and docs/Targets.md, and include stage1 programming if factory_wstage1.bin is the intended deployment artifact.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +43
/* Wait for reboot */
while(1) {
for (j=0; j<1000000; j++)
;
i++;
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty delay loop has no side effects and can be optimized away by the compiler, which would remove the intended pacing of UART output. To make the delay reliable, use a hardware timer/udelay equivalent, or force a side effect (e.g., a volatile loop counter and/or an asm volatile barrier inside the loop).

Copilot uses AI. Check for mistakes.
/* Platform SRAM - 160KB */
PSRAM (rwx) : ORIGIN = 0xFDFC0000, LENGTH = 0x28000

/* DDR - 8GB: Start at 16MB to avoid using 0x0 (NULL) addresses */
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says DDR is 8GB, but the LENGTH expression limits DRAM to below 0x80000000 (i.e., <2GB address space). Either update the comment to reflect the deliberate 32-bit-addressing limit, or adjust the region definition if stage1 is expected to address more of DDR.

Suggested change
/* DDR - 8GB: Start at 16MB to avoid using 0x0 (NULL) addresses */
/* DDR - 32-bit window (<2GB) starting at 16MB to avoid using 0x0 (NULL) addresses */

Copilot uses AI. Check for mistakes.
{
/* DDR4 - 8GB (offset by destination address and 4KB boot region) */
DRAM (rwx) : ORIGIN = @WOLFBOOT_STAGE1_LOAD_ADDR@,
LENGTH = 0x7FFFFFFF - 4K - @WOLFBOOT_STAGE1_LOAD_ADDR@
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, the DRAM region is capped at 0x7FFFFFFF, which contradicts the DDR4 - 8GB comment. If this is intentional (keeping everything within 31-bit/32-bit addressing), please document that rationale explicitly; otherwise, adjust the upper bound to match the 8GB target.

Suggested change
LENGTH = 0x7FFFFFFF - 4K - @WOLFBOOT_STAGE1_LOAD_ADDR@
LENGTH = 0x200000000 - 4K - @WOLFBOOT_STAGE1_LOAD_ADDR@

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants