jzs3c2440 Bare Board Program Gpio Operation Summary

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.