Author Topic: DIGIC 8 'PowerShot' development (M50, SX70, SX740)  (Read 19586 times)

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3645
DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« on: April 21, 2018, 04:20:27 PM »
Edit: the EOS M50 appears to run EOS firmware (other recent models, i.e. M3, M5, M6, M10 and M100, are based on PowerShot firmware). Looking for a volunteer to try the LED blinking test on this camera, too :)

+1
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

acarboni

  • New to the forum
  • *
  • Posts: 2
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #1 on: May 22, 2018, 05:40:24 PM »
Hi! I've got an M50, a second camera, and I went out and bought a couple low-capacity SD cards. I'd love to help out with the blinking led test. Do I just use the standard one from the diagnostic tools thread (http://a1ex.magiclantern.fm/blink/autoexec.bin)? Does anyone have a link to instructions/materials that I might've missed to help me through the process?

lovefilm

  • New to the forum
  • *
  • Posts: 4
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #2 on: June 03, 2018, 10:46:06 PM »
Portable ROM dumpers ready 8)

M50_DUMP.FIR (need a second volunteer who has either another camera to film the display, or a phototransistor connected to soundcard/arduino/whatever)

Emulation coming soon.

Hello a1ex!

Also got a M50 and a 2nd camera, would be happy to help as well.

Since the M50 is running EOS firmware, would that mean its easier to port Magic Lantern to it? :)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12171
  • Maintenance mode
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #3 on: June 04, 2018, 04:19:01 PM »
I went out and bought a couple low-capacity SD cards.

Really? You only need a small filesystem; card size doesn't matter. You can run the test on 128GB cards just as easy as on a 2GB card (in other words, both of them will have to be formatted at a smaller capacity anyway).

LED blinking FIR sent via PM.

lovefilm

  • New to the forum
  • *
  • Posts: 4
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #4 on: June 04, 2018, 11:04:07 PM »
LED blinking FIR sent via PM.

Trying to get it working on my M50,

I used dd to write the QEMU image suggested in here https://www.magiclantern.fm/forum/index.php?topic=16534.0 to my SD-Card, this it how it looks now:
Code: [Select]
root@cubeX:/home/freezer/Canon# fdisk -l /dev/sdd
Disk /dev/sdd: 59,5 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start    End Sectors   Size Id Type
/dev/sdd1          99 506879  506781 247,5M  6 FAT16

And the file-structure within the FAT16:

Code: [Select]
root@cubeX:/media/freezer/EOS_DIGITAL# find .
.
./autoexec.bin
./LEDIDM50.FIR
./DCIM
./DCIM/autoexec.bin
./DCIM/LEDIDM50.FIR
./DCIM/100CANON
./DCIM/EOSMISC
./MISC

filesizes:
-rw-r--r-- 1 freezer freezer   604 Jun  4 19:16 LEDIDM50.FIR
-rw-r--r-- 1 freezer freezer 25312 Jun  4 20:07 autoexec.bin

I used the autoexec.bin from the Portable ROM-Dumper thread above and the .FIR provided. Copied them to both / and /DCIM

However nothing really seems to happen when turning it on with the SD-Card inserted. As far as I understand the .FIR file is to enable the boot-flag in the Canon Firmware, is there anything special needed to do to apply it?


Thanks!


ArcziPL

  • Contributor
  • Member
  • *****
  • Posts: 129
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #5 on: June 04, 2018, 11:28:58 PM »
Run "firmware update" from the original menu.
70D.112 | M50.102 | M.202

lovefilm

  • New to the forum
  • *
  • Posts: 4
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #6 on: June 04, 2018, 11:48:06 PM »
Run "firmware update" from the original menu.

Can't find any option to update firmware in the original menu.

EOS Utility seems to have an option for Firmware Update, not sure if that would work? Don't have a Windows installation right now.

ArcziPL

  • Contributor
  • Member
  • *****
  • Posts: 129
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #7 on: June 05, 2018, 08:06:09 AM »
You have to be in one of the following modes: M/Av/Tv/P. The camera manual describes it for sure. And don't use EOS Utility for that.
70D.112 | M50.102 | M.202

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6673
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #8 on: June 05, 2018, 08:58:52 AM »
Page 299 of your manual contains a screenshot showing firmware information. Highlight/select this item and open sub-menu to access firmware update option.
@ArcziPL: Nope, Canon don't bother users with this kind of geeky stuff ...
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

lovefilm

  • New to the forum
  • *
  • Posts: 4
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #9 on: June 05, 2018, 09:15:16 AM »
Thanks,
got it now.

However when i confirm "Update firmware" with OK, the LCD screen goes black immediately with no LED blinking or anything else happening.
Have to remove the battery to revive it. 

ldevulder

  • New to the forum
  • *
  • Posts: 1
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #10 on: June 10, 2018, 05:23:09 PM »
Hi all,

I've got a M50 and another camera (6D). I'm ready to help any developper to port ML on this camera.

I didn't find the FIR file to perform the LED blinking test on the M50.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3645
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #11 on: June 11, 2018, 10:00:32 PM »
I didn't find the FIR file to perform the LED blinking test on the M50.

You need to get it from a1ex via PM.

Also read over posts from lovefilm because he tried running the M50 LED blinking test.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Ant123

  • Contributor
  • Member
  • *****
  • Posts: 117
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #12 on: August 07, 2018, 11:06:24 PM »
Canon released firmware update for EOS M50.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12171
  • Maintenance mode
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #13 on: August 08, 2018, 05:55:59 PM »
Looks very much like DIGIC 7. Dual core.

Code: [Select]
EC412 READY
EC412 ICU Firmware Version 1.0.1 ( 6.8.0 )
ICU Release DateTime May 23 2018 15:50:06
...
[CPU0] [        init:e014499b ] task_create(PowerMgr, prio=20, stack=400, entry=e01448ed, arg=0)
[CPU0] [        init:e0558f51 ] task_create(DbgMgr, prio=1f, stack=0, entry=e0558ecf, arg=c81c78)
[CPU0] [        init:e0097255 ] CreateStateObject(DMState, 0xe09d49c0, inputs=22, states=2)
[CPU0] [        init:e004c24b ] task_create(EEPROM, prio=1f, stack=400, entry=e004bea5, arg=0)
[CPU0] [        init:e0044ea9 ] task_create(ROM0R, prio=11, stack=400, entry=e00448c1, arg=620004)
[CPU0] [        init:e0044ebb ] task_create(ROM1R, prio=11, stack=400, entry=e00448c1, arg=640006)
...
[CPU0] [        init:e0622337 ] register_func('EnableBootDisk', e062228b, 0)
[CPU0] [        init:e0622343 ] register_func('DisableBootDisk', e0622295, 0)
...
[CPU0] [        init:e0050521 ] task_create(Startup, prio=15, stack=2800, entry=e0050415, arg=c826a0)
[CPU0] [        init:e0040905 ] task_create(TaskMain, prio=1d, stack=0, entry=e0040525, arg=0)
[CPU0] [     Startup:e0558f51 ] task_create(PropMgr, prio=14, stack=0, entry=e0558ecf, arg=cc9264)

akashimorino
[CPU0] [    TaskMain:e00461e9 ] register_func('drysh', e07393e9, 0)
[CPU0] [    TaskMain:e00461ff ] register_func('NewTaskShell', e00461ad, 0)
[CPU0] [    TaskMain:e00461c9 ] task_create(EvShel, prio=18, stack=8000, entry=e0046105, arg=0)
[CPU0] [      EvShel:e05773eb ] task_create(LowConsole, prio=19, stack=800, entry=e005153d, arg=0)
[CPU0] [      EvShel:e05773eb ] task_create(ConsoleSvr, prio=18, stack=800, entry=e0051141, arg=0)

Open Console EC412[1]>...

EC412[1]>drysh

Dry[WarpPUX]> ?
[Kern]
 extask  memmap  meminfo  mkcfg  dminfo  exobjinfo  stdlibcfg  efatcfg
 sysvers  xd  xm  prio  resume  suspend  release  sem  mutex  event  mq  exit

Dry[WarpPUX]> memmap
e008f6c0 : Exception vector
000dc870 : Heap start
           0x00114920(1132832)
001f1190 : Heap end
001f1190 : DRYOS system object
           0x000094e0(38112)
001fa670 : DRYOS system memory
           0x000e2200(926208)
000dc070 : Error exception stack start (PU0)
           0x00000400(1024)
000dc470 : Error exception stack end (PU0)
000dc470 : Error exception stack start (PU1)
           0x00000400(1024)
000dc870 : Error exception stack end (PU1)
df000000 : IRQ exception stack start (PU0)
           0x00001000(4096)
df001000 : IRQ exception stack end (PU0)
df001000 : IRQ exception stack start (PU1)
           0x00001000(4096)
df002000 : IRQ exception stack end (PU1)

