I have a codebase that works fine on the MK60DN512, and I am trying to port it to run on the prequalification early part, PK60DN512Z.
I have configured codewarrior Processor Expert to target the "MK60DN512ZVMD10" as there is no "PK..." part, but as I understand it they should be identical for this purpose?
The code has been regenerated, and I have adjusted register names in my code where necessary, however I am hitting a fault early in the bring-up sequence.
startup.c gets to the following branch instruction:
// call C++ static initializers
bl __call_static_initializers
At some point during this the fault occurs - I've stepped through at the instruction level but didn't see anything revealing. It seems that the error occurs on a "MOVS" instruction (location 00000042 in the listing below):
00000034: ldrh r5,[r4,r5]
00000036: movs r0,r0
00000038: ldrh r5,[r4,r5]
0000003a: movs r0,r0
0000003c: ldrh r5,[r4,r5]
0000003e: movs r0,r0
00000040: strh r1,[r2,#62]
00000042: movs r0,r0
00000044: strh r1,[r2,#60]
At that time (at 00000040):
- r1 = 0x0000A7D6
- r2 = 0x00000000
- r0 = 0x00000001
Once the fault occurs the System Control Registers look at follows:
System Control Registers
SCB_ACTLR 0x0 0xe000e008
SCB_CPUID 0x410fc240 0xe000ed00
SCB_ICSR 0x803 0xe000ed04
SCB_VTOR 0x0 0xe000ed08
SCB_AIRCR 0xfa050000 0xe000ed0c
SCB_SCR 0x0 0xe000ed10
SCB_CCR 0x200 0xe000ed14
SCB_SHPR1 0x0 0xe000ed18
SCB_SHPR2 0x0 0xe000ed1c
SCB_SHPR3 0x0 0xe000ed20
SCB_SHCSR 0x0 0xe000ed24
SCB_CFSR 0x400 0xe000ed28
SCB_HFSR 0x40000000 0xe000ed2c
SCB_DFSR 0x9 0xe000ed30
SCB_MMFAR 0xe000edf8 0xe000ed34
SCB_BFAR 0xe000edf8 0xe000ed38
SCB_AFSR 0x0 0xe000ed3c
I'm not sure that this is telling me an awful lot though:
- ICSR is just showing that we are now in the interrupt handler (which is correct)
- CFSR.IMPRECISERR bits[ 10:10 ] = 1 a data bus error has occurred, but the return address in the stack frame is not related to the instruction that caused the error.
- HFSR.FORCED bits[ 30:30 ] = 1 forced HardFault
Where do I go from here to determine why I get the hardfault on this target, but not on the MK60DN512?
The linker file in use is the same for both, and I believe that should be ok as they should be identical.
The (working) MK60DN512 is mask 5N22D, and the (non-working) PK60DN512Z is mask 4N30D; I've looked through the errata and can't see anything that would relate to this, but perhaps I missed something?
Thanks in advance!