RE: [arm-gnu] codesourcery compile helping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [arm-gnu] codesourcery compile helping



Hi ,
 
you need to write ...
stack_base :      

   .word     0x80000     @ stack defin  

 

You need to write ":" after symbol name in GCC.

 

cheers,

parag

 

 

 

	-----Original Message-----
	From: Yongming (Stephen Lg) Hu [mailto:yohu@xxxxxxx] 
	Sent: Monday, March 06, 2006 9:03 AM
	To: Borkar, Parag (Parag)
	Subject: RE: [arm-gnu] codesourcery compile helping
	
	

	Please see the red words, could you help me to solve this
question

	Thank you

	Stephen

	 

	////////////////////////////////////

	.section  .data    @ pre_define

	       

	Mode_USR        =     0x10

	Mode_FIQ        =     0x11

	Mode_IRQ        =     0x12

	Mode_SVC        =     0x13

	Mode_ABT        =     0x17

	Mode_UND        =     0x1B

	Mode_SYS        =     0x1F 

	 

	I_Bit           =     0x80 

	F_Bit           =     0x40 

	 

	 

	Len_UND_Stack    =     256

	Len_ABT_Stack    =     256

	Len_IRQ_Stack    =     256

	Len_FIQ_Stack    =     256

	Len_SVC_Stack    =     256

	 

	Offset_UND_Stack         =     0

	Offset_ABT_Stack         =     256

	Offset_IRQ_Stack         =     512

	Offset_FIQ_Stack         =     768

	Offset_SVC_Stack         =     1024

	 

	.section  .text    @ program start

	.global _start

	 

	_start:            @ begin

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	@@ exception enter address define

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	        LDR      PC, Reset 

	        LDR      PC, Undefined_Handler

	        LDR      PC, SWI_Handler

	        LDR      PC, Prefetch_Handler

	        LDR      PC, Abort_Handler

	        B        .

	        LDR      PC, IRQ_Handler

	        LDR      PC, FIQ_Handler    

	        

	 

	@ ************************

	@ Exception Handlers

	@ ************************

	Undefined_Handler:

	        B       Undefined_Handler

	SWI_Handler:

	        B       SWI_Handler     

	Prefetch_Handler:

	        B       Prefetch_Handler

	Abort_Handler:

	        B       Abort_Handler

	IRQ_Handler:

	        B       IRQ_Handler

	FIQ_Handler:

	        B       FIQ_Handler

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	@@  reset handler 

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	 Reset:     

	@ Enter each mode in turn and set up the stack pointer 

	        

	        LDR     r0,     stack_base 

	        @MSR     CPSR_c, $Mode_UND:OR:I_Bit:OR:F_Bit   @Undefine
mode

	        MRS      R1, CPSR

	        ORR      r1, r1, $I_Bit

	        ORR      R1, R1, $F_BIT

	        ORR      R1, R1, $Mode_USR

	        MSR     CPSR, R1

	        SUB     sp, r0, $Offset_UND_Stack            

	        

	        @MSR     CPSR_c, $Mode_ABT:OR:I_Bit:OR:F_Bit   @Abort
mode

	        MRS     r1,     CPSR

	        ORR     r1, r1, $I_Bit

	        ORR     R1, R1, $F_BIT

	        ORR     R1, R1, $Mode_ABT

	        MSR     CPSR, R1

	        SUB     sp, r0, $Offset_ABT_Stack

	 

	        @MSR     CPSR_c, $Mode_IRQ:OR:I_Bit:OR:F_Bit   @IRQ mode

	        MRS     r1,     CPSR

	        ORR     r1, r1, $I_Bit

	        ORR     R1, R1, $F_BIT

	        ORR     R1, R1, $Mode_IRQ

	        MSR     CPSR, R1

	        SUB     sp, r0, $Offset_IRQ_Stack

	 

	        @MSR     CPSR_c, $Mode_FIQ:OR:I_Bit:OR:F_Bit   @FIQ mode

	        MRS     r1,     CPSR

	        ORR     r1, r1, $I_Bit

	        ORR     R1, R1, $F_BIT

	        ORR     R1, R1, $Mode_FIQ

	        MSR     CPSR, R1

	        SUB     sp, r0, $Offset_FIQ_Stack

	 

	        @MSR     CPSR_c, $Mode_SVC:OR:I_Bit:OR:F_Bit   @ SVC
mode

	        MRS     r1,     CPSR

	        ORR     r1, r1, $I_Bit

	        ORR     R1, R1, $F_BIT

	        ORR     R1, R1, $Mode_SVC

	        MSR     CPSR, R1

	        SUB     sp, r0, $Offset_SVC_Stack

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@

	@@ call the main function

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@                           

	       @ LDR     r12,=C_Entry

	       @ BX      r12

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@

	@@ IRQ exception handler

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@                               

	 

	stack_base      

	   .word     0x80000     @ stack defin  

	
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////

	Could not run still: which imply:  error instruction:
stack_base      

	                                      .word     0x80000

	I want to define the stack point address

	 

	
