Extra modules - General Discussion and Assistance - CHDK Forum supplierdeeply

Extra modules

  • 20 Replies
  • 9085 Views
*

Offline srsa_4c

  • ******
  • 4451
Extra modules
« on: 25 / June / 2016, 09:23:07 »
Advertisements
I'm maintaining a few extra CHDK modules. I have finally decided to make this announcement, because it appears that one of them may find some use.

- Mandelbrot "game", published in the forum. It's not my work, see source for details.
- Memory dumper tool, for dumping the ROM.
- "Memory workshop" tool, short MemWorks or MW.

https://app.assembla.com/spaces/chdk-s1/subversion-12/source/HEAD/trunk

The modules in the repository can be built by copying all files to the modules subdirectory of the CHDK tree (1.4+), and doing a build.

*

Offline srsa_4c

  • ******
  • 4451
Re: Extra modules
« Reply #1 on: 25 / June / 2016, 09:24:30 »
Memory workshop module - description (incomplete)

First, a warning: this utility will try to access any word of the 32 bit address space it is instructed to.
The user is responsible for specifying memory locations that are accessible. On newer DIGIC 6 cams, the first 32 bytes (0-31) are protected and crash the camera when read.
A binary is intentionally not provided.

There are two ways for leaving the module: pressing MENU will unload the module and return to CHDK menu. Pressing the ALT button will exit the module, but it will continue to run in the background.
If the module is running in background, it can be re-entered by starting it again.
Placing the module on the CHDK user menu is recommended for fast access.

The top line shows the 'logo' and a number of hints, depending on the currently active user interface element.
The second line from the top is the menu line.

The active UI element is displayed in red. Pages (entries on the horizontal menu line) can be selected with the left/right buttons.
The OPT and ADV pages are vertical menus. Manipulation of the selected menu entry is performed with the left/right buttons or the SET button, depending on the entry.

The effect of half shoot depends on the current operation: If a number is being edited, half shoot zeroes the selected digit.
Otherwise, half shoot cycles the copy/paste state (Disabled -> Copy -> Paste -> Disabled).
When the copy/paste state is not disabled, pressing SET executes the selected copy or paste operation if the current UI element allows it.

The effect of 'zoom in' or 'zoom out' is:
When copy/paste state is 'copy', zoom will cycle the current 'collection' entry.
Otherwise, when the sample view is shown, zoom will cycle the second sample column.

When editing a number, pressing full shoot zeroes the whole number.

Scrolling the wheel acts as the up/down button.

The module has 2 main operating modes: DMP (memory dump) and SMP (sampler). This can be changed by setting focus on the second word in the menu line and pressing SET.
There's a main switch (first word in the menu line). When HLT is displayed, memory is not accessed. Operation is enabled when RUN is shown.
The third word in the menu line is the main address, used in both operating modes.
The fourth word is the mask used in "sampler" mode. Any bits that should be watched for change need to be set '1'. To watch for every change of the word found at the main address, it should be set 'ffffffff'. If it's set to zero, sampling will be unconditional.
The fifth word (OPT) is the page of options. The sixth word (ADV) is the page for setting up the additional 5 sampled words, and saving/restoring the complete set of sampled words (including the main one).
At the end of the menu line, there's an indicator for the copy/paste state (-/C/P) and the selected entry of the 'collection'.

Howto for unconditional sampling multiple memory locations (up to 6 words), up to 500 samples/sec

- The following should be edited and copied to CHDK/MEMWS_00.INI
addr is the main address to sample, adr(0)...adr(4) are the additional five sampled locations.
Code: [Select]
[ver]
0x100
[sampledefs]
addr=0x4b25fc00
mask=0x0
kind(0)=0x1
opt(0)=0x0
ofs(0)=0x0
adr(0)=0x4b2f5c00
kind(1)=0x1
opt(1)=0x0
ofs(1)=0x0
adr(1)=0x4b38bc00
kind(2)=0x1
opt(2)=0x0
ofs(2)=0x0
adr(2)=0x4b421c00
kind(3)=0x1
opt(3)=0x0
ofs(3)=0x0
adr(3)=0x4b4b7c00
kind(4)=0x1
opt(4)=0x0
ofs(4)=0x0
adr(4)=0x4b54dc00

- The second word in the "menu" line should read "SMP" rather than DMP

- On the ADV page, highlight 'Load definition set', select 00 with the left/right buttons then press SET to load the config stored in MEMWS_00.INI.

- On the OPT page, set the 'sampling rate', 'continuous sampling', 'sample buffer' and 'delay before sampling start' options as desired.

Sampling starts by pressing SET on the first 'page', so that it reads 'RUN'.
If sampling is continuous, it needs to be stopped manually by pressing SET again on the first 'page'.
A delay can be useful for setting the cam in a certain state.

The sampled data can be saved in a CSV-line format for later analysis: on the OPT page, click on "Save sampled content to file" and then retrieve the file (named SMP_xxxx.JPG in DCIM/100CANON). It's not a JPG file, the name allows it to be show up using a regular PTP connection.
« Last Edit: 25 / June / 2016, 09:44:28 by srsa_4c »

