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

Decompressor overwrites my variables...

cpu: at91sam7x256

I have in my project some global objects, they are by default placed at address 0x200000. My program seems to work properly but occasionally beginning of RAM is filled with zeros by Keil library function at label: __decompress1 in deassembly window. It makes some my variables and pointers are useles and program stops responding. The worst is, that pointers are defined as const and they are not expected to change.

Any idea how to solve this error?

Parents
  • Here is updated SWI handler. This one does not allow nested interrupts, but solves your interrupt disable problem.

    SWI_Handler
    
                    STMFD   SP!, {R8, LR}          ; Store R8, LR
                    MRS     R12, SPSR              ; Get SPSR
                    TST     R12, #T_Bit            ; Check Thumb Bit
                    LDRNEH  R12, [LR,#-2]          ; Thumb: Load Halfword
                    BICNE   R12, R12, #0xFF00      ;        Extract SWI Number
                    LDREQ   R12, [LR,#-4]          ; ARM:   Load Word
                    BICEQ   R12, R12, #0xFF000000  ;        Extract SWI Number
    
                    LDR     R8, SWI_Count
                    CMP     R12, R8
                    BHS     SWI_Dead               ; Overflow
                    ADR     R8, SWI_Table
                    LDR     R12, [R8,R12,LSL #2]   ; Load SWI Function Address
                    MOV     LR, PC                 ; Return Address
                    BX      R12                    ; Call SWI Function
    
                    LDMFD   SP!, {R8, PC}^         ; Restore R8 and Return
    
    SWI_Dead        B       SWI_Dead               ; None Existing SWI
    

Reply
  • Here is updated SWI handler. This one does not allow nested interrupts, but solves your interrupt disable problem.

    SWI_Handler
    
                    STMFD   SP!, {R8, LR}          ; Store R8, LR
                    MRS     R12, SPSR              ; Get SPSR
                    TST     R12, #T_Bit            ; Check Thumb Bit
                    LDRNEH  R12, [LR,#-2]          ; Thumb: Load Halfword
                    BICNE   R12, R12, #0xFF00      ;        Extract SWI Number
                    LDREQ   R12, [LR,#-4]          ; ARM:   Load Word
                    BICEQ   R12, R12, #0xFF000000  ;        Extract SWI Number
    
                    LDR     R8, SWI_Count
                    CMP     R12, R8
                    BHS     SWI_Dead               ; Overflow
                    ADR     R8, SWI_Table
                    LDR     R12, [R8,R12,LSL #2]   ; Load SWI Function Address
                    MOV     LR, PC                 ; Return Address
                    BX      R12                    ; Call SWI Function
    
                    LDMFD   SP!, {R8, PC}^         ; Restore R8 and Return
    
    SWI_Dead        B       SWI_Dead               ; None Existing SWI
    

Children