看到野火的烧录器对STM32系列支持最完善,本次就用STM32G070来测试一下脱机烧录器功能。
首先使用STM32CubeMX简单创建一个基于STM32G070的点灯例子程序。实现led快速闪烁。
![image.png](//file1.elecfans.com/web2/M00/82/DF/wKgZomRlguKABV7CAADgpdcxN74144.png)
编译成功后,得到固件文件。
下面打开野火脱机烧录的软件。选择STM32G070KBT6。
![image.png](//file1.elecfans.com/web2/M00/82/DF/wKgaomRlg8iANv9cAAEH_oZIE90448.png)
一般要设置加密读保护等级,以及烧录次数限制。这里等下测试设置一下效果。这里不管新旧片子,都选择先解除读保护,兼容性更好。如果是新IC,一般不需要先解除读保护。
下面选择刚刚生成的固件。点击加载固件,可以看到支持hex和axf格式的文件。
![image.png](//file1.elecfans.com/web2/M00/82/DF/wKgZomRlhS-AQ_tfAAGWhreCemw764.png)
加载固件完成后,首先对这个新的固件取个名称,如果不取就是默认名称。
下面1指示可以查询脱机烧录器内存在哪个固件,以及2指示删除脱机烧录器内存在的固件。对应3指示将新的固件发送到脱机烧录器中。
一般选择一键烧录,将固件发送到烧录器,然后就可以使用烧录器脱机烧录MCU了。
![image.png](//file1.elecfans.com/web2/M00/82/DF/wKgaomRlhdOAUGTgAAFk9ziVm4A519.png)
下面是操作日志记录:
[09:38:57.024]>>>未找到设备,请检查连接或长按进入配置状态状态!
[09:40:24.153]>>>已连接到fireFlasher_Mini
[09:55:50.567]>>>Reading Firmware Note......
[09:55:50.568]>>>Inject command 'read-memory'
[09:55:50.569]>>>Successful response to command 'read-memory'
[09:55:50.569]>>>(1/1)58%
[09:55:50.569]>>>(1/1)100%
[09:55:50.569]>>> Completed!
[09:55:50.570]>>>Successful generic response to command 'read-memory'
[09:55:50.570]>>>Response status = 0 (0x0) Success.
[09:55:50.572]>>>Response word 1 = 1744 (0x6d0)
[09:55:50.572]>>>Read 1744 of 1744 bytes.
[09:55:50.707]>>>Note: memoryId is not required for read-memory when accessing mapped external memory. Ignore this parameter.
[09:55:50.719]>>>Inject command 'read-memory'
[09:55:50.722]>>>Successful response to command 'read-memory'
[09:55:50.722]>>>(1/1)24%
[09:55:50.722]>>>(1/1)49%
[09:55:50.723]>>>(1/1)74%
[09:55:50.724]>>>(1/1)98%
[09:55:50.724]>>>(1/1)100%
[09:55:50.724]>>> Completed!
[09:55:50.725]>>>Successful generic response to command 'read-memory'
[09:55:50.728]>>>Response status = 0 (0x0) Success.
[09:55:50.729]>>>Response word 1 = 4096 (0x1000)
[09:55:50.729]>>>Read 4096 of 4096 bytes.
[09:55:50.729]>>>共有1个固件
[09:55:50.730]>>>当前固件:新建固件_1
[09:55:50.730]>>>固件注释:
[09:55:50.730]>>>最大烧录次数:无限制
[09:55:50.731]>>>固件地址:0x60081000
[09:55:50.731]>>>固件大小:13696
[09:55:50.731]>>>HASH:4A8D8B7BEBC25AED7429DAF8DCFAF77498EB37108EBAE423A6842A001080A21E
[09:55:50.731]>>>加载目录完成
[09:55:55.830]>>>Running blhost flash-erase-region, wait for a minute......
[09:55:55.839]>>>Inject command 'flash-erase-region'
[09:55:55.886]>>>Successful generic response to command 'flash-erase-region'
[09:55:55.887]>>>Response status = 0 (0x0) Success.
[09:55:55.887]>>>Running blhost write-memory ......
[09:55:55.894]>>>Inject command 'write-memory'
[09:55:55.895]>>>Preparing to send 4096 (0x1000) bytes to the target.
[09:55:55.898]>>>Successful generic response to command 'write-memory'
[09:55:55.899]>>>(1/1)24%
[09:55:55.899]>>>(1/1)49%
[09:55:55.902]>>>(1/1)74%
[09:55:55.905]>>>(1/1)98%
[09:55:55.908]>>>(1/1)100%
[09:55:55.909]>>> Completed!
[09:55:55.909]>>>Successful generic response to command 'write-memory'
[09:55:55.910]>>>Response status = 0 (0x0) Success.
[09:55:55.910]>>>Wrote 4096 of 4096 bytes.
[09:56:06.816]>>>当前MCU型号: STM32G070KBTx
[09:56:06.817]>>>正在解析文件: F:/fireFlasher/firmware/opt_pack_info/st/STM32/STM32G0xx/STM32G0x0xx.yml
[09:56:13.807]>>>Running packFile......
[09:56:13.814]>>>Finish packFile......
[09:56:13.814]>>>Starting Create file......
[09:56:13.815]>>>Starting Write file......
[09:56:13.815]>>>Finish Create file F:/fireFlasher/tmp/stm32g070.fire......
[09:56:13.815]>>>Running blhost flash-erase-region, wait for a minute......
[09:56:13.824]>>>Inject command 'flash-erase-region'
[09:56:14.007]>>>Successful generic response to command 'flash-erase-region'
[09:56:14.008]>>>Response status = 0 (0x0) Success.
[09:56:14.008]>>>Running blhost write-memory ......
[09:56:14.018]>>>Inject command 'write-memory'
[09:56:14.019]>>>Preparing to send 13696 (0x3580) bytes to the target.
[09:56:14.023]>>>Successful generic response to command 'write-memory'
[09:56:14.024]>>>(1/1) 7%
[09:56:14.025]>>>(1/1)14%
[09:56:14.028]>>>(1/1)22%
[09:56:14.028]>>>(1/1)29%
[09:56:14.031]>>>(1/1)36%
[09:56:14.034]>>>(1/1)44%
[09:56:14.037]>>>(1/1)51%
[09:56:14.039]>>>(1/1)59%
[09:56:14.042]>>>(1/1)66%
[09:56:14.044]>>>(1/1)73%
[09:56:14.046]>>>(1/1)81%
[09:56:14.048]>>>(1/1)88%
[09:56:14.052]>>>(1/1)96%
[09:56:14.054]>>>(1/1)100%
[09:56:14.055]>>> Completed!
[09:56:14.055]>>>Successful generic response to command 'write-memory'
[09:56:14.056]>>>Response status = 0 (0x0) Success.
[09:56:14.056]>>>Wrote 13696 of 13696 bytes.
[09:56:14.057]>>>当前固件:stm32g070
[09:56:14.057]>>>固件注释:
[09:56:14.058]>>>最大烧录次数:无限制
[09:56:14.058]>>>固件地址:0x60081000
[09:56:14.058]>>>固件大小:13696
[09:56:14.059]>>>HASH:BBA20335CE2D1CC6C6D36574F9DABC29CF292EE1D23188F9338236B82B84F3C0
[09:56:14.062]>>>Running blhost flash-erase-region, wait for a minute......
[09:56:14.069]>>>Inject command 'flash-erase-region'
[09:56:14.118]>>>Successful generic response to command 'flash-erase-region'
[09:56:14.118]>>>Response status = 0 (0x0) Success.
[09:56:14.119]>>>Running blhost write-memory ......
[09:56:14.126]>>>Inject command 'write-memory'
[09:56:14.127]>>>Preparing to send 4096 (0x1000) bytes to the target.
[09:56:14.131]>>>Successful generic response to command 'write-memory'
[09:56:14.132]>>>(1/1)24%
[09:56:14.132]>>>(1/1)49%
[09:56:14.135]>>>(1/1)74%
[09:56:14.138]>>>(1/1)98%
[09:56:14.141]>>>(1/1)100%
[09:56:14.141]>>> Completed!
[09:56:14.141]>>>Successful generic response to command 'write-memory'
[09:56:14.142]>>>Response status = 0 (0x0) Success.
[09:56:14.142]>>>Wrote 4096 of 4096 bytes.
接着点击退出配置,烧录器就可以进行脱机烧录了。此时烧录器提示灯绿灯亮起。
下面这是测试的板子
![image.png](//file1.elecfans.com/web2/M00/82/E0/wKgZomRlh_aAZYyRAAu8YcgVQkQ033.png)
烧录器和板子的接线。
![image.png](//file1.elecfans.com/web2/M00/82/E0/wKgZomRliBOATtloAA0c9E66Zao133.png)
![image.png](//file1.elecfans.com/web2/M00/82/DF/wKgaomRliB-AIHtuAArPkzXO07A708.png)
下面测试烧录效果。如果烧录成功就嘀嘀2声。如果烧录失败就会有另外的提示音,并且指示灯亮红色。
烧录效果
|