Compiling my application in eclipse works fine. Then I upload this application to my ESP-01 module using esptool.py on Raspberry Pi. Uploading seems to be successful as well, but the problem is that application does not seem to run on EPS8266 as the LED does not blink.
I know that uploading applications with Raspberry works fine because I can upload binary files compiled with Arduino IDE on Windows and it works. So basically there is no difference in the upload side (Raspberry side), except the file used to flash the ESP8266.
So I'm wondering what is the issue. I have few ideas which I've explored but have not been able to solve the problem:
1. Wrong settings in make menuconfig maybe? I'm not really sure what settings I should check - I just checked that flash size, flash speed, CPU clock and crystal frequency are as in Arduino IDE (1MB, 80MHz, 40MHz, 26MHz). Is there anything else that I should change?
2. Maybe my code is wrong? I know for sure that LED is connected to GPIO1. Other than that I don't really know what could be wrong in the code. I've attached my main.c file.
3. Am I uploading the correct binary file from eclipse? The binary file to be uploaded is .../esp-idf-template/build/app-template.bin right? There are other binary files as well, but these seem to be too small.
4. When uploading Eclipse compiled binary I see esptool.py output following text which is not output when I upload Arduino IDE compiled binary:
WARNING: Suspicious segment 0x40210010, length 82912
WARNING: Suspicious segment 0x402243f0, length 22968
Flash params set to 0x0220
Help with this is really appreciated because I'm stuck and cannot think of any solution.
My main.c file:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "esp_system.h"
#define LED_GPIO 1 // this pin is connected to blue LED on ESP-01
#define GPIO_OUTPUT_PIN_SEL (1ULL<<LED_GPIO)
static void gpio_task_example(void *arg)
{
while (1) {
gpio_set_level(LED_GPIO, 1);
vTaskDelay(1000 / portTICK_RATE_MS);
gpio_set_level(LED_GPIO, 0);
vTaskDelay(1000 / portTICK_RATE_MS);
}
}
void app_main(void)
{
gpio_config_t io_conf;
//disable interrupt
io_conf.intr_type = GPIO_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_OUTPUT;
//bit mask of the pins that you want to set,e.g.GPIO15/16
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
//disable pull-down mode
io_conf.pull_down_en = 0;
//disable pull-up mode
io_conf.pull_up_en = 0;
//configure GPIO with the given settings
gpio_config(&io_conf);
//start gpio task
xTaskCreate(gpio_task_example, "gpio_task_example", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}