安裝Hi3861開發(fā)板特有環(huán)境
除上述[安裝庫和工具集]和[安裝編譯工具]外,針對Hi3861開發(fā)板還需要安裝特定的編譯工具。
工具要求
表1 Hi3861 WLAN模組需要安裝的編譯工具
開發(fā)工具 | 用途 |
---|---|
SCons3.0.4+ | 編譯構(gòu)建工具 |
python模塊:setuptools、kconfiglib、pycryptodome、six、ecdsa | 編譯構(gòu)建工具 |
gcc riscv32 | 編譯構(gòu)建工具 |
操作步驟
相關操作在Ubuntu環(huán)境下進行。
安裝Scons
運行如下命令,安裝SCons安裝包。
python3 -m pip install scons
運行如下命令,查看是否安裝成功。如果安裝成功,查詢結(jié)果下圖所示。
scons -v
圖1 SCons安裝成功界面,版本要求3.0.4以上
鴻蒙開發(fā)指導文檔:[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
]
安裝python模塊
- 運行如下命令,安裝python模塊setuptools。
pip3 install setuptools
- 安裝GUI menuconfig工具(Kconfiglib),建議安裝Kconfiglib 13.2.0+版本,任選如下一種方式。
- 安裝pycryptodome,任選如下一種方式。
安裝升級文件簽名依賴的Python組件包,包括:pycryptodome、six、ecdsa。安裝ecdsa依賴six,請先安裝six,再安裝ecdsa。- 命令行方式:
sudo pip3 install pycryptodome
- 安裝包方式:
- 下載.whl文件(例如:pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl)。 下載路徑:“[https://pypi.org/project/pycryptodome/#files]”。
- 運行如下命令,安裝.whl文件。
sudo pip3 install pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl
- 命令行方式:
- 安裝six,任選如下一種方式。
- 命令行方式:
sudo pip3 install six --upgrade --ignore-installed six
- 安裝包方式:
- 下載.whl文件(例如:six-1.12.0-py2.py3-none-any.whl)。 下載路徑:“[https://pypi.org/project/six/#files]”
- 運行如下命令,安裝.whl文件。
sudo pip3 install six-1.12.0-py2.py3-none-any.whl
- 命令行方式:
- 安裝ecdsa,任選如下一種方式。
- 命令行方式:
sudo pip3 install ecdsa
- 安裝包方式:
- 下載.whl文件(例如:ecdsa-0.14.1-py2.py3-none-any.whl)。 下載路徑:“[https://pypi.org/project/ecdsa/#files]”
- 運行如下命令,安裝.whl文件。
sudo pip3 install ecdsa-0.14.1-py2.py3-none-any.whl
- 命令行方式:
安裝gcc_riscv32(WLAN模組類編譯工具鏈)
須知:
- 打開Linux編譯服務器終端。
- 下載riscv-gnu-toolchain交叉編譯工具鏈。
git clone --recursive https://gitee.com/mirrors/riscv-gnu-toolchain.git
- 打開文件夾riscv-gnu-toolchain,先刪除空文件夾,以防止下載newlib,binutils,gcc時沖突。
cd riscv-gnu-toolchain && rm -rf riscv-newlib && rm -rf riscv-binutils && rm -rf riscv-gcc
- 下載riscv-newlib-3.0.0。
git clone -b riscv-newlib-3.0.0 https://github.com/riscv/riscv-newlib.git
- 下載riscv-binutils-2.31.1。
git clone -b riscv-binutils-2.31.1 https://github.com/riscv/riscv-binutils-gdb.git
- 下載riscv-gcc-7.3.0。
git clone -b riscv-gcc-7.3.0 https://github.com/riscv/riscv-gcc
- 添加riscv-gcc-7.3.0補丁。
訪問gcc官方補丁鏈接[89411],[86724],按照補丁鏈接中要求的修改,手動將變更添加到對應的.c和.h文件中,注意由于patch版本與下載的gcc版本有所偏差,行數(shù)有可能對應不上,請自行查找patch中的關鍵字定位到對應行。 - 下載[GMP 6.1.2],并解壓安裝。
tar -xvf gmp-6.1.2.tar.bz2 && mkdir build_gmp && cd build_gmp && ../gmp-6.1.2/configure --prefix=/usr/local/gmp-6.1.2 --disable-shared --enable-cxx && make && make install
- 下載[mpfr-4.0.2 ],并解壓安裝。
tar -xvf mpfr-4.0.2.tar.gz && mkdir build_mpfr && cd build_mpfr && ../mpfr-4.0.2/configure --prefix=/usr/local/mpfr-4.0.2 --with-gmp=/usr/local/gmp-6.1.2 --disable-shared && make && make install
- 下載mpc-1.1.0 ,并解壓安裝。
tar -xvf mpc-1.1.0.tar.gz && mkdir build_mpc && cd build_mpc && ../mpc-1.1.0/configure --prefix=/usr/local/mpc-1.1.0 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.2 --disable-shared && make && make install
- 打開文件夾riscv-gnu-toolchain,新建工具鏈輸出目錄。
cd /opt && mkdir gcc_riscv32
- 編譯binutils。
mkdir build_binutils && cd build_binutils && ../riscv-binutils-gdb/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --bindir=/opt/gcc_riscv32/bin --libexecdir=/opt/gcc_riscv32/riscv32 --libdir=/opt/gcc_riscv32 --includedir=/opt/gcc_riscv32 && make -j16 && make install && cd ..
- 編譯newlib。
mkdir build_newlib && cd build_newlib && ../riscv-newlib/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --bindir=/opt/gcc_riscv32/bin --libexecdir=/opt/gcc_riscv32 --libdir=/opt/gcc_riscv32 --includedir=/opt/gcc_riscv32 && make -j16 && make install && cd ..
- 編譯gcc。
mkdir build_gcc && cd build_gcc && ../riscv-gcc/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" LDFLAGS="-Wl,-z,relro,-z,now,-z,noexecstack" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --with-headers="/opt/gcc-riscv32/riscv32-unknown-elf/include" --with-mpc=/usr/local/mpc-1.1.0 --with-gmp=/usr/local/gmp-6.1.2 --with-mpfr=/usr/local/mpfr-4.0.2 && make -j16 && make install
HarmonyOS與OpenHarmony鴻蒙文檔籽料:mau123789是v直接拿
- 設置環(huán)境變量。
說明:
如果直接采用編譯好的riscv32 gcc包,請先執(zhí)行以下命令將壓縮包解壓到根目錄:
> tar -xvf gcc_riscv32-linux-7.3.0.tar.gz -C ~ >
注意之后設置和生效環(huán)境變量時,所設置的路徑為根目錄。
打開`.bashrc`文件。
vim /opt/.bashrc
將以下命令拷貝到的最后一行,保存并退出。
export PATH=/opt/gcc_riscv32/bin:$PATH
- 生效環(huán)境變量。
source /opt/.bashrc
- Shell命令行中輸入如下命令,如果能正確顯示編譯器版本號,表明編譯器安裝成功。
riscv32-unknown-elf-gcc -v
審核編輯 黃宇
-
開發(fā)板
+關注
關注
25文章
5187瀏覽量
98716 -
鴻蒙
+關注
關注
57文章
2405瀏覽量
43201 -
HarmonyOS
+關注
關注
79文章
1985瀏覽量
30869 -
OpenHarmony
+關注
關注
25文章
3760瀏覽量
16867
發(fā)布評論請先 登錄
相關推薦
鴻蒙OpenHarmony【輕量系統(tǒng)運行】 (基于Hi3861開發(fā)板)

鴻蒙OpenHarmony【集成三方SDK】 (基于Hi3861開發(fā)板)

鴻蒙OpenHarmony【輕量系統(tǒng) 運行】 (基于Hi3861開發(fā)板)

Hi3861開發(fā)板介紹
鴻蒙硬件HI3861開發(fā)環(huán)境搭建 精選資料分享
如何使用 HiBurn 工具燒錄鴻蒙的 .bin 文件到 Hi3861 開發(fā)板
關于OpenHarmony輕量系統(tǒng)開發(fā)
自制Hi3861開發(fā)板(附原理圖和電路圖)

潤開鴻Hi3861開發(fā)板介紹

鴻蒙OpenHarmony【輕量系統(tǒng)編譯】 (基于Hi3861開發(fā)板)

鴻蒙OpenHarmony南向:【Hi3861開發(fā)板介紹】

評論