安裝Hi3861開發板特有環境
除上述[安裝庫和工具集]和[安裝編譯工具]外,針對Hi3861開發板還需要安裝特定的編譯工具。
工具要求
表1 Hi3861 WLAN模組需要安裝的編譯工具
開發工具 | 用途 |
---|---|
SCons3.0.4+ | 編譯構建工具 |
python模塊:setuptools、kconfiglib、pycryptodome、six、ecdsa | 編譯構建工具 |
gcc riscv32 | 編譯構建工具 |
操作步驟
相關操作在Ubuntu環境下進行。
安裝Scons
運行如下命令,安裝SCons安裝包。
python3 -m pip install scons
運行如下命令,查看是否安裝成功。如果安裝成功,查詢結果下圖所示。
scons -v
圖1 SCons安裝成功界面,版本要求3.0.4以上
鴻蒙開發指導文檔:[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版本有所偏差,行數有可能對應不上,請自行查找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直接拿
- 設置環境變量。
說明:
如果直接采用編譯好的riscv32 gcc包,請先執行以下命令將壓縮包解壓到根目錄:
> tar -xvf gcc_riscv32-linux-7.3.0.tar.gz -C ~ >
注意之后設置和生效環境變量時,所設置的路徑為根目錄。
打開`.bashrc`文件。
vim /opt/.bashrc
將以下命令拷貝到的最后一行,保存并退出。
export PATH=/opt/gcc_riscv32/bin:$PATH
- 生效環境變量。
source /opt/.bashrc
- Shell命令行中輸入如下命令,如果能正確顯示編譯器版本號,表明編譯器安裝成功。
riscv32-unknown-elf-gcc -v
審核編輯 黃宇
聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網站授權轉載。文章觀點僅代表作者本人,不代表電子發燒友網立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規問題,請聯系本站處理。
舉報投訴
-
開發板
+關注
關注
25文章
4469瀏覽量
94321 -
鴻蒙
+關注
關注
55文章
1693瀏覽量
42142 -
HarmonyOS
+關注
關注
79文章
1870瀏覽量
29299 -
OpenHarmony
+關注
關注
23文章
3348瀏覽量
15184
發布評論請先 登錄
相關推薦
【全網最簡】Hi3861鴻蒙開發環境搭建指南(Linux下開發環境)
和串口工具是2個?為了幫助新人解決這些問題,更好的利用社區贈送的Hi3861板子學習鴻蒙,我用業余時間完成了這套野生的Hi3861鴻蒙開發
發表于 03-04 15:01
鴻蒙硬件HI3861開發環境搭建 精選資料分享
鴻蒙HI3861開發環境搭建1.板子在哪里買https://item.taobao.com/item.htm?spm=a1z09.2.0.0
發表于 07-22 06:42
【匯總】OpenHarmony輕量系統開發目錄和個人感悟
,演變到了現在的3.1版本。于是決定重新開啟篇章,針對3.0以上的版本,寫一系列的文章。開發板:潤和Hi3861開發套件適合人群:剛入門想學習OpenHarmony
發表于 01-20 09:04
OpenHarmony輕量與小型系統入門概述
。 本文將介紹如何基于Windows+Ubuntu環境進行OpenHarmony的開發。 開發板 本文基于以下兩款典型開發板進行
發表于 05-06 15:48
自制Hi3861開發板(附原理圖和電路圖)
OpenHarmony的發展已經進入了新的階段,逐步把重點向富設備開發方向。OpenHarmony 3.x的各大特性也是針對富設備來的,但是仍然支持輕量設備,如Hi3861芯片設備。于
純Windows環境開發Hi3861,編譯燒錄更快捷
更快捷 Hi3861作為OpenHarmony社區Top級開發板,相信很多鴻蒙智聯設備開發者都在Linux上編譯燒錄過
鴻蒙OpenHarmony【LED外設控制】 (基于Hi3861開發板)
OpenHarmony WLAN模組基于Hi3861平臺提供了豐富的外設操作能力,包含I2C、I2S、ADC、UART、SPI、SDIO、GPIO、PWM、FLASH等
評論