Minor progress with emulation:
- SD also works in main firmware, not just bootloader
- found the HDMI status GPIO (but didn't help much, other than cleaning the debug messages)
- patched JPCORE to avoid an assertion
Here's how I've found what to patch for the assert:
b *0x3CBC
assert_log
./run_canon_fw.sh 1300D,firmware="boot=0" -d callstack -s -S & arm-none-eabi-gdb -x 1300D/debugmsg.gdb
...
Current stack: [158398-157398] sp=158238 at [ShootCapture:3cbc:3320]
0xFE2BE514(796b3c &"StageClass", fe2be514, 19980218, 19980218) at [ShootCapture:41fc:158388] (pc:sp)
0xFE0CAAC4(796a70 &"ShootCapture", 0, 0, 0) at [ShootCapture:fe2be570:158360] (pc:sp)
0xFE2BE970(796ab8 &"StateObject", 796a70 &"ShootCapture", 0, 0) at [ShootCapture:fe0caaf0:158348] (pc:sp)
0xFE2BE9A8(796ab8 &"StateObject", 796a70 &"ShootCapture", 0, 0) at [ShootCapture:fe2be9a0:158338] (pc:sp)
0xFE12DB28(796a70 &"ShootCapture", 0, 0, fe12db28) at [ShootCapture:fe2bea28:158318] (pc:sp)
0xFE3ABD84(4fb1c080, 80000, 1, 25335c) at [ShootCapture:fe12db84:1582f0] (pc:sp)
0xFE539194(0, 142240, 141dfc, 31170) at [ShootCapture:fe3abdf0:1582a8] (pc:sp)
0xFE2A0164(40797480, 4079bd60, 792e34, 25) at [ShootCapture:fe5391b4:158290] (pc:sp)
0xFE2A16C8(0, 80000013, 4f550, 40000000) at [ShootCapture:fe2a01e4:158280] (pc:sp)
0xFE2A0088(7, 142240, 141dfc, 31170) at [ShootCapture:fe2a16ec:158270] (pc:sp)
0xFE4244FC(fe2a02c0 "JPEGICError", 0, 141dfc, 31170) at [ShootCapture:fe2a00d4:158260] (pc:sp)
0x3270(0, 0, 141dfc, 31170) at [ShootCapture:fe424510:158250] (pc:sp)
0x3CBC(3340, 332c "SystemIF::KerSem.c", 13a, 31170) at [ShootCapture:331c:158238] (pc:sp)
[ShootCapture:0000331c ] [ASSERT] 0 at SystemIF::KerSem.c:314, 3320
# patch JPCORE (assert)
set *(int*)0xFE4244FC = 0xe12fff1e
With this, the emulation moved forward, but still no GUI.
What's missing:
[ Startup:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 1, 0x20000002, Flag = 0x20000000)
[ PowerMgr:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 1, 0x2, Flag = 0x2)
[ FileMgr:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 2, 0x10, Flag = 0x10)
[ Startup:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 3, 0xe0110, Flag = 0x40000)
[ Startup:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 3, 0xa0110, Flag = 0x80000)
[ Startup:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 3, 0x20110, Flag = 0x100)
[ FileMgr:fe0d4054 ] (00:03) [SEQ] NotifyComplete (Cur = 3, 0x20010, Flag = 0x10)
Notice the pattern? The startup code expects a bunch of things to complete, but it doesn't really care about their order. There are a bunch of binary flags that get cleared whenever some component finishes its initialization. When all these flags are reset, the startup code moves on to the next stage. Therefore, to push the emulation even further (and hopefully get the GUI), one needs to:
1) find out who calls NotifyComplete(Flag = 0x20000) - easy
2) understand why it doesn't get called - hard
3) adjust the emulation so it gets called - easy after solving 2.
The above is not required for porting ML; you already have everything you need to print Hello World. It just makes things a bit easier.