Skip to content

Commit c684d48

Browse files
committed
Progress testing
1 parent 1029bd3 commit c684d48

12 files changed

Lines changed: 826 additions & 89 deletions

File tree

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: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@
9494
#endif
9595

9696
#define FLASH_BASE_ADDR 0xEC000000UL
97-
#define FLASH_BASE_PHYS_HIGH 0xFULL
97+
#ifndef BUILD_LOADER_STAGE1
98+
#define FLASH_BASE_PHYS_HIGH 0xFULL /* 36-bit: 0xF_EC000000 */
99+
#else
100+
#define FLASH_BASE_PHYS_HIGH 0x0ULL /* 32-bit stage1 */
101+
#endif
98102
#define FLASH_LAW_SIZE LAW_SIZE_64MB
99103
#define FLASH_TLB_PAGESZ BOOKE_PAGESZ_64M
100104

@@ -110,14 +114,23 @@
110114
#define CCSRBAR_DEF (0xFE000000) /* T1040RM 4.4.1 default base */
111115
#define CCSRBAR_SIZE BOOKE_PAGESZ_16M
112116

113-
#define INITIAL_SRAM_ADDR 0xFDFC0000
114-
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_256KB
115-
#define INITIAL_SRAM_LAW_TRGT LAW_TRGT_PSRAM
116-
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_256K
117-
118117
#define ENABLE_L1_CACHE
119118
#define ENABLE_INTERRUPTS
120119

120+
/* T1040 has a 256KB CPC (CoreNet Platform Cache), not PSRAM.
121+
* Use L1 locked dcache (16KB) as initial stack, same as T2080.
122+
* CPC SRAM is configured but not used for stack to avoid
123+
* cold power cycle reliability issues via CoreNet. */
124+
#define L1_CACHE_ADDR (0xFDFC0000UL)
125+
126+
#define L2SRAM_ADDR (0xFDFE0000UL) /* CPC as SRAM (256KB) */
127+
#define L2SRAM_SIZE (256UL * 1024UL)
128+
129+
#define INITIAL_SRAM_ADDR L2SRAM_ADDR
130+
#define INITIAL_SRAM_LAW_SZ LAW_SIZE_256KB
131+
#define INITIAL_SRAM_LAW_TRGT LAW_TRGT_DDR_1 /* CPC target per T1040RM */
132+
#define INITIAL_SRAM_BOOKE_SZ BOOKE_PAGESZ_256K
133+
121134
#ifdef BUILD_LOADER_STAGE1
122135
#define ENABLE_L2_CACHE
123136
#else
@@ -131,10 +144,15 @@
131144
#define DDR_SIZE (8192ULL * 1024ULL * 1024ULL) /* 8GB */
132145
#endif
133146

134-
/* 256MB NOR: 0xE8000000 - 0xF7FFFFFF */
147+
/* 128MB NOR: 0xE8000000 - 0xEFFFFFFF */
135148
#define FLASH_BASE_ADDR 0xE8000000UL
136-
#define FLASH_BASE_PHYS_HIGH 0xFULL
137-
#define FLASH_LAW_SIZE LAW_SIZE_256MB
149+
#ifndef BUILD_LOADER_STAGE1
150+
#define FLASH_BASE_PHYS_HIGH 0xFULL /* 36-bit: 0xF_E8000000 */
151+
#else
152+
#define FLASH_BASE_PHYS_HIGH 0x0ULL /* 32-bit stage1 */
153+
#endif
154+
#define FLASH_LAW_SIZE LAW_SIZE_128MB
155+
/* e5500 BookE has no 128M page size (64M->256M), use 256M TLB */
138156
#define FLASH_TLB_PAGESZ BOOKE_PAGESZ_256M
139157

140158
#define USE_LONG_JUMP

hal/nxp_t1024_stage1.ld

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ MEMORY
3030

