I'm newbie and i'm beginning in esp8266 via blinky project. I'm in trouble with sdk flash and i need help. I don't know what happen when i build project failed. Everything is ok when i use arduino. This is my walkthough and my code.
Please tell me where i'm wrong.
I’m using ESP SDK NonOS 2.1.0, Firmware have OTA and esp D1 mini board
#include <ets_sys.h>
#include <osapi.h>
#include <gpio.h>
#include "user_interface.h"
// see eagle_soc.h for these definitions
#define LED_GPIO 2
#define LED_GPIO_MUX PERIPHS_IO_MUX_GPIO2_U
#define LED_GPIO_FUNC FUNC_GPIO2
#define DELAY 50000 /* microseconds */
extern void ets_wdt_enable (void);
extern void ets_wdt_disable (void);
void user_init(void)
{
uint8_t state=0;
ets_wdt_enable();
ets_wdt_disable();
// Configure pin as a GPIO
PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC);
for(;;)
{
GPIO_OUTPUT_SET(LED_GPIO, state);
os_delay_us(DELAY);
state ^=1;
}
}
uint32 ICACHE_FLASH_ATTR
user_rf_cal_sector_set(void)
{
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:
case FLASH_SIZE_16M_MAP_1024_1024:
rf_cal_sec = 512 - 5;
break;
case FLASH_SIZE_32M_MAP_512_512:
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;
}
void ICACHE_FLASH_ATTR
user_rf_pre_init(void)
{
}
- Building by Eclipse
- Building by makefile
- Flashing by esp flash tool
- Flashing by esptool.py
- Result : Nothing happened! Led just light