Cannot modify example for ESP8266 provided by espressif - c

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 www.doit.am 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

Related

Printing (in C) to IDE console on STM32CubeIDE

I'm starting to use CubeIDE to program a NUCLEO-F401RE board (with sensors attached) and in one of my projects I had to get the voltage of the board and print it somewhere on my laptop (connected to the board via usb cable).
I got this to work using HAL_UART_Transmit function to send the string and PuTTY, on my laptop, to receive and print the string.
Now, I noticed that there is a Console integrated in the IDE where the IDE automatically prints control information, compilation errors and such and I'd like to print the voltage (possibly using printf since I'm programming in C) here rather than using PuTTY, but it doesn't seem so straightforward (as in many other IDEs that I've used) from what I've read on the internet, for instance, here.
I get that here we have two different computers talking to each other, so printing using printf is not as easy as in other situations where code is written, compiled and executed all on the same computer.
My question is:
why isn't there a "console tab" in the IDE where the result of the printf, generated on the board, is displayed? And if there is, how to set it up? Is it simply some settings configuration in the project properties or do I have to modify the low level I/O C functions as stated in the discussion linked above?
Thank you.
Create a new Command Shell Console.
Configure the new Console just as you did with PuTTY.

STM32: usart IAP

I'm trying to use example code provided by X-CUBE-IAP-USART package to develop IAP FW for STM32L0xx device. I'm using STM32L073 Nucleo64 board for development.
When I send compiled FW using TeraTerm's YMODEM protocol nothing happens.
Only thing that is being send to target STM device is: "ota_test.elf166988 13332031541 100644¶Ê" over and over again. When I debugged example code I was getting HAL_TIMEOUT on receive. (rework example code to work with interrupts?). I've triple checked my USART settings so that is not the problem. Cam anyone please help me or send some functioning example code please? Original example code was written for STM32L073 eval board, but I've ported it to work with NUCLEO board, maybe I've made mistake there but, I've configured all peripherals exactly as they were configured in example code.
I appreciate any kind of help.
Thank you.
I am using STM32L476 and faced same issues while writing boodloader for my project.
The problems I encountered are:
HAL_UART_Receive() not working properly, always returning HAL_TIMEOUT
After the uart problem was solved, I was still not be able to upload bin files. Where I noticed that the codes were trying to delete the wrong memory address.
Applied solutions:
I changed the usart conection options. I used DMA channel to receive ymodem packages.
In the FLASH_If_Erase() function, pEraseInit.Banks configured 'FLASH_BANK_1' instead of 'FLASH_BANK_2'. I guess this was a bug and needs to be updated by ST developers.
I added the bootloader projects link where you can find all codes and the changes. Hope it helps with your problems.
Link : https://github.com/yelkovany/Embedded_codes.git

Clearing the screen in C using Cygwin

I have attempted several approaches to clearing the screen in C, under Cygwin. system("cls") and system("clear") don't work when the application is running, giving errors that say in effect, "that command doesn't exist". I'm testing a c application that is going to end up on a micro-controller and operate an LCD screen, and the testing code needs to output the monochrome LCD data to the console each time it changes. The state changes have the potential to occur very quickly, and visualizing the changes properly really means I need an honest-to-goodness screen clear to occur in a programmatic way. Any ideas how this might be done?

Why did Nano just mangle my code?

Using VM VirtualBox I'm running a copy of 32bit Linux which is itself running a VM for an ARM environment. This entire setup is needed to have an environment that lets me do buffer overflows for a class.
Twice now, I've come back to my code in Nano to find that the entire file had just been changed to a line of nothing but.
#^#^#^#^#^#^#^
going on and on. The first time it happened I thought I made some kind of mistake overwriting my C file with my compiled code. I moved on and worked on a different machine but now it's happened a second time and I'm sure I didn't accidentally overwrite anything.
Does anyone have any idea what could possibly cause this? Is there anyway to save my code?

Is it a good idea to use a Screensaver on a raspberry pi as digital signage?

I asked this question in the Raspberry PI section, so please forgive me for posting this here again. Its just there doesn't seem to be as active as this section of the forum. So, onto my question...
I have an idea and I'm working on it right now. I just wanted to see what the community's thought was on using a screensaver as digital signage. Every tutorial I've read shows someone using chromium in kiosk mode, and while that's fine and works well for some uses, it doesn't work for what I need. I have successfully completed a chromium kiosk, and it was cool. But the signage that I need to create now, has to work without internet. I've thought about installing LAMP locally on the PI, and still using chromium. I still may have to if this idea doesn't pan out. All I need from the signage is a Title Message in the top center, and a message body underneath it, with roughly 300-400 character limit. My idea is to write a screensaver module, in C, that will work with a screensaver such as xscreensaver. The module would need to be able to load messages from a directory on the pi. Then for my clients to update their signage text, I would write a simple client that sent commands as well as the text via SSH to the pi. I want to know what other people think about this. Is it a good idea? Bad idea? Should I "waste" my time doing something like this?
Thanks in advance.
I am already using a rPi as digital signage, just over a year. I am using two different setups:
version 1 uses Raspian loading xdesktop and qiv image viewer to cycle images stored on the Pi itself, synchronized with a remote server. The problem I found was power and SD stability, when the power fails, which it will do no matter what, just when... The Sd card can become corrupt due to all the writing that Raspian does all the time. Certainly does not really need to write to SD.
version 2 uses a RO-filesystem and a command line image tool. Uses the same process to show images from local, and sync with server. But power fail causes no ill effects.
I am not using screensaver to display images, that seemed redundant to me, and unnecessary to wait for the SS to start just to display the images.
Some of the images are created using imagemagik, which is nicely dynamic where needed.

Resources