gec210 led bare metal development assembly instructions

Publisher:书香门第Latest update time:2022-07-29 Source: csdn Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Software environment: ADS1.2

Hardware platform: GEC210 development board


Running method: Use uboot to download to memory 0x30008000, then use the go command to run and view the effect.


The effect of this program is that all the LEDs are lit at the beginning, and then they change according to the binary addition until all the lights are off, and then the cycle repeats. The program will not return to uboot, it is an infinite loop


Schematic Description:

    The 4 LEDs are connected to the positive pole of the power supply through pull-up resistors, and the cathode of the LED is connected to the corresponding pins 0-3 of GPJ2io.

    So these 4 LEDs will light up when the CPU outputs a low level, and will go out when the CPU outputs a high level

    

    The program code is as follows:


    AREA init,code,readonly; Set segment attributes, code segment, code segment name inti, read-only attribute

    entry; entry, the same project should not have multiple entries


    ldr r0,=0xe0200280; led corresponding GPIO control register

    ldr r1,=0x1111 ;Configure as output mode

    str r1,[r0] ;Configure the corresponding pin to output mode

loop0    

    mov r1,#0x0

loop    

    strb r1,[r0,#4]

    add r1,r1,#1

    bl delay

    cmp r1,#0xf

    bne loop

    b loop0

        

    mov pc,lr; if the go command is used in uboot, it will jump back to uboot  


                              ;Not applicable to this program because the previous one is an infinite loop.


;The delay function is to let the CPU do something that has nothing to do with the LED, such as subtraction.

delay

    move r2, #0xff00000

delay1

    subs r2,r2,#1

    bne delay1

    mov pc,lr; until it decreases to 0, the delay function will return

    

    end


Note: If you use arm-linux-gcc to compile, pay attention to some differences in usage.


Reference address:gec210 led bare metal development assembly instructions

Previous article:Introduction to arm architecture registers
Next article:arm assembly pseudo-instructions and position-dependent codes

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号