This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC43X example_SafetyLib and SL_REG_INIT_VAL

Other Parts Discussed in Thread: HALCOGEN

When following the steps in the HALCoGen example example_SafetyLib.c for the TMS570LC43x,

You get compiler errors on sl_asm_api.asm,

C:/ti/Hercules/SafeTI Diagnostic Library/2.2.0/safety_library/source/sl_asm_api.asm", ERROR! at line 333: [E0001] Undefined symbol
MOV R0, #SL_REG_INIT_VAL

line 333 and further, because #SL_REG_INIT_VAL id unknown

This is because the instructions in the HALCoGen help file say:

Add the following macros (without quotes) as predefined symbols to the project (Project Properties->CCS Build->ARM Compiler->Advanced Options->Predefined Symbols):

  • "_TMS570LC43x_" (or "_RM57Lx_" based on the device)
  • "_VFP_SUPPORT_=1"
  • "EXTERNAL_SP_INIT"

And then, sl_config.h in the safety library 2.2.0 says:

#ifndef EXTERNAL_SP_INIT
/**
* @defgroup config_group configuration items for SafeTI™ Hercules™ Diagnostic library
* configuration items for the SafeTI™ Hercules™ Diagnostic library
*/
#define SL_REG_INIT_VAL 0u
/** \defgroup grp_armmodes Stack Size for various ARM modes

So, the define of EXTERNAL_SP_INIT in the project properties causes that SL_REG_INIT_VAL will not get defined (#ifndef),

and compilation fails.

I have temporary resolved this adding this additional define in the project props (Project Properties->CCS Build->ARM Compiler->Advanced Options->Predefined Symbols):

SL_REG_INIT_VAL=0u