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.

RM48 BootLoader Interrupt Vector Setting.

Other Parts Discussed in Thread: TMS470R1B1M

Zhaohong,

Sorry, I question again.

I equally modified software interrupts in both of the bootloader and the application. And I tested to update the application using the bootloader. As a result, the I/O control using polling is OK, but interrupt is not happened. (Actually, it didn't work for I/O control using polling before this modifying.). And I attached my bootloader and application. Please check my error or fault.

-- File Description--

 The bootloader is based on “Hercules_Bootloader_v1.0.0” of  “http://processors.wiki.ti.com/index.php/RM48_HDK_Kit”.

Application is based on the “RM48 Hercules Demo” of the “spnc034.zip”. And I modified “link cmd” and “sys_startup.c”.

 

7065.20121107.zip

Thank you.

  • Bongju,

    I took a look at the two projects you sent. It seems that you do not use interrupts in bootloader.and the interrupts are not set up correctly in your application. You can find information about how to set up interrupt in the following thread.

    http://e2e.ti.com/support/microcontrollers/hercules/f/766/p/194430/694660.aspx

    I would also suggest you focusing on debugging your application without bootloader. You can run the application without bootloader by change the address of application interrupt table to address 0x0 by changing the link command file.

    I also observed an error in your bootloader interrupt table. Since you branch to an address offset of 0x80000, you should use " b #0x7fff8".

    Please let me know if this reply would help you in solving the problem.

    Thanks and regards,

    Zhaohong

  • Hello, Zhaohong

    I thank you for your answer.

     

    The boot loader uses the software interrupt (RTI, UART RX). Why you would not interrupt the boot loader did you guess that?

     

    You were told to debug the application, vacation without the boot loader.

    Link cmd file the application of the vector address 0x0 and testing, I tried but, it works without a problem.

    The application does not seem to have a problem.

     

    You know, the application start address of the address is 0x80000. In the boot loader, you suggested that the branch address 0x80000 "b # 0x7fff8". This means right?

    A while ago, I jump to the address 0x80000 source Test was modified to address 0x7ffff8(  ((void (*)(void))0x7fff8)(); ) Application, but only IO toggle action.

     

    Please, I do hope that you will answer.

     

    Thanks and regards,

    bongju

  • Bongju,

    In your initial post, you said that the interrupts (I assume IRQs and FIQs) do not work in your application. Do interrupts work when your run application alone? If application works fine by itself but not with bootloader, there must be some bootloader "residue" which prevents application from running correctly. In order to start the application in a "clean" way,  you need to do the following.

    (1) After successful bootloader operation, generate a S/W system reset instead of branching to application start address (0x00080000 for your case). This S/W system reset will bring everything except for ESM status registers to the default status. In this way, you do not need to check what has been set up in the bootloader and how to clean them.

    (2) At the beginning of the bootloader, check if a S/W reset is occurred. If yes, directly branch to the application start address.

    The above steps will enable application to start as if bootloader does not exist.

    Now, let's get back to your bootloader interrupt vector table. This is what you have today.

             b   _c_int00     ;0x00   Bootloader reset
             b #0x80004    ;0x04   undefined_instruction
             b #0x80008    ;0x08   software_interrupt
             b #0x8000c    ;0x0C   prefetch_abort
             b #0x80010    ;0x10   data_abort
            b #0x0x80014 ; reserved
            ldr pc,[pc,#-0x1b0]        ;0x18
            ldr pc,[pc,#-0x1b0]        ;0x1C

    You need to change into the following since "b #xxxxxxxx" is branching to an offset address whichis is current address + xxxxxxxx+8.

         b   _c_int00     ;0x00   Bootloader reset
             b #0x7ffff8    ;0x04   undefined_instruction
             b #0x7fff8    ;0x08   software_interrupt
             b #0x7fff8    ;0x0C   prefetch_abort
             b #0x7fff8    ;0x10   data_abort
            b #0x7fff8 ; reserved
            ldr pc,[pc,#-0x1b0]        ;0x18
            ldr pc,[pc,#-0x1b0]        ;0x1C

    To branch to application start address (0x80000), you may consider using the following assembly instructions.

    mov r0, #0x80000

    b r0

    Please let me if the above solves your problem.

    Thanks and regards,

    Zhaohong

  • Hello Zhaohong,

    I might be posting my query in a wrong thread...but i find your answers very authentic and clear.....

    I am writing a bootloader for SM470R1B1M (aka TMS470R1B1M) AMR 7TDMI core...i am very confused regarding mapping my vector tables for my application .....

    My bootloader starts at memory 0x80, and i have given 32KByte of size for it..

    and my application Starts at 0x8080.

    Please give me a sample code for for mapping my vector table for the application.....

    as in the datasheet its mentioned that vector table is fixed at 0x00 to 0x1C, so how could i use the same vector table for both bootloader and Application.

    Please provide the sample code for mapping my vector table...and guide as to where i have to write the new code for the mapping the vector table.

    I am using IAR v6.5 for development....

    Reply Expected.

    Thanks In Advance,

    Amjad

  • Amjad,

    You need to use two vector tables. One is located at address 0x0 for the boot loader. CPU starts at address 0x0 after reset. The second one is for the application located at address 0x8000. In this way, we can make software development independent of each other. Bootloader and application will be independent projects. When an exception occurs, CPU goes to the the vector table at 0x0 then jumps to the vector table for application. You can use IRQ/FIQ  but no other exceptions in bootloader. The IRQ and FIQ should be served in vector mode.

    The bootloader  vector table at address 0x0 should look as follows.

       _c_int00     ;0x00   Bootloader reset
             b #0x7ff8    ;0x04   undefined_instruction, branch to application
             b #0x7ff8    ;0x08   software_interrupt, branch to application
             b #0x7ff8    ;0x0C   prefetch_abort, branch to application
             b #0x7ff8    ;0x10   data_abort, branch to application
            b #0x7ff8 ; reserved, branch to application
            ldr pc,[pc,#-0x1b0]        ;0x18
            ldr pc,[pc,#-0x1b0]        ;0x1C

    To branch to application start address (0x80000) at the end of bootloading, you may consider using the following assembly instructions.

    mov r0, #0x80000

    b r0

    The application vector table at the address 0x8000 should look as follows.

             b   _c_int00     ;0x00   application reset
             b  _undef_ISR;  0x04 undefined_instruction
             b  _swi_ISR    ;0x08   software_interrupt
             b  _prefetch_abort_ISR    ;0x0C   prefetch_abort
             b  _data_abort_ISR    ;0x10   data_abort
             b  _reserved_ISR ; reserved
             ldr pc,[pc,#-0x1b0]        ;0x18
             ldr pc,[pc,#-0x1b0]        ;0x1C

    Thanks and regards,

    Zhaohong

  • Hello Zhaohong,

    In the solution provided by you, I have few doubts:-

    1.Where these vector table needs to assigned, as i m using IAR i will be changing its address in linker file? is my understanding correct.?

    2.For the Bootloader vector table you have used address #0x7ff8, where as in the data sheet its given vector table is fixed at 0x00 to 0x1C.

    3.What is this _c_int00 ? is it the start address of the Main() routine?

    4.In the second Application Vector table what will be adress of the _c_int00, Do i need to put it as 0x8000.?

    5.Whats does the data sheet actually means when it says that "Vector table address is fixed" ?

    Thanks & Regards,

    Amjad Masood

  • Amjad,

    (1) For the bootloader, the vector table has to be at address 0x0.

    (2) You also need to to define a vector table for your application. I assume it starts at 0x8000. B #07ff8 is to branch an offset of 0x7ff8. When you test without bootloader, you can change it to address 0x0.

    (3) _c_int_00 is the start address of the start tup code if you use TI compiler.

    (4) Start up code has nothing to do with vector table. You can put it anywhere with in memory you defined for your application.

    (5) CPU always start up at address 0x0 after reset. For the hardware, the exception interrupt vector table is fixed at address 0x0. In this discussion, the bootloader and application are considered as independent programs. When an exception occurs, it will go to the vector table at address 0x0 and then jump to the table for the application.

    Best regards,

    Zhaohong

  • Thanks Zhaohong,

    I am in the last phase of developing my bootloader code for SM470R1B1M, I will make the changes suggested by you and will mail you the code incase of any doubt. Please provide me your mail id.

    What will happen when any interrupt will occur while the bootloader is running,

    as above code , the control will jump to the location of the application interrupt handler routine.how we are making sure that only the bootloader's vector are called when bootloader is running...for eg. i m using SPI in bootloader and application both....but both have separate handlers, when a interrupt occurs when bootloader is running how we can make sure that SPI interrupt handler for the bootlaoder will be called, from the above changes i feel like the bootloader SPI interrupt will be redirected the the Application SPI interrupt handler, due to the jump instructions in the bootloader code..

    Thanks a lot once again.

    Amjad

  • Amjad,

    The assumption of the approach discussed in this thread is that the only IRQ/FIQ interrupts are allowed in bootloader. You will need to use software vector mode to handle IRQ/FIQ where the address of ISRs are saved to VIM RAM. The VIM RAM will have different content in bootloader and application.

    Thanks and regards,

    Zhaohong

  • Hi Zhaohong Zhang :
    would you please send me the sample source code for app ? I have not found the app code for bootloader!
    I don't know how to modify the start file, want a reference project . we are using TMS470R1B1M .
  • Siliang,

    What development tool are you using? Do you have an existing project with the tool you currently use?

    Thanks and regards,

    Zhaohong