[Tiny6410] led bare board program

Source: Internet
Author: User

Start. s file

StartCodeIt is very simple, mainly to do some hardware-related settings: Tell the core address of the CPU peripherals, turn off the dog, set the stack (for callsC LanguagePreparation)

 

 
. Globl _ start_start:/* hardware-related settings * // * Peri Port setup */LDR r0, = 0x70000000 Orr r0, R0, #0x13 MCR P15, 0, r0, C15, C2, 4 @ 256 m (0x70000000-0x7fffffff)/* shut down the watchdog * // * write 0 */LDR R0 to wtcon (0x7e004000), = 0x7e004000mov R1, # 0str R1, [R0]/* set the stack because C language calls require stack */LDR sp, = 4*1024 + 0x50000000 // set the stack address, + 0x50000000 is downloaded to DDR for running, and the DDR start address is 0x50000000bl main // jump to main to run halt: B halt

 

Led. c file

Configure gpk4 as the IO output port and set it to 0

// Define the register # define gpkcon0 (* (volatile unsigned long *) 0x7f008800) # define gpkdat (* (volatile unsigned long *) 0x7f008808) int main () {/* Set gpk7 as the output pin */gpkcon0 = gpkcon0 &(~ (0xf <28) | (1 <28 ); // 0001 0000 0000 0000 0000 0000 0000 00000 = 0x10000000/* gpk7 output 0 */gpkdat = gpkdat &(~ (1 <7); Return 0 ;}

Makefile

 

 
LED. bin: Start. O led. the oarm-Linux-LD-ttext 0x50000000-O led. elf start. O led. O # link to the 0x50000000 address. Because we download it to DDR and run it, the DDR start address is 0x50000000arm-linux-objcopy-O binary led. elf led. bin # generate the binfile arm-Linux-objdump-D led. elf> led. dis # generate the disassembly file start. o: Start. SARM-Linux-gcc-o start. o start. s-C # compile start. sled. o: LED. carm-Linux-gcc-O led. O led. c-C # compile led. cclean: RM *. O led. elf led. bin led. DIS

Because weProgramLoad it to the address starting from DDR (0x5000) and run it from start. in S, SP is set in DDR, and the link address of text in makefile is also from the link to DDR; therefore, this program is not applicable to running on a board where no DDR is initialized or the base address of the DDR is not 0x5000 0000.

Change 0x5000 0000 to 0 if internal SRAM is to be run.

 

How to load the make production led. binfile to the DDR of tiny6410 for running?

I am using the minitool tool,

Preparations:
1. Use the SD-flasher tool to burn the superboot into the SD card.
2. Copy the images/friendlyarm. ini file on the CD to the images directory on the SD card.
3. Edit the images/friendlyarm. ini file in the SD card and add the following content:

USB-mode = Yes

 

Connection steps:
1. Switch the S2 switch on the development board to the SD card or nor flash startup mode.
2. After power-on, the Development Board will enter the USB download mode, and the LCD will display "USB mode: waiting ..."
3. Connect the computer and Development Board with USB cable
4. If the connection is successful, "USB mode: connected" will be displayed on the LCD"

This is the program that has been loaded to DDR on the Development Board.

 

 

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.