How To Disassemble From Initial Address On Power_Up or Reset

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Disassemble From Initial Address On Power_Up or Reset

451 Views
jimccall
Contributor I


I'm using the CodeWarrior Development Studio with the CodeWarrior Tap on a T4240_QDS Rev_2 blue box. I'm trying to set a hardware Breakpoint at the first address the processor goes to in reset (my understanding is, it's 0xFFFF_FFFC) so I can step through the instructions and see which addresses the processor steps to and the instructions it runs on its way to the actual main() statement of my program.

 

Basically, I'm trying step through the assembly and instruction set to better understand exactly what the processor is doing from the second I power up the system until the C program hits its main statement.

 

I have a breakpoint set (it says [address: 0x00000000fffffffc] [type: Hardware]) so I'm assuming the breakpoint has been placed correctly.

 

The problem is, when I connect to the board and reset via the debug console, it does not pause at the initial instruction; it keeps on running. When I finally pause the core of interest (core 0), and look at the disassembly, the PC is already far down in the instruction stream. Is there a set of debugger configurations I need to create in order for the board to reset and halt on the very first instruction?

 

I have tried debugging as an "attach" configuration as well as a "custom" configuration.

Labels (1)
0 Kudos
1 Reply

186 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Jesse McCall,

I recommend you to refer to the procedure in the first section of "Debugging U-Boot using NOR flash" in C:\Freescale\CW_PA_v10.5.0\PA\Help\PDF\Targeting_PA_Processors.pdf to use Attach method to debug program boot from NOR Flash.

Probably you could start with the CodeWarrior ROM sample project, please follow new project wizards to create a ROM Attach project, build this project to generate the bin file and program it to the end of NOR Flash. Please follow the above procedure to attach to the target board, then use CodeWarrior to reset the target without run initialization file. The debugger will stop at the program entry point.

In addition, CodeWarrior only generates elf file, you could use the following method to generate a binary file.

From Project->Properties->C/C++ Build->Settings->Build Steps->Post-build steps enter the following command

"${PAGccAeabiE6500Dir}/powerpc-eabi-objcopy.exe -O binary -S <project>.elf <project>.bin", after build the project, the binary file will generated in <project>/ROM folder.

At last, if you only want to see Disassemble code which CodeWarrior fetches from the target board, please use this method, use Attach launch configuration to connect to the target board, and use CodeWarrior to reset the target without initialization, the debugger will stop at the entry point 0xFFFF_FFFC, and disassemble code can be seen from the Disassembly Window.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos