玩转涂鸦:win10下下载开发框架既固件试烧录

接上篇我们已经完成到了环境的搭建,并安装了IDE,本节我们下载开发框架,烧录固件。

一、下载开发框架

在vscode平台下登陆了TuyaWindIDE后,出现如下的窗口,接着我们一步一步叙述。
在这里插入图片描述如果有开发框架请打开,若没有,点击新建开发框架,
在这里插入图片描述名词解释
开发模式:

  • TuyaOS 模式:涂鸦已经对芯片平台进行过适配,您直接基于开发包开发应用功能即可。
  • SDK 模式:涂鸦提供按照 TuyaOS Kernel 标准导入的基础 SDK,您先完成芯片平台的接口适配,再开发应用功能
    类型开发包:按照开发框架的分类以及开发包的类型不同,可选择不同的开发包。
    开发平台:开发框架对应的硬件支持选择,按照处理器类型、厂商、分类、芯片型号依次选择当前开发框架所需要的硬件支持。支持的芯片和工具链。
    TuyaOS版本:使用如下格式xx.xx.xx。如01.01.00
    本地项目名称:本地项目自定义名称。
    位置:使用默认下载位置或自定义下载位置。说明:使用自定义下载目录时,需要确保在该目录有写入权限,不然会下载失败。
    在这里插入图片描述每点击一个选项,右侧有说明。
    类型开发包:选择:子设备开发/蓝牙 Mesh 设备开发包
    开发平台:选择 wireless SoC/PhyPlus/Bluetooth /PHY6222
    在这里插入图片描述

点击完成开始下载,下载完成后如下界面
在这里插入图片描述

二、创建、编译和烧录固件

创建项目

展开software/TuyaOS/apps,鼠标右击apps目录,选择Create Project,输入项目名称,如下所示。
在这里插入图片描述

编译固件

展开左侧 software/TuyaOS/apps/tuyaos_demo_mesh_node(自己的项目) 目录,并在右键单击tuyaos_demo_mesh_node 目录后选择 Build Project
在这里插入图片描述
选择编译后,出现如下错误及警告信息:

点击展开代码

PS C:\Users\jock\Documents\tuya\Projects\PHY6222_TuyaOS-3.9.0\software\TuyaOS> cd 'c:\Users\jock\Doc
uments\tuya\Projects\PHY6222_TuyaOS-3.9.0\software\TuyaOS\'
PS C:\Users\jock\Documents\tuya\Projects\PHY6222_TuyaOS-3.9.0\software\TuyaOS> & python.exe .\build_
app.py apps\tuyaos_demo_mesh_node tuyaos_demo_mesh_node 1.0
4
DEMO_PATH: apps/tuyaos_demo_mesh_node
DEMO_NAME: tuyaos_demo_mesh_node
DEMO_FIRMWARE_VERSION: 1.0
BOARD_NAME: phy6222_smesh
SUPPORT_BOARDS: []
BUILD_COMMAND: build
build-pre...
windows

