From e27721442ed997058f31a2f52523748dd6be8f28 Mon Sep 17 00:00:00 2001 From: zt222 Date: Tue, 21 Feb 2023 10:56:09 +0800 Subject: [PATCH] feat(Simcom-A7670C): Add fabric to Simcom-A7670C #1378 BoATE-910 --- .../Simcom-A7670C/BoatFabricDemo/README.md | 154 +++++++++++++++++ .../Simcom-A7670C/BoatFabricDemo/README_en.md | 155 ++++++++++++++++++ 2 files changed, 309 insertions(+) create mode 100644 vendor/platform/Simcom-A7670C/BoatFabricDemo/README.md create mode 100644 vendor/platform/Simcom-A7670C/BoatFabricDemo/README_en.md diff --git a/vendor/platform/Simcom-A7670C/BoatFabricDemo/README.md b/vendor/platform/Simcom-A7670C/BoatFabricDemo/README.md new file mode 100644 index 000000000..7f53c3d9f --- /dev/null +++ b/vendor/platform/Simcom-A7670C/BoatFabricDemo/README.md @@ -0,0 +1,154 @@ +# BoAT-X-Framework for 芯讯通A7670C整合说明 + + +## 一、前言 + +本文档说明如何在A7670C开发环境中整合BoAT-X-Framework,编译BoAT-X-Framework静态库,以及生成demo程序。 + + +## 二、拷贝文件 + +约定``是A7670C平台SDK的根目录: + +1、拷贝 BoAT代码,将 BoAT-X-Framework 整个文件夹拷贝至``下。 + +2、拷贝并覆盖 `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/A7670CRootDirCode/sc_demo`到``下。 + +3、拷贝并覆盖 `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/A7670CRootDirCode/sc_application.c`到``下。 + +4、拷贝并覆盖 `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/BoAT-X-Framework`到`/BoAT-X-Framework`下。 + +拷贝后的目录和文件结构如下: +``` + +|-- BoAT-X-Framework +|-- config +|-- examples +|-- kernel +|-- sc_lib +|-- script +|-- tools +|-- app_build_doc.md +|-- CMakeLists.txt +|-- makeDepend.mak +|-- Makefile +|-- sc_application.c +`-- sc_demo + |-- inc + | |-- demo_lcd.h + | |-- boat_fabric_demo.h + |-- src + | |-- token + | |-- utils + | |-- cus_uart.c + | |-- cus_urc.c + | |-- cus_usb_vcom.c + | |-- demo_app_download.c + | |-- demo_app_updater.c + | |-- demo_audio.c + | |-- demo_auto_mqtt.c + | |-- demo_ble.c + | |-- demo_call.c + | |-- demo_cam.c + | |-- demo_file_system.c + | |-- demo_flash.c + | |-- demo_fota.c + | |-- demo_ftps.c + | |-- demo_ftps_test.c + | |-- demo_gpio.c + | |-- demo_gps.c + | |-- demo_helloworld.c + | |-- demo_htp.c + | |-- demo_https.c + | |-- demo_i2c.c + | |-- demo_lcd.c + | |-- demo_mqtt.c + | |-- demo_network.c + | |-- demo_ntp.c + | |-- boat_fabric_demo.c + | |-- demo_pm.c + | |-- demo_poc.c + | |-- demo_pwm.c + | |-- demo_simcard.c + | |-- demo_sms.c + | |-- demo_spi.c + | |-- demo_ssl.c + | |-- demo_ssl_test.c + | |-- demo_tcpip.c + | |-- demo_uart.c + | |-- demo_wifi.c + | |-- mqtt_OneNET.c + | |-- mqtt_tencent.c + | |-- simcom_demo.c + |-- CMakeLists.txt +``` + + +## 三、文件修改 + +### 1、添加BoAT-X-Framework生成的静态库.a文件到A7670C平台 + + 打开`/CMakeLists.txt`文件。 + + 首先找到 + ``` + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/sc_lib/${SCMODULE}/lib/libsc_lib.a" + ) + endif() + endif() + ``` + 然后在下方添加以下内容: + ``` + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/BoAT-X-Framework/lib/libboatwallet.a" + ) + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/BoAT-X-Framework/lib/libboatvendor.a" + ) + ``` + +### 2、添加BoAT-X-Framework有关头文件路径到A7670C平台 + + 打开`/sc_demo/CMakeLists.txt`文件。 + + 首先找到 `${CMAKE_SOURCE_DIR}/sc_demo/inc`,然后在下方添加以下内容: + ``` + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/include + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/include/protocolapi + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/vendor/platform/include + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/sdk/network/hlfabric + ``` + + +## 四、编译BoAT-X-Framework静态库 + +### 1、在Cygwin环境下编译BoAT-X-Framework静态库.a文件 + + #### a、修改BoAT-X-Framework/Makefile中的target + ``` + PLATFORM_TARGET ?= Simcom-A7670C + ``` + + #### b、打开Cygwin终端进入BoAT-X-Framework目录编译BoAT静态库 + ``` + cd /BoAT-X-Framework + ../tools/win32/GNUmake.exe clean + ../tools/win32/GNUmake.exe all + ``` + + 编译成功后,在BoAT-X-Framework/lib下会生成静态库`libboatvendor.a`、`libboatwallet.a`。 + + +### 2、编译A7670C演示demo程序,生成.zip下载文件 + + 通过BoAT-X-Framework访问区块链的演示代码,在`/sc_demo/src/boat_fabric_demo.c`。 + + 打开windows终端进入`` + ``` + cd + make clean + make A7670C_LANS + ``` + + 编译成功会在`/out`下生成`A7670C_LANS.zip`下载文件。 \ No newline at end of file diff --git a/vendor/platform/Simcom-A7670C/BoatFabricDemo/README_en.md b/vendor/platform/Simcom-A7670C/BoatFabricDemo/README_en.md new file mode 100644 index 000000000..abec37539 --- /dev/null +++ b/vendor/platform/Simcom-A7670C/BoatFabricDemo/README_en.md @@ -0,0 +1,155 @@ +# BoAT-X Framework for Simcom A7670C Integration Guideline + + +## About This Guideline + +This guide describes how to integrate BoAT-X Framework source code into A7670C SDK, compile BoAT-X Framework static library and build the demo program under Windows environment. + + +## Copy files + +Assuming `` to be the root directory of A7670C SDK: + +1. Copy the entire BoAT-X-Framework directory into `/app`. + +2. Copy `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/A7670CRootDirCode/sc_demo` into ``. + +3. Copy `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/A7670CRootDirCode/sc_application.c` into ``. + +4. Copy `BoAT-X-Framework/vendor/platform/Simcom-A7670C/BoatFabricDemo/BoAT-X-Framework` into `/BoAT-X-Framework`. + + +After these files copied, the directory structure should look like: +``` + +|-- BoAT-X-Framework +|-- config +|-- examples +|-- kernel +|-- sc_lib +|-- script +|-- tools +|-- app_build_doc.md +|-- CMakeLists.txt +|-- makeDepend.mak +|-- Makefile +|-- sc_application.c +`-- sc_demo + |-- inc + | |-- demo_lcd.h + | |-- boat_fabric_demo.h + |-- src + | |-- token + | |-- utils + | |-- cus_uart.c + | |-- cus_urc.c + | |-- cus_usb_vcom.c + | |-- demo_app_download.c + | |-- demo_app_updater.c + | |-- demo_audio.c + | |-- demo_auto_mqtt.c + | |-- demo_ble.c + | |-- demo_call.c + | |-- demo_cam.c + | |-- demo_file_system.c + | |-- demo_flash.c + | |-- demo_fota.c + | |-- demo_ftps.c + | |-- demo_ftps_test.c + | |-- demo_gpio.c + | |-- demo_gps.c + | |-- demo_helloworld.c + | |-- demo_htp.c + | |-- demo_https.c + | |-- demo_i2c.c + | |-- demo_lcd.c + | |-- demo_mqtt.c + | |-- demo_network.c + | |-- demo_ntp.c + | |-- boat_fabric_demo.c + | |-- demo_pm.c + | |-- demo_poc.c + | |-- demo_pwm.c + | |-- demo_simcard.c + | |-- demo_sms.c + | |-- demo_spi.c + | |-- demo_ssl.c + | |-- demo_ssl_test.c + | |-- demo_tcpip.c + | |-- demo_uart.c + | |-- demo_wifi.c + | |-- mqtt_OneNET.c + | |-- mqtt_tencent.c + | |-- simcom_demo.c + |-- CMakeLists.txt +``` + + +## File Modification + +### 1. Add BoAT-X-Framework static libraries .a files onto A7670C platform + + Open `/CMakeLists.txt`. + + Find + ``` + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/sc_lib/${SCMODULE}/lib/libsc_lib.a" + ) + endif() + endif() + ``` + add the following content in the last new line: + ``` + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/BoAT-X-Framework/lib/libboatwallet.a" + ) + set_property(TARGET third_libs APPEND PROPERTY IMPORTED_OBJECTS + "${CMAKE_SOURCE_DIR}/BoAT-X-Framework/lib/libboatvendor.a" + ) + ``` + +### 2. Add the BoAT-X-Framework header files + + Open `/sc_demo/CMakeLists.txt`. + + Find `${CMAKE_SOURCE_DIR}/sc_demo/inc`, add the following content in the last new line: + ``` + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/include + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/include/protocolapi + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/vendor/platform/include + ${CMAKE_SOURCE_DIR}/BoAT-X-Framework/sdk/network/hlfabric + ``` + + +## Compile BoAT-X-Framework Static library + +### 1. Compile BoAT-X Framework static library (under Cygwin) + + #### a. Configure the target platform in directory BoAT-X-Framework/Makefile + ``` + PLATFORM_TARGET ?= Simcom-A7670C + ``` + + #### b. Open a Cygwin shell, enter /BoAT-X-Framework directory and compile BoAT static library + ``` + cd /BoAT-X-Framework + ../tools/win32/GNUmake.exe clean + ../tools/win32/GNUmake.exe all + ``` + + After compiling, static library `libboatvendor.a` and `libboatwallet.a` will be created in `/BoAT-X-Framework/lib` directory. + + +### 2. Build demo program, generate .zip file for download + + Demo code for accessing blockchain through BoAT-X Framework is in `/sc_demo/src/boat_fabric_demo.c`。 + + Open a Windows cmd window and build the download file: + ``` + cd + make clean + make A7670C_LANS + ``` + + The download file `A7670C_LANS.zip` will be generated under `/out` once compiled successfully. \ No newline at end of file