From 5baa048cbb26069c11dccdb731565ca9981c8cc5 Mon Sep 17 00:00:00 2001 From: Alex Stewart Date: Sun, 30 Aug 2015 13:37:40 -0700 Subject: [PATCH] app_main.c: load correct g_ic sector from flash --- core/app_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/app_main.c b/core/app_main.c index 3136b2a..1989234 100644 --- a/core/app_main.c +++ b/core/app_main.c @@ -239,11 +239,11 @@ void IRAM sdk_user_start(void) { sdk_flashchip.chip_size = flash_size; set_spi0_divisor(flash_speed_divisor); sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE); - boot_slot = buf8[0] & 1; + boot_slot = buf8[0] ? 1 : 0; cksum_magic = buf32[1]; cksum_len = buf32[3 + boot_slot]; cksum_value = buf32[5 + boot_slot]; - ic_flash_addr = (flash_sectors - 2 + boot_slot) * sdk_flashchip.sector_size; + ic_flash_addr = (flash_sectors - 3 + boot_slot) * sdk_flashchip.sector_size; sdk_SPIRead(ic_flash_addr, buf32, sizeof(struct sdk_g_ic_saved_st)); Cache_Read_Enable(0, 0, 1); zero_bss();