[bsp][amebaz]支持IAR工程及smartconfig配网

This commit is contained in:
tyx 2018-10-25 16:36:46 +08:00
parent fbaa86933d
commit 135ec47a6a
30 changed files with 12344 additions and 134 deletions

View File

@ -19,7 +19,7 @@ CONFIG_RT_IDEL_HOOK_LIST_SIZE=4
CONFIG_IDLE_THREAD_STACK_SIZE=256
CONFIG_RT_USING_TIMER_SOFT=y
CONFIG_RT_TIMER_THREAD_PRIO=4
CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024
CONFIG_RT_DEBUG=y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
# CONFIG_RT_DEBUG_THREAD_CONFIG is not set
@ -229,7 +229,10 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
# AT commands
#
# CONFIG_RT_USING_AT is not set
# CONFIG_LWIP_USING_DHCPD is not set
CONFIG_LWIP_USING_DHCPD=y
CONFIG_DHCPD_SERVER_IP="192.168.169.1"
CONFIG_DHCPD_USING_ROUTER=y
# CONFIG_LWIP_USING_CUSTOMER_DNS_SERVER is not set
#
# VBUS(Virtual Software BUS)
@ -408,5 +411,10 @@ CONFIG_PKG_REALTEK_AMEBA_VER="latest"
# CONFIG_SYS_AUTO_UPDATE_PKGS is not set
# CONFIG_SYS_CREATE_MDK_IAR_PROJECT is not set
# CONFIG_SYS_PKGS_DOWNLOAD_ACCELERATE is not set
#
# External Libraries
#
CONFIG_RT_USING_SMARTCONFIG_LIB=y
# CONFIG_BSP_USING_UART0 is not set
CONFIG_BSP_USING_WIFI=y

View File

@ -26,6 +26,7 @@ config $ENV_DIR
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
source "$ENV_DIR/tools/scripts/cmds/Kconfig"
source "$BSP_DIR/libraries/Kconfig"
source "$BSP_DIR/drivers/Kconfig"
select PKG_USING_REALTEK_AMEBA

View File

