A note on the last "cleanup"
BL 0xFFC0BD98
BL 0xFFC0BB50
This is
wrong. It does NOT jump to the given address, because B and BL only take 24 bit PC relative offsets. It will crash. The "correction"
BL =0xFFC0BD98
BL =0xFFC0BB50
Is also wrong. In this case, it doesn't matter much because it's an assert anyway.
Explanation:
http://chdk.wikia.com/wiki/CHDK_Coding_Guidelines#Calling_original_ROM_functionsThere are several correct ways do do this
#1)
BL sub_<address>
CHDK build process will automatically put the correct shim in stubs_auto.S
edit: Note, this only applies to platform files mentioned in STUBS_AUTO_DEPS
#2)
MOV LR, PC
LDR PC, =<address>
for a BL, or just the LDR for a B
#3)
Add a stub to stubs_entry_2.S, and use B/BL <name>
B/BL <constant> is not something that you are ever likely to want to do.
edit:
and ADR should should generally be translated to the appropriate LDR =constant, although AFAIK ADRL will do the right thing if it assembles at all.
Random debugging code (e.g. ixus100 boot.c) should be #if 0'd out to save memory.
I'm going to grep the code for all the B/BL [0=]0x* and fix them. Something to look out for when adding ports, it seems to be a common mistake.