Dry[WarpPUX]> meminfo -m
Malloc Information (onetime type)
  Start Address       = 0x000dc878
  End Address         = 0x001f0ec0
  Total Size          = 0x00114648 (  1132104)
  Allocated Size      = 0x000018c8 (     6344)
  Allocated Peak      = 0x000018c8 (     6344)
  Allocated Count     = 0x00000008 (        8)
  Free Size           = 0x00112d80 (  1125760)
  Free Block Max Size = 0x00112d80 (  1125760)
  Free Block Count    = 0x00000001 (        1)

Dry[WarpPUX]> sysvers
SystemIF 0.97
DRYOS version 2.3, release #0060+p2
 MACH 0.50

TODO: figure out LED address(es), bootloader display registers and a way to dump the ROM. Currently running it from a modified 200D bootloader.

Edit: might have found the LEDs (drive values: on = 0xD0002, off = 0xC0003)
- 0: SD card LED 0xD01300E4
- 6: WLAN LED 0xD01300E4 (same LED?!)
- 7, 8, 10, 11: 0xD01300E4 (same LED?!)
- 1, 2, 3, 4, 9: unknown 0xD01301A4
- 5: ?! (no obvious MMIO activity)

Volunteers willing to run untested code are welcome.

shadimar69

  • New to the forum
  • *
  • Posts: 5
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #14 on: October 18, 2018, 04:12:32 AM »
Hi all,

Just received my shiny new M50 and then rapidly proceeded to wonder how I can make it do what it 'should' be able to do. ;)

I have read through this forum, and have not seen any definitive working versions of ML(Magic Lantern) for the M50. Can someone significantly more intelligent than myself in regards to firmware code injection, please advise current status of a functioning ML for the Canon M50 on the DIGIC 8?

Please let me know if there is anything I can do to help progress/assist with the project moving forward.

Thanks in advance! :)
Canon M50 tinkerer

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12171
  • Maintenance mode
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #15 on: October 18, 2018, 09:22:22 AM »
Status:
- can run custom code (FIR files for now; I need to prepare those)
- can blink the LEDs
- can flip error screen from bootloader
- can jump to main firmware from FIR (no special tricks required)
- cannot boot main firmware with 200D code (likely easy to debug)
- can not display custom stuff on the screen, not even from bootloader (likely easy after seeing the bootloader)

I can prepare test files for #5, but not right now.

shadimar69

  • New to the forum
  • *
  • Posts: 5
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #16 on: October 18, 2018, 10:14:58 AM »
Thank you for the status update a1ex!

Please let me know if there is anything that I can do to help expedite any of the steps.

Thank you again! :)
Canon M50 tinkerer

c_joerg

  • New to the forum
  • *
  • Posts: 36
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #17 on: October 23, 2018, 09:38:54 AM »
Edit: the EOS M50 appears to run EOS firmware (other recent models, i.e. M3, M5, M6, M10 and M100, are based on PowerShot firmware). Looking for a volunteer to try the LED blinking test on this camera, too :)

Does anyone know if Canon Basic is available on the M50 or EOS R(as with the M3)?
6D

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12171
  • Maintenance mode
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #18 on: October 23, 2018, 10:02:27 AM »
Maybe. The M50 ROM contains the following strings:

Code: [Select]
B:/script.req
uartr.req
FIO_GetFileInfo (%s) ver.req failed
(%s) ver.req Dir
for DC_scriptdisk
B:/Factory.m
B:/AutoTest.m
B:/Extend.m

I have not tested it, but it's worth trying.

