Sitdown Standup for July 7th, 2017

Let's get started: What happened this week?
Uhh... A lot of time went into product one... and the Pushrate stuff I did get done isn't quite baked enough to talk about... and I'm sick as a dog.
Remember this next week when I'm inevitably sick... Anyway, this week I spent my time improving our build process and figuring out how to get debugging up and running on the ESP8266.
Better you than me, I hate all the stuff around programming that is isn't programming. Especially when you're dealing with embedded hardware.
I can't blame you, it has been a real pain in the ass. The nice part is that other people have shared this pain, so I don't have to start from scratch. Espressif have published their gdb stub and in theory it is pretty easy to get up and running without bothering with JTAG, just using the existing serial line.
Did you figure out the memory mapping stuff? We need to control how the code is placed in memory?

In part. I figured out the issue that was causing me to run out of space in the .text segment: the gdb stub itself is quite big. I shifted it into irom, with a #define, and ended up learning quite a bit about how code makes its way onto the esp. Most of the important stuff is contained in the linker file, eagle.app.v6.ld. I now understand how the various sections are mapped into flash, and then into ram.

I'm not yet sure about how the upgrade process works, since stuff loaded into irom will have their own internal offsets compiled, so I think the code needs to be compiled with a custom ld file to the right offset depending if it going into slot A or B. That would mean that OTA updates would have to be compiled twice, once for each offset, and loaded depending on the currently active slot on the device. That feels wrong, so I guess I'll keep reading and see if there is a better way to deal with that. Perhaps there is a register that is used to hold the base address for the active slot.
So I can just boot up Eclipse and go to town?
Maybe? I was having some stability issues there, with the debugger just stalling out. I got quite deep into the gdb machine interface protocol and its implementation in the stub, but I couldn't find any obvious problems that would cause what I was seeing. Maybe I'll have to train you on using gdb straight from the command line. I know you love text mode.
Meh, printf is good enough for anyone.
I pulled together a sample/template project that includes the esp-gdbstub code. From experience, I wanted to document this setup so that when we have to do it again I'm not starting from scratch. I spent a good chunk of time getting the Makefile into shape, so I pulled together a review of the file with my notes as a way to tell future me what the heck it all means.
Future me always thinks past me was a moron.
I don't think a truer statement has ever been spoken.
Previous Edition
Next Edition