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.

Relocate Vector table in TMS570LC4357

Hi,

I am using TMS570LC4357 to code bootloader and application.

I am placing bootloader Vector table @ address 0x00000000 and application vector table @ 0x00200000 and application code @ flash 1 0x00200020.

In debug mode the program work properly, jump to application was successful and interrupts in application code works properly. but in Run mode Interrupts in application code does not work properly.

I observed code working properly in run and debug mode when I changed application vector table to 0x00000000. But I want to shift application vector table to Flash1 @ 0x00200000.

If I shift application vector table to 0x00200000,in run mode interrupts are not working. how to resolve this. Please suggest.

1. How to relocate vector table?

Thanks

Apoorva

  • You cannot relocate the vector table. You must have the initial interrupt service routine determine if you are in boot or application mode. If in application mode, then read the vector from the table at 0x00200020. Or, you can use the VIM in Hardware Vectored Interrupt mode. See chapter 19 of the TRM.

  • You can analyze interrupt source in bootloader  interrupt handler. If return address > 0x20000 then hum to application interrupt handler.

    My bootloader located in first 64k. Application interrupt table located ad 0x10000;

        .arm
    ;place this section 
        .sect ".app_intvecs"
        .def    app_vPortSWI
        .def    app_dabort
    ;-------------------------------------------------------------------------------
    ; Application interrupt vectors layout
            .word 0 ;Reset
            .word 0 ;Undefined
    app_vPortSWI
            .word 0 ;SWI
            .word 0 ;prefetch
    app_dabort
            .word 0 ;dabort
            .word 0 ;reserved
            .word 0 ;IRQ
            .word 0 ;FIQ
    
    
    ;-------------------------------------------------------------------------------
    ;
        .text
        .ref phantomInterrupt
        .def    bl_vPortSWI
    bl_vPortSWI
    	cmp lr, #0x10000
    	blo phantomInterrupt
    	b app_vPortSWI
    
    	.ref _dabort
        .def bl_dabort
    bl_dabort
    	cmp lr, #0x10000
    	blo _dabort
    	b app_dabort
    

  • --retain="*(.intvecs)"
    --retain="*(.app_intvecs)"
    /*----------------------------------------------------------------------------*/
    /* Memory Map                                                                 */
    
    #define BL_SIZE 64k
    
    MEMORY
    {
    //SECTOR 0
        VECTORS		(X)  : origin=0x00000000		length=0x20
        BOOT_FLASH	(RX) : origin=END(VECTORS)		length=(BL_SIZE-END(VECTORS))
    
        APP_VECTORS	(R)  : origin=BL_SIZE	length=0x20
        FLASH_STATE_PTR	(R) : origin=END(BOOT_FLASH)+32k	    length=4
    
    
        STACKS		(RW) : origin=0x08000000   		length=2k
        KRAM		(RW) : origin=END(STACKS) 	    length=2k
        REBOOT_STATE(RW) : origin=END(KRAM) 	    length=16
        RAM			(RW) : origin=END(REBOOT_STATE) length=(192k - SIZE(KRAM) - SIZE(STACKS) - SIZE(REBOOT_STATE))
    }
    
    //BOOTLOADER_END = END(FLASH0_4);
    
    /*----------------------------------------------------------------------------*/
    /* Section Configuration                                                      */
    
    SECTIONS
    {
        .intvecs : {} LOAD = VECTORS crc_table(crc_table)
        flashAPI :
    	{
        	External/utils_tms/fapi_critical.obj (.text)
         	--library= F021_API_CortexR4_BE_V3D16.lib
        } load = BOOT_FLASH, run = RAM, LOAD_START(fapi_load), RUN_START(fapi_run), SIZE(fapi_size), crc_table(crc_table)
    
        .cinit   : {} > BOOT_FLASH crc_table(crc_table)
    	GROUP {
        	.text
        	.const
    	} > BOOT_FLASH crc_table(crc_table)
        .TI.crctab > BOOT_FLASH LOAD_END(bootloader_end)
    
        .kernelBSS    : {} LOAD = KRAM
        .kernelHEAP   : {} LOAD = RAM
        .bss          : {} LOAD = RAM
        .data         : {} LOAD = RAM
    
        .app_intvecs > APP_VECTORS type = DSECT LOAD_START(app_start)
      	.FLASH_STATE_PTR > FLASH_STATE_PTR type = NOINIT
      	.REBOOT_STATE > REBOOT_STATE type = NOINIT
    }
    

    Bootloader link script:

  • Hi Bob,

    Thanks for your reply.

    I found the problem.it is because viminit() of application code  was not called after jump application. Because when I reset the board ,it goes to bootloader

    _c_int00() so bootloader's VIM was initialized.

    So I put all initialization functions in application startup code to default. Now the bootloader and application works properly both in debug and Run mode.

    I need your suggestion that, the above changes I made in the startup code will affect anything else?

    Thanks

    Apoorva