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

intel hex file format change?

what has changed in the basic hex file output format moving from uvision 2 to uvision3 and 4?

i have several hex files from examples from keil and analog for my part and they work fine if i try to program the part, but now i open up uvision 4 and start a new program to do nothing but toggle one gpio and it doesnt work.

with nothing else in the program but toggling one io, it doesnt work. it all works in the simulator just fine but not in the part anymore.

so before the hex files worked fine and i could compile and write a blinky style program into my part and all was well, now it compiles and simulates fine but doesnt work.

are there some retarded hidden compiler options im missing, or what, all i know is when i write a program to toggle just this one io that was compiled in uvision 2 its fine and compiled in uvision4 it doesnt do anything.

Parents
  • #include <aduc7022.H>                             // Include ADuC7022 Header File
    
    
    void IRQ_Handler(void)__irq;
    void FIQ_Handler(void)__irq;
    void PAbt_Handler(void){};
    void DAbt_Handler(void){};
    void SWI_Handler(void){};
    void Undef_Handler(void){};
    
    
    
    int main (void)
    {
    
            // set up core clock frequency
            POWKEY1 = 0x01;
            POWCON = 0x00;
            POWKEY2 = 0xF4;
    
    
            // start all gpio out in mode 00, override below
            GP0CON = 0x00000000;
            GP1CON = 0x00000000;
            GP2CON = 0x00000000;
            GP3CON = 0x00000000;
            GP4CON = 0x00000000;
    
            // start all gpio to inputs, override below
            GP0DAT = 0x00000000;
            GP1DAT = 0x00000000;
            GP2DAT = 0x00000000;
            GP3DAT = 0x00000000;
            GP4DAT = 0x00000000;
    
            // Port 0 setup
            // p0.0 is not used
            // p0.1 is not used
            // p0.2 is not used
            // P0.3 is the charge hv+ output
            // p0.4 is the ok 2 charge signal input (ie IRQ0)
            // p0.5 is the diagnostics dwell interrupt  input (irq1)
            // p0.6 is the charge hv- output
            // p0.7 is not used on WP64D rev1 as the UART0 and I2C1 are now used (was rs232rx)
            GP0DAT = 0x48000000;
    
             // Port 2 setup
            // p2.0 is xtra output
            GP2DAT = 0x1010000;
    
            // set up uart
            COMCON0 = 0x80;                                 // Setting DLAB
            COMDIV0 = 0x88;                                 // Setting DIV0 and DIV1 to DL calculated
            COMDIV1 = 0x00;
            COMCON0 = 0x07;                                 // Clearing DLAB
            COMIEN0 = 0x01;
    
    
    
            IRQEN = 0x00004000;
            FIQEN = 0x00008000;
    
            while(1)
            {
                    GP2DAT ^= 0x010000;
            }
    
    }
    
    
    
    
    
    void IRQ_Handler(void)   __irq
    {
    int a;
    a = COMRX&0xFF; // clear buffer
            GP2DAT ^= 0x1010000;
            return;
    }
    
    void FIQ_Handler(void) __irq
    {  int a ;
            a = FIQSTA;
            GP2DAT ^= 0x1010000;
            return;
    }
    

    this is just a tiny example where i ripped out everything useful just to try and debug the compiler options. this is running on an Analog devices ADuC7022 using uvision4.03 running the eval version of the compiler, linker, hex converter, etc. v 4.0.0.728

    the only thing i can think of anymore is that there has been some change to the hex file creation or that i am missing some kind of compiler option.

    but as far as options go i cant find anything different from this version to what i was using before. the memory addresses are correct, even though it doesnt matter.

    there are some major differences in the startup.s vs the aduc702x.s startup files where the new version has a new syntax, and some other changes that it automatically loads,