There is some (different) scripting interface in DIGIC 5 DSLRs as well, but I have not explored it (it's left as a nice exercise for the community). This scripting engine is not present on DIGIC 6 or newer "pure EOS" models, from what I could tell.

SniperJunkie

  • New to the forum
  • *
  • Posts: 1
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #19 on: December 06, 2018, 10:10:56 PM »
I have a Canon EOS M50, If you need me to do anything to help, Please feel free to ask.

kenthinson

  • New to the forum
  • *
  • Posts: 2
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #20 on: December 07, 2018, 06:38:11 AM »
For DIGIC 7 models, the next step is porting the 80D startup code (i.e. running user code alongside Canon firmware). I expect this step to be straightforward, so it's left as an exercise to the owners of these cameras. You can debug the startup code in the emulator; once you get it working, just ask me to enable the boot flag so you can test it on the camera.

The previous post was for M50 ( DIGIC 8 ). On this camera, I don't know yet how the bootloader looks like, and the code written for DIGIC 7 didn't work, so I'll probably attempt to dump the ROM directly from main firmware. The tests you'll run are:
- jumping to Canon firmware (expecting to be identical to DIGIC 7, i.e. jumping to 0xE0040000)
- LED blinking (testing the above addresses)
- LED blinking from main firmware (if I'll get this working in QEMU)
- ROM dumping from main firmware (could not test this one in QEMU yet)
- other tests (CPU model, diagnostic logs etc)

After publishing the ROM dumper, I'll update the emulator, attempt to enable the boot flag and get some diagnostic logs. Further progress will require a developer with a camera in their hands and plenty of spare time for experiments. If that describes you, your contribution will be more than welcome. I'll be here to help if you get stuck, but please be aware I'm not interested in maintaining yet another camera port alone.

If the code damages the camera, I'll try to help, but cannot guarantee success.

Hi a1ex. I'm a software engineering student. I'll be graduating the end of the month. I'm interested in working on my m50 with my spare time. I see the documentation on the site about setting up qemu dev environment. Looks exciting. Any advice you have for me before I jump in? Thanks :)

I'll be jumping in after the semester is over. For now back to writing papers  :'(

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6673
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #21 on: December 07, 2018, 07:49:20 AM »
I have a Canon EOS M50, If you need me to do anything to help, Please feel free to ask.

Do you have another cam with ML running on it?
If not:
Take a look into http://chdk.wikia.com/wiki/Obtaining_a_firmware_dump#Using_soundcard_input

@kenthinson: Welcome abord! Best luck for the finals!
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!

srsa

  • New to the forum
  • *
  • Posts: 12
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #22 on: December 08, 2018, 07:11:57 PM »
After exploring the D8 disassembly I have (I was given a reconstructed M50 dump) I decided to publish my findings here.

- The camera does appear to have the scripting language we (@CHDK) refer to as Canon Basic.
- I have the impression that the card setup is the same as described here: http://chdk.wikia.com/wiki/Canon_Basic/Card_Setup
- Event procedures (short: eventproc) do exist, the eventproc handling firmware routines seem to be the same as on PowerShots.
- There seems to be support for extend.m and autotest.m scripts, but their invocation may differ from what's described here: http://chdk.wikia.com/wiki/Canon_Basic#Starting_the_script

- Now, the differences:
 - Most event procedures that appear in CHDK related scripts do not exist. That means, CHDK scripts will not work on D8 cams.
 - Many event procedures seem to be pre-registered, so registration functions such as System.Create() are not necessarily needed.
 - In file names, the card root is B:/
 - I have not yet found an eventproc to write binary files from script, or, to write text on screen.
 
Problem is, I can't say for sure whether using a prepared script card is enough to run scripts. So, everything below is speculation.

Script support seems to be enabled when the cam is in factory mode - the factory mode flag is at 0xE1FF802C.
I think it is also enabled when there's a script named "AutoTest.m" in the root of the card. The code I found loads "AutoTest.m" automatically at the end of the startup procedure.

The following minimal script should make a hex dump of the first 0x40000 bytes of ROM. I'm not certain that my WriteFileString interpretation is correct.
For a first try, name the script "AutoTest.m".

Code: [Select]
dim startadr=0xe0000000
dim romsize=0x40000
dim fname="B:/ROM.TXT"

private sub Initialize()
    p = startadr
    f = OpenFileCREAT(fname)
    do while p < (startadr+romsize)
        WriteFileString(f,"%08X: %08x %08x %08x %08x\n",p,*p,*(p+4),*(p+8),*(p+12))
        p = p + 16
    loop
    CloseFile(f)
end sub

This script is not camera specific, so it can be tried on any D8 cameras (assuming that all D8 cams share the same codebase):
EOS M50, R; PowerShot SX740, SX70

To make sure the card is correctly prepared for scripting, get any older PowerShot (2005...2017) and use the universal dumper script (http://chdk.wikia.com/wiki/Canon_Basic/Scripts/Dumper) to check.

I can't guarantee success, but I think it's worth to try this route.

StefanKeller.AC

  • Freshman
  • **
  • Posts: 54
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #23 on: December 18, 2018, 05:40:54 PM »
sorry, but I didnt have success on my M50, I prepared the Card with EOSCard after true formating in the M50
(but with my M50 I also did not have success with the dumper scripts)

Walter Schulz

  • Contributor
  • Hero Member
  • *****
  • Posts: 6673
Re: DIGIC 8 'PowerShot' development (M50, SX70, SX740)
« Reply #24 on: December 18, 2018, 06:09:09 PM »
EOScard?
Is there a bootflag enabler for the real (not emulated) M50 body?
Wondering if I missed something ...
Photogs and videographers: Assist in proof reading upcoming in-camera help!. Your input is wanted and needed!