筆者在去年利用國慶時間,將Cortex-M7 的國產廠商兆易創新GD32H459移植OpenHarmony輕量系統,但是適配不太完善——只能選擇liteos-m接管中斷。這樣導致使用中斷非常麻煩。于是筆者最近將接管中斷模式修改為不接管,這樣可以方便的使用gd32提供的中斷。
相關開源地址:https://gitee.com/GD32H759_OpenHarmony/docs/blob/OpenHarmony-v5.0.3-Release/README.md
往期文章
國產兆易創新Cortex-M7 GD32H459適配OpenHarmony輕量系統,代碼開源!
兆易創新Cortex-M7 GD32H459適配OpenHarmony輕量系統適配教程
GD32H759IMT6 Cortex-M7 OpenHarmony輕量系統移植——接管中斷修改為不接管
如何在GD32H759IMT6 上使用OpenHarmony 5.0.3 輕量系統開發
1.首先搭建好OpenHarmony開發環境后,下載OpenHarmony輕量系統5.0.3r的hi3861代碼
# 下載v5.0.3 版本hi3861源碼
repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v5.0.3-Release -m chipsets/hispark_pegasus.xml -g ohos:mini
repo sync -c
repo forall -c 'git lfs pull'# 安裝依賴
./build/build_scripts/env_setup.sh
source ~/.bashrc# 下載編譯工具
bash build/prebuilts_download.sh# 執行一遍3861的編譯命令確認環境有沒有問題
./build.sh --product-name wifiiot_hispark_pegasus --ccache --no-prebuilt-sdk
2.將本組織下GD32H759的vendor和device替換掉上一步拉取的3861代碼的vendor和device目錄
# 5.0.3版本中需要將third_party/cmsis回退到4.1
rm -rf third_party/cmsis
git clone -b OpenHarmony-v4.1-Release https://gitee.com/openharmony/third_party_cmsis.git third_party/cmsisrm -rf device
git clone -b OpenHarmony-v5.0.3-Release https://gitee.com/GD32H759_OpenHarmony/device.git devicerm -rf vendor
git clone -b OpenHarmony-v5.0.3-Release https://gitee.com/GD32H759_OpenHarmony/vendor.git
5.0.3版本中需要將third_party/cmsis回退到4.1,如果不回退,會顯示cmsis版本太高導致無法編譯通過(廠家提供的裸機文件一般是沒問題的)
[OHOS ERROR] ../../../device/soc/gigadevice/gd32h7xx/libraries/drivers/src/gd32h7xx_misc.c: In function 'nvic_irq_enable':
[OHOS ERROR] ../../../device/soc/gigadevice/gd32h7xx/libraries/drivers/src/gd32h7xx_misc.c:101:11: error: 'NVIC_Type' {aka 'struct <anonymous>'} has no member named 'IP'; did you mean 'IPR'?
[OHOS ERROR] 101 | NVIC->IP[nvic_irq] = (uint8_t)temp_priority;
[OHOS ERROR] | ^~
[OHOS ERROR] | IPR[OHOS ERROR] Traceback (most recent call last):
3.編譯固件
rm -rf out
./build.sh --product-name GD32H759IMT6_BOARD --ccache --no-prebuilt-sdk