Build and run SDK example on codewarrior

Install CodeWarrior

Take below codewarrior specific combination as example

  • CodeWarrior Development Studio v11.2 + CodeWarrior for DSC v11.2 SP1 (Service Pack 1)

Steps to install codewarrior

  • Download CodeWarrior for DSC v11.2, and ServicePack1 for DSC devices from CodeWarrior for 56800 Digital Signal Controller v11.2.

  • Install CodeWarrior for DSC v11.2

  • Install ServicePack1 within CodeWarrior from the menu. Click the Help menu -> select Install new software -> Add -> Archive -> select the downloaded SP1 -> open -> check MCU v11.2 DSC Service Packs -> click Next.

NOTE

  • Codewarrior for DSC only support windows.

  • Please check board release note for specific requirement of codewarrior and service pack version.

Build an example application

To build the hello_world example application, perform the following example steps:

  1. Launch CodeWarrior and in the workspace launcher, choose a workspace which holds the projects to use. If the dialogue box does not pop up, enter a workspace folder and create one workspace.

    Then the CodeWarrior Development Studio workspace with empty projects appears.

  2. Import the project into the workspace. Click Import project in the Commander pane. A form pops up. Click Browse to the SDK install directory. Take TWR-MC56F8400 SDK as an example, all available demo projects are shown. Select the hello_world project in the list and click Finish.

    NOTE

    • If you already know the project location, navigate to the folder when clicking Browse, and only one project can be seen. To locate most example application workspace files, use the following path

      <install_dir>/boards/<board_name>/<example_type>/<application_name>/codewarrior
      

      Take TWR-MC56F8400 SDK as an example, the hello_world workspace is located in

      <install_dir>/boards/twrmc56f8400/demo_apps/hello_world/codewarrior
      
  3. Select the desired build target from the drop-down menu. For this example, select hello_worldflash_sdm_lpm_debug

  4. To build the demo application, click Build (All) in the Commander pane.

  5. The build completes without errors.

Board debugger setup

Board debugger info:

  • Default debugger is OSJTAG.

  • Onboard debugger USB port is J8, which set the debugger and COM port.

  • Onboard debugger firmware update jumper is J6.

To download and run the application, perform the following steps:

  • Connect USB cable between the host PC and the debugger USB port.

  • Install the debugger driver and USB CDC driver as PC hint if it is the first time you run it on the PC. The debugger and USB CDC driver are provided by CodeWarrior by default.

  • The CodeWarrior may prompt to update the debugger firmware, which requires to connect the firmware update jumper on board and then follow the instruction by CodeWarrior to finish the firmware update.

Run an example application

To download and run the application, perform the following steps:

  1. Open the terminal application on the PC, such as PuTTY or TeraTerm, and connect to the debug COM port (see How to determine COM port). Configure the terminal with these settings:

    • 115200, defined by BOARD_DEBUG_UART_BAUDRATE in the board.h file

    • No parity

    • 8 data bits

    • 1 stop bit

  2. For this example(TWR-MC56F8400 hello_world), click Debug in the Commander pane, and select the hello_world_flash_sdm_lpm_debug_OSJTAG launch configuration. Then the application is downloaded onto target board and automatically runs to the main() function.

    Note:

    • Generally there are four build configurations for DSC SDK examples: flash_sdm_lpm_debug, flash_sdm_lpm_release, flash_ldm_lpm_debug, and flash_ldm_lpm_release.

      • *_debug: uses optimization level 1

      • *_release: uses optimization level 4

      • sdm: small data memory model

      • ldm: large data memory model

      • lpm: large program memory model

    • Select corresponding launch configuration based on build target and debugger type.

    • Some examples may require specific hardware settings, check each demo readme document, which includes detail instructions for HW and SW settings.

  3. To run the code, click Run on the toolbar.

  4. The hello_world application is now running and a banner is displayed on the terminal.