I've loaded my program onto Flash, and now I would like to debug with HPUSB-ICE attached to my BF533 target board. How can I do this?
Debugging an application which boots from Flash on your target board is relatively simple with an EZ-KIT session, as we offer a 'Boot Load' option within VisualDSP++ which will reset the target EZ-KIT so it starts running from Flash, allowing debugging of the application as with debugging an executable (DXE). This option is only for EZ-KIT Lite via Debug Agent platforms, and is available via 'Settings'->'Boot Load'.
If the target is a custom target board, you need to configure the way in which VisualDSP++ connects to your target, to ensure that when VisualDSP++ does connect to your board it does not reset the processor.
There are three different Initial Connection Settings available:
*Halt and Reset: (Default)
This is the standard Connection Setting used for hardware targets in VisualDSP++. Once the IDDE connects to the target it halts the processor, and performs a Core Reset. Note that after a Core Reset, Boot does not start automatically. This setting is not suitable for debugging a target booting from Flash.
This Connection Setting will simply halt the target processor once VisualDSP++ connects to your board. It does not perform and additional actions, so code which has booted from flash can be resumed using the 'Debug'->'Run' command.
*Do Not Disturb:
This Connection Setting will allow VisualDSP++ to establish a connection with your target board, but will perform no further actions. Any code booting from flash will run uninterrupted until any debug commands are issued from the IDDE. This setting is not suitable for BF561 Targets, the VisualDSP++ IDDE will simply issue a halt if this setting is chosen.
Configuring the Platform:
The Initial Connection Settings are configured via the settings for your 'Platform', which can be modified/created within the Configurator. Below is an example for configuring a single BF533 Target:
- Open VisualDSP++, go to 'Session'->'New Session' and click "Configurator". Alternatively, this can be accessed from the Windows Start Menu via 'Start'->'Programs'->'Analog Devices'->'VisualDSP++'->'VisualDSP++ Configurator'.
- Click on the "New" button or, from the 'Platform Templates', double-click on an existing platform similar to your target if one exists (the processor can be changed when configuring the platform).
- First, enter a suitable name for your target within the 'Platform' section. e.g. "BF533 via HPUSB-ICE Halt only".
- Still within the 'Platform' section, select the appropriate Emulator for your connection from the 'Type' drop-down menu. Note that the 'Device ID' in the 'Emulator Settings' section should be set to "0" for the USB-ICE and HPUSB-ICE. The default JTAG I/O Voltage is "3.3/5".
- Now, double click on "Device 0" in the 'Devices'. This will open the Device Properties window, so select your processor from the 'Type' drop-down list, if it is not already populated correctly.
- You will now see that you can set the 'Initial Connection Options' to 'Halt then Reset', 'Halt' or 'Do Not Disturb'.
- For a target which is booting from Flash, you will want to choose either 'Halt' or 'Do Not Disturb' for your connection, as described above. Choose 'OK'.
- Click 'OK' to close the Configurator and you will return to the 'New Session' wizard.
- Your platform will now be available to connect to under the "Emulator" sessions for the appropriate Processor Family and Target Processor. For our example, it would be available via 'Blackfin'->'Emulator'->'BF533 via HP-USB-ICE Halt only'. This time, the 'Halt' or 'Do Not disturb' setting will ensure that the device is not reset when VisualDSP++ connects to it, allowing the Application to execute from flash, and debug of its execution.
Further details regarding configuring the platform can be found in the VisualDSP Documentation at 'Help'->'Contents'->'Graphical Environment'->'Emulation Tools'->'VisualDSP++ Configurator'.
Debugging the Application:
Actually debugging the application, albeit possible, is not fully featured. Firstly, 'C' level debugging is not possible, as only assembly level single stepping can be used. Secondly, breakpoints will not be available for code which resides in flas; only hardware breakpoints can be used. Even with these restrictions, it is possible to view memory and registers from flash exactly as though it were internal memory. To view Debug Symbols, you will need to choose 'File'->'Load Symbols', and select your application's DXE file.
Another way to debug the application is to put following instruction at the start of your code or kernel/init code, and create the kernel dxe with this code. This insruction will cause the processor to loop at the start of the application.
[Blackfin]: JUMP 0;
1. build a loader file with the kernel/init code dxe built above.
2, Flash the code onto your board using a flash programmer. Close VisualDSP++.
3. Boot the code by pressing reset on the board.
4. Open the VisualDSP++ with a new session having the processor in HALT state.
5. Open the VisualDSP++ session created above. Load symbols from the kernel project.
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.