1. 准备工作 软件:Setup_JLinkARM_V468.exe,上篇已成功安装的相关软件。
硬件:STM32F1板子(STM32F103ZET6)、JLink OB下载器。
2.软件配置 安装“Setup_JLinkARM_V468.exe”,本例安装目录为“D:\Program Files (x86)\SEGGER\JLinkARM_V468\”,安装完成后可以在设备管理器中看到J-Link driver。
文章图片
genericSTM32F103Z.menu.upload_method.jLinkMethod=JLINK
genericSTM32F103Z.menu.upload_method.jLinkMethod.upload.protocol=jlink
genericSTM32F103Z.menu.upload_method.jLinkMethod.upload.tool=jlink_upload
genericSTM32F103Z.menu.upload_method.jLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
genericSTM32F103Z.menu.upload_method.jLinkMethod.upload.device=STM32F103ZE
文章图片
重新启动Arduino IDE可以看到上载方式增加了“JLINK”项。
【STM32|Arduino JLink上载教程】
文章图片
打开D:\Program Files (x86)\Arduino\hardware\Arduino_STM32\STM32F1\platform.txt文件,添加如下代码并保存,已存在可省略。
tools.jlink_upload.cmd=jlink_upload
tools.jlink_upload.cmd.windows=jlink_upload.bat
tools.jlink_upload.cmd.macosx=jlink_upload
tools.jlink_upload.path={runtime.hardware.path}/tools/win
tools.jlink_upload.path.macosx={runtime.hardware.path}/tools/macosx
tools.jlink_upload.path.linux={runtime.hardware.path}/tools/linux
tools.jlink_upload.path.linux64={runtime.hardware.path}/tools/linux64
tools.jlink_upload.upload.params.verbose=-d
tools.jlink_upload.upload.params.quiet=n
tools.jlink_upload.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.bin"
文章图片
打开D:\Program Files (x86)\Arduino\hardware\Arduino_STM32\tools\win\jlink_upload.bat文件,添加如下代码并保存。对于不同系列的STM32,需要更改最后一行中对应的“STM32Fxxxxx”。
rem: @echo off
rem: Note %~dp0 get path of this batch file
rem: Need to change drive if My Documents is on a drive other than C:
set driverLetter=%~dp0
set driverLetter=%driverLetter:~0,2%
%driverLetter%
cd %~dp0
rem: the two line below are needed to fix path issues with incorrect slashes before the bin file name
set tmpBinFilePath=%1
set tmpBinFilePath=%tmpBinFilePath:/=\%rem: create commander script file with the tmp bin that the Arduino IDE creates@echo erase > %tmpbinfilepath%.jlink
@echo loadbin %tmpbinfilepath% , 0x8000000 >> %tmpbinfilepath%.jlink
@echo r >> %tmpbinfilepath%.jlink
@echo q >> %tmpbinfilepath%.jlinkjlink\JLink.exe -device STM32F103ZE -if SWD -speed 4000 -CommanderScript %tmpBinFilePath%.jlink
在“D:\Program Files (x86)\Arduino\hardware\Arduino_STM32\tools\win”文件夹下新建文件夹“jlink”,并将JLink安装目录下的“JLink.exe”和“JLinkARM.dll”两个文件拷贝到该文件夹下。
文章图片
完成配置,JLink上载比串口烧写速度快,也不需要改变BOOT0跳线,很方便。
推荐阅读
- stm32|基于STM32和freeRTOS智能门锁设计方案
- 日常分享|共享充电宝方案原理,具体部件组成以及主控MUC参数
- #|ARM裸机开发(汇编LED灯实验(I.MX6UL芯片))
- RXTX|Java调用RXTX库与Arduino进行串口通讯需注意的编程问题
- STM32|STM32的四种IO输出模式
- STM32 远程升级(ISP / IAP)
- stm32|stm32f103can总线过滤器配置
- STM32CubeMX配置SDIO模式(非DMA方式)
- STM32|如何建一个STM32F030标准库工程模板
- STM32 时钟RCC相关配置参考stm32f10x_rcc.h