The new version boots into play with both short presses to Play and Rec, goes into Rec if Rec button is being held during power on, turns off if Play is being held. So seems you did not break anything in the clean-up.
Thanks. I checked those changes in.
I also removed KEY_DISPLAY from the keyboard definition and ALT options. This was defined as an alias for the down button which really makes no sense. down arrow as an alt button would be quite unusable.
I'm at a bit of a loss for the PTP crash.
* The platform ASM code is mostly code-gen, so risk of typos should be low
* The USB bit is correctly identified, add_ptp_handler is correctly identified.
* Loader code seems normal. It had the "SD card power cycle" logic, incorrectly referencing an LED MMIO. Taking that out had no impact on the crash
* Free memory was reported to be reasonable in earlier posts.
Other ideas:
* Disable CHDK tasks and see if the effect is still there
* Maybe there's something in the function commented out for diskboot that needs to be called, similar to some SD card issues? However, it looks pretty normal to other cameras of the same era (2011, Digic 4, Dry 47, propset 4) as does the rest of the boot / restart code
* Try to figure out where the HardwareDefect call originates and work back from that
* something bad elsewhere trashing memory
c1oud seemed to report that it was fixed in
https://chdk.setepontos.com/index.php?topic=6341.msg81752#msg81752 but the relevant changes were apparently committed.
I feel like it should be something headslappingly obvious, but I don't see it yet...