一、遇到问题
- 合并nRF52832生成的三个hex出现问题
mergehex --merge nrf52832_xxaa.hex bootload.hex softdevice.hex --output o1.hex
mergehex --merge nrf52832_xxaa.hex bootload.hex softdevice.hex --output o1.hex
Parsing input hex files.
Merging files.
ERROR: The hex files cannot be merged since there are conflicts.
二、分析问题
- 错误信息简洁易懂,一目了然
Parsing input hex files.
:解析输入的hex文件Merging files.
:合并文件ERROR: The hex files cannot be merged since there are conflicts.
:错误:hex文件不能合并因为这里有冲突
- 具体什么冲突,这里没说。不过按照合并原理,是按照在flash中的地址进行合并。
- 所以应该是flash地址冲突了,需要确认几个地方
IROM1
的地址范围__attribute__
指定地址的数组
- 果然,找到了。我把
nrf_dfu_settings
从bootloader搬到app中用了,所以这一块的地址,bootloader和app重复冲突了。
三、解决问题
- 要解决这个问题也比较简单,就是不使用
__attribute__
,将其注释掉。 - 然后,直接指定地址从flash中读即可。修改如下:
四、验证
mergehex --merge nrf52832_xxaaV3.hex bootload.hex softdevice.hex --output o1.hex
Parsing input hex files.
Merging files.
Storing merged file.
觉得好,就一键三连呗(点赞+收藏+关注)