Switch to CC3200 SDK 1.2.0

PUBLISHED_FROM=857459178e3af50fa6626379d1f71a725cd3b68b
This commit is contained in:
Deomid Ryabkov 2016-04-06 09:22:45 +02:00 committed by rojer
parent 7dd1004b93
commit ccd0167e40
8 changed files with 66 additions and 150 deletions

View File

@ -78,11 +78,12 @@ $(FW_ZIP): $(FW_ELF) $(FW_BIN) $(SLFS_FILES)
FREERTOS_SRCS = timers.c list.c queue.c tasks.c port.c heap_3.c osi_freertos.c FREERTOS_SRCS = timers.c list.c queue.c tasks.c port.c heap_3.c osi_freertos.c
DRIVER_SRCS = cpu.c gpio.c gpio_if.c i2c.c i2c_if.c interrupt.c pin.c prcm.c spi.c uart.c udma.c utils.c DRIVER_SRCS = cpu.c gpio.c gpio_if.c i2c.c i2c_if.c interrupt.c pin.c prcm.c spi.c uart.c udma.c utils.c
SL_SRCS = socket.c wlan.c driver.c device.c netapp.c netcfg.c cc_pal.c fs.c SL_SRCS = socket.c wlan.c driver.c device.c netapp.c netcfg.c network_common.c cc_pal.c fs.c
SDK_SRCS = startup_gcc.c $(FREERTOS_SRCS) $(DRIVER_SRCS) $(SL_SRCS) SDK_SRCS = startup_gcc.c $(FREERTOS_SRCS) $(DRIVER_SRCS) $(SL_SRCS)
IPATH += $(SDK_PATH) $(SDK_PATH)/inc $(SDK_PATH)/driverlib \ IPATH += $(SDK_PATH) $(SDK_PATH)/inc $(SDK_PATH)/driverlib \
$(SDK_PATH)/example/common $(SDK_PATH)/oslib \ $(SDK_PATH)/example/common $(SDK_PATH)/oslib \
$(SDK_PATH)/simplelink $(SDK_PATH)/simplelink/include \ $(SDK_PATH)/simplelink $(SDK_PATH)/simplelink/include \
$(SDK_PATH)/simplelink_extlib/provisioninglib \
$(SDK_PATH)/third_party/FreeRTOS/source \ $(SDK_PATH)/third_party/FreeRTOS/source \
$(SDK_PATH)/third_party/FreeRTOS/source/include \ $(SDK_PATH)/third_party/FreeRTOS/source/include \
$(SDK_PATH)/third_party/FreeRTOS/source/portable/GCC/ARM_CM4 $(SDK_PATH)/third_party/FreeRTOS/source/portable/GCC/ARM_CM4
@ -103,4 +104,5 @@ ENTRY_$(PROG) = ResetISR
# Disable certain warnings on SDK sources, we have no control over them anyway. # Disable certain warnings on SDK sources, we have no control over them anyway.
SDK_OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SDK_SRCS))) SDK_OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SDK_SRCS)))
$(SDK_OBJS): CFLAGS += -Wno-missing-braces -Wno-strict-aliasing -Wno-parentheses -Wno-unused-variable $(SDK_OBJS): CFLAGS += -include mongoose.h -Wno-missing-braces -Wno-strict-aliasing -Wno-parentheses -Wno-unused-variable
$(BUILD_DIR)/cc_pal.o: CFLAGS += -Wno-error

View File

@ -25,6 +25,7 @@
#include "gpio_if.h" #include "gpio_if.h"
#include "i2c_if.h" #include "i2c_if.h"
#include "mongoose.h"
#include "simplelink.h" #include "simplelink.h"
#include "device.h" #include "device.h"
@ -226,3 +227,8 @@ void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *e,
void SimpleLinkSockEventHandler(SlSockEvent_t *e) { void SimpleLinkSockEventHandler(SlSockEvent_t *e) {
} }
void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *e) {
LOG(LL_INFO, ("status %d sender %d", e->EventData.deviceEvent.status,
e->EventData.deviceEvent.sender));
}

View File

