星期日, 09. 九月 2018 07:51下午 - beautifulzzzzhtml
1) 從GNU Arm Embedded Toolchain官網下載最新的gcc-arm工具鏈,寫文章時下載的是:linux
gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
2) 從NORDIC官網下載相應版本的SDK,我這裏選擇的是12.3.0版本:git
Code | Name | Version |
---|---|---|
nRF5-SDK-v12-zip | nRF5 SDK Zip File - works with S132 v3 and S130 v2 | 12.3.0 |
nRF5-SDK-zip | nRF5 SDK Zip File - works with S112 v6.1.0, S132 v6.1.0, S140 v6.1.0, and S212 v5.0.0 Note that support for the nRF51 Series was included up until v12.3 of the nRF5 SDK |
15.1.0 |
3) 解壓工具鏈和nRF5-SDK到AAAA目錄下,並編輯sdk_root/components/toolchain/gcc/Makefile.posix :github
GNU_INSTALL_ROOT := /home/btfz/Downloads/AAAA/gcc-arm-none-eabi-5_4-2016q3 GNU_VERSION := 5.4.1 GNU_PREFIX := arm-none-eabi
4) 從NORDIC官網下在nRF5x-Tools-Linux,我下載的版本是(解壓後也放在AAAA目錄下):架構
nRF5x-Command-Line-Tools_9_7_3_Linux-x86_64.tar
5) 從SEGGER官網下載最新的J-Link工具包 J-Link Software and Documentation Pack,我下載的是最新的linux-64位-deb安裝版:app
1) 檢查開發板所用的芯片爲nRF51822-QFAA,參考nRF51822 Product Anomaly Notification v3.3,得知QFAA是256 kB Flash, 16 kB RAM:工具
2) 參考developer(#5)>Software Development Kit > nRF5 SDK > nRF5 SDK v12.3.0 > Getting Started > Using the SDK with other boards中的介紹:ui
Depending on the device on the legacy board, you might need to change the memory layout. For example, all nRF51 examples assume that you are using the 32 kB variant of nRF51, so if you are using a variant with 16 kB RAM, you must decrease the size of IRAM1 by 16 kB (0x4000 in hex). In Keil, click Project > Options for Target '...' and modify the values for "Read/Write Memory Area". For GCC, change the linked *.ld file in the Makefile..net
所以須要修改nRF5_SDK_12.3.0_d7731ad/examples/peripheral/blinky/pca10028/blank/armgcc/blinky_gcc_nrf51.ld
中的RAM配置爲0x4000:設計
MEMORY { FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x40000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000 }
注:若是RAM大小不符合條件,會致使程序燒寫成功,可是沒有任何效果!!!
3) 編譯運行(以blinky - blank爲例):
➜ cd /examples/peripheral/blinky/pca10028/blank/armgcc ➜ armgcc make clean rm -rf _build ➜ armgcc make all mkdir _build Compiling file: nrf_log_backend_serial.c ... Compiling file: system_nrf51.c Linking target: _build/nrf51422_xxac.out text data bss dec hex filename 3160 112 112 3384 d38 _build/nrf51422_xxac.out Preparing: _build/nrf51422_xxac.hex Preparing: _build/nrf51422_xxac.bin
4) 燒寫運行:
運行燒寫的腳本在makefile中都有,可是在此以前要作兩件事:
注:在當前terminal中運行一次export PATH=$PATH:/home/btfz/Downloads/AAAA/nRF5x-Command-Line-Tools_9_7_3/nrfjprog/
,則對當前窗口有效,直至串口關閉。
➜ armgcc export PATH=$PATH:/home/btfz/Downloads/AAAA/nRF5x-Command-Line-Tools_9_7_3/nrfjprog/ ➜ armgcc make erase nrfjprog --eraseall -f nrf51 Erasing user available code and UICR flash areas. Applying system reset. ➜ armgcc make flash Flashing: _build/nrf51422_xxac.hex nrfjprog --program _build/nrf51422_xxac.hex -f nrf51 --sectorerase Parsing hex file. Erasing page at address 0x0. Erasing page at address 0x400. Erasing page at address 0x800. Erasing page at address 0xC00. Applying system reset. Checking that the area to write is not protected. Programming device. nrfjprog --reset -f nrf51 Applying system reset. Run.
1) 相似2中的須要調整RAM,這裏也要將flash和ram配置作修改。參考S130_SDS_v2.0.pdf的15.1 Memory resource map and usage
:
其中flash的佔用狀況爲:
其中ram的佔用狀況爲:
所以修改ble_app_hrs_gcc_nrf51.ld
中的flash和ram的配置爲:
MEMORY { FLASH (rx) : ORIGIN = 0x1b000, LENGTH = 0x23000 RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x2000 }
3) 燒寫:
make erase make flash_softdevice make flash
1)板子和芯片對應關係
因爲nRf51822和nRF51422差異不大,所以咱們以前一直用pca10028工程來作實驗。此外我看了下最新的SDK中的DEMO,發現沒有pca10028了,我猜想應該是nRF51822在新版本SDK中不繼續支持了。
2)協議棧和芯片對應關係
可見咱們上面用的S130支持衆多芯片且具有BLE的Central and Peripheral功能。
3)NORDIC提供的一些協議棧
[1].GNU Arm Embedded Toolchain
[2].nRF5-SDK Download Page
[3].nRF5x-Tools-Linux Download Page
[4].nRF51 Development Kit complete setup for Linux
[5].NORDIC 開發者社區 -- 資料最全的地方
[6].nRF51822_pan_v3.3.pdf
[7].S130_SDS_v2.0.pdf
[nRF51822] 一、一個簡單的nRF51822驅動的天馬4線SPI-1.77寸LCD彩屏DEMO
[nRF51822] 二、D-BUG之詩
[nRF51822] 三、 新年也來個總結——圖解nRF51 SDK中的Button handling library和FIFO library
[nRF51822] 四、 圖解nRF51 SDK中的Schedule handling library 和Timer library
[nRF51822] 五、 霸屏了——詳解nRF51 SDK中的GPIOTE(從GPIO電平變化到產生中斷事件的流程詳解)
[nRF51822] 六、基於nRF51822平臺的flash讀寫研究
[nRF51822] 七、基礎實驗代碼解析大全(前十)
[nRF51822] 八、基礎實驗代碼解析大全 · 實驗11 - PPI
[nRF51822] 九、基礎實驗代碼解析大全 · 實驗12 - ADC
[nRF51822] 十、基礎實驗代碼解析大全 · 實驗15 - RTC
[nRF51822] 十一、基礎實驗代碼解析大全 · 實驗16 - 內部FLASH讀寫
[nRF51822] 十二、基礎實驗代碼解析大全 · 實驗19 - PWM
[nRF51822] 1三、淺談nRF51822和NRF24LE1/NRF24LU1/NRF24L01經典2.4G模塊無線通訊配置與流程
[nRF51822] 1四、淺談藍牙低功耗(BLE)的幾種常見的應用場景及架構(科普類乾貨)
[nRF51822] 1五、穿戴式設備上電量檢測裝置的設計及細節技術點(偏專業硬件文章)
[nRF51822] 1六、nRF51822的隨機數生成器,及隨機數生成器的一些知識(能夠幫您補補隨機數發生器的知識)
[異常解決] Keil安裝好nRF51822開發環境,運行DEMO報錯:Error:「GPIOTE_CONFIG_NUM_OF_LOW_POWER_ENVENTS」 is undefined
[異常解決] How to build a gcc toolchain for nRF51 on linux (very detailed!!!)
[藍牙] 一、藍牙核心技術瞭解(藍牙協議、架構、硬件和軟件筆記)
[藍牙] 二、藍牙BLE協議及架構淺析&&基於廣播超時待機說廣播事件
[藍牙] 三、 剖析BLE心率檢測工程
[藍牙] 四、Heart Rate Service module
[藍牙] 五、Battery Service module
[藍牙] 六、基於nRF51822的藍牙心率計工程消息流Log分析(詳細)
@beautifulzzzz 智能硬件、物聯網,熱愛技術,關注產品 博客:http://blog.beautifulzzzz.com 園友交流羣:414948975