fix: Fixing lots of compilation warnings

- fix(esp8266):
  - Adding includes for missing symbols.
  - Removing unused variables.
  - Skip unsupported packing pragmas.
  - Add rom_functions.h for symbols that come from the ESP ROM. Add attributes on
ets_printf so GCC will check the syntax of the formatting string and types of
the arguments.
  - Add ETS_GPIO_INTR_EN(DIS)ABLE macro.
  - Use gpio_output_conf instead of gpio_output_set.

- fix(freertos):
  - Define functions that are useful.
  - Use correct printf symbols when printing.

- fix(lwip):
  - Ignore the warning in sntp.

- fix(mqtt):
  - `xTicksToWait` is unsigned, can't check for less than zero. Remove
unused variables.

- fix(newlib):
  - `_free_r()` returns `void`, not `void *`.
  - Adding includes for missing symbols.

- fix(ssl):
  - Make sure functions always return a value.

Merges https://github.com/espressif/ESP8266_RTOS_SDK/pull/188
This commit is contained in:
Trygve Laugstøl
2018-05-20 20:19:54 +02:00
committed by Wu Jian Gang
parent 74e972880c
commit f82e9be787
20 changed files with 79 additions and 43 deletions

View File

@@ -23,6 +23,7 @@
*/
#include "esp_common.h"
#include "freertos/portmacro.h"
#define US_TO_RTC_TIMER_TICKS(t) \
((t) ? \

View File

@@ -10,7 +10,9 @@
*******************************************************************************/
#include "c_types.h"
#include "esp8266/ets_sys.h"
#include "esp_misc.h"
#include "gpio.h"
#include "freertos/portmacro.h"
#include "i2c_master.h"

View File

@@ -24,6 +24,7 @@
#include "esp8266/ets_sys.h"
#include "esp8266/pin_mux_register.h"
#include "esp_libc.h"
#include "freertos/portmacro.h"
//*****************************************************************************
//
// Make sure all of the definitions in this header have a C binding.
@@ -457,7 +458,7 @@ int ICACHE_FLASH_ATTR SPIMasterRecvStatus(SpiNum spiNum)
while (READ_PERI_REG(SPI_CMD(spiNum))&SPI_USR);
uint8_t data = (uint8)(READ_PERI_REG(SPI_W0(spiNum)) & 0xff);
(void)(READ_PERI_REG(SPI_W0(spiNum)) & 0xff);
SHOWREG();
return (uint8)(READ_PERI_REG(SPI_W0(spiNum)) & 0xff);
@@ -520,4 +521,4 @@ void ICACHE_FLASH_ATTR SPIIntClear(SpiNum spiNum)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -29,6 +29,7 @@
#include "freertos/queue.h"
#include "uart.h"
#include "esp8266/rom_functions.h"
enum {
UART_EVENT_RX_CHAR,
@@ -82,6 +83,7 @@ uart0_write_char(char c)
}
}
#if 0
LOCAL void
uart_rx_intr_handler_ssc(void *arg)
{
@@ -109,7 +111,6 @@ uart_rx_intr_handler_ssc(void *arg)
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
}
#if 0
LOCAL void
uart_config(uint8 uart_no, UartDevice *uart)
{
@@ -149,6 +150,7 @@ uart_config(uint8 uart_no, UartDevice *uart)
}
#endif
#if 0
LOCAL void
uart_task(void *pvParameters)
{
@@ -170,7 +172,6 @@ uart_task(void *pvParameters)
vTaskDelete(NULL);
}
#if 0
void
uart_init(void)
{
@@ -351,11 +352,9 @@ uart0_rx_intr_handler(void *para)
/* uart0 and uart1 intr combine togther, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents
* uart1 and uart0 respectively
*/
uint8 RcvChar;
uint8 uart_no = UART0;//UartDev.buff_uart_no;
uint8 fifo_len = 0;
uint8 buf_idx = 0;
uint8 fifo_tmp[128] = {0};
uint32 uart_intr_status = READ_PERI_REG(UART_INT_ST(uart_no)) ;

View File

@@ -29,6 +29,10 @@
extern "C" {
#endif
#include "esp8266/gpio_register.h"
#define ETS_GPIO_INTR_ENABLE() _xt_isr_unmask(1 << ETS_GPIO_INUM)
#define ETS_GPIO_INTR_DISABLE() _xt_isr_mask(1 << ETS_GPIO_INUM)
#define GPIO_Pin_0 (BIT(0)) /* Pin 0 selected */
#define GPIO_Pin_1 (BIT(1)) /* Pin 1 selected */
#define GPIO_Pin_2 (BIT(2)) /* Pin 2 selected */

View File

@@ -29,16 +29,16 @@
#endif
#define I2C_MASTER_SDA_HIGH_SCL_HIGH() \
gpio_output_set(1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
gpio_output_conf(1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_HIGH_SCL_LOW() \
gpio_output_set(1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
gpio_output_conf(1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_LOW_SCL_HIGH() \
gpio_output_set(1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
gpio_output_conf(1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
#define I2C_MASTER_SDA_LOW_SCL_LOW() \
gpio_output_set(0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
gpio_output_conf(0, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 1<<I2C_MASTER_SDA_GPIO | 1<<I2C_MASTER_SCL_GPIO, 0)
/** \defgroup Driver_APIs Driver APIs
* @brief Driver APIs

View File

@@ -126,8 +126,6 @@ typedef enum
SpiPinCS_2 = 2,
} SpiPinCS;
#pragma pack (1)
/**
* @brief SPI attribute
*/
@@ -152,8 +150,6 @@ typedef struct
uint8_t dataLen; ///< Data byte length.
} SpiData;
#pragma upack (1)
#define SHOWREG() __ShowRegValue(__func__, __LINE__);
/**
@@ -325,4 +321,4 @@ void SPIIntClear(SpiNum spiNum);
}
#endif
#endif // __SPI_INTERFACE_H__
#endif // __SPI_INTERFACE_H__

View File

@@ -0,0 +1,17 @@
#ifndef _ROM_FUNCTIONS_H
#define _ROM_FUNCTIONS_H
#include <stdint.h>
uint32_t Wait_SPI_Idle();
void uart_div_modify(uint32_t uart_no, uint32_t baud_div);
void ets_delay_us(uint32_t us);
int ets_printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
void system_soft_wdt_feed();
void Cache_Read_Enable_New();
#endif

View File

@@ -42,7 +42,7 @@ static void *task_create_wrapper(void *task_func, const char *name, uint32_t sta
portBASE_TYPE ret;
xTaskHandle handle;
ret = xTaskCreate(task_func, (const signed char *)name, stack_depth, param, prio, &handle);
ret = xTaskCreate(task_func, name, stack_depth, param, prio, &handle);
return ret == pdPASS ? handle : NULL;
}
@@ -248,7 +248,7 @@ static uint32_t get_free_heap_size_wrapper(void)
static void *timer_create_wrapper(const char *name, uint32_t period_ticks, bool auto_load, void *arg, void (*cb)(void *timer))
{
return xTimerCreate((const signed char *)name, period_ticks, auto_load, arg, (tmrTIMER_CALLBACK)cb);
return xTimerCreate(name, period_ticks, auto_load, arg, (tmrTIMER_CALLBACK)cb);
}
static void *timer_get_arg_wrapper(void *timer)