USBDM (JMxx Version) V4.9

Codewarrior - Eclipse V10.1

Using the New Project Wizard to create a Project with USBDM support

USBDM is now fully supported by the Codewarrior New Project Wizard. The following shows the required initial steps of creating a USBDM project using the wizard.

  • Start the wizard from the pop-up menu in the Project Explorer window or from the main Menu, for example New->Bareboard Project.
  • Choose a suitable name for the project.
  • Select the target device or board for development.
  • Select the USDBM connection and any other connections required.

The remaining pages of the Wizard are independent of the target connection and allow a range of options and alternative for the project. If only a basic project is needed it is sufficient to click Finish now. This will create a new project with a Remote System connection for USBDM.
It may be desirable to change some of the default settings to suit your BDM. This will be the case if you wish to trim the target clock or use the power supply features of the BDM. The following section describes the USBDM specific settings available.

The Remote System dialogue for USBDM may be accessed in two ways (that I know of!):

  • Locate the connection in the Remote Systems tab which is usually one of those at the bottom of the Eclipse Workspace: There will be a line for each remote entry in the the workspace. Note that it possible to share these systems between different projects but they must have the same target device. For the example created above, this Remote System will be called MyFirstUSBDMProject_MC9S08AC128_USBDM.
  • Alternatively, locate the connection through the debug settings for the project:

To view the USBDM Debug Options select the Debug Configuration at the left and then click on the Edit button in the Remote Settings area.


The various options are discussed in the following sections

Some of the following options may be absent from the dialogue for a particular target.
Some options may have no effect depending upon the hardware capabilities of the BDM interface connected during the actual debugging session.

Common options

  • Connection Name: An arbitrary name used to identify this target connection.
  • Description: Descriptive text - change as desired to describe the connection.
  • System type: This identifies the target device e.g. MCF51CN128 etc
  • Connection type: This allows selection between all the connections available for the device chosen above.
    The USBDM connections available are:
    • USBDM RS08 Interface
    • USBDM HCS08 Interface
    • USBDM Coldfire V1 Interface
    • USBDM Coldfire V2,3,4 Interface
    • USBDM ARM interface
3. NewDebugConfiguration_Debugger_Connection_Common.png

Options for RS08, HCS08 and Coldfire V1 targets only.

Some of the following options may be absent from the dialogue for a particular target.
Some options may have no effect depending upon the hardware capabilities of the BDM interface connected during the actual debugging session.

3. NewDebugConfiguration_Debugger_Connection_HCS08_V10_1.png

Preferred BDM - Allows selection of preferred BDM when multiple are connected when launching a debug session

3. NewDebugConfiguration_Debugger_Connection_Preferred_BDM.png
  • Refresh - This may be used to scan for connected BDMs.

  • BDM Selection drop-down box - This displays the serial numbers of the connected USBDM-BDMs. It is useful if each BDM has a unique serial number as that will allow the automatic re-selection of the same BDM on the next session.
    If the BDM does not support the required target then a suitable message replaces the serial number. Communication problems will also cause an informative message.
    You may select a preferred BDM from those currently connected. This BDM will be given preference when launching a new debugging session. If not found then the first suitable BDM will be used instead without any prompting. If you have no preference or are only using a single BDM then select the Any Connected USBDM option.

  • BDM Description - Also displayed is the BDM Description obtained from the BDM firmware.

Target Vdd Supply - Enables supply of Target Vdd from the USBDM module

3. NewDebugConfiguration_Debugger_Connection_Target_Vdd.png
  • Off, 3.3V or 5V - Controls voltage supply to target through BDM Vdd connection.

  • Cycle target Vdd on reset - This option will cause the BDM to cycle the target power as part of the reset sequence.

  • Cycle target Vdd on connection problems - This option will cause the BDM to cycle the target power when it is having trouble connecting to the target.

  • Leave target powered on exit - The target Vdd supply will be left on when exiting the debugger.

