A1100 IS Porting thread - page 56 - DryOS Development - CHDK Forum

A1100 IS Porting thread

  • 647 Replies
  • 245992 Views
Re: A1100 IS Porting thread
« Reply #550 on: 27 / October / 2012, 17:55:44 »
Advertisements
Note user reported that build attached to blackhole's post above does work.
Yes - but its a 1.0.0 build.   If he is getting invalid instructions then it seems likely something is overwriting code space.   Could be it writes somewhere harmless in 1.0.0 and somewhere not so harmless in 1.1.0 ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14128
Re: A1100 IS Porting thread
« Reply #551 on: 28 / October / 2012, 00:15:39 »
Summarizing from IRC
1.0 builds don't crash
every 1.1 build we tried (going back to r1600) crashed, in the same place in the CHDK code, even when other changes moved the actual address around. In other words, it's not some fixed address in ram.
If kbd task is disabled in 1.1 builds, it doesn't crash
With kbd task disabled, taking a dump of the CHDK image in RAM shows no corruption of CHDK code.

The crash happens very early, probably the first iteration of kbd_task

Delaying kbd_task with _SleepTask(1000) before the main loop delays the crash by 1 second.

Next step: dump ram immediately before the part that crashes ?

edit:
as pointed out by phil, the invalid instruction could be caused by being in the wrong arm/thumb state, and from the romlog it appears the processor is in thumb.
« Last Edit: 28 / October / 2012, 01:05:14 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14128
Re: A1100 IS Porting thread
« Reply #552 on: 28 / October / 2012, 23:13:45 »
The crash issue should be fixed in trunk 2237, release 2238. The root causes was that kbd_pwr_off pointed to a piece of code which would randomly change memory depending on the contents of r1 and r0. Thanks to user `fb in IRC for invaluable assistance, and also to waterwingz for reminding us more than once to look at that stub...

edit:
The reason 1.0 builds did not crash appears to be down to not stomping on critical bits of memory.
« Last Edit: 28 / October / 2012, 23:20:25 by reyalp »
Don't forget what the H stands for.

Re: A1100 IS Porting thread
« Reply #553 on: 24 / June / 2013, 06:06:02 »
Hello.  :D

I'm trying to port CHDK to the firmware 100a from the 100c following this guide.
I've created the address.txt but i don't know if i did it correctly, can someone check if there is any error?

Code: [Select]
boot 0xFFC00028 89
sub_FFC001A0_my 0xFFC001AC 30
sub_FFC00FC4_my 0xFFC00FC4 23
sub_FFC04D38_my 0xFFC04D38 30
taskcreate_Startup_my 0xFFC0C298 30
task_Startup_my 0xFFC117BC 23
init_file_modules_task 0xFFC5C35C 15
sub_FFC59CC8_my 0xFFC59CC8 17
sub_FFC3E9BC_my 0xFFC3E9BC 23
sub_FFC3E75C_my 0xFFC3E75C 12
sub_FFC3E4EC_my 0xFFC3E4EC 130
capt_seq_task 0xFFC4906C 223
sub_FFC4327C_my 0xFFC493BC 61
sub_FFCE97F4_my 0xFFCFC44C 48
movie_record_task 0xFFCE56F0 88
sub_FFCE51D8_my 0xFFCE5254 141
sub_FFDBE6A8_my 0xFFDBE6A8 73

Here's the boot.c,capt_seq.c and movie_rec.c.

Thanks  :)
« Last Edit: 26 / June / 2013, 08:52:44 by Switch01 »

*

Offline nafraf

  • *****
  • 1308
Re: A1100 IS Porting thread
« Reply #554 on: 25 / June / 2013, 22:59:12 »
I'm trying to port CHDK to the firmware 100a from the 100c following this guide.
I've created the address.txt but i don't know if i did it correctly, can someone check if there is any error?
Hi, the link to the guide is wrong, but I assume that you are trying to use chdk-pt.

There are some errors on your address list, boot function starts at 0xFFC0000C. The first label on 100c code is 0xFFC00028 but there are some instruction before it.

You should not count labels to know function length, so correct length for boot is 86, not 89.  Please recheck other functions ;)

There is a new tool for porting: code_gen.   If you need more help, let me know.



Re: A1100 IS Porting thread
« Reply #555 on: 26 / June / 2013, 08:41:51 »
Hi, the link to the guide is wrong, but I assume that you are trying to use chdk-pt.

There are some errors on your address list, boot function starts at 0xFFC0000C. The first label on 100c code is 0xFFC00028 but there are some instruction before it.

You should not count labels to know function length, so correct length for boot is 86, not 89.  Please recheck other functions ;)

There is a new tool for porting: code_gen.   If you need more help, let me know.

Thank to your tips i remade correcly the address.txt file!  :)

But i think there's a bug in CHDK-PT because as i type
Code: [Select]
sub_FFDBE6A8_my 0xFFDEECB4 57 in the file, the program read "0xFFDEECB4" as "0xFFDEEC34" and output this:

Code: [Select]
//** sub_FFDBE6A8_my  @ 0xFFDEEC34

void __attribute__((naked,noinline)) sub_FFDBE6A8_my(  ) {
asm volatile (
      "    STR     R2, [R4, #4] \n"
      "    BNE     loc_FFDEEC4C \n"
      "    MOV     R0, R1 \n"
      "    BL      sub_FFDC58C0 \n"
      "    MOV     R0, #0x79 \n"
      "    B       loc_FFDEECAC \n"
"loc_FFDEEC4C:\n"
      "    CMP     R0, #0x280 \n"
      "    MOV     R2, #2 \n"
      "    BNE     loc_FFDEEC7C \n"
      "    CMP     R12, #1 \n"
      "    MOVEQ   R0, #6 \n"
      "    STREQ   R0, [R4, #8] \n"
      "    STREQ   R2, [R4, #4] \n"
      "    BEQ     loc_FFDEEC98 \n"
      "    MOV     R0, #0xC \n"
      "    STR     R0, [R4, #8] \n"
      "    MOV     R0, #3 \n"
      "    B       loc_FFDEEC94 \n"
[cut...]
Which is incorrect. Should i post it in the CHDK-PT thread?
« Last Edit: 26 / June / 2013, 08:48:36 by Switch01 »

Re: A1100 IS Porting thread
« Reply #556 on: 26 / June / 2013, 09:10:53 »
Should i post it in the CHDK-PT thread?
Don't bother - I'll take a look
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A1100 IS Porting thread
« Reply #557 on: 26 / June / 2013, 11:30:48 »
Should i post it in the CHDK-PT thread?
Don't bother - I'll take a look

Update :  would you please attach the actual addresses.txt file that produces this error to a post in this thread (i.e. don't cut and paste into the message text)
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A1100 IS Porting thread
« Reply #558 on: 26 / June / 2013, 11:35:17 »
Should i post it in the CHDK-PT thread?
Don't bother - I'll take a look

Update :  would you please attach the actual addresses.txt file that produces this error to a post in this thread (i.e. don't cut and paste into the message text)

Sure.

Re: A1100 IS Porting thread
« Reply #559 on: 26 / June / 2013, 13:46:41 »
But i think there's a bug in CHDK-PT because as i type
Code: [Select]
sub_FFDBE6A8_my 0xFFDEECB4 57 in the file, the program read "0xFFDEECB4" as "0xFFDEEC34" and output this:
...
Which is incorrect. Should i post it in the CHDK-PT thread?
Well,  I downloaded the most recent version of CHDK-PT  (2.10 - although the window banner still reads 2.09 - whoops).   And I downloaded the A1100 1.00a PRIMARY.BIN file.   I used the address.txt file you posted and here's what I get as the final function in the output file :
Code: [Select]
//** sub_FFDBE6A8_my  @ 0xFFDEECB4

void __attribute__((naked,noinline)) sub_FFDBE6A8_my(  ) {
asm volatile (
      "    STMFD   SP!, {R4-R8,LR} \n"
      "    LDR     R4, =0x8C18 \n"
      "    LDR     LR, [R4] \n"
      "    LDR     R2, [R4, #8] \n"
      "    CMP     LR, #0 \n"
      "    LDRNE   R3, [R4, #0xC] \n"
      "    MOV     R5, R2 \n"
      "    CMPNE   R3, #1 \n"
      "    MOVEQ   R2, #0 \n"
      "    STREQ   R0, [R4] \n"
      "    STREQ   R2, [R4, #0xC] \n"
      "    BEQ     loc_FFDEED80 \n"
      "    LDR     R3, [R4, #4] \n"
      "    LDR     R7, =0xFFEB75C0 \n"
      "    ADD     R12, R3, R3, LSL #1 \n"
      "    LDR     R3, [R7, R12, LSL #2] \n"
      "    ADD     R6, R7, #0x30 \n"
      "    LDR     R8, [R6, R12, LSL #2] \n"
      "    SUB     R3, LR, R3 \n"
      "    CMP     R3, #0 \n"
      "    SUB     LR, LR, R8 \n"
      "    BLE     loc_FFDEED3C \n"
      "    ADD     R12, R7, R12, LSL #2 \n"
      "    LDR     LR, [R12, #4] \n"
      "    CMP     LR, R3 \n"
      "    ADDGE   R2, R2, #1 \n"
      "    BGE     loc_FFDEED30 \n"
      "    LDR     R12, [R12, #8] \n"
      "    CMP     R12, R3 \n"
      "    ADDLT   R2, R2, #3 \n"
      "    ADDGE   R2, R2, #2 \n"
"loc_FFDEED30:\n"
      "    CMP     R2, #0x17 \n"
      "    MOVGE   R2, #0x16 \n"
      "    B       loc_FFDEED70 \n"
"loc_FFDEED3C:\n"
      "    CMP     LR, #0 \n"
      "    BGE     loc_FFDEED70 \n"
      "    ADD     R3, R6, R12, LSL #2 \n"
      "    LDR     R12, [R3, #4] \n"
      "    CMP     R12, LR \n"
      "    SUBLE   R2, R2, #1 \n"
      "    BLE     loc_FFDEED68 \n"
      "    LDR     R3, [R3, #8] \n"
      "    CMP     R3, LR \n"
      "    SUBGT   R2, R2, #3 \n"
      "    SUBLE   R2, R2, #2 \n"
"loc_FFDEED68:\n"
      "    CMP     R2, #0 \n"
      "    MOVLT   R2, #0 \n"
"loc_FFDEED70:\n"
      "    CMP     R2, R5 \n"
      "    STRNE   R2, [R4, #8] \n"
      "    MOVNE   R2, #1 \n"
      "    STRNE   R2, [R4, #0xC] \n"
"loc_FFDEED80:\n"
      "    LDR     R2, =0xFFEB7564 \n"
      "    LDR     R3, [R4, #8] \n"
      "    LDR     R2, [R2, R3, LSL #2] \n"
      "    STR     R2, [R1] \n"
      "    STR     R0, [R4] \n"
      "    LDMFD   SP!, {R4-R8,PC} \n"
);
}
Looks okay to me.   Do you still see the error when you start everything up from scratch?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal