各位關(guān)注先楫的小伙伴們,基于OpenHarmony 4.0-Release版本和hpm_sdk v1.4.0 版本的 HPMicro ohos v1.0.0 正式發(fā)布了。
支持的開發(fā)板:
- HPM6750EVK2
- HPM6800EVK
- HPM6300EVK
- HPM6200EVK
- HPM5300EVK
提供的主要功能
對(duì)如下組件和驅(qū)動(dòng)進(jìn)行了適配:
定時(shí)器類: WATCHDOG
文件系統(tǒng): littlefs
網(wǎng)絡(luò)協(xié)議棧: lwip
C庫:musl
組件類: bootstrap_lite,utils_lite,liteos_m,samgr_lite,hilog_lite,hievent_lite,hiview_lite,xts_acts,xts_tools
開發(fā)環(huán)境
推薦采用Windows+Ubuntu環(huán)境進(jìn)行開發(fā):
- Windows環(huán)境用于編寫代碼、下載程序和燒入固件等,系統(tǒng)要求:Windows 10 64位系統(tǒng)。
- Linux環(huán)境用于代碼下載、編譯工程和生成固件等,系統(tǒng)要求:Ubuntu 20.04 64位及以上版本。
注意:若不確定所使用的Linux設(shè)備的系統(tǒng)及版本,請(qǐng)?jiān)赽ash中運(yùn)行如下命令查看:
lsb_release -a
請(qǐng)?jiān)诖_認(rèn)Linux系統(tǒng)不低于Ubuntu 20.04.XX LTS的情況下執(zhí)行后續(xù)的步驟;否則,請(qǐng)升級(jí)或更換合適的Liunx設(shè)備。
若需要支持在Linux與Windows之間的文件共享以及編輯,請(qǐng)?jiān)贚inux設(shè)備上適當(dāng)?shù)匕惭b和配置samba、vim等常用軟件。
OpenHarmony開發(fā)環(huán)境搭建:
[準(zhǔn)備開發(fā)環(huán)境]
https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-prepare.md
[安裝庫和工具集]
https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-install-package.md
編譯工具安裝
[gcc工具下載]
https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz
設(shè)置環(huán)境變量
說明:如果直接采用編譯好的riscv32 gcc包,請(qǐng)先執(zhí)行以下命令將壓縮包解壓到用戶的home(也可以是其他目錄,注意使用實(shí)際的PATH即可):
tar -xvf gcc_riscv32-linux-7.3.0.tar.gz -C ~
將以下命令拷貝到`.bashrc`文件的最后一行,保存并退出。
export PATH=~/gcc_riscv32/bin:$PATH
執(zhí)行下面命令使環(huán)境變量生效:
source ~/.bashrc
Shell命令行中輸入如下命令 `riscv32-unknown-elf-gcc -v`,如果能正確顯示編譯器版本號(hào),表明編譯器安裝成功。
Using built-in specs.
COLLECT_GCC=riscv32-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/home/hhp/ohos/tools/gcc_riscv32/bin/../libexec/gcc/riscv32-unknown-elf/7.3.0/lto-wrapper
Target: riscv32-unknown-elf
Configured with: ../riscv-gcc/configure --prefix=/home/yuanwenhong/gcc_compiler_riscv/gcc_riscv32/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=/home/yuanwenhong/gcc_compiler_riscv/gcc_riscv32/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
Thread model: single
源碼獲?。?/strong>
[獲取源碼]
https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-sourcecode.md
[安裝hb工具]
https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-pkg-install-tool.md
注意:默認(rèn)下載的是master分支版本,如果想下載其他分支版本請(qǐng)將-b master改為需要下載的分支。
比如下載OpenHarmony-4.0-Release:
repo init -u [email protected]:openharmony/manifest.git -b OpenHarmony-4.0-Release --no-repo-verify
hb 安裝報(bào)錯(cuò):
WARNING: The scripts alldefconfig, allmodconfig, allnoconfig, allyesconfig, defconfig, genconfig, guiconfig, listnewconfig, menuconfig, oldconfig, olddefconfig, savedefconfig and setconfig are installed in '/home/xxx/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script hb is installed in '/home/xxx/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.```
解決辦法:
1. 將以下命令拷貝到.bashrc文件的最后一行,保存并退出。
export PATH=~/.local/bin:$PATH
2. 執(zhí)行如下命令更新環(huán)境變量
source ~/.bashrc
python3 -m pip uninstall ohos-build
python3 -m pip install --user build/hb
工程編譯
選擇目標(biāo)工程:
執(zhí)行hb set選擇hpmicro下的hpm6750evk2:
也可以直接通過命令指定
hb set -p hpm6750evk2
編譯工程
執(zhí)行`hb build -f` 進(jìn)行工程編譯,編譯成功后顯示如下內(nèi)容:
打開xts功能
執(zhí)行hb build -f --gn-args="build_xts=true"命令進(jìn)行xts編譯。
鏡像燒錄
下載安裝燒錄工具(windows)
點(diǎn)擊[先楫系列資料] 百度網(wǎng)盤下載sdk/HPMicro_Manufacturing_Tool_vx.x.x.zip
網(wǎng)盤鏈接:https://pan.baidu.com/s/1RaYHOD7xk7fnotmgLpoAlA?pwd=xk2n
下載后解壓HPMicro_Manufacturing_Tool_vx.x.x.zip文件到任意目錄。
找到 hpm_manufacturing_gui.exe,雙擊執(zhí)行程序:
下載程序到開發(fā)板:
1. 將開發(fā)板的USB2UART0接口連接至PC,正確連接后,PC可識(shí)別到一路usb串口,hpm6750evk2板載了ch340 usb轉(zhuǎn)串口芯片。
2. 將BOOT撥碼開關(guān)設(shè)置為:
boot0: 0
boot1: 1
撥碼開關(guān)設(shè)置好后,點(diǎn)擊開發(fā)板的`RESTN`按鈕,進(jìn)行復(fù)位,復(fù)位后進(jìn)入到isp模式。
3. 配置hpm_manufacturing_gui的 類型為:UART 并選擇選擇步驟1中對(duì)用的串口,點(diǎn)擊連接:
連接成功:
4. 拷貝編譯好的固件程序out/hpm6750evk2/hpm6750evk2/OHOS_Image.bin到windows。
5. 選擇固件程序,點(diǎn)擊燒寫進(jìn)行下載:
6. 設(shè)置撥碼開關(guān)為正常模式
boot0: 0
boot1: 0
7. 打開一個(gè)串口終端MobaXterm,重啟開發(fā)板,串口打印啟動(dòng)信息
8. hpm_manufacturing_gui更多用法,請(qǐng)參考:HPMicro_Manufacturing_Tool_vx.x.x\doc\user_manual.html
openocd 進(jìn)行調(diào)試鏡像
1. 下載openocd
git clone [email protected]:hpmicro/riscv-openocd.git -b riscv-hpmicro
2. 安裝依賴工具
sudo apt install libtool libusb-1.0-0-dev libhidapi-dev libftdi-dev
3. 安裝
進(jìn)入源碼目錄,并執(zhí)行下面的命令
./bootstrap
./configure
make -j16
sudo make install
sudo cp contrib/60-openocd.rules /etc/udev/rules.d/
4. 連接燒寫和目標(biāo)板
5. 啟動(dòng)openocd
進(jìn)入到ohos源碼device/soc/hpmicro/sdk/hpm_sdk/boards/openocd,執(zhí)行如下命令:
$ openocd -s . -f probes/cmsis_dap.cfg -f soc/hpm6750-single-core.cfg -f boards/hpm6750evk2.cfg
Open On-Chip Debugger 0.11.0+dev (2024-01-08-14:39)
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: JTAG supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (JTAG)
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 8000 kHz
Info : cmsis-dap JTAG TLR_RESET
Info : cmsis-dap JTAG TLR_RESET
Info : JTAG tap: hpm6750.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Info : [hpm6750.cpu0] datacount=4 progbufsize=8
Info : Examined RISC-V core; found 2 harts
Info : hart 0: XLEN=32, misa=0x4094112d
[hpm6750.cpu0] Target successfully examined.
Info : starting gdb server for hpm6750.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
6. 打開另一個(gè)終端,并進(jìn)入ohos源碼目錄,啟動(dòng)gdb
$ riscv32-unknown-elf-gdb
GNU gdb (GDB) 8.1.50.20180718-git
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=riscv32-unknown-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)
7. 選擇需要調(diào)試的鏡像,并進(jìn)行加載調(diào)試
(gdb) file out/hpm6750evk2/hpm6750evk2/OHOS_Image
Reading symbols from out/hpm6750evk2/hpm6750evk2/OHOS_Image...done.
(gdb) target extended-remote :3333
Remote debugging using :3333
warning: Target-supplied registers are not supported by the current architecture
_start () at ../../../device/soc/hpmicro/hpm6700/liteos_m/los_start.S:26
26 la gp, __global_pointer$
(gdb) load
Loading section .nor_cfg_option, size 0x10 lma 0x80000400
Loading section .boot_header, size 0x90 lma 0x80001000
Loading section .start, size 0x2e lma 0x80003000
Loading section .vectors, size 0x3c0 lma 0x8000302e
Loading section .text, size 0x5876e lma 0x800033ee
Loading section .data, size 0x1158 lma 0x8005bb5c
Start address 0x80003000, load size 367956
Transfer rate: 6 KB/sec, 13141 bytes/write.
(gdb) c
相關(guān)倉庫
[vendor_hpmicro]
https://gitee.com/openharmony/vendor_hpmicro
[device_soc_hpmicro]
https://gitee.com/openharmony/device_soc_hpmicro
[device_board_hpmicro]
https://gitee.com/openharmony/device_board_hpmicro
-
開發(fā)板
+關(guān)注
關(guān)注
25文章
5126瀏覽量
98310 -
OpenHarmony
+關(guān)注
關(guān)注
25文章
3749瀏覽量
16656 -
先楫半導(dǎo)體
+關(guān)注
關(guān)注
10文章
233瀏覽量
2203
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
有獎(jiǎng)提問!先楫半導(dǎo)體HPM6E00系列新品發(fā)布會(huì)?。?/a>
先楫半導(dǎo)體 hpm_sdk v1.5.0 正式發(fā)布
先楫半導(dǎo)體攜手OpenHarmony正式發(fā)布HPMicro ohos v1.0.0
![<b class='flag-5'>先</b><b class='flag-5'>楫</b><b class='flag-5'>半導(dǎo)體</b><b class='flag-5'>攜手</b><b class='flag-5'>OpenHarmony</b>正式<b class='flag-5'>發(fā)布</b><b class='flag-5'>HPMicro</b> <b class='flag-5'>ohos</b> <b class='flag-5'>v1.0.0</b>](https://file1.elecfans.com/web2/M00/C6/A4/wKgZomYLca2AIaTMAABYemApwG4036.png)
先楫高性能MCU HPM6800系列產(chǎn)品生態(tài)綻放,共鏈未來
先楫半導(dǎo)體攜手立功科技發(fā)布全新汽車液晶儀表解決方案
先楫半導(dǎo)體HPMicro Nuttx v0.2.0正式發(fā)布!
先楫半導(dǎo)體HPMicro Nuttx v0.2.0 發(fā)布
![<b class='flag-5'>先</b><b class='flag-5'>楫</b><b class='flag-5'>半導(dǎo)體</b><b class='flag-5'>HPMicro</b> Nuttx <b class='flag-5'>v</b>0.2.0 <b class='flag-5'>發(fā)布</b>](https://file.elecfans.com/web2/M00/37/D7/pYYBAGI9l9uAOwALAAAmFmqVYdg094.png)
AI導(dǎo)航器V1.0.0 發(fā)布說明
![AI導(dǎo)航器<b class='flag-5'>V1.0.0</b> <b class='flag-5'>發(fā)布</b>說明](https://file.elecfans.com/web1/M00/D9/4E/pIYBAF_1ac2Ac0EEAABDkS1IP1s689.png)
評(píng)論