Connection Control

3. NewDebugConfiguration_Debugger_Connection_Connection_Control.png
  • Automatically re-connect - The existing TBDML code appears to have problems debugging a target when the target clock speed is changed. The option causes the BDM to continuously update the interface speed to prevent loss of communication in this case.

  • Drive RESET signal - Many of the target microcontrollers do not have a dedicated reset signal. This is not a problem as it is possible to reset the target using the BKGD mode commands through the BDM interface. However, the RESET signal on the BDM interface will often still be connected to the Reset signal of the processor. This option allows the BDM to monitor and control the RESET signal when appropriate.

BDM Clock Select

3. NewDebugConfiguration_Debugger_Connection_BDM_Clock_Select.png
  • Some targets provide an alternative BDM clock selection which may be at a lower speed that the default. This can have advantages when connecting to high speed targets (mostly of use in the JB16 version). There may be other requirements before the alternative clock will be used.
    • Default - Use whatever is the default BDM clock source
    • Bus Clk/2 - The BDM clock is derived from the target Bus Clock. Note that this means that the connection speed may vary when the target clock configuration changes.
    • Alt - Use whatever is the Alternative BDM clock source. This varies with the target device.

Internal Clock Trim

3. NewDebugConfiguration_Debugger_Connection_Internal_Clock_Trim.png
  • Trim Frequency - If the check box is selected then the target chip's internal clock source will be trimmed to the given frequency and the trim parameters programmed to nonvolatile memory.
    Note that the value given is for the target clock - NOT the target bus clock. See the documentation for the stand-alone Programmers for a more complete discussion of the use of the clock modules.
    The FTRIM value will be combined with the flash image value if not 0xFF.
    Setting a Trim Frequency of 0 will cause a chip-dependent default to be used.

  • Nonvolatile TRIM Address - The address of the non-volatile flash locations to program the clock trim parameters to. Freescale has nominated particular locations to be used. It is (usually) the responsibility of the reset code programmed in the chip to copy these values to the clock registers upon reset.
    Setting a Trim Address of 0 will cause a chip-dependent default to be used.

Erase Options

3. NewDebugConfiguration_Debugger_Connection_Erase_Options.png

This option controls how the device is erased before programming. Not all options will be available with a every target type.

  • None - The device will not be erased. This is only useful if the device is blank in the regions to be programmed.
  • Mass - A mass erase/unsecure operation will be done using a target specific unsecure method. This may also involve programming of default security information. This method is applicable to a secured device. Please refer to the Flash programming manual for more details.
  • All - All flash or EEPROM regions will be erased using individual mass erase operations as needed. This is similar to the above but is done by executing a program on the target so it not applicable to a secured device.
  • Selective - Only modified sectors or pages of the Flash or EEPROM will be erased as needed. Note that the sector containing the security information will be erased and re-programmed in any case to ensure the device is unsecured for debugging.


3. NewDebugConfiguration_Debugger_Connection_Miscellaneous.png
  • Mask interrupts when stepping (HCS08 only) - This option allows the single stepping of the target without entry to pending interrupt routines. If this option is not selected then stepping may result in movement to the 1st instruction of the pending interrupt routine - usually not desired. This function is achieved by setting the I-bit in the CCR before each step and restoring the original value afterwards. I have tried to check for all special case instructions (e.g. SEI or CLI) and I believe this option is safe to use. Note that execution of a WAIT instruction will always cause entry to pending interrupt routines.

Common Options
  • Restore Default - Returns the dialogue to default values.

This completes the setting up of a launch configuration . You may proceed directly to debugging with the Debug button or just Close the dialogue.

