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.

Compiler/TMS570LS0914: Application interrupt don't work with bootloader

Part Number: TMS570LS0914


Tool/software: TI C/C++ Compiler

Hello,

in my current project i need to implement a bootloader. The bootloader is at the beginning of the flash. If an update of the application is not necessary the bootloader starts the application at address 0x41000.

So far the application is called by the bootloader as expected but behaves different than if programmed without bootloader at address 0x00.

Therfore i debugged the application in bootloader configuration(Startaddress 0x41000).

The problem occures if the code run into an undefined instruction, an software interrupt, an prefetch abort or an data abort.

In case i simulated one of these faults, the wrong interruptaddress is called.

The expected address is:

Application's linker file:

/*----------------------------------------------------------------------------*/
/* Memory Map                                                                 */

MEMORY
{
#if defined(BOOTLOADER_ACTIVE)
    VECTORS (X)  : origin=0x00041000 length=0x00000030
#else
    VECTORS (X)  : origin=0x00000000 length=0x00000030
#endif
    SOFTWAREINFOS	(RW)  : origin=0x000040000 length=0x0000800 // Zweiter Sektor, Aktualisiere die Softwareinformationen, wie CRC
    SOFTWAREINFOSBOOT (RW) : origin=0x000040800 length=0x0000800 // Aktualisiere die Softwareinformationen für den BOOTLOADER
    KERNEL  (RX) : origin=0x00041030 length=0x00009600
    FLASH0  (RX) : origin=0x00050630 length=0x000B59D0
    STACKS  (RW) : origin=0x08000000 length=0x00002000
    KRAM    (RW) : origin=0x08002000 length=0x00000800
    BSSRAM  (RW) : origin=0x08002800 length=(0x00007000 - 0x00002800)
    DATARAM (RW) : origin=0x08007000 length=0x00000100
    RAM	  (RW) : origin=0x0800A000 length=(0x0001F000 - 0x0000A000)
}

/*----------------------------------------------------------------------------*/
/* Section Configuration                                                      */


SECTIONS
{

    .TI.crctab :  {}  > SOFTWAREINFOS/* The CRC tables generated by the linker are created in the special section .TI.crctab */
    .intvecs : {} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO) > VECTORS
    /* FreeRTOS Kernel in protected region of Flash */
    .kernelTEXT   : {} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO) > KERNEL
    .cinit        : {} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO) > KERNEL
 /*   .pinit        : {} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO) > KERNEL */
    /* Rest of code to user mode flash region */
    .text         : {} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0
    .const        : {.econst = .;} palign=8, crc_table(app_crc_table, algorithm=TMS570_CRC64_ISO),  > FLASH0
    .softwareinfos_str : {} > SOFTWAREINFOSBOOT

    /* FreeRTOS Kernel data in protected region of RAM */
    .kernelBSS    : {} > KRAM
    .kernelHEAP   : {} > RAM
    .bss          : {} > BSSRAM
    .data         : {} > DATARAM

	.sysmem : {} > RAM
}

Application's sys_intvecs.asm file:

;-------------------------------------------------------------------------------
    .sect ".intvecs"
    .arm

;-------------------------------------------------------------------------------
; import reference for interrupt routines

    .ref _c_int00
    .ref vPortSWI
    .ref _dabort
    .ref phantomInterrupt
    .ref prefetchEntry
    .ref undefEntry
    .def resetEntry

;-------------------------------------------------------------------------------
; interrupt vectors

resetEntry
        b   _c_int00
        b   undefEntry
        b   vPortSWI
        b   prefetchEntry
        b   _dabort
        b   phantomInterrupt
        ldr pc,[pc,#-0x1b0]
        ldr pc,[pc,#-0x1b0]

    
;-------------------------------------------------------------------------------

Application's map file:

MEMORY CONFIGURATION

         name            origin    length      used     unused   attr    fill
----------------------  --------  ---------  --------  --------  ----  --------
  SOFTWAREINFOS         00040000   00000800  00000080  00000780  RW  
  SOFTWAREINFOSBOOT     00040800   00000800  00000000  00000800  RW  
  VECTORS               00041000   00000030  00000020  00000010     X
  KERNEL                00041030   00009600  00004440  000051c0  R  X
  FLASH0                00050630   000b59d0  00034df8  00080bd8  R  X
  STACKS                08000000   00002000  00000000  00002000  RW  
  KRAM                  08002000   00000800  0000035c  000004a4  RW  
  BSSRAM                08002800   00004800  0000443c  000003c4  RW  
  DATARAM               08007000   00000100  00000051  000000af  RW  
  RAM                   0800a000   00015000  0000e000  00007000  RW  

Any ideas what is going wrong?

Kind regards

Aron

 

 

  • Hello Aron,

    For application to use the interrupt handlers (for undef, dabort, swi, prefetch) defined in application rather than the ISR defined in bootloader, the addresses for those interrupts in sys_intvects.asm of bootloader should be changed as follow:

    b    _c_int00            ;0x00

    b    #0x40FF8         ;0x04; 0x40FF8=$41000-0x8; 

    b    #0x40FF8         ;0x08, Software interrupt

    b    #0x40FF8         ;0x0C, Abort (prefetch)

    b    #0x40FF8         ;0x10, Abort (data)

    reservedEntry
          b reservedEntry         ;0x14

    ldr   pc,  [pc, #-0x1b0]      ;0x18
    ldr   pc,  [pc, #-0x1b0]      ;0x1C