NXP rt1064 Changing code location in XIP Flash causes program failure

18 views Asked by At

Changing code location in XIP Flash causes program failure.

My application for NXP rt1064 loaded at 0x70040400 (for starting via bootloader) is behaving differently from the "standalone" version loaded at the normal start address 0x70000000. The "bad" version fails: it stalls during sys_check_timeouts() in the LWIP code and the debugger loses control. The standalone version is "good" in that its execution continues without stalling.

To test if is is a code location issue, or an issue with the runtime environment set up for app execution when jumped to from bootloader, I took the "good" standalone version, temporarily disabled managed linker scripts, and added a padding directive as follows to the .ld file:

/* Image Vector Table and Boot Data for booting from external flash */
.boot_hdr : ALIGN(4)
{
FILL(0xff)
...
. = 0x2000 ;
. = 0x40400 ;  /* Add padding to load next section at 0x70040400 */
} >PROGRAM_FLASH

/* MAIN TEXT SECTION */
.text : ALIGN(4)

This aligned the main text section in the modified "good" version to load at 0x70040400, ie same as "bad" version. Extract from .map file to show this:

0x00002000 . = 0x2000
*fill* 0x70001460 0xba0 ff
0x00040400 . = 0x40400
*fill* 0x70002000 0x3e400 ff

.text 0x70040400 0xc7734
FILL mask 0xff
0x70040400 __vectors_start__ = ABSOLUTE (.)
*(SORT_BY_ALIGNMENT(.isr_vector))
.isr_vector 0x70040400 0x2b8 ./startup/startup_mimxrt1064.o

The remaining functions in the modified "good" version are loaded at addresses corresponding to those in the "bad" version

The modified "good" version with padding now fails in the same way as the "bad" version . Aside from the addition of padding, no other changes were made. So it appears to be a code location issue.

Can anyone suggest how changing the location of code in XIP flash could make a difference to program execution?

0

There are 0 answers