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.

Bootloader and Secondary PIE Vector Table

Hi,

I'm working on a custom bootloader. I need two different pie interrupt vector table, one for bootloader and one for user application. After bootloader code ends and cpu jump to user application code, cpu will use user application pie vector table. Bootloder code and it's vector table will be constant and user application code and it's vector table will be updatable.

How can I do that?

- CPU F28377D, CCSv6.1.2, Compiler v6.4.9


Thanks,

  • You will have to re-initalize PIE with the new vectors when you start the user application.

    Best Regards
    Santosh Athuru
  • I have already did that. But the problem is when application code changes, F2837xD_PieVect.obj also changes. F2837xD_PieVect.obj is located at the bootloader memory FLASHA-B and FLASHC-N is assigned to contain user application code. FLASHA-B is not updated but FLASHC-N is updated. So when I run the code it goes to a dummy ISR.

    I tried to make two seperate functions like in below.

    const struct PIE_VECT_TABLE PieVectTableInit_Boot= {
    PIE_RESERVED_ISR, // Reserved
    PIE_RESERVED_ISR, // Reserved
    PIE_RESERVED_ISR, // Reserved
    PIE_RESERVED_ISR,
    .
    .
    .
    }

    void InitPieVectTable_Bootloader(void)
    {
    Uint16 i;
    Uint32 *Source = (void *) &PieVectTableInit_Boot;
    Uint32 *Dest = (void *) &PieVectTable;

    // Do not write over first 3 32-bit locations (these locations are
    // initialized by Boot ROM with boot variables)

    Source = Source + 3;
    Dest = Dest + 3;

    EALLOW;
    for(i = 0; i < 221; i++)
    {
    *Dest++ = *Source++;
    }
    EDIS;

    // Enable the PIE Vector Table
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    }

    void InitPieVectTable(void)
    {
    Uint16 i;
    Uint32 *Source = (void *) &PieVectTableInit;
    Uint32 *Dest = (void *) &PieVectTable;

    // Do not write over first 3 32-bit locations (these locations are
    // initialized by Boot ROM with boot variables)

    Source = Source + 3;
    Dest = Dest + 3;

    EALLOW;
    for(i = 0; i < 221; i++)
    {
    *Dest++ = *Source++;
    }
    EDIS;

    // Enable the PIE Vector Table
    PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
    }

    User application calls InitPieVectTable(), bootloader calls InitPieVectTable_Bootloader() function. But the issue is still there. When I make a change in the user application InitPieVectTable_Bootloader.obj changes which is stored in the FLASHA-B(bootloader memory). For this reason, user code doesn't work properly.
  • I tested again, and my above approach was working. There were some other issue which causes error.