Skip to content

Commit 78a4584

Browse files
committed
Progress testing
1 parent 1029bd3 commit 78a4584

File tree

7 files changed

+594
-27
lines changed

7 files changed

+594
-27
lines changed

config/examples/nxp-t1040.config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,34 @@ WOLFTPM?=0
2626
ELF?=1
2727
DEBUG_ELF=0
2828

29-
# NOR Base Address (256MB NOR at 0xE8000000 - 0xF7FFFFFF)
29+
# NOR Base Address (128MB NOR at 0xE8000000 - 0xEFFFFFFF)
3030
ARCH_FLASH_OFFSET?=0xE8000000
3131

3232
# Flash Sector Size (128KB)
3333
WOLFBOOT_SECTOR_SIZE=0x20000
3434

35-
# wolfBoot start address
36-
WOLFBOOT_ORIGIN=0xF7F40000
35+
# wolfBoot start address (same as T1024 - NOR top is 0xEFFFFFFF)
36+
WOLFBOOT_ORIGIN=0xEFF40000
3737
# wolfBoot partition size (custom)
3838
BOOTLOADER_PARTITION_SIZE=0xC0000
3939

4040
# Application Partition Size (15MB)
4141
WOLFBOOT_PARTITION_SIZE?=0xF00000
4242
# Location in Flash for Application Partition
43-
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xF6000000
43+
WOLFBOOT_PARTITION_BOOT_ADDRESS?=0xEE000000
4444
# Load Partition to RAM Address
4545
WOLFBOOT_LOAD_ADDRESS?=0x70000000
4646

4747
# Location in Flash for Update Partition
48-
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xF6F00000
48+
WOLFBOOT_PARTITION_UPDATE_ADDRESS?=0xEEF00000
4949

5050
# Location of temporary sector used during updates
5151
WOLFBOOT_PARTITION_SWAP_ADDRESS?=0xE80F0000
5252

5353
# Stage 1 loader settings (16KB)
5454
WOLFBOOT_STAGE1_SIZE=0x4000
5555
# Location in Flash for stage 1 loader (XIP from boot ROM)
56-
WOLFBOOT_STAGE1_FLASH_ADDR=0xF7FFC000
56+
WOLFBOOT_STAGE1_FLASH_ADDR=0xEFFFC000
5757
# Address in RAM to load wolfBoot (end of DDR at 2GB-1MB for 32-bit addressing)
5858
WOLFBOOT_STAGE1_LOAD_ADDR=0x7FF00000
5959

docs/Targets.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,9 +3277,9 @@ Reset Configuration Word (RCW):
32773277
00000020: 00000000 00000000 00000000 00030810
32783278
00000030: 00000000 0342580f 00000000 00000000
32793279

3280-
Flash is NOR on IFC CS0 (0x0_E800_0000) 256MB.
3280+
Flash is NOR on IFC CS0 (0x0_E800_0000) 128MB (Micron JS28F00AM29EWHA, 16-bit, AMD CFI).
32813281

3282-
Default NOR Flash Memory Layout (256MB) (128KB block, 1K page)
3282+
Default NOR Flash Memory Layout (128MB) (128KB block, 1K page)
32833283

32843284
| Description | Address | Size |
32853285
| ----------------- | ---------- | -------------------- |
@@ -3289,13 +3289,13 @@ Default NOR Flash Memory Layout (256MB) (128KB block, 1K page)
32893289
| Free | 0xE8100000 | 0x00700000 ( 7 MB) |
32903290
| FDT (Primary) | 0xE8800000 | 0x00020000 (128 KB) |
32913291
| FDT (Update) | 0xE8820000 | 0x00020000 (128 KB) |
3292-
| Free | 0xE8840000 | 0x0D7C0000 (~200 MB) |
3293-
| Application (OS) | 0xF6000000 | 0x00F00000 ( 15 MB) |
3294-
| Update (OS) | 0xF6F00000 | 0x00F00000 ( 15 MB) |
3295-
| QUICC | 0xF7E00000 | 0x00100000 ( 1 MB) |
3296-
| DPAA (FMAN) | 0xF7F00000 | 0x00020000 (128 KB) |
3297-
| wolfBoot | 0xF7F40000 | 0x000BC000 (752 KB) |
3298-
| wolfBoot Stage 1 | 0xF7FFC000 | 0x00004000 ( 16 KB) |
3292+
| Free | 0xE8840000 | 0x057C0000 ( 87 MB) |
3293+
| Application (OS) | 0xEE000000 | 0x00F00000 ( 15 MB) |
3294+
| Update (OS) | 0xEEF00000 | 0x00F00000 ( 15 MB) |
3295+
| QUICC | 0xEFE00000 | 0x00100000 ( 1 MB) |
3296+
| DPAA (FMAN) | 0xEFF00000 | 0x00020000 (128 KB) |
3297+
| wolfBoot | 0xEFF40000 | 0x000BC000 (752 KB) |
3298+
| wolfBoot Stage 1 | 0xEFFFC000 | 0x00004000 ( 16 KB) |
32993299

