/* The example of esp-free-rtos
*
* This sample code is in the public domain.
*/
#include <string.h>
#include "espressif/esp_common.h"
#include "esp/uart.h"
#include "FreeRTOS.h"
#include "ssid_config.h"
#include "ota-tftp.h"
#include "rboot-api.h"
void dummy_task(void *pvParameters)
{
while(1) {
vTaskDelay(5000
/ portTICK_PERIOD_MS);
}
}
void user_init(void)
{
uart_set_baud(0, 115200);
rboot_config conf = rboot_get_config();
printf("\r\n\r\nOTA Basic
demo.\r\nCurrently running on flash slot %d /
%d.\r\n\r\n",
conf.current_rom, conf.count);
printf("Image addresses in
flash:\r\n");
for(int i = 0; i <conf.count; i++) {
printf("%c%d:
offset 0x%08x\r\n", i == conf.current_rom ? '*':' ', i,
conf.roms[i]);
}
//printf("This is NEW FIRMWARE\n");
struct sdk_station_config config = {
.ssid =
WIFI_SSID,
.password =
WIFI_PASS,
};
sdk_wifi_set_opmode(STATION_MODE);
sdk_wifi_station_set_config(&config);
printf("Starting TFTP server...");
ota_tftp_init_server(TFTP_PORT);
xTaskCreate(&dummy_task, "dummy",
512, NULL, 2, NULL);
} |