Re: Extra modules
« Reply #2 on: 25 / June / 2016, 13:27:03 »
This is useful I think. If I understand correctly addr =0x95e4, adr(0) = 0x43334300 and so on incrementing by 0x96000, in order to test frame buffers on the sx60hs for example.
I created MEMWS_00.INI and copied it to the camera CHKD/ directory.
When I select and run (press the shoot key) MODULES/MEMWORKS.FLT, I get a ubasic parse error. Perhaps there is something I don't understand?


Re: Extra modules
« Reply #3 on: 25 / June / 2016, 13:33:57 »
This is useful I think. If I understand correctly addr =0x95e4, adr(0) = 0x43334300 and so on incrementing by 0x96000, in order to test frame buffers on the sx60hs for example.
I created MEMWS_00.INI and copied it to the camera CHKD/ directory.
When I select and run (press the shoot key) MODULES/MEMWORKS.FLT, I get a ubasic parse error. Perhaps there is something I don't understand?
It's not a script - you can't activate it that way.  I think you need to load the module manually in the debug menu ?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline srsa_4c

  • ******
  • 4451
Re: Extra modules
« Reply #4 on: 25 / June / 2016, 13:37:37 »
This is useful I think. If I understand correctly addr =0x95e4, adr(0) = 0x43334300 and so on incrementing by 0x96000, in order to test frame buffers on the sx60hs for example.
Yes (didn't check the numbers, but I assume they are correct).
Quote
When I select and run (press the shoot key) MODULES/MEMWORKS.FLT, I get a ubasic parse error. Perhaps there is something I don't understand?
.FLT files are CHDK modules. They need to reside in the CHDK/MODULES folder on the card. Although a number of them (including memworks) can be executed from the file browser, their default place in the CHDK menu is:
Miscellaneous stuff -> Tools (This list is populated automatically on first access)
For completeness, game modules will appear in Miscellaneous stuff -> Games.
If you enable the user menu (CHDK settings -> Menu settings -> User menu enable), you can add executable modules to it directly, so you don't have to browse down to Miscellaneous stuff -> Tools.
To launch the user menu editor: CHDK settings -> Menu settings -> User menu edit.

Re: Extra modules
« Reply #5 on: 25 / June / 2016, 13:56:09 »
Thanks, I can access it now.  All but the last step where I press SET to change HLT to run....after a few seconds the camera shuts down/crashes.....
will maybe remove some of my test code and rebuild before continuing.
I imagine the same test work work on g7x but would need a different address for the indexer variable (if that is what it is).

*

Offline srsa_4c

  • ******
  • 4451
Re: Extra modules
« Reply #6 on: 25 / June / 2016, 14:35:07 »
Thanks, I can access it now.  All but the last step where I press SET to change HLT to run....after a few seconds the camera shuts down/crashes.....
Some guesses:
- make sure all 6 addresses are correct. I assume you did load them like this:
Quote
- On the ADV page, highlight 'Load definition set', select 00 with the left/right buttons then press SET to load the config stored in MEMWS_00.INI.
You can display address #1 .. 5 on the ADV page by highlighting "Sample definition #1" and pressing left/right. The main address is in the menu bar, after "A:".
- You can check the memory dump mode: second word in the horizontal menu should be "DMP" and the main address should be correct. Highlight HLT and press SET. You should then see 128 bytes worth of data in dump view.
- the module uses the CancelHPTimer and SetHPTimerAfterNow firmware functions, those stubs need to be correct. They are not used in normal CHDK operations.
- the module accesses a microsecond counter directly: *(uint32_t*)0xc0242014, but I don't think this has changed since the sx280

Re: Extra modules
« Reply #7 on: 25 / June / 2016, 15:19:07 »
Quote
You can display address #1 .. 5 on the ADV page by highlighting "Sample definition #1" and pressing left/right. The main address is in the menu bar, after "A:".
I checked these, and all 5 are correct.

Interesting.  DMP works, I see the locations updating properly...don't know if I can capture this to a file...
SMP crashes after several seconds,  (first the camera just becomes non responsive), romlog doesn't seem to be created...looks to be old:
Code: [Select]
Exception!! Vector 0x10
Occured Time  2016:06:25 09:52:59
Task ID: 16307923
Task name:
Exc Registers:
0x00000000
0x36313032
0x3A36303A
0x30203532
0x32353A39
0x0039353A
0x00000002
0x00000000
0x00000010
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
0x00000000
StackDump:
is blank
« Last Edit: 25 / June / 2016, 15:59:39 by 62ndidiot »


Re: Extra modules
« Reply #8 on: 25 / June / 2016, 15:34:56 »
Is there a chdkptp command or utility that will display several  non adjacent memory locations at the same time? A better rmem?

How does one paste an image using the img tags?

*

Offline srsa_4c

  • ******
  • 4451
Re: Extra modules
« Reply #9 on: 25 / June / 2016, 15:49:46 »
Interesting.  DMP works, I see the locations updating properly...don't know if I can capture this to a file...
No, and this mode only samples a few times per second. The alternative is rmem.
Quote
SMP crashes after several seconds,  (first the camera just becomes non responsive), romlog doesn't seem to be created...looks to be old:
I used to get weird exceptions like that when I was attempting 1000 samples/sec. Try lowering the sample rate (on the OPT page).

An HP timer based memory sampling method could be developed for use over PTP, but I never attempted that (it would require bigger amount of work on both CHDK and chdkptp side).

 

Related Topics