4033 views|2 replies

9720

Posts

24

Resources
The OP
 

Use VSCode to compile and debug BlueNRG-1 code [Copy link]

 

BlueNRG-1-VSCode

This repo is a template for setting up VSCode to compile and debug the code for the EMB-1061 BlueNRG-1 module

Watch this video for an introduction to the project

Watch this video

链接已隐藏,如需查看请登录或者注册
Please note:

This is a work in progress project and there are some issues and jank. Things like printing floats may not work properly. Take this into account when you decide to use this chip.

Still, it's better than paying $1500 per year for a license for IAR or MDK5...

链接已隐藏,如需查看请登录或者注册
feature

  • OTA
  • Low power consumption (coin cell battery lasts for years)

链接已隐藏,如需查看请登录或者注册
Basic Setup (All Operating Systems)

  1. 链接已隐藏,如需查看请登录或者注册
    for your own project and clone it to your computer
  2. Download and install VSCode and open the project you cloned
  3. Install the Cortex-Debug extension via marus25
    1. marus25.cortex-debugSearch and install in the extensions menu
  4. Installing the Arm Cortex Debug Tools

链接已隐藏,如需查看请登录或者注册
Window Settings

  1. In your project opened in VSCode, open and modify it .vscode/settings.jsonas follows:
    1. Run getShort.bat in the integrated terminal with the location of the bin file for your version of the Arm Cortex Debug Tools as an argument, for example:./getshort.bat "C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin"
    2. Copy the output and put it in "cortex-debug.armToolchainPath"your settings, for example:'"cortex-debug.armToolchainPath": "C:/PROGRA\~2/GNUARM\~1/102020~1/bin",'
    3. Open the file location for your version of the Arm Cortex Debug Tools in Explorer, then navigate to \lib\gcc\arm-none-eabiand copy the file name from that location.
      • My full path is C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\lib\gcc\arm-none-eabi
      • The file name I copied is 10.2.1
    4. Replace the setting "armToolchainVersion" with the file name you copied, for example:"armToolchainVersion": "10.2.1",
    5. (Optional if using JLink) Copy the installation location of your JLink server into your setup "cortex-debug.JLinkGDBServerPath", for example:'"cortex-debug.JLinkGDBServerPath": "C:/Program Files (x86)/SEGGER/JLink_V635c/JLinkGDBServerCL.exe"'
  2. Installing BlueNRG-1_2 DK
    1. If building the project does not work, you may need to update settings.json with the file location. Check and make sure "bluenrgDkLocation"the value of the setting is the installation location of your BlueNRG DK. If not, find it and run getshort.bat with its lib file location.
      • For example, my installation is located at C:\Users\<USER>\ST\BlueNRG-1_2 DK 3.2.1\Libraryso my setup looks like"bluenrgDkLocation": "C:/Users/<USER>/ST/BLUENR~1.1/Library"

You should be done!

链接已隐藏,如需查看请登录或者注册
Linux Setup

  1. In your project opened in VSCode, open and modify it .vscode/settings.jsonas follows:

    1. Set the toolchain path in the settings "cortex-debug.armToolchainPath", for example:'"cortex-debug.armToolchainPath": "/home/<user>/gcc-arm-none-eabi-10-2020-q4-major/bin",'
    2. Open the file location for your version of the Arm Cortex Debug Tools in Explorer, then navigate to \lib\gcc\arm-none-eabiand copy the directory name at that location.
      • My full path is /home//gcc-arm-none-eabi-10-2020-q4-major/lib/gcc/arm-none-eabi
      • The name of the directory I copied is 10.2.1
    3. Replace the setting "armToolchainVersion" with the file name you copied, for example:"armToolchainVersion": "10.2.1",
  2. Installing BlueNRG-1_2 DK

    1. Sign up and wait for email download :(
    2. Use innoextract to get files from exe
    3. Copy %USERPROFILE/ST/BlueNRG-1_2 DK 3.2.1 to your desired destination
    4. Update settings.json with the file location. Check and make sure "bluenrgDkLocation"the value of the setting is the location where your BlueNRG DK is installed, for example:"/home/<user>/BlueNRG-1_2-DK-3.2.1"
  3. Build and install openocd-0.11.0-rc2

    1. For instructions, see the openocd README http://openocd.org/doc-release/README
    • No special options are needed, the defaults are valid

链接已隐藏,如需查看请登录或者注册
Build and run the example project

  1. Press ctrl+shift+b to build the project, and if everything is set up correctly, it should build!
  2. Navigate to the Run menu on the left and set the debug configuration to "Debug (ST-Link)" or "Debug (JLink)" depending on the debug device you are using
    • You will also need to connect your debug device to the ST-Link or JLink using the SWDIO, SWCLK and GND pins. NOTE: I do not recommend using the 3.3V line to power your BlueNRG module, it will cause errors. Please use an external power supply between 1.7 and 3.6 V or a coin cell battery
  3. Click run or press f5 and the debug window should pop up. Note that this will also execute the make task so you don't need to press ctrl+shift+b every time you want to build and upload. To modify this behavior, edit the .vscode/launch.json file
  4. You should be able to step through your program, or click Continue to let it run. When running, it should blink an LED (GPIO_Pin_14 on my board) and become a BLE beacon. You should be able to see the BLE device with a BLE sniffer on your phone

链接已隐藏,如需查看请登录或者注册
File location description

Below is the location where the BlueNRG-1 DK is from https://www.st.com/content/st_com/en/products/embedded-software/evaluation-tool-software/stsw-bluenrg1-dk.html When you install this DK the actual location of the file should beC:/Users/<your user>/ST/BlueNRG-1_2 DK 3.2.1

链接已隐藏,如需查看请登录或者注册

Source: https://github.com/calebmarting/BlueNRG-1-VSCode/

Source code: BlueNRG-1-VSCode-main.zip (4.63 MB, downloads: 3)

This post is from ST - Low Power RF

Latest reply

Thanks for sharing  Details Published on 2021-11-22 22:44
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 

51

Posts

0

Resources
2
 

Well done, Brother Shrimp.

For those who use BlueNRG-1/2/3, Keil can be used for free. http://www2.keil.com/stmicroelectronics-stm32/mdk#

There are also free official Eclipse-based development tools.

https://www.st.com/content/st_com/en/products/embedded-software/wireless-connectivity-software/stsw-wise-studio.html

This post is from ST - Low Power RF
 
 
 

1412

Posts

3

Resources
3
 

Thanks for sharing

This post is from ST - Low Power RF
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list