G7X II - need help finding led details. - General Discussion and Assistance - CHDK Forum

G7X II - need help finding led details.

  • 30 Replies
  • 999 Views
*

Offline philmoz

  • *****
  • 3107
    • Photos
G7X II - need help finding led details.
« on: 06 / May / 2019, 00:36:42 »
Advertisements
So I also have a Digic 7 G7X II, which has some changes in the firmware even though it's still DryOS R58.

Firmware starts at 0xE0000000, and I needed to tweak finsig_thumb2 to find some of the core bits (changes are in the G5X branch).

My main issue is I can't get anything to boot and I can't find the led GPIO or on/off control values to put debugging blinking in - these seem to have changed again.

Any ideas or pointers on how I can track these down would be greatly appreciated.
« Last Edit: 06 / May / 2019, 00:38:29 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

*

Offline reyalp

  • ******
  • 11903
Re: G7X II - need help finding led details.
« Reply #1 on: 06 / May / 2019, 01:11:10 »
In case you haven't already found it, there was some digic 7 investigation in https://chdk.setepontos.com/index.php?topic=13014.msg131205#msg131205

Magic Lantern also has some https://www.magiclantern.fm/forum/index.php?topic=19737.0 might be worth trying their LED addresses.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 3907
Re: G7X II - need help finding led details.
« Reply #2 on: 06 / May / 2019, 13:03:29 »
can't find the led GPIO or on/off control values to put debugging blinking in - these seem to have changed again.

Any ideas or pointers on how I can track these down would be greatly appreciated.
From this post, GPIO base address is 0xd2080000, led on 0x20d0002, off 0x20c0003.
By following what I did in finsig, the LED table element init function is sub_E045D84A, the GPIO offset is either in r1 or r2. The led_on function used by task_LEDCon is sub_E003BF00, led_off is sub_E003BF16. Addresses are for firmware 101b.

You can do various experiments from Canon Basic, you can find examples in this thread.
And I keep mentioning that the D7 ARM cores don't support integer division, you'll need to adjust the makefile.

*

Offline philmoz

  • *****
  • 3107
    • Photos
Re: G7X II - need help finding led details.
« Reply #3 on: 06 / May / 2019, 18:04:43 »
can't find the led GPIO or on/off control values to put debugging blinking in - these seem to have changed again.

Any ideas or pointers on how I can track these down would be greatly appreciated.
From this post, GPIO base address is 0xd2080000, led on 0x20d0002, off 0x20c0003.
By following what I did in finsig, the LED table element init function is sub_E045D84A, the GPIO offset is either in r1 or r2. The led_on function used by task_LEDCon is sub_E003BF00, led_off is sub_E003BF16. Addresses are for firmware 101b.

You can do various experiments from Canon Basic, you can find examples in this thread.
And I keep mentioning that the D7 ARM cores don't support integer division, you'll need to adjust the makefile.


Thanks very much.


Any thoughts on what setting to use in arm_rules.inc for -march?

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)


*

Offline srsa_4c

  • ******
  • 3907
Re: G7X II - need help finding led details.
« Reply #4 on: 06 / May / 2019, 18:30:30 »
Any thoughts on what setting to use in arm_rules.inc for -march?
-march=armv7-a
That might just work for the DIGIC 6 Cortex R too, but if it comes to integrating D7 support, it would be great if D6 could still keep this small piece of performance (integer division) somehow.

*

Offline philmoz

  • *****
  • 3107
    • Photos
Re: G7X II - need help finding led details.
« Reply #5 on: 07 / May / 2019, 08:17:36 »
Any thoughts on what setting to use in arm_rules.inc for -march?
-march=armv7-a
That might just work for the DIGIC 6 Cortex R too, but if it comes to integrating D7 support, it would be great if D6 could still keep this small piece of performance (integer division) somehow.


:) Thanks for the help - I now have the boot loader working with blinking green LED.


Now to get it to do something useful...
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

*

Offline philmoz

  • *****
  • 3107
    • Photos
Re: G7X II - need help finding led details.
« Reply #6 on: 07 / May / 2019, 18:25:09 »
Question - since the Digic7 needs a different ARM architecture from Digic6 the files that are compiled as 'camera independent' are not compatible between D6 and D7.


I guess we need to seperate the build files out into yet a another directory.
I'm thinking of:
- Adding a DIGIC7 define in the camera makefile.inc file (along with THUMB_FW)
- Setting the build directory to .o3 if DIGIC7 is set.


Any thoughts? Any better way to handle this?

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

*

Offline srsa_4c

  • ******
  • 3907
Re: G7X II - need help finding led details.
« Reply #7 on: 07 / May / 2019, 19:25:40 »
the Digic7 needs a different ARM architecture from Digic6 the files that are compiled as 'camera independent' are not compatible between D6 and D7.
AFAIK the only practical difference is the presence or absence of udiv and sdiv instructions, but I did not check.
My original thoughts were keeping D6 and D7 modules compatible:
We could build platform with the appropriate -march, and the core / modules as armv7-a. If that's even possible, we could provide v7-a and v7-r specific math routines and link the appropriate one.
... but that might be too much work compared to
- Setting the build directory to .o3 if DIGIC7 is set.
Users with several cameras are already affected by modules' incompatibility (D6 vs previous), introducing a third set of modules would not make significantly more mess.

edit:
D7 may bring a different set of troubles (I'm thinking about threading problems) which may then require specific fixes. That would then go against keeping D6 D7 compatibility.
« Last Edit: 07 / May / 2019, 19:29:28 by srsa_4c »


*

Offline reyalp

  • ******
  • 11903
Re: G7X II - need help finding led details.
« Reply #8 on: 08 / May / 2019, 01:19:04 »
D7 may bring a different set of troubles (I'm thinking about threading problems) which may then require specific fixes. That would then go against keeping D6 D7 compatibility.
ML had changes to cache routines https://www.magiclantern.fm/forum/index.php?topic=19737.msg205290#msg205290

MMU might also have some impact or provide opportunities https://chdk.setepontos.com/index.php?topic=13014.msg131247#msg131247

My initial inclination is to .o3, but that's little more than WAG.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3107
    • Photos
Re: G7X II - need help finding led details.
« Reply #9 on: 08 / May / 2019, 18:55:42 »
Made some progress with the boot sequence on G7X II; but I've come unstuck and could use some pointers.


Early in the startup (just after stdio setup) it calls a function at 0xe051e07c which calls 0xe04f0d9c (this is FW 1.01a).
The code in the second function is:
            //capdis -f=chdk -s=0xe04f0d9d -c=7 -stubs PRIMARY.BIN 0xe0000000
            "    orr.w   r0, r0, r1, lsl #16\n"
            "    movw    r1, #0x1f00\n"
            "    movt    r1, #0xc100\n"
            "    str     r0, [r1]\n"            " <<<<< HANGS HERE
            "    dsb     sy\n"
            "    mov.w   r0, #0\n"
            "    bx      lr\n"


The store operation to 0xc1001f00 hangs the camera - I can blink the LED before this instruction; but not after.
I'm guessing this is some protected memory region set up in the MMU; but I have no idea how to get around it.


If I bypass this call then I can get further but it will eventually hang again later in the code.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

 

Related Topics