在Linux下搭建Arduino的C语言开发环境

平台和工具

  • 操作系统:Fedora 23
  • 开发板:Arduino UNO R3
  • 编译器:avr-gcc
  • 烧录软件:avrdude

主要内容

  • avr-gcc和avrdude的安装
  • avr-gcc编译
  • avrdude烧录

avr-gcc和avrdude的安装

sudo dnf install avr-gcc

sudo dnf install avrdude

avr-gcc编译

#编译hello.c生成hello.elf
avr-gcc -std=c11 -mmcu=atmega328p hello.c -o hello.elf

#从hello.elf中提取段,生成hello.hex
avr-objcopy -j .text -j .data -O ihex hello.elf hello.hex

avrdude烧录

#烧录hello.hex
sudo avrdude -c arduino -p m328p -P /dev/ttyACM0 -U flash:w:hello.hex

猜你喜欢

转载自www.cnblogs.com/dda9/p/10746144.html