Project

General

Profile

DSP / ARM Hello World CCS 5.5

We recommend utilizing Code Composer Studio 7 as documented in this wiki

This guide will step you through setting up your MityDSP-L138 system and build environment so that you can run a hello world program on both the DSP and ARM which sends a message, "Hello DSP", from the DSP to the ARM processor. This uses the dsplink driver for inter-processor communications:

ARM received a message from the DSP:
        DSP Message = "Hello Word. DSP Received Message = 'Hello DSP'" 

Prerequisites

  • Make sure your system and build environment are setup to run a Hello World program on the ARM side.
  • Make sure your MityDSP-L138 module has the latest Kernel and Filesystem to match the MDK you are using
  • Make sure that you have the necessary library and include files from Critical Link:
    • The 2014-01-13 MDK, which can be downloaded from the Files section on this site.
      • If you are registered and logged in, there should be a "Files" tab at the top of this page.
      • Note: If you are having trouble installing the MDK see this post.
      • To install the MDK on a Windows machine (for using CCS on the windows machine), you should use cygwin to install the .run file to an appropriate directory.
      • You will need to set up your environment variables to point to this MDK directory.
    • On your Linux Virtual Machine provided by Critical Link you will need:
      • attachment:arm_main.cpp - Hello World code for the ARM ($MDK/examples/DspHelloWorld/ARM/)
      • dsplinkk.ko - Can be found in the latest MDK release ($MDK/images/modules/) or you can rebuild DSPLink. See details at DSP Link Configuration.
      • dsplink.lib - Can be found in the latest MDK release ($MDK/lib/ARM/Release/) or you can rebuild DSPLink. See details at DSP Link Configuration.
      • libdsp.a and libdsp.so.* - Can be found in the latest MDK release ($MDK/lib/ARM/Release/) or you can rebuild the libdsp library.
      • attachment:main_dsp.cpp - Hello World code for the DSP ($MDK/examples/DspHelloWorld/DSP/HelloWorldDSP/)
      • dspcore.lib, dsplink.lib, etc. - Can be found in the latest MDK release ($MDK/lib/DSP/Release)
      • Platform.tci - Can be found in the latest MDK release ($MDK/sw/DSP/templates/criticallink/platforms/MityDSP-L138/)
    • SYS/BIOS must be installed before Code Composer Studio (If you are using the 2018 Virtual Machine image this is already installed)
      • SYS/BIOS version 5.42 is the version on the unified VM. Other versions of SYS/BIOS have not been tested.
      • SYS/BIOS installers can be found on the TI downloads site

Compiling for the ARM

This process documents how to compile/build the application for the ARM processor (arm_main.cpp)

  • Download and utilize the attachment:Makefile if you prefer to work from the command line.
  • Add the arm_main.cpp file to the project
    • This can be accomplished by simply moving the file to the project's directory and refreshing the project.
    • This can also be accomplished by importing the file. See Help - Eclipse SDK for details.
  • Set up Build Variables
    • In project properties, under 'C/C++ Build' click on 'Build Variables'
    • Click 'Add...' and type variable name, Check "Apply to all configurations", set 'Type' to 'Directory', enter path and click 'Ok'
    • Add the paths shown in the following image
Variable Name Type Value
MDK Directory ${HOME}/MDK_2014-01-13
LIBARM Directory ${MDK}/lib/ARM/Debug
LIBDSP Directory ${MDK}/sw/ARM/linux/libdsp

  • Note: As you follow through this guide, please follow closely the use of quotations when using build variables. Differing use could lead to build errors which are difficult to diagnose.
  • Add the path to $MDK/sw/ARM/linux/libdsp to the include path
    • In project properties, under 'C/C++ Build' click on 'Settings'
    • Under the 'Tool Settings' tab, expand 'Cross G++ Compiler' and click on 'Directories'. Called 'Includes' in some versions.
    • Click the Add button and enter the path to "${MDK}/sw/ARM/linux/libdsp" or "${LIBDSP}" if defined build variables
  • Link against the libdsp and libpthread libraries
    • In project properties, under 'C/C++ Build' click on 'Settings'
    • Under the 'Tool Settings' tab, expand 'Cross G++ Linker' and click on 'Libraries'
    • In the 'Libraries (-l)' window pane use the add button to add 'dsp' and 'pthread'
    • In the 'Library search path (-L)' window pane add the path to "${MDK}/lib/ARM/Release" or "${LIBARM}" if defined build variables
  • Link against dsplink.lib
    • In project properties, under 'C/C++ Build' click on 'Settings'
    • Under the 'Tool Settings' tab, expand 'Cross G++ Linker' and click on 'Miscellaneous'
    • In the 'Other objects' window pane click add and add the path to "${MDK}/lib/ARM/Release/dsplink.lib" or "${LIBARM}/dsplink.lib" if defined build variables
  • Build the project.
  • Copy libdsp.so.* to the MityDSP-L138
    • Copy the library ($MDK/lib/ARM/Release/) to the /lib directory
    • See Starter Guide for details on copying files to the MityDSP-L138
  • Copy the built ARM executable from the CCS/Eclipse project (i.e. "HelloWorldDSP") to the MityDSP-L138
    • If CCS on the VM was used with the default workspace the file can be found in the /home/mitydsp/workspace_v7/HelloWorldDSP/Debug/ directory
    • See Starter Guide for details on copying files to the MityDSP-L138

