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.

Creating Bootloader for OMAP L138(NOR FLASH)

Hi,

 

I need to run ARM processor in OMAP L138 using code composer studio v4.2 and after that the instructions for LED blinking should be loaded from NOR flash.

1. What all should be included in the project as well as the source file?

2. What should I write in the command file?

3. How can I flash an external memory(NOR) with the LED blinking program? ---- Help provided in http://processors.wiki.ti.com/index.php/Secondary_Bootloaders_on_OMAP-L1x was found to be confusing.........

  •  

    Thanks for ur reply......


    1. Can u give a brief idea about how this boot.asm file present in the project works???

    2. Which portion of the code tells the entry point of  bootloader(address)???????


     .if  __TI_TMS470_V7M3__

        .thumbfunc _c_int00

        .else

    .armfunc _c_int00

       .endif


    ;****************************************************************************

    ; Accomodate different lowerd names in different ABIs

    ;****************************************************************************

       .if   __TI_EABI_ASSEMBLER

            .asg _args_main,   ARGS_MAIN_RTN

            .asg exit,         EXIT_RTN

            .asg    main_func_sp, MAIN_FUNC_SP

       .elseif __TI_ARM9ABI_ASSEMBLER | .TMS470_32BIS

            .asg __args_main,   ARGS_MAIN_RTN

            .asg _exit,         EXIT_RTN

            .asg    _main_func_sp, MAIN_FUNC_SP

       .else

            .asg $_args_main,   ARGS_MAIN_RTN

            .asg $exit,         EXIT_RTN

            .asg    _main_func_sp, MAIN_FUNC_SP

       .endif


       .if .TMS470_16BIS


    ;****************************************************************************

    ;*  16 BIT STATE BOOT ROUTINE                                               *

    ;****************************************************************************


       .if __TI_TMS470_V7M3__

    .state16

       .else

    .state32

       .endif


    .global __stack

    ;***************************************************************

    ;* DEFINE THE USER MODE STACK (DEFAULT SIZE IS 512)               

    ;***************************************************************

    __stack:.usect ".stack", 0, 4


    .global _c_int00


    ;***************************************************************

    ;* FUNCTION DEF: _c_int00                                      

    ;***************************************************************

    _c_int00: .asmfunc


    .if !__TI_TMS470_V7M3__

    .if __TI_NEON_SUPPORT__ | __TI_VFP_SUPPORT__

            ;*------------------------------------------------------

    ;* SETUP PRIVILEGED AND USER MODE ACCESS TO COPROCESSORS

    ;* 10 AND 11, REQUIRED TO ENABLE NEON/VFP      

    ;* COPROCESSOR ACCESS CONTROL REG 

    ;* BITS [23:22] - CP11, [21:20] - CP10

    ;* SET TO 0b11 TO ENABLE USER AND PRIV MODE ACCESS

            ;*------------------------------------------------------

    MRC      p15,#0x0,r0,c1,c0,#2

            MOV      r3,#0xf00000

    ORR      r0,r0,r3

            MCR      p15,#0x0,r0,c1,c0,#2


            ;*------------------------------------------------------

    ; SET THE EN BIT, FPEXC[30] TO ENABLE NEON AND VFP

            ;*------------------------------------------------------

          MOV      r0,#0x40000000

            FMXR     FPEXC,r0

    .endif


    ;------------------------------------------------------

    ;* SET TO USER MODE

            ;*------------------------------------------------------

            MRS     r0, cpsr

            BIC     r0, r0, #0x1F  ; CLEAR MODES

            ORR     r0, r0, #0x10  ; SET USER MODE

            MSR     cpsr_cf, r0


            ;*------------------------------------------------------

    ;* CHANGE TO 16 BIT STATE

            ;*------------------------------------------------------

    ADD r0, pc, #1

    BX r0


    .state16

    .endif


    ;*------------------------------------------------------

            ;* INITIALIZE THE USER MODE STACK                      

            ;*------------------------------------------------------

    LDR     r0, c_stack

    MOV sp, r0

            LDR     r0, c_STACK_SIZE

    ADD sp, r0


    ;*-----------------------------------------------------

    ;* ALIGN THE STACK TO 64-BITS IF EABI.

    ;*-----------------------------------------------------

    .if __TI_EABI_ASSEMBLER

    MOV r7, sp

    MOV r0, #0x07

    BIC     r7, r0         ; Clear upper 3 bits for 64-bit alignment.

    MOV sp, r7

    .endif


    ;*-----------------------------------------------------

    ;* SAVE CURRENT STACK POINTER FOR SDP ANALYSIS

    ;*-----------------------------------------------------

    LDR r0, c_mf_sp

    MOV r7, sp

    STR r7, [r0]


            ;*------------------------------------------------------

            ;* Perform all the required initilizations:

            ;*   - Process BINIT Table

            ;*   - Perform C auto initialization

            ;*   - Call global constructors 

            ;*------------------------------------------------------

            BL      __TI_auto_init


            ;*------------------------------------------------------

    ;* CALL APPLICATION                                     

            ;*------------------------------------------------------

            BL      ARGS_MAIN_RTN


            ;*------------------------------------------------------

    ;* IF APPLICATION DIDN'T CALL EXIT, CALL EXIT(1)

            ;*------------------------------------------------------

            MOV     r0, #1

            BL      EXIT_RTN


            ;*------------------------------------------------------

    ;* DONE, LOOP FOREVER

            ;*------------------------------------------------------

    L1:     B L1

    .endasmfunc


       .else           ; !.TMS470_16BIS


    ;****************************************************************************

    ;*  32 BIT STATE BOOT ROUTINE                                               *

    ;****************************************************************************


    .global __stack

    ;***************************************************************

    ;* DEFINE THE USER MODE STACK (DEFAULT SIZE IS 512)            

    ;***************************************************************

    __stack:.usect ".stack", 0, 4


    .global _c_int00

    ;***************************************************************

    ;* FUNCTION DEF: _c_int00                                      

    ;***************************************************************

    _c_int00: .asmfunc


    .if __TI_NEON_SUPPORT__ | __TI_VFP_SUPPORT__

            ;*------------------------------------------------------

    ;* SETUP PRIVILEGED AND USER MODE ACCESS TO COPROCESSORS

    ;* 10 AND 11, REQUIRED TO ENABLE NEON/VFP      

    ;* COPROCESSOR ACCESS CONTROL REG 

    ;* BITS [23:22] - CP11, [21:20] - CP10

    ;* SET TO 0b11 TO ENABLE USER AND PRIV MODE ACCESS

            ;*------------------------------------------------------

    MRC      p15,#0x0,r0,c1,c0,#2

            MOV      r3,#0xf00000

    ORR      r0,r0,r3

            MCR      p15,#0x0,r0,c1,c0,#2


            ;*------------------------------------------------------

    ; SET THE EN BIT, FPEXC[30] TO ENABLE NEON AND VFP

            ;*------------------------------------------------------

          MOV      r0,#0x40000000

            FMXR     FPEXC,r0

    .endif


            ;*------------------------------------------------------

    ;* SET TO USER MODE

            ;*------------------------------------------------------

            MRS     r0, cpsr

            BIC     r0, r0, #0x1F  ; CLEAR MODES

            ORR     r0, r0, #0x13  ; SET USER MODE

            MSR     cpsr_cf, r0


            ;*------------------------------------------------------

            ;* INITIALIZE THE USER MODE STACK                      

            ;*------------------------------------------------------

    LDR     sp, c_stack

            LDR     r0, c_STACK_SIZE

    ADD sp, sp, r0


    ;*-----------------------------------------------------

    ;* ALIGN THE STACK TO 64-BITS IF EABI.

    ;*-----------------------------------------------------

    .if __TI_EABI_ASSEMBLER

    BIC     sp, sp, #0x07  ; Clear upper 3 bits for 64-bit alignment.

    .endif


    ;*-----------------------------------------------------

    ;* SAVE CURRENT STACK POINTER FOR SDP ANALYSIS

    ;*-----------------------------------------------------

    LDR r0, c_mf_sp

    STR sp, [r0]

                    

            ;*------------------------------------------------------

            ;* Perform all the required initilizations:

            ;*   - Process BINIT Table

            ;*   - Perform C auto initialization

            ;*   - Call global constructors 

            ;*------------------------------------------------------

            BL      __TI_auto_init


            ;*------------------------------------------------------

    ;* CALL APPLICATION                                     

            ;*------------------------------------------------------    

            BL      ARGS_MAIN_RTN


            ;*------------------------------------------------------

    ;* IF APPLICATION DIDN'T CALL EXIT, CALL EXIT(1)

            ;*------------------------------------------------------

            MOV     R0, #1

            BL      EXIT_RTN


            ;*------------------------------------------------------

    ;* DONE, LOOP FOREVER

            ;*------------------------------------------------------

    L1:     B L1

    .endasmfunc


       .endif    ; !.TMS470_16BIS


    ;***************************************************************

    ;* CONSTANTS USED BY THIS MODULE

    ;***************************************************************

    c_stack .long    __stack

    c_STACK_SIZE   .long    __STACK_SIZE

    c_mf_sp        .long    MAIN_FUNC_SP


    .if __TI_EABI_ASSEMBLER

            .data

            .align 4

    _stkchk_called:

            .field          0,32

            .else

            .sect   ".cinit"

            .align  4

            .field          4,32

            .field          _stkchk_called+0,32

            .field          0,32


            .bss    _stkchk_called,4,4

            .symdepend ".cinit", ".bss"

            .symdepend ".cinit", ".text"

            .symdepend ".bss", ".text"

    .endif


    ;******************************************************

    ;* UNDEFINED REFERENCES                               *

    ;******************************************************

    .global _stkchk_called

    .global __STACK_SIZE

    .global ARGS_MAIN_RTN

    .global MAIN_FUNC_SP

    .global EXIT_RTN

            .global __TI_auto_init


    .end

     

  • The included boot.asm is simply a modified version on the one used by the ARM compiler tools. Everything is identical, except the part where it places it in supervisor mode has been removed.

    Check your .map file to see where sections and the entry point have been placed after compiling.

    Jeff