SX260 HS Porting Thread - page 9 - DryOS Development - CHDK Forum  

SX260 HS Porting Thread

  • 642 Replies
  • 155722 Views
*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #80 on: 14 / April / 2012, 14:25:12 »
Advertisements
yes the problem with the canon basic Script is that this code is diferent for these cams
Code: [Select]
PRIVATE SUB MakeLoader()
buf = AllocateMemory(76)
p = buf
*p = 0xee113f10 ' MRC p15, 0, R3, c1, c0, 0
p = p + 4
*p = 0xe3c33a01 ' BIC R3, R3, #0x1000 // icache bit
p = p + 4
*p = 0xe3c33004 ' BIC R3, R3, #0x4 // dcache bit
p = p + 4
*p = 0xee013f10 ' MCR p15, 0, R3, c1, c0, 0
p = p + 4
*p = 0xe3a03000 ' MOV R3, #0
p = p + 4
*p = 0xee073f9a ' MCR p15, 0, R3,c7,c10, 4 // drain write buffer
p = p + 4
*p = 0xee073f15 ' MCR p15, 0, R3,c7,c5 // flush icache
p = p + 4
*p = 0xee073f16 ' MCR p15, 0, R3,c7,c6 // flush dcache
p = p + 4
*p = 0xe10f4000 ' MRS R4, CPSR
p = p + 4
*p = 0xe3844080 ' ORR R4, R4, #0x80
p = p + 4
*p = 0xe12ff004 ' MSR CPSR_cxsf, R4 // disable IRQs
p = p + 4
*p = 0xee195f11 ' MRC p15, 0, R5, c9, c1, 0 // read data TCM config
p = p + 4
*p = 0xe1a05625 ' MOV R5, R5, LSR#12 // clear the lower 12 bits
p = p + 4
*p = 0xe7935605 ' LDR R5, [R3, R5, LSL#12] // R3 is still 0
p = p + 4
*p = 0xe1a02001 ' MOV R2, R1
p = p + 4
*p = 0xe1a01000 ' MOV R1, R0
p = p + 4
*p = 0xe3a00c19 ' MOV R0, #0x1900
p = p + 4
*p = 0xe3a03c19 ' MOV R3, #0x1900
p = p + 4
*p = 0xe12fff35 ' BLX R5
MakeLoader = buf
END SUB

Yes I'm trying autoboot  but for now, the screen is 100% black with no signs of even hang or do anything but once you insert the card and press play the camera will respond to nothing until you take out the battery and use other card.

The diference with this cam is that it copies some functions to RAM, and since I'm using 0x006..... for this funtions in ram, this is maybe wrong too.

thanks for the tips, anyway.

*

Offline reyalp

  • ******
  • 13449
Re: SX260 HS Porting Thread
« Reply #81 on: 14 / April / 2012, 16:54:46 »
yes the problem with the canon basic Script is that this code is diferent for these cams
I don't understand, what is this different from ? Looking at FF027250 in sx260, the call to the "copy and restart" function from TCM appears identical to other cams. Specifically, it's still stored in the first word of data TCM, and appears to take the same parameters. The code you quoted doesn't correspond to any particular firmware code.
Quote
Canonbasic loader doesn't work on sx220
Can you provide more information on how it "doesn't work" ?
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 13449
Re: SX260 HS Porting Thread
« Reply #82 on: 14 / April / 2012, 16:56:53 »
http://tools.assembla.com/chdk/browser/trunk/tools/pakwif.c#L17
??? pakwif is only used for vxworks (FIR).  see pakfi2 for dryos.

edit:
Another thought... if you haven't figured out how to light LEDs, you might try using poke in canon basic scripts to find the correct address / sequence.

edit again:
Here's background on how the canon basic loader is supposed to work http://chdk.setepontos.com/index.php?topic=5648.0
« Last Edit: 14 / April / 2012, 17:01:03 by reyalp »
Don't forget what the H stands for.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #83 on: 14 / April / 2012, 17:51:19 »
@reyalp
about the current cbasic script, I have traced the error back to the copyandrestart function, but it dosnt write a thing in romlog, so thats where I get, about sx200 no clue.
But I will look further for the thread you mention.

The FI2, I was wondering It they have changed the algorithm or tables  & keep the keys thats why we get  the error, but for example in sx40 it works, and don't know if it works on s100

How do I poke values in cbasic,  can I write asm directly anyway?



*

Offline reyalp

  • ******
  • 13449
Re: SX260 HS Porting Thread
« Reply #84 on: 14 / April / 2012, 18:29:36 »
How do I poke values in cbasic,  can I write asm directly anyway?
You can use pointers, like the loader does. Just set your pointer to a hex constant instead of using AllocateMemory.

System.Create also gives you functions like
Poke8, Poke16, Poke32
So Poke32(0xC...., 0x46)
etc should work.

If you want to write ASM, you can do like I did for loader: Write the asm code in a file, assemble to object, then write the values as words. But you have to be careful  for several things
- Code must be position independent
- After you set the values, they might not be flushed out of the data cache. There's a few ways around this. If you set the uncached bit on your pointer before setting the values, that should be OK. Sleeping will probably work too, since other tasks running will cause your changes to get flushed out.

You could also load your binary from a file, like loader, but just call the pointer instead of running it through the reboot code. The position/cache issues still apply.
Don't forget what the H stands for.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #85 on: 15 / April / 2012, 02:47:14 »
 I have been diging into the led stuff and its diferent than the one used in s100 & sx40

Is it possible to call LEDDrive(0,0) from boot.c instead of trying to find the ledaddress ?

moving 0 to R0 & R1 and then BL to LEDDRive address?

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #86 on: 15 / April / 2012, 09:34:01 »
@reyalp

I was able to boot up from the canon basic script commenting the dancing bits to generate main.bin, so it works with sx260

for now only just boot up to normal code but a big progress!!!

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #87 on: 15 / April / 2012, 11:33:12 »
well good news,

I was able to start-up using canonbasic, and boot.c is almost working,

I was even able to see the chdk LOGO before it crashed!!!!!
« Last Edit: 15 / April / 2012, 11:42:59 by asm1989 »


*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #88 on: 15 / April / 2012, 12:22:11 »
OK I was able to load chdk using the canon basic script & encoded diskbin using a FAT32 card with autoload.

Shows logo, It stays on for a while and then turns off, no big crash but turns off

It even hangs if jump back to the original code sooner in boot.c, so maybe is something realted to the canonbasic script or the trunk using 1807 now.

The log is the same with the script & autoload, so the script is working, is another issue.

attached the romlog, seams like something related to "AVS.c" any clue?
« Last Edit: 15 / April / 2012, 12:42:07 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX260 HS Porting Thread
« Reply #89 on: 15 / April / 2012, 14:51:44 »
Still no way to load by firmware update menu -> seams that somethings changes with the keys.
So load bin CanonBasic or autoload.

Attached my latest sources,

Loads and shows chdk logo and then crashed, by the romlog looks like something related to:
ScreenLock   /  ScreenUnLock / DisplayPhysicalScreenCBR / MuteOffPhysicalScreen ..... look at the previous post romlog.

Any clue? ???
« Last Edit: 15 / April / 2012, 15:47:43 by asm1989 »

 

Related Topics