This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Creating a boot loader and application in ROM at different locations

I want to create a boot loader that will be loaded/executed at device startup which will determine if the firmware application is present and if so, jump (start) the application firmware. Else, it will spin waiting of USB commands to update the firmware (virgin boot). The ultimate goal is to have a device that is field programmable for firmware updates. My project utilizes the Infineon XC161CJ-16F processor and uVision3 V3.60 development tool. Here are my questions:
1. What are the steps to creating Program A (boot loader) to start at 0xC00000 and Program B (application) to start at 0xC04000? My confusion is getting the "Options for Target" dialog settings correct. Are there any examples?
2. Can I download both the boot loader and application firmware separately using my ULINK without stepping on each other’s toes? I assume if the addressing is setup correctly this will be possible.

Thanks
B

Parents
  • Your approach is the one I am currently working on. There are some explanations as to how to implement this.

    Some links:
    http://www.keil.com/support/docs/143.htm
    Refer to http://www.keil.com/support/docs/132.htm http://www.keil.com/support/docs/2707.htm

    Basically you need to relocate your code not your boot loader) somewhere else and vector your interrupts which are hard coded to the beggining of the flash. But do it for all of them except the reset 0000H (you use this to jump to your boot loader to determine if the firmware is valid). Once you determine if your firmware is valid you jump to it using function pointers.

    Ininclude some code:

    #pragma iv(0x400) // Force the compiler to relocate the code
    #pragma src // Creates the src file

    #pragma asm // ASM code to redirect the interrupts.
    OFFSET EQU 400H

    CSEG AT 0003H ; External Interrupt 0 LJMP OFFSET + 0003H

    CSEG AT 000BH ; Timer 0 overflow LJMP OFFSET + 000BH

    CSEG AT 0013H ; External Interrupt 1 LJMP OFFSET + 0013H

    CSEG AT 001BH ; Timer 1 overflow LJMP OFFSET + 001BH

    CSEG AT 0023H ; UART LJMP OFFSET + 0023H

    CSEG AT 002BH ; Timer 2 overflow LJMP OFFSET + 002BH

    CSEG AT 0033H ; SPIO LJMP OFFSET + 0033H

    CSEG AT 003BH ; SMB0 LJMP OFFSET + 003BH

    CSEG AT 0053H ; ADC0 LJMP OFFSET + 0053H

    CSEG AT 005BH ; Programmable counter array LJMP OFFSET + 005BH

    CSEG AT 0063H ; Comparator0 LJMP OFFSET + 0063H

    CSEG AT 0073H ; Timer 3 overflow LJMP OFFSET + 0073H

    #pragma endasm

    Let me know about your progress.
    JV

Reply
  • Your approach is the one I am currently working on. There are some explanations as to how to implement this.

    Some links:
    http://www.keil.com/support/docs/143.htm
    Refer to http://www.keil.com/support/docs/132.htm http://www.keil.com/support/docs/2707.htm

    Basically you need to relocate your code not your boot loader) somewhere else and vector your interrupts which are hard coded to the beggining of the flash. But do it for all of them except the reset 0000H (you use this to jump to your boot loader to determine if the firmware is valid). Once you determine if your firmware is valid you jump to it using function pointers.

    Ininclude some code:

    #pragma iv(0x400) // Force the compiler to relocate the code
    #pragma src // Creates the src file

    #pragma asm // ASM code to redirect the interrupts.
    OFFSET EQU 400H

    CSEG AT 0003H ; External Interrupt 0 LJMP OFFSET + 0003H

    CSEG AT 000BH ; Timer 0 overflow LJMP OFFSET + 000BH

    CSEG AT 0013H ; External Interrupt 1 LJMP OFFSET + 0013H

    CSEG AT 001BH ; Timer 1 overflow LJMP OFFSET + 001BH

    CSEG AT 0023H ; UART LJMP OFFSET + 0023H

    CSEG AT 002BH ; Timer 2 overflow LJMP OFFSET + 002BH

    CSEG AT 0033H ; SPIO LJMP OFFSET + 0033H

    CSEG AT 003BH ; SMB0 LJMP OFFSET + 003BH

    CSEG AT 0053H ; ADC0 LJMP OFFSET + 0053H

    CSEG AT 005BH ; Programmable counter array LJMP OFFSET + 005BH

    CSEG AT 0063H ; Comparator0 LJMP OFFSET + 0063H

    CSEG AT 0073H ; Timer 3 overflow LJMP OFFSET + 0073H

    #pragma endasm

    Let me know about your progress.
    JV

Children
No data