Porting chdk to the G9 - page 5 - DryOS Development - CHDK Forum

Porting chdk to the G9

  • 245 Replies
  • 132609 Views
Re: Porting chdk to the G9
« Reply #40 on: 21 / April / 2008, 17:38:48 »
Advertisements
Hello Titan_G9! :)

did you have some progress?
have you tested the diskboot.bin?

I'm really sorry but it's late night and I'm just going to sleep soon, but next day I plan to test it with the Blue led where the code stop.

Thanks Grand!
I did not know that other method.  :(

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #41 on: 21 / April / 2008, 17:45:25 »
@bongo_bingo

The generic way of porting is:
1) Disable as much code as possible (keep just enough to boot CHDK)
2) Open two instances of IDA. Load your fw in the first IDA and the fw which is used as "base" (A720 in your case) in the second.
3) Go though the CHDK code, understand which code/constants of "base" fw were taken from, then search for the same code/consts in your fw.
4) Find any led address and try to switch the led on. It could help in debugging.
5) Step-by-step add code into boot.c. Check the boot process by led blinking.
6) When boot loader is worked, enable the main CHDK functionality. Double check the addresses in stubs_entry*.S files.
7) Adjust keyboard key-codes.
8) Step-by-step add code to capt_seq.c

PS. I described what I did when ported the SD870.
CHDK Developer.

Re: Porting chdk to the G9
« Reply #42 on: 21 / April / 2008, 19:06:01 »
almost understood GrAnd,
I'll be slow

Anyway, I've lost my time this way:

- copied my dump on primary.bin
- compiled with errors in stubs_entry_2.S
- started to replace functions adresses with the one in Names from Ida
- still have a lot of errors

tomorrow I'll try your method

Edit 1:

- I'm posting the error log
« Last Edit: 21 / April / 2008, 19:17:45 by bongo_bingo »

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #43 on: 22 / April / 2008, 02:10:28 »
- copied my dump on primary.bin

BTW. PRIMARY.BIN should be stripped from zeros. :) Use 'head-tail' method I described. Otherwise you will get wrong addresses detected.

BTW2. Why do you use .rtf format for saving your logs? I think, the plain txt will be enough. :)
« Last Edit: 22 / April / 2008, 02:14:56 by GrAnd »
CHDK Developer.

Re: Porting chdk to the G9
« Reply #44 on: 22 / April / 2008, 02:33:01 »
- copied my dump on primary.bin

BTW. PRIMARY.BIN should be stripped from zeros. :) Use 'head-tail' method I described. Otherwise you will get wrong addresses detected.

BTW2. Why do you use .rtf format for saving your logs? I think, the plain txt will be enough. :)

Goodmorning! :)

ok!

Edit 1:

- stripped the dump with tail-head, created primary.bin
- analized in ida and obteined a list of Names
- replaced known functions addresses in stubs_entry_2.S
- compiled successfully
- bootbin wont load in g9  :o

Edit 2:

- New adressess were found using: \tools\finsig.exe PRIMARY.BIN 0xff810000
- replaced in stubs_entry_2.S
- compiling


- ls this procedure have some logic?
- have I forgotted something?
« Last Edit: 22 / April / 2008, 06:31:44 by bongo_bingo »

Re: Porting chdk to the G9
« Reply #45 on: 22 / April / 2008, 06:38:19 »
Nothing new :o

Edit 1:

- What does it means?

wrappers.c -> wrappers.o
In file included from wrappers.c:1:
../generic/wrappers.c:297:2: warning: #warning A650, A720 do something with this
! - sizeof(x[]) must be >= sizeof(struct tm) : 'static int x[9];'
../generic/wrappers.c:359:2: warning: #warning A650, A720 do something with this
! - sizeof(de[]) must be >= sizeof(struct dirent): 'static char de[40];'
kbd.c -> kbd.o
« Last Edit: 22 / April / 2008, 06:40:24 by bongo_bingo »

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Porting chdk to the G9
« Reply #46 on: 22 / April / 2008, 06:46:07 »
- What does it means?

It means that that files contain #warning directive that prints these messages. That's ok for now.
CHDK Developer.

Re: Porting chdk to the G9
« Reply #47 on: 22 / April / 2008, 06:48:53 »
- What does it means?

It means that that files contain #warning directive that prints these messages. That's ok for now.

good! :)


Re: Porting chdk to the G9
« Reply #48 on: 22 / April / 2008, 11:41:20 »
Any hint to go ahead?

In the g9 wiki there are addresses for the leds:

LED_PWR   0xC0220068
LED_BLUE  0xC022006C
LED_AF    0xC0220094 (Same as G7)
LED_ISO   0xC02200B0

How can I modify the source to make it turn on?
How should I have to approach at \loader\resetcode\main.c?

Edit 1 & 2:

- changed led address in \loader\g9\main.c
  1) #define LED_PR 0xC0220068 was 0xC02200D4

- changed led address in \loader\g9\resetcode\main.c
   1)#define DP (void*)0xC022006C was 0xC02200C4
   
- changed led address in \platform\g9\lib.c :
 
  1) #define LED_PR 0xC022006C was 0xc02200C4
  2) #define LED_AF 0xC0220094 was 0xc0220080
- just compiling
- no led blinked
« Last Edit: 22 / April / 2008, 12:55:58 by bongo_bingo »

Re: Porting chdk to the G9
« Reply #49 on: 22 / April / 2008, 14:00:52 »

In the g9 wiki there are addresses for the leds:

LED_PWR   0xC0220068
LED_BLUE  0xC022006C
LED_AF    0xC0220094 (Same as G7)
LED_ISO   0xC02200B0

How can I modify the source to make it turn on?  Write 0x46 to turn ON 0x44 to turn OFF


for example to turn ON and OFF

Code: [Select]
long* led=(long*)0xC0220094;

void on(void)
{
 *led=0x46;
}

void off(void)
{
 *led=0x44;
}
 

Cheers

 

Related Topics


SimplePortal © 2008-2014, SimplePortal