Since I don’t seem to be making any progress on the Sigma Delta output, I decided to update my copy of Espressif’s API. I went to bbs.espressif.com and clicked on the SDKs thread under the heading DOWNLOADS. In the list i looked for the most recent Non OS SDK release. I saw that ESP8266_NONOS_SDK_V1.5.4_16_05_20 is the most recent release. It’s file name indicates a release date of May 20th 2016. I downloaded the zip file and extracted the contents.
To Make moving forward a little easier, I renamed the SDK folder to UProgrammer. This will help me maintain paths the next time I move to a new SDK Version. Each time I update to a new SDK, I will Rename the OLD SDK folder to indicate it’s version number, and rename the new SDK folder to UProgrammer. To maintain compatibility with Github’s folder naming, I will continue to keep the UProgrammer-Firmware folder name for the project files. This folder will be sitting in the SDK folder I just renamed to UProgrammer. I then created an empty text file with the name of the SDK file to mark the version I am working in. Then I copied the hidden file .metadata from the old SDK folder into the new (UProgrammer) SDK folder.
I opened eclipse and pointed the workspace to the UProgrammer folder and it loaded the files as if I hadn’t changed anything. Then I made edited the comment block at the top of the file to indicate I had moved to NONOS SDK V1.5.4. I saved the file and then checked the file in the new directory structure for the changes. It has the change I had just made. To make sure there wasn’t something weird going on, I also checked the file in the old directory structure. It was unchanged. I had planned on dealing with more problems just in case they happened.
I compiled the code to see if anything broke moving to the new SDK. Things definitely broke. First the files all compiled but linking failed. The first error message was:
section `.irom0.text' will not fit in region `irom0_0_seg'
This reminded me that I modified the linker file eagle.app.v6.ld to allow for more room for the code space in a 4MByte flash chip. I made the modification to the new file and saved it.
I tried compiling again. Again it failed to link but I was no longer getting the memory failure. This time the first error message was:
undefined reference to `uart0_sendStr'
I didn’t have the most recent programming reference, so I went back to bbs.espressif.com to download it. I got the 2C-ESP8266_SDK_API Guide_EN_1.5.4.pdf. It turns out uart0_sendStr() isn’t in the documentation. So I looked in my code to find it. I found the prototype for it in uart.h. but it doesn’t appear anywhere else. This makes me wonder how I was compiling last week. I did find it in uart.c in the drivers folder. At one time that file was part of the project. I am guessing the object file was still getting linked in to the project. The compiled object files are in hidden folders and didn’t get copied by default. (It’s a good thing. The versions of code on Github would not have worked. Now they will get fixed.) I copied The code for uart0_sendStr() into simple_serial.c and recompiled expecting it to fail because uart0_sentStr() calls something else in uart.c.
Again I looked at the first error from the linker which was:
../lib/libat.a(at_ipCmd.o): In function `at_set_rx_buf_state':
(.irom0.text+0x10ac): undefined reference to `espconn_secure_sent'
I am not using any secure features or any AT functions, so I decided to look at the make files. I used a Linux tool called meld to compare files. There were very small differences. Looking at my makefile, I noticed four lines that effectively added the -lat linker option. I commented out those 4 lines and recompiled. Now the linker only has 4 errors remaining, all of which can be fixed by copying code from the uart.c file. After copying each function I needed from uart.c, I finally got a successful compile of the code. I then uploaded it to the PCB to see if it still runs. It ran the wrong code. I now get a message in the serial terminal “dmode : softAP (XXX) indicating it is booting up as an access point.
I was able to connect to the device and dhcp worked, but an attemp to connect by http was refused. Since the messages are system messages I decided to try a UART Swap. No change in the behavior. I need to do a sanity check, this is a new API so back to doing a Hello World test. I finally got confirmation that my code is what is being uploaded to the module. I placed the following function call:
system_set_os_print(0); // Turn off System Messages
into the code. I am no longer getting any output in the terminal. I wasn’t getting any error from compiling but it turns out the function uart_tx_one_char() needed to be copied from the uart.c to simple_serial.c I chose not to have uart.c to reduce code size, there is a lot of code in uart.c that I will never use.
I cleaned up some of the things I tested recompiled and posted a new copy to Github. Do you have any tips for migrating between environments? I’d love to hear about them.