ubuntu下配置nordic52832开发环境

7 篇文章 0 订阅
3 篇文章 0 订阅

1.编译环境安装

Ubuntu可直接装gcc编译环境

sudo apt install gcc-arm-none-eabi

2. 检查make工具是否安装

make -v

一般来说开发Linux上的开发者都会安装,若没有安装的话,执行以下命令安装。

sudo apt-get install build-essential checkinstall

3. nRF5 SDK下载

Nordic官方对nRF51、nRF52系列提供了SDK,SDK中提供了大量的BLE和ANT示例。

下载最新的15.3版本

https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/nRF5SDK153059ac345.zip

下载之后解压到自己习惯的目录中,然后修改Makefile.posix文件。

一般解压后的目录在/home/hy/nRF5_SDK_15.3.0_59ac345/components/toolchain/gcc

文件夹打开:

GNU_INSTALL_ROOT ?= /usr/bin/
GNU_VERSION ?= 7.3.1
GNU_PREFIX ?= arm-none-eabi

第一行目录改成安装目录

这里有个技巧,搜寻安装目录:

sudo find / -name arm-none-eabi

4. 编译一个示例

在SDK的目录下打开一个示例文件夹

/media/hy/程序1/52832/nRF5_SDK_15.3.0_59ac345/examples/peripheral/blinky/pca10040/blank/armgcc$ make

上面命令是打开官方例程led闪烁的例子,pca10040是52832的开发板版本.

在该目录下运行"make",就会编译文件并生成二进制文件。

5. 安装nrfjprog工具包,包含了JLinkExe,而且版本做了匹配

nRF Command Line Tools - Downloads - nordicsemi.com

安装包里有jlink安装包deb,先安装jink再安装nrfjprog

安装完成后,检查下版本

nrfjprog -v
nrfjprog version: 10.3.0
JLinkARM.dll version: 6.44e

 JLinkExe -v
SEGGER J-Link Commander V6.44e (Compiled Apr  5 2019 16:16:27)
DLL version V6.44e, compiled Apr  5 2019 16:16:13


6. 下载

进入JLinkExe

JLinkExe -device nRF52
SEGGER J-Link Commander V6.44e (Compiled Apr  5 2019 16:16:27)
DLL version V6.44e, compiled Apr  5 2019 16:16:13

Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-STM32F072-CortexM compiled Mar  8 2020 11:15:54
Hardware version: V1.00
S/N: -1
License(s): GDB, RDI, FlashBP, FlashDL, JFlash, RDDI
VTref=3.300V


Type "connect" to establish a target connection, '?' for help
J-Link>


这里可以输入?查看帮助

Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify target interface:
No suggested target interface for core: 0x0 !
TIF>SWD
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>4000
Device "NRF52" selected.


Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Cortex-M4 identified.
J-Link>


完成芯片连接

erase可以擦除

loadfile xxxx(二进制文件名)  可下载文件

J-Link>loadfile nrf52832_xxaa.hex
Downloading file [nrf52832_xxaa.hex]...
Comparing flash   [100%] Done.
Erasing flash     [100%] Done.
Programming flash [100%] Done.
Verifying flash   [100%] Done.
J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (4096 bytes)
J-Link: Flash download: Total time needed: 0.094s (Prepare: 0.031s, Compare: 0.002s, Erase: 0.000s, Program: 0.054s, Verify: 0.000s, Restore: 0.005s)
O.K.


顺利下载

7.程序修改

ubuntu下sublime挺好用的,暂时按这样的工具链搭建。

修改代码,开发板LED1/LED2对应P06/P07

修改下载后,板子终于闪起来了!!!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

海里的鱼2022

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值