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.

TMS570LS0714: How to understand the cmd file and handle application interrupt with CAN_Bootloader

Part Number: TMS570LS0714

Hi Team,

My customer is developing CAN_bootloader on TMS570LS0714 platform, they tried to remapped the application vector table to 0x20000 and follow the instructions at this link:

But they have some doubts about how to  understand the cmd configuration and how to handle application interrupt with bootloader.

1. Why the interrupt vector table in bootloader is "application start address - 0x08"? What's the "-0x08" stand for? 

2.  Why the address of SVC, Abort (prefetch), Abort(data) is the same as "application start address - 0x08" ?

3. In their application sys_intvecs.asm, the code is as follows, what's the differences compared with the interrupt vector table in bootloader?

    .sect ".intvecs"
    .arm

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

    .ref _c_int00
    .ref _dabort
    .ref phantomInterrupt
    .def resetEntry

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

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

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

4. In the above thread,  said that "pay attention to the code "switch (getResetSource ())....” in the HL_sys_startup.c file.

When the code jump into app from bootloader, the reset source is cleared at bootloader, the interrupt vector initialization and other functions will not be executed, so the interruption in app can not enter.

If this place is not modified, this problem will be encountered."

So customer want to know how the modify the file to avoid the problem. 

5. Is there anything need to be modified and noticed  when remapping interrupt vector table and running FIQ and IRQ interrupt in application code?

  • Hello David,

    I am forwarding your questions to one of our Boot loader experts. He should get back with you soon.
  • Hello David,

    1. The Cortex-R4 prefetch operation causes the PC to be 2 words (0x08 bytes) ahead of the current instruction, so we need minus 8 to get the correct address.
    2. When the MCU has a Undef INT, it will execute the instruction at 0x04 (PC=0x04 + 0x08), but the ISR is at 0x20000+0x04 (in application), so the code needs to jump to 0x20000+0x04. The offset is (0x20000+0x04 -PC) = 0x20000-0x08
    3. The ISR of undef, prefech, daboart and SVC defined in bootloader will be used. If you want to use the ISR defined in application image, you need to use the formula: (application start address- 0x08) as the offset.
    4. You need to modify the code to leave the SYSESR uncleared in bootloader (I will give you an example later)
    5. No modification for FIQ and IRQ
  • Hi QJ,
    Appreciate your response and explanation.
    How about the example? Thanks.

    Thanks and Regards,
    David Bai
  • Hello David,

    At startup, the code reads the system register SYSESR to check the reset source. Previous reset source status bits are not automatically cleared if new resets occur, the getResetSource() function clears the flags that are sets after reading this register. If you want to keep those flags for your application, you need to comment out the statements for clearing the flags:

    SYS_EXCEPTION = 0x0000FFFFU;

    SYS_EXCEPTION = (uint32)EXT_RESET;

    SYS_EXCEPTION = (uint32)CPU1_RESET;

    SYS_EXCEPTION = (uint32)CPU0_RESET;

    SYS_EXCEPTION = (uint32)SW_RESET;

    ...