Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-10547

IAR stack pointer not set by startup code causes IAR-compiled binaries not to load using CCS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • TI Device Drivers
    • TIDRIVERS-5008
    • TIDRIVERS_5_50_02
    • TIDRIVERS_5_70_00
    • All

      We manually set the stack pointer in GCC startup files, and rely on the compiler start routines to set the stack pointer for ARM and LLVM. TIRTOS6 and TIRTOS7 also have their own copies of the startup code that overwrite c_int00 and set the stack pointer.

      This leaves IAR as the odd one out, which can cause the stack pointer to be incorrect when loading IAR binaries with CCS. See the linked issue for more details.

      To rectify this, we will need to modify all the startup_xxx_iar.c files for nortos and freertos:

      • Replace __iar_program_start with a new ResetISR function in the vector table
      • ResetISR must set MSP to STACK_TOP, which is already externed in that file
        • We can do this with intrinsics or with inline assembly
      • ResetISR then calls __iar_program_start and normality resumes

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: