WICED 开发 Redbear Duo

使用 WICED SDK 开发 Redbear Duo

花了三天时间琢磨这个WICED,终于理清了头绪,网上资料太少,还得要从 SDK 文档入手。原来2016年4月博通将 IOT 业务卖给了 Cypress (赛普拉斯),这个WICED以前是博通的,感觉用的人还是很少,而且用的 RTOS 居然是 ThreadX ,好像很小众的样子,不过居然美国宇航局的太空撞击器就是跑到这个系统,好吧你牛X!

编译程序

参考 RedBear 官方文档FW_Make ,示例如下:

./make redbear.rgb-RB_DUO

下载编译的固件(firmware)

mem_map

由上图得到到Duo 下载使用如下指令:

dfu-util -d 2b04:d058 -a 0 -s 0x80C0000 -D rgb-RB_DUO.bin

WICED_SDK/apps 中有很多实例,具体可以查看里面的 Readme.txt 文档,里面有说 apps/snip 文件夹中多是各种 WICED API 实例。首先从 scan 开始入手,用于扫描可用的路由,代码如下:

make snip.scan-RB_DUO

可能这个 make 工具是定制的??? 编译的信息很详细了,总之,很高大上。显示如下:

MAKEFILE MAKECMDGOALS=snip.scan-RB_DUO OTA2_SUPPORT is disabled
Making config file for first time
+-----------------------------------------------------------------------------------------------------+ 
| IMPORTANT NOTES                                                                                     | 
+-----------------------------------------------------------------------------------------------------+ 
| Wi-Fi MAC Address                                                                                   | 
|    The target Wi-Fi MAC address is defined in <WICED-SDK>/generated_mac_address.txt                 | 
|    Ensure each target device has a unique address.                                                  | 
+-----------------------------------------------------------------------------------------------------+ 
| MCU & Wi-Fi Power Save                                                                              | 
|    It is *critical* that applications using WICED Powersave API functions connect an accurate 32kHz | 
|    reference clock to the sleep clock input pin of the WLAN chip. Please read the WICED Powersave   | 
|    Application Note located in the documentation directory if you plan to use powersave features.   | 
+-----------------------------------------------------------------------------------------------------+ 
+-----------------------------------------------------------------------------------------------------+ 
| IMPORTANT NOTES                                                                                     | 
+-----------------------------------------------------------------------------------------------------+ 
| Wi-Fi MAC Address                                                                                   | 
|    The target Wi-Fi MAC address is defined in <WICED-SDK>/generated_mac_address.txt                 | 
|    Ensure each target device has a unique address.                                                  | 
+-----------------------------------------------------------------------------------------------------+ 
| MCU & Wi-Fi Power Save                                                                              | 
|    It is *critical* that applications using WICED Powersave API functions connect an accurate 32kHz | 
|    reference clock to the sleep clock input pin of the WLAN chip. Please read the WICED Powersave   | 
|    Application Note located in the documentation directory if you plan to use powersave features.   | 
+-----------------------------------------------------------------------------------------------------+ 
MAKEFILE MAKECMDGOALS=snip.scan-RB_DUO OTA2_SUPPORT is disabled
Building Bootloader
Finished Building Bootloader

Creating security credentials
Processing resources
Making DCT image
Compiling App_Scan 
Compiling Platform_RB_DUO 
Compiling WICED 
Compiling Lib_SPI_Flash_Library_RB_DUO 
Compiling Lib_GPIO_button 
Compiling WWD_ThreadX_Interface 
Compiling WICED_ThreadX_Interface 
Compiling WWD_for_SDIO_ThreadX 
Compiling Supplicant_BESL 
Compiling Lib_DNS 
Compiling NetX_Duo 
Compiling Lib_Wiced_RO_FS 
Compiling STM32F2xx 
Compiling Lib_TLV 
Compiling Lib_base64 
Compiling Lib_Linked_List 
Compiling Lib_crypto_open 
Compiling Lib_micro_ecc 
Compiling WWD_NetX_Duo_Interface 
Compiling WICED_NetX_Duo_Interface 
Compiling common_GCC 
Compiling STM32F2xx_Peripheral_Drivers 
Compiling Lib_Ring_Buffer 
Compiling Lib_crc 
Compiling Lib_DHCP_Server 
Compiling STM32F2xx_Peripheral_Libraries 
Making build/snip.scan-RB_DUO/libraries/App_Scan.a
Making build/snip.scan-RB_DUO/libraries/Platform_RB_DUO.a
Making build/snip.scan-RB_DUO/libraries/WICED.a
Making build/snip.scan-RB_DUO/libraries/Lib_SPI_Flash_Library_RB_DUO.a
Making build/snip.scan-RB_DUO/libraries/Lib_GPIO_button.a
Making build/snip.scan-RB_DUO/libraries/WWD_ThreadX_Interface.a
Making build/snip.scan-RB_DUO/libraries/WICED_ThreadX_Interface.a
Making build/snip.scan-RB_DUO/libraries/WWD_for_SDIO_ThreadX.a
Making build/snip.scan-RB_DUO/libraries/Supplicant_BESL.a
Making build/snip.scan-RB_DUO/libraries/Lib_DNS.a
Making build/snip.scan-RB_DUO/libraries/NetX_Duo.a
Making build/snip.scan-RB_DUO/libraries/Lib_Wiced_RO_FS.a
Making build/snip.scan-RB_DUO/libraries/STM32F2xx.a
Making build/snip.scan-RB_DUO/libraries/Lib_TLV.a
Making build/snip.scan-RB_DUO/libraries/Lib_base64.a
Making build/snip.scan-RB_DUO/libraries/Lib_Linked_List.a
Making build/snip.scan-RB_DUO/libraries/Lib_crypto_open.a
Making build/snip.scan-RB_DUO/libraries/Lib_micro_ecc.a
Making build/snip.scan-RB_DUO/libraries/WWD_NetX_Duo_Interface.a
Making build/snip.scan-RB_DUO/libraries/WICED_NetX_Duo_Interface.a
Making build/snip.scan-RB_DUO/libraries/common_GCC.a
Making build/snip.scan-RB_DUO/libraries/STM32F2xx_Peripheral_Drivers.a
Making build/snip.scan-RB_DUO/libraries/Lib_Ring_Buffer.a
Making build/snip.scan-RB_DUO/libraries/Lib_crc.a
Making build/snip.scan-RB_DUO/libraries/Lib_DHCP_Server.a
Making build/snip.scan-RB_DUO/libraries/STM32F2xx_Peripheral_Libraries.a
Making snip.scan-RB_DUO.elf

Making snip.scan-RB_DUO.bin
snip.scan-RB_DUO
----------------------------------|---------|---------|
                                  |         |  Static |
              Module              |  Flash  |   RAM   |
----------------------------------+---------+---------|
App                               |     404 |       0 |
crc                               |    1060 |       0 |
Host MCU-family library           |   12987 |    2485 |
Interrupt Vectors                 |     388 |       0 |
libc                              |   23557 |    3064 |
Networking                        |     989 |    8523 |
NetX-Duo - Interfaces & Stacks    |       0 |      16 |
Other                             |    3678 |      92 |
Packet Buffers                    |       0 |   23086 |
platform                          |    1252 |     264 |
RAM Initialisation                |    2340 |       0 |
resources                         |      16 |       0 |
Ring_Buffer                       |     116 |       0 |
Startup Stack & Link Script fill  |       9 |       3 |
ThreadX                           |    7872 |     396 |
TLV                               |      28 |       0 |
Wi-Fi Firmware                    |  382736 |       0 |
WICED                             |    3857 |     976 |
WWD                               |   15439 |    3071 |
----------------------------------+---------+---------|
TOTAL (bytes)                     |  454388 |   41976 |
----------------------------------|---------|---------|

Merge all bin files into a single bin for MSD upload
build\waf.bootloader-NoOS-RB_DUO\binary\waf.bootloader-NoOS-RB_DUO_PAD.bin
build\snip.scan-RB_DUO\DCT.bin_PAD.bin
build\snip.scan-RB_DUO\binary\snip.scan-RB_DUO.bin
已复制         1 个文件。
Location: build/snip.scan-RB_DUO/binary/snip.scan-RB_DUO.bin_MSD.bin
Build complete
Making .gdbinit

接下来就是下载固件了,指令如下:

dfu-util -d 2b04:d058 -a 0 -s 0x800C000 -D build/snip.scan-RB_DUO/binary/snip.scan-RB_DUO.bin

DFU-util 下载程序的过程也是帅到没有朋友,在命令行的世界就是干净利落,如下:

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 2b04:d058
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x0800c000, size = 456740
Download    [=========================] 100%       456740 bytes
Download done.
File downloaded successfully
Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!

猜你喜欢

转载自blog.csdn.net/ymsunshine/article/details/53967903