Reply
  • #include <aduc7022.H>                             // Include ADuC7022 Header File
    
    
    void IRQ_Handler(void)__irq;
    void FIQ_Handler(void)__irq;
    void PAbt_Handler(void){};
    void DAbt_Handler(void){};
    void SWI_Handler(void){};
    void Undef_Handler(void){};
    
    
    
    int main (void)
    {
    
            // set up core clock frequency
            POWKEY1 = 0x01;
            POWCON = 0x00;
            POWKEY2 = 0xF4;
    
    
            // start all gpio out in mode 00, override below
            GP0CON = 0x00000000;
            GP1CON = 0x00000000;
            GP2CON = 0x00000000;
            GP3CON = 0x00000000;
            GP4CON = 0x00000000;
    
            // start all gpio to inputs, override below
            GP0DAT = 0x00000000;
            GP1DAT = 0x00000000;
            GP2DAT = 0x00000000;
            GP3DAT = 0x00000000;
            GP4DAT = 0x00000000;
    
            // Port 0 setup
            // p0.0 is not used
            // p0.1 is not used
            // p0.2 is not used
            // P0.3 is the charge hv+ output
            // p0.4 is the ok 2 charge signal input (ie IRQ0)
            // p0.5 is the diagnostics dwell interrupt  input (irq1)
            // p0.6 is the charge hv- output
            // p0.7 is not used on WP64D rev1 as the UART0 and I2C1 are now used (was rs232rx)
            GP0DAT = 0x48000000;
    
             // Port 2 setup
            // p2.0 is xtra output
            GP2DAT = 0x1010000;
    
            // set up uart
            COMCON0 = 0x80;                                 // Setting DLAB
            COMDIV0 = 0x88;                                 // Setting DIV0 and DIV1 to DL calculated
            COMDIV1 = 0x00;
            COMCON0 = 0x07;                                 // Clearing DLAB
            COMIEN0 = 0x01;
    
    
    
            IRQEN = 0x00004000;
            FIQEN = 0x00008000;
    
            while(1)
            {
                    GP2DAT ^= 0x010000;
            }
    
    }
    
    
    
    
    
    void IRQ_Handler(void)   __irq
    {
    int a;
    a = COMRX&0xFF; // clear buffer
            GP2DAT ^= 0x1010000;
            return;
    }
    
    void FIQ_Handler(void) __irq
    {  int a ;
            a = FIQSTA;
            GP2DAT ^= 0x1010000;
            return;
    }
    

    this is just a tiny example where i ripped out everything useful just to try and debug the compiler options. this is running on an Analog devices ADuC7022 using uvision4.03 running the eval version of the compiler, linker, hex converter, etc. v 4.0.0.728

    the only thing i can think of anymore is that there has been some change to the hex file creation or that i am missing some kind of compiler option.

    but as far as options go i cant find anything different from this version to what i was using before. the memory addresses are correct, even though it doesnt matter.

    there are some major differences in the startup.s vs the aduc702x.s startup files where the new version has a new syntax, and some other changes that it automatically loads,

Children
  • the .s files have more than 7k characters and keil wont let me post them. an area of interest though i think is

    
    PRESERVE8
    
    
    ; Area Definition and Entry Point
    ;  Startup Code must be linked first at Address at which it expects to run.
    
    AREA    RESET, CODE, READONLY
    ARM
    
    
    ; Exception Vectors
    ;  Mapped to Address 0.
    ;  Absolute addressing mode must be used.
    ;  Dummy Handlers are implemented as infinite loops which can be modified.
    PRESERVE8
    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
                    LDR     PC, SWI_Addr
                    LDR     PC, PAbt_Addr
                    LDR     PC, DAbt_Addr
                    NOP                            ; Reserved Vector
                    LDR     PC, IRQ_Addr
                    LDR     PC, FIQ_Addr
    
                    EXTERN Undef_Handler
                    EXTERN SWI_Handler
                    EXTERN PAbt_Handler
                    EXTERN DAbt_Handler
                    EXTERN IRQ_Handler
                    EXTERN FIQ_Handler
    
    Reset_Addr      DCD     Reset_Handler
    Undef_Addr      DCD     Undef_Handler
    SWI_Addr        DCD     SWI_Handler
    PAbt_Addr       DCD     PAbt_Handler
    DAbt_Addr       DCD     DAbt_Handler
                    DCD     0                      ; Reserved Address
    IRQ_Addr        DCD     IRQ_Handler
    FIQ_Addr        DCD     FIQ_Handler
    
    
    ; Reset Handler
    
                    EXPORT  Reset_Handler
    Reset_Handler
    
    
    ; Setup PLL
                    IF      PLL_SETUP <> 0
                    LDR     R0, =MMR_BASE
                    MOV     R1, #0x01
                    STR     R1, [R0,#POWKEY1_OFFSET]
                    MOV     R1, #PLLCFG_Val
                    STR     R1, [R0,#POWCON_OFFSET]
                    MOV     R1, #0xF4
                    STR     R1, [R0,#POWKEY2_OFFSET]
                    ENDIF   ; PLL_SETUP
    
    
    ; Setup Pins
                    IF      GPIO_SETUP <> 0
    
                    ADR     R10, GPIO_CFG          ; Pointer to GPIO CFG
                    LDMIA   R10, {R0-R5}           ; Load GPIO Configuration
                    STMIA   R0, {R1-R5}            ; Store GPxCON
                    B       GPIO_END
    
    GPIO_CFG        DCD     GPIOBASE
                    DCD     GP0CON_Val
                    DCD     GP1CON_Val
                    DCD     GP2CON_Val
                    DCD     GP3CON_Val
                    DCD     GP4CON_Val
    GPIO_END
    
                    ENDIF   ; GPIO_SETUP
    
    
    ; Setup External Memory Interface
                    IF      XM_SETUP <> 0
    
                    ADR     R10, XM_CFG            ; Pointer to XM CFG
                    LDMIA   R10, {R0-R9}           ; Load XM Configuration
                    STR     R1, [R0],#0x10         ; Store XMCFG
                    STMIA   R0, {R2-R9}            ; Store XMxCON & XMxPAR
                    B       XM_END
    
    XM_CFG          DCD     XMBASE
                    DCD     XMCFG_Val
                    DCD     XM0CON_Val
                    DCD     XM1CON_Val
                    DCD     XM2CON_Val
                    DCD     XM3CON_Val
                    DCD     XM0PAR_Val
                    DCD     XM1PAR_Val
                    DCD     XM2PAR_Val
                    DCD     XM3PAR_Val
    XM_END
    
                    ENDIF   ; XM_SETUP
    
    
    ; Copy Exception Vectors to Internal RAM and Remap Memory
    ;  (when Interrupt Vectors are in RAM)
    
     ;               IF      :DEF:RAM_INTVEC
     ;               ADR     R8, Vectors         ; Source
     ;               LDR     R9, =0x00010000     ; Destination
     ;               LDMIA   R8!, {R0-R7}        ; Load Vectors
     ;               STMIA   R9!, {R0-R7}        ; Store Vectors
     ;               LDMIA   R8!, {R0-R7}        ; Load Handler Addresses
     ;               STMIA   R9!, {R0-R7}        ; Store Handler Addresses
     ;               LDR     R0, =MMR_BASE
     ;               MOV     R1, #1
     ;               STR     R1, [R0,#REMAP_OFFSET]
     ;               ENDIF
    
    
    ; Setup Stack for each mode
    
                    LDR     R0, =Stack_Top
    
    ;  Enter Undefined Instruction Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_UND:OR:I_Bit:OR:F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #UND_Stack_Size
    
    ;  Enter Abort Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_ABT:OR:I_Bit:OR:F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #ABT_Stack_Size
    
    ;  Enter FIQ Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_FIQ:OR:I_Bit:OR:F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #FIQ_Stack_Size
    
    ;  Enter IRQ Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_IRQ:OR:I_Bit:OR:F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #IRQ_Stack_Size
    
    ;  Enter Supervisor Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #SVC_Stack_Size
    
    ;  Enter User Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_USR
                    MOV     SP, R0
                    SUB     SL, SP, #USR_Stack_Size
    
    
    
    
    ; Enter the C code
    
                    IMPORT  __main
                    LDR     R0, =__main
                    BX      R0
    
    
    ; User Initial Stack & Heap
                    AREA    |.text|, CODE, READONLY
    
                    IMPORT  __use_two_region_memory
                    EXPORT  __user_initial_stackheap
    __user_initial_stackheap
    
                    LDR     R0, =  Heap_Mem
                    LDR     R1, =(Stack_Mem + USR_Stack_Size)
                    LDR     R2, = (Heap_Mem +      Heap_Size)
                    LDR     R3, = Stack_Mem
                    BX      LR
    
    
    
                    END
    
    
    

  • and the old startup from uv2

    
    # Starupt Code must be linked first at Address at which it expects to run.
    
            .text
            .arm
    
            .global _startup
            .func   _startup
    _startup:
    
    
    # Exception Vectors
    #  Mapped to Address 0.
    #  Absolute addressing mode must be used.
    #  Dummy Handlers are implemented as infinite loops which can be modified.
    
    Vectors:        LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
                    LDR     PC, SWI_Addr
                    LDR     PC, PAbt_Addr
                    LDR     PC, DAbt_Addr
                    NOP                            /* Reserved Vector */
                    LDR     PC, IRQ_Addr
                    LDR     PC, FIQ_Addr
    
    Reset_Addr:     .word   Reset_Handler
    Undef_Addr:     .word   ADI_UNDEF_Interrupt_Setup
    SWI_Addr:       .word   ADI_SWI_Interrupt_Setup
    PAbt_Addr:      .word   ADI_PABORT_Interrupt_Setup
    DAbt_Addr:      .word   ADI_DABORT_Interrupt_Setup
    IRQ_Addr:       .word   ADI_IRQ_Interrupt_Setup
    FIQ_Addr:       .word   ADI_FIQ_Interrupt_Setup
    
    # Reset Handler
    
    Reset_Handler:
    
    
    .if PLL_SETUP
                    LDR     R0, =MMR_BASE
                    MOV     R1, #0x01
                    STR     R1, [R0,#POWKEY1_OFFSET]
                    MOV     R1, #PLLCFG_Val
                    STR     R1, [R0,#POWCON_OFFSET]
                    MOV     R1, #0xF4
                    STR     R1, [R0,#POWKEY2_OFFSET]
    .endif
    
    
    # Setup Pins
    .if GPIO_SETUP
    
                    ADR     R10, GPIO_CFG          /* Pointer to GPIO CFG */
                    LDMIA   R10, {R0-R5}           /* Load GPIO Configuration */
                    STMIA   R0, {R1-R5}            /* Store GPxCON */
                    B       GPIO_END
    
    GPIO_CFG:       .word   GPIOBASE
                    .word   GP0CON_Val
                    .word   GP1CON_Val
                    .word   GP2CON_Val
                    .word   GP3CON_Val
                    .word   GP4CON_Val
    GPIO_END:
    
    .endif  /* GPIO_SETUP */
    
    
    # Setup External Memory Interface
    .if XM_SETUP
    
                    ADR     R10, XM_CFG            /* Pointer to XM CFG */
                    LDMIA   R10, {R0-R9}           /* Load XM Configuration */
                    STR     R1, [R0],#0x10         /* Store XMCFG */
                    STMIA   R0, {R2-R9}            /* Store XMxCON & XMxPAR */
                    B       XM_END
    
    XM_CFG:         .word   XMBASE
                    .word   XMCFG_Val
                    .word   XM0CON_Val
                    .word   XM1CON_Val
                    .word   XM2CON_Val
                    .word   XM3CON_Val
                    .word   XM0PAR_Val
                    .word   XM1PAR_Val
                    .word   XM2PAR_Val
                    .word   XM3PAR_Val
    XM_END:
    
    .endif  /* XM_SETUP */
    
    
    # Setup Stack for each mode
    
                    LDR     R0, =Top_Stack
    
    #  Enter Undefined Instruction Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_UND|I_Bit|F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #UND_Stack_Size
    
    #  Enter Abort Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_ABT|I_Bit|F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #ABT_Stack_Size
    
    #  Enter FIQ Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_FIQ|I_Bit|F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #FIQ_Stack_Size
    
    #  Enter IRQ Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_IRQ|I_Bit|F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #IRQ_Stack_Size
    
    #  Enter Supervisor Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_SVC|I_Bit|F_Bit
                    MOV     SP, R0
                    SUB     R0, R0, #SVC_Stack_Size
    
    #  Enter User Mode and set its Stack Pointer
                    MSR     CPSR_c, #Mode_USR
                    MOV     SP, R0
    
    #  Setup a default Stack Limit (when compiled with "-mapcs-stack-check")
                    SUB     SL, SP, #USR_Stack_Size
    
    
    # Relocate .data section (Copy from ROM to RAM)
                    LDR     R1, =_etext
                    LDR     R2, =_data
                    LDR     R3, =_edata
    LoopRel:        CMP     R2, R3
                    LDRLO   R0, [R1], #4
                    STRLO   R0, [R2], #4
                    BLO     LoopRel
    
    
    # Clear .bss section (Zero init)
                    MOV     R0, #0
                    LDR     R1, =__bss_start__
                    LDR     R2, =__bss_end__
    LoopZI:         CMP     R1, R2
                    STRLO   R0, [R1], #4
                    BLO     LoopZI
    
    
    # Enter the C code
    
    .if En_StdIO
    
    # Enter the standard system startup code required for stdlib I/O
                    B       _start
    
    .else
    
                    LDR     LR, =__Return_from_main
                    LDR     R0, =main
                    BX      R0
    
    __Return_from_main:
                    B       __Return_from_main
    
    .endif
    
    
            .size   _startup, . - _startup
            .endfunc
    
    
            .end
    
    

  • Do you really mean new syntax?

    If so, have you not only switched from UV2 to UV3, but also from the old (now obsolete) Keil CARM tools to the new ARM RealView tools...?

    In any case, if the startup code is different, that is highly likely to be the key to your problem.

    And, if it works in the simulator but not the target, that almost certainly means it's a hardware-dependency somewhere...