3131
SECTIONS
3232
{
33+
/* .text is placed first via "> FLASH" which allocates from ORIGIN(FLASH).
34+
* .boot and .reset use explicit addresses at end-of-flash and do NOT
35+
* consume FLASH region space (no "> FLASH" directive). */
36+
.text :
37+
{
38+
_start_vector = .;
39+
KEEP(*(.isr_vector))
40+
. = ALIGN(256);
41+
_start_text = .;
42+
*(.text*)
43+
*(.rodata*)
44+
*(.sdata*)
45+
} > FLASH
46+
3347
/* boot code boot_ppc_start.S for _reset */
3448
.boot BOOTSTRAP_TLB :
3549
{
@@ -44,17 +58,6 @@ SECTIONS
4458
} = 0x4
4559
. = ALIGN(4);
4660

47-
.text :
48-
{
49-
_start_vector = .;
50-
KEEP(*(.isr_vector))
51-
. = ALIGN(256);
52-
_start_text = .;
53-
*(.text*)
54-
*(.rodata*)
55-
*(.sdata*)
56-
} > FLASH
57-
5861
/* Read-only sections, merged into text segment: */
5962
.interp : { *(.interp) }
6063
.hash : { *(.hash) }
@@ -108,3 +111,5 @@ SECTIONS
108111
/* Platform SRAM heap/stack */
109112
PROVIDE(_start_heap = ORIGIN(PSRAM));
110113
PROVIDE(_end_stack = ORIGIN(PSRAM) + (LENGTH(PSRAM)));
114+
115+
ASSERT(_stored_data <= BOOTSTRAP_TLB, ".text/.reloc overflow into bootstrap region")

hal/nxp_t1040.ld

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ ENTRY( _reset )
44

55
MEMORY
66
{
7-
/* DDR4 - 8GB (offset by destination address and 4KB boot region) */
7+
/* DDR4 - 8GB physical (32-bit addressing limits window to <2GB) */
88
DRAM (rwx) : ORIGIN = @WOLFBOOT_STAGE1_LOAD_ADDR@,
99
LENGTH = 0x7FFFFFFF - 4K - @WOLFBOOT_STAGE1_LOAD_ADDR@
1010

11-
/* L1 SRAM - 16KB */
12-
L1RAM (rwx) : ORIGIN = 0xF8F80000, LENGTH = 0x4000
11+
/* L1 locked dcache - 16KB */
12+
L1RAM (rwx) : ORIGIN = 0xFDFC0000, LENGTH = 0x4000
1313

14-
/* Platform SRAM - 160KB */
15-
PSRAM (rwx) : ORIGIN = 0xFDFC0000, LENGTH = 0x28000
14+
/* CPC SRAM - 256KB */
15+
CPCSRAM (rwx) : ORIGIN = 0xFDFE0000, LENGTH = 0x40000
1616
}
1717

1818
SECTIONS
@@ -84,6 +84,6 @@ SECTIONS
8484
PROVIDE(_start_heap = _end);
8585
PROVIDE(_end_stack = ORIGIN(DRAM) + (LENGTH(DRAM)));
8686

87-
/* Platform SRAM heap/stack */
88-
/* PROVIDE(_start_heap = ORIGIN(PSRAM)); */
89-
/* PROVIDE(_end_stack = ORIGIN(PSRAM) + (LENGTH(PSRAM))); */
87+
/* CPC SRAM heap/stack (unused - wolfBoot runs from DDR) */
88+
/* PROVIDE(_start_heap = ORIGIN(CPCSRAM)); */
89+
/* PROVIDE(_end_stack = ORIGIN(CPCSRAM) + (LENGTH(CPCSRAM))); */

hal/nxp_t1040_stage1.ld

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,49 @@ 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
{
1818
/* Boot Location */
1919
FLASH (rx) : ORIGIN = BASE_ADDR, LENGTH = LOADER_STAGE1_SIZE
2020

21-
/* L1 SRAM - 16KB */
22-
L1RAM (rwx) : ORIGIN = 0xF8F80000, LENGTH = 0x4000
21+
/* L1 locked dcache as initial stack - 16KB */
22+
L1RAM (rwx) : ORIGIN = 0xFDFC0000, LENGTH = 0x4000
2323

24-
/* Platform SRAM - 160KB */
25-
PSRAM (rwx) : ORIGIN = 0xFDFC0000, LENGTH = 0x28000
24+
/* CPC SRAM - 256KB (CoreNet Platform Cache configured as SRAM) */
25+
CPCSRAM (rwx) : ORIGIN = 0xFDFE0000, LENGTH = 0x40000
2626

27-
/* DDR - 8GB: Start at 16MB to avoid using 0x0 (NULL) addresses */
27+
/* DDR - 8GB physical, 32-bit addressing limits window to <2GB.
28+
* Start at 16MB to avoid using 0x0 (NULL) addresses */
2829
DRAM (rwx) : ORIGIN = 0x1000000, LENGTH = 0x7FFFFFFF - 0x1000000
2930
}
3031

3132
SECTIONS
3233
{
34+
/* .text is placed first via "> FLASH" which allocates from ORIGIN(FLASH).
35+
* .boot and .reset use explicit addresses at end-of-flash and do NOT
36+
* consume FLASH region space (no "> FLASH" directive). */
37+
.text :
38+
{
39+
_start_vector = .;
40+
KEEP(*(.isr_vector))
41+
. = ALIGN(256);
42+
_start_text = .;
43+
*(.text*)
44+
*(.rodata*)
45+
*(.sdata*)
46+
} > FLASH
47+
3348
/* boot code boot_ppc_start.S for _reset */
3449
.boot BOOTSTRAP_TLB :
3550
{
@@ -44,17 +59,6 @@ SECTIONS
4459
} = 0x4
4560
. = ALIGN(4);
4661

47-
.text :
48-
{
49-
_start_vector = .;
50-
KEEP(*(.isr_vector))
51-
. = ALIGN(256);
52-
_start_text = .;
53-
*(.text*)
54-
*(.rodata*)
55-
*(.sdata*)
56-
} > FLASH
57-
5862
/* Read-only sections, merged into text segment: */
5963
.interp : { *(.interp) }
6064
.hash : { *(.hash) }
@@ -105,6 +109,8 @@ SECTIONS
105109

106110
}
107111

108-
/* Platform SRAM heap/stack */
109-
PROVIDE(_start_heap = ORIGIN(PSRAM));
110-
PROVIDE(_end_stack = ORIGIN(PSRAM) + (LENGTH(PSRAM)));
112+
/* CPC SRAM heap, L1 locked dcache stack */
113+
PROVIDE(_start_heap = ORIGIN(CPCSRAM));
114+
PROVIDE(_end_stack = ORIGIN(L1RAM) + (LENGTH(L1RAM)));
115+
116+
ASSERT(_stored_data <= BOOTSTRAP_TLB, ".text/.reloc overflow into bootstrap region")

0 commit comments

Comments
 (0)