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.

TMS320F28379S: TMS320F28379S: Cannot execute program after execution with different entry point

Part Number: TMS320F28379S
Other Parts Discussed in Thread: CONTROLSUITE

Almost same issue as described https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/758274/tms320f280049-cannot-execute-program-after-execution-with-different-entry-point.

When the image is OK:

  1. Successfully write image into MCU via CCS
  2. Successfully boots by debugger
  3. Powered off
  4. Powered on, then MCU still boots successfully

When the image is NG

  1. Successfully write image into MCU via CCS
  2. Successfully boots by debugger
  3. Powered off
  4. Powered on, then MCU cannot boot

Here are my codes. Please notice that line GPIO_WritePin(GPIO_PIN_DEBUG_LED0, LOW). When this line is commented out, the image is OK. But, when we keep that line, then the image is NG.

set_buzzer_aiming_delkey_fan(false, false, true, true, 200, 200);
sleep(3);
GPIO_WritePin(GPIO_PIN_DEBUG_LED0, HIGH);
set_buzzer_aiming_delkey_fan(false, true, false, true, 10000, 10000);
sleep(3);
GPIO_WritePin(GPIO_PIN_DEBUG_LED0, LOW);
set_buzzer_aiming_delkey_fan(true, false, true, true, 15000, 15000);
sleep(1);
GPIO_WritePin(GPIO_PIN_DEBUG_LED0, HIGH);
GPIO_WritePin(GPIO_PIN_DEBUG_LED1, HIGH);
set_buzzer_aiming_delkey_fan(false, true, true, true, 20000, 20000);
sleep(1);
// GPIO_WritePin(GPIO_PIN_DEBUG_LED0, LOW);
set_buzzer_aiming_delkey_fan(true, false, true, true, 25000, 25000);
sleep(1);
I notice the address of entry point for OK image is even number, while the address of entry point for NG image is odd number.
ENTRY POINT SYMBOL: "_c_int00" address: 00094a48 // OK
ENTRY POINT SYMBOL: "_c_int00" address: 00094a4f // NG
Furthermore, I follow up previous thread to disable Watch dog in /Applications/ti/controlSuite/device_support/F2837xS/v210/F2837xS_common/source/F2837xS_CodeStartBranch.asm, then the address of entry point is still 0x00094a4f, but it can boot successfully (after powered off and on).
Here are my development environment
  • CCS 10.1.0.00010
  • Toolchain: TI v18.1.4.LTS
  • ControlSuite: /Applications/ti/controlSuite/device_support/F2837xS/v210/F2837xS_common
  • BTW, here are the codes for F2837xS_CodeStartBranch.asm

    ;//###########################################################################

    ;// $TI Release: F2837xS Support Library v210 $

    ;// $Release Date: Tue Nov  1 15:35:23 CDT 2016 $

    ;// $Copyright: Copyright (C) 2014-2016 Texas Instruments Incorporated -

    ;//             http://www.ti.com/ ALL RIGHTS RESERVED $

    ;//###########################################################################

    ***********************************************************************

    WD_DISABLE  .set  1    ;set to 1 to disable WD, else set to 0

        .ref _c_int00

        .global code_start

    ***********************************************************************

    * Function: codestart section

    *

    * Description: Branch to code starting point

    ***********************************************************************

        .sect "codestart"

    code_start:

        .if WD_DISABLE == 1

            LB wd_disable       ;Branch to watchdog disable code

        .else

            LB _c_int00         ;Branch to start of boot._asm in RTS library

        .endif

    ;end codestart section

    ***********************************************************************

    * Function: wd_disable

    *

    * Description: Disables the watchdog timer

    ***********************************************************************

        .if WD_DISABLE == 1

        .text

    wd_disable:

        SETC OBJMODE        ;Set OBJMODE for 28x object code

        EALLOW              ;Enable EALLOW protected register access

        MOVZ DP, #7029h>>6  ;Set data page for WDCR register

        MOV @7029h, #0068h  ;Set WDDIS bit in WDCR to disable WD

        EDIS                ;Disable EALLOW protected register access

        LB _c_int00         ;Branch to start of boot._asm in RTS library

        .endif

    ;end wd_disable

        .end

  • Hi,

    Furthermore, I follow up previous thread to disable Watch dog in /Applications/ti/controlSuite/device_support/F2837xS/v210/F2837xS_common/source/F2837xS_CodeStartBranch.asm, then the address of entry point is still 0x00094a4f, but it can boot successfully (after powered off and on).

    Once you disable the WD, code always works. Is that correct ? If yes then we suggest to keep the WD disable and enable in your main application and make sure to service it with in it's TIMEOUT period. 

    Regards,

    Vivek Singh

  • Hi Vivek,

    Thanks for feedback. We will try your suggested way to enable WD in our main application.

    But, be curious, why different address (especially odd number of address) can make WD timeout? All of those codes (F2837xS_CodeStartBranch.asm, boot28.asm) are from TI CodeSuite. We didn't modify them... Can you share more insights about odd address issue for entry point?

    My wild guess is that boot28.asm tries to initialize memory map, interrupt vector based on the address of entry point, and some of the memcpy/memset operations need to be word aligned, 16 bits... Then, odd address would make mis-alignment issue, and then jump to wrong address of main()...

    Br,

    Yagamy

  • Hi,

    But, be curious, why different address (especially odd number of address) can make WD timeout?

    May be I misunderstood this. I thought even with same odd address as entry point, if you disable the WD, it works fine. Is that not the case ? 

    Regards,

    Vivek Singh

  • Your understandings are correct. Let me organize what we've tested:

    1. WD disabled, odd address as entry point => OK
    2. WD disabled, even address as entry point => OK
    3. WD enabled, odd address as entry point => NG
    4. WD enabled, even address as entry point => OK

    My question is that, why 4 can work but 3 cannot work. In my codes, when I just add one line of function call to GPIO_WritePin, that increases that object file 4 bytes, then it makes linker to rearrange object files and finally place EntryPoint _c__init00() to an odd address.

    Although I can always disable WD in F2837xS_CodeStartBranch.asm to make situations only 1 and 2, but I still want to learn more why 4 can work but 3 cannot work because we need to make technical explanations to our customer to ease their concerns to disable WD in F2837xS_CodeStartBranch.asm.

    They think, disabling WD is workaround, and there must be some side-effects if we don't know the true root-cause. They can accept the workaround if the root-cause is one of following reasons:

    • odd number as entry point address, as Errata of F28379S
    • known issue in toolchain, either assembler, linker, or compiler
    • known issue in ControlSuite

    Br,

    Yagamy

  • I don't think it has anything related to entry point because if that is causing issue then WD disable will not help. I think it's because of addition of the code which is causing WD to timeout. My guess is that once you add that line, for some reason it's increasing the execution time before WD get disable and that is enough for WD to time out. You can profile you code execution from entryPoint _c__init00() to function in main() which disables the WD in both case using CCS and see if there is any difference. 

    Regards,

    Vivek Singh

  • Could you please guide me how to profile code execution from entryPoint to main()?

    BTW, our program also disables WD at very early stage of main() execution. It looks like:

    void main() {

        InitSysCtrl(); /* from F2837xS_SysCtrl.c */

        ...

    }

    void InitSysCtrl(void) {
        //
        // Disable the watchdog
        //
        DisableDog();
        ...
    }

    You can see watch dog is disabled at very early stage since executing main(). The implementation of _c_init00() is from TI. We didn't modify it. Why does the execution of _c_init00() take longer time to trigger WD when we just increase 4 bytes (by adding a function call) in the object files?

  • HI,

    Please refer this E2E post for code profiling.

    BTW, our program also disables WD at very early stage of main() execution. It looks like:

    Yes, that is what I mentioned in my earlier post. When you add few line of code, the execution time for reaching to the application code which disables the WD is a bit longer hence WD times out. Please note that we have full cinit code which gets executed before CPU jumps to main application. 

    Regards,

    Vivek Singh