This post was last edited by Unseen on 2021-6-3 00:27
Last time we explained the hardware composition of the Bear Pi development board. What everyone wants to do most is to learn how to use the Bear Pi development board to light up the lamp.
Lighting a lamp is a basic task. First of all, we need to lay a good foundation. So if we want to light a lamp, we must first configure the compilation environment. Without good soil, how can it sprout healthily?
Refer to the official guidance document of BearPie. Compiling under Windows system still requires the use of Linux environment. Fortunately, Windows 10 also supports Linux environment very well (refer to wsl2 mode). We only need to configure a few parameters to seamlessly connect to Linux environment under Windows and happily use dual systems for development.
,
First, we install VSCode, an open source editor officially produced by Microsoft. Press ctrl+j to call out the command line tool and refer to the official development documentation.
Knowing that we need to install the above-mentioned development tools in the Linux environment, we will install and use them one by one.
ps (In actual use, I found that I could not download the above gcc compiler, which might be a network environment problem, so I used the LVMM from the official website)
We use the command line tool and type the command wsl to connect to the Linux environment
When the environment prompt PS in front of your command line symbol changes to the familiar $ sign in Linux, it means that you have entered the Linux environment.
By default, you can type the command to check whether each tool has been installed by default and the corresponding version number:
First check the python3 installation, as shown below:
After installing python3, use
- python3 -m pip install scons
Install and update the Python package management tool (pip3)
- sudo apt-get install python3-setuptools python3-pip -y
- sudo pip3 install --upgrade pip
To install the Scons tool (if you use the official lvmm+hb, you do not need to install this item)
- sudo apt install scons -y
-
After the installation is complete, remember to check whether the installation is correct.
Next you need to download the compilation tool
1. Download gn tool
2. Download the ninja tool
3. Download LLVM tools
Create respective directories and unzip them
- mkdir ~/gn
- tar -xvf gn-linux-x86-1717.tar.gz -C ~/gn
- tar -xvf ninja.1.9.0.tar -C ~/
- tar -zxvf llvm.tar.gz -C ~/
Setting Environment Variables
- vim ~/.bashrc
- export PATH=~/gn:$PATH
- export PATH=~/ninja:$PATH
- export PATH=~/llvm/bin:$PATH
Effective environment variables
Install hb using python3
- python3 -m pip install --user ohos-build
Edit the environment variables and enable
- vim ~/.bashrc
- export PATH=~/.local/bin:$PATH
- source ~/.bashrc
Execute: hb -h. If the following information is displayed, the installation is successful.