3.2. Eclipse Development Guide under Windows
This document introduces the use of eclipse under Windows to build a software development environment for BL702 series MCU.
3.2.1. Software and hardware environment
Eclipse free installation package
Serial port assistant software
A USB Type-A data cable
A j-link emulator
A USB-TTL serial port module
Several Dupont lines
3.2.2. Download Eclipse
Download the installation package with the RISC-V toolchain from the Bouffalo Lab developer community Eclipse https://dev.bouffalolab.com/download .
3.2.3. Download bl_mcu_sdk
Download from the open source community bl_mcu_sdk.
You can use
git clone
or directlydownload
to download the SDKBefore using
git clone
, please make sure thatgit
has been installed correctly. Open a terminal that supportsgit
and enter the following command to get the latest SDK.
1$ git clone https://gitee.com/bouffalolab/bl_mcu_sdk.git --recursive
3.2.4. Configure eclipse
Copy the eclipse compressed package to the working directory, unzip the eclipse compressed package
Enter the eclipse directory, double-click
eclipse.exe
to start eclipseSelect your
Workspace
directory, clickLaunch
to enter the workspaceClick
Window->preferences
in the menu bar to open the environment configuration related page, ready to import the related configuration environment- Click the icon at “1” in the figure below to open the import configuration interface, follow the steps shown in the figure, and select the
bflb_mcu_preferences.epf
configuration file in theeclipse.exe
directory.
- Click the icon at “1” in the figure below to open the import configuration interface, follow the steps shown in the figure, and select the
After selecting the corresponding file, click
Finish
, select and clickcancel
in the dialog box without restarting.
3.2.5. Import bl_mcu_sdk
Click on the menu bar
File->Import
to open the configuration interface of the imported projectIn the opened
Import
window, selectGeneral->Existing Projects into Workspace
, and then clickNext
After loading the project path of bl_mcu_sdk, click
Finsh
to complete the importAfter the import is complete, close the
Welcome
window to see the imported projectExpand
Build Target
, you can see the three function buttonsbl_clean
,bl_make
, anddownload
.Double-click the
bl_clean
button, it will clear the compilation cache in thebuild
andout
directoriesDouble-click the
bl_make
button, the set case will be compiled normally, if the default configuration is not modified, thehelloworld
project will be compiledDouble-click the
download
button, the code will be downloaded to the chip, if it is not compiled successfully, the default or last.bin
file will be downloaded
3.2.6. Hardware connection
For specific board connection, please refer to Hardware connection; (The eclipse environment recommends using
j-link
for programming and debugging)Please make sure that the development board is set up correctly before proceeding to the following steps
3.2.7. Test the Hello World project
Open Hello World
Open
examples/hellowd/helloworld/main.c
, you can edit and modify the code of thehelloworld
test demo. If you modify it, please save it and execute the compilation
Compile Hello World
Double click
bl_make
to compile the helloworld projectAfter successful compilation, you can see the log information as shown in the figure below in the
Console
window
Program Hello World
Double-click
download
to program the helloworld projectbin
file to the chipAfter the download is successful, you can see the log information as shown in the figure below in the
Console
window
Run Hello World
Connect the
TXD0
,RXD0
andGND
pins of the board to the USB-TTL serial port module with a DuPont cable, insert the serial port module into the PC, and use any serial port assistant software to open the serial portAfter the programming is successful, press the
rst
button on the board. If the download is correct, you can see the log information as shown in the figure below in the serial port assistant software.
Debug Hello World
Click the
Debug
button in the eclipse toolbar to enter the debug configuration windowSelect
GDB SEGGER J-Link Debugging->Jlink_bl_mcu_sdk
, select the.elf
file that needs to be debugged inC/C++ Application:
Click
Apply
first, then clickDebug
to startDebug
After entering the Debug interface, you can see that the program stops at
main
, click theStep Over
button in the upper toolbar to perform single-step debugging of the code project.
3.2.8. Compile and program different target projects
When you right-click the
bl_make
button and clickEdit
, the configuration interface for replacing the target project will pop up, as shown in the figure below
Where
APP=xxx
can be changed to the name of the target project that needs to be compiled and programmed. For example, if you want to compile and program thegpio/gpio_blink
project, modify it toAPP=gpio_blink
.make BOARD=bl706_iot
inBuild command
will specify different Board types to adapt to different types of boards.The
Board
type determines the correspondingborad
header file when compiling. The default selection ismake build BOARD=bl706_iot