IXUS 1000 HS Porting Thread - page 17 - DryOS Development - CHDK Forum

IXUS 1000 HS Porting Thread

  • 440 Replies
  • 144636 Views
Re: IXUS 1000 HS Porting Thread
« Reply #160 on: 15 / November / 2010, 14:13:26 »
Advertisements
You have add a ASM_SAFE("BL blink\n") below.is that execute on your CAM when you activate it ?


void __attribute__((naked,noinline)) sub_FF986044_my(){      // in sx200:sub_FF937C70_my
 asm volatile(
"      STMFD   SP!, {R4-R11,LR}\n"
"      SUB   SP, SP,   #0x64\n"
"      MOV   R8, #0\n"
"      LDR   R7, =0x7898\n"
"      STR   R8, [SP,#0x54]\n"
"      STR   R8, [SP,#0x4C]\n"
"      STR   R8, [R7,#0xB8]\n"
"      STR   R8, [R7,#0xBC]\n"
"      STR   R8, [R7,#0xC0]\n"
"      MOV   R4, R0\n"
"      STR   R8, [R7,#0xC4]\n"
"      LDR   R0, [R7,#0x44]\n"
"      MOV   R9, #0\n"
"      CMP   R0, #3\n"
"      MOVEQ   R0, #4\n"
"      STREQ   R0, [R7,#0x44]\n"
"      LDR   R0, [R7,#0xB4]\n"
"      MOV   R6, #0\n"
"      MOV   R5, #1\n"
"      BLX   R0\n"
"      LDR   R0, [R7,#0x44]\n"
"      CMP   R0, #6\n"
"      BEQ   loc_FF9860B4\n"
//ASM_SAFE("BL blink\n")


I have change

"      LDR   R6, =0xFF986044\n" //__MovieRecorder.c__0 ;   LOCATION: MovieRecorder.c:0
//"      LDR   R6, =sub_FF986044_my\n" //__MovieRecorder.c__0 ;   LOCATION: MovieRecorder.c:0

so the sub_FF986044_my is not use.

this work.so the first codepart is ok and the blink should reach.
my guess is this function

void  set_quality(int *x){ // -17 highest; +12 lowest
 if (conf.video_mode) *x=12-((conf.video_quality-1)*(12+17)/(99-1));
}

this can trash register, maybe you call that with asm safe

 "LDR     R0, =0x7920-4\n"      // -<---     // +
 "BL      set_quality\n"                     // +

« Last Edit: 15 / November / 2010, 14:15:13 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #161 on: 15 / November / 2010, 15:45:55 »
yes I think the problem is in sub_FF986044_my(){  

So where do you manage to track the blink?

Also I think the slow motion movie goes with another task o a diferent branch thats why it dosnt fail

This is like in other cams but with the correct numbers for this cam
Code: [Select]
"LDR     R0, =0x7920-4\n"      // -<---     // +
 "BL      set_quality\n"                     // +
« Last Edit: 15 / November / 2010, 15:51:10 by asm1989 »

Re: IXUS 1000 HS Porting Thread
« Reply #162 on: 16 / November / 2010, 05:23:26 »
I test and when i remove this code, record work.I test 2 times.switch was in middle position.

// "LDR     R0, =0x7920-4\n"      // -<---     // +
// "BL      set_quality\n"                     // +

maybe the quality calculation is wrong for this CAM

when you deactivate this lines, does it work then on your F Firmware too ?
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #163 on: 16 / November / 2010, 12:45:39 »
100F Crashes at the end of video record even with these two lines comented.


Re: IXUS 1000 HS Porting Thread
« Reply #164 on: 17 / November / 2010, 04:02:41 »
Hm. i test again, and switch to video mode(left), it crash(show no rec symbol).then i try middle mode, crash too and show no rec symbol.but later test it show rec symbol and crash

sorry that i think it work, or its maybe a random crash, or i just forget to copy the new file to SD Card.

But all the time when use old code

"      LDR   R6, =0xFF986044\n" //__MovieRecorder.c__0 ;   LOCATION: MovieRecorder.c:0

it work

I notice that when i add blink here, blink not work.so this func seem not called when i activate

"      LDR   R6, =sub_FF986044_my\n" //__MovieRecorder.c__0 ;   LOCATION: MovieRecorder.c:0

and deactivate old

void __attribute__((naked,noinline)) sub_FF986044_my(){      // in sx200:sub_FF937C70_my
 asm volatile(
"      STMFD   SP!, {R4-R11,LR}\n"
"      SUB   SP, SP,   #0x64\n"
"      MOV   R8, #0\n"
"      LDR   R7, =0x7898\n"
"              BL blink  " //not work
My arm asm knowledge is not good, but i test what commands use register r6

that store here to 0xcc

"      STR   R6, [R4,#0xCC]\n"

Now i look what commands access r4,#0xCC.

I find that code, there seem load the address to register r1 and a BLX seem a call of this function.but what mean the X ?


"loc_FF98674C:\n"
"      LDR   R1, [R4,#0xCC]\n"
"      BLX   R1\n"
"      B   loc_FF986794\n"

maybe somebody with better arm knowledge can tell what this do
« Last Edit: 17 / November / 2010, 04:04:49 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #165 on: 18 / November / 2010, 00:36:55 »

Re: IXUS 1000 HS Porting Thread
« Reply #166 on: 18 / November / 2010, 04:18:10 »
>BLX label always causes a change to Thumb state.

is the sub_FF986044_my in thumb instruction set compile ?
because this func is not execute, that the inctruction set is wrong, is a possible reason.


>I think the problem is somewhere at sub_FF986044_my, becuse if you replace it with the correct >one it works

but when at beginning of sub_FF986044_my a blink not work, then the function is never called.

because camera crash badly, do you know a asm command call, that powerdown the camera correct ?

so when a codeplace to test is reach,  the camera do not blink with Lens out.the lens is move in and you can see the place is reach.

because when the lens is out and you switch on the camera there come not nice sound out of it.

sure every camera have a lens moter overload protect, because a user can too remove the battery when lens is out, or touch on lens when this is move

but i want use my camera in next 10 years, so i want use it carefully. ;-)

its also usefull to test if the BLX command is reach.

this blx have so many exceptions but do you think this command is able to call sub_FF986044_my ?

if it should call, then there need the func sub_FF986044_my reach.
« Last Edit: 18 / November / 2010, 04:21:48 by Bernd R »
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #167 on: 19 / November / 2010, 08:40:47 »
I dont think the problem is in the blx , in most of the movie_rec files of other cams is present,

my aproach to find where it fails is by geting back to the firmaware address,

for example to see if it reaches this function at any point you B (branch with no link) to what would be its sub address
Quote
void __attribute__((naked,noinline)) sub_FF986050_my(){     
 asm volatile(
"      STMFD   SP!, {R4-R11,LR}\n"
"B sub_FF986054\n"  // back to firm works.

this should be better than the blink stuff

I will try to go this way


Re: IXUS 1000 HS Porting Thread
« Reply #168 on: 19 / November / 2010, 10:08:48 »
I get now in mind the blink stuff fail maybe because it is no thumb code.

but how to write code that work in thumb mode.
Ixus 1000 HS

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: IXUS 1000 HS Porting Thread
« Reply #169 on: 19 / November / 2010, 11:07:06 »
Instead of doing the blink, just jump to the original firmware with the B instrucction

Bernrd here you have a version, that returns to firmware an looks like works, becuse it overloads the video if you change the quality!
http://www.4shared.com/file/Yo0x8s7O/ixus1000-100Dmovie_recc-v002.html

BUT:

I think that where fails is In this instruction:
Code: [Select]
" MOVL R3, 0xFFFFFFFE\n"
I converted it maybe wrong to

Code: [Select]
" MVN R3, #0xFFFFFFFE\n"
I try also with LDR but hangs badly too

Is this correct question for any of the chdk code gurus!!

« Last Edit: 19 / November / 2010, 12:15:22 by asm1989 »

 

Related Topics