BearPi-HM Nano开发笔记

小熊派

简单介绍

BearPi-HM Nano开发板是一块专门为鸿蒙OS设计的HarmonyOS开发板,板载高度集成的2.4GHz WLAN SoC芯片Hi3861,并板载NFC电路及标准的E53接口可拓展

E53接口

介绍

E53接口标准为"物联网俱乐部"联合国内多家开发板厂家制定的物联网案例标准,E53接口的E取自扩展(Expansion)的英文首字母,板子的尺寸为5*3cm,故采用E53作为前缀来命名尺寸为5*3cm类型的案例扩展版,任何一款满足标准设计的开发板均可直接适配E53扩展板。

E53拓展板

E53扩展板是根据不同的应用场景来设计的,以最大的程度在扩展板上还原真实应用场景,不同案例的扩展版根据不同的应用场景来命名后缀。

编译、烧录、工程的编写

下载和编译源码

  • 使用 hpm 软件

    1. 在打算存储项目工程代码的文件中打开终端(工程源码存放文件夹)

    cmd 复制代码
    hpm init -t default // 不知道是干嘛的
    hpm i @bearpi/bearpi_hm_nano // 这句话执行后就是下载源码   
    hpm dist // 编译源码
  • 使用 git 拉取

    1. 在打算存储项目工程代码的文件中打开终端(工程源码存放文件夹)

    cmd 复制代码
    git clone https://gitee.com/bearpi/bearpi-hm_nano.git
    python build.py [板子名字,如BearPi-HM_Nano] // 编译源码

烧录

HiBurn 是烧录软件

  1. 点击 Setting 设置baud为921600
  2. 选择COM
  3. select file:选中 OUT 文件夹中的 allinone.bin
  4. 打钩 Auto burn
  5. 点击 connect
  6. 按下开发板复位

工程编写

  1. 在下载源码的文件夹相对路径 applications\BearPi\BearPi-HM_Nano\sample\ 下创建工程文件夹名(如my_app)

  2. 在 my_app 下新建 xxx.c(我们认定 xxx.c 文件是程序入口函数存放区)、BUILD.gn

  3. 在 xxx.c 中写

    c 复制代码
    #include <stdio.h>
    #include "ohos_init.h" // 不可或缺
    
    void hello_kexie(void){
      printf("Hello KeXie!\r\n");
    }
    
    APP_FEATURE_INIT(hello_kexie); // 告诉编译器 hello_kexie 函数是程序入口函数
  4. 在 my_app 下的 BUILD.gn 中编写

    gn 复制代码
    static_library("myapp"){ # "myapp" 指定输出的静态库文件名为 libmyapp.a
      sources = [
        "hello_world.c" # 指定 .a 文件所依赖的 .c 文件及路径,若路径包含"//"则表示绝对路径(此处为代码根路径),若不包含"//" 则表示相对路径
      ]
      include_dirs = [
        "//utils/native/lite/include" # 指定 source 所需依赖的 .h 文件路径
      ]
    }
  5. 在 sample 下的 BUILD.gn 中编写

gn 复制代码
# Copyright (c) 2020 Nanjing Xiaoxiongpai Intelligent Technology 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 = [
        #"A1_kernal_thread:thread_example",
        #"A2_kernel_timer:timer_example",
        #"A3_kernel_event:event_example",
        #"A4_kernel_mutex:mutex_example",
        #"A5_kernel_semaphore:semaphore_example",
        #"A6_kernel_message:message_example",

        #"B1_basic_led_blink:led_example",
        #"B2_basic_button:button_example",
        #"B3_basic_pwm_led:pwm_example",
        #"B4_basic_adc:adc_example",
        #"B5_basic_i2c_nfc:i2c_example",
        #"B6_basic_uart:uart_example",
        
        #"C1_e53_sf1_mq2:e53_sf1_example",
        #"C2_e53_ia1_temp_humi_pls:e53_ia1_example",
        #"C3_e53_sc1_pls:e53_sc1_example",
        #"C4_e53_sc2_axis:e53_sc2_example",
        #"C5_e53_is1_infrared:e53_is1_example",

        #"D1_iot_wifi_ap:wifi_ap",
        #"D2_iot_wifi_sta_connect:wifi_sta_connect",        
        #"D3_iot_udp_client:udp_client",
        #"D4_iot_tcp_server:tcp_server",
        #"D5_iot_mqtt:iot_mqtt",        
        #"D6_iot_cloud_oc:oc_mqtt",
        #"D7_iot_cloud_onenet:onenet_mqtt",
        #"D8_iot_cloud_oc_smoke:cloud_oc_smoke",
        #"D9_iot_cloud_oc_light:cloud_oc_light",
        #"D10_iot_cloud_oc_manhole_cover:cloud_oc_manhole_cover",
        #"D11_iot_cloud_oc_infrared:cloud_oc_infrared",
        #"D12_iot_cloud_oc_agriculture:cloud_oc_agriculture",
        #"D13_iot_cloud_oc_gps:cloud_oc_gps",
        "my_app:myapp" # 此时程序就只会编译这个工程
    ]
}
相关推荐
不会代码的小猴12 小时前
21. 泛型编程上
开发语言·c++·笔记·算法
大爱编程♡14 小时前
GPIO-I2C
stm32·单片机·嵌入式硬件
摇滚侠14 小时前
《SpringBoot 3:入门与应用实战》第 2 章 IOC 思想与实现 阅读笔记 1
spring boot·笔记·后端
蒸蒸yyyyzwd14 小时前
秋招不熟悉力扣学习笔记1
笔记·学习·leetcode
振南的单片机世界16 小时前
PVD掉电中断——让单片机“咽气前”写完遗书
arm开发·stm32·单片机·嵌入式硬件
LuminousCPP16 小时前
数据结构-双向循环链表
c语言·数据结构·笔记·链表
302wanger17 小时前
【阅读笔记】当AI拿走一切之后
笔记
续写烂尾18 小时前
SD NAND存储实测:正点原子STM32精英板SDIO读写验证全流程
stm32·单片机·嵌入式硬件
疯狂打码的少年19 小时前
【数据结构】串(字符串):基本概念与存储
数据结构·笔记
zlinear数据采集卡20 小时前
USB HS 480M高速传输与SRAM记录仪:DABM-D223数据存储系统全解析
arm开发·嵌入式硬件·fpga开发·开源