SX720 Porting thread - page 8 - DryOS Development - CHDK Forum

SX720 Porting thread

  • 158 Replies
  • 42413 Views
*

Offline srsa_4c

  • ******
  • 4078
Re: SX720 Porting thread
« Reply #70 on: 09 / April / 2016, 10:56:43 »
Advertisements
Here they are http://filebin.net/b1brrlhc77
One thing I could think of is, CHDK gets corrupted or the CPU cache is messing with you.
Now, the routine called in the loader is supposed to take care of at least the data cache.

You could try setting MEMISOSTART to 0x6de000 (which is the AdditionAgentRAM memory), but it's only good when the CHDK core stays below 0x22000 bytes in size.

One other thing to try is using the CHDK CPU cache routines (lib/armutil/cache.c) icache_flush_all() and dcache_clean_all() .

I'm starting getting clueless...

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX720 Porting thread
« Reply #71 on: 09 / April / 2016, 11:23:53 »
with MEMISOSTART to 0x6de000  the led on works after "ldr     r0, =hook_CreateTask\n"  interesting


EDIT: it dosn't seem to work, the led stays on from the beginning seems to be crashed maybe size is too big, where do you suggest to use the cache routines, in main.c in loader?
« Last Edit: 09 / April / 2016, 12:23:07 by asm1989 »

*

Offline srsa_4c

  • ******
  • 4078
Re: SX720 Porting thread
« Reply #72 on: 09 / April / 2016, 15:35:13 »
Hopefully reyalp will come up with some better ideas. For me, it seems like CPU cache issue.

In the meantime:
The 'Restart' routine (sub_fc0a9e3a, unless I'm wrong) in this fw seems to have lost its restart capability. The magic value 0x12345678 and the fw start address 0xfc020001 don't appear anywhere in main fw.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX720 Porting thread
« Reply #73 on: 09 / April / 2016, 17:28:24 »
yes will wait for reyalp magic, stuck here , I didn't find 0x12345678  either


*

Offline srsa_4c

  • ******
  • 4078
Re: SX720 Porting thread
« Reply #74 on: 09 / April / 2016, 17:45:10 »
Checked the cache-related routine which is used at main firmware start and also in CHDK loader: no change between the 2 cameras... If it works in one, I'd expect it to work in the other.
We'll probably need to review the details of the diskboot process.
I hope I'm not overlooking something obvious...

*

Offline reyalp

  • ******
  • 12297
Re: SX720 Porting thread
« Reply #75 on: 09 / April / 2016, 17:46:04 »
FWIW, SAFEblinkout in the last posted code is not correct. You should just use the macro call directly (assuming it works in thumb2, which I haven't verified). Without "naked" the compiler will add it's own stuff to a function, and in any case using a function call will change LR so it defeats the purpose.

I don't see an obvious problem yet. I agree with srsa that you should start without the task hooks. The first goal should be to get the camera to boot normally with CHDK present, without out creating / hooking any CHDK tasks or changing anything not directly required to boot. You still need to comment out the StartDiskboot to prevent a boot loop, and you might need something else for the poweron button checks.

Debugging this kind of thing it's easy to get tricked by errors caused by the debugging code ('ve done this many time myself  :-[). Until the Canon firmware starts creating tasks (task_startup_my), I highly recommend using an infinite loop to see how far it gets, or at least one long enough to be really obvious. You will need to pull the battery each time, but at least you can be sure where your code got to.

When I started the G7x, I was confused by the startup button checks for a long time, because the actual behavior depended on how long the play or power buttons was held: If just clicked, it would shut down, if held long enough, it would boot. Since it looks like the 0x12345678 stuff doesn't exist any more on your cam, it's probably a good idea to hold the button down.
Don't forget what the H stands for.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX720 Porting thread
« Reply #76 on: 10 / April / 2016, 09:40:51 »
Maybe some progress without this
//   "ldr     r0, =hook_CreateTask\n"    // Address to patch (hook_ has thumb bit off)
//   "stm     r0, {r1,r2}\n"             // Store patch instructions
and this in main.c (optional it boots witho or without it)
 //*(volatile unsigned *)(0x4ffc)=0x12345678;   

Boots with long press , but no chdk logo or anything is shown, and seems to shut down in a few secs
« Last Edit: 10 / April / 2016, 09:47:43 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX720 Porting thread
« Reply #77 on: 10 / April / 2016, 09:56:02 »
Any clue on how to proceed where hook_CreateTask is defined, I see somethings in finsig file, could not be that this is wrong for this cam ?
« Last Edit: 10 / April / 2016, 10:04:52 by asm1989 »


*

Offline srsa_4c

  • ******
  • 4078
Re: SX720 Porting thread
« Reply #78 on: 10 / April / 2016, 10:16:18 »
Boots with long press , but no chdk logo or anything is shown,
Finally, at least something. So it's not a cache issue. You don't see anything because you either don't start spytask or (most likely) do not have the correct frame buffer related addresses.
Quote
and seems to shut down in a few secs
Try getting a romlog (and make a snapshot of your source and corresponding main.bin.dump): http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Romlog

The shutdown reason could be either a crash (assert, exception) or due to a missing startupflag.
edit: If your bitmap overlay variables are wrong, that's the most likely reason of shutdown.

I'd recommend finding out the reason of shutdown before continuing.

I have posted a RAM dumper Canon Basic script, you may want to make a dump (without CHDK!) to see firmware variables (the startup flags for example) and framebuffers. If you want to see framebuffers, make a large dump (up to the available RAM, which, I think, is 512MB.

Note, however, that you won't be able to see/dump the first bytes of RAM (IIRC 32) due to protection.
Modify the mydump line in the script to
mydump(32,0x1FFFFFE0)
to get 512MB - 32 bytes. Don't forget to insert 32 zero bytes at the start of the dump later to get correct addresses when analysing.
« Last Edit: 10 / April / 2016, 10:25:33 by srsa_4c »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: SX720 Porting thread
« Reply #79 on: 10 / April / 2016, 10:44:39 »
Thanks srsa_4c here is the romlog, ramdump script takes longer but works


And any clue why with this enable "ldr     r0, =hook_CreateTask\n" it wont boot?
« Last Edit: 10 / April / 2016, 11:22:09 by asm1989 »

 

Related Topics