the sx20 porting thread - page 7 - General Discussion and Assistance - CHDK Forum supplierdeeply

the sx20 porting thread

  • 1286 Replies
  • 444782 Views
*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #60 on: 19 / October / 2009, 13:43:57 »
Advertisements
I analysed all the files dozen times and i not found any problem. I must miss somthing, but i don't know what.

Any help appreciated. Where can i debug?

Reyalp: Am i right, that the camera should clean reboot without finding all the function addresses? I didn't add any spy task yet.

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #61 on: 19 / October / 2009, 14:11:23 »
If you have everything done right, then yes, the camera should restart nicely. So long as you commented the task hook functions so that no tasks are hooked.

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #62 on: 19 / October / 2009, 18:37:43 »
The very first thing that gets called loader/sx20/entry.S

   MOV     SP, #0x1900
   MOV     R11, #0
   B   my_restart

I changed this to

   LDR   R1, =0xFF83A570
   BX   R1

to jump the camera's own reset code, and this way i also get E31! So no copy, no trick.

Would be good to know, what is the very first code in the firmware that gets called.

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #63 on: 19 / October / 2009, 19:23:38 »
The very first code I think is in entry.S
Try to replace MOV     R3, #0x8000 with different values (higher, lower, etc.)

You might also want to comment out this code:

// Turn OFF SD Card power
// to support autostart
   LDR     R3, =0xC0220018
   MOV     R2, #0x44
   STR     R2, [R3]

Just to be sure.
And I hope you did test to make sure the code actually reaches this part, right?
« Last Edit: 19 / October / 2009, 19:28:06 by RaduP »


*

Online reyalp

  • ******
  • 14079
Re: the sx20 porting thread
« Reply #64 on: 19 / October / 2009, 19:44:53 »
Reyalp: Am i right, that the camera should clean reboot without finding all the function addresses? I didn't add any spy task yet.
Depending where you have go to, yes. Obviously having correct addresses for functions only matters if those functions are called. Walk through the execution from loader/<camera>/entry.S onward, and you can see what is needed where. If you don't create spytask or hook any other tasks, then basically you don't need any of the camera functions or variables.

You probably need asm stuff in  loader/<camera>/resetcode/main.c to boot correctly after loading an FI2 or diskboot. edit: note that this, like almost all the inline ASM, is specific to your camera.
Don't forget what the H stands for.

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #65 on: 20 / October / 2009, 06:50:37 »
The very first code I think is in entry.S
Try to replace MOV     R3, #0x8000 with different values (higher, lower, etc.)

Days before i tried higher value (64000) with no result, now i tried lower value (1000) with no result.

Quote
You might also want to comment out this code:

// Turn OFF SD Card power
// to support autostart
   LDR     R3, =0xC0220018
   MOV     R2, #0x44
   STR     R2, [R3]

Just to be sure.

Yes, of course, i tried to comment this out, but as i analysed the firmware code and i'am 99% sure, this address (0xC0220018) is also the SD card power address for sx20.

Quote
And I hope you did test to make sure the code actually reaches this part, right?
Especially, i didn't tried to blink in loader/sx20/entry.S, but the last line of this code is "B   my_restart", and the there were successfull blinking in the fist line of the

void __attribute__((noreturn)) my_restart() {

function. Is this enought, or should i try in asm code?

Thanx for the ideas! Now i'am not hopless. :)

Somehow i must jump over this silly problem.

*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #66 on: 20 / October / 2009, 06:55:47 »
Walk through the execution from loader/<camera>/entry.S onward, and you can see what is needed where.
Is that true, if i jump to the code, in the firmware:

        asm volatile (
                 "MRS     R0, CPSR\n"
                 "BIC     R0, R0, #0x3F\n"
                 "ORR     R0, R0, #0xD3\n"
                 "MSR     CPSR, R0\n"
                 "LDR     R1, =0xC0200000\n"
                 "MVN     R0, #0\n"
                 "STR     R0, [R1,#0x10C]\n"
                 "STR     R0, [R1,#0xC]\n"
                 "STR     R0, [R1,#0x1C]\n"

in the loader/sx20/entry.S, the camera should boot normally?

http://chdk.setepontos.com/index.php/topic,4348.msg41835.html#msg41835

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #67 on: 20 / October / 2009, 13:53:41 »
No, I think it will crash or something.
I remember trying to do something similar, and the camera won't restart until you complete some of the restart code. But I forgot where exactly you can safely restart it.


*

Offline neszt

  • ***
  • 174
Re: the sx20 porting thread
« Reply #68 on: 20 / October / 2009, 15:30:56 »
I begun to try again the DISKBOOT.BIN method. (when i got infinite reboot loop).

I'am curious what, if i can avoid the infinite reboot loop by turning the SD power off. Will i get E31 also?

I dont't know, because i can not avoid the loop, but i'am sure, that the sx20 SD Power address is the same as sx10, sx1, sd980, sd990, sx200. (0xC0220018)

I saw in sx200 case that the delay was incressed to 0xF0000, so i tried also extreme high values, but no result.

*

Offline RaduP

  • *****
  • 926
Re: the sx20 porting thread
« Reply #69 on: 20 / October / 2009, 15:43:39 »
My SD980 address is wrong though. Don't rely on it.
Also, if you get an infinite boot loop, it means the camera actually does reboot.. try to find the right address.

 

Related Topics