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.

Interrupt vector handling: 1 MCU 3 SW project

Other Parts Discussed in Thread: RM48L952

Hi all,

I have a common problem as guys before me in this post:
http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/206272.aspx

I have 3 projects (Fork, bootloader, firmware). Each project has its own vector table. Fork and bootloader uses HW hardware vector mode, but FW uses dispatch mode.
My architecture is:
0x0      Vectors of FORK,
0x20    FORK

0x02000 Vectors of Bootloader
0x02020 Bootloader 

0x08000 Vectors of FW

0x08020 FW

So interrups works in Fork and Bootloader but in FW doesnt. If i change in FW into hardware vector mode it starts to work.
Is there a possible way that in SW dispatch mode also starts to work? What i must change?
I need SW dispatch mode in FW because of interrupt nesting and priority. 

Im using RM48L952ZWT.

  • Hi Dejan,

    Ah I have a ton of quesitons for you ::

    When you say that the vectors for "Bootloader" work you mean just the IRQ vectors, correct?

    Or is "FORK" somehow redirecting the other exception vectors, like UNDEF, between Bootloader and FW?

    Do you *want* FORK to handle all the other exceptions except for IRQ?   Also do you want FORK to always be the primary Reset handler?

    Regarding the limitation of HW dispatch, VIM has the ability to map the priority of the interrupt requests

     

    And the Channels can be enabled/disabled through VIM so nesting with priority should also be possible by temporarily disabling the interrupts below the current level before enabling nesting.

    Best Regards,

    Anthony

  • Hi Anthony,

    Yesterday I have read a little more the documentation and topic forums and I notice that exception vector for RM48L952 can't be move. It can be on address 0x0 or 0xFFFF0000, but 0xFFFF0000 is not possible on RM48L952.
    So each SW project has to have common exception vector. Is this correct?

    So if I set up in sys_link.cmd   as example:


    /*----------------------------------------------------------------------------*/
    /* Memory Map */
    MEMORY{
    VECTORS (X) : origin=0x00002000 length=0x00000020
    FLASH0 (RX) : origin=0x00002020 length=0x0017FFE0
    FLASH1 (RX) : origin=0x00180000 length=0x00180000
    STACKS (RW) : origin=0x08000000 length=0x00002000
    RAM (RW) : origin=0x08002000 length=0x0003ED00
    }

    /*----------------------------------------------------------------------------*/
    /* Section Configuration */
    SECTIONS{
    .intvecs : {} > VECTORS
    .text : {} > FLASH0 | FLASH1
    .const : {} > FLASH0 | FLASH1
    .cinit : {} > FLASH0 | FLASH1
    .pinit : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM
    }

    Will not work.  I have erased the whole flash and flash it with this settings and of course didnt work, because address 0x0 had none value.
    On STM32 there is some special register which you say where your exception vector is. I think that this option is not available on RM48L952.

    So to answer first question, i thought that Bootloader was working but you are right only IRQ are working. Because FORK started, and than called Bootloader and in bootloader I use only IRQ interrupts. And IRQ are set to HW vector interrupt.


    So what kind procedure would you suggest that I simulate this kind way of integration? That each SW project has its own exception vector. 
    So when Fork is working, reset is address of Fork, When Bootloader is working, reset is bootloader, and so on.

    To keep in mind:
    What can happen if bootloader is updating from USB FW. But in that time it mustn't rewrite exception vectors, in case of power loss or some other problem. 

    Thx,
    BR, Dejan 

  • Dejan,

    Hi, mulled this one over for most of the day and not coming up with any great ideas.

    We have something called "POM" that you could look at .. it's in chapter 18 of the TRM spnu499.  I've personally never tried POM and am not sure if you can execute instructions through it or not. I don't see anything in the TRM that says you can't so it might be possible.  But it's original intention was to remap data tables from flash to RAM so you could make quick calibration changes during a parameter tuning session without going through the program/erase of flash.

    The only other thing that comes to mind goes back to the ARM Angel and Demon debug monitors that you would download your C code on top of and execute.  These debug monitors have been replaced by JTAG debug and have been obsolete for many years.  I don't know where you would get the code, but probably you could find some port on the internet that's still out there.   I did some googling and found this:   http://infocenter.arm.com/help/topic/com.arm.doc.dui0001d/DUI0001D_pie6_ug.pdf

    There's a little description of the SWI services that the monitor provided to the application, in particular you could register an exception handler using the SWI_InstallHandler() function.   (see page 37).    It was a pretty elegent monitor code that they had and maybe this could be the basis of your 'FORK' on top of which you could run your bootloader or your FW.   While their intent was primarily *debug* the ideas could possibly be adapted to your use case.

    Sorry I can't come up with any better ideas at the moment.  Maybe someone else reading the forum will.

    By the way - how did you intend to decide which would execute (Fork v.s. Bootloader v.s. Firmware)?   Would this be a GIO pin or some other 'sticky' bit ?

    Thanks and Best Regards,

    Anthony

     

  • Hi Anthony,

    First thank you for your ideas. I think i'm going to simplify the design.

    My starting point will be always Fork, and than Fork decides if it goes to bootloader, or FW. Calls _c_int00 of each projects.

    All project will use common exception vectors which are going be handled by the fork sw.
    Question: So in bootloader SW and FW SW sys_invec.asm must look like so:

    b _c_int00
    undefEntry
    b #0x4;b undefEntry
    svcEntry
    b #0x8;b svcEntry
    prefetchEntry
    b #0x0C;b prefetchEntry
    b #0x10;b _dabort
    reservedEntry
    b reservedEntry
    b #0x18;ldr pc,[pc,#-0x1b0]
    b #0x1C;ldr pc,[pc,#-0x1b0]


    IRQ are goning to be hardware vector and each SW project will overwrite VIMRAM vector table.

    So far now when im in debug, everthing works, but on power-up it doesnt. Fork calls FW, FW enables interrupts and when handling first interrupt i get esm group 2 interrupt.
    In FW in vim vector table I have for irq interrupt irqDispacher function which executes the highest interrupt also its supports nesting.
    If i ignore esm interrupt or put normal ISR function without irqDispacher it works also on power-up.

    irqDispacther is done like so, expect that address of asm function is not in sys_invec.asm but in vim vector table.
    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/164944.aspx 

    Sometimes with dispatcher also works on power-up, if I reset the board very quickly. 

    Setup sys_link.cmd

    Fork: exception vectors are at address 0x0

    BW and FW: exception vectors are on other address (that we dont overwrite forks settings)

  • I found what was wrong. Roger had the same problem.

    This is the fix:
    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/251942.aspx 

    I had one old sys_core.asm file.