Enable -std=gnu11 for modules dir.
Plus boat-load of fixes to actually make that build.
This commit is contained in:
parent
5cbea0a61f
commit
182d45f928
|
@ -192,6 +192,11 @@ void coap_setup(void);
|
|||
void endpoint_setup(void);
|
||||
|
||||
int coap_buildOptionHeader(uint32_t optDelta, size_t length, uint8_t *buf, size_t buflen);
|
||||
int check_token(coap_packet_t *pkt);
|
||||
|
||||
#include "uri.h"
|
||||
int coap_make_request(coap_rw_buffer_t *scratch, coap_packet_t *pkt, coap_msgtype_t t, coap_method_t m, coap_uri_t *uri, const uint8_t *payload, size_t payload_len);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "driver/key.h"
|
||||
|
||||
LOCAL void key_intr_handler(struct keys_param *keys);
|
||||
LOCAL void ICACHE_RAM_ATTR key_intr_handler(void *arg);
|
||||
|
||||
/******************************************************************************
|
||||
* FunctionName : key_init_single
|
||||
|
@ -130,8 +130,9 @@ key_50ms_cb(struct single_key_param *single_key)
|
|||
* Returns : none
|
||||
*******************************************************************************/
|
||||
LOCAL void
|
||||
key_intr_handler(struct keys_param *keys)
|
||||
key_intr_handler(void *arg)
|
||||
{
|
||||
struct keys_param *keys = arg;
|
||||
uint8 i;
|
||||
uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
|
||||
|
||||
|
|
|
@ -306,8 +306,9 @@ pwm_get_freq(uint8 channel)
|
|||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
LOCAL void ICACHE_RAM_ATTR
|
||||
pwm_tim1_intr_handler(void)
|
||||
pwm_tim1_intr_handler(void *p)
|
||||
{
|
||||
(void)p;
|
||||
uint8 local_toggle = pwm_toggle; // pwm_toggle may change outside
|
||||
RTC_CLR_REG_MASK(FRC1_INT_ADDRESS, FRC1_INT_CLR_MASK);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define SPI_APP_H
|
||||
|
||||
#include "spi_register.h"
|
||||
#include "ets_sys.h"
|
||||
#include "rom.h"
|
||||
#include "osapi.h"
|
||||
#include "uart.h"
|
||||
#include "os_type.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define _ROM_H_
|
||||
|
||||
#include "c_types.h"
|
||||
#include "ets_sys.h"
|
||||
|
||||
// SHA1 is assumed to match the netbsd sha1.h headers
|
||||
#define SHA1_DIGEST_LENGTH 20
|
||||
|
@ -44,7 +45,7 @@ extern unsigned char * base64_decode(const unsigned char *src, size_t len, size_
|
|||
extern void mem_init(void * start_addr);
|
||||
|
||||
// Interrupt Service Routine functions
|
||||
typedef void (*ets_isr_fn) (void *arg, uint32_t sp);
|
||||
typedef void (*ets_isr_fn) (void *arg);
|
||||
extern int ets_isr_attach (unsigned int interrupt, ets_isr_fn, void *arg);
|
||||
extern void ets_isr_mask (unsigned intr);
|
||||
extern void ets_isr_unmask (unsigned intr);
|
||||
|
@ -108,4 +109,35 @@ typedef void (*exception_handler_fn) (struct exception_frame *ef, uint32_t cause
|
|||
*/
|
||||
exception_handler_fn _xtos_set_exception_handler (uint32_t cause, exception_handler_fn handler);
|
||||
|
||||
|
||||
void ets_update_cpu_frequency (uint32_t mhz);
|
||||
uint32_t ets_get_cpu_frequency (void);
|
||||
|
||||
void *ets_memcpy (void *dst, const void *src, size_t n);
|
||||
void *ets_memmove (void *dst, const void *src, size_t n);
|
||||
void *ets_memset (void *dst, int c, size_t n);
|
||||
int ets_memcmp (const void *s1, const void *s2, size_t n);
|
||||
|
||||
char *ets_strcpy (char *dst, const char *src);
|
||||
size_t ets_strlen (const char *s);
|
||||
int ets_strcmp (const char *s1, const char *s2);
|
||||
int ets_strncmp (const char *s1, const char *s2, size_t n);
|
||||
|
||||
void ets_delay_us (uint32_t us);
|
||||
|
||||
int ets_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
void ets_str2macaddr (uint8_t *dst, const char *str);
|
||||
|
||||
void ets_timer_disarm (ETSTimer *a);
|
||||
void ets_timer_setfn (ETSTimer *t, ETSTimerFunc *fn, void *parg);
|
||||
|
||||
void Cache_Read_Enable(uint32_t b0, uint32_t b1, uint32_t use_40108000);
|
||||
void Cache_Read_Disable(void);
|
||||
|
||||
void ets_intr_lock(void);
|
||||
void ets_intr_unlock(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
#include <ets_sys.h>
|
||||
#include "rom.h"
|
||||
#include "rtcaccess.h"
|
||||
#include "user_interface.h"
|
||||
|
||||
// Layout of the RTC storage space:
|
||||
//
|
||||
|
|
|
@ -272,7 +272,6 @@ strtoupper(char *p)
|
|||
//#include <string.h>
|
||||
//#include <pmon.h>
|
||||
#include "c_string.h"
|
||||
typedef int int32_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned long u_long;
|
||||
|
|
|
@ -15,6 +15,8 @@ ifndef PDIR
|
|||
GEN_LIBS = libmodules.a
|
||||
endif
|
||||
|
||||
EXTRA_CCFLAGS+=-std=gnu11
|
||||
|
||||
#############################################################
|
||||
# Configuration i.e. compile options etc.
|
||||
# Target specific stuff (defines etc.) goes in here!
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "c_limits.h"
|
||||
#include "lauxlib.h"
|
||||
#include "flash_api.h"
|
||||
#include "ctype.h"
|
||||
|
||||
#include "strbuf.h"
|
||||
#include "cjson_mem.h"
|
||||
|
|
|
@ -372,7 +372,7 @@ static int coap_request( lua_State* L, coap_method_t m )
|
|||
if(!pdu){
|
||||
if(uri)
|
||||
c_free(uri);
|
||||
return;
|
||||
return luaL_error (L, "alloc fail");
|
||||
}
|
||||
|
||||
const char *payload = NULL;
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
#include "platform.h"
|
||||
#include "c_stdlib.h"
|
||||
#include "c_string.h"
|
||||
#include "ctype.h"
|
||||
#include "user_interface.h"
|
||||
#include "espconn.h"
|
||||
#include "flash_fs.h"
|
||||
|
||||
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
|
||||
#define ENDUSER_SETUP_ERR_FATAL (1 << 0)
|
||||
|
@ -96,7 +96,7 @@ static void enduser_setup_station_start(void);
|
|||
static void enduser_setup_station_start(void);
|
||||
static void enduser_setup_ap_start(void);
|
||||
static void enduser_setup_ap_stop(void);
|
||||
static void enduser_setup_check_station(void);
|
||||
static void enduser_setup_check_station(void *p);
|
||||
static void enduser_setup_debug(lua_State *L, const char *str);
|
||||
|
||||
|
||||
|
@ -177,8 +177,9 @@ static void enduser_setup_check_station_stop(void)
|
|||
*
|
||||
* Check that we've successfully entered station mode.
|
||||
*/
|
||||
static void enduser_setup_check_station(void)
|
||||
static void enduser_setup_check_station(void *p)
|
||||
{
|
||||
(void)p;
|
||||
struct ip_info ip;
|
||||
c_memset(&ip, 0, sizeof(struct ip_info));
|
||||
|
||||
|
@ -391,7 +392,7 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
|
|||
err = wifi_station_disconnect();
|
||||
if (err == FALSE)
|
||||
{
|
||||
ENDUSER_SETUP_ERROR_VOID("enduser_setup_station_start failed. wifi_station_disconnect failed.", ENDUSER_SETUP_ERR_UNKOWN_ERROR, ENDUSER_SETUP_ERR_NONFATAL);
|
||||
ENDUSER_SETUP_ERROR("enduser_setup_station_start failed. wifi_station_disconnect failed.", ENDUSER_SETUP_ERR_UNKOWN_ERROR, ENDUSER_SETUP_ERR_NONFATAL);
|
||||
}
|
||||
err = wifi_station_connect();
|
||||
if (err == FALSE)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "module.h"
|
||||
#include "lauxlib.h"
|
||||
#include "platform.h"
|
||||
#include "rom.h"
|
||||
|
||||
#include "c_types.h"
|
||||
#include "c_string.h"
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "mqtt_msg.h"
|
||||
#include "msg_queue.h"
|
||||
|
||||
#include "user_interface.h"
|
||||
|
||||
#define MQTT_BUF_SIZE 1024
|
||||
#define MQTT_DEFAULT_KEEPALIVE 60
|
||||
#define MQTT_MAX_CLIENT_LEN 64
|
||||
|
@ -831,7 +833,7 @@ static void socket_connect(struct espconn *pesp_conn)
|
|||
}
|
||||
|
||||
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg);
|
||||
static dns_reconn_count = 0;
|
||||
static int dns_reconn_count = 0;
|
||||
static ip_addr_t host_ip; // for dns
|
||||
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
|
||||
{
|
||||
|
|
|
@ -610,7 +610,7 @@ static void socket_connect(struct espconn *pesp_conn)
|
|||
}
|
||||
|
||||
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg);
|
||||
static dns_reconn_count = 0;
|
||||
static int dns_reconn_count = 0;
|
||||
static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
|
||||
{
|
||||
NODE_DBG("socket_dns_found is called.\n");
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "flash_api.h"
|
||||
#include "flash_fs.h"
|
||||
#include "user_version.h"
|
||||
#include "rom.h"
|
||||
|
||||
#define CPU80MHZ 80
|
||||
#define CPU160MHZ 160
|
||||
|
@ -49,7 +50,7 @@ static int node_deepsleep( lua_State* L )
|
|||
if ( option < 0 || option > 4)
|
||||
return luaL_error( L, "wrong arg range" );
|
||||
else
|
||||
deep_sleep_set_option( option );
|
||||
system_deep_sleep_set_option( option );
|
||||
}
|
||||
// Set deleep time, skip if nil
|
||||
if ( lua_isnumber(L, 1) )
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "module.h"
|
||||
#include "lauxlib.h"
|
||||
#include "platform.h"
|
||||
#include "rom.h"
|
||||
//#include "driver/easygpio.h"
|
||||
//static Ping_Data pingA;
|
||||
#define defPulseLen 185
|
||||
|
|
|
@ -87,7 +87,7 @@ static void do_sleep_opt (lua_State *L, int idx)
|
|||
uint32_t opt = lua_tonumber (L, idx);
|
||||
if (opt < 0 || opt > 4)
|
||||
luaL_error (L, "unknown sleep option");
|
||||
deep_sleep_set_option (opt);
|
||||
system_deep_sleep_set_option (opt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,20 +59,6 @@ tmr.softwd(int)
|
|||
#define TIMER_MODE_AUTO 1
|
||||
#define TIMER_IDLE_FLAG (1<<7)
|
||||
|
||||
//well, the following are my assumptions
|
||||
//why, oh why is there no good documentation
|
||||
//chinese companies should learn from Atmel
|
||||
extern void ets_timer_arm_new(os_timer_t* t, uint32_t milliseconds, uint32_t repeat_flag, uint32_t isMstimer);
|
||||
extern void ets_timer_disarm(os_timer_t* t);
|
||||
extern void ets_timer_setfn(os_timer_t* t, os_timer_func_t *f, void *arg);
|
||||
extern void ets_delay_us(uint32_t us);
|
||||
extern uint32_t system_get_time();
|
||||
extern uint32_t platform_tmr_exists(uint32_t t);
|
||||
extern uint32_t system_rtc_clock_cali_proc();
|
||||
extern uint32_t system_get_rtc_time();
|
||||
extern void system_restart();
|
||||
extern void system_soft_wdt_feed();
|
||||
|
||||
//in fact lua_State is constant, it's pointless to pass it around
|
||||
//but hey, whatever, I'll just pass it, still we waste 28B here
|
||||
typedef struct{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "c_types.h"
|
||||
#include "c_string.h"
|
||||
#include "rom.h"
|
||||
|
||||
static lua_State *gL = NULL;
|
||||
static int uart_receive_rf = LUA_NOREF;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "c_string.h"
|
||||
#include "c_stdlib.h"
|
||||
#include "ctype.h"
|
||||
|
||||
#include "c_types.h"
|
||||
#include "user_interface.h"
|
||||
|
@ -22,7 +23,7 @@ static bool FLAG_wifi_force_sleep_enabled=0;
|
|||
|
||||
//variables for wifi event monitor
|
||||
static sint32_t wifi_status_cb_ref[6] = {LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF};
|
||||
static volatile os_timer_t wifi_sta_status_timer;
|
||||
static os_timer_t wifi_sta_status_timer;
|
||||
static uint8 prev_wifi_status=0;
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static void ws2801_strip(uint8_t const * data, uint16_t len) {
|
|||
GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, ws2801_bit_data);
|
||||
}
|
||||
|
||||
static void enable_pin_mux(pin) {
|
||||
static void enable_pin_mux(int pin) {
|
||||
// The API only supports setting PERIPHS_IO_MUX on GPIO 0, 2, 4, 5
|
||||
switch (pin) {
|
||||
case 0:
|
||||
|
|
|
@ -131,7 +131,8 @@ int platform_gpio_read( unsigned pin )
|
|||
}
|
||||
|
||||
#ifdef GPIO_INTERRUPT_ENABLE
|
||||
static void platform_gpio_intr_dispatcher( platform_gpio_intr_handler_fn_t cb){
|
||||
static void platform_gpio_intr_dispatcher( void *arg) {
|
||||
platform_gpio_intr_handler_fn_t cb = arg;
|
||||
uint8 i, level;
|
||||
uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
|
||||
for (i = 0; i < GPIO_PIN_NUM; i++) {
|
||||
|
|
|
@ -149,6 +149,7 @@ int platform_uart_recv( unsigned id, unsigned timer_id, timer_data_type timeout
|
|||
int platform_s_uart_recv( unsigned id, timer_data_type timeout );
|
||||
int platform_uart_set_flow_control( unsigned id, int type );
|
||||
int platform_s_uart_set_flow_control( unsigned id, int type );
|
||||
void platform_uart_alt( int set );
|
||||
|
||||
// *****************************************************************************
|
||||
// PWM subsection
|
||||
|
@ -253,6 +254,13 @@ uint32_t platform_flash_mapped2phys (uint32_t mapped_addr);
|
|||
void* platform_get_first_free_ram( unsigned id );
|
||||
void* platform_get_last_free_ram( unsigned id );
|
||||
|
||||
|
||||
// *****************************************************************************
|
||||
// Other glue
|
||||
|
||||
int platform_ow_exists( unsigned id );
|
||||
int platform_gpio_exists( unsigned id );
|
||||
|
||||
// *****************************************************************************
|
||||
// Helper macros
|
||||
#define MOD_CHECK_ID( mod, id )\
|
||||
|
|
|
@ -499,7 +499,7 @@ void smart_end(){
|
|||
wifi_station_connect();
|
||||
|
||||
os_timer_disarm(&smart_timer);
|
||||
os_timer_setfn(&smart_timer, (os_timer_func_t *)station_check_connect, 1);
|
||||
os_timer_setfn(&smart_timer, (os_timer_func_t *)station_check_connect, (void *)1);
|
||||
os_timer_arm(&smart_timer, STATION_CHECK_TIME, 0); // no repeat
|
||||
}
|
||||
}
|
||||
|
@ -716,6 +716,6 @@ void station_check_connect(bool smart){
|
|||
break;
|
||||
}
|
||||
os_timer_disarm(&smart_timer);
|
||||
os_timer_setfn(&smart_timer, (os_timer_func_t *)station_check_connect, smart);
|
||||
os_timer_setfn(&smart_timer, (os_timer_func_t *)station_check_connect, (void *)(int)smart);
|
||||
os_timer_arm(&smart_timer, STATION_CHECK_TIME, 0); // no repeat
|
||||
}
|
||||
|
|
|
@ -571,6 +571,7 @@ void myspiffs_clearerr( int fd );
|
|||
int myspiffs_check( void );
|
||||
int myspiffs_rename( const char *old, const char *newname );
|
||||
size_t myspiffs_size( int fd );
|
||||
int myspiffs_format (void);
|
||||
|
||||
s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh);
|
||||
s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef _SDK_OVERRIDE_MEM_H_
|
||||
#define _SDK_OVERRIDE_MEM_H_
|
||||
|
||||
void *pvPortMalloc (size_t sz, const char *, unsigned);
|
||||
void vPortFree (void *p, const char *, unsigned);
|
||||
void *pvPortZalloc (size_t sz, const char *, unsigned);
|
||||
void *pvPortRealloc (void *p, size_t n, const char *, unsigned);
|
||||
|
||||
#include_next "mem.h"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef _SDK_OVERRIDE_OSAPI_H_
|
||||
#define _SDK_OVERRIDE_OSAPI_H_
|
||||
|
||||
#include "rom.h"
|
||||
void ets_timer_arm_new (ETSTimer *a, int b, int c, int isMstimer);
|
||||
|
||||
#include_next "osapi.h"
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue