Merge branch 'bugfix/bootloader_header_align_v4.1' into 'release/v4.1'

bootloader: Force bootloader_image_hdr to be word aligned (v4.1)

See merge request espressif/esp-idf!9068
This commit is contained in:
Angus Gratton 2020-06-05 07:28:35 +08:00
commit aa6481837f
2 changed files with 4 additions and 2 deletions

View file

@ -14,6 +14,7 @@
#include <string.h>
#include <stdint.h>
#include "sdkconfig.h"
#include "esp_attr.h"
#include "esp_log.h"
#include "bootloader_init.h"
#include "bootloader_flash.h"
@ -30,7 +31,7 @@
static const char *TAG = "boot";
esp_image_header_t bootloader_image_hdr;
esp_image_header_t WORD_ALIGNED_ATTR bootloader_image_hdr;
void bootloader_clear_bss_section(void)
{

View file

@ -18,6 +18,7 @@
#include <esp_secure_boot.h>
#include <esp_fault.h>
#include <esp_log.h>
#include <esp_attr.h>
#include <esp_spi_flash.h>
#include <bootloader_flash.h>
#include <bootloader_random.h>
@ -722,7 +723,7 @@ static esp_err_t verify_checksum(bootloader_sha256_handle_t sha_handle, uint32_t
length = (length + 15) & ~15; // Pad to next full 16 byte block
// Verify checksum
uint8_t buf[16];
WORD_ALIGNED_ATTR uint8_t buf[16];
esp_err_t err = bootloader_flash_read(data->start_addr + unpadded_length, buf, length - unpadded_length, true);
uint8_t calc = buf[length - unpadded_length - 1];
uint8_t checksum = (checksum_word >> 24)