Neptune w800開發版ubuntu linux環境編譯通過——如何搭建開發環境
windows寫代碼,linux編譯
Utunbu安裝Samba服務並映射目錄到windows:
https://www.cnblogs.com/txwtech/p/15087136.html
安裝VS code
https://device.harmonyos.com/cn/docs/ide/user-guides/install_windows-0000001050164976
啟動VScode打開工程,並找到通過Z驅動映射的
Neptune-HarmonyOS-IOT-master的目錄
會有幾個選項,對應填入,framework選hb
插入Neptune開發板,並查看com口
點開工程-配置工程
記得右上角的保存
打開工程
配置文件路徑:以下目錄供參考,請更改對應的路徑
"F:/utils/native/lite/include",
"F:/domains/iot/link/libbuild",
"F:/base/iot_hardware/peripheral/interfaces/kits",
"F:/third_party/cmsis/CMSIS/RTOS2/Include",
"F:/Neptune-HarmonyOS-IOT-master/base/iot_hardware/interfaces/kits/wifiiot_lite",

右鍵app文件夾--創建文件夾--比如hello1

右鍵Hello1,創建文件, hello1.c 與BUILD.gn
hello1.c
#include <stdio.h> #include <unistd.h> #include "cmsis_os2.h" #include "ohos_init.h" #include "wifiiot_gpio.h" #include "wifiiot_gpio_ex.h" #include "wifiiot_gpio_w800.h" static void* GpioTask(const char* arg) { (void) arg; for(int i=1;i<=10;i++) { /* code */ printf("hello world!= %d\n",i); } } static void hello1(void) { osThreadAttr_t attr={0}; attr.name="GpioTask"; attr.stack_size=4096; attr.priority=osPriorityNormal; if (osThreadNew((osThreadFunc_t)GpioTask, NULL, &attr) == NULL) { printf("[GpioExample] Falied to create GpioTask!\n"); } } SYS_RUN(hello1);
BUILD.gn
# Copyright (c) 2020 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. static_library("hello1") { sources = [ "hello1.c" ] include_dirs = [ "//utils/native/lite/include", "//kernel/liteos_m/components/cmsis/2.0", "//base/iot_hardware/interfaces/kits/wifiiot_lite", ] }
修改app同目錄的BUILD.gn
代碼:
# Copyright (c) 2020 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/lite/config/component/lite_component.gni") lite_component("app") { features = [ # "startup", #"iothardware:gpio_example", # "wifitest:wifi_test", #"iothardware:lowpower_example" # "uart_sample:uart_demo" "Hello1:hello1", ] }
添加內容后,都記得CTRL+S保存
Linux界面的編譯方法:
https://www.cnblogs.com/txwtech/p/15086496.html
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
windows界面使用putty.exe鏈接ubuntu,這個windows是遠程編譯方法。
參考鏈接:http://www.pc6.com/softview/SoftView_81789.html
cd 進入Neptune-HarmonyOS-IOT-master目錄,可以看到build.py, 編譯源碼 輸入:python build.py w800 make[2]: 進入目錄“/home/txwtech/Downloads/Neptune-HarmonyOS-IOT-master/vendor/winnermicro/w800/src/app/cJSON” make[2]: 離開目錄“/home/txwtech/Downloads/Neptune-HarmonyOS-IOT-master/vendor/winnermicro/w800/src/app/cJSON” make[1]: 離開目錄“/home/txwtech/Downloads/Neptune-HarmonyOS-IOT-master/vendor/winnermicro/w800/src/app” libs has been updated. LINK w800.elf OBJCOPY w800.bin generate normal image completed. compress binary completed. generate compressed image completed. build finished! Build success! [170/170] STAMP obj/vendor/winnermicro/w800/build_w800_sdk.stamp ohos w800 build success!
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、