Flashing from Linux
Good news. The precompiled HEX can be flashed from Linux without the Cypress stuff. Obviously to recompile the firmware would still require Windows and Cypress.
Download OpenOCD. The version with my distribution didn't seem to work so I used the newest 'xpack' version: https://xpack.github.io/openocd/
https://github.com/xpack-dev-tools/openocd-xpack/releases/
I didn't install it, I just uncompressed it in the current directory where I had the hex file.
You may need to hold the button on the programmer part until the green light begins flashing. This I believe is the opposite of the Cypress tools.
"dmesg" should show: Product: Cypress KitProg (CMSIS-DAP, Mass Storage)
Then I then simply ran, and I just used sudo since I was too lazy to install all the needed udev rules:
sudo xpack-openocd-0.11.0-1/bin/openocd -d1 -f xpack-openocd-0.11.0-1/scripts/interface/cmsis-dap.cfg -c "adapter speed 50" -c "transport select swd" -f xpack-openocd-0.11.0-1/scripts/target/psoc5lp.cfg -c init -c "program FluxEngine.hex verify reset exit"
Ok, maybe not that simple, but it all looked happy. adapter speed may be able to be increased but I didn't test any more.
And it looks like SWD is unhappy after the firmware has been loaded the first time. Maybe more debugging to do.
I switched to using the kitprog driver and it works the first time, but once FluxEngine has been flashed OpenOCD is unable to re-flash. I suspect this is a bug as it should be working. It's probably due to FluxEngine using the SWD pins as GPIO. I have a query in to OpenOCD users so we'll see if it can be resolved.
Thanks --- that's really good news!
I'd very much like to add flashing support to the FluxEngine client itself, so I can deploy a single binary which can program the hardware. This would involve reimplementing the flash protocol, unfortunately...
Sadly it doesn't appear there is DFU code for the 5Lp, which would mean you could easily have users just use dfu-util.
Closest it seems would be to add the official HID bootloader and then use one of the few opensource projects which support the protocol.
And before anyone else tries it, turns out the flash didn't actually work right. Something didn't go quite right and I had to reflash with the Windows tool. More testing is needed.
Still no progress on OpenOCD. Bootloader is coming along nicely. I've added the official bootloaded component and a second HID bootloader project. Added some code so fluxengine can reboot to bootloader mode. And added a quick libusb/C re-implementation of just enough of the bootload HID protocol in a separate command. Need to integrate with the build system and test on all supported OSes.
Obviously the bootloader still needs to be flashed once in the usual way, but after that any OS can do the updates.
@wormley Any progress here? I was hoping to flash the pre-built images this way.