Loading Extended Hex File Causes HardFault, and unable to debug immediately after loading.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Loading Extended Hex File Causes HardFault, and unable to debug immediately after loading.

1,150 Views
Vijay_Arwapally
Contributor III

@nxp@danielmartynek @Robin_Shen 

Device : S32K148 EVB,

Environment S32KDS 2.2

Issue : Post build, generated Hex is extended to fill the required size of the allocated flash for the code section and updated with CRC code at last. But when this generated hex is used to flash, flashing seems to be successful, but immediately debugging is not possible. Can you let me know the issue here?

 

Below is the log from console during flashing/debugging:

Connection from "127.0.0.1" via 127.0.0.1. Connection from port "50876" to 6224
Connection from "127.0.0.1" via 127.0.0.1. Connection from port "50878" to 7224
Telnet server running on 127.0.0.1:51794
Searching for FreeRTOS Kernel Symbols...
rsp_qC - qSymbol: 707843757272656E74544342
Symbol pxCurrentTCB found. (0x20002204)
rsp_qC - qSymbol: 707852656164795461736B734C69737473
Symbol pxReadyTasksLists found. (0x20002208)
rsp_qC - qSymbol: 7844656C617965645461736B4C69737431
Symbol xDelayedTaskList1 found. (0x2000226C)
rsp_qC - qSymbol: 7844656C617965645461736B4C69737432
Symbol xDelayedTaskList2 found. (0x20002280)
rsp_qC - qSymbol: 7850656E64696E6752656164794C697374
Symbol xPendingReadyList found. (0x2000229C)
rsp_qC - qSymbol: 757843757272656E744E756D6265724F665461736B73
Symbol uxCurrentNumberOfTasks found. (0x200022DC)
rsp_qC - qSymbol: 757844656C657465645461736B7357616974696E67436C65616E5570
Symbol uxDeletedTasksWaitingCleanUp found. (0x200022C4)
rsp_qC - qSymbol: 7853757370656E6465645461736B4C697374
Symbol xSuspendedTaskList found. (0x200022C8)
rsp_qC - qSymbol: 785363686564756C657252756E6E696E67
Symbol xSchedulerRunning found. (0x200022E8)
Successfully initialized kernel symbols. FreeRTOS analysis enabled.
Copyright 2018 P&E Microcomputer Systems,Inc.
Command Line :C:\NXP\S32DS_ARM_v2.2\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_4.8.6.202102101934\win32\pegdbserver_console -device=NXP_S32K1xx_S32K148F2M0M11 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=OPENSDA -speed=5000 <
OpenSDA detected - Flash Version 1.22

CMD>RE

Initializing.
Target has been RESET and is active.
CMD>CM C:\NXP\S32DS_ARM_v2.2\eclipse\plugins\com.pemicro.debug.gdbjtag.pne_4.8.6.202102101934\win32\gdi\P&E\supportFiles_ARM\NXP\S32K1xx\freescale_s32k148f2m0m11_pflash_dflash_eeprom.arp

Initializing.
Initialized.

;version 1.06, 04/06/2020, Copyright 2020 P&E Microcomputer Systems, Inc. All rights reserved. www.pemicro.com [s32k148f2m0m11_x_pflash_dflash_eeprom]

;device freescale, s32k148f2m0m11, pflash_dflash_eeprom

;begin_cs device=$00000000, length=$14001000, ram=$20000000

Loading programming algorithm ...
Done.
Programming sequency is : erase, blank check, program, and verify {default}
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-0017FFFF ...
Calculated CRC-16 does not match block. (File = $F382, Device = $9676)
Current content of flash does not match application to be programmed

CMD>EM

Erasing.
Module has been erased.
Reloading programming algorithm ...
done.
CMD>PM

Programming.
Processing Object File Data ...


.
Programmed.
CMD>VC
Verifying object file CRC-16 to device ranges ...
block 00000000-0017FFFF ...
Ok.
Checksum Verification Successful. (Cumulative CRC-16=$F382)

CMD>RE

Initializing.
Target has been RESET and is active.
Number of threads 1 (Scheduler not yet running)
Number of threads 1 (Scheduler not yet running)
Number of threads 1 (Scheduler not yet running)
Number of threads 1 (Scheduler not yet running)
UsageFault: The processor has attempted to execute an undefined instruction.
HardFault: A fault has been escalated to a hard fault.
Kernel thread information now available.
DelayedTaskList1
uxNumberOfItems - 14549214
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is
Task name is B¿ïó ?ïó?H`
Task name is
Task name is

 

Task name prints(junk) are continuous on the console output. Once the target is power reset, I am able to debug without loading flash, and device seems to executing the right code. Why doesn't the debugging work right away after flashing as in the generated hex/elf flashing case?

Debug/Flash Configuration settings:

Vijay_Arwapally_0-1627540968354.pngVijay_Arwapally_1-1627540993100.pngVijay_Arwapally_2-1627541021208.png

 

Attached are the build generated hex and extended hex files.

0 Kudos
3 Replies

190 Views
egn_lehmann
Contributor I

Did you ever get to fixing this? I'm facing the exact same problem but the suggested fix didn't help, sadly

0 Kudos

778 Views
stanish
NXP Employee
NXP Employee

Hello,

I suspect the problem in the debug session is caused by the fact the debugger set the PC to address 0x0 (see below). Typically this address is used for interrupt vector table and not for the application entry point. After reset PC is set to the reset vector and it works fine.

stanish_0-1667234218214.png

I'd suggest to untick "set PC..." option and re-try again.

Hope it helps.

Stan

0 Kudos

1,117 Views
Vijay_Arwapally
Contributor III

@nxp  any hints?

0 Kudos