EOS M3 porting - page 11 - DryOS Development - CHDK Forum

EOS M3 porting

  • 746 Replies
  • 391435 Views
*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: EOS M3 porting
« Reply #100 on: 17 / July / 2016, 18:05:00 »
Advertisements
Updated QEMU to emulate SD card access on M3. SD1stInit appears to do its job successfully, and the card write protect switch check before StartDiskboot is also recognized.

Code: [Select]
[ SD1stInit:010f3ff1 ] SetSSCG(12,0)s
[ SD1stInit:010f3ff1 ] HWInit(0)s
SD: CMD0 0x00000000 state 0
SD: No response 0
[ SD1stInit:010f3ff1 ] SWInit(0)s
[ SD1stInit:010f3ff1 ] SetUHSMod(0,1)s
[ SD1stInit:010f3ff1 ] RegPowCF(0)s
[ SD1stInit:010f3ff1 ] CrdPreInit(0)s
SD: CMD0 0x00000000 state 0
SD: No response 0
SD: CMD52 0x80000c08 state 0
SD: No response 0
SD: CMD0 0x00000000 state 0
SD: No response 0
[EOS] trigger int 0xEE
SD: CMD0 0x00000000 state 0
SD: No response 0
[EOS] trigger int 0xEE
SD: CMD8 0x000001aa state 0
SD: Response: 00 00 01 aa state 0
[EOS] trigger int 0xEE
SD: CMD5 0x00000000 state 0
SD: No response 0
SD: CMD55 0x00000000 state 0
SD: Response: 00 40 01 20 state 0
[EOS] trigger int 0xEE
SD: ACMD41 0x50100000
SD: Response: 80 ff ff 00 state 1
[EOS] trigger int 0xEE

I guess the code needs to reach FC37A2E2, where it probably checks the BOOTDISK flag on the SD card image. I'll figure it out later.

@Ant: can you give me a small DISKBOOT.BIN for testing? (something that prints hello world on UART, for example)
« Last Edit: 17 / July / 2016, 18:15:28 by a1ex »

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #101 on: 17 / July / 2016, 18:20:41 »
Do you understood how to reliably enter to debug shell?
I was trying to short RX and TX  lines - it does not work.

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: EOS M3 porting
« Reply #102 on: 17 / July / 2016, 18:28:50 »
The code waits for a '#' on the UART (that is, echo the first character it outputs). It doesn't matter if you output more stuff after that (only the first character is checked).

I guess shorting the two pins during startup should work, and the "loopback" name suggest the same thing...

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #103 on: 18 / July / 2016, 17:38:22 »
Finaly I restored my camera without using file IO functios.
I has generated 64kB array, and then wrote it to flash using small function:
Code: [Select]
void rescue_me(void)
{
char voltagestr [64];
unsigned int i;

sprintf (voltagestr, "Hello world\n\r");
( ( void ( * ) ( char* ) ) 0xFC003181 )(voltagestr);

i = _write_flash(0xFDF20000, &data2k[0], 0x00010000);

sprintf (voltagestr, "\n\rResult: %08x\n\r", i);
( ( void ( * ) ( char* ) ) 0xFC003181 )(voltagestr);

*(int*)0xd20b0810  = 0x4d0002; // Orange Led = on
while (1);
}

I called it after fc1ee640. Function fc0f4222 was commented because it generate assert.

Big thanks to a1ex  for his help.

P.S. on QEMU write_flash function can not be finished, but erase_flash returns 0.
« Last Edit: 18 / July / 2016, 17:45:14 by Ant »


*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: EOS M3 porting
« Reply #104 on: 18 / July / 2016, 17:44:15 »
Hurray!

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: EOS M3 porting
« Reply #105 on: 19 / July / 2016, 01:58:50 »
P.S. on QEMU write_flash function can not be finished, but erase_flash returns 0.

The flash emulation is turned off by default. There are two attempts - g3gg0's code in eos.c (I remember he ran into some issues, but back then, what he did was way beyond my understanding on how flash works, so I couldn't debug it), and Antony Pavolv's attempt in digic*.c for A1100 (which is merged in the official QEMU source tree, so it probably works). I should integrate the code from eos.c there to try it, but this is a non-trivial task. And so far I had no real reason to emulate the flash reprogrammig...

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #106 on: 21 / July / 2016, 16:15:42 »
If things like focus mode, subject distance and zoom state don't exist as propcases, they will probably need to be faked something like I did for PROPCASE_SHOOTING on g7x.