Later debugging sessions may be started by selecting the Launch configuration directly from the debug drop-down menu.
7. Launch Debugger.png


  • When connecting with the target you may be prompted to cycle the target power.
    Simply turn off and turn on the target power and then press Retry to continue. The Target BKGD pin will be held low while doing this.
    This is useful for difficult HCS08 targets that may not respond to software reset when in certain modes. For example, this may occur when a blank chip has a COP timeout or some times when the processor clock is suspended. Another case would be if the BKGD pin can be programmed as an general purpose I/O pin.
  • After the initial connection with the target, you may be prompted to supply power to the target. This means that the BDM has detected that the target has no supply.
  • The following dialogue is used to alert you to a supply overload when using the internal BDM power supply. It is likely that the target is taking more current than the BDM can supply (~100 mA but depends on the regulator used). This prompt may also appear if the target supply is momentarily shorted. The BDM detects this situation and removes the target supply until a new debugging session is started.

Manually Creating a Launch Configuration for USBDM

Since USBDM is now supported by the Codewarrior New project Wizard the following process is no longer necessary. It is included as a reference to what the various setting do rather than as a necessary process.

The following describes manually creating a custom Debug Launch Configuration. The configuration can then be used to launch a debug session.

The following outlines the steps required to create the Debug Launch Configuration. This should be read in conjunction with the Codewarrior V10 quickstart manual. It is assumed that a suitable application has been created beforehand.

The following example is for a Coldfire V1 device. The settings for a RS08 or HCS08 device would be almost identical. The required changes are indicated where appropriate.

Programming the flash of Coldfire V2,3,4 devices is not supported so some sections are not appropriate to those devices. It is necessary to program the device using the Flash programmer before debugging or as a autorun task setup as part of the Debug Launch Configuration.

Select an existing application to configure for debugging.
1a. Select Project.png
Open the Debug Configuration Dialogue by selecting Run->Debug Configurations... from the menu or clicking on the small arrow to the right of the debug icon. The dialogue shown below will open:
1a. NewDebugConfigurationMenu.png
2a. NewDebugConfiguration(New).png
Make sure Codewarrior Download is selected in the panel at left and then click the New button/icon to create a new empty configuration. This configuration will be partially completed providing you have selected an existing application at the first step above.
2b. NewDebugConfiguration(New)_V10_1.png
Check the dialogue contents and rename the launch configuration if desired e.g. add the USBDM suffix as a reminder that this configuration is intended for the USBDM debugger..
Click on the New Button in the Remote System area
Select Hardware or Simulator in the
dialogue as shown and Click Next
Set up the following option:
  • Connection name:
    Choose a suitable name for the Connection.
  • Description:
    Choose a suitable description for the Connection.
  • System type:
    Choose the appropriate device - in this case a MCF51CN128.
  • Select the appropriate USBDM connection from the Connection type: drop-down box. This will be one of
    • "USBDM RS08 Interface"
    • "USBDM HCS08 Interface"
    • "USBDM Coldfire V1 Interface"
    • "USBDM Coldfire V2,3,4 Interface".
  • The dialogue will update to show options specific to the USBDM interface.

    You can complete the USBDM Specific remainder of the dialogue as described earlier.

    Select OK to save the changes and return to the launch configuration.
6. NewDebugConfiguration_Debugger_Coldfire_V10_1.png

Programming Options for RS08, HCS08 or Coldfire V1

These option should already have been set correctly by the New Project Wizard.

Select the Debugger and then the Download tab and modify the contents as shown below :
(Make sure Execute Tasks is unselected.)
5. NewDebugConfiguration_Debugger_Download_HCS08.png
The USBDM GDI dll has a built in flash programmer that handles the programming of the target non-volatile memory (in RS08, HCS08, CFV1 and Kinetis targets).
The options selected cause USBDM to program the target on initial download with a new debug session but not to re-program if the debugger session is re-started. This prevents the Flash from being needlessly re-programmed.
The verify options may be selected but USBDM already verifies programming so this is unnecessary. Also, it is possible for the Codewarrior verify to fail as USBDM may modify the data programmed to the target memory to support trimming of the target clock or disabling target security to allow debugging.