mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-03 02:56:35 +08:00
fix(components): Fix all components's compile warning and enable warning checking
This commit is contained in:
@ -14,9 +14,10 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "bootloader_config.h"
|
||||
#include "bootloader_init.h"
|
||||
|
||||
#include "bootloader_utility.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
|
@ -167,11 +167,10 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "crc.h"
|
||||
|
||||
#include "bootloader_config.h"
|
||||
|
||||
static const char* TAG = "boot_comm";
|
||||
|
||||
uint32_t bootloader_common_ota_select_crc(const esp_ota_select_entry_t *s)
|
||||
{
|
||||
return crc32_le(UINT32_MAX, (uint8_t*)&s->ota_seq, 4);
|
||||
|
@ -264,6 +264,9 @@ esp_err_t bootloader_flash_erase_sector(size_t sector)
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
extern void Cache_Read_Disable();
|
||||
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
|
||||
|
||||
static const char *TAG = "bootloader_flash";
|
||||
|
||||
typedef enum { SPI_FLASH_RESULT_OK = 0,
|
||||
@ -335,7 +338,6 @@ esp_err_t bootloader_flash_read(size_t src_addr, void *dest, size_t size, bool a
|
||||
|
||||
esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool write_encrypted)
|
||||
{
|
||||
esp_err_t err;
|
||||
size_t alignment = write_encrypted ? 32 : 4;
|
||||
if ((dest_addr % alignment) != 0) {
|
||||
ESP_LOGE(TAG, "bootloader_flash_write dest_addr 0x%x not %d-byte aligned", dest_addr, alignment);
|
||||
|
@ -545,6 +545,7 @@ void __assert_func(const char *file, int line, const char *func, const char *exp
|
||||
|
||||
#include "esp_image_format.h"
|
||||
#include "esp_flash_partitions.h"
|
||||
#include "bootloader_flash.h"
|
||||
|
||||
extern int _bss_start;
|
||||
extern int _bss_end;
|
||||
@ -589,28 +590,28 @@ static esp_err_t bootloader_main()
|
||||
|
||||
static void update_flash_config(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
uint32_t size;
|
||||
switch(pfhdr->spi_size) {
|
||||
case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
size = 1;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
case ESP_IMAGE_FLASH_SIZE_2MB_C1:
|
||||
size = 2;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
case ESP_IMAGE_FLASH_SIZE_4MB_C1:
|
||||
size = 4;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
size = 8;
|
||||
break;
|
||||
case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
size = 16;
|
||||
break;
|
||||
default:
|
||||
size = 2;
|
||||
}
|
||||
// uint32_t size;
|
||||
// switch(pfhdr->spi_size) {
|
||||
// case ESP_IMAGE_FLASH_SIZE_1MB:
|
||||
// size = 1;
|
||||
// break;
|
||||
// case ESP_IMAGE_FLASH_SIZE_2MB:
|
||||
// case ESP_IMAGE_FLASH_SIZE_2MB_C1:
|
||||
// size = 2;
|
||||
// break;
|
||||
// case ESP_IMAGE_FLASH_SIZE_4MB:
|
||||
// case ESP_IMAGE_FLASH_SIZE_4MB_C1:
|
||||
// size = 4;
|
||||
// break;
|
||||
// case ESP_IMAGE_FLASH_SIZE_8MB:
|
||||
// size = 8;
|
||||
// break;
|
||||
// case ESP_IMAGE_FLASH_SIZE_16MB:
|
||||
// size = 16;
|
||||
// break;
|
||||
// default:
|
||||
// size = 2;
|
||||
// }
|
||||
|
||||
// Set flash chip size
|
||||
// esp_rom_spiflash_config_param(g_rom_flashchip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff);
|
||||
|
@ -482,9 +482,12 @@ static void set_cache_and_start_app(
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/param.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bootloader_config.h"
|
||||
#include "bootloader_utility.h"
|
||||
#include "bootloader_flash.h"
|
||||
#include "bootloader_common.h"
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
@ -536,7 +539,7 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs)
|
||||
esp_partition_info_t partiton_local;
|
||||
esp_partition_info_t *partition = &partiton_local;
|
||||
|
||||
memcpy(&partiton_local, (intptr_t)partitions + i * sizeof(esp_partition_info_t), sizeof(esp_partition_info_t));
|
||||
memcpy(&partiton_local, (void *)((intptr_t)partitions + i * sizeof(esp_partition_info_t)), sizeof(esp_partition_info_t));
|
||||
|
||||
ESP_LOGD(TAG, "load partition table entry 0x%x", (intptr_t)partition);
|
||||
ESP_LOGD(TAG, "type=%x subtype=%x", partition->type, partition->subtype);
|
||||
@ -774,6 +777,9 @@ bool bootloader_utility_load_boot_image(const bootloader_state_t *bs, int start_
|
||||
|
||||
void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
|
||||
{
|
||||
void (*user_start)(size_t start_addr, size_t map);
|
||||
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
|
||||
|
||||
#if defined(CONFIG_SECURE_BOOT_ENABLED) || defined(CONFIG_FLASH_ENCRYPTION_ENABLED)
|
||||
esp_err_t err;
|
||||
#endif
|
||||
@ -834,8 +840,6 @@ void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
|
||||
|
||||
Cache_Read_Enable(map, 0, 0);
|
||||
|
||||
void (*user_start)(size_t start_addr, size_t map);
|
||||
|
||||
user_start = (void *)image_data->image.entry_addr;
|
||||
user_start(image_data->start_addr, map);
|
||||
#endif /* BOOTLOADER_UNPACK_APP */
|
||||
|
@ -94,6 +94,7 @@ esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition
|
||||
#ifdef CONFIG_TARGET_PLATFORM_ESP8266
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bootloader_config.h"
|
||||
|
||||
@ -115,7 +116,7 @@ esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition
|
||||
esp_partition_info_t part_local;
|
||||
esp_partition_info_t *part = &part_local;//partition_table[num_parts];
|
||||
|
||||
memcpy(&part_local, (intptr_t)partition_table + num_parts * sizeof(esp_partition_info_t), sizeof(esp_partition_info_t));
|
||||
memcpy(&part_local, (void *)((intptr_t)partition_table + num_parts * sizeof(esp_partition_info_t)), sizeof(esp_partition_info_t));
|
||||
|
||||
if (part->magic == ESP_PARTITION_MAGIC) {
|
||||
const esp_partition_pos_t *pos = &part->pos;
|
||||
|
@ -66,9 +66,3 @@ endif
|
||||
|
||||
# global CFLAGS for ESP8266
|
||||
CFLAGS += -DMEMLEAK_DEBUG -DICACHE_FLASH
|
||||
|
||||
# void compiler error, we should remove these later
|
||||
CFLAGS += -Wno-error=char-subscripts -Wno-error=unknown-pragmas -Wno-error=implicit-function-declaration \
|
||||
-Wno-error=pointer-sign -Wno-error=switch -Wno-error=maybe-uninitialized -Wno-error=format= \
|
||||
-Wno-error=unused-value -Wno-error=address -Wno-error=return-type -Wno-error=format-extra-args \
|
||||
-Wno-error=format-zero-length -Wno-error=unused-label -Wno-error=sizeof-pointer-memaccess
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp8266/pin_mux_register.h"
|
||||
#include "esp8266/uart_register.h"
|
||||
|
@ -12,10 +12,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "stdlib.h"
|
||||
|
||||
#include "esp_attr.h"
|
||||
#include "esp_libc.h"
|
||||
|
||||
#include "esp8266/eagle_soc.h"
|
||||
#include "esp8266/rom_functions.h"
|
||||
#include "rom/ets_sys.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/timeouts.h"
|
||||
#include "dhcpserver/dhcpserver.h"
|
||||
#include "dhcpserver/dhcpserver_options.h"
|
||||
|
||||
@ -1154,7 +1155,7 @@ void dhcps_start(struct netif *netif, ip4_addr_t ip)
|
||||
|
||||
udp_bind(pcb_dhcps, &netif->ip_addr, DHCPS_SERVER_PORT);
|
||||
udp_recv(pcb_dhcps, handle_dhcp, NULL);
|
||||
sys_timeout(1000, dhcps_coarse_tmr, NULL);
|
||||
sys_timeout(1000, (sys_timeout_handler)dhcps_coarse_tmr, NULL);
|
||||
#if DHCPS_DEBUG
|
||||
DHCPS_LOG("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n");
|
||||
#endif
|
||||
@ -1176,7 +1177,7 @@ void dhcps_stop(struct netif *netif)
|
||||
return;
|
||||
}
|
||||
|
||||
sys_untimeout(dhcps_coarse_tmr, NULL);
|
||||
sys_untimeout((sys_timeout_handler)dhcps_coarse_tmr, NULL);
|
||||
|
||||
if (pcb_dhcps != NULL) {
|
||||
udp_disconnect(pcb_dhcps);
|
||||
@ -1273,7 +1274,7 @@ void dhcps_coarse_tmr(void)
|
||||
|
||||
/*Do not restart timer when dhcp server is stopped*/
|
||||
if (pcb_dhcps != NULL) {
|
||||
sys_timeout(1000, dhcps_coarse_tmr, NULL);
|
||||
sys_timeout(1000, (sys_timeout_handler)dhcps_coarse_tmr, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ COMPONENT_SRCDIRS += apps/dhcpserver \
|
||||
CFLAGS += -Wno-address #lots of LWIP source files evaluate macros that check address of stack variables
|
||||
|
||||
lwip/src/apps/sntp/sntp.o: CFLAGS += -Wno-implicit-function-declaration
|
||||
lwip/src/core/ipv4/ip4.o: CFLAGS += -Wno-implicit-function-declaration
|
||||
|
||||
ifdef CONFIG_LWIP_SOCKET_MULTITHREAD
|
||||
COMPONENT_OBJEXCLUDE := lwip/src/api/sockets.o
|
||||
|
@ -1900,7 +1900,7 @@ void *memp_malloc_ll(size_t type);
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
#define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook
|
||||
#define LWIP_HOOK_IP4_ROUTE_SRC(d, s) (void *)ip4_route_src_hook(d, s)
|
||||
|
||||
/**
|
||||
* @defgroup lwip_opts_hooks Hooks
|
||||
|
@ -42,6 +42,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/unistd.h>
|
||||
|
||||
#include "rom/ets_sys.h"
|
||||
|
||||
#if 0
|
||||
#define ssl_printf(fmt, args...) printf(fmt,## args)
|
||||
@ -49,6 +55,10 @@ extern "C" {
|
||||
#define ssl_printf(fmt, args...)
|
||||
#endif
|
||||
|
||||
void *zalloc(size_t n);
|
||||
uint32_t system_get_data_of_array_8(const uint8_t*, uint8_t);
|
||||
void system_get_string_from_flash(const char *, char *, size_t n);
|
||||
|
||||
#define STDCALL
|
||||
#define EXP_FUNC
|
||||
|
||||
@ -89,11 +99,11 @@ static __inline__ uint64_t be64toh(uint64_t __x) {return (((uint64_t)be32toh(__x
|
||||
#endif
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
#define SSL_MALLOC(size) ax_malloc(size, __FILE__, __LINE__)
|
||||
#define SSL_REALLOC(mem_ref,size) ax_realloc(mem_ref, size, __FILE__, __LINE__)
|
||||
#define SSL_CALLOC(element, size) ax_calloc(element, size, __FILE__, __LINE__)
|
||||
#define SSL_ZALLOC(size) ax_zalloc(size, __FILE__, __LINE__)
|
||||
#define SSL_FREE(mem_ref) ax_free(mem_ref, __FILE__, __LINE__)
|
||||
#define SSL_MALLOC(size) os_malloc(size)
|
||||
#define SSL_REALLOC(mem_ref,size) os_realloc(mem_ref, size)
|
||||
#define SSL_CALLOC(element, size) os_calloc(element, size)
|
||||
#define SSL_ZALLOC(size) os_zalloc(size)
|
||||
#define SSL_FREE(mem_ref) os_free(mem_ref)
|
||||
#else
|
||||
#define SSL_MALLOC(size) malloc(size)
|
||||
#define SSL_REALLOC(mem_ref,size) realloc(mem_ref, size)
|
||||
|
@ -266,6 +266,7 @@ int get_random_NZ(int num_rand_bytes, uint8_t *rand_data)
|
||||
int hex_finish;
|
||||
int hex_index;
|
||||
|
||||
#if 0
|
||||
static void print_hex_init(int finish)
|
||||
{
|
||||
hex_finish = finish;
|
||||
@ -297,6 +298,7 @@ static void print_hex(uint8_t hex)
|
||||
ssl_printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Spit out a blob of data for diagnostics. The data is is a nice column format
|
||||
@ -402,8 +404,9 @@ EXP_FUNC int STDCALL base64_decode(const char *in, int len,
|
||||
|
||||
error:
|
||||
#ifdef CONFIG_SSL_FULL_MODE
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
ssl_printf("Error: Invalid base64\n"); //TTY_FLUSH();
|
||||
}
|
||||
#endif
|
||||
//TTY_FLUSH();
|
||||
SSL_FREE(base64_map);
|
||||
|
@ -224,6 +224,8 @@ static int pem_decrypt(const char *where, const char *end,
|
||||
MD5_CTX md5_ctx;
|
||||
AES_CTX aes_ctx;
|
||||
uint8_t key[32]; /* AES256 size */
|
||||
char *aes_str_0_ram = NULL;
|
||||
char *aes_str_1_ram = NULL;
|
||||
|
||||
if (password == NULL || strlen(password) == 0)
|
||||
{
|
||||
@ -233,8 +235,8 @@ static int pem_decrypt(const char *where, const char *end,
|
||||
goto error;
|
||||
}
|
||||
|
||||
char *aes_str_0_ram = (char *)SSL_MALLOC(24);
|
||||
char *aes_str_1_ram = (char *)SSL_MALLOC(24);
|
||||
aes_str_0_ram = (char *)SSL_MALLOC(24);
|
||||
aes_str_1_ram = (char *)SSL_MALLOC(24);
|
||||
|
||||
system_get_string_from_flash(aes_str[0], aes_str_0_ram, 24);
|
||||
system_get_string_from_flash(aes_str[1], aes_str_1_ram, 24);
|
||||
|
@ -88,14 +88,14 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size)
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char * out_of_mem_str = "out of memory %s %d\n";
|
||||
//static const char * out_of_mem_str = "out of memory %s %d\n";
|
||||
|
||||
#define exit_now printf
|
||||
//#define SSL_LOG
|
||||
#ifdef SSL_LOG
|
||||
#define debug_now printf
|
||||
#else
|
||||
#define debug_now
|
||||
#define debug_now(fmt, ...)
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
@ -184,6 +184,8 @@ EXP_FUNC int STDCALL esp_base64_encode(uint8_t *dst, size_t dlen, size_t *olen,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *key_password = NULL;
|
||||
@ -1098,11 +1100,11 @@ void esp_ssl_sleep(uint16_t mseconds)
|
||||
vTaskDelay(mseconds / portTICK_RATE_MS);
|
||||
}
|
||||
|
||||
esp_ssl_CTX_set_client_cert_cb(){}
|
||||
void esp_ssl_CTX_set_client_cert_cb(){}
|
||||
|
||||
esp_ssl_CTX_set_mode(){}
|
||||
void esp_ssl_CTX_set_mode(){}
|
||||
|
||||
esp_ssl_pending()
|
||||
void esp_ssl_pending()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -54,8 +54,9 @@ EXP_FUNC SSL * STDCALL ssl_server_new(SSL_CTX *ssl_ctx, int client_fd)
|
||||
ssl->next_state = HS_CLIENT_HELLO;
|
||||
|
||||
#ifdef CONFIG_SSL_FULL_MODE
|
||||
if (ssl_ctx->chain_length == 0)
|
||||
if (ssl_ctx->chain_length == 0) {
|
||||
ssl_printf("Warning - no server certificate defined\n"); //TTY_FLUSH();
|
||||
}
|
||||
#endif
|
||||
|
||||
return ssl;
|
||||
|
@ -491,7 +491,7 @@ end_verify:
|
||||
/**
|
||||
* Used for diagnostics.
|
||||
*/
|
||||
static const char *not_part_of_cert = "<Not Part Of Certificate>";
|
||||
//static const char *not_part_of_cert = "<Not Part Of Certificate>";
|
||||
void x509_print(const X509_CTX *cert, CA_CERT_CTX *ca_cert_ctx)
|
||||
{
|
||||
if (cert == NULL)
|
||||
|
Reference in New Issue
Block a user