Embedded Learning Note 002-lit LED

Source: Internet
Author: User

  1. Just as the first program to print "Hello World", the first use of the TQ2440 Development Board from the simplest part of the beginning, lit LED lights is undoubtedly the simplest, at least as long as the setting of a few registers is good, compared to the printing is much easier, Follow-up will talk about the serial port section to achieve our Golden Code of dialogue ~ ~ ~
  2. Board a total of 4 LED lights, if you can successfully light one of them, then the other few will not be a problem, so our goal is to first Light first first, here we must clarify a few questions:
    A. Related registers for pin connections of LEDs
    B. Languages written
    C. What to use to compile the link into an executable file
    D. How to download to the board, burn into where nor flash or NAND flash
    Now let's take a slow approach:
    A. View tq2440 schematic found that the 4 LEDs are connected to the gpb5~8 respectively, because one end is connected to VCC, so the pin is set to output and 0 (low) is light, 1 (high) is off, the relevant register has Gpbcon (0x56000010), Gpbdat ( 0x56000014), the rest can be taken without consideration.
    B. The experiment at the same time to achieve the assembly and C, wherein the assembly is mainly to achieve an LED light, in order to understand the basic flow of the Assembly, the implementation is called Simple, C can be slightly "complex" points, such as multiple LEDs, running water lamps, etc., more flexible.
    C. Because our development environment is on the PC, want to end up on the board with the help of cross-compiling tools, so-called cross-compiler tool is to compile the source code for the specific architecture of the processor to identify the machine language, such as PC is X86 architecture, and the board is ARM architecture, Here the use of arm-linux-3.4.5, as to how to install the cross-compiler tool chain can be self-surfing, remember to add to the path of the environment variable after installation, so you use the relevant compilation command to search, in my case, I was added to my home There is a. profile file under the directory
    vim. profile
    export path= $PATH:/opt/embedsky/crosstools_3.4.5_softfloat/gcc-3.4.5-glibc-2.3.6/arm-linux/bin
    Can take a look at this path bin there is no ARM-LINUX-GCC arm-linux-ld command and the like, if it is GCC ld that is the path is wrong oh, before it is to add this path/opt/embedsky/crosstools_3.4.5_ Softfloat/gcc-3.4.5-glibc-2.3.6/arm-linux/arm-linux/bin out of the Black dragon .........
    Save after exiting remember
    source. Profile
    To make it effective, you can enter the relevant command to see if it is possible to execute, such as:
    arm-linux-gcc-v
    This is the version command that looks at the cross-compilation toolchain, and if it is not added to the path, it will tell you that the command is not found, otherwise it will print a bunch of messages, and you will see this line at the end:
    gcc version 3.4.5
    D. Since the bootloader has a burn-in function, the embedded bootloader is burned into nor flash, and then the bootloader is used to burn our code into NAND flash, Subsequent examples will use this method to burn code into NAND Flash, which is the easiest way, if you want to "wayward" through external tools to burn code into the NAND flash readers can check their own. Just bought the board nor Flash has been burned into a good day embedded bootloader, will dial switch to nor option to start the power will be in the serial port to see the download interface (if the serial port configuration is correct), if there is no tool will be bootloader burn into nor flash. For how to burn in bootloader to nor flash please consult the add enclosed CD-ROM document.
    PS: Because our code is written under Ubuntu, and burned in through the Win7 environment, I use Samba to achieve Win7 access to Ubuntu, the specific way is to build a directory "Samba" in the home directory, and then all the relevant code in this directory implementation, Open Samba server at the same time (see how to set up Samba yourself), then access it via Win7 and map to a local drive letter as simple as accessing your own hard drive. The simultaneous operation of Ubuntu is not done directly in the Ubuntu interface, but is accessed through SECURECRT.
  3. Now explain the specific code to write, start with the Assembly
    Because it's too late to continue tomorrow night

Embedded Learning Note 002-lit LED

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.