Ok, more, with significant progress.  And again, probably most people don't need to know this.  It's mainly for the archives.

Just so you know, the connection between the Atollic TrueStudio IDE running on Linux, or gdb on Linux, or the STM ST-Link utility running on Windows is made via a USB gadget called ST-Link/V2.  It is available easily, for example from Mouser here: https://www.mouser.com/ProductDetail/STMicroelectronics/ST-LINK-V2/?qs=sGAEpiMZZMu3sxpa5v1qrqPIYHPyeOmOUBuCAg6HF1c%3D.  I'm sure Digikey has them too.

Then you need a little adapter to connect the STLink to the IHU board via the red connector.  That is available here from Bdale Garbee's business:

https://shop.gag.com/parts/swd-adapter-v2.html

Remember that in TrueStudio you have to select "STLink" not Segger J-link.  That was another mistake I kept making.  But this give you the capability of loading code fairly quickly as well as adding breakpoints, watchpoints, and the standard gdb stuff.  It makes things WAY easier. 

Remember that once the IHU is no longer accessible (installed in a satellite body, for example) you can't use this anymore.  You have to have a code loader installed which can load code by way of the satellite umbilical.  For both Golf and LTM, this loader lives in flash addresses 0x08000000 through 0x08001000 and is generally called a bootloader.  I usually install the bootloader via the STM32 ST-link utility and mark this first 0x1000 bytes read only.  But Golf and LTM use different bootloaders.  Golf loads via a serial connection (the CIU board has a USB-to-serial chip on it), and LTM (and Fox) via a direct-to-MCU USB connection.  The other end of the serial or USB connection is a Linux or Windows system where the elf executable file for the flight software is sitting.

The USB boot loader was written by Keith Packard, (keithp@keithp.com--I don't remember his call), and is most easily available from him, although it is open source and available on git://git.gag.com/fw/altos but you have to work hard to figure out how to build it--this repo includes lots of other stuff.  Easiest to ask Keith :-)

The serial bootloader started life as a clone of the USB loader, but was modified considerably to work with serial lines by me (WB1FJ).  It is currently located at ssh://git.amsat.org/srv/git/GolfSerialLoader.git.  However, in keeping with the original USB loader GNU license, I should include it in my gitHub account.

Speaking of which, the program that you run on your Linux (or Windows) system to connect to the boot loader on the IHU is here:

https://github.com/burnsfisher/pyMicroloader

73,

Burns Fisher, WB1FJ
AMSAT(R) Flight Software


On Thu, Feb 11, 2021 at 3:17 PM Burns Fisher (AMSAT) <wb1fj@fisher.cc> wrote:
When I first started writing the software for Fox-1 (which turned out to be AO-85) I was using the Eclipse IDE along with the gdb debugger and other hacked-together pieces.  This worked great with debugging--single step, breakpoints, watchpoints, etc all worked fine. 

As we got to the end of development and I switched to compiling for release rather than debug, I stopped using the debugger.  When I wanted to use it agan for Golf, having switched to the Atollic TrueStudio (a 'supported' bundle of Eclipse, gdb etc) I could never get debugging to work again.

Today, I finally found the magic:

1) If I have the umbilical plugged in, the of course power-on stops in the USB loader.  For some reason when it is in the USB loader, gdb can't connect over the ST-link SWD connection. 

2) If I do NOT have the umbilical plugged in I can upload some code but it hangs.  Why?  Because without the umbilical, the code, as expected, does a checksum of itself and since the code has changed a bit every time (it incorporated the build time) the checksum fails, and it attempts to fire off the watchdog to power cycle.

I've finally worked around these by putting "ifndef UNDEFINE_BEFORE_FLIGHT" around the test so it will only execute as we are preparing for flight. 

I'm just recording this for posterity in both the golf software list and the ltm list.

73,

Burns Fisher, WB1FJ
AMSAT(R) Flight Software