ARM Series--FS2410 LED Cyclic Lighting

Publisher:咖啡小熊Latest update time:2016-12-02 Source: eefocusKeywords:FS2410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. PurposeTo
   understand the basic process of ARM embedded development by realizing the cyclic lighting of the four light-emitting diodes D9, D10, D11, and D12 on the FS2410 board.

2. Establish the development environment
   (1) Install the compiler arm-linux-gcc.
       I use arm-linux-gcc-3.4.1. The installation steps are as follows:
       tar xjvf arm-linux-gcc-3.4.1.tar.bz2 -C /

   (2) The generated compilation tools are under /usr/local/arm/3.4.1/bin. Modify /etc/profile and add arm-linux-gcc to the PATH environment variable. This way, you can directly use compilation tools such as arm-linux-gcc without specifying the path, which is much more convenient:
       
       PATH=$PATH:/usr/local/arm/3.4.1/bin
       export.
       
       Note that it will take effect after reboot. You can use which arm-linux-gcc to check whether your settings are effective.

3. Briefly understand the development board
   Because we want to control the four light-emitting diodes D9, D10, D11, and D12 on the development board and make them light up in a cycle, it is necessary to understand how the FS2410 development board controls them. By checking the schematic diagram of this development board, we found that D9, D10, D11, and D12 actually correspond to GPF7, GPF6, GPF5, and GPF4 of the GPFCON register, and GPF4, 5, 6, and 7 are the 9th and 8th, 11th and 10th, 13th and 12th, and 15th and 14th bits of the GPFCON register, respectively. The corresponding relationship is as follows:

    -------------------------------------------------- ---
    GPFCON Bit Description
    ----------------------------------------------- ----------
    GPF7 [15:14] 00 = Input 01 = Output
                                           10 = EINT7 11 = Reserved
    ----------------------- -------------------------------
    GPF6 [13:12] 00 = Input 01 = Output
                                           10 = EINT6 11 = Reserved
    -- -------------------------------------------------- -
    GPF5 [11:10] 00 = Input 01 = Output
                                           10 = EINT5 11 = Reserved
    ---------------------------------- -----------------------
    GPF4 [9:8] 00 = Input 01 = Output
                                           10 = EINT4 11 = Reserved
    ---------- --------------------------------------------------       

   GPF4,5,6,7 need to be set as output to control the lighting of four LEDs D12, D11, D10 and D9.
   Because these four LEDs are all low level effective, the corresponding bits of GPF DAT need to be set to 0.

4. Write a program
   (1) An assembly program: 
       ; led_on.s
       .text
       .global _start
     _start:
        mov r3, #4 ; Counter, used to light up four lights in a loop
        ldr r0, =0x56000050 ; Set R0 to the GPFCON register, which is
                                            used to select the function of each pin of port F: output
                                            , input, or other
        mov r1, #0x1
        mov r2, r1, LSL#8
     _loop:
        ldr r4, =100000
        str r2, [r0]
       
        ldr r5, =0x56000054 ; Set R5 to the GPFDACT register, used to read/write
                                            the data of each pin of port F
        mov r1, #0x0
        str r1, [r5]
        
     _delay: 
        nop
        subs r4, r4, #1
        bne _delay
       
        mov r2, r2, LSL#2
        subs r3, r3, #1
        bne _loop
        
        b _start
       
       Haha, you may ask why we have to use assembly, because we are now running directly on the "naked" chip, without the support of the operating system, unable to initialize the C environment, and our program will be burned into the first 4K of Nand flash in the future, and Nand flash has no address bus. If we use C, its variables and functions cannot be found.

   (2) Write
       Makefile Making files is essential for writing programs under Linux. It can simplify your compilation process:
       led_on:led_on.s
               arm-linux-gcc -c -o led_on.o led_on.s
               arm-linux-ld -Ttext 0x00000000 -g led_on.o -o led_on_tmp.o
               arm-linux-objcopy -O binary -S led_on_tmp.o led_on
       
       clean:
               rm -f led_on.o
               rm -f led_on
               rm -f led_on_tmp.o

       Note that there should be a TAB before the corresponding command in the Makefile.

   (3) Compile the program
       and execute make -f Makefile to generate led_on. Haha, what we want is finally generated.

5. Burn the program
   Take the generated led_on to Windows XP, and burn it to the Nand flash of the development board through JTAG. Execute sjf2410.exe /f:led_on and press Enter. When prompted, enter 0, 0, 0 in sequence. When the burning is complete
   , a prompt will appear. Enter 2 to exit.
   
   Reset the development board. Do you see the LEDs being lit up in sequence?


Keywords:FS2410 Reference address:ARM Series--FS2410 LED Cyclic Lighting

Previous article:ARM Series -- Migrating code from Nand Flash to memory on FS2410 development board
Next article:ARM Series -- Memory Migration Experiment on FS2410 Development Board

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号