fix(components): Fix all components's compile warning and enable warning checking

This commit is contained in:
Dong Heng
2018-08-07 13:00:43 +08:00
parent 7c46284f50
commit 35ee995327
19 changed files with 81 additions and 55 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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;