This is the list of commands that allows to control EF lenses:
Code: [Select]
EFLensCom.AFMFSwState
 EFLensCom.ChangeEF2Sync
 EFLensCom.ChangeSync2EF
 EFLensCom.Connect
 EFLensCom.DebugPrint
 EFLensCom.Disconnect
 EFLensCom.DistanceInfo
 EFLensCom.FocusSearchFar
 EFLensCom.FocusSearchNear
 EFLensCom.GetAberrationData
 EFLensCom.GetEFComState
 EFLensCom.GetEFComState
 EFLensCom.GetFNoRange
 EFLensCom.GetFNo
 EFLensCom.GetFocalLength
 EFLensCom.GetFocalLength
 EFLensCom.GetFocusPitch
 EFLensCom.GetID
 EFLensCom.GetIrisSpeedInfo
 EFLensCom.GetLatestGyroData
 EFLensCom.GetLatestGyroData
 EFLensCom.GetLensType
 EFLensCom.GetNewPO
 EFLensCom.GetPO
 EFLensCom.GetiBpDesign
 EFLensCom.IsSafeModeLens
 EFLensCom.LensFirmUpdate
 EFLensCom.LoadAEData
 EFLensCom.LoadiBpManufacture
 EFLensCom.MoveFocusBySync
 EFLensCom.MoveFocus
 EFLensCom.MoveIrisBySync
 EFLensCom.MoveIris
 EFLensCom.MoveIris_FNo
 EFLensCom.OneShotEFStatus
 EFLensCom.PrintCameraInfo
 EFLensCom.PrintDCL1st
 EFLensCom.PrintDCL2nd
 EFLensCom.PrintDCLInit
 EFLensCom.PrintDLC1st
 EFLensCom.PrintDLC2nd
 EFLensCom.PrintDLCInit
 EFLensCom.PrintLib
 EFLensCom.PrintStatus
 EFLensCom.PrintUnitSpec
 EFLensCom.ResetFocusPulse
 EFLensCom.Reset
 EFLensCom.ResumeStatus
 EFLensCom.SendCommand
 EFLensCom.SetError
 EFLensCom.SetFPSetting
 EFLensCom.SetFocusPowerBySync
 EFLensCom.SetFocusSpdPtn
 EFLensCom.SetPFSetting
 EFLensCom.StartOCKick
 EFLensCom.StopOCKick
 EFLensCom.SuspendStatus
 EFLensCom.SuspendStatus
 EFLensCom.SyncComFocusInfo
 EFLensCom.SyncComFocusStatus
 EFLensCom.UpdateStatus
 EFLensTool.Create

« Last Edit: 21 / July / 2016, 16:19:01 by Ant »

*

Offline reyalp

  • ******
  • 14080
Re: EOS M3 porting
« Reply #107 on: 21 / July / 2016, 21:15:34 »
This is the list of commands that allows to control EF lenses:
If those work like the names suggests, it seems like most of the focus and av related values should be available. Zoom and the fl_tbl related code might need additional work. So in get_property_case you could do something like
Code: [Select]
#if CAM_PROPSET == x
switch (id) {
 case PROPCASE_AV:
//some code that calls EFLensCom.GetFNo and stuffs the result into to the return buffer
...
Propcases like AV normally only update in half shoot, so it might be better to just save the in a variable there instead of getting it each time the propcases are red. Setting would need additional consideration.

It would be useful to know if the regular firmware uses these same functions (or something trivially called by them)

The propcase IDs for these "fake" propcases should be outside the normal range used by the camera in your propset.
Don't forget what the H stands for.


Re: EOS M3 porting
« Reply #108 on: 26 / July / 2016, 18:03:32 »
Is there an unstable release I can download? What's the status right now?

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #109 on: 27 / July / 2016, 03:50:07 »
M3man

You can find the link in the first post.

 

Related Topics