<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 11, 2017 at 10:33 AM, Jef Driesen <span dir="ltr"><<a href="mailto:jef@libdivecomputer.org" target="_blank">jef@libdivecomputer.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_-8451421154345040113gmail-HOEnZb"><div class="m_-8451421154345040113gmail-h5">On 2017-08-10 18:01, John Van Ostrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On Thu, Aug 10, 2017 at 10:57 AM, Jef Driesen <<a href="mailto:jef@libdivecomputer.org" target="_blank">jef@libdivecomputer.org</a>><br>
wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On 2017-07-15 22:39, John Van Ostrand wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
For previously supported Cochran computers high-speed read of<br>
log and profile data started at byte 0. Older models that lack the<br>
high-speed transfer function use the standard speed read commands<br>
and so the log and profile data are read at higher addresses.<br>
<br>
</blockquote>
<br>
I don't really understand the reason for this change. With this change you<br>
are only downloading the memory area containing the logbook and profile<br>
ringbuffers, and not a full memory dump. Can you explain why you changed<br>
this?<br>
</blockquote>
<br>
I figured I should start staging changes into patches that are more easily<br>
reviewed and doing it in a way that still results in a good build in case a<br>
build occurs at the commit. This patch is a staging patch intended to set a<br>
path for support for Commander TM computers. This patch also fixes an<br>
assumption I made in _device_dump.<br>
<br>
Prior to this patch the read command that read the log and profile data<br>
always had addresses that started at 0. Log data always started at 0 and<br>
profile data followed after. So layout->rb_logbook_begin for every computer<br>
was always 0x0. In _device_dump I should have used this variable but I used<br>
a hard coded 0. Using the variable makes more sense.<br>
<br>
In effect, this patch doesn't change what the dump contains for computers<br>
supported at the time of this patch. A dump done after this patch matches a<br>
dump done prior to it.<br>
</blockquote>
<br></div></div>
I know the behavior remains the same for the existing devices. That's quite obvious when reading the code. But that's not what my question was about. It's about this part of your answer:<span class="m_-8451421154345040113gmail-"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
As to downloading *all* memory I presumed it wasn't supposed to dump all<br>
memory. I presume it was only supposed to dump log and profile data.<br>
<br>
There may be two reasons why I thought the device_dump was only intended to<br>
dump the user data, i.e. logbook and profile data. Prior to my patches<br>
currently under review, the code uses what I now realize is a high-speed<br>
read function which seems intended to only download log and profile data<br>
probably because of the large size. I was confused when working with the<br>
older Commander TM models because the high-speed download commands didn't<br>
work and I had no reference to how to download it (i.e. no vendor program<br>
to observe.) Then I decided to brute force it recently, take the DC apart,<br>
obtain the IC specs, and try a wide range of commands. I realized that the<br>
read commands I've been using to access some data on new models were<br>
generic low-speed read commands and I could use them to access all memory<br>
areas on the older computer. Because it had randomized SRAM logbook and<br>
profile data it took a while to find the user data. It starts at 0x10000.<br>
<br>
I could read all data on the old computer and dump all that data but there<br>
are also 32K of RAM and ROM which I figure only confuses the data and<br>
doesn't help the user much. RAM, being RAM, changes a lot.<br>
<br>
That said, I've started experimenting with a simulator that uses a full<br>
memory dump so there might be some benefit to changing this. The new<br>
simulator would be simplified and might be more robust when working with a<br>
less predictable program like the vendor's software.<br>
</blockquote>
<br></span>
Memory dumps are not only useful for debugging today's problems. They can also help future development (developing new features, regression testing against old data, etc). But if you only download part of the memory, and it turns out the ringbuffer starts at some other address then your initial assumption, or your new feature needs some info from another area, then the old memory dump is suddenly useless. That's why a memory dump should (ideally) contain everything, and also require as little logic as possible (e.g. no knowledge of a certain address range).<br>
<br>
A memory dump typically contains other sections besides the logbook and profile ringbuffer(s) too. For example:<br>
<br>
* Ringbuffer metadata (pointers where the next item should be written)<br>
* Configuration data (user configurable settings)<br>
* Dive computer state (decompression tissue loadings, etc)<br>
* ... (lots of things we don't know about)<br>
<br>
There is probably lots of stuff we aren't interested in, but that's difficult to tell in advance if you don't even know what's in there. So making sure to include everything is the most future proof :-)<br></blockquote><div><br></div><div>The ID, conf, and misc blocks should give us everything we want. ID tells us the model and f/w version (I think), conf pages give us the configurable settings and I think misc gives us tissue loading. The original code was dumping all this. I'm not sure why it was removed.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Having said that, if the download protocol uses addresses where certain ranges are mapped to the ROM (firmware code) or even RAM, then that's indeed another story. We're not really interested in that kind of stuff. Just the flash (or some other non-volatile storage technology) where the dives are being stored. But so far I've never seen any dive computer where the download protocol gives access to that kind of data (except for the ostc firmware updater).<br>
<br></blockquote><div><br></div><div>I disassembled the Commander TM to identify the MCU. In the downloads I can see memory structures that match what the specs suggest should be there, the interrupt table is visible at the beginning of ROM. I've done captures minutes apart and compared the results. The parts that change correspond strongly to the RAM, LCD RAM, and internal IO registers outlined in the MCU spec, things expected to be dynamic. So I'm pretty sure we're looking at the entire 32K address space of the MCU. I've not gathered the courage to disassemble my expensive Cochran computers (or borrowed ones) so I'm guessing a little more with those.<br></div><div><br>There are two write commands that I'm aware of. One appears to be able to address all mapped space. It's how the time is changed. The format is:<br><br></div><div> 0xa0 0xXX 0xYY 0xZZ 0xVV 0xWW (write 0xWWVV bytes (following command) to address 0xZZYYXX)</div><div><br></div><div>Like the slow read command this one is supported across all DCs I've tested.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Have you checked (on the newer devices), whether a read operation at the same address with the slow and fast commands, yields the same data?</blockquote><div><br></div><div>I have. Slow reads seem to read the MCU addressing space. The EMC-20H looks very similar to the TM (same MCU?) The Commander II appears slightly different (different MCU?) but it also appears to be the full address space.</div></div><div><br></div>-- <br><div class="m_-8451421154345040113gmail_signature"><div dir="ltr"><div>John Van Ostrand<br></div><div>At large on sabbatical<br></div><br></div></div>
</div></div>