Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Creating new CCS v5 Project with HALCoGen

From Texas Instruments Wiki
Jump to: navigation, search

Introduction

Hercules family of devices has a very peculiar way of performing code development, as it heavily relies on the HALCoGen tool that is external to Code Composer Studio, therefore if you intend to create and use a HALCoGen project with CCSv5 this page is for you.

IMPORTANT! The procedure shown below is also applicable to CCSv6 releases, with just minor differences in some screenshots. also, the short video below shows the whole process.





Software used


References


Procedure

The steps below show a practical way to create a HALCoGen project and use it inside CCSv5. The idea is to create a type of "Hello world" example project that uses the UART instead of the standard console. The board used is a TMS570LS31x HDK with a built-in XDS100 JTAG emulator.

  • The video shows that the mentioned board connects the MCU's SCI to the USB. If you instead use a TMS570LS12x LaunchPad, it is the SCI2/LIN that is connected to USB (change the setting in HALCoGen, the main function is not affected).
  • The video shows that the board is connected via a Spectrum Digital XDSPRO USB Emulator. If you instead use the probe integrated in the TMS570LS12x LaunchPad, it is the Texas Instrument XSD110 USB Debug Probe (found as a name of a serial connection in the Windows Device Manager).


Due to the structure of both tools, the flow is somewhat convoluted: first create an empty project in CCSv5 then create a project in HALCoGen, but using the CCSv5 project directory as the placeholder. This way the CCSv5 project will contain all the generated files and will also allow for it to pick up any changes done to the original HALCoGen project (add peripheral configurations, for example).
If you happened to create the HALCoGen project without first creating the CCS project, it is still possible to later create the CCS project and simply copy the HALCoGen source files into the CCS project folder. However, in this case if modifications are done to the HALCoGen project and code is re-generated, it will not get automatically picked up by the CCS project.

IMPORTANT! if modifications are done to the HALCoGen project and code is re-generated, the tool will automatically overwrite the file that contains the main() routine (also called <sys_main.c>).


1. Create an Empty CCS project (no main, no hello world). Check section 6.1 of the CCSv5 Getting Started Guide referenced above for details.

Fig. 1: CCS project options

2. Start up HALCoGen, go to menu Help → Help Topics, open the "Examples" section and select the "example_sci_uart_9600.c". Follow the instructions on that help page to create the HALCoGen project for the example_sci_UART_9600 and set the destination directory the same as the CCS Project. Don't forget to disable the directory creation option or the files will be placed in a subdirectory.

Fig. 2: HALCoGen project options

3. With all the code generated from the HALCoGen tool, the files "magically" show up in the CCS project. At this point it is necessary to add the generated "include" directory to the compiler options, so the compiler is able to "see" the include files from HALCoGen. Right-click on the project, then select Properties → Build → ARM Compiler → Include Options and add the relative path as shown below:

Fig. 3: CCS compiler options
  • Well, "PROJECT_ROOT" didn't worked for me (may be one of the CCS v5-v6-differences?). I clicked on the [Workspace...] button in the [Add...] dialog, navigated to the include directory, and got "${workspace_loc:/${ProjName}/include}".

4. Click OK to close all the project properties and build the project (either using the little hammer button or menu Project → Build Project).

Debugging

In order to debug the project it is necessary to configure, connect, load code to the board and have a terminal program to see the output.

1. Create a Target Configuration with the emulator and device used and launch the debugger - check section 6.2 of the CCSv5 Getting Started Guide referenced above for details.

Fig. 4: CCS target configuration options

2. Launch the debugger through the green bug button and the project is halted in main(). In order to see the output via UART (the TMS570LS31x HDK has a built-in USB-serial port), a terminal program must be used (TeraTerm, Putty, etc.). CCSv5 comes with such program built-in: simply go to menu View → Other... then type "Terminal" to find the proper tool. (its default settings as shown below work fine with the project, but the COM port number may change depending on your system)

Fig. 5: terminal configuration options

3. Run the code (F8). A continuous stream of data should show up in the terminal screen.

Fig. 6: code running






Hercules Training References