Here is the most up-to-date patch files for the code.
Thanks for posting this, a very good start.
Regarding the current status, I am a bit stuck on what to do next. I suspect that I need to use Ghidra a bit more to search for the correct address values to use that are currently NULL_SUBs or FAKEDEFs. I may get around to digging through the decompiled original FW a bit more this week to try to locate some of these addresses
A few things I noticed looking at this:
in platform/main.c start() you *definitely* need the bss initialization loop. You might see some comments in other ports that sanity check is useless, but that only refers to the if statement, not the loop!
In platform/sub, entries correctly identified by the sig finder in stubs_entry.S should be just left in stubs_entry.S, not copied to stubs_min.S / stubs_entry_2.S. stubs_min.S and stubs_entry_2.s allow overriding variables and functions respectively, if the sig finder is wrong or doesn't find them. This doesn't directly affect functionality, but but it makes it easier to maintain and identify what needs to be done. (sx700 had a few things in override files that were also found by the sig finder, because the sig finder was improved after the port was done)
The NULL_SUB address at the top of stubs_entry_2.s should point at a return instruction. It currently doesn't, which will likely crash if any of those functions are called.
Similarly if you use the RET0 or RET1, they should point at code that returns one of those values.
Also note you can't use NULL_SUB/RET0/RET1 on all functions. If you NULL_SUB a function that needs to return a real value (like GetDrive_TotalClusters) it won't immediately crash, but it will return random garbage. Returning 0 or 1 in this case would also be broken.
Attached is a patch against the trunk r5708 which cleans up some of these things:
enable bss initialization in main.c
correct NULL_SUB
remove auto-identified stubs from stubs_entry_2.S and stubs_min.S
generate firmware_crc_data.h
(note this would apply to a fresh SVN checkout of the trunk, not your source)
To find the remaining unknown functions and variables, I highly recommend the Ghidra version tracking tool:
https://chdk.fandom.com/wiki/Ghidra_Version_Tracking_workflow_for_porting