PlatformIO Community

Esp8266-12 RTOS sdk


#1

Good morning
we wanted to start implementing on my esp8266-12 the RTOS operating system,
but i was not able, because after uploading with usb-uart (boot) on
my ESP, if I go to check it does not work, indeed the serial continues to transmit data
which for me have no meaning.
I ask kindly there is a complete project, including everything (include, ini) working that if i upload from boot usb-uart works?
Thank you so much.

Win 7
Visual Studio Code 1.18.1


#2

What board setting are you using?

My last ESP8266 purchase had no real indication of what version of chip it used. I had issues with getting the console working properly (no output), even though the firmware uploaded and executed properly. When I set the board type to nodemcuv2, it started to work properly.


#3

Many thanks mrred128
I tried to put board = nodemcuv2 but the problem is the same
when i start my esp8266-12 does nothing of the program but keeps sending
characters on the serial. This esp8266 works well with arduin ide, so the module has no problems.
I ask you kindly if you can help me.
Thank you

platformio.ini

[env:esp_wroom_02]
platform = espressif8266
framework = esp8266-rtos-sdk
;board = esp_wroom_02
board = nodemcuv2
monitor_baud = 115200
board_flash_mode = dio
upload_resetmethod = ck
board_f_cpu = 80000000L
board_f_flash = 40000000L
upload_speed = 115200
upload_port = COM48

main.c

#include “esp_common.h”
#include “freertos/task.h”
#include “gpio.h”

//fine GPIO_OUTPUT_SET(gpio_no, bit_value) gpio_output_conf(bit_value<<gpio_no, ((bit_value)&0x01)<<gpio_no, 1<<gpio_no, 0)

/******************************************************************************

  • FunctionName : user_rf_cal_sector_set

  • Description : SDK just reversed 4 sectors, used for rf init data and paramters.

  •            We add this function to force users to set rf cal sector, since
    
  •            we don't know which sector is free in user's application.
    
  •            sector map for last several sectors : ABCCC
    
  •            A : rf cal
    
  •            B : rf init data
    
  •            C : sdk parameters
    
  • Parameters : none

  • Returns : rf cal sector
    *******************************************************************************/
    uint32 user_rf_cal_sector_set(void)
    {
    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;
    
     default:
         rf_cal_sec = 0;
         break;
    

    }

    return rf_cal_sec;
    }

void task_blink(void* ignore)
{
//gpio16_output_conf();
while(true) {
//gpio16_output_set(0);
vTaskDelay(1000/portTICK_RATE_MS);
//gpio16_output_set(1);
vTaskDelay(1000/portTICK_RATE_MS);

}

vTaskDelete(NULL);

}

/******************************************************************************

  • FunctionName : user_init

  • Description : entry of user application, init user function here

  • Parameters : none

  • Returns : none
    *******************************************************************************/
    void user_init(void)
    {

        PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO12);
     GPIO_OUTPUT_SET(12, 1);
    

    xTaskCreate(&task_blink, “startup”, 2048, NULL, 1, NULL);
    }


#4

How I arrived at nodemcuv2 was getting a complete list of boards by running a command in the terminal box. “pio boards 8266” and go through the listed boards until something works.

I suspect it’s different mapping of GPIO pins to be the culprit.

Beyond this, I don’t have your board and can’t be of much help with this.


#5

I attach the photo of my module that we programmed it from uart TXD0 RXD0


#6

It looks like I have a couple of wifi shields using that same chip. The downside is my usb serial devices are still on a dogsled from china. It may be a while before I can get to it.


#7

Thanks for the answer, i used this with arduino ide no problem, I wanted to integrate rtos with platformio.


#8

Have you tried simba? http://simba-os.readthedocs.io/en/latest/

I have played with it and it does support 8266.


#9

Hi mrred128
Simba is a rtos?
I was interested in an operating system to open various tasks in various phases of wifi, avoiding the slowdowns of other processes while, loop, …


#10

Yes, it is a rtos. everything is modular and you add what you need via a config.h

It’s supported here and in the arduino ide.


#11

Many thanks would you have a platformio project including libraries from where can i start that if I load it with visual code on my esp something runs?
Too kind


#12

I made a project with Hello world! it works, I do not understand why on my monitor with a Esp8266 reset I leave all these characters before Hello word!

main.c

#include “simba.h”

int main()
{

struct uart_driver_t uart;

sys_start();

uart_module_init();
uart_init(&uart, &uart_device[0], 9600, NULL, 0);
uart_start(&uart);
sys_set_stdout(&uart.chout);

std_printf(FSTR("Hello world!\n"));

return (0);

}

monitor

Executing task: platformio.exe device monitor <

— Miniterm on COM48 9600,8,N,1 —
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
HH>� $G(h␒�GEYidbC)IdbC)�YC-iYC-i�dC)IdC)I4dhC-Hi�� dxUH$� dE=)IdCIIdC�)IdbC)IdbC�ih,�0FECC)Idhb-iIdb-iIdhC-iYC-iYIC)IdC)IdI-iYdb-iYdb
)IdC)IdC�iYdb-iYdb-�iYC-iYC-�IdC)IdbC)�Ydb-iYdb-i�YC-iYC-i�dbC)IdbC)I(db-iYdb-iYEEIYCIId(bC)I�$ dC)�YdB-iYB-i�dCIIdCII4dbC)IdbC)I4@EK␌(YdIhHr �[A+Hr0Q kIdb%iIdb-�iYC-iY�l�`�B␕HM␑ty���t��X:xHxt�d�\�)�␔��l����휌���(����)���Hello world!


#13

In a seminar all day. I will see what I have when I get home.


#14

Many thanks mrred128


#15

Hi mrred128
I have documented on simba and i saw that it is not complete in the drivers etc. it would be interesting to implement freertos.


#16

Returning to the initial trial with freertos is a problem related to setting the addresses of the esp8266 in the platformio.ini


#17

The 8266 end is the most developed, for simba. All the network stuff is in place. The i2c interface is perfect. I looked at porting an i2c lcd driver, but haven’t found the time. It looks strait forward.


#18

hi
I have some news concerning the problem with freertos indicated above this discussion the data that are sent continuously on the uart are the following:

ets Jan 8 2013,rst cause:2, boot mode:(3,7)

load 0x40100000, len 31360, room 16
tail 0
chksum 0x07
load 0x3ffe8000, len 2128, room 8
tail 8
chksum 0xb2
load 0x3ffe8850, len 492, room 0
tail 12
chksum 0xe3
csum 0xe3
OS SDK ver: 1.5.0-dev(caff253) compiled @ Oct 23 2017 17:42:20
phy ver: 1055_1, pp ver: 10.7

rf cal sector: 1019
tcpip_task_hdl : 3ffef620, prio:10,stack:512
idle_task⸮

I tried using esp8266-12 with visual studio / visualgdb, I had the same identical problem I solved by setting

esp_init_data_default.bin to 0x3fc000 on additional flash

how can I solve this problem?

In the ini file I have already added

[Env: Esp8266-12]
platform = espressif8266
framework = esp8266-rtos-sdk
board = esp12e
board_f_flash = 80000000L
board_flash_mode = god
upload_resetmethod = ck
upload_speed = 115200

I enclose the settings used with visual studio

Many thanks


#19

Please re-test with upstream version http://docs.platformio.org/en/latest/platforms/espressif8266.html#stable-and-upstream-versions

Does it work now?