Skip to content

Commit d59e766

Browse files
committed
Merge branch 'bugfix/fix_compile_warning' into 'master'
Fix compile warning See merge request sdk/ESP8266_RTOS_SDK!363
2 parents 7c46284 + 520b213 commit d59e766

File tree

28 files changed

+99
-70
lines changed

28 files changed

+99
-70
lines changed

components/bootloader/subproject/main/bootloader_start.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
#include "sdkconfig.h"
1616

17+
#include <string.h>
1718
#include "bootloader_config.h"
1819
#include "bootloader_init.h"
19-
20+
#include "bootloader_utility.h"
2021
#include "esp_image_format.h"
2122
#include "esp_log.h"
2223

components/bootloader_support/src/bootloader_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,10 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat
167167

168168
#include "esp_err.h"
169169
#include "esp_log.h"
170+
#include "crc.h"
170171

171172
#include "bootloader_config.h"
172173

173-
static const char* TAG = "boot_comm";
174-
175174
uint32_t bootloader_common_ota_select_crc(const esp_ota_select_entry_t *s)
176175
{
177176
return crc32_le(UINT32_MAX, (uint8_t*)&s->ota_seq, 4);

components/bootloader_support/src/bootloader_flash.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ esp_err_t bootloader_flash_erase_sector(size_t sector)
264264
#include "esp_err.h"
265265
#include "esp_log.h"
266266

267+
extern void Cache_Read_Disable();
268+
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
269+
267270
static const char *TAG = "bootloader_flash";
268271

269272
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
335338

336339
esp_err_t bootloader_flash_write(size_t dest_addr, void *src, size_t size, bool write_encrypted)
337340
{
338-
esp_err_t err;
339341
size_t alignment = write_encrypted ? 32 : 4;
340342
if ((dest_addr % alignment) != 0) {
341343
ESP_LOGE(TAG, "bootloader_flash_write dest_addr 0x%x not %d-byte aligned", dest_addr, alignment);

components/bootloader_support/src/bootloader_init.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ void __assert_func(const char *file, int line, const char *func, const char *exp
545545

546546
#include "esp_image_format.h"
547547
#include "esp_flash_partitions.h"
548+
#include "bootloader_flash.h"
548549

549550
extern int _bss_start;
550551
extern int _bss_end;
@@ -589,28 +590,28 @@ static esp_err_t bootloader_main()
589590

590591
static void update_flash_config(const esp_image_header_t* pfhdr)
591592
{
592-
uint32_t size;
593-
switch(pfhdr->spi_size) {
594-
case ESP_IMAGE_FLASH_SIZE_1MB:
595-
size = 1;
596-
break;
597-
case ESP_IMAGE_FLASH_SIZE_2MB:
598-
case ESP_IMAGE_FLASH_SIZE_2MB_C1:
599-
size = 2;
600-
break;
601-
case ESP_IMAGE_FLASH_SIZE_4MB:
602-
case ESP_IMAGE_FLASH_SIZE_4MB_C1:
603-
size = 4;
604-
break;
605-
case ESP_IMAGE_FLASH_SIZE_8MB:
606-
size = 8;
607-
break;
608-
case ESP_IMAGE_FLASH_SIZE_16MB:
609-
size = 16;
610-
break;
611-
default:
612-
size = 2;
613-
}
593+
// uint32_t size;
594+
// switch(pfhdr->spi_size) {
595+
// case ESP_IMAGE_FLASH_SIZE_1MB:
596+
// size = 1;
597+
// break;
598+
// case ESP_IMAGE_FLASH_SIZE_2MB:
599+
// case ESP_IMAGE_FLASH_SIZE_2MB_C1:
600+
// size = 2;
601+
// break;
602+
// case ESP_IMAGE_FLASH_SIZE_4MB:
603+
// case ESP_IMAGE_FLASH_SIZE_4MB_C1:
604+
// size = 4;
605+
// break;
606+
// case ESP_IMAGE_FLASH_SIZE_8MB:
607+
// size = 8;
608+
// break;
609+
// case ESP_IMAGE_FLASH_SIZE_16MB:
610+
// size = 16;
611+
// break;
612+
// default:
613+
// size = 2;
614+
// }
614615

615616
// Set flash chip size
616617
// esp_rom_spiflash_config_param(g_rom_flashchip.device_id, size * 0x100000, 0x10000, 0x1000, 0x100, 0xffff);

components/bootloader_support/src/bootloader_utility.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,12 @@ static void set_cache_and_start_app(
482482

483483
#include <stdbool.h>
484484
#include <sys/param.h>
485+
#include <string.h>
485486

486487
#include "bootloader_config.h"
487488
#include "bootloader_utility.h"
489+
#include "bootloader_flash.h"
490+
#include "bootloader_common.h"
488491

489492
#include "esp_err.h"
490493
#include "esp_log.h"
@@ -536,7 +539,7 @@ bool bootloader_utility_load_partition_table(bootloader_state_t* bs)
536539
esp_partition_info_t partiton_local;
537540
esp_partition_info_t *partition = &partiton_local;
538541

539-
memcpy(&partiton_local, (intptr_t)partitions + i * sizeof(esp_partition_info_t), sizeof(esp_partition_info_t));
542+
memcpy(&partiton_local, (void *)((intptr_t)partitions + i * sizeof(esp_partition_info_t)), sizeof(esp_partition_info_t));
540543

541544
ESP_LOGD(TAG, "load partition table entry 0x%x", (intptr_t)partition);
542545
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_
774777

775778
void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
776779
{
780+
void (*user_start)(size_t start_addr, size_t map);
781+
extern void Cache_Read_Enable(uint8_t map, uint8_t p, uint8_t v);
782+
777783
#if defined(CONFIG_SECURE_BOOT_ENABLED) || defined(CONFIG_FLASH_ENCRYPTION_ENABLED)
778784
esp_err_t err;
779785
#endif
@@ -834,8 +840,6 @@ void bootloader_utility_load_image(const esp_image_metadata_t* image_data)
834840

835841
Cache_Read_Enable(map, 0, 0);
836842

837-
void (*user_start)(size_t start_addr, size_t map);
838-
839843
user_start = (void *)image_data->image.entry_addr;
840844
user_start(image_data->start_addr, map);
841845
#endif /* BOOTLOADER_UNPACK_APP */

components/bootloader_support/src/flash_partitions.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition
9494
#ifdef CONFIG_TARGET_PLATFORM_ESP8266
9595

9696
#include <stdbool.h>
97+
#include <string.h>
9798

9899
#include "bootloader_config.h"
99100

@@ -115,7 +116,7 @@ esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition
115116
esp_partition_info_t part_local;
116117
esp_partition_info_t *part = &part_local;//partition_table[num_parts];
117118

118-
memcpy(&part_local, (intptr_t)partition_table + num_parts * sizeof(esp_partition_info_t), sizeof(esp_partition_info_t));
119+
memcpy(&part_local, (void *)((intptr_t)partition_table + num_parts * sizeof(esp_partition_info_t)), sizeof(esp_partition_info_t));
119120

120121
if (part->magic == ESP_PARTITION_MAGIC) {
121122
const esp_partition_pos_t *pos = &part->pos;

components/esp8266/Makefile.projbuild

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,3 @@ endif
6666

6767
# global CFLAGS for ESP8266
6868
CFLAGS += -DMEMLEAK_DEBUG -DICACHE_FLASH
69-
70-
# void compiler error, we should remove these later
71-
CFLAGS += -Wno-error=char-subscripts -Wno-error=unknown-pragmas -Wno-error=implicit-function-declaration \
72-
-Wno-error=pointer-sign -Wno-error=switch -Wno-error=maybe-uninitialized -Wno-error=format= \
73-
-Wno-error=unused-value -Wno-error=address -Wno-error=return-type -Wno-error=format-extra-args \
74-
-Wno-error=format-zero-length -Wno-error=unused-label -Wno-error=sizeof-pointer-memaccess

components/esp8266/driver/uart.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <stdint.h>
1616
#include <stddef.h>
1717
#include <stdbool.h>
18+
#include <stdio.h>
1819

1920
#include "esp8266/pin_mux_register.h"
2021
#include "esp8266/uart_register.h"

components/freertos/port/esp8266/panic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#include "stdlib.h"
16+
1517
#include "esp_attr.h"
1618
#include "esp_libc.h"
1719

1820
#include "esp8266/eagle_soc.h"
21+
#include "esp8266/rom_functions.h"
1922
#include "rom/ets_sys.h"
2023
#include "esp_err.h"
2124

components/lwip/apps/dhcpserver/dhcpserver.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "lwip/pbuf.h"
2828
#include "lwip/udp.h"
2929
#include "lwip/mem.h"
30+
#include "lwip/timeouts.h"
3031
#include "dhcpserver/dhcpserver.h"
3132
#include "dhcpserver/dhcpserver_options.h"
3233

@@ -1154,7 +1155,7 @@ void dhcps_start(struct netif *netif, ip4_addr_t ip)
11541155

11551156
udp_bind(pcb_dhcps, &netif->ip_addr, DHCPS_SERVER_PORT);
11561157
udp_recv(pcb_dhcps, handle_dhcp, NULL);
1157-
sys_timeout(1000, dhcps_coarse_tmr, NULL);
1158+
sys_timeout(1000, (sys_timeout_handler)dhcps_coarse_tmr, NULL);
11581159
#if DHCPS_DEBUG
11591160
DHCPS_LOG("dhcps:dhcps_start->udp_recv function Set a receive callback handle_dhcp for UDP_PCB pcb_dhcps\n");
11601161
#endif
@@ -1176,7 +1177,7 @@ void dhcps_stop(struct netif *netif)
11761177
return;
11771178
}
11781179

1179-
sys_untimeout(dhcps_coarse_tmr, NULL);
1180+
sys_untimeout((sys_timeout_handler)dhcps_coarse_tmr, NULL);
11801181

11811182
if (pcb_dhcps != NULL) {
11821183
udp_disconnect(pcb_dhcps);
@@ -1273,7 +1274,7 @@ void dhcps_coarse_tmr(void)
12731274

12741275
/*Do not restart timer when dhcp server is stopped*/
12751276
if (pcb_dhcps != NULL) {
1276-
sys_timeout(1000, dhcps_coarse_tmr, NULL);
1277+
sys_timeout(1000, (sys_timeout_handler)dhcps_coarse_tmr, NULL);
12771278
}
12781279
}
12791280

components/lwip/component.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ COMPONENT_SRCDIRS += apps/dhcpserver \
2020
CFLAGS += -Wno-address #lots of LWIP source files evaluate macros that check address of stack variables
2121

2222
lwip/src/apps/sntp/sntp.o: CFLAGS += -Wno-implicit-function-declaration
23+
lwip/src/core/ipv4/ip4.o: CFLAGS += -Wno-implicit-function-declaration
2324

2425
ifdef CONFIG_LWIP_SOCKET_MULTITHREAD
2526
COMPONENT_OBJEXCLUDE := lwip/src/api/sockets.o

components/lwip/port/esp8266/include/lwipopts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ void *memp_malloc_ll(size_t type);
19001900
---------------------------------------
19011901
*/
19021902

1903-
#define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook
1903+
#define LWIP_HOOK_IP4_ROUTE_SRC(d, s) (void *)ip4_route_src_hook(d, s)
19041904

19051905
/**
19061906
* @defgroup lwip_opts_hooks Hooks

components/ssl/axtls/include/ssl/ssl_os_port.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ extern "C" {
4242
#endif
4343

4444
#include <stdint.h>
45+
#include <string.h>
46+
#include <stdlib.h>
47+
#include <stdio.h>
48+
#include <sys/unistd.h>
49+
50+
#include "rom/ets_sys.h"
4551

4652
#if 0
4753
#define ssl_printf(fmt, args...) printf(fmt,## args)
4854
#else
4955
#define ssl_printf(fmt, args...)
5056
#endif
5157

58+
void *zalloc(size_t n);
59+
uint32_t system_get_data_of_array_8(const uint8_t*, uint8_t);
60+
void system_get_string_from_flash(const char *, char *, size_t n);
61+
5262
#define STDCALL
5363
#define EXP_FUNC
5464

@@ -89,11 +99,11 @@ static __inline__ uint64_t be64toh(uint64_t __x) {return (((uint64_t)be32toh(__x
8999
#endif
90100

91101
#ifdef MEMLEAK_DEBUG
92-
#define SSL_MALLOC(size) ax_malloc(size, __FILE__, __LINE__)
93-
#define SSL_REALLOC(mem_ref,size) ax_realloc(mem_ref, size, __FILE__, __LINE__)
94-
#define SSL_CALLOC(element, size) ax_calloc(element, size, __FILE__, __LINE__)
95-
#define SSL_ZALLOC(size) ax_zalloc(size, __FILE__, __LINE__)
96-
#define SSL_FREE(mem_ref) ax_free(mem_ref, __FILE__, __LINE__)
102+
#define SSL_MALLOC(size) os_malloc(size)
103+
#define SSL_REALLOC(mem_ref,size) os_realloc(mem_ref, size)
104+
#define SSL_CALLOC(element, size) os_calloc(element, size)
105+
#define SSL_ZALLOC(size) os_zalloc(size)
106+
#define SSL_FREE(mem_ref) os_free(mem_ref)
97107
#else
98108
#define SSL_MALLOC(size) malloc(size)
99109
#define SSL_REALLOC(mem_ref,size) realloc(mem_ref, size)

components/ssl/axtls/source/crypto/ssl_crypto_misc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ int get_random_NZ(int num_rand_bytes, uint8_t *rand_data)
266266
int hex_finish;
267267
int hex_index;
268268

269+
#if 0
269270
static void print_hex_init(int finish)
270271
{
271272
hex_finish = finish;
@@ -297,6 +298,7 @@ static void print_hex(uint8_t hex)
297298
ssl_printf("\n");
298299
}
299300
}
301+
#endif
300302

301303
/**
302304
* 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,
402404

403405
error:
404406
#ifdef CONFIG_SSL_FULL_MODE
405-
if (ret < 0)
407+
if (ret < 0) {
406408
ssl_printf("Error: Invalid base64\n"); //TTY_FLUSH();
409+
}
407410
#endif
408411
//TTY_FLUSH();
409412
SSL_FREE(base64_map);

components/ssl/axtls/source/ssl/ssl_loader.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ static int pem_decrypt(const char *where, const char *end,
224224
MD5_CTX md5_ctx;
225225
AES_CTX aes_ctx;
226226
uint8_t key[32]; /* AES256 size */
227+
char *aes_str_0_ram = NULL;
228+
char *aes_str_1_ram = NULL;
227229

228230
if (password == NULL || strlen(password) == 0)
229231
{
@@ -233,8 +235,8 @@ static int pem_decrypt(const char *where, const char *end,
233235
goto error;
234236
}
235237

236-
char *aes_str_0_ram = (char *)SSL_MALLOC(24);
237-
char *aes_str_1_ram = (char *)SSL_MALLOC(24);
238+
aes_str_0_ram = (char *)SSL_MALLOC(24);
239+
aes_str_1_ram = (char *)SSL_MALLOC(24);
238240

239241
system_get_string_from_flash(aes_str[0], aes_str_0_ram, 24);
240242
system_get_string_from_flash(aes_str[1], aes_str_1_ram, 24);

components/ssl/axtls/source/ssl/ssl_os_port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size)
8888
}
8989
#endif
9090

91-
static const char * out_of_mem_str = "out of memory %s %d\n";
91+
//static const char * out_of_mem_str = "out of memory %s %d\n";
9292

9393
#define exit_now printf
9494
//#define SSL_LOG
9595
#ifdef SSL_LOG
9696
#define debug_now printf
9797
#else
98-
#define debug_now
98+
#define debug_now(fmt, ...)
9999
#endif
100100

101101
#if 0

components/ssl/axtls/source/ssl/ssl_platform.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ EXP_FUNC int STDCALL esp_base64_encode(uint8_t *dst, size_t dlen, size_t *olen,
184184

185185
return 0;
186186
}
187+
188+
return 0;
187189
}
188190

189191
static char *key_password = NULL;
@@ -1098,11 +1100,11 @@ void esp_ssl_sleep(uint16_t mseconds)
10981100
vTaskDelay(mseconds / portTICK_RATE_MS);
10991101
}
11001102

1101-
esp_ssl_CTX_set_client_cert_cb(){}
1103+
void esp_ssl_CTX_set_client_cert_cb(){}
11021104

1103-
esp_ssl_CTX_set_mode(){}
1105+
void esp_ssl_CTX_set_mode(){}
11041106

1105-
esp_ssl_pending()
1107+
void esp_ssl_pending()
11061108
{
11071109

11081110
}

components/ssl/axtls/source/ssl/ssl_tls1_svr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ EXP_FUNC SSL * STDCALL ssl_server_new(SSL_CTX *ssl_ctx, int client_fd)
5454
ssl->next_state = HS_CLIENT_HELLO;
5555

5656
#ifdef CONFIG_SSL_FULL_MODE
57-
if (ssl_ctx->chain_length == 0)
57+
if (ssl_ctx->chain_length == 0) {
5858
ssl_printf("Warning - no server certificate defined\n"); //TTY_FLUSH();
59+
}
5960
#endif
6061

6162
return ssl;

components/ssl/axtls/source/ssl/ssl_x509.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ int x509_verify(const CA_CERT_CTX *ca_cert_ctx, const X509_CTX *cert)
491491
/**
492492
* Used for diagnostics.
493493
*/
494-
static const char *not_part_of_cert = "<Not Part Of Certificate>";
494+
//static const char *not_part_of_cert = "<Not Part Of Certificate>";
495495
void x509_print(const X509_CTX *cert, CA_CERT_CTX *ca_cert_ctx)
496496
{
497497
if (cert == NULL)

0 commit comments

Comments
 (0)