@ -1,9 +1,8 @@
# amebaz on RT-Thread
## 1. 简介
## 1 简介
amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
包括如下硬件特性:
amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片属于rtl8710b系列。硬件特性如下
| 硬件 | 描述 |
| -- | -- |
@ -11,8 +10,7 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
|CPU| Cortex-M4 |
|主频| 125MHz |
## 2. 编译说明
## 2 编译说明
| 环境 | 说明 |
| ------------ | ------------------------------------------------------------ |
@ -21,15 +19,33 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
| 构建工具 | scons |
| 依赖软件环境 | Env工具/(IAR或arm-none-eabi-gcc)/git/调试器驱动 |
1) 下载源码
## 3 下载源码
```bash
git clone https://github.com/RT-Thread/rt-thread.git
```
2) 配置工程并准备env
## 4 环境准备
Linux/Mac
### 4.1 Windows 环境准备
Windows环境下有两种开发环境`GCC toolchain` 和 `IAR IDE`,根据不同的需求自行选择。
#### 4.1.1 IAR 发开环境
IAR 开发环境需要开发者自己安装软件安装过程这里就不特别说明了。amebaz工程当前仅支持 `IAR 7.X` 的版本。
#### 4.4.2 GCC 开发环境
GCC开发使用 RT-Thread 官方提供的 env 工具,该工具集成 GCC 工具链,还具有编译构建环境、图形化系统配置及软件包管理功能。
下载地址:[点击下载env工具](https://www.rt-thread.org/page/download.html)
第一次使用env工具的开发者可以去这里查看教程[RT-Thread env 工具用户手册](https://www.rt-thread.org/document/site/rtthread-development-guide/rtthread-tool-manual/env/env-user-manual/)。
### 4.2 Linux/Mac 环境准备
Linux/Mac 仅支持 GCC 工具链。
```bash
cd rt-thread/bsp/amebaz
@ -38,11 +54,17 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
pkgs --upgrade
```
Windows
## 5 配置工程(可选
>在[RT-Thread官网][1]下载ENV工具包并参考官网给出的env使用教
### 5.1 Windows 配置工
3) 配置工程(可选)
配置工程,需要在相应的工程目录下使用 `menuconfig` 命令打开图形界面,开发者根据自己的需求开关功能组件。
```bash
menuconfig
```
### 5.2 Linux/Mac 配置工程
Linux/Mac
@ -50,37 +72,44 @@ amebaz 是由Realtek推出的Cortex-M4内核的WiFi SOC芯片rtl8710b系列
scons --menuconfig
```
Windows(ENV环境中)
## 6 更新软件包
```bash
menuconfig
```
4) 下载package
amebaz配套的驱动库以package形式提供故需先下载对应的package(realtek-ameba)请使用env下载package
amebaz 配套的驱动库以 package 形式提供,故需先下载对应的 package(realtek-ameba),在工程目录下,使用下面命令下载软件包。
```bash
pkgs --update
```
*该板级支持包不支持生成mdk的工程及iar工程后续会支持iar工程
## 7 编译
5) 编译
### 7.1 Windows 编译工程
Windows可以使用env编译工程无需设置GCC工具链路径直接在bsp/amebaz工程目录下编译即可。
#### 7.1.1 IAR 编译工程
Linux/Mac arm-none-eabi-gcc
使用以下指令设置gcc路径
先打开工程目录下的IAR工程project.eww然后单击 Project 选项卡,单击 Rebuild All 选项,进行编译
![ ](figures/iar_build.png)
#### 7.1.2 GCC 编译工程
可以使用env编译工程无需设置GCC工具链路径直接在 rt-thread/bsp/amebaz 工程目录下输入 `scons` 编译即可。编译完成后,在工程目录下生成 `image2_all_ota1.bin` 文件。
```bash
scons
```
### 7.2 Linux/Mac 编译工程
如果没有配置GCC路径的环境变量则需要使用以下指令设置gcc路径。
```bash
export RTT_EXEC_PATH=[GCC路径]
```
编译WindowsLinux/Mac arm-none-eabi-gcc
设置 GCC 路径后,使用 `scons` 编译工程。
```bash
scons -j4
scons
```
出现下列信息即为编译成功
@ -109,35 +138,75 @@ Done...
scons: done building targets.
```
如果编译正确无误,会产生image2_all_ota1.bin文件。
如果编译正确无误,会在工程目录下生成 image2_all_ota1.bin 文件。
## 3. 烧写及执行
## 8 烧写及执行
烧写可以使用仿真器 串口等多种方式 此处不再赘述
### 8.1 IAR下载
### 3.1 运行结果
下载程序分为两部分:
如果编译 & 烧写无误,会在专用日志串口*上看到RT-Thread的启动logo信息
a先使用jlink工具正确连接A14(CLK),A15(TMS),GND,VCC引脚
b打开 IAR 工程并完成编译后,单击 Project 选项卡下 Download 选项,选择 Download active application 下载程序。
![IAR下载程序](figures/iar_download.png)
c短按复位按钮连接串口查看调试信息
### 8.2 串口下载
串口下载分为三个步骤
a板子进入下载模式
板子使用 `micros usb` 上电,然后按住 `FLASH` 键不放手,短按 `RST` 键,松开 `RST``FLASH` 键进入下载模式。
b配置下载工具
打开 Image Tool 下载工具配置使用,选择 `micros usb` 所对应的串口端口,选择波特率,默认波特率 1.5Mbps,然后打开串口端口,如下载工具图“①”所示
![串口下载程序](figures/image-tool_v2.2.0.png)
boot选择工程提供的 `boot_all.bin`, OTA1 选择生成的 image2_all_ota1.bin 文件(通常在工程目录下),并且注意在这两个选项前面打勾确认,其他默认即可,如下载工具图“②”。
c下载程序
按下 Download如下载工具图 “③”),即可开始下载程序,并且可以从日志窗口查看到下载信息。
## 9 运行
下载程序后,连接串口(默认使用板子上 `micro usb`),打开串口工具,配置串口波特率 115200数据位 8 位,停止位 1 位,无校验,无流控;短按 `RST` 键复位,串口将输出调试信息,如下所示:
```bash
\ | /
- RT - Thread Operating System
/ | \ 3.0.4 build May 15 2018
/ | \ 3.1.1 build Oct 25 2018
2006 - 2018 Copyright by rt-thread team
msh />
lwIP-2.0.2 initialized!
Initializing WIFI ...
LDO Mode, BD_Info: 0
LDO Mode, BD_Info: 0
WIFI initialized
[I/WIFI] amebaz_wifi_start success
build time: Oct 25 2018 10:52:02
Hello RT-Thread!
[I/WLAN.dev] wlan init success
[I/WLAN.lwip] eth device init ok name:w0
msh >
```
*默认串口
## 10 WIFI简单使用
## 4. WIFI简单使用
### 4.1 wifi扫描命令
### wifi扫描命令
wifi 扫描命令格式如下
```unknown
wifi scan
```bash
wifi scan
```
命令说明
@ -149,8 +218,7 @@ wifi 扫描命令格式如下
在调试工具中输入该命令,即可进行 wifi 命令扫描,调试信息如下
```unknown
```bash
scan ap down
SSID MAC security rssi chn Mbps
------------------------------- ----------------- -------------- ---- --- ----
@ -159,19 +227,16 @@ WQ1 88:25:93:94:51:54 WPA2_AES_PSK -76 13
shyc1 a0:40:a0:a3:e8:c9 WPA2_AES_PSK -77 13 0
KVIP 70:65:82:3b:71:43 WPA2_AES_PSK -83 11 0
YST2016 88:25:93:c6:67:d1 WPA2_TKIP_PSK -84 4 0
```
> 注:
>
> 测试命令有关 wifi,均以wifi开头。
> 注wifi 有关的命令均以wifi开头。
### 4.2 wifi 接入
### wifi 接入
接入 wifi 之前,先介绍一下其接入的命令 ,如下
```unknown
wifi join ssid 123456789
```bash
wifi join ssid 123456789
```
命令说明
@ -185,7 +250,7 @@ YST2016 88:25:93:c6:67:d1 WPA2_TKIP_PSK -84 4
了解上述命令,并且成功完成前面步骤,在串口中输入 `wifi w0 join realthread_VIP 123456789` ,如下日志表示连接成功
```unknown
```bash
WIFI wlan0 Setting:
==============================
@ -200,8 +265,7 @@ WIFI wlan0 Setting:
另外提供一个简单的测试使用命令查询设备IP地址命令ifconfig。
```unknown
```bash
network interface: w0 (Default)
MTU: 1500
MAC: 00 e0 4c d5 ac 46
@ -211,21 +275,16 @@ gw address: 172.16.200.1
net mask : 255.255.255.0
dns server #0: 172.16.200.1
dns server #1: 223.5.5.5
```
## 5. 驱动支持情况及计划
## 驱动支持情况及计划
| 驱动 | 支持情况 | 备注 |
| ---------- | :------: | :--------------------------: |
| UART | 支持 | UART0 |
| WLAN | 部分支持 | 仅支持STA模式 |
## 6. 已知问题
wlan仅支持STA模式连接WIFI输入错误密码时会宕机。
## 7. 联系人信息
## 联系人信息
维护人:
[flyingcys][4] < [flyingcys@163.com][5] >