Compiling for the DSP - CCSv5.5 on Windows

Setup

Please note that the Code Composer Studio section in which the DSP code will be built applies to, and was originally performed on, a Windows PC.
It is possible to install Code Composer on the linux VM. See Installing CCS5 for L138 DSP for details.

  • Install Code Composer Studio v5.5 on your PC.
    • Installer can be download here

Create a new CCS project

  • File->New->CCS Project
    If CCS Project isn't listed, check under Other -> Code Composer Studio.
  • Give the project a name
  • Set 'Output type:' to 'Executable'
  • Set 'Device Family:' to C6000
  • Set 'Device Variant:' to 'Generic devices' followed by 'Generic C674x Device'
  • Expand the 'Advanced settings menu':
    • Set 'Device endianness' to 'little'
  • Expand 'Project templates and examples':
    • Inside 'DSP/BIOS v5.xx Examples' open up 'evmOMAPL138 Examples' and select 'hello example'
  • Click 'Finish'
  • Delete the hello.c file that was auto-generated when the project was created by right clicking the file within your project in the 'Project Explorer' and selecting 'Delete'
  • Add the main_dsp.cpp file to the project. <MDK>/examples/DspHelloWorld/DSP/HelloWorldDSP/main_dsp.cpp
    • This can be accomplished by copying main_dsp.cpp to the project directory
    • This can also be accomplished by right clicking on the project and selecting 'Link Files to Project...' or 'Add Files to Project...'
  • Create a DSP/BIOS Configuration file
    • Delete any created tcf file for the hello example. "hello.tcf"
    • File->New->DSP/BIOS v5.x Configuration File
      • Note: If 'DSP/BIOS v5.x Configuration File' is not an option, you will need to select 'Other...' and search for 'bios'
    • Click 'Next' on the window that pops up (default name is fine)
    • Click Modify
    • Browse to the directory which contains Platform.tci. <MDK>/sw/DSP/templates
    • Select criticallink.platforms.MityDSP-L138 (Description = 'MityDSP-L138 (300 MHz)')
    • Click 'Finish'
    • Save and close the window that pops up

