博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
为Atmega328P定制bootloader 添加自己的板卡到Arduino IDE
阅读量:4599 次
发布时间:2019-06-09

本文共 3125 字,大约阅读时间需要 10 分钟。

当参照Arduino官方的电路设计自己做板卡的时候,Arduino官方提供的bootloader可能无法满足需求,要定制自己的bootloader,下面就是具体步骤

1. 生成自己的bootloader: [这里使用的是optiboot, in arduino-1.0.5-r2, by aka WestfW]

在 arduino-1.0.5-r2\hardware\arduino\bootloaders\optiboot 目录的makefile中找到:

atmega328: TARGET = atmega328atmega328: MCU_TARGET = atmega328patmega328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'atmega328: AVR_FREQ = 16000000Latmega328: LDSECTIONS  = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffeatmega328: $(PROGRAM)_atmega328.hexatmega328: $(PROGRAM)_atmega328.lstatmega328_isp: atmega328atmega328_isp: TARGET = atmega328atmega328_isp: MCU_TARGET = atmega328p# 512 byte boot, SPIENatmega328_isp: HFUSE = DE# Low power xtal (16MHz) 16KCK/14CK+65msatmega328_isp: LFUSE = FF# 2.7V brownoutatmega328_isp: EFUSE = 05atmega328_isp: isp

紧随其后添加如下内容:

# Atmega328p target 16Mhz for DIY Board with baud rate 14400atmega328DIY: TARGET = atmega328p_DIYatmega328DIY: MCU_TARGET = atmega328patmega328DIY: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=14400'atmega328DIY: AVR_FREQ = 16000000Latmega328DIY: LDSECTIONS  = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffeatmega328DIY: $(PROGRAM)_atmega328DIY.hexatmega328DIY: $(PROGRAM)_atmega328DIY.lstatmega328DIY_isp: atmega328atmega328DIY_isp: TARGET = atmega328p_DIYatmega328DIY_isp: MCU_TARGET = atmega328p# 512 byte boot, SPIENatmega328DIY_isp: HFUSE = DE# Low power xtal (16MHz) 16KCK/14CK+65msatmega328DIY_isp: LFUSE = FF# 2.7V brownoutatmega328DIY_isp: EFUSE = 05atmega328DIY_isp: isp

在目录arduino-1.0.5-r2\hardware\arduino\bootloaders\optiboot\中,执行命令:

omake atmega328DIY

这样,就在optiboot目录中生成文件:optiboot_atmega328DIY.hex,optiboot_atmega328DIY.lst, hex 文件即为atmega328p所需要的bootloader。

 

在  中的boards.txt找到

##############################################################uno.name=Arduino Unouno.upload.protocol=arduinouno.upload.maximum_size=32256uno.upload.speed=115200uno.bootloader.low_fuses=0xffuno.bootloader.high_fuses=0xdeuno.bootloader.extended_fuses=0x05uno.bootloader.path=optibootuno.bootloader.file=optiboot_atmega328.hexuno.bootloader.unlock_bits=0x3Funo.bootloader.lock_bits=0x0Funo.build.mcu=atmega328puno.build.f_cpu=16000000Luno.build.core=arduinouno.build.variant=standard##############################################################

紧随其后,添加如下内容:

##############################################################DIYBoard.name=Arduino DIYBoardDIYBoard.upload.protocol=arduinoDIYBoard.upload.maximum_size=32256DIYBoard.upload.speed=115200DIYBoard.bootloader.low_fuses=0xffDIYBoard.bootloader.high_fuses=0xdeDIYBoard.bootloader.extended_fuses=0x05DIYBoard.bootloader.path=optibootDIYBoard.bootloader.file=optiboot_atmega328DIY.hexDIYBoard.bootloader.unlock_bits=0x3FDIYBoard.bootloader.lock_bits=0x0FDIYBoard.build.mcu=atmega328pDIYBoard.build.f_cpu=16000000LDIYBoard.build.core=arduinoDIYBoard.build.variant=standard##############################################################

重启IDE后,就可以看到相应的板卡了

 

最后,就可以在IDE中选择自己的板卡及其相应的串口号,使用ISP下载bootloader到Atmega328p中。

 

完成。

 

主要参考资料:http://www.geek-workshop.com/thread-1535-1-1.html 【作者:zcbzjx】

转载于:https://www.cnblogs.com/ohio/p/4033416.html

你可能感兴趣的文章
如何用WinCC发送报警消息至微信
查看>>
LeetCode算法扫题系列19
查看>>
nginx获取经过层层代理后的客户端真实IP(使用正则匹配)
查看>>
YII实现dropDownList 联动事件
查看>>
搞定PHP面试 - 正则表达式知识点整理
查看>>
为什么JavaScript里面0.1+0.2 === 0.3是false
查看>>
freemarker 设置中文
查看>>
docker swarm集群搭建
查看>>
选择排序
查看>>
SQLAlchemy
查看>>
BZOJ 1303: [CQOI2009]中位数图 问题转化_扫描_思维
查看>>
SP1026 FAVDICE - Favorite Dice 数学期望
查看>>
NodeJS、NPM安装配置步骤(windows版本)
查看>>
今日内容的回顾12
查看>>
js中字符串常用熟悉和方法
查看>>
【矩阵+十进制快速幂】[NOI2013]矩阵游戏
查看>>
Java一个简单的文件工具集
查看>>
蓝牙BLE扫描成功,log中打印出扫描到的设备
查看>>
React(v16.8.4)生命周期详解
查看>>
一般处理应用页中绑定方法代码段
查看>>