Debugging on the board-lighting method

Source: Internet
Author: User

1. makefile under Win
Makefile

Asmasm led. S-O led. O // compile the. S source file into the target file
Armlink-ro-base 0x0-entry 0x0 led. o-O led. axf // connector, parameter 1: Run. start address of the Text Segment, base address, parameter 2: The entry address for debugging; (optional )//. an elf file that can be debugged by the axf with debugging information.
Fromelf led. axf-bin-output led. Bin // remove the debugging information of. axf, generate a streaking bind file, and execute it on the board (exec can be used directly );

Ii. Lighting method (very hanging debuger) my frist Program
Step 3: 1. iopmod: Set the input and output directions of gpio, Io control set output (1)/input (0); 2, 3: iopdata: directly assign a value of 1 light to the LED pin, 0 off;
1. iopmod
First, set the input/output direction of gpio.
; The internal I/O port mode register iopmod (Address: 0x03ff5000) is implemented as follows:
LDR R1, = 0x0003ffff; set all 18 gpios 'ction ction to output
LDR r0, = 0x03ff5000
STR R1, [R0]

2. Then, set the relevant gpio output 1 to light up the connected led.
; This is achieved by setting the iopdata (Address: 0x03ff5008) of the internal IO port data register of initi4510b:
The implementation principle is also very simple. The LED light is connected to the IO provided by the. The specific connection method is as follows:
;
; Hardware connection
; Pio17 pio04 pio05 pio06 (gpio); query datasheet to find which one can make the corresponding
; The led below is on.
; D6 D7 D8 D9 (LED );
; So output value = 0x00020070 = (0b0000 0000 0000 0010 0000 0000 0111); check DS and assign 1 to the bit of the IO register, you can set the corresponding gpio to 1 or 0, and then control the led to be on or off.
;

; Light the LED, flashing
LDR R1, = 0x00020070; show led = 1111
Loop:
LDR r0, = 0x03ff5008
STR R1, [R0]
B Loop

3.
; Turn off the LED
LDR R1, = 0x00000000; show led = 0000
Loop:
LDR r0, = 0x03ff5008
STR R1, [R0]
B Loop

Use the analyticdb 1.2 compiler to compile, link, and obtain binary executable code:
 
Armasm led_1111.s-O led_1111.o
Armlink-ro-base 0x0-entry 0x0 led_1111.o-O led_1111.axf // file. axf
Fromelf led_1111.axf-bin-output led_1111.bin

A self-made, welded, and debugged board can first burn the lamp-on program and run it.
When flashing, it should at least indicate the connection between the CPU and flash, the welding is normal, and the crystal oscillator works normally. // Crystal oscillator ??
Before printf fails to output data, LED is always our most reliable debuger.

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.