Arduino compilation bootloader

Source: Internet
Author: User

Recently, I intend to customize an Arduino board, change the Arduino's burn-write mechanism. Fortunately, bootloader are active code, say dry, before rewriting of course to try this source can compile, but to the bootloader directory is dazed .... Actually use is makefile, but as a program ape of course can't retreat ...

1. Find bootloader Source code

Bootloader source code are in the \arduino-1.6.9\hardware\arduino\avr\bootloaders folder, different microcontroller chip or Arduino board has a different folder, take the cheapest atmega8 to do it, Just I also have a lot of usbasp PCB can be changed. Into the Atmega8 directory, you can see a few files below, No doubt. c file is the source code, temporarily do not modify the source code, just try to compile, so this time not to explain. c file, there are two. hex files, which is the implementation of the compiled hex file, when the new Arduino board connected to the IDE to write bootloader, this hex is not what To say. The last file is makefile, makefile generally only the Ox x programmer will write, I generally divert, but in order to toss, still have to ....

2. Find Make.exe

Although not written makefile, at least seen makefile, have not read a number of books before, the number of compile programs more than also see some doorway. The make command is always required for each compilation, and when compiled with the IDE you can see the shadow in the command line before the start. So if I want to compile first find out where Make.exe is. So in the Arduino directory search, but very disappointed not .... So next to look at the Arduino directory, careful I found that the previous Arduino version with WINAVR, seemingly the latest version is not. So find an old version looked, sure old version of Make.exe, so hurriedly download a WINAVR loaded (installed in any directory can), finally saw the long-lost make.exe.

3. First attempt to compile

Now that you have Make.exe, start compiling, first go to the ATMEGA8 directory, call the Make.exe command (note that the path of the WINAVR installation is different, the command is different, depending on the directory you installed), I invoke the following command:

C:\winavr-20081205\utils\bin\make.exe

The idea is always good, but the reality is always cruel .... Of course compile bootloader error ... Wrong... The ...

  

4, modify the Makefile

No matter how, or dry the tears continue to struggle, actually carefully look at the error message, it seems clear .... Cannot find the specified file, look at the above command/BIN/AVR-GCC, it seems that there is no such file,/clearly is the path of Linux, I here is windows, open makefile Look,

Soon find out why ...

It is easy to see that the path of AVR-GCC is defined by Diravrbin, and Diravrbin is obtained by DIRAVR this variable, and the variable in the file is commented .... The following is the code before the modification

1 # DIRAVR =/usr/local/avr 2 diravrbin = $ (DIRAVR)/bin3 diravrutils = $ (DIRAVR)/utils/bin4 dirinc = $ (DIRAVR)/include5 dirlib = $ (DIRAVR)/avr/lib

Now that you see the problem, just modify it, and search to find the directory where the AVR-GCC is located, and you can determine the relative path to the directory where the AVR-GCC resides relative to the makefile: \.. \.. \.. \tools\avr\bin, so makefile modified as follows:

1 diravr = .. \.. \.. \.. \tools\avr2 diravrbin = $ (DIRAVR)/bin3 diravrutils = $ (DIRAVR)/utils/bin 4 dirinc = $ (DIRAVR)/include5 dirlib = $ (DIRAVR)/avr/lib

Run again C:\winavr-20081205\utils\bin\make.exe Hex finally see the new hex file ....

Arduino compilation bootloader

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.