IXUS 1000 HS Porting Thread - page 4 - DryOS Development - CHDK Forum supplierdeeply

IXUS 1000 HS Porting Thread

  • 436 Replies
  • 93529 Views
*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #30 on: 24 / October / 2010, 14:30:04 »
Advertisements
Hi Bernrd, I made some changes in boot.c get the new one from here:
http://es.drop.io/asm1989  -> boot.cixus1000v001.zip

also upload the full bin for your test

I think the best way is to work with the s95 code and the ixus1000, since most of the boot code is the same (not the addresess!)


I also created another boot.c for testing s95 style: -> boot.cixus1000v002.zip

compile both and tell me
« Last Edit: 24 / October / 2010, 15:10:01 by asm1989 »

Re: IXUS 1000 HS Porting Thread
« Reply #31 on: 25 / October / 2010, 07:26:53 »
i test now 1000v002 zip.

kamera still crash, but i add led blink on this func and your version work better,  because with below code LED blink.

should i try the v1 too or better search in the V2 upto what sourceline work ?

void __attribute__((naked,noinline)) sub_FF815EE0_my() {
     panic(); // work
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #32 on: 25 / October / 2010, 07:56:02 »
test the v1 too and if fails dig into the v2

Re: IXUS 1000 HS Porting Thread
« Reply #33 on: 25 / October / 2010, 08:07:33 »
The v1 fail too.i search now in V2

I rename panic function to blink.

.after this in func sub_FF815EE0_my()

BLLT    sub_FF815FD4\n"      // err_init_task

blink not work.
Ixus 1000 HS


*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #34 on: 25 / October / 2010, 13:54:46 »
Bernd R,

In fact there are some wrong adress get the boot v3 from http://es.drop.io/asm1989

Re: IXUS 1000 HS Porting Thread
« Reply #35 on: 29 / October / 2010, 05:15:57 »
good that the Forum work, so i can report my v3 test.
seem the first dmsetup call fail.and because you change this lines, the second call is do

 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
                 "BLLT    sub_FF815FD4\n"       //Mising err_init_task
                 "BL      sub_FF815B1C\n"

see here what i add as testcode

void __attribute__((naked,noinline)) sub_FF815EE0_my() {
//blink();   //work
     asm volatile (
                 "STMFD   SP!, {R4,LR}\n"
                 "BL      sub_FF810B20\n"
                 "BL      sub_FF81A33C\n"       // BL      dmSetup
);
//blink(); //work
asm volatile (
                 "CMP     R0, #0\n"
                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
                 "BLLT    sub_FF815FD4\n"       //Mising err_init_task
                 "BL      sub_FF815B1C\n"
);
blink(); // not work (on V2 work)

i do also a test and add code as this

                 "CMP     R0, #0\n"
                 "bllt blink\n"
                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
                 "BLLT    sub_FF815FD4\n"       //Mising err_init_task
                 "BL      sub_FF815B1C\n"

then the ixus LED blink.

so you can see the subroutine call to the bllt  sub_FF815FD4 is taken.But it should not taken
« Last Edit: 29 / October / 2010, 05:18:20 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #36 on: 29 / October / 2010, 09:08:23 »
BernR, code looks ok,

test after
                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
and after
    "BLLT    sub_FF815FD4\n"       //Mising err_init_task


Re: IXUS 1000 HS Porting Thread
« Reply #37 on: 29 / October / 2010, 09:36:55 »
>test after
>                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"

blink code is execute

>and after
>    "BLLT    sub_FF815FD4\n"       //Mising err_init_task

blink code is not execute.

so this confirm too it jump to sub_FF815FD4

I notice when i remove static in blink func i can also call blink funtion direct with asm instruction.

my latest testcode was this

asm volatile (
                 "STMFD   SP!, {R4,LR}\n"
                 "BL      sub_FF810B20\n"
                 "BL      sub_FF81A33C\n"       // BL      dmSetup
                 "CMP     R0, #0\n"
                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
                 "BLLT    sub_FF815FD4\n"       //Mising err_init_task
                 "BL blink \n" // not work
« Last Edit: 29 / October / 2010, 09:38:36 by Bernd R »
Ixus 1000 HS


*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #38 on: 29 / October / 2010, 12:26:56 »
Bernd R, I'm a bit puzzled because everything fits,

Test out v4 from http://es.drop.io/asm1989 , just made a plain copy from s95, since looks that the address are the same

*

Offline reyalp

  • ******
  • 11998
Re: IXUS 1000 HS Porting Thread
« Reply #39 on: 29 / October / 2010, 12:29:19 »
                "CMP     R0, #0\n"
                 "bllt blink\n"
                 "LDRLT   R0, =0xFF815FF4\n"    //Mising ; "dmSetup"
                 "BLLT    sub_FF815FD4\n"       //Mising err_init_task
                 "BL      sub_FF815B1C\n"
Note, you cannot just put function calls or instructions anywhere. Frequently, rather than actually finding the point that crashes, you will cause a new crash because you stepped on some registers the firmware expected to have specific values. See http://chdk.wikia.com/wiki/CHDK_Coding_Guidelines#Calling_functions_from_firmware_assembly

In your example above, blink will probably step on CPSR, which will make the subsequent conditional instructions do something different than they otherwise would.

The following macros will let you use pretty much any code almost anywhere
Code: [Select]
// push all regs except SP and PC
// push CPSR via R0
// restore value for R0 from stack
#define ASM_SAFE_ENTER \
"STMFD SP!, {R0-R12,LR}\n" \
"MRS R0, CPSR\n" \
"STR R0,[SP,#-4]!\n" \
"LDR R0,[SP,#4]\n"

// pop CPSR via R0
// pop all regs except SP and PC
#define ASM_SAFE_LEAVE \
"LDR R0,[SP],#4\n" \
"MSR CPSR_cxsf,R0\n" \
"LDMFD SP!, {R0-R12,LR}\n"


#ifdef my_debug_stuff
#define ASM_SAFE(asmcode) \
ASM_SAFE_ENTER \
asmcode \
ASM_SAFE_LEAVE
#else
#define ASM_SAFE(asmcode)
#endif
...
example usage:
"                LDR     R0, [SP]\n"
"                LDR     R1, [R0]\n"
ASM_SAFE(
"MOV R2, R1\n"
"LDR R1, =cs_msg_fmt\n"
"LDR R1, [R1]\n"
"MOV R0, #0x120\n"
"BL _LogPrintf\n"
)
"                CMP     R1, #0x1E\n"
Someday I'll get around to putting this in the trunk somewhere... the way we currently call chdk from ASM is technically wrong and very fragile.

edit
@asm1989
blind porting is a challenge :D
« Last Edit: 29 / October / 2010, 12:31:14 by reyalp »
Don't forget what the H stands for.

 

Related Topics