IXUS 990 / SD970 IS porting thread - page 2 - DryOS Development - CHDK Forum
supplierdeeply

IXUS 990 / SD970 IS porting thread

  • 24 Replies
  • 973 Views
*

Online reyalp

  • ******
  • 12444
Re: IXUS 990 / SD970 IS porting thread
« Reply #10 on: 13 / January / 2020, 14:20:54 »
Advertisements
Thanks, perhaps someone else wants to see it, too. Made a collage of ASM and decompile... Cursor is at "PC/LR"
I don't see an obvious explanation. romlogs often aren't sufficient to meaningfully debug a problem. If keeps happening, you can try to narrow down what specific actions trigger it.

The instruction at the PC value is MRS, which according the ARM architecture reference manual for armv5 does not generate exceptions. The preceding instruction is BLX R2, meaning a function pointer call to whatever is in R2. R2 in the romlog is 0. The PC value in the dump could refer to the address that actually triggered the exception, or the next one.

It's possible that there was major memory corruption somewhere and the romlog information is doesn't reflect what actually happened.
Don't forget what the H stands for.

*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #11 on: 13 / January / 2020, 15:35:34 »
If keeps happening, you can try to narrow down what specific actions trigger it.
Thank you, that was interesting nonetheless. Given the fact I'm not even 100% sure that it did happen with the current version of the code waiting it out is the best advice. I do remember that it did happen when testing zebra, so upon shutter half press. And immediately on shutter half press and after turning the cam back on things were normal with zebra. Since zebra does not work in video modes as I found today and edge overlay needs to be fixed anyway if it can be there will be enough situations in testing for it to show up again. For the time being I did the zebra testing for a couple of minutes in photography mode and it was just fine.
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #12 on: 05 / February / 2020, 21:17:24 »
I've been distracted from this once it was "mostly done". There will always be things to revisit and do better but that is the case for so many ports. This seems to be a rather rare camera, too. Tried to get another in good condition and no luck to this date, which is no problem I hoped for an FW 1.00B Cam. The one thing I wanted to get to is fixing the "edge overlay" to work as zebra does but that can wait.

@reyalp do you think we should add this port to autobuild? I'd flag 100A as beta and 100B as alpha. It is a code-gen made blind port and 100B has not been tested although I was fairly sure of it. Without being added to Autobuild it may never get tested, so... If you think this is far enough would you please commit my code and add the cam?
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Online reyalp

  • ******
  • 12444
Re: IXUS 990 / SD970 IS porting thread
« Reply #13 on: 05 / February / 2020, 22:36:27 »
I've been distracted from this once it was "mostly done". There will always be things to revisit and do better but that is the case for so many ports. This seems to be a rather rare camera, too. Tried to get another in good condition and no luck to this date, which is no problem I hoped for an FW 1.00B Cam. The one thing I wanted to get to is fixing the "edge overlay" to work as zebra does but that can wait.

@reyalp do you think we should add this port to autobuild? I'd flag 100A as beta and 100B as alpha. It is a code-gen made blind port and 100B has not been tested although I was fairly sure of it. Without being added to Autobuild it may never get tested, so... If you think this is far enough would you please commit my code and add the cam?
I'll have a look over the source and add it to SVN when I have some time.

Regarding the untested 100b port: We do not generally add completely untested builds to the autobuild. Instead, they get posted on the forum with a link from https://chdk.fandom.com/wiki/Test_releases_not_available_in_autobuilds
That usually gets linked from the camera wiki page and supported cameras list, so it's discoverable but people are forced to visit the forum.

If you can put together a notes.txt of what has been tested and any known issues, that would be helpful.
Don't forget what the H stands for.


*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #14 on: 08 / February / 2020, 19:32:36 »
Thanks.

If you can put together a notes.txt of what has been tested and any known issues, that would be helpful.
Is the attached good enough? Otherwise change it in any way you see fit.
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Online reyalp

  • ******
  • 12444
Re: IXUS 990 / SD970 IS porting thread
« Reply #15 on: 10 / February / 2020, 01:39:20 »
I checked this in, trunk 5420 with some modifications. I included the notes.txt with some additional camera-specific information. Autobuild disabled pending one issue and confirmation I didn't break anything else:

in platform_kdb.h:
KEYS_MASKn should be the bitwise OR of the keys in each of the 3 words of physw_status. Assuming kbd.c is correct, KEYS_MASK0 should be 0xc, KEYS_MASK1 is correctly 0, KEYS_MASK2 should be 0xBFF (power shouldn't be masked, so you can power off without leaving alt).


Other comments and changes:
This looks very good for a first port, so please don't take the the comments below as criticism.


100b appears functionally identical to 100a: All the stubs values are the same, meaning the builds should be compatible. I've configured it to be a copy rather than a separate sub. Still disabled pending someone reporting that it works.

In kbd.c, I commented out KEY_POWER. It's identified by the sig finder, but generally not exposed as a key in CHDK.

In stubs_min.S,
* There was recreview_hold with an address from another camera. stubs_min.S / stubs_entry2.S should never be something that is known incorrect. If the correct value is not known, it should be set to something that at least provides predictable, safe value. 
I changed this to FAKEDEF, which will always be zero rather than whatever random value exists at the address in this platform. However, the sig finder finds recreview_hold for this platform, so if you can verify that it's OK, we can just remove the stubs_min one completely.
* removed the *_for_dng stuf in stubs_min.S, it's only relevant for older cameras
* commented out rear_dial_position, since it's unused, and different from the jogdial MMIO in kbd.c
* commented out enabled_refresh_physical_screen, since it appears to be unused

platform / lib.c vid_get_bitmap_active_buffer directly referenced firmware address, so I moved it to sub/lib.c. The files in the top level platform directory should only reference addresses that shouldn't change between subs, like MMIOs and framebuffer addresses. Stuff referencing variables or constants in ROM can either use the addresses directly in lib.c, or you can define variables in stubs_min.S and keep the code in the common lib.c

The stuff under #if CAM_CONSOLE_LOG_ENABLED is only applicable to vxworks cameras, so I removed it.

shooting.c referenced MODE_ZOOM_BLUR. I added it to include/modelist.c

makefile.inc:
* FI2 build failed because of space before the comment. In makefiles, spaces are included in value.
* Some values were duplicated between the sub makefile.inc and the top level. I moved most of them to the top level.

The camtest result only shows ~340KB free, which is a bit marginal. It might be worth implementing exmem support.

Other things to test:
define CAM_AF_LED 5 in platform_camera.h, and run MD_Tune.bas to check fast MD is working.

All the CAM_SD_OVER_IN_ are set in platform_camera.h. Did you check that the SD override works in each mode?

What's the issue with edge overlay, can you post a screenshot?

Has multi-partition support been tested?
Don't forget what the H stands for.

*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #16 on: 10 / February / 2020, 18:19:02 »
I checked this in, trunk 5420 with some modifications. I included the notes.txt with some additional camera-specific information.
Thanks for looking at my stuff.
Autobuild disabled pending one issue and confirmation I didn't break anything else:
It builds so I guess not.
in platform_kdb.h:
KEYS_MASKn should be the bitwise OR of the keys in each of the 3 words of physw_status. Assuming kbd.c is correct, KEYS_MASK0 should be 0xc, KEYS_MASK1 is correctly 0, KEYS_MASK2 should be 0xBFF (power shouldn't be masked, so you can power off without leaving alt).
I included the power button, so what is in 5420 does not allow powering off while in alt mode. With the above that works.

This looks very good for a first port, so please don't take the the comments below as criticism.
Thanks for saying that. Thank you for the detailed comments! I'll only reply to those I have any comment on.
In stubs_min.S,
* There was recreview_hold with an address from another camera. stubs_min.S / stubs_entry2.S should never be something that is known incorrect. If the correct value is not known, it should be set to something that at least provides predictable, safe value. 
I changed this to FAKEDEF, which will always be zero rather than whatever random value exists at the address in this platform. However, the sig finder finds recreview_hold for this platform, so if you can verify that it's OK, we can just remove the stubs_min one completely.
This came from sd780. There it also is found by sigfinder but is commented out in the genrated stubs_entry.S and has something else in stubs_min.S I didn't know what to do about it. How do I test if it works? I put the sigfinder found one into place in the current build I'm testing.
platform / lib.c vid_get_bitmap_active_buffer directly referenced firmware address, so I moved it to sub/lib.c. The files in the top level platform directory should only reference addresses that shouldn't change between subs, like MMIOs and framebuffer addresses. Stuff referencing variables or constants in ROM can either use the addresses directly in lib.c, or you can define variables in stubs_min.S and keep the code in the common lib.c
Inspiration & location came from sd990 - maybe it needs the same fix or maybe its FW 100E and 101B are identical in this regard and it makes sense where it is, just noting that that is why I put it there.
The camtest result only shows ~340KB free, which is a bit marginal. It might be worth implementing exmem support.
What needs to be done for that?
define CAM_AF_LED 5 in platform_camera.h, and run MD_Tune.bas to check fast MD is working.
Although I read the instructions I did not figure out what to do.
I added
Quote
#define CAM_AF_LED                   5
compiled, ran the script took the cam to a dark romm but no AF-Light turned on when running the script. Any further hints?
All the CAM_SD_OVER_IN_ are set in platform_camera.h. Did you check that the SD override works in each mode?
The three come from sd780. I tested Inf while in macro mode, both half press and quick full press with having been in macro focus before pressing the shutter button do set focus to infinity. I'm not aware of an MF feature. SD990 Manual
What's the issue with edge overlay, can you post a screenshot?
Yes attached. We're shooting 8 lines of text, edge overly gets the height wrong and shows but 4. Zebra is just fine (3rd image)
Has multi-partition support been tested?
It has been now ;-)
« Last Edit: 10 / February / 2020, 18:41:03 by koshy »
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Online reyalp

  • ******
  • 12444
Re: IXUS 990 / SD970 IS porting thread
« Reply #17 on: 11 / February / 2020, 01:52:13 »
I included the power button, so what is in 5420 does not allow powering off while in alt mode. With the above that works.
Updated in svn, 100a enabled in autobuild 5422

Quote
This came from sd780. There it also is found by sigfinder but is commented out in the genrated stubs_entry.S and has something else in stubs_min.S I didn't know what to do about it. How do I test if it works? I put the sigfinder found one into place in the current build I'm testing.
This controls whether some OSD elements are visible in review after shooting. To test, you can set the memory browser to the recreview_hold address (0x000036ec), and turn on "show misc values" in the debug menu.

It should normally be 0. If you set the review setting in the canon menu to "hold" and a shoot in singe shot mode (not continuous) the last shot image should show until you click a button, and you should see 1 in the OSD mem value.

Quote
Inspiration & location came from sd990 - maybe it needs the same fix or maybe its FW 100E and 101B are identical in this regard and it makes sense where it is, just noting that that is why I put it there.
Yes, there's a fair few like that where it's safe for the specific port, but a bad example.

Quote
The camtest result only shows ~340KB free, which is a bit marginal. It might be worth implementing exmem support.
What needs to be done for that?
I'll try to answer that later  :-[

Quote
define CAM_AF_LED 5 in platform_camera.h, and run MD_Tune.bas to check fast MD is working.
Although I read the instructions I did not figure out what to do.
Oops, my mistake. It should be the set_led value that makes the AF turn on, while I was looking at the canon number. I think the set_led value should be 3. You can check in chdkptp like =set_led(3,1)

Quote
The three come from sd780. I tested Inf while in macro mode, both half press and quick full press with having been in macro focus before pressing the shutter button do set focus to infinity. I'm not aware of an MF feature.
See https://chdk.fandom.com/wiki/Testing#mftest.lua

MF includes set_mf(1), which works on many cameras without Canon MF support. AF lock can be set with set_aflock(1) or the canon half press + focus button shortcut.

In MF or AF Lock, the focus should move immediately if you use set_focus(n) in chdkptp
Quote
What's the issue with edge overlay, can you post a screenshot?
Yes attached. We're shooting 8 lines of text, edge overly gets the height wrong and shows but 4. Zebra is just fine (3rd image)
That's odd, does the sd780 have the same problem? I suspect it's one of the myriad framebuffer size functions / constants is wrong, but I'm not sure which one.

You can get the actual dimensions in chdkptp live view, by using
Code: [Select]
set gui_verbose=2

then connecting live view and switching to rec. chdkptp will spit out all the dimensions each time resolution changes. You can post the output for rec mode here.
Don't forget what the H stands for.


*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #18 on: 11 / February / 2020, 20:14:31 »
Thanks, perhaps someone else wants to see it, too. Made a collage of ASM and decompile... Cursor is at "PC/LR"
I don't see an obvious explanation. romlogs often aren't sufficient to meaningfully debug a problem. If keeps happening, you can try to narrow down what specific actions trigger it.

The instruction at the PC value is MRS, which according the ARM architecture reference manual for armv5 does not generate exceptions. The preceding instruction is BLX R2, meaning a function pointer call to whatever is in R2. R2 in the romlog is 0. The PC value in the dump could refer to the address that actually triggered the exception, or the next one.

It's possible that there was major memory corruption somewhere and the romlog information is doesn't reflect what actually happened.
I finally found my crash. It is reproducible but it's odd. If I am connected to CHDKPT and am in Rec mode and zebra is enabled and I then half press the shutter on the camera -> boom. Without zebra being in no problem. With edge overlay instead of zebra, no problem. Edge overlay gets drawn (in its incorrect way), zebra does not get drawn the cam seems to stall for a blink of an eye and crashes. Without the USB connection no problem. Whether Viefinder or UI Overlay are on or off in CHDKPTP seems irrelevant.
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

*

Offline koshy

  • *****
  • 1037
Re: IXUS 990 / SD970 IS porting thread
« Reply #19 on: 11 / February / 2020, 20:25:54 »
That's odd, does the sd780 have the same problem? I suspect it's one of the myriad framebuffer size functions / constants is wrong, but I'm not sure which one.
I'd have to revisit sd780. I think it was different but had other problems. Eventually I ended up with 720 and 480 for play mode and using _GetVRAMHPixelsSize() and _GetVRAMVPixelsSize() otherwise. Seemed like a neat thing except when I found that edge overlay oddity.
Code: [Select]
// Fixes 320 Video for CHDKPTP, maybe more?
int vid_get_viewport_width_proper() {
    return ((mode_get()&MODE_MASK) == MODE_PLAY)?720:_GetVRAMHPixelsSize();
}
int vid_get_viewport_height_proper() {
    return ((mode_get()&MODE_MASK) == MODE_PLAY)?480:_GetVRAMVPixelsSize();
}
You can get the actual dimensions in chdkptp live view, by using
Code: [Select]
set gui_verbose=2

then connecting live view and switching to rec. chdkptp will spit out all the dimensions each time resolution changes. You can post the output for rec mode here.

Code: [Select]
##### THIS IS PLAY #####
> set gui_verbose=2
update mode dropdown 0
update_frame_data: changed
version_major:nil->2
version_minor:nil->2
lcd_aspect_ratio:nil->0
palette_type:nil->3
palette_data_start:nil->104
vp_desc_start:nil->32
bm_desc_start:nil->68
bmo_desc_start:nil->0
vp.fb_type:nil->0
vp.data_start:nil->1128
vp.buffer_width:nil->720
vp.visible_width:nil->720
vp.visible_height:nil->480
vp.margin_left:nil->0
vp.margin_top:nil->0
vp.margin_right:nil->0
vp.margin_bot:nil->0
bm.fb_type:nil->1
bm.data_start:nil->519528
bm.buffer_width:nil->960
bm.visible_width:nil->720
bm.visible_height:nil->240
bm.margin_left:nil->0
bm.margin_top:nil->0
bm.margin_right:nil->0
bm.margin_bot:nil->0
bmo.fb_type:nil->2
bmo.data_start:nil->2
bmo.buffer_width:nil->0
bmo.visible_width:nil->3
bmo.visible_height:nil->104
bmo.margin_left:nil->32
bmo.margin_top:nil->68
bmo.margin_right:nil->0
bmo.margin_bot:nil->0
Resize: Width=360   Height=270
##### THIS IS REC #####
update mode dropdown 1
new value 1
##### THIS IS GOING TO MOVIE WHILE AT MOVIE 320 #####
update_frame_data: changed
version_major:2->2
version_minor:2->2
lcd_aspect_ratio:0->0
palette_type:3->3
palette_data_start:104->104
vp_desc_start:32->32
bm_desc_start:68->68
bmo_desc_start:0->0
vp.fb_type:0->0
vp.data_start:1128->1128
vp.buffer_width:720->720
vp.visible_width:720->360
vp.visible_height:480->240
vp.margin_left:0->0
vp.margin_top:0->0
vp.margin_right:0->0
vp.margin_bot:0->0
bm.fb_type:1->1
bm.data_start:519528->260328
bm.buffer_width:960->960
bm.visible_width:720->720
bm.visible_height:240->240
bm.margin_left:0->0
bm.margin_top:0->0
bm.margin_right:0->0
bm.margin_bot:0->0
bmo.fb_type:2->2
bmo.data_start:2->2
bmo.buffer_width:0->0
bmo.visible_width:3->3
bmo.visible_height:104->104
bmo.margin_left:32->32
bmo.margin_top:68->68
bmo.margin_right:0->0
bmo.margin_bot:0->0
Resize: Width=180   Height=135
##### THIS IS BACK TO REC #####
update_frame_data: changed
version_major:2->2
version_minor:2->2
lcd_aspect_ratio:0->0
palette_type:3->3
palette_data_start:104->104
vp_desc_start:32->32
bm_desc_start:68->68
bmo_desc_start:0->0
vp.fb_type:0->0
vp.data_start:1128->1128
vp.buffer_width:720->720
vp.visible_width:360->720
vp.visible_height:240->480
vp.margin_left:0->0
vp.margin_top:0->0
vp.margin_right:0->0
vp.margin_bot:0->0
bm.fb_type:1->1
bm.data_start:260328->519528
bm.buffer_width:960->960
bm.visible_width:720->720
bm.visible_height:240->240
bm.margin_left:0->0
bm.margin_top:0->0
bm.margin_right:0->0
bm.margin_bot:0->0
bmo.fb_type:2->2
bmo.data_start:2->2
bmo.buffer_width:0->0
bmo.visible_width:3->3
bmo.visible_height:104->104
bmo.margin_left:32->32
bmo.margin_top:68->68
bmo.margin_right:0->0
bmo.margin_bot:0->0
Resize: Width=360   Height=270
Koshy had a little ELPH which wasn't white as snow but everywhere that Koshy went the ELPH was sure to go. (actually an SD, but that detail ruins the rhyme...)

 

Related Topics