Project

General

Profile

DSP / ARM Hello World

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 CL Linux Virtual Machine has all the necessary files pre-loaded):
    • 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:
      • 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.
      • 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 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 - CCSv7.3 on Linux (Unified VM)

Setup

As of February 2018 the Critical Link Unified VM (https://support.criticallink.com/redmine/projects/arm9-platforms/wiki/Linux_Build_VM) will come with Code Composer Studio v7.3.0 and dependencies already installed.

The MDK root directory (i.e. <MDK> ) is '/home/mitydsp/MDK_2014-01-13'.

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 Target (right-most drop-down) to 'Generic C674x Device'
  • Set 'Compiler version:' to 'TI v7.4.23'
    • If that option does not exist, you'll need to add it...
    • Select 'More' then 'Add...'
    • Navigate to '/opt/ti/ti_cgt_c6000_7.4.23'
    • In the 'Discovered tools:' > 'C6000' list, select 'TI v7.4.23'
    • Select 'OK'
  • Expand the 'Advanced settings menu':
    • Set 'Output type:' to 'Executable'
    • Set 'Output format:' to legacy COFF
    • 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 'Add Files...', navigating to the cpp file, then selecting 'OK'
  • Create a DSP/BIOS Configuration file
    • Delete any created tcf file for the hello example. "hello.tcf"
    • Left-click the project to highlight it
    • 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 - then select 'OK'
    • Select criticallink.platforms.MityDSP-L138 (Description = 'MityDSP-L138 (300 MHz)')
    • Click 'Finish'
    • Close and ignore the error 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/
      

  • 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}" 
        "${MITYDSPL138_SW_LIB}/TILibs" 
        

  • 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 the directory containing criticallink/platforms/MityDSP-L138/Platform.tci
      "${MDK}/sw/DSP/templates"
    • 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
    • Select 'Project' > 'Build All' or 'Build Project'
  • Copy the built executable from the CCS project (i.e. "HelloDSP.out") to the MityDSP-L138
    • The file is located in the /home/mitydsp/workspace_v7/HelloDSP/Debug/ directory unless a non-default workspace was specified in CCS
    • 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.

Binary message template

If you would like to use a binary message type instead of string, see below for example.

DSP Binary message template

CCS_new_proj.png View (41 KB) Gregory Gluszek, 12/17/2010 11:50 AM

CCS_NewBios1.5.png View (13.8 KB) Gregory Gluszek, 12/17/2010 11:51 AM

CCS_NewBios1.png View (46.5 KB) Gregory Gluszek, 12/17/2010 11:51 AM

CCS_NewBios2.png View (16 KB) Gregory Gluszek, 12/17/2010 11:51 AM

dsp_main.cpp View (4.6 KB) Gregory Gluszek, 06/30/2011 02:41 PM

dsp_main.cpp View (4.54 KB) Gregory Gluszek, 08/19/2011 03:15 PM

newCCSAdvanced.PNG View (34.5 KB) Eric Nagy, 03/06/2012 03:14 PM

projTemplates.PNG View (61.6 KB) Eric Nagy, 03/06/2012 03:14 PM

ubuntuBuildVars.PNG View (98.5 KB) Eric Nagy, 03/06/2012 03:47 PM

ubuntuDirSettings.PNG View (106 KB) Eric Nagy, 03/06/2012 03:47 PM

ubuntuLibSettings.PNG View (111 KB) Eric Nagy, 03/06/2012 03:47 PM

ubuntuMiscSettings.PNG View (112 KB) Eric Nagy, 03/06/2012 03:47 PM

main_dsp.cpp View (4.54 KB) Eric Nagy, 03/13/2012 09:37 AM

CCS_buildvars.PNG View (46.2 KB) Eric Nagy, 03/13/2012 10:39 AM

CCS_fsp.PNG View (105 KB) Eric Nagy, 03/13/2012 10:39 AM

CCS_genOpts.PNG View (95.8 KB) Eric Nagy, 03/13/2012 10:39 AM

CCS_incOpts.PNG View (93.4 KB) Eric Nagy, 03/13/2012 10:39 AM

Makefile (952 Bytes) Gregory Gluszek, 04/18/2013 05:24 PM

ccs53_new_project1.png View (106 KB) Jonathan Cormier, 06/20/2013 04:03 PM

ccs53_new_project2.png View (68 KB) Jonathan Cormier, 06/20/2013 04:03 PM

ccs53_new_project3.png View (85.6 KB) Jonathan Cormier, 06/20/2013 04:03 PM

ccs53_properties_1.png View (85.2 KB) Jonathan Cormier, 06/20/2013 04:06 PM

ccs53_properties_2.png View (63 KB) Jonathan Cormier, 06/20/2013 04:06 PM

ccs53_properties_3.png View (78.9 KB) Jonathan Cormier, 06/20/2013 04:06 PM

ccs53_properties_4.png View (66.2 KB) Jonathan Cormier, 06/20/2013 04:06 PM

ccs53_new_bios1.png View (94.5 KB) Jonathan Cormier, 06/20/2013 04:07 PM

ccs53_new_bios2.png View (37.6 KB) Jonathan Cormier, 06/20/2013 04:07 PM

ccs53_new_bios3.png View (42.9 KB) Jonathan Cormier, 06/20/2013 04:07 PM

arm_main.cpp View - Updated to remove delete statements until they can be fixed. (3.51 KB) Jonathan Cormier, 06/24/2013 08:41 AM

arm_main.cpp View (3.51 KB) Jonathan Cormier, 06/24/2013 08:53 AM

ccs73_new_bios1.png View (47.5 KB) James Haller, 11/02/2017 09:11 PM

ccs73_new_bios2.png View (19.5 KB) James Haller, 11/02/2017 09:11 PM

ccs73_new_bios3.png View (24.1 KB) James Haller, 11/02/2017 09:11 PM

ccs73_new_project1.png View (51.6 KB) James Haller, 11/02/2017 09:11 PM

ccs73_new_project2.png View (50.1 KB) James Haller, 11/02/2017 09:11 PM

ccs73_new_project3.png View (66.1 KB) James Haller, 11/02/2017 09:11 PM

ccs73_properties_1.png View (74.8 KB) James Haller, 11/02/2017 09:11 PM

ccs73_properties_2.png View (51.2 KB) James Haller, 11/02/2017 09:11 PM

ccs73_properties_3.png View (70 KB) James Haller, 11/02/2017 09:11 PM

ccs73_properties_4.png View (57.7 KB) James Haller, 11/02/2017 09:11 PM

Add picture from clipboard (Maximum size: 2 GB)