Two ways of assembling, assembling +c
***************************************
Assembler Programming LED_ON.S
****************************************
. text
. Global _start
_start:
LDR ro,=0x***//register address to operate Gpfcon
MOV r1, #0x * * *//Register value to be modified
STR R1,[R0]
LDR ro,=0x***//register address to operate Gpfdate
MOV r1, #0x * * *//Register value to be modified
STR R1,[R0]
Main_loop:
b main_loop
***********************
Makefile
Led_on:led_on.s
Arm_linux_gcc-g-C Led_on.s-o led_on.o.
Arm_linux_ld-ttext 0x00000000-g Led_on.o-o led_on_elf
Arm_inux_objcopy-o binary-s Led_on.bin led_on_elf
Clean
Rm-f led_on_elf Led_on.bin *.O
******************************************
Assembly and C mixed-code CRTO.S LED_ON_C.C
******************************************
. text
. Global _start
_start:
LDR ro,=0x53000000//inhibit watchdog
mov r1, #0x0
STR R1,[R0]
LDR sp,=1024*4//Set stack
BL Main
Main_loop:
b main_loop
*************************
#define GPFCON * * *//Register address required for operation
#define GPFDAT * * *
int main ()
{
gpfcon=0x00000;
gpfdat=0x10000;
return 0;
}
************************
Makefile
Led_on_c.bin:crt0. S LED_ON_C.C
Arm-linux-gcc-g-c-o crt0.o crt0. S
Arm-linux-gcc-g-c-o LED_ON_C.O LED_ON_C.C
Arm-linux-ld-ttext 0x0000000-g crt0.o Led_on_c.o-o led_on_c_elf
Arm-linux-objcopy-o binary-s led_on_c_elf Led_on_c.bin
arm-linux-objdump-d-M arm led_on_c_elf > Led_on_c.dis
Clean
Rm-f Led_on_c.dis led_on_c.bin led_on_c_elf *.o
jzs3c2440 Bare Board Program Gpio Operation Summary