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

ARM7 org 0x38000

Hi all,

I wanna locate the start up code to address 0x38000,
I have to write minimum code at start and I want the other setup codes to start from address 0x38000
I have written a code but it is so long for me,
I think I'll write the code for booting to
"IMPORT BootLoader
B BootLoader"
and other initialization codes will be proceeded in the function named BootLoader.

In another processors there is an instruction line org 0x38000, but I couldn't understand how can I do that in ARM7 LPC2300

UND_Stack_Size  EQU     0x00000010
SVC_Stack_Size  EQU     0x00000008
ABT_Stack_Size  EQU     0x00000010
FIQ_Stack_Size  EQU     0x00000100
IRQ_Stack_Size  EQU     0x00000100
USR_Stack_Size  EQU     0x00000400

ISR_Stack_Size  EQU     (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ 
                         FIQ_Stack_Size + IRQ_Stack_Size)

                AREA    STACK, NOINIT, READWRITE, ALIGN=3
Stack_Mem       SPACE   USR_Stack_Size
Heap_Size       EQU     0x00000400

                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
Heap_Mem        SPACE   Heap_Size


                AREA    RESET, CODE, READONLY
                ARM

                                        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, [PC, #-0x0120]
                LDR     PC, FIQ_Addr

Reset_Addr      DCD     Reset_Handler
Undef_Addr      DCD     Reset_Handler
SWI_Addr        DCD     Reset_Handler
PAbt_Addr       DCD     Reset_Handler
DAbt_Addr       DCD     Reset_Handler
                DCD     0                      ; Reserved Address
IRQ_Addr        DCD     Reset_Handler
FIQ_Addr        DCD     Reset_Handler

; Reset Handler
Reset_Handler
                                                                IMPORT BootLoader
                                                                B       BootLoader ; Goto bootloader

;########################
;##### END OF CODE ######
;########################
;other codes will be at address 0x38000

; 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

Best regards & thanks

0