Question:
I have an application that boots from flash, and now I would like to debug this application out of flash using an ADZS-HPUSB ICE. How can I do this?
====================================
Answer:
To debug a target that is booting from Flash, you need to configure the way in which CrossCore Embedded Studio connects to your target, to ensure that when it does connect to your board it does not reset the processor.
The Debug Configuration window offers you 4 settings when loading a DXE, each of which can be enabled/disabled independently:
Reset core before load - Issues a reset to the target processor before loading the DXE.
Check silicon revision before load - Queries the silicon revision of the connected target before loading the DXE, to ensure that the Target silicon revision matches the build.
Load symbols only - Only loads the debug symbols, rather than loading the disassembly.
Run immediately after load - Sets the target running once the DXE load has completed.
Configuring your Debug Configuration:
When debugging an application that has booted from flash, you want to avoid some of the options above. The important steps are to ensure that you enable the "Load Symbols Only" option, and disable the "Reset Core before load" option. Here are example steps to create a suitable debug configurationt:
- Open CrossCore Embedded Studio and go to ‘Run’->’Debug Configurations’
- Click on the “New launch configuration” button, or right click on “CrossCore Embedded Studio Application’ and select ‘New’.
- In the Session Wizard, select the 'Processor Family' and 'Processor Type' that match your target.
- On the next page, select either "EZ-KIT Lite" or "Emulator", depending on what you are using. If you use an emulator, the next page will let you select your specific target/emulator.
- Once the Session Wizard is complete, and you are back at the "Debug Configurations" window, you need to set up the "Program(s) to Load" settings.
- For each Core/Processor that you need to load a DXE to, click on the core/processor and select "Add". Browse to the DXE you need to load and select it.
- Disable the "Reset Core Before Load" option
- Enable the "Load Symbols Only" option
When you launch your Debug Configuration, the symbols (global data and function names) will be loaded, but your application will not be re-loaded or interrupted. You can then halt the target and inspect the disassembly to determine where your application is. If your DXE was built with Debug Information, you may also have source-level debugging available.
You can also debug the entire execution of your application (rather than just 'breaking in' at whatever its current PC may be, as above) by putting the following instruction at the start of your code or kernel/init code, or the start of your application, and build an LDR. This instruction will cause the processor to loop at the start of the application.
[SHARC] : JUMP(PC,0);
[Blackfin]: JUMP 0;
1. build a loader file with the kernel/init code/application dxe built with the above instruction inserted.
2, Flash the code onto your board using the Command Line Device Programmer.
3. Boot the code by pressing reset on the board.
4. Open the CrossCore Embedded Studio and connect to your Debug Configuration set up as above
In the disassembly window the program counter will be looping at the jump(pc,0) - or jump 0 - instruction. Replace the jump(pc,0) - or jump 0 - with a 'nop' instruction in the disassembly window and you can now step through your kernel/init code/application as required.