33003300
QE: uploading microcode 'Microcode for T1040 r1.0' version 0.0.1
33013301

@@ -3336,11 +3336,11 @@ If getting errors with keystore then you can reset things using `make distclean`
33363336
./tools/bin-assemble/bin-assemble factory_custom.bin \
33373337
0xE8000000 RCW.bin \
33383338
0xE8020000 custom.dtb \
3339-
0xF6000000 custom_v1_signed.bin \
3340-
0xF7E00000 iram_Type_A_T1040_r1.0.bin \
3341-
0xF7F00000 fsl_fman_ucode_t1040.bin \
3342-
0xF7F40000 wolfboot.bin \
3343-
0xF7FFC000 stage1/loader_stage1.bin
3339+
0xEE000000 custom_v1_signed.bin \
3340+
0xEFE00000 iram_Type_A_T1040_r1.0.bin \
3341+
0xEFF00000 fsl_fman_ucode_t1040.bin \
3342+
0xEFF40000 wolfboot.bin \
3343+
0xEFFFC000 stage1/loader_stage1.bin
33443344
```
33453345

33463346
Flash factory_custom.bin to NOR base 0xE800_0000

hal/nxp_ppc.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,11 @@
131131
#define DDR_SIZE (8192ULL * 1024ULL * 1024ULL) /* 8GB */
132132
#endif
133133

134-
/* 256MB NOR: 0xE8000000 - 0xF7FFFFFF */
134+
/* 128MB NOR: 0xE8000000 - 0xEFFFFFFF */
135135
#define FLASH_BASE_ADDR 0xE8000000UL
136136
#define FLASH_BASE_PHYS_HIGH 0xFULL
137-
#define FLASH_LAW_SIZE LAW_SIZE_256MB
137+
#define FLASH_LAW_SIZE LAW_SIZE_128MB
138+
/* e5500 BookE has no 128M page size (64M->256M), use 256M TLB */
138139
#define FLASH_TLB_PAGESZ BOOKE_PAGESZ_256M
139140

140141
#define USE_LONG_JUMP

hal/nxp_t1040_stage1.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ OUTPUT_ARCH( "powerpc" )
22

33
ENTRY( _reset )
44

5-
/* Boot ROM out of reset mapped to 0xF7FFF000 */
5+
/* Boot ROM out of reset mapped to 0xEFFFF000 (top of 128MB NOR) */
66
BASE_ADDR = @WOLFBOOT_STAGE1_FLASH_ADDR@;
77

88
LOADER_STAGE1_SIZE = @WOLFBOOT_STAGE1_SIZE@;
99

1010
/* Boot initialization code */
11-
BOOTSTRAP_TLB = 0xF7FFF000;
11+
BOOTSTRAP_TLB = 0xEFFFF000;
1212

1313
/* Entry point where RCW directs code to execute from */
14-
BOOTSTRAP_ENTRY = 0xF7FFFFFC;
14+
BOOTSTRAP_ENTRY = 0xEFFFFFFC;
1515

1616
MEMORY
1717
{

hal/nxp_t10xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ enum ifc_amask_sizes {
525525

526526
/* NOR Flash */
527527
#ifdef TARGET_nxp_t1040
528-
#define FLASH_BANK_SIZE (256*1024*1024) /* 256MB NOR */
528+
#define FLASH_BANK_SIZE (128*1024*1024) /* 128MB NOR */
529529
#else
530530
#define FLASH_BANK_SIZE (64*1024*1024) /* 64MB NOR */
531531
#endif
@@ -1304,7 +1304,7 @@ static void hal_flash_init(void)
13041304
IFC_CSPR_MSEL_NOR |
13051305
IFC_CSPR_V));
13061306
#ifdef TARGET_nxp_t1040
1307-
set32(IFC_AMASK(0), IFC_AMASK_256MB);
1307+
set32(IFC_AMASK(0), IFC_AMASK_128MB);
13081308
#else
13091309
set32(IFC_AMASK(0), IFC_AMASK_64MB);
13101310
#endif
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
; ------------------------------------------------------------------------------
2+
; @Title: NXP T2080 wolfBoot Debug Script
3+
; @Description:
4+
; Brings up the T2080, loads wolfBoot ELF symbols, and sets breakpoints
5+
; for source-level debugging of wolfBoot running from NOR flash (XIP).
6+
; @Chip: T2080
7+
; Based on demo scripts from Lauterbach
8+
; ------------------------------------------------------------------------------
9+
;
10+
; Prerequisites:
11+
; - wolfBoot must already be flashed to NOR (use t2080_flash.cmm)
12+
; - wolfboot.elf must be built with debug symbols (DEBUG=1 recommended)
13+
; ------------------------------------------------------------------------------
14+
15+
; Base directory for wolfBoot build output (adjust to match your build path)
16+
&basedir="."
17+
18+
PRINT "========================================"
19+
PRINT "T2080 wolfBoot Debug Session"
20+
PRINT "========================================"
21+
PRINT ""
22+
23+
; Reset everything
24+
RESet
25+
SYStem.RESet
26+
27+
SYStem.BdmClock 15.MHz
28+
SYStem.CPU T2080
29+
SYStem.DETECT CPU
30+
CORE.ASSIGN 1.
31+
SYStem.Option.FREEZE ON
32+
SYStem.Option.IMASKASM ON
33+
34+
; Use RCW override to bring up the system in a controlled state.
35+
; This halts the CPU before any flash code executes.
36+
PRINT "Bringing up system with RCW override..."
37+
SYStem.Mode.Prepare
38+
39+
SYStem.Option.HRCWOVerRide ON
40+
41+
; RCW values (matching the flash RCW)
42+
Data.Set DBG:0x01000000 0x0c050012
43+
Data.Set DBG:0x01000001 0x0e000000
44+
Data.Set DBG:0x01000002 0x00000000
45+
Data.Set DBG:0x01000003 0x00000000
46+
Data.Set DBG:0x01000004 0xd8150002
47+
Data.Set DBG:0x01000005 0x00800000
48+
Data.Set DBG:0x01000006 0xfc027000
49+
Data.Set DBG:0x01000007 0xa1000000
50+
Data.Set DBG:0x01000008 0x00000000
51+
Data.Set DBG:0x01000009 0x00000000
52+
Data.Set DBG:0x0100000A 0x00000000
53+
Data.Set DBG:0x0100000B 0x0002b000
54+
Data.Set DBG:0x0100000C 0x00000200
55+
Data.Set DBG:0x0100000D 0x0080000d
56+
Data.Set DBG:0x0100000E 0x00000000
57+
Data.Set DBG:0x0100000F 0x00000004
58+
59+
SYStem.Up
60+
61+
SYStem.Option.HRCWOVerRide OFF
62+
63+
PRINT "System up (CPU halted)"
64+
65+
; Allow non-intrusive run-time memory access
66+
SYStem.MemAccess CPU
67+
68+
; NOTE: Keep CCSRBAR at default 0xFE000000 to match wolfBoot.
69+
; wolfBoot uses CCSRBAR_DEF = 0xFE000000 in hal/nxp_ppc.h.
70+
; Do NOT relocate CCSRBAR here.
71+
72+
; Set up LAW0 for CCSR at 0xFE000000 (16 MB)
73+
; LAWAR = ENABLE(0x80000000) | TRGT_CORENET(0x1E<<20) | SIZE_16MB(0x17)
74+
PRINT "Setting up LAW for CCSR access..."
75+
Data.Set ANC:IOBASE()+0x00C00 %Long %BE 0x00000000 ; LAWBARH0 = 0
76+
Data.Set ANC:IOBASE()+0x00C04 %Long %BE 0xFE000000 ; LAWBARL0 = 0xFE000000
77+
Data.Set ANC:IOBASE()+0x00C08 %Long %BE 0x81E00017 ; LAWAR0 = enable|CORENET|16 MB
78+
79+
; Set up LAW1 for IFC NOR Flash at 0xE8000000 (128 MB)
80+
; LAWAR = ENABLE(0x80000000) | TRGT_IFC(0x1F<<20) | SIZE_128MB(0x1A)
81+
PRINT "Setting up LAW for flash access..."
82+
Data.Set ANC:IOBASE()+0x00C10 %Long %BE 0x00000000 ; LAWBARH1 = 0
83+
Data.Set ANC:IOBASE()+0x00C14 %Long %BE 0xE8000000 ; LAWBARL1 = 0xE8000000
84+
Data.Set ANC:IOBASE()+0x00C18 %Long %BE 0x81F0001A ; LAWAR1 = enable|IFC|128 MB
85+
86+
; TLB for CCSR: Entry 1, 0xFE000000, 16 MB
87+
; MAS1: V=1(0x80000000), IPROT=1(0x40000000), TSIZE=14 (16 MB) <<7 = 0x700
88+
; MAS2: EPN=0xFE000000, I|G=0x0A
89+
; MAS3: RPN=0xFE000000, SX|SW|SR=0x15
90+
MMU.TLB1.Set 1. 0xC0000700 0xFE00000A 0xFE000015 0x00000000 0x0
91+
92+
; TLB for Flash: Entry 2, 0xE8000000, 128 MB
93+
; MAS1: V=1, IPROT=1, TSIZE=17 (128 MB) <<7 = 0x880
94+
; MAS2: EPN=0xE8000000, I|G=0x0A
95+
; MAS3: RPN=0xE8000000, SX|SW|SR=0x15
96+
MMU.TLB1.Set 2. 0xC0000880 0xE800000A 0xE8000015 0x00000000 0x0
97+
98+
PRINT "CCSR (0xFE000000) and Flash (0xE8000000) configured"
99+
100+
; Verify flash is accessible - check for RCW preamble
101+
&rcw_preamble=Data.Long(D:0xE8000000)
102+
PRINT "RCW preamble at 0xE8000000: &rcw_preamble"
103+
IF &rcw_preamble!=0xAA55AA55
104+
(
105+
PRINT %WARNING "WARNING: Expected RCW preamble 0xAA55AA55, got &rcw_preamble"
106+
PRINT " Flash may not be properly programmed"
107+
)
108+
ELSE
109+
(
110+
PRINT " RCW preamble OK"
111+
)
112+
113+
; Verify wolfBoot code is present at expected location
114+
&wb_first=Data.Long(D:0xEFFE0000)
115+
PRINT "wolfBoot first word at 0xEFFE0000: &wb_first"
116+
IF &wb_first==0xFFFFFFFF
117+
(
118+
PRINT %ERROR "ERROR: wolfBoot region appears erased (0xFFFFFFFF)"
119+
PRINT " Run t2080_flash.cmm first"
120+
STOP
121+
)
122+
123+
PRINT ""
124+
PRINT "Loading wolfBoot symbols..."
125+
126+
; Load ELF symbols (debug info only - code is already in flash, XIP)
127+
Data.LOAD.Elf &basedir/wolfboot.elf /NoCODE
128+
Data.LOAD.Elf &basedir/test-app/image.elf /NoCODE /NoClear
129+
sYmbol.SourcePATH.Set &basedir &basedir/src &basedir/hal &basedir/lib/wolfssl &basedir/test-app
130+
131+
PRINT " Symbols loaded from wolfboot.elf"
132+
PRINT " Symbols loaded from test-app/image.elf"
133+
134+
; Set breakpoints at key wolfBoot entry points
135+
PRINT ""
136+
PRINT "Setting breakpoints..."
137+
138+
Break.Delete /ALL
139+
140+
; Entry point - reset vector
141+
Break.Set _reset /Program /Onchip
142+
PRINT " BP: _reset (0xEFFFF000) - reset vector"
143+
144+
; main wolfBoot entry
145+
IF sYmbol.EXIST(main)
146+
(
147+
Break.Set main /Program /Onchip
148+
PRINT " BP: main"
149+
)
150+
151+
; hal_init
152+
IF sYmbol.EXIST(hal_init)
153+
(
154+
Break.Set hal_init /Program /Onchip
155+
PRINT " BP: hal_init"
156+
)
157+
158+
PRINT ""
159+
160+
; Set PC to wolfBoot reset vector
161+
Register.Set PC 0xEFFFF000
162+
163+
PRINT "PC set to _reset (0xEFFFF000)"
164+
PRINT ""
165+
166+
PRINT "========================================"
167+
PRINT "wolfBoot Debug Ready"
168+
PRINT "========================================"
169+
PRINT ""
170+
PRINT "Key symbols:"
171+
PRINT " _reset: 0xEFFFF000 (entry)"
172+
PRINT " _start_vector: 0xEFFE0000"
173+
PRINT " hal_init: (see symbol table)"
174+
PRINT ""
175+
PRINT "Commands:"
176+
PRINT " Go - Run to next breakpoint"
177+
PRINT " Step / Step.Over - Single step"
178+
PRINT " Var.View <var> - Inspect variable"
179+
PRINT " Data.dump <addr> - Memory dump"
180+
PRINT ""
181+
PRINT "Ready - press Go to start execution"
182+
PRINT ""
183+
184+
ENDDO

0 commit comments

Comments
 (0)