SYN app TEMPLATE------------------------
Compare Some Files With Template:
>> ['.gitignore', 'build_app.py', 'build_app.sh', 'ci_autobuild.sh', 'ci_autopack.sh', 'gitx.sh', 'p
repare.sh']
-> [Y] .gitignore is same
-> [Y] build_app.py is same
-> [Y] build_app.sh is same
-> [Y] ci_autobuild.sh is same
-> [Y] ci_autopack.sh is same
-> [Y] gitx.sh is same
-> [Y] prepare.sh is same

Change URL:------------------------

MY KCONFIG------------------------
INPUT:
    -------------------------------------
    project_path:     ./
    app_path:         apps/tuyaos_demo_mesh_node
    auto:             1
    -------------------------------------

    > Check ./apps/tuyaos_demo_mesh_node/tuya_iot.config exists
    > Copy ./apps/tuyaos_demo_mesh_node/tuya_iot.config To ./build/tuya_iot.config
    > Create HEAD_FILE = ./apps/tuyaos_demo_mesh_node/app_config.h

INPUT:
    -------------------------------------
    project_path:     C:/Users/jock/Documents/tuya/Projects/PHY6222_TuyaOS-3.9.0/software/TuyaOS
    app_path:         apps/tuyaos_demo_mesh_node
    vendor_name:      phy6222_smesh
    output_path:      _output
    firmware_name:    tuyaos_demo_mesh_node
    firmware_version: 1.0
    -------------------------------------

CREATE:
    -> apps/apps/tuyaos_demo_mesh_node
    -> components
        -> app_tuya_driver
        -> tal_driver
        -> tal_gpio_test
        -> tal_oled
        -> tal_security
        -> tal_system
        -> tal_utc
        -> tal_util
    -> app libs
    -> libs
    -> include
    -> adapter
    -> vendor/phy6222_smesh/tkl
        -> drivers
        -> system
        -> utilities
        -> bluetooth
        -> zigbee
        -> security
        -> include
    -> output
    -> vendor/phy6222_smesh/sdk
    -> tool

WRITE TO FILE...
build...
windows

SYN app TEMPLATE------------------------
Compare Some Files With Template:
>> ['.gitignore', 'build_app.py', 'build_app.sh', 'ci_autobuild.sh', 'ci_autopack.sh', 'gitx.sh', 'p
repare.sh']
-> [Y] .gitignore is same
-> [Y] build_app.py is same
-> [Y] build_app.sh is same
-> [Y] ci_autobuild.sh is same
-> [Y] ci_autopack.sh is same
-> [Y] gitx.sh is same
-> [Y] prepare.sh is same

Change URL:------------------------
./project.json

MAKE
> clean .log
> copy json_file to .log
#1. fill the output dict
#2. fill the cmd dict
#3. fill flash cmd dict
#4. fill the src dict
#5. get var map
> AFTER MAKE CALL VENDOR PYTHON SCRIPTS...

BUILD
> [cmd]:UV4.exe -j0 -b ./.log/Demo.uvprojx  -o Demo.log
> wait about 2 min ...
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Target 1'
compiling tal_pwm.c...
compiling tal_gpio.c...
compiling tal_i2c.c...
compiling tal_spi.c...
compiling tal_adc.c...
compiling app_common.c...
../apps/tuyaos_demo_mesh_node/src/app_common.c(440): warning:  #223-D: function "tkl_mesh_network_tr
ansmit_set" declared implicitly
              tkl_mesh_network_transmit_set(7, 0);
../apps/tuyaos_demo_mesh_node/src/app_common.c(441): warning:  #223-D: function "tkl_mesh_network_re
lay_retransmit_set" declared implicitly
              tkl_mesh_network_relay_retransmit_set(4, 0);
../apps/tuyaos_demo_mesh_node/src/app_common.c(53): warning:  #177-D: variable "app_mdev_test_timer_
id"  was declared but never referenced
  STATIC TIMER_ID app_mdev_test_timer_id = NULL;
../apps/tuyaos_demo_mesh_node/src/app_common.c(56): warning:  #550-D: variable "mode"  was set but n
ever used
  STATIC UINT8_T mode  = 0;
../apps/tuyaos_demo_mesh_node/src/app_common.c: 4 warnings, 0 errors
compiling tal_flash.c...
compiling tal_rtc.c...
compiling tuya_mesh_sdk_test.c...
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(760): warning:  #188-D: enumerated type mixed
 with another type
              tal_spi_deinit(channel);
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(768): warning:  #188-D: enumerated type mixed
 with another type
              ret = tal_spi_init(channel, &spi_cfg);
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(772): warning:  #188-D: enumerated type mixed
 with another type
                      ret = tal_spi_xfer(channel, spi_data, buf, spi_data_len);
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(985): warning:  #188-D: enumerated type mixed
 with another type
                  param.wakeup_para.gpio_param.gpio_num = cmd_data[1];
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(986): warning:  #188-D: enumerated type mixed
 with another type
                  param.wakeup_para.gpio_param.level = cmd_data[2];
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(990): warning:  #188-D: enumerated type mixed
 with another type
                  param.wakeup_para.timer_param.timer_num = cmd_data[1];
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c(991): warning:  #188-D: enumerated type mixed
 with another type
                  param.wakeup_para.timer_param.mode = cmd_data[2];
../apps/tuyaos_demo_mesh_node/src/tuya_mesh_sdk_test.c: 7 warnings, 0 errors
compiling tal_watchdog.c...
compiling tal_uart.c...
compiling tal_gpio_test.c...
compiling mbedtls_x509.c...
compiling mbedtls_asymmetrical.c...
../components/tal_security/src/mbedtls_asymmetrical.c(44): warning:  #1-D: last line of file ends wi
thout a newline
  #endif
../components/tal_security/src/mbedtls_asymmetrical.c: 1 warning, 0 errors
compiling mbedtls_symmetry.c...
../components/tal_security/src/mbedtls_symmetry.c(210): warning:  #1-D: last line of file ends witho
ut a newline
  #endif
../components/tal_security/src/mbedtls_symmetry.c: 1 warning, 0 errors
compiling mbedtls_hash.c...
../components/tal_security/src/mbedtls_hash.c(381): warning:  #1-D: last line of file ends without a
 newline
  #endif
../components/tal_security/src/mbedtls_hash.c: 1 warning, 0 errors
compiling tal_oled.c...
compiling tal_asymmetrical.c...
compiling tal_hash.c...
../components/tal_security/src/tal_hash.c(1048): warning:  #1-D: last line of file ends without a ne
wline
  #endif
../components/tal_security/src/tal_hash.c: 1 warning, 0 errors
compiling tal_x509.c...
compiling tal_ota.c...
compiling tal_sleep.c...
compiling tal_memory.c...
compiling tal_symmetry.c...
../components/tal_security/src/tal_symmetry.c(893): warning:  #1-D: last line of file ends without a
 newline
  #endif
../components/tal_security/src/tal_symmetry.c: 1 warning, 0 errors
compiling tal_log.c...
compiling tal_sw_timer.c...
compiling tal_system.c...
compiling tal_utc.c...
compiling tkl_flash.c...
compiling tkl_adc.c...
compiling tkl_gpio.c...
compiling tkl_i2c.c...
compiling tkl_rtc.c...
compiling tkl_pwm.c...
compiling tal_util.c...
compiling tkl_memory.c...
compiling tkl_mutex.c...
compiling tkl_ota.c...
compiling tkl_watchdog.c...
compiling tkl_spi.c...
compiling tkl_timer.c...
compiling tkl_uart.c...
compiling tkl_output.c...
compiling tuya_list.c...
compiling tuya_queue.c...
compiling tuya_mem_heap.c...
compiling tuya_ringbuf.c...
compiling tkl_sleep.c...
compiling tkl_system.c...
compiling tuya_tools.c...
../vendor/phy6222_smesh/tuyaos/utilities/tuya_tools.c(59): warning:  #1293-D: assignment in conditio
n
      while(!(ret  =  *(UCHAR_T *)src - *(UCHAR_T *)dst) && *dst) {
../vendor/phy6222_smesh/tuyaos/utilities/tuya_tools.c: 1 warning, 0 errors
compiling tkl_wakeup.c...
compiling tkl_asymmetrical.c...
compiling tkl_hash.c...
compiling tkl_symmetry.c...
compiling pwm.c...
compiling flash.c...
compiling tkl_bluetooth_mesh_device.c...
compiling tkl_bluetooth.c...
compiling clock.c...
compiling main.c...
compiling crc16.c...
compiling my_printf.c...
compiling uart.c...
compiling pwrmgr.c...
compiling gpio.c...
compiling timer.c...
compiling watchdog.c...
compiling adc.c...
compiling spi.c...
compiling i2c.c...
compiling devinfoservice.c...
compiling mbedtls_md5.c...
compiling mbedtls_aes.c...
compiling gap.c...
compiling gattservapp.c...
compiling gapgattserver.c...
compiling observer.c...
compiling central.c...
compiling jump_table.c...
compiling bleMesh_Main.c...
compiling osal_snv.c...
compiling gapbondmgr.c...
compiling led_light.c...
compiling OSAL_bleMesh.c...
compiling aes.c...
compiling EM_platform.c...
compiling bleMesh.c...
compiling sha256.c...
compiling EM_debug.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/osal/src/phyos/EM_debug.c(22): warning:
  #550-D: variable "em_runtime_debug_level"  was set but never used
      DECL_STATIC UCHAR em_runtime_debug_level;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/osal/src/phyos/EM_debug.c: 1 warning, 0
 errors
compiling EM_os.c...
compiling cli_model.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/climodel/cli_model.c(460):
warning:  #550-D: variable "group"  was set but never used
      UINT16  group;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/climodel/cli_model.c: 1 war
ning, 0 errors
compiling EM_timer.c...
compiling aes-ccm.c...
compiling blebrr_gatt.c...
compiling MS_common_pl.c...
compiling prov_pl.c...
compiling cry.c...
compiling blebrr_pl.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_main.h(33): warni
ng:  #64-D: declaration does not declare anything
  void appl_dump_bytes(UCHAR* buffer, UINT16 length);
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/platforms/mesh/blebrr_pl.c: 1 warning,
0 errors
compiling mesh_services.c...
compiling blebrr.c...
compiling model_state_handler_pl.c...
compiling appl_prov.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_main.h(33): warni
ng:  #64-D: declaration does not declare anything
  void appl_dump_bytes(UCHAR* buffer, UINT16 length);
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(274): warn
ing:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(571): warn
ing:  #550-D: variable "T1"  was set but never used
                      UINT32  T1, T2;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(571): warn
ing:  #550-D: variable "T2"  was set but never used
                      UINT32  T1, T2;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(531): warn
ing:  #550-D: variable "T1"  was set but never used
          UINT32  T1, T2;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(531): warn
ing:  #550-D: variable "T2"  was set but never used
          UINT32  T1, T2;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(666): warn
ing:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(958): warn
ing:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(1002): war
ning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(1109): war
ning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c(237): warn
ing:  #177-D: variable "main_prov_options"  was declared but never referenced
  DECL_STATIC const char main_prov_options[] = "\n\
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/ethermind/mesh/export/appl/appl_prov.c: 11 warnin
gs, 0 errors
compiling MS_limit_config.c...
compiling tuyamodel_server.c...
compiling access_ps.c...
compiling EXT_cbtimer.c...
compiling cliface.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/libraries/cli/cliface.c(57): warning:  #177-D: va
riable "p_ctx"  was declared but never referenced
      cli_ctx_t* p_ctx = & g_cli_ctx;
../vendor/phy6222_smesh/sdk/phy6222_sdk/components/libraries/cli/cliface.c: 1 warning, 0 errors
compiling generic_onoff_server_model.c...
compiling tuya_mesh_model_app.c...
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(16): warning:  #64-D: declaration does not declare anything
  void appl_dump_bytes(UCHAR* buffer, UINT16 length);
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(427): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(614): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(632): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(650): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(699): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(786): warning:  #550-D: variable "retval"  was set but never used
      API_RESULT retval;
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c(1135): warning:  #550-D: parameter "retval"  was set but never used
      /* IN */ API_RESULT                retval,
../vendor/phy6222_smesh/sdk/phy6222_sdk/example/ble_mesh/mesh_light/source/bleMesh/tuya_mesh_model_a
pp.c: 8 warnings, 0 errors
compiling light_ctl_server_model.c...
compiling light_ctl_temp_server_model.c...
compiling light_hsl_server_model.c...
assembling startup_ARMCM0.s...
compiling light_lightness_server_model.c...
compiling scene_server_model.c...
compiling system_ARMCM0.c...
compiling tuya_vendor_server_model.c...
compiling ty_gatt_ota.c...
linking...
.\Objects\Demo.axf: error: L6050U: The code size of this image (150048 bytes) exceeds the maximum al
lowed for this version of the linker.
Finished: 0 information, 0 warning, 0 error and 1 fatal error messages.
".\Objects\Demo.axf" - 1 Error(s), 40 Warning(s).
> build end, create final fw...
Target not created.
Build Time Elapsed:  00:00:10
copy ./.log/Objects/Demo_phy6222.hex16.bin -> UG
> build fail

经查询,主要错误有1处,其他的均为警告,我们可以不用管,优化时再处理即可:

.\Objects\Demo.axf: error: L6050U: The code size of this image (150048 bytes) exceeds the maximum allowed for this version of the linker.

因为我使用的Keil MDK-Lite是免费版, 对 ARM Cortex-M 系列芯片有代码大小限制(Cortex-M0/M0 + 芯片限制为128KB,我的编译结果是 150048 字节≈146KB,已超出限制)。
涂鸦 OS(TuyaOS)的 Mesh 节点 Demo(tuyaos_demo_mesh_node)包含蓝牙 Mesh 协议栈、TuyaOS 核心组件、驱动等模块,代码量较大,免费版 Keil 无法满足链接需求。
接着我们测试其他的试试。

很显然,我们

编译失败了,于是我们下一篇从官网的说明出发,烧录官方的示例文件。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值