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 Bootloader Jump to Application

Other Parts Discussed in Thread: HALCOGEN, TMDX570LC43HDK, TMS570LS3137, TMS570LC4357

Hi,

I'm having issues running my application from bootloader with the HalcoGen startup code.

The bootloader and application are separate projects each with there own Halcogen configuration and each run fine standalone.

When the application code is programming with the bootloader before running it the bootloader verifies the flash to prove the Linker CRC of the application is correct so I know the application is not corrupt.

The initial jump to the start of the application _c_int00() from the bootloader works and stepping through the disassembler I found a system reset occurs in the Halcogen code at __TI_auto_init().

I created a basic rtiBlinky project which I have attached to demonstrate the issue of the _c_int00() function being called a second time which replicates jumping to an application from booloader.

Running the project the first time simulates being in the bootloader and the LED will be blinking, by pressing the GIOA7 pushbutton on the TMDX570LC43HDK the code will then jump to the _c_int00() function and run the Halcogen initialisation again to simulate running the application startup. The LED then stops blinking and the code gets stuck in a never ending loop of resets every time  __TI_auto_init() is called.

I have tried various initialisations in the Reset handler switch statement to see if this resolves the issue but with limited success.

Please help explain why calling the HalcoGen _c_int00() function multiple times causes the system resets?

Kind regards,

Stu6136.rtiBlinky.zip

  • I have not had a chance to reproduce this yet, but the startup code was not designed to be run from anywhere but reset.
  • Hi Bob,

    I have never had an issue before when I wrote a bootloader and application for the TMS570LS3137 based on exactly the same principle.
    It is only since porting to the TMS570LC4357 that I've had problems.

    Kind regards,
    Stu
  • OK, I traced what is happening. When you run through _c_int00 the second time, the code does a switch on the reset source, but there is no valid reset source. The default case it to do nothing. The stack pointer, which was cleared earlier by _coreInitRegisters_() is not initialized. In __TI_auto_init() the code pushes several registers to stack, but the stack pointer is not pointing to ram. You get a reset.
  • I added a call to _coreInitStackPointer_() in user code section 21 of HL_sys_startup.c. That seems to fix this problem. I will suggest a change to HALCoGen to put the stack pointer initialization after the register initialization outside of the CASE statement.

            default:
    /* USER CODE BEGIN (21) */
                /* Initialize Stack Pointers */
                _coreInitStackPointer_();
    /* USER CODE END */
    

  • Thanks Bob.

    This looks like it works. I have apply this to both the bootloader and application HL_sys_startup.c code and it now looks like I have stable operation.
    I agree it would be a good suggested change to the HALCoGen code to prevent others getting tripped up by the same issue.

    Thanks again
    Stu