View File

@ -0,0 +1,146 @@
/*
* File : smartconfig_demo.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2018-09-13 Bernard the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#ifdef RT_USING_SMARTCONFIG_LIB
#include <sys/socket.h>
#include "smartconfig.h"
#define NET_READY_TIME_OUT (rt_tick_from_millisecond(30 * 1000))
static int rt_wlan_device_connetct(char *ssid, char *passwd)
{
int result = RT_EOK;
rt_uint8_t time_cnt = 0;
result = rt_wlan_connect(ssid, passwd);
if (result != RT_EOK)
{
rt_kprintf("\nconnect ssid %s error:%d!\n", ssid, result);
return result;
};
do
{
rt_thread_mdelay(1000);
time_cnt ++;
if (rt_wlan_is_ready())
{
break;
}
}
while (time_cnt <= (NET_READY_TIME_OUT / 1000));
if (time_cnt <= (NET_READY_TIME_OUT / 1000))
{
rt_kprintf("networking ready!\n");
}
else
{
rt_kprintf("wait ip got timeout!\n");
result = -RT_ETIMEOUT;
}
return result;
}
static void airkiss_send_notification(uint8_t random)
{
int sock = -1;
int udpbufsize = 2;
struct sockaddr_in UDPBCAddr, UDPBCServerAddr;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
{
rt_kprintf("notify create socket error!\n");
goto _exit;
}
UDPBCAddr.sin_family = AF_INET;
UDPBCAddr.sin_port = htons(10000);
UDPBCAddr.sin_addr.s_addr = htonl(0xffffffff);
rt_memset(&(UDPBCAddr.sin_zero), 0, sizeof(UDPBCAddr.sin_zero));
UDPBCServerAddr.sin_family = AF_INET;
UDPBCServerAddr.sin_port = htons(10000);
UDPBCServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
rt_memset(&(UDPBCServerAddr.sin_zero), 0, sizeof(UDPBCServerAddr.sin_zero));
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &udpbufsize, sizeof(int)) != 0)
{
rt_kprintf("notify socket setsockopt error\n");
goto _exit;
}
if (bind(sock, (struct sockaddr *)&UDPBCServerAddr, sizeof(UDPBCServerAddr)) != 0)
{
rt_kprintf("notify socket bind error\n");
goto _exit;
}
for (int i = 0; i <= 20; i++)
{
int ret = sendto(sock, (char *)&random, 1, 0, (struct sockaddr *)&UDPBCAddr, sizeof(UDPBCAddr));
rt_thread_delay(10);
}
rt_kprintf("airkiss notification thread exit!\n");
_exit:
if (sock >= 0)
{
closesocket(sock);
}
}
static int smartconfig_result(rt_smartconfig_type result_type, char *ssid, char *passwd, void *userdata, rt_uint8_t userdata_len)
{
rt_uint8_t random = *(rt_uint8_t *)userdata;
rt_kprintf("type:%d\n", result_type);
rt_kprintf("ssid:%s\n", ssid);
rt_kprintf("passwd:%s\n", passwd);
rt_kprintf("user_data:0x%02x\n", random);
if (rt_wlan_device_connetct(ssid, passwd) == RT_EOK)
{
airkiss_send_notification(random);
}
return 0;
}
void smartconfig_demo(void)
{
rt_smartconfig_start(SMARTCONFIG_TYPE_AIRKISS, SMARTCONFIG_ENCRYPT_NONE, RT_NULL, smartconfig_result);
}
#ifdef RT_USING_FINSH
#include "finsh.h"
MSH_CMD_EXPORT(smartconfig_demo, smartconfig demo);
#endif
#endif

View File

@ -12,10 +12,8 @@
* 2009-01-05 Bernard first implementation
* 2018-03-15 flyingcys add amebaz
*/
#include <rtl8710b.h>
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include "board.h"
#include "drv_uart.h"

View File

@ -17,7 +17,17 @@
#ifndef __BOARD_H__
#define __BOARD_H__
#include "rtl8710b.h"
#ifdef _LITTLE_ENDIAN
#undef _LITTLE_ENDIAN
#endif
#ifdef SECTION
#undef SECTION
#endif
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
void rt_hw_board_init(void);

View File

@ -22,11 +22,8 @@
* 2017-05-30 Bernard the first version
* 2018-03-15 flyingcys add amebaz
*/
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <rtl8710b.h>
#include <serial_api.h>
#include "board.h"
#include "drv_uart.h"
@ -37,6 +34,8 @@ struct device_uart
rt_uint32_t irqno;
};
extern int LOGUART_SetBaud(u32 BaudRate);
#ifdef BSP_USING_UART0
static struct rt_serial_device serial0;
static struct device_uart uart0;
@ -64,7 +63,6 @@ const struct rt_uart_ops _uart_ops =
*/
static rt_err_t ameba_uart_configure (struct rt_serial_device *serial, struct serial_configure *cfg)
{
rt_uint32_t baud_div;
struct device_uart * uart;
RT_ASSERT(serial != RT_NULL);

View File

@ -26,9 +26,6 @@
#ifndef __DRV_UART_H__
#define __DRV_UART_H__
#include "ameba_soc.h"
#include "serial_api.h"
#if defined(CONFIG_PLATFORM_8711B)
// 8710B
#define UART_TX PA_23

View File

@ -25,8 +25,6 @@
#include <skbuff.h>
#include "board.h"
#include <string.h>
#include <drv_wlan.h>
#include <wlan_dev.h>
#include "drv_wlan.h"
#include "drv_wifi.h"
@ -153,8 +151,11 @@ static void rtw_connect_callbackfn(char *buf, int len, int flags, void *user_dat
struct ameba_wifi *wifi = user_data;
LOG_D("L:%d wifi connect callback flags:%d user_data:%08x", __LINE__, flags, user_data);
wifi->connected = 1;
rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_CONNECT, RT_NULL);
if( wifi_is_connected_to_ap() == 0)
{
wifi->connected = 1;
rt_wlan_dev_indicate_event_handle(wifi->wlan, RT_WLAN_DEV_EVT_CONNECT, RT_NULL);
}
}
static void rtw_connect_fail_callbackfn(char *buf, int len, int flags, void *user_data)
@ -371,7 +372,7 @@ static rt_err_t rthw_wlan_join (struct rt_wlan_device *wlan, str
ssid = &sta_info->ssid.val[0];
if (sta_info->key.len > 0)
key = &sta_info->key.val[0];
LOG_D("bssid connect bssid: %02x:%02x:%02x:%02x:%02x:%02x ssid:%s ssid_len:%d key:%s key_len%d",
LOG_D("bssid connect bssid: %02x:%02x:%02x:%02x:%02x:%02x ssid:%s ssid_len:%d key:%s key_len%d",
sta_info->bssid[0],sta_info->bssid[1],sta_info->bssid[2],sta_info->bssid[3],sta_info->bssid[4],sta_info->bssid[5],
ssid,
sta_info->ssid.len,
@ -649,11 +650,8 @@ int rthw_wifi_low_init(void)
LOG_I("amebaz_wifi_start success");
LOG_D("F:%s L:%d wifi_sta:0x%08x wifi_ap:0x%08x", __FUNCTION__, __LINE__, &wifi_sta, &wifi_ap);
wifi_reg_event_handler(0, rtw_connect_callbackfn, &wifi_sta);
wifi_reg_event_handler(1, rtw_disconnect_callbackfn, &wifi_sta);
wifi_reg_event_handler(8, rtw_sta_assoc_callbackfn, &wifi_ap);
wifi_reg_event_handler(9, rtw_sta_disassoc_callbackfn, &wifi_ap);
wifi_reg_event_handler(RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, rtw_connect_callbackfn, &wifi_sta);
wifi_reg_event_handler(RTHW_WIFI_EVENT_DISCONNECT, rtw_disconnect_callbackfn, &wifi_sta);
_init_flag = 1;

View File

@ -26,15 +26,7 @@
#include "wifi_constants.h"
#include <wifi/wifi_util.h>
#include <wifi/wifi_conf.h>
#ifdef _LITTLE_ENDIAN
#undef _LITTLE_ENDIAN
#endif
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <wlan_dev.h>
#include "board.h"
#include "drv_wlan.h"
// #define SCAN_WAIT_TIME (10000)
@ -349,7 +341,7 @@ static void rthw_wifi_promisc_callback(unsigned char *buf, unsigned int len, voi
{
if (monitor_callback)
{
monitor_callback(buf, len, RT_NULL);
monitor_callback(userdata, len, RT_NULL);
}
}
@ -372,4 +364,3 @@ void rthw_wifi_monitor_enable(int enable)
rthw_wifi_stop();
}
}

View File

@ -25,8 +25,6 @@
#ifndef __DRV_WLAN_H__
#define __DRV_WLAN_H__
#include <rtthread.h>
typedef enum
{
RTHW_MODE_NONE = 0,
@ -65,6 +63,26 @@ typedef enum {
RTHW_SECURITY_FORCE_32_BIT = 0x7fffffff /**< Exists only to force rtw_security_t type to 32 bits */
} rthw_security_t;
typedef enum {
RTHW_WIFI_EVENT_CONNECT = 0,
RTHW_WIFI_EVENT_DISCONNECT = 1,
RTHW_WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
RTHW_WIFI_EVENT_SCAN_RESULT_REPORT = 3,
RTHW_WIFI_EVENT_SCAN_DONE = 4,
RTHW_WIFI_EVENT_RECONNECTION_FAIL = 5,
RTHW_WIFI_EVENT_SEND_ACTION_DONE = 6,
RTHW_WIFI_EVENT_RX_MGNT = 7,
RTHW_WIFI_EVENT_STA_ASSOC = 8,
RTHW_WIFI_EVENT_STA_DISASSOC = 9,
RTHW_WIFI_EVENT_STA_WPS_START = 10,
RTHW_WIFI_EVENT_WPS_FINISH = 11,
RTHW_WIFI_EVENT_EAPOL_START = 12,
RTHW_WIFI_EVENT_EAPOL_RECVD = 13,
RTHW_WIFI_EVENT_NO_NETWORK = 14,
RTHW_WIFI_EVENT_BEACON_AFTER_DHCP = 15,
RTHW_WIFI_EVENT_MAX,
}rthw_event_indicate_t;
typedef enum {
RTHW_802_11_BAND_5GHZ = 0, /**< Denotes 5GHz radio band */
RTHW_802_11_BAND_2_4GHZ = 1 /**< Denotes 2.4GHz radio band */
@ -72,13 +90,13 @@ typedef enum {
struct rthw_wlan_info
{
char *ssid;
char *ssid;
rt_uint8_t *bssid;
rthw_802_11_band_t band;
rt_uint32_t datarate;
rt_uint16_t channel;
rt_int16_t rssi;
rthw_security_t security;
rthw_security_t security;
};
typedef void (*scan_callback_fn)(struct rthw_wlan_info *info, void *user_data);

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -0,0 +1,7 @@
menu "External Libraries"
config RT_USING_SMARTCONFIG_LIB
bool "Using RT-Thrad SmartConfig Library"
default n
endmenu

View File

@ -0,0 +1,12 @@
import os
from building import *
objs = []
cwd = GetCurrentDir()
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
objs = objs + SConscript(os.path.join(item, 'SConscript'))
Return('objs')

View File

@ -0,0 +1,18 @@
Import('rtconfig')
from building import *
cwd = GetCurrentDir()
src = []
path = [cwd + '/inc']
libs = ['']
libpath = [cwd + '/libs']
if rtconfig.CROSS_TOOL == 'gcc':
libs += ['libsmartconfig_armcm4_gcc']
elif rtconfig.CROSS_TOOL == 'iar':
libs += ['libsmartconfig_armcm4_iar']
group = DefineGroup('smartconfig', src, depend = ['RT_USING_SMARTCONFIG_LIB'], CPPPATH = path, LIBS = libs, LIBPATH = libpath)
Return('group')

View File

@ -0,0 +1,62 @@
/*
* File : smartconfig.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2018-09-13 Bernard the first version
*/
#ifndef __SMARTCONFIG_H__
#define __SMARTCONFIG_H__
#define SMARTCONFIG_EVENT_CHANGE_CHANNEL (1 << 0)
#define SMARTCONFIG_EVENT_LOCKED_CHANNEL (1 << 1)
#define SMARTCONFIG_EVENT_COMPLETE (1 << 2)
#define SMARTCONFIG_EVENT_RESTART (1 << 3)
#define SMARTCONFIG_EVENT_STOP (1 << 4)
typedef enum
{
SMARTCONFIG_TYPE_AIRKISS = 0,
SMARTCONFIG_TYPE_JDSMART = 1,
SMARTCONFIG_TYPE_ESPTOUCH,
SMARTCONFIG_TYPE_REALTOUCH,
SMARTCONFIG_TYPE_ALL,
SMARTCONFIG_TYPE_MAX,
} rt_smartconfig_type;
typedef enum
{
SMARTCONFIG_ENCRYPT_NONE,
SMARTCONFIG_ENCRYPT_AES,
} rt_smartconfig_encrypt_type;
typedef int (*rt_smartconfig_result_cb)(rt_smartconfig_type result_type, char *ssid, char *passwd, \
void *userdata, rt_uint8_t userdata_len);
typedef void (*rt_smartconfig_event_handle)(rt_uint32_t event, void *userdata);
int rt_smartconfig_start(rt_smartconfig_type config_type, rt_smartconfig_encrypt_type encrypt_type, char *encrypt, \
rt_smartconfig_result_cb result_cb);
int rt_smartconfig_stop(void);
void rt_smartconfig_set_event_handle(rt_smartconfig_event_handle handle, void *userdata);
char *rt_smartconfig_version(void);
#endif

2697
bsp/amebaz/project.ewd Normal file

File diff suppressed because it is too large Load Diff

2434
bsp/amebaz/project.ewp Normal file

File diff suppressed because it is too large Load Diff

10
bsp/amebaz/project.eww Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\project.ewp</path>
</project>
<batchBuild/>
</workspace>

View File

@ -17,7 +17,7 @@
#define IDLE_THREAD_STACK_SIZE 256
#define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_TIMER_THREAD_STACK_SIZE 1024
#define RT_DEBUG
/* Inter-Thread communication */
@ -151,6 +151,9 @@
/* AT commands */
#define LWIP_USING_DHCPD
#define DHCPD_SERVER_IP "192.168.169.1"
#define DHCPD_USING_ROUTER
/* VBUS(Virtual Software BUS) */
@ -216,6 +219,10 @@
/* Env config */
/* External Libraries */
#define RT_USING_SMARTCONFIG_LIB
#define BSP_USING_WIFI
#endif

View File

@ -67,32 +67,6 @@ if PLATFORM == 'gcc':
M_CFLAGS = CFLAGS + ' -mlong-calls -Dsourcerygxx -O0 -fPIC '
M_LFLAGS = DEVICE + ' -Wl,-z,max-page-size=0x4 -shared -fPIC -e main -nostdlib'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --cpu=cortex-m4.fp'
CFLAGS = DEVICE + ' --apcs=interwork -DSTM32F429_439xx'
AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread-stm32.map --scatter stm32f429_flash.sct'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
EXEC_PATH += '/arm/bin40/'
if BUILD == 'debug':
CFLAGS += ' -g -O0'
AFLAGS += ' -g'
else:
CFLAGS += ' -O2'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
# toolchains
CC = 'iccarm'
@ -101,7 +75,7 @@ elif PLATFORM == 'iar':
LINK = 'ilinkarm'
TARGET_EXT = 'out'
DEVICE = ' -D USE_STDPERIPH_DRIVER' + ' -D STM32F10X_HD'
DEVICE = '-Dewarm'
CFLAGS = DEVICE
CFLAGS += ' --diag_suppress Pa050'
@ -112,26 +86,31 @@ elif PLATFORM == 'iar':
CFLAGS += ' --no_tbaa'
CFLAGS += ' --no_clustering'
CFLAGS += ' --no_scheduling'
CFLAGS += ' --debug'
CFLAGS += ' --endian=little'
CFLAGS += ' --cpu=Cortex-M4'
CFLAGS += ' -e'
CFLAGS += ' --fpu=None'
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
CFLAGS += ' -Ol'
CFLAGS += ' --use_c++_inline'
CFLAGS += ' --silent'
AFLAGS = ''
AFLAGS = DEVICE
AFLAGS += ' -s+'
AFLAGS += ' -w+'
AFLAGS += ' -r'
AFLAGS += ' --cpu Cortex-M4'
AFLAGS += ' --fpu None'
AFLAGS += ' -S'
LFLAGS = ' --config stm32f429_flash.icf'
if BUILD == 'debug':
CFLAGS += ' --debug'
CFLAGS += ' -On'
else:
CFLAGS += ' -Oh'
LFLAGS = ' --config rom_symbol_v01_iar.icf'
LFLAGS += ' --redirect _Printf=_PrintfTiny'
LFLAGS += ' --redirect _Scanf=_ScanfSmall'
LFLAGS += ' --entry __iar_program_start'
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = ''
POST_ACTION = 'ielftool --bin $TARGET rt-thread.bin'

2733
bsp/amebaz/template.ewd Normal file

File diff suppressed because it is too large Load Diff

1898
bsp/amebaz/template.ewp Normal file

File diff suppressed because it is too large Load Diff

2098
bsp/amebaz/template.ewt Normal file

File diff suppressed because it is too large Load Diff

10
bsp/amebaz/template.eww Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\template.ewp</path>
</project>
<batchBuild/>
</workspace>

21
bsp/amebaz/tmp.board Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_board>
<pass>
<range>CODE 0x8000000 0x8004fff</range>
<loader>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0x00000000</abs_offset>
</pass>
<pass>
<range>CODE 0x800b020 0x807ffff</range>
<loader>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0xb020</abs_offset>
</pass>
<pass>
<range>CODE 0x10005000 0x10005A9B</range>
<loader>$PROJ_DIR$\packages\realtek_ameba-latest\sdk-ameba-v4.0b_without_NDA_GCC_V1.0.0\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0xb000</abs_offset>
<args>--concat</args>
</pass>
<ignore>CODE 0x10005a9c 0x1003dfff</ignore>
</flash_board>