________________________________


	From: Borkar, Parag (Parag) [mailto:borkar@xxxxxxxxx] 
	Sent: Monday, March 06, 2006 3:36 PM
	To: Yongming (Stephen Lg) Hu; arm-gnu@xxxxxxxxxxxxxxxx
	Subject: RE: [arm-gnu] codesourcery compile helping

	 

	Hi Stephen,

	 

	the equivalent of DCD in GNU as is .word. 

	 

	regards,

	parag

	-----Original Message-----
	From: Yongming (Stephen Lg) Hu [mailto:yohu@xxxxxxx] 
	Sent: Monday, March 06, 2006 3:18 AM
	To: arm-gnu@xxxxxxxxxxxxxxxx
	Subject: [arm-gnu] codesourcery compile helping

		Dear Sir;

		 

		   I am a new player, I want to use the coudsourcery to
compile and debug the arm assemble language. 

		 

		I give you the program, could you help me solving the
question. Thank you.

	
@///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

		.section  .data    @ pre_define

		       

		Mode_USR        =     0x10

		Mode_FIQ        =     0x11

		Mode_IRQ        =     0x12

		Mode_SVC        =     0x13

		Mode_ABT        =     0x17

		Mode_UND        =     0x1B

		Mode_SYS        =     0x1F 

		 

		I_Bit           =     0x80 

		F_Bit           =     0x40 

		 

		 

		Len_UND_Stack    =     256

		Len_ABT_Stack    =     256

		Len_IRQ_Stack    =     256

		Len_FIQ_Stack    =     256

		Len_SVC_Stack    =     256

		 

		Offset_UND_Stack         =     0

		Offset_ABT_Stack         =     256

		Offset_IRQ_Stack         =     512

		Offset_FIQ_Stack         =     768

		Offset_SVC_Stack         =     1024

		 

		.section  .text    @ program start

		.global _start

		 

		_start:            @ begin

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		@@ exception enter address define

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		        LDR      PC, Reset 

		        LDR      PC, Undefined_Handler

		        LDR      PC, SWI_Handler

		        LDR      PC, Prefetch_Handler

		        LDR      PC, Abort_Handler

		        B        .

		        LDR      PC, IRQ_Handler

		        LDR      PC, FIQ_Handler    

		        

		 

		@ ************************

		@ Exception Handlers

		@ ************************

		Undefined_Handler:

		        B       Undefined_Handler

		SWI_Handler:

		        B       SWI_Handler     

		Prefetch_Handler:

		        B       Prefetch_Handler

		Abort_Handler:

		        B       Abort_Handler

		IRQ_Handler:

		        B       IRQ_Handler

		FIQ_Handler:

		        B       FIQ_Handler

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		@@  reset handler 

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		 Reset:     

		@ Enter each mode in turn and set up the stack pointer 

		        

		        LDR     r0,     stack_base 

		        @MSR     CPSR_c, $Mode_UND:OR:I_Bit:OR:F_Bit
@Undefine mode

		        MRS     r1,     CPSR

		        BIC     r1, r1, $I_Bit

		        BIC     R1, R1, $F_BIT

		        BIC     R1, R1, $Mode_USR

		        MSR     CPSR, R1

		        SUB     sp, r0, $Offset_UND_Stack            

		        

		        @MSR     CPSR_c, $Mode_ABT:OR:I_Bit:OR:F_Bit
@Abort mode

		        MRS     r1,     CPSR

		        BIC     r1, r1, $I_Bit

		        BIC     R1, R1, $F_BIT

		        BIC     R1, R1, $Mode_ABT

		        MSR     CPSR, R1

		        SUB     sp, r0, $Offset_ABT_Stack

		 

		        @MSR     CPSR_c, $Mode_IRQ:OR:I_Bit:OR:F_Bit
@IRQ mode

		        MRS     r1,     CPSR

		        BIC     r1, r1, $I_Bit

		        BIC     R1, R1, $F_BIT

		        BIC     R1, R1, $Mode_IRQ

		        MSR     CPSR, R1

		        SUB     sp, r0, $Offset_IRQ_Stack

		 

		        @MSR     CPSR_c, $Mode_FIQ:OR:I_Bit:OR:F_Bit
@FIQ mode

		        MRS     r1,     CPSR

		        BIC     r1, r1, $I_Bit

		        BIC     R1, R1, $F_BIT

		        BIC     R1, R1, $Mode_FIQ

		        MSR     CPSR, R1

		        SUB     sp, r0, $Offset_FIQ_Stack

		 

		        @MSR     CPSR_c, $Mode_SVC:OR:I_Bit:OR:F_Bit   @
SVC mode

		        MRS     r1,     CPSR

		        BIC     r1, r1, $I_Bit

		        BIC     R1, R1, $F_BIT

		        BIC     R1, R1, $Mode_SVC

		        MSR     CPSR, R1

		        SUB     sp, r0, $Offset_SVC_Stack

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@

		@@ call the main function

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@                           

		       @ LDR     r12,=C_Entry

		       @ BX      r12

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@

		@@ IRQ exception handler

	
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@                               

		 

		stack_base      DCD     0x80000     @ stack defin  

	
@///////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/////////////////

		I use the arm-none-eabi-as -mcpu=arm7 -o=Vector_GNU.o
Vector_GNU.s

		 

		But it imply bad instruction ' stack_base DCD 0x80000'

		 

		Could you tell me how to solve the question.

		 

		Thank you

		Stephen