Add environment variables which point to the necessary libraries for the DSPL138/EDMA3 (Suggested)

  • Note: Please be careful where and when you use quotes around path names, especially if you are using Macros
    • Quotes will be required if a path name has a space in it (otherwise it will be read as two separate paths by the compiler).
    • However, you should only encase the actual include specification in quotes and not the macro itself.
    • Here's an example of what can go wrong:
      • You create a Environment Variable ${MDK} = "c:/my work/MDK"
      • You specify a search path as "${MDK}/sw/DSP/templates"
      • However, this derefences to ""c:/my work/MDK"/sw/DSP/templates" where the quotes are no longer surrounding the space in your path name
  • Right click on project and select 'Properties'
  • Click on 'Build'
  • Click on the 'Environment' tab
  • Add variables - relevant paths are shown in the picture below
    • If using the MDK the header files should be stored in ${MDK}/sw/DSP/lib and the libraries should be stored in ${MDK}/lib/DSP
    • Depending on where the EDMA package (downloaded as a prerequisite) installed, your TI_EDMA3 path may differ
      MDK <dir to MDK>
      MITYDSPL138_LIBDBG ${MDK}/lib/DSP/Debug
      MITYDSPL138_SW_LIB ${MDK}/sw/DSP/lib
      TI_EDMA3 ${MDK}/sw/3rdparty/edma3lld_01_11_00_03/packages/
      

    • Click apply
  • Specify the project Include Options
    • Right click on the project and select 'Properties'
    • Expand 'Build'
    • Expand 'C6000 Compiler' and select 'Include Options'
    • Add the appropriate directories, or the Environment Variable(s) you created in the above step (i.e. "${MityDSPL138_LIBDBG}"), to the Include Options. Note quotes are important.
      "${MITYDSPL138_LIBDBG}" 
      "${MITYDSPL138_SW_LIB}" 
      "${TI_EDMA3}" 
      "${TI_EDMA3}/ti/sdo/edma3" 
      

  • Specify the linking options
    • Right click on the project and select 'Properties'
    • Expand 'Build'
    • Expand 'C6000 Linker' and select 'File Search Path'
    • In the "Include library file or command file as input (--library, -l)" pane, add the following:
      • "dspcore.lib"
      • "edma3_drv_bios.lib"
      • "edma3_drv_bios_sample.lib"
      • "edma3_rm_bios.lib"
      • "dsplink.lib"
      • "dsplinkdata.lib"
      • "dsplinkmpcs.lib"
      • "dsplinkmplist.lib"
      • "dsplinkmsg.lib"
      • "dsplinknotify.lib"
      • "dsplinkpool.lib"
      • "dsplinkringio.lib"
    • In the "Add <dir> to library search path (--search_path, -i)" pane, add the directories, or Environment Variable(s) created above, that contain the above libraries
      • These libraries are located in ${MDK}/lib/DSP/Debug or ${MDK}/lib/DSP/Release if you are pulling them from the MDK (shown using the "${MityDSPL138_LIBDBG}" Environment Variable)
        "${TI_EDMA3}/ti/sdo/edma3/drv/sample/lib/omapl138/Debug" 
        "${TI_EDMA3}/ti/sdo/edma3/rm/lib/omapl138/Debug" 
        "${TI_EDMA3}/ti/sdo/edma3/drv/lib/Debug" 
        "${MITYDSPL138_LIBDBG}" 
        "${MITYDSPL138_SW_LIB}" 
        

  • Specify the location of ${MDK}/sw/DSP/templates directory, where the criticallink/platforms/MityDSP-L138/Platform.tci file is located:
    • Right click on the project and select 'Properties'
    • Expand 'Build'
    • Expand 'TConf' and select 'General Options'
    • Set to the path to the location of ${MDK}/sw/DSP/templates on your machine, which contains contains criticallink/platforms/MityDSP-L138/Platform.tci
    • Note: you must specify the location of the ${MDK}/sw/DSP/templates directory and not any deeper as the criticallink/platforms/MityDSP-L138/ path is expected in parts of the build process.

Final steps

  • Build the project
  • Copy the built executable from the CCS project (i.e. "HelloWorldDSP.out") to the MityDSP-L138
    • See Starter Guide for details on copying files to the MityDSP-L138

Running the ARM/DSP programs

  • Insert (insmod) the DSPLink drivers
    root@mityomap# insmod /lib/modules/$(uname -r)/extra/dsplinkk.ko
    
    • The pre-built MityDSP-L138 MDK filesystems include the dsplinkk.ko driver. If missing you can copy and/or rebuild the driver from the MDK
      • The pre-built copy is located in the $MDK/images/modules/ directory
      • See Starter Guide for details on copying files to the MityDSP-L138
  • Execute the ARM (HellowWorldDSP) and DSP (HellowWorldDSP.out) programs
    root@mityomap# ./HelloWorldDSP HelloWorldDSP.out
    
  • Example output
    root@mityomapl138:~# ./HelloWorldDSP HelloWorldDSP.out
    Loading file HelloWorldDSP.out
    PROC Load successful
    Starting application.
    ARM received a message from the DSP:
            DSP Message = "DSP Initialization finished." 
    Sending a message to the DSP.
    Waiting for DSP response (type 'q' to quit)...
    ARM received a message from the DSP:
            DSP Message = "Hello Word. DSP Received Message = 'Hello DSP'" 
    Exiting application.
    

Note: There is currently a bug in the destructors of ipc_inbound and ipc_outbound that cause assert statements to get hit. The delete statements have been skipped as a way of removing the error messages. This is a decent solution for now as most applications shouldn't need to be shutdown and restart large numbers of times.

Go to top
Add picture from clipboard (Maximum size: 1 GB)