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.

TMS570LC4357: STC self-test restart Issue

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Hi,

I am executing code to run the STC module self test based on the SafeTI library (based means technically the same here :)).

After encountering some issues to make the WFI instruction to reset the MCU, following this other thread solved the issue by clearing the A bit at begining of the program.

Now the problem is that after the CPU restarts ,and therefore the program starts executing from the entry point, that entry point's first instruction triggers a data abort exception.

So I have two main concerns here:

  •  Why the instruction is triggering a data abort after reset (caused by STC self test) and not triggering it in the first execution?
  • I can force the PC (by manually editing it in the debug session) to execute the next instruction and then the program executes normally.

The entry point is shown in the next snapshot and the instruction in question can be seen in the disassembly with a breakpoint (the push instruction).

Any help is very appreciated.

Thanks in advance.

  • Hi Guillermo,

    Can you please share your project or else at least a simple project with the issue you are talking about?

    This would be helpful for me to debug the issue at my end.

    You can also do a private message with project.

    --
    Thanks & regards,
    Jagadish.

  • Thanks a lot Jagadish.

    I have PM you with a simplified project showing the issue.

    Kind regards.

  • Hi,

    I was just wondering if there is any update on this issue.

    Thanks and kind regards.

  • Hi, 

    Researching this problem a bit more I think I have discovered the reason.

    The next image shows the entry point and the correspondant assembly instruction during  a normal power up.

    And some registers are shown next ( to observe the stack pointer).

    After the reset caused by executing the STC self test, the stack pointer shows:

    So my guess is that the data abort is caused due to that the push instruction fail to save context in that SP address. Which is reasonable as that address does not belongs to RAM memory (it belongs to a reserved region according to the TRM).

    The stack pointer is initialized soon after that instruction but obviously the code never reaches it.

    I have tried to add the inline attribute to the core init function (void _coreInitStackPointer_(void) __attribute__ ((naked, always_inline)); ) in order to avoid to have to save context before executing it. 

    But it seems there is some kind of conflict as the compiler says ( ) though I have not been able to find the noinline attribute anywhere (neither in the properties of the project nor in the code itself).

    Any idea or help will be much appreciated.

    Regards.

  • Hi Guillermo,

    Good to hear that you find the root cause.

    Regarding inline, can you try as below:

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    Originally, in the code generated by Halcogen I mean, those functions have the attribute "naked" which seems to be causing a compiler warning when adding the inline directive (same problem if trying to add the "always_inline" attribute).

    Suppressing the "naked" attribute lead to a "declared but not defined" warning.

    If ignoring the warning, program behavior is still the same, and the assembly code at the beginning still has the push instruction (showed in previous post) which is the one provoking the data abort and the one I am trying to get rid off.

    I have also tried to add asm instruction right in the entry point to fix "manually" a value for the SP. But still the aforementioned push instruction is placed first by the compiler and so it still leads to data abort after STC cause the reset. 

    Note: SW resets or any other resets work properly. Problems seems to come only from the STC reset that is causing an abnormal value in the SP register.

    Any idea to fix this is well appreciated :).

    Regards.

  • Hi Guillermo,

    I created one example project for STC on bare metal can you please verify whether it is useful?

    Please refer latest comment in below thread:

    (+) TMS570LC4357: WFI-Instruction not starting LBIST or interconnect self-test - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    --
    Thanks & regards,
    Jagadish.