NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Migrating a TI-RTOS project to a custom development board

From Texas Instruments Wiki
Jump to: navigation, search

This migration guides describes the steps involved to port an existing TI-RTOS project (such as an example project) to custom development/production board.

TI-RTOS projects are easily modified to accommodate custom development/production boards. Each TI-RTOS project has a set of board files that configure and initialize TI-RTOS drivers which are named (by convention) after the development board. By simply configuring a few specific files, the porting process from one development board to another is straight forward. Before continuing, it's recommended to create a copy of the CCS project as a backup.

Backup the original CCS project[edit]

  • Clean the TI-RTOS project. Right-click on the project and select Clean Project.
  • Create copy of original. Right-click on the project select Copy.
  • Right-click in the Project Explorer window and select Paste.
  • Give you project a new name of your choosing. For the remaining portion of the documentation references to this new name is referred as Project.

Modify the board files[edit]

Within Project you will find a set of files that need to be modified for your port.

  • Board.h
  • <dev board name>.h
  • <dev board name>.c
  • <dev board name>.cmd

It's recommended to rename the files with the <dev board name> file names with the name chosen for Project. For example EK_TM4C123GXL.h, EK_TM4C123GXL.c, and EK_TM4C123GXL.cmd would be renamed to Project.h, Project.c, and Project.cmd. During the process of renaming the board files you will also have to update the #include and other #define directives and function names as necessary. Board.h also contains definitions that need to be updated.

For full details on what these files are for, see the TI-RTOS User's guide. From a high-level perspective these files serve the following functions:

File Purpose
Board.h This file used by TI-RTOS examples to abstract Board_ definitions. Depending on your setup, you may not need this file.
Project.h Development board's .h file. This file contains the enum statements that dictate on how many peripheral instances are to be statically allocated in the application.
Project.c Development board's .c file. This file contains the initialization code that is specific to the peripherals used by Project.
Project.cmd Development board's linker command file.

The following steps guide you through the migration:

Update Project.h[edit]

Open Project.h and update the enum definitions to allocate the desired number of peripheral instances needed for your application. This applies for each TI-RTOS driver in Project.h.

<syntaxhighlight lang='c'> /*

*  @def    Project_I2CName
*  @brief  Enum of I2C names on the Project dev board
*/

typedef enum Project_I2CName {

   Project_I2C1 = 0,
   Project_I2C3,
   Project_I2CCOUNT

} Project_I2CName; </syntaxhighlight>

Update Project.c[edit]

Open Project.c and make the necessary updates that reflect your custom development board. The following code block shows a board configuration for a TI-RTOS I2C driver for Tiva devices.

<syntaxhighlight lang='c'>

  1. if TI_DRIVERS_I2C_INCLUDED
  2. include <ti/drivers/I2C.h>
  3. include <ti/drivers/i2c/I2CTiva.h>

/* I2C objects */ I2CTiva_Object i2cTivaObjects[Project_I2CCOUNT];

/* I2C configuration structure, describing which pins are to be used */ const I2CTiva_HWAttrs i2cTivaHWAttrs[Project_I2CCOUNT] = {

   {I2C1_BASE, INT_I2C1},
   {I2C3_BASE, INT_I2C3},

};

const I2C_Config I2C_config[] = {

   {&I2CTiva_fxnTable, &i2cTivaObjects[0], &i2cTivaHWAttrs[0]},
   {&I2CTiva_fxnTable, &i2cTivaObjects[1], &i2cTivaHWAttrs[1]},
   {NULL, NULL, NULL}

};

/*

*  ======== Project_initI2C ========
*/

Void Project_initI2C(Void) {

   /* I2C1 Init */
   /* Enable the peripheral */
   SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
   /* Configure the appropriate pins to be I2C instead of GPIO. */
   GPIOPinConfigure(GPIO_PA6_I2C1SCL);
   GPIOPinConfigure(GPIO_PA7_I2C1SDA);
   GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
   GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
   /* I2C3 Init */
   /* Enable the peripheral */
   SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);
   /* Configure the appropriate pins to be I2C instead of GPIO. */
   GPIOPinConfigure(GPIO_PD0_I2C3SCL);
   GPIOPinConfigure(GPIO_PD1_I2C3SDA);
   GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
   GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);
   I2C_init();

}

  1. endif /* TI_DRIVERS_I2C_INCLUDED */

</syntaxhighlight>

Examine the custom development board's schematics and adjust the code snippet in your Project.c to accommodate the changes needed. This process needs to be performed for each TI-RTOS driver you plan to use in your application.

The Driver_config[] data structure configures TI-RTOS drivers as documented in the TI-RTOS User's guide and init_Driver function addresses changes may include but items such as:

  • Peripheral power-up requirements
  • Peripheral pin assignments
  • Pad configurations
  • Pin [Un]Locking

Update Project.cmd[edit]

TI-RTOS examples provide a linker command file as part of the board files. These linker command files are taken from example TI-RTOS kernel projects and/or taken from TI-Ware specific examples (MSP430Ware, TivaWare, MWare, etc...).

Rebuild Project[edit]

The last step is to Rebuild and debug Project.
Tirtos porting rebuild.jpg

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Migrating a TI-RTOS project to a custom development board here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Migrating a TI-RTOS project to a custom development board here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Migrating a TI-RTOS project to a custom development board here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity