NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

Integration of HALCoGen with Hercules SafeTI Diagnostics Library

From Texas Instruments Wiki
Jump to: navigation, search

!!!!! WORK In Progress - This WIKI page is NOT Complete !!!!!



Hardware Abstraction Layer (HAL) is the lowest software layer. It contains software modules with direct access to MCU and is responsible for system initialization. HALCoGen allows users to generate these HAL device drivers for Hercules™ safety critical microcontrollers. Simple GUI helps in configuring and generating the microcontroller abstraction layer including the safety related functions.

Hercules SafeTITM Diagnostics Library

The Hercules SafeTI™ Diagnostic Library is a collection of software functions and response handlers for various safety features of the Hercules Safety MCUs. The Hercules SafeTI Diagnostic Library runs in the context of the caller's protection environment and all responses are handled in the context of interrupt or exception.

Purpose of this Wiki Page

Problem Statement

Both Hercules SafeTITM Diagnostics Library and HALCoGen Supports Safety Diagnostics functions like LBIST, Memory BIST, RAM Test, Selftest modes etc, so

  • Question 1 : Why SafeTITM Diagnostics Library?
Answer : SafeTITM Diagnostics Library development initially started to provide recommended safety software support for Hercules safety MCU customers who does not use
HALCoGen in their development. From overwhelming response from customers SafeTITM Diagnostics Library was made as standalone product supporting all Hercules Safety
MCU's. Similar to HALCoGen SafeTITM Diagnostics Library followed ASILD / SIL3 software development process. TI provides SafeTITM Diagnostics Library in the form of
a library and also source files for maximum flexibility to customers.
  • Question 2 : Which of these routines that TI recommends customer to use?
Answer : HALCoGen Safety function was developed long before SafeTITM Diagnostics Library was available. So for legacy reasons HALCoGen still supports these 
safety functions with respect to boot code. There is still a need to evaluate run time and periodic needs for diagnostic execution according to the application
specific FTTI requirements. Each customer is encouraged to evaluate the specific needs of their project in regard to their Safety Requirements and development
schedules and although it is not a requirement for system certification, the use of the SafeTITM Diagnostics Library can aid in time to market since many of
the safety mechanisms described in the device specific safety manuals are implemented in the SafeTITM Diagnostics Library. This allows for a faster understanding
of the diagnostic measures as well as faster implementation in the application level code.
  • Question 3 : Can customer use both HALCoGen and SafeTITM Diagnostics Library?
Answer : Yes. This wiki page walk's through the steps to use HALCoGen and SafeTITM Diagnostics Library together.

Download Links

HALCoGen :
SafeTITM Diagnostics Library :

Note: HALCoGen Installer is bundled with SafeTITM Diagnostics Library Installer too.

Installation Paths

HALCoGen : c:\ti\Hercules\HALCoGen\<vxx.yy.zz>
SafeTITM Diagnostics Library : c:\ti\Hercules\SafeTI Diagnostic Library\<x.y.z>

HALCoGen Configuration

In all the steps below are explained with RM46x device. Same procedure is applicable to all Hercules devices. The aim is to use Safety Functions from SafeTITM Diagnostics Library not from HALCoGen.

Step 1 : Deselecting HALCoGen's Safety Diagnostics Features

In HALCoGen goto --> SAFETYINIT TAB --> Uncheck all except checks under Power Management Module as shown in the figure below.

Step 2 : Code Generation

Generate Code

SafeTITM Diagnostics Library Configuration

SafeTITM Diagnostics Library can be used as Library or direct source. When customer chooses to use SafeTITM Diagnostics Library file directly with HALCoGen they must regenerate the library. The default library files that comes with the standard SafeTITM Diagnostics Library installer is build with EXTERNAL_SP_INIT = 0, i.e., stack pointer is initialized by SafeTITM Diagnostics Library. But for this demonstration we want HALCoGen to do stack pointer initialization hence rebuild SafeTITM Diagnostics Library with option EXTERNAL_SP_INIT = 1.

When customer chooses to use the SafeTITM Diagnostics Library source files directly can skip to CCS Project Settings section directly.

Below steps will help in building the SafeTITM Diagnostics Library that can be added to customers CCS project to be used linked along with HALCoGen source files.

Step 1 : Finding the build project

Currently SafeTITM Diagnostics Library supports following device families, In order to regenerate the library for the respective device family customer can use the respective CCS project file provided under folder C:\ti\Hercules\SafeTI Diagnostic Library\x.x.x\build.

Device Family Symbol
TMS570LC43x _TMS570LC43x_
RM57Lx _RM57Lx_
TMS570LS31x _TMS570LS31x_
TMS570LS12x _TMS570LS12x_
RM48x _RM48x_
RM46x _RM46x_
RM42x _RM42x_
TMS570LS04x _TMS570LS04x_

Step 2 : Building the project

  • Add the following macros (without quotes) as predefined symbols to the project (Project Properties->CCS Build->ARM Compiler->Advanced Options->Predefined Symbols):
     - "_RM46x_" ( Respective Device Symbols must be used)
     - "_VFP_SUPPORT_=1"
  • Configure the sl_config.h file if needed. Refer the SafeTITM Diagnostics Library user guide for more configuration options.
  • Build the project to get

CCS Project Settings



  1. Hercules Microcontrollers