Arduino ATmega16U2

arduino uno
https://item.taobao.com/item.htm?spm=a230r.1.14.78.72cd6558vBJ3Oo&id=538761766612&ns=1&abbucket=15#detail

https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-17559408425.14.17c448a1ECiFXK&id=532923514247

ATmega16U2

https://github.com/arduino/Arduino

https://www.microchip.com/wwwproducts/en/ATMEGA16U2

ATmega16U2

http://arduino.cc/en/Hacking/DFUProgramming8U2

http://www.nongnu.org/avrdude/

http://www.fourwalledcubicle.com/LUFA.php

https://blog.csdn.net/yinkaishikd/article/details/49680329

Atmel提供了相关的工具链,使得开发者可以简单方便地进行开发,包括Linux平台和Windows平台。除了Atmel提供的工具链之外,还可以使用第三方工具链,按照自己的需要来进行开发。同时,LUFA已经成为Atmel Studio 6.1及后续版本的原生插件之一。无论是编译固件,还是固件上传,LUFA文档都提供了详细的说明。详情请参阅LUFA文档部分:LUFA Library -> Getting Started。

LUFA的项目主页(英文)在http://www.fourwalledcubicle.com/LUFA.php。该项目的源码版本管理托管在github上,相关地址在http://github.com/abcminiuser/lufa。更多详情,可以在LUFA的项目主页上查看。、

http://www.fourwalledcubicle.com/files/LUFA/Doc/130303/html/

LUFA is written specifically for the free AVR-GCC compiler, and uses several GCC-only extensions to make the library API more streamlined and robust. You can download AVR-GCC for free in a convenient windows package, from the the Atmel website.

http://www.fourwalledcubicle.com/LUFA.php

https://electronics.stackexchange.com/questions/24512/make-lufa-for-arduino-uno-atmega16u2/24537

cd Arduino/hardware/arduino/firmwares/arduino-usbserial

The Arduino-usbserial firmware is the default firmware that the UNO comes installed with on its atmega8u2. It implements a serial interface over USB. Build this firmware to check that your avr-gcc toolchain and avr-libc are working.

cd Arduino/hardware/arduino/firmwares/arduino-usbserial
edit the makefile and make sure that MCU = atmega8u2 and ARDUINO_PID = 0x0001

make
You should have an newly built Arduino-usbserial.hex file.

AVR-GCC 8.1.0 for Windows 32 and 64 bit

http://download.savannah.gnu.org/releases/avrdude/

http://winavr.sourceforge.net/

https://blog.csdn.net/yinkaishikd/article/details/49680329

[GCC] : Compiling C file “Benito.c”
avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=atmega32u2 -fshort-enums -fno-inline-small-
functions -fpack-struct -Wall -fno-strict-aliasing -funsigned-char -funsigned-bi
tfields -ffunction-sections -I. -I../../LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_B
ENITO -DF_USB=8000000UL -DF_CPU=8000000UL -mrelax -x c -Os -std=gnu99 -Wstrict-p
rototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -MMD -MP -MF Benito.d Benito.c -o
Benito.o
Benito.c: In function ‘SetupHardware’:
Benito.c:180: warning: implicit declaration of function ‘clock_prescale_set’
Benito.c:180: error: ‘clock_div_1’ undeclared (first use in this function)
Benito.c:180: error: (Each undeclared identifier is reported only once
Benito.c:180: error: for each function it appears in.)
make[2]: * [Benito.o] Error 1
make[2]: Leaving directory C:/Users/compile/Downloads/LUFA-130901/Projects/Benito'
make[1]: *** [Benito/] Error 2
make[1]: Leaving directory
C:/Users/compile/Downloads/LUFA-130901/Projects’
make: * [all] Error 2

把第180行给注释掉

使用 WinAVR-20100110-install.exe 编译

LEDNotifier.c: In function ‘main’:
LEDNotifier.c:137: warning: passing argument 1 of ‘fputc’ makes integer from poi
nter without a cast
LEDNotifier.c:137: warning: passing argument 2 of ‘fputc’ makes pointer from int
eger without a cast
LEDNotifier.c: In function ‘SetupHardware’:
LEDNotifier.c:153: warning: implicit declaration of function ‘clock_prescale_set

LEDNotifier.c:153: error: ‘clock_div_1’ undeclared (first use in this function)
LEDNotifier.c:153: error: (Each undeclared identifier is reported only once
LEDNotifier.c:153: error: for each function it appears in.)
make[2]: * [obj/LEDNotifier.o] Error 1
make[2]: Leaving directory E:/Arduino/lufa-LUFA-170418/lufa-LUFA-170418/Project
s/LEDNotifier'
make[1]: *** [LEDNotifier/] Error 2
make[1]: Leaving directory
E:/Arduino/lufa-LUFA-170418/lufa-LUFA-170418/Project
s’
make: * [all] Error 2

// clock_prescale_set(clock_div_1);

问题解决网址

https://www.avrfreaks.net/forum/error-compiling-lufa-130901-windows-7-solved

ref -Wl,–gc-sections -Wl,–relax -mmcu=at90usb1287
../AVRISP-MKII/obj/ISPTarget.o: In function __vector_17':
E:\Arduino\lufa-LUFA-170418\lufa-LUFA-170418\Projects\AVRISP-MKII/Lib/ISP/ISPTar
get.c:119: multiple definition of
__vector_17’
obj/SoftUART.o:E:\Arduino\lufa-LUFA-170418\lufa-LUFA-170418\Projects\XPLAINBridg
e/Lib/SoftUART.c:102: first defined here
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: Disablin
g relaxation: it will not work with multiple definitions
make[2]: * [XPLAINBridge.elf] Error 1
make[2]: Leaving directory E:/Arduino/lufa-LUFA-170418/lufa-LUFA-170418/Project
s/XPLAINBridge'
make[1]: *** [XPLAINBridge/] Error 2
make[1]: Leaving directory
E:/Arduino/lufa-LUFA-170418/lufa-LUFA-170418/Project
s’
make: * [all] Error 2

ISR(TIMER2_COMPA_vect, ISR_BLOCK)

https://blog.csdn.net/fyz2014/article/details/77908904

Arduino UNO R3 刷写bootloader

这里要先将UNO板转为USB设备,转换方法是短接UNO R3开发板的左上方的两个引脚(红色方框位置)。

猜你喜欢

转载自blog.csdn.net/wowocpp/article/details/80626065