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?
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
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- TI CCS & controlSUITE Troubleshooting Log
- Several issues about high frequency transformers
- PSF Trademark Usage Policy
- CC1310 Two-wire Serial Bootloader Solution
- Finding hope in despair
- Please recommend a 48 to 12V DCDC step-down chip
- Happy Valley facility malfunctioned, many children were hanging upside down in the air~~
- [LAUNCHXL-CC2650] simple_peripheral routine analysis
- Is it a tax on IQ?
- CCS compilation error: unresolved symbols remain solution