@WW
Could there be a problem with the motion detection code...?
In the exception log, PC points to the instruction right after the libmotiondetect->md_draw_grid() call in gui_script_draw(). And, that instruction is "undefined", which it shouldn't be. Overwritten CHDK code?
03cb3ed0 <gui_script_draw>:
3cb3ed0: b510 push {r4, lr}
3cb3ed2: f7f5 fd75 bl 3ca99c0 <gui_chdk_draw>
3cb3ed6: f7f9 ffde bl 3cade96 <mode_get>
3cb3eda: 24c0 movs r4, #192
3cb3edc: 00a4 lsls r4, r4, #2
3cb3ede: 4020 ands r0, r4
3cb3ee0: 2380 movs r3, #128
3cb3ee2: 005b lsls r3, r3, #1
3cb3ee4: 4298 cmp r0, r3
3cb3ee6: d006 beq.n 3cb3ef6 <gui_script_draw 0x26>
3cb3ee8: f7f9 ffd5 bl 3cade96 <mode_get>
3cb3eec: 4004 ands r4, r0
3cb3eee: 2380 movs r3, #128
3cb3ef0: 009b lsls r3, r3, #2
3cb3ef2: 429c cmp r4, r3
3cb3ef4: d111 bne.n 3cb3f1a <gui_script_draw 0x4a>
3cb3ef6: 4b0a ldr r3, [pc, #40] (3cb3f20 <gui_script_draw 0x50>)
3cb3ef8: 33f4 adds r3, #244
3cb3efa: 681a ldr r2, [r3, #0]
3cb3efc: 4b09 ldr r3, [pc, #36] (3cb3f24 <gui_script_draw 0x54>)
3cb3efe: 2a00 cmp r2, #0
3cb3f00: d001 beq.n 3cb3f06 <gui_script_draw 0x36>
3cb3f02: 2205 movs r2, #5
3cb3f04: 605a str r2, [r3, #4]
3cb3f06: 685a ldr r2, [r3, #4]
3cb3f08: 2a00 cmp r2, #0
3cb3f0a: d006 beq.n 3cb3f1a <gui_script_draw 0x4a>
3cb3f0c: 3a01 subs r2, #1
3cb3f0e: 605a str r2, [r3, #4]
3cb3f10: 4b05 ldr r3, [pc, #20] (3cb3f28 <gui_script_draw 0x58>)
3cb3f12: 681b ldr r3, [r3, #0]
3cb3f14: 6a1b ldr r3, [r3, #32]
3cb3f16: f000 f99d bl 3cb4254 <script_start_gui 0xc8>
3cb3f1a: bc10 pop {r4} @ <<< *** trashed instruction? ***
3cb3f1c: bc01 pop {r0}
3cb3f1e: 4700 bx r0
3cb3f20: 03cc29ac .word 0x03cc29ac
3cb3f24: 03cc7b84 .word 0x03cc7b84
3cb3f28: 03cc68d4 .word 0x03cc68d4
...
3cb4254: 4718 bx r3
3cb4256: 46c0 nop