Code:
/*
* Debuging app that crashes with fatal exception when compiled fo OTA.
* Compiled fo non-OTA: works
* Compiled for OTA (bootloader 1.7): fatal exception right after boot. Due to PWM lib ?
*/
#include "osapi.h"
#include "os_type.h"
#include "user_interface.h"
#include "gpio.h"
#include "pwm.h"
#include "espconn.h"
#include "driver/i2c_master.h"
void PostInitCb(void);
uint32 user_rf_cal_sector_set(void);
void user_init(void);
/**
* @brief Called when system is fully initialized.
*/
void PostInitCb(void)
{
os_printf("PostInitCb() !\n");
/* Force references to functions from the libs without calling them */
volatile bool tt = false;
if(tt)
{
pwm_start(); /* Uncommented: crash ! */
gpio_init(); /* Uncommented or commented: ok */
espconn_secure_set_size(ESPCONN_CLIENT, 5120); /* Uncommented or commented: depends on gc-section */
i2c_master_gpio_init(); /* Uncommented or commented: ok */
}
}
/**
* @brief Was present in IoT_Demo/user/user_main.c on which this code is based...
*/
uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void)
{
os_printf("BB!\n");
enum flash_size_map size_map = system_get_flash_size_map();
uint32 rf_cal_sec = 0;
switch (size_map) {
case FLASH_SIZE_4M_MAP_256_256:
rf_cal_sec = 128 - 5;
break;
case FLASH_SIZE_8M_MAP_512_512:
rf_cal_sec = 256 - 5;
break;
case FLASH_SIZE_16M_MAP_512_512:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_32M_MAP_512_512:
rf_cal_sec = 1024 - 5;
break;
case FLASH_SIZE_32M_MAP_1024_1024:
rf_cal_sec = 1024 - 5;
break;
case FLASH_SIZE_64M_MAP_1024_1024:
rf_cal_sec = 2048 - 5;
break;
case FLASH_SIZE_128M_MAP_1024_1024:
rf_cal_sec = 4096 - 5;
break;
default:
rf_cal_sec = 0;
break;
}
return rf_cal_sec;
}
/**
* @brief Main entry point of our programm
*/
void user_init(void)
{
os_printf("AA!\n");
system_init_done_cb(PostInitCb);
}
Statistics: Posted by Pato — Wed Aug 29, 2018 1:09 am