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
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)
- for your own project and clone it to your computer
- Download and install VSCode and open the project you cloned
- Install the Cortex-Debug extension via marus25
marus25.cortex-debug Search and install in the extensions menu
- Installing the Arm Cortex Debug Tools
Window Settings
- In your project opened in VSCode, open and modify it
.vscode/settings.json as follows:
- 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"
- 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",'
- Open the file location for your version of the Arm Cortex Debug Tools in Explorer, then navigate to
\lib\gcc\arm-none-eabi and 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
- Replace the setting "armToolchainVersion" with the file name you copied, for example:
"armToolchainVersion": "10.2.1",
- (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"'
- Installing BlueNRG-1_2 DK
- 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\Library so my setup looks like"bluenrgDkLocation": "C:/Users/<USER>/ST/BLUENR~1.1/Library"
You should be done!
Linux Setup
-
In your project opened in VSCode, open and modify it .vscode/settings.json as follows:
- 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",'
- Open the file location for your version of the Arm Cortex Debug Tools in Explorer, then navigate to
\lib\gcc\arm-none-eabi and 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
- Replace the setting "armToolchainVersion" with the file name you copied, for example:
"armToolchainVersion": "10.2.1",
-
Installing BlueNRG-1_2 DK
- Sign up and wait for email download :(
- Use innoextract to get files from exe
- Copy %USERPROFILE/ST/BlueNRG-1_2 DK 3.2.1 to your desired destination
- 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"
-
Build and install openocd-0.11.0-rc2
- 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
- Press ctrl+shift+b to build the project, and if everything is set up correctly, it should build!
- 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
- 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
- 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)
|