Embedded Development Summary---application Chapter

Source: Internet
Author: User

Lab Catalogue:

Problems encountered during the course:

    1. System crashes

      This problem was caused by modifying a. c file inside the kernel of the system, then I compiled the kernel myself, and the steps refer to the Isaiah PDF description. Moreover, the PDF says, after burning the kernel, reboot to restore to the original kernel, after my test, this sentence has a problem. I follow the PDF instructions, restart the direct crash, has been reboot, and then directly garbled.

      There is something wrong with this sentence:

      The following problem occurs because I set the IP address incorrectly

      Need to be reset.

      The following problem is the problem caused by modifying kernel parameters without reason:

    2. Re-assembly system

      As shown above, follow the PDF document exactly. It is necessary to note that the system itself has been burned to write the TFTP tool.

      The second thing to note is that the problem with the network segment, the IP you entered on arm and the IP in your TFTP can be different.

      My development environment is a notebook computer, that is, I have two network cards, I only need to ensure that the PC-side IP and arm IP can be ping-pass. The cable may not be connected at this time.

      At this point we set the IP address of the wired network. This way, the machine and arm can ping each other, and then we can use the TFTP tool to download and upload the arm system. That is

      Uimage System. Follow the steps in the documentation to proceed.

    3. About the physical connection relationship of IO ports

      For the connection on the board, we generally need to look at the CBT210-DVP backplane. See the picture below for details

    4. About Driver Development

      Prior to the drive development understanding is relatively simple, recently in the can development, feel more difficult. Originally embedded inside also has more can make of place. The core boards we buy are the same.

Of course, the light core board this piece there are many different styles can be selected. But inside the same thing, according to the resources inside, we can develop a lot of the functions we want to engage.

I am currently using the Development Board is s5pv210, want to understand this monolithic microcomputer, can refer to its user-mannal datasheet or its own datasheet. These are the necessary things to develop.

For a chip, it is driven by foreign people to write good things, specific can be found in the following directory.

Above is a complete system of source code, everything has.

The entire system structure is as follows:

We are just concentrating on the driver layer, mainly involved in driver layer development. In this, the factory, the manufacturers have already each pin function has been driven to write well.

When we write our own drivers, we only need to call the manufacturer to write the driver.

Here's an example: in ADC development, we call it directly based on the written drive of the hardware itself. For Linux, everything is file.

All we have to do is read the file, write the file, manipulate the file, register the file, close the file. Operation files, which we can understand as configuration files. This means adding some operations other than read and write.

So to speak, as long as the board inside the pin of the multiplexing function, you as long as the connection, you can use it has been written by the driver to build their own projects.

At this point, the company's work is actually the core board pin has the function, plus peripherals only.

Of course, I've just mentioned that there are two ways to load a drive: 1, compile kernel 2, add drivers as modules

Both of the advantages and disadvantages of the two ways, to add the driver module mode, you can receive the uninstall and add, flexibility is better. For details, refer to the Getting Started section of the kernel driver. This section explains how to manually

Load the driver. There are several key commands: Insmod Mknod and so on. Drivers generally end with Xxx.ko.

The second way is to compile the kernel, usually by make menuconfig to add or delete the specified module, and then make, that is, compile. After compiling, generate a xximage file, then convert the format and load it into arm. This is usually done with TFTP.

    1. About debugging

      Linux inside the biggest inconvenient place is debugging, debugging generally not humane, we need to download debugging Tools for debugging. There are generally two ways: 1) plus breakpoint.

2) with GDB, GDB has the arm side and Linux side, so we can achieve remote debugging. This can also be used to analyze the program to verify that it is correct.

Reference: Installation of the http://my.oschina.net/gzhuo/blog/323434 arm-linux gdb debugging Tool

