The avr development environment requires the installation of two software:
A must-read for beginners of WinAVR+AVR Studio
1. Obtain the necessary software.
Please obtain the latest version of AVR Studio from Atmel. For
the download address, see: http://www.cnblogs.com/proteus/archive/2011/11/09/2242583.html
. Please obtain the latest version of WinAVR from WinAVR.
Download address: http://sourceforge.net/projects/winavr/files/WinAVR/
Note: WinAVR and AVR Studio are two different software. The former is an open source project and is not owned by Atmel, while the latter is copyrighted by Atmel.
2. Installation steps
1) Install WinAVR
2) Install AVR Studio
3) Install AVR Studio Service Pack (if any)
3. Create a new test project
1) Start AVR Studio
2) Select "New Project"
3) Select "AVR GCC" in "Project type", click the button next to "Location", select the project save location (here it is assumed to be C:), avoid Chinese characters in the path, (Note, make sure there is no Chinese path in the project save location, so it cannot be saved in "My Documents" or "Desktop" or other folders with Chinese characters)
Enter the project name test01 in "Project name:", uncheck "Create initial file", check "Create folder", click "Next>>"
4) Select "AVR Simulator" in "Debug platform:", select "Atmega128" in "Device:", click "Finish"
5) Select File->New File, create a blank document, and copy the following code to the document (Note: there is a blank line under the last "}"):
#include "avr/io.h"
int main(void)
{
while(1);
}
6) Select File->Save, and in the "Save As" dialog box, select the folder named by the project name under the path where the project is saved (here it is assumed to be C:test01), and
you will see that there is already a test01.aps file, which is the project file of AVR Studio. Enter "main.c" in "File name" and save.
7) Right-click on "Source Files" in the "AVR GCC" project management pane, select "Add Existing Source File(s)..." in the right-click menu, and
select the main.c file you just created in "Add Source File". You will see that there is an additional main.c file under "Source Files" in the project management pane.
8) Menu Project->Configuration Oprions, under "General" (it is by default), confirm that "Use External MakeFile" is not checked,
fill in the frequency "8000000" in "Frequency:", select "-00" in "Optimiztion", confirm that "Create Hex File" is checked,
and then click OK (do not modify other settings)
9) Menu Build->ReBuild All, compile the project. If the operation is correct, there should be no warnings and errors.
10) Menu Debug->Start Debugging, if everything goes well, the software simulation has been started.
11) So far, the test project has been successful. You can see a default folder in the project save directory. After opening it, there are test01.elf (one of the simulation debugging file formats supported by AVR Studio) and test01.hex (the file to be used when burning)
Successful display:
Build started 9.11.2011 at 16:14:41
avr-gcc -mmcu=atmega128 -Wl,-Map=liaojie.map main.o -o liaojie.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature liaojie.elf liaojie.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex liaojie.elf liaojie.eep || exit 0
avr-objdump -h -S liaojie.elf > liaojie.lss
AVR Memory Usage
----------------
Device: atmega128
Program: 204 bytes (0.2% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
Build succeeded with 0 Warnings...
4. Advice for beginners:
If the book/material uses command line to compile files, please skip the command line operations in these examples and use AVR Studio to create a new project to compile instead.
If there are explanations about Makefile, please skip them. Because these explanations may be too brief and difficult to understand.
1) Do not use the Makefile generated by the mfile that comes with WinAVR. Only use the AVR Studio menu Project->Configuration Oprions to configure the project (do not check "Use External MakeFile").
2) Do not have Chinese names in the project save path, that is, only in English folders (including folders at all levels above it are also in English).
3) Always use Build->ReBuild All to compile the project.
4) When creating a new project, do not use Makefile as the project name (regardless of the uppercase and lowercase combination).
5) When creating a new project, do not check "Create initial file".
6) Do not modify the file name in "Output File".
7) Now, interrupt programs are declared in the ISR(...) way. Books and materials may lag behind the changes of WinAVR. Please feel free to check the current WinAVR functions and header file descriptions through avr-libc Manual [WinAVR] under WinAVR in the start menu.
5. Further learning:
When you are more familiar with using AVR Studio to complete your project compilation process, you can consider learning Makefile:
Previous article:AVR microcontroller proteus simulation lesson 2: running lights
Next article:A BT problem in the transplantation of ucosii to AVR series microcontrollers
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- I recently found an article (PPT) to solve the EMC problem of a certain system. I just found it after exploring a little bit (share it...
- Serial port sending and receiving string examples
- First look at TMS320C5410
- Open source INS/GNSS navigation development board Pellicanus
- Radio information
- Force value jitter problem
- VGA Chinese Character Display.pdf
- Seeking guidance, a few questions about RA2A1's SDADC
- Mother's Day is coming, what do you have to say?
- 6ull mini board size