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.

RM44L920: Implementing Safety Diagnostic Library to the project with bootloader

Part Number: RM44L920
Other Parts Discussed in Thread: HALCOGEN

Tool/software:

Hi,

I’m trying to integrate the Safety Diagnostic Library (SDL) into an existing project that already has a bootloader. The bootloader is based on TI's uart bootloader example. I’d appreciate some guidance on best practices for implementing SDL in this setup.

  1. Is it necessary to implement SDL in both the bootloader and the main application, or is it sufficient to add SDL to just one of them?

  2. Documentation or Examples: Are there any resources, guides, or examples that cover this type of SDL integration in projects with a bootloader? I was not able to find any.

Thanks in advance for any advice or insights.

  • Hi llija,

    (+) SAFETI_DIAG_LIB: Guidance on integration SafeTI library with a bootloader - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    There is no special guidance or document for integrating SDL to the application.

    You can refer the existing SDL examples and can do it in the same way.

    You can either use part of the routines or complete SDL based on your application requirements.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Your answer is quite general, I’ve seen similar answers before on forum, and they don’t address the question in detail. I haven’t found any specific guidance on implementing SDL with a bootloader.

    Could you answer a more specific question about SDL integration? In the bootloader, I have a sys_startup.c file generated by HalCoGen, which is similar to the one in the main project. I’ve implemented sys_startup.c according to the SDL demo example. Do I need to make adjustments in the bootloader's startup routine? Specifically, should I modify or comment out parts related to reading the reset reason, performing initialization functions, or running PBIST in the bootloader?

    Any detailed guidance on handling these parts when SDL is integrated with a bootloader setup would be very helpful.

    Thanks & regards,
    Ilija.

  • Hi Ilija,

    All we have is SDL demos only. 

    Even i will refer the SDL demos codes and answer according to it. My suggestion would be that please refer SDL demo project and create your project in according to it. If you face any difficulty in achieving this then i will work from my side and will provide suggestions.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    I implemented my sys_startup.c file as per the SDL demo application. Everything works fine when the bootloader is not flashed before the main application. However, when the bootloader is present, my main application gets stuck in the following exception handler, with the R14 (undef) register showing 0x00060004, which is not a valid memory address:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    #ifdef __TI_COMPILER_VERSION__
    #pragma INTERRUPT ( _excpt_vec_udef_instr, UDEF)
    void _excpt_vec_udef_instr()
    #endif
    #ifdef __IAR_SYSTEMS_ICC__
    __irq __arm void _excpt_vec_udef_instr()
    #endif
    {
    while(1);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I traced the issue in debug mode and found that it occurs after the _SL_Kickoff_STC_execution() function is called as part of SL_SelfTest_STC(STC_COMPARE_SELFCHECK, TRUE, &stcSelfTestConfig).

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    if (RESET_TYPE_DEBUG == reset_reason)
    {
    /* Make sure that the CPU self-test controller can actually detect a fault inside CPU */
    stcSelfTestConfig.stcClockDiv = 0; /* STC Clock divider = 1 */
    stcSelfTestConfig.intervalCount = 1; /* One interval only */
    stcSelfTestConfig.restartInterval0 = TRUE; /* Start from interval 0 */
    stcSelfTestConfig.timeoutCounter = 0x1; /* Timeout counter*/
    _SL_HoldNClear_nError();
    /* mask vim interrupts before running STC */
    vimREG->REQMASKCLR0 = 0xFFFFFFFFu;
    vimREG->REQMASKCLR1 = 0xFFFFFFFFu;
    vimREG->REQMASKCLR2 = 0xFFFFFFFFu;
    vimREG->REQMASKCLR3 = 0xFFFFFFFFu;
    /* ensure no pending ESM GRP2 errors before running STC */
    if(esmREG->SSR2 == 0u)
    {
    //! Executes CPU Logic Built-In Self Test using Self-Test Controller
    SL_SelfTest_STC(STC_COMPARE_SELFCHECK, TRUE, &stcSelfTestConfig);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Could this issue be related to the reset_reason value? Is it possible that the bootloader alters the reset reason or interferes with the STC initialization?

    Any insights into why this might be happening and whether additional steps are needed in the bootloader or main application to handle this scenario would be greatly appreciated.

    Thanks & regards,

    Ilija.

  • Hi Ilija,

    Could this issue be related to the reset_reason value? Is it possible that the bootloader alters the reset reason or interferes with the STC initialization?

    Actually, bootloader will erase the reset cause, i found this in one of my old threads:

    (+) TMS570LC4357: freertos bootloader application getting problem in I2C - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    Please refer above thread and based on this try to do modifications.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    I have already implemented this in my startup code. I called systemInit(), _coreEnableIrqVicOffset_(), vimInit(), esmInit() before main().

    Here is my application startup code:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /** @file sys_startup.c
    * @brief Startup Source File
    * @date 11-Dec-2018
    * @version 04.07.01
    *
    * This file contains:
    * - Include Files
    * - Type Definitions
    * - External Functions
    * - VIM RAM Setup
    * - Startup Routine
    * .
    * which are relevant for the Startup.
    */
    /*
    * Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com
    *
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Do I need to comment out erasing of the SYS_EXCEPTION in the bootloader ?

  • Hi ,

    Apologies for the delay in late response, i was stuck with other issues.

    Do I need to comment out erasing of the SYS_EXCEPTION in the bootloader ?

    Maybe you could try this.

    Personally, i never tested _SL_Kickoff_STC_execution API with both bootloader and application.

    --
    Thanks & regards,
    Jagadish.