http://www.cnblogs.com/hankers/archive/2012/12/07/2806836.html GDB Debugging the use of some commands

  1. About application development (interface is not available)

    The main explanation here is the interface and no interface. There is the interface is the development of QT, about QT development now generally write code on Windows, and then into the Linux cross-compile, to see if there are errors.

    Generally speaking, the Linux side of the program and the arm side of the program is similar, the library what can be universal. So the development of the QT program is similar to the development of MFC under Windows.

    But a different place is that QT is cross-platform, it can run on Apple, Linux, Windows, the source code is the same, but the compiler is not the same. That is, you can run QT program on Windows, the development of the QT program on the Windows side, but at this time you can not call the Linux side of the library function, on a platform to play cool, to abide by the rules of a platform, can not be played according to the rules of the card. Of course, we can also develop on Linux, but here is a handy point, if you are already familiar with the Windows system, you can first put the program on Windows.

    Then get the Linux to compile, so you can save a lot of time and energy. This should be noted. Of course, if your program is running on ARM, then you compile it with a cross-compilation environment. Then it can be run on the Linux system above the arm side. Because it is with the interface, you need to add the LCD library, so that it can be displayed.

    For non-interface program development, and vs above written. C and. h are similar. However, it is not so convenient to use GDB to debug.

    Of course, the above is to write the source code, the compilation of the source code is also a thing to pay attention to. No interface and interface are not the same. For non-interface program compilation, we now generally need to write Makefile files. The simplest makefile files are as follows, set up dependent libraries, and the origin of each file, purge files, etc.

    As for the preparation of the makefile file, you can refer to the following information:

    http://blog.csdn.net/haoel/article/details/2897 with me to write makefile. A good place to use makefile files is that we don't need to use static libraries and dynamic libraries. Of course, if you want to introduce another third-party library, which is a. So file, this can be configured in the makefile file. It is emphasized that, for driver development projects, we write driver module makefile and ordinary English program is not the same, this also need to write a special makefile file, of course, this can refer to other people write things.

For the development of QT program, will produce makefile file specially, do not write for oneself specially. If there is no project, you can build it yourself, makefile will generate it yourself, this need not worry.

    1. About can development

      Recently do can development, encountered a lot of problems, the main is that they have just started to do, a lot of things are not too, so it takes longer than normal.

      Hardware interface:

For the above wiring diagram, in fact, GND and 5V can not be connected, we only need to pick up two lines Canh and canl can be. USBCAN2 over there too.

On the Development Board, the module used is MCP2510 http://wenku.baidu.com/link?url=sgIr2WM0lg1A9G4efVooZj1Up-BgUnmxlNjdotneuA_ zioqmiv2q2plrkhjwlbwiccwcweoroawjtsnbunzhjotbkdbcia4lme3cgcekq0w Chinese Documents

This chip is the SPI-to-can communication setup: http://blog.163.com/zhaozhi_q/blog/static/170060833201211165956770/

Driver Development Example: http://blog.csdn.net/xiafeng1113/article/details/7881900

?

Another problem is the question of time:

Not yet resolved, I tried to modify the time interval found in can send, as long as can send >100ms, this kind of problem appears very few. So, I wonder if I can improve

Can rate, but can rate and you send interval is not related, this can only say the problem of SPI communication, and then try to modify the kernel inside the driver function:

Location: There are 210 settings for the SPI rate at the time of Development Board initialization.

?

Later, thinking about this thing is related to can, the code must be inside the can drive, and then found can drive related code:

Character device: code here.

?

A small place:

Comment out the can communication main.c inside the # define debug 1, there will be debugging information invisible situation. Just take a look at this.

    1. Difficult problems to solve

      A/N to blame.

      Before writing the program, in the main thread to write such a sentence:

      Printf ("OK +%d", i); Note there is no plus/n.

      This problem tangled me for a long time, after the program can be compiled through, but it is not as before, every 100ms to send me data, but wait for a long period, send me data at once. The error is as follows:

      At first, I suspected that I had a problem with my function encapsulation, which is to encapsulate some of my functions in. c and. h, the function is declared in. h, and the variable is extern.

      When writing, there is a variable is static, and then my can has been sent to not go out, has failed, and later I found that this variable caused by the curse, may be defined as the static type after the

      has lost its role as a global variable. Because the satic global variable is only valid in the source file in which it is defined, it is not valid elsewhere.

      Reference: http://blog.csdn.net/keyeagle/article/details/6708077 use of static in C language

      For Linux, your screen input stdout is also a file, there is a buffer, you may not be able to enter multiple files at once, so the above program execution will appear above the problem.

Embedded Development Summary---application Chapter

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.