@ -1,7 +1,5 @@
#include "mg_task.h" #include "mg_task.h"
#include <oslib/osi.h>
enum mg_q_msg_type { enum mg_q_msg_type {
MG_Q_MSG_CB, MG_Q_MSG_CB,
}; };
@ -13,11 +11,11 @@ struct mg_q_msg {
static OsiMsgQ_t s_mg_q; static OsiMsgQ_t s_mg_q;
static void mg_task(void *arg); static void mg_task(void *arg);
bool mg_start_task(int priority, int stask_size, mg_init_cb mg_init) { bool mg_start_task(int priority, int stack_size, mg_init_cb mg_init) {
if (osi_MsgQCreate(&s_mg_q, "MG", sizeof(struct mg_q_msg), 16) != OSI_OK) { if (osi_MsgQCreate(&s_mg_q, "MG", sizeof(struct mg_q_msg), 16) != OSI_OK) {
return false; return false;
} }
if (osi_TaskCreate(mg_task, (const signed char *) "MG", stask_size, if (osi_TaskCreate(mg_task, (const signed char *) "MG", stack_size,
(void *) mg_init, priority, NULL) != OSI_OK) { (void *) mg_init, priority, NULL) != OSI_OK) {
return false; return false;
} }

View File

@ -7,11 +7,13 @@
#define CS_MONGOOSE_EXAMPLES_CC3200_MG_TASK_H_ #define CS_MONGOOSE_EXAMPLES_CC3200_MG_TASK_H_
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h>
#include <oslib/osi.h>
#include "mongoose.h" #include "mongoose.h"
typedef void (*mg_init_cb)(struct mg_mgr *mgr); typedef void (*mg_init_cb)(struct mg_mgr *mgr);
bool mg_start_task(int priority, int stask_size, mg_init_cb mg_init); bool mg_start_task(int priority, int stack_size, mg_init_cb mg_init);
void mg_run_in_task(void (*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg); void mg_run_in_task(void (*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg);

View File

@ -1 +1 @@
docker.cesanta.com:5000/cc3200-build:1.1.0-r7 docker.cesanta.com:5000/cc3200-build:1.2.0-r1

View File

@ -1,12 +1,11 @@
#include "wifi.h" #include "wifi.h"
#include "mongoose.h"
#include "simplelink.h" #include "simplelink.h"
#include "wlan.h" #include "wlan.h"
#include "gpio_if.h" #include "gpio_if.h"
#include "mongoose.h"
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) { void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
switch (e->Event) { switch (e->Event) {
case SL_WLAN_CONNECT_EVENT: case SL_WLAN_CONNECT_EVENT:

View File

@ -10171,8 +10171,8 @@ ssize_t fs_slfs_read(int fd, void *buf, size_t count) {
*/ */
if (fi->size >= 0 && fi->pos == fi->size) return 0; if (fi->size >= 0 && fi->pos == fi->size) return 0;
_i32 r = sl_FsRead(fi->fh, fi->pos, buf, count); _i32 r = sl_FsRead(fi->fh, fi->pos, buf, count);
DBG(("sl_FsRead(%d, %d, %d) = %d", (int) fi->fh, (int) fi->pos, DBG(("sl_FsRead(%d, %d, %d) = %d", (int) fi->fh, (int) fi->pos, (int) count,
(int) count, (int) r)); (int) r));
if (r >= 0) { if (r >= 0) {
fi->pos += r; fi->pos += r;
return r; return r;
@ -10184,8 +10184,8 @@ ssize_t fs_slfs_write(int fd, const void *buf, size_t count) {
struct sl_fd_info *fi = &s_sl_fds[fd]; struct sl_fd_info *fi = &s_sl_fds[fd];
if (fi->fh <= 0) return set_errno(EBADF); if (fi->fh <= 0) return set_errno(EBADF);
_i32 r = sl_FsWrite(fi->fh, fi->pos, (_u8 *) buf, count); _i32 r = sl_FsWrite(fi->fh, fi->pos, (_u8 *) buf, count);
DBG(("sl_FsWrite(%d, %d, %d) = %d", (int) fi->fh, (int) fi->pos, DBG(("sl_FsWrite(%d, %d, %d) = %d", (int) fi->fh, (int) fi->pos, (int) count,
(int) count, (int) r)); (int) r));
if (r >= 0) { if (r >= 0) {
fi->pos += r; fi->pos += r;
return r; return r;
@ -10587,15 +10587,16 @@ int mkdir(const char *path, mode_t mode) {
} }
#endif #endif
int cc3200_fs_init() { int cc3200_fs_init() {
int ret = 1;
#ifdef __TI_COMPILER_VERSION__ #ifdef __TI_COMPILER_VERSION__
#ifdef CC3200_FS_SLFS #ifdef CC3200_FS_SLFS
return add_device("SL", _MSA, fs_slfs_open, fs_slfs_close, fs_slfs_read, fs_slfs_write, fs_slfs_lseek, fs_slfs_unlink, fs_slfs_rename) == 0; ret = (add_device("SL", _MSA, fs_slfs_open, fs_slfs_close, fs_slfs_read,
fs_slfs_write, fs_slfs_lseek, fs_slfs_unlink,
fs_slfs_rename) == 0);
#endif #endif
#else
return 1;
#endif #endif
return ret;
} }
#endif /* CS_PLATFORM == CS_P_CC3200 */ #endif /* CS_PLATFORM == CS_P_CC3200 */

View File

@ -431,140 +431,43 @@ unsigned long os_random(void);
#define MG_DISABLE_DIRECTORY_LISTING 1 #define MG_DISABLE_DIRECTORY_LISTING 1
#endif #endif
#ifndef __TI_COMPILER_VERSION__
#undef __CONCAT
#undef EACCES
#undef EADDRINUSE
#undef EADDRNOTAVAIL
#undef EAFNOSUPPORT
#undef EAGAIN
#undef EBADF
#undef ECONNREFUSED
#undef EDESTADDRREQ
#undef EFAULT
#undef EINVAL
#undef EISCONN
#undef ENETUNREACH
#undef ENOBUFS
#undef ENOMEM
#undef ENOPROTOOPT
#undef ENOTCONN
#undef EOPNOTSUPP
#undef EPROTONOSUPPORT
#undef EPROTOTYPE
#undef ETIMEDOUT
#undef EWOULDBLOCK
#undef FD_CLR
#undef FD_ISSET
#undef FD_SET
#undef FD_SETSIZE
#undef FD_ZERO
#undef fd_set
#endif
#include <simplelink/include/simplelink.h> #include <simplelink/include/simplelink.h>
#define SOMAXCONN 8 #define SOMAXCONN 8
/* Undefine a bunch of conflicting symbols so we can use SDK defs verbatim. */
#undef FD_CLR
#undef FD_SET
#undef FD_ZERO
#undef FD_ISSET
#undef FD_SETSIZE
#undef fd_set
#undef EACCES
#undef EBADF
#undef EAGAIN
#undef EWOULDBLOCK
#undef ENOMEM
#undef EFAULT
#undef EINVAL
#undef EDESTADDRREQ
#undef EPROTOTYPE
#undef ENOPROTOOPT
#undef EPROTONOSUPPORT
#undef EOPNOTSUPP
#undef EAFNOSUPPORT
#undef EAFNOSUPPORT
#undef EADDRINUSE
#undef EADDRNOTAVAIL
#undef ENETUNREACH
#undef ENOBUFS
#undef EISCONN
#undef ENOTCONN
#undef ETIMEDOUT
#undef ECONNREFUSED
/* The following comes from $SDK/simplelink/include/socket.h */
/* clang-format off */
#define FD_SETSIZE SL_FD_SETSIZE
#define SOCK_STREAM SL_SOCK_STREAM
#define SOCK_DGRAM SL_SOCK_DGRAM
#define SOCK_RAW SL_SOCK_RAW
#define IPPROTO_TCP SL_IPPROTO_TCP
#define IPPROTO_UDP SL_IPPROTO_UDP
#define IPPROTO_RAW SL_IPPROTO_RAW
#define AF_INET SL_AF_INET
#define AF_INET6 SL_AF_INET6
#define AF_INET6_EUI_48 SL_AF_INET6_EUI_48
#define AF_RF SL_AF_RF
#define AF_PACKET SL_AF_PACKET
#define PF_INET SL_PF_INET
#define PF_INET6 SL_PF_INET6
#define INADDR_ANY SL_INADDR_ANY
#define ERROR SL_SOC_ERROR
#define INEXE SL_INEXE
#define EBADF SL_EBADF
#define ENSOCK SL_ENSOCK
#define EAGAIN SL_EAGAIN
#define EWOULDBLOCK SL_EWOULDBLOCK
#define ENOMEM SL_ENOMEM
#define EACCES SL_EACCES
#define EFAULT SL_EFAULT
#define EINVAL SL_EINVAL
#define EDESTADDRREQ SL_EDESTADDRREQ
#define EPROTOTYPE SL_EPROTOTYPE
#define ENOPROTOOPT SL_ENOPROTOOPT
#define EPROTONOSUPPORT SL_EPROTONOSUPPORT
#define ESOCKTNOSUPPORT SL_ESOCKTNOSUPPORT
#define EOPNOTSUPP SL_EOPNOTSUPP
#define EAFNOSUPPORT SL_EAFNOSUPPORT
#define EADDRINUSE SL_EADDRINUSE
#define EADDRNOTAVAIL SL_EADDRNOTAVAIL
#define ENETUNREACH SL_ENETUNREACH
#define ENOBUFS SL_ENOBUFS
#define EOBUFF SL_EOBUFF
#define EISCONN SL_EISCONN
#define ENOTCONN SL_ENOTCONN
#define ETIMEDOUT SL_ETIMEDOUT
#define ECONNREFUSED SL_ECONNREFUSED
#define SOL_SOCKET SL_SOL_SOCKET
#define IPPROTO_IP SL_IPPROTO_IP
#define SO_KEEPALIVE SL_SO_KEEPALIVE
#define SO_RCVTIMEO SL_SO_RCVTIMEO
#define SO_NONBLOCKING SL_SO_NONBLOCKING
#define IP_MULTICAST_IF SL_IP_MULTICAST_IF
#define IP_MULTICAST_TTL SL_IP_MULTICAST_TTL
#define IP_ADD_MEMBERSHIP SL_IP_ADD_MEMBERSHIP
#define IP_DROP_MEMBERSHIP SL_IP_DROP_MEMBERSHIP
#define socklen_t SlSocklen_t
#ifdef __TI_COMPILER_VERSION__
#define timeval SlTimeval_t
#endif
#define sockaddr SlSockAddr_t
#define in6_addr SlIn6Addr_t
#define sockaddr_in6 SlSockAddrIn6_t
#define in_addr SlInAddr_t
#define sockaddr_in SlSockAddrIn_t
#define MSG_DONTWAIT SL_MSG_DONTWAIT
#define FD_SET SL_FD_SET
#define FD_CLR SL_FD_CLR
#define FD_ISSET SL_FD_ISSET
#define FD_ZERO SL_FD_ZERO
#define fd_set SlFdSet_t
#define socket sl_Socket
#define accept sl_Accept
#define bind sl_Bind
#define listen sl_Listen
#define connect sl_Connect
#define select sl_Select
#define setsockopt sl_SetSockOpt
#define getsockopt sl_GetSockOpt
#define recv sl_Recv
#define recvfrom sl_RecvFrom
#define write sl_Write
#define send sl_Send
#define sendto sl_SendTo
/* rojer: gethostbyname() and sl_NetAppDnsGetHostByName are NOT compatible. */ /* rojer: gethostbyname() and sl_NetAppDnsGetHostByName are NOT compatible. */
/* #define gethostbyname sl_NetAppDnsGetHostByName */ #undef gethostbyname
#define htonl sl_Htonl
#define ntohl sl_Ntohl
#define htons sl_Htons
#define ntohs sl_Ntohs
/* clang-format on */
typedef int sock_t; typedef int sock_t;
#define INVALID_SOCKET (-1) #define INVALID_SOCKET (-1)
@ -576,6 +479,7 @@ typedef struct stat cs_stat_t;
#define INT64_X_FMT PRIx64 #define INT64_X_FMT PRIx64
#define __cdecl #define __cdecl
#undef close /* Defined by SL's socket.h */
#define closesocket(x) sl_Close(x) #define closesocket(x) sl_Close(x)
#define fileno(x) -1 #define fileno(x) -1
@ -586,8 +490,12 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
char *inet_ntoa(struct in_addr in); char *inet_ntoa(struct in_addr in);
int inet_pton(int af, const char *src, void *dst); int inet_pton(int af, const char *src, void *dst);
struct timeval; #ifdef __TI_COMPILER_VERSION__
#define timeval SlTimeval_t
int gettimeofday(struct timeval *t, void *tz); int gettimeofday(struct timeval *t, void *tz);
#else
#undef timeval
#endif
long int random(void); long int random(void);