none
WEC 2013 bootloader hanging RRS feed

  • Question

  • Hi all,

    I am porting WEC7 bootloader to WEC 2013.

    My startup assembly code hangs in between.

    It is hanging after  

     add     r8, r8, #0x3E0-(8*4)            ; (r8) = target location of the vector table
    		
     ldmia   r7!, {r0-r3}

    instruction in the below code.

    Why program is hanging after that instruction?

    how i can solve this issue?

        ; Set up exception vector
        mov     r8, #0                           ; (r8) = ptr to exception vectors
        ;add     r7, pc, #VectorInstructions - (.+8)
        adr     r7, VectorInstructions
        ldmia   r7!, {r0-r3}                    ; load 4 instructions
        stmia   r8!, {r0-r3}                    ; store the 4 vector instructions
        ldmia   r7!, {r0-r3}                    ; load 4 instructions
        stmia   r8!, {r0-r3}                    ; store the 4 vector instructions
    
        ldr     r7, =VectorTable                ; (r0) = VA of VectorTable
    
        add     r8, r8, #0x3E0-(8*4)            ; (r8) = target location of the vector table
    		
        ldmia   r7!, {r0-r3}
        stmia   r8!, {r0-r3}
        ldmia   r7!, {r0-r3}
        stmia   r8!, {r0-r3}
    	
    
        ;Enable Interrupt
        mrs     r0, cpsr                            ; r0 = CPSR
        mov     r0, #ARM_CPSR_MODE_SVC              ; enter supervisor mode
        bic     r0, r0, #ARM_CPSR_IRQDISABLE        ; enable fast IRQ
        msr     cpsr_c, r0                         ; update CPSR control bits
    
        ; Jump to the C entrypoint.
        ;    
        bl      main                              ; Jump to main.c::main(), never to return...
        nop
        nop
        nop
        
    STALL2
        b      STALL2 
    
        LEAF_END
    
        ALIGN 4   
         
    VectorInstructions
        ldr     pc, [pc, #0x3E0-8]              ; reset
        ldr     pc, [pc, #0x3E0-8]              ; undefined instruction
        ldr     pc, [pc, #0x3E0-8]              ; SVC
        ldr     pc, [pc, #0x3E0-8]              ; Prefetch abort
        ldr     pc, [pc, #0x3E0-8]              ; data abort
        ldr     pc, [pc, #0x3E0-8]              ; unused vector location
        ldr     pc, [pc, #0x3E0-8]              ; IRQ
        ldr     pc, [pc, #0x3E0-8]              ; FIQ
    
    VectorTable
        DCD     -1                             ; reset
        DCD     -1                             ; undefined instruction
        DCD     -1                             ; SVC
        DCD     -1                             ; Prefetch abort
        DCD     -1                             ; data abort
        DCD     -1                             ; unused vector
        DCD     IRQHandler                     ; IRQ
        DCD     -1                             ; FIQ
           
        END

    Thanks in advance.

    regards,

    Kavya



    kavya

    Wednesday, August 14, 2013 7:07 AM

Answers

All replies

  • My experience suggests that "bootloader hanging" usually indicates "code assuming incorrect processor state". Are you sure interrupts are disabled, for example? Are you sure that the correct addresses are returned from your table access instructions? Have you modified any of that code (it sure looks like it's been modified)? If so what assumptions are you making about the operating state?

    Paul T.

    Wednesday, August 14, 2013 7:07 PM
  • You need to put any data into RODATAAREA and take it out of the code area. All addresses to code have the LSB set (so the ARM processor knows it jumps to Thumb2 code), but this is causing problems when trying to access data in a code segment (you simply can't do that anymore in Thumb2).

    There are many more things you need to do, porting an ARM BSP from WEC7 to WEC2013 is not an easy task unfortunately...

    More info on the following links:

    http://msdn.microsoft.com/en-us/library/jj919375.aspx

    http://msdn.microsoft.com/en-us/library/jj919376.aspx

    And a good blog by Vinoth here: http://www.e-consystems.com/windows-embedded-compact-2013-thumb2.asp


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.


    Thursday, August 15, 2013 4:58 AM
    Moderator
  • Hi Kavya

    One way to find out what could be causing the bootloader to hang, it's to use a JTAG debugger. The JTAG will help you to look at the processor state (ARM vs Thumb) at each point. This tool will help you narrow down the issue faster.

    Regards

    Adeneo-Embedded Dev Team

    www.adeneo-embedded.com

    Thursday, October 3, 2013 9:50 PM
  • Got a JTAG.

    Whats a good reference for getting started with a JTAG.

    TI processor

    OLIMEX TMS5320-XD3100-V3 JTAG

    Thx


    DJaus Snr SW Dev (Embedded Systems and .NET)

    Sunday, June 29, 2014 11:39 AM