morcillo morcillo - 1 month ago 9x
C Question

Cannot modify example for ESP8266 provided by espressif

My setup consists of the Espressif SDK using eclipse and a nodemcu, which I want to program in C.

I have followed all he steps and I can compile and flash the board from the eclipse environment. I don't press any buttons to load the flash because the board can handle it by itself (at least that's what I read). According to this apparently I have a nodemcu 0.9, but the board I have doesn't look quite like the one in the picture (the microstrip antenna looks weird .. and on the back of the board it says ESP12E devkit V2 ... the antenna on mine doesn't even look like the one on the site listed behind the board).

I looked past everything and kept on going. I compiled the blinky example on espressif and flashed it. I saw that it created the eagle.flash.bin and eagle.irom0text.bin and loads them in 0x00000 and 0x10000 respectively (according to documents I've read this is ok). When i reset the board I can see that it really flashed and there is a program in it since the led is blinking. Then I tried the hello_world example. Everything went accordingly and after I reset the board I see that the led keeps on blinking at the same frequency and when I connect to the board via the terminal.exe provided by espressif I can only see garbage in the output, even though the baud is correct according to the code (even so I tried all different bauds possible in terminal.exe).

Ok ... then I went to the blinky example again and increased the delay between blinks. Flashed it and the the frequency stayed the same. I know that it created new .bin files, but still, nothing changed. This led me to create a new project. I did it, following the instructions provided by Mikhail Grigorev. I just put an infinite loop, expecting to get nothing, but after flashing the newly compiled firmware I can still see the led blinking at the same frequency even though there is absolutely nothing in the code, I even wiped the flash before (yes, I verified the flash was empty).

So this lead me to test every single example I could compile. I noticed that some didn't blink the led and others did, like nothing happened. After that i downloaded the nodemcu firmware, and after loading it I noticed that it worked properly and I could even see the ESP in the available wifi networks.

I really don't understand what's happening. Why do some examples work and others don't? Why can't I modify the source code of a simple blinky and see the change? I really prefer to use the esp module this way, since I don't like the arduino interface or the way that it uses a static setup and loop functions, and I don't want to program it in LUA.

I even checked the makefiles provided by espressif and the only difference I can see are the BOOT and APP variables. I even tried modifying them, but still .. no changes.

Can anybody help me?


Ok, finally found my problem. The thing is that the espressif SDK needs some software bits on certain addresses of the flash. What initially happened is that I erased the flash as soon as I got the board, assuming all those binaries would have already been stored in flash.

The next thing I did is that I tried putting all the other binaries, but I was putting them in the wrong addresses, so the software wouldn't work.

Finally, after many many hours of reading forums and reading documentation, I found the correct addresses and it worked.

The addresses are:

0x00000  - boot_v1.6.bin

0x01000  - firmware application (I set the makefile to BOOT=new, APP=1, SIZE_MAP=6)

0x3fc000 - esp_init_data_default.bin

0xfe000  - blank.bin 

0x3fe000 - blank.bin