View Full Version: Pv2Tool downloaded flash images too big?

camerahacks >>Applications / Developers >>Pv2Tool downloaded flash images too big?


<< Prev | Next >>

jnorden- 07-13-2006
Pv2Tool downloaded flash images too big?
In Pv2Tool 2.14, 'Download Flash' produces a 16MB file in ~1minute. In version 2.19, you get a 256MB file that takes ~15minutes to download. This is with a CVS red 6550 or 6600 firmware camera. The larger 2.19 file just contains ~16 copies of the smaller one repeated over and over. I assume this has something to do with: Changes from 2.14 to 2.15: -Fixed all file routines to work with larger flash sizes. I looked briefly at the source and found the following change in Camera.cpp - m_image = new unsigned char[16*1024*1024]; + m_image = new unsigned char[64*1000*1024]; which explains things partly, but still leaves a factor of about 4 that I don't understand. Anyway, I thought that the flash in an unmodified camera is just 16MB, is that right? Maybe PV2Tool could have some way to specify the flash size, to avoid such large files and long waits. Also, it might be a good idea if the title bar and/or the 'about PV2Tool' box included the version number. It just now realized that it is printed out in the debug display, though. Thanks for all your work - this is a really great project! -Jeff

BillW- 07-13-2006

Right - it's a known bug waiting to get squashed at this point. I haven't looked at the specifics yet, but it happened as a result of that change. As a workaround use and earlier version or truncate the file to 16MB.

jnorden- 07-14-2006

Thanks for the quick reply Bill. I looked through the code some more - here is what I found. It seems that this problem was introduced in version 2.17. The changelog entry above seems to refer to other routines that work with large flash. For example, 'Upload Flash' is fine since it assumes the flash size is equal to the size of the file you are uploading, (it just checks that the file is at least 16MB). From 2.16 to 2.17, the following change was made in the function OnButtonDownloadFlash() which is in PV2Tool2Dlg.cpp: if (file.Open(filename, CFile::modeWrite|CFile::modeCreate, &error)) { - unsigned long flash_size = 0x1000000; // 16 Mb - int n_sectors = 256; // 128K = (256) * 512 * 1024 -// int n_sectors = 64; // 32K = (64) * 512 * 1024 +// unsigned long flash_size = 0x1000000; // 16 Mb + unsigned long flash_size = 256*1024*1000; // 16 Mb +// int n_sectors = 256; // 128K = (256) * 512 * 1024 + int n_sectors = 512; int n_transfers = (flash_size/(n_sectors*512)); unsigned char* buffer = new unsigned char [n_sectors * 512]; The variable flash_size is changed from 16MB to 256MB (well, actually 256,000KB which is slightly less). Looking at the loop that follows, it seems that 256MB will always be downloaded - there isn't any attempt to figure out the flash size. Since no error occurs, it seems that the camera must just 'wrap around' when you make a memory request past the real size, so there may not be any way to find out the size of the flash in the camera. Probably, flash_size in this subroutine should just get changed back to 16MB. Alternatively, a dialog box could ask the user for the size of flash to download. Hope this helps, -Jeff

BillW- 07-14-2006

Yeah, with the cameras I -*test*-('")ed the flash download came to a hard stop after the actual end of flash. This may have changed with later firmwares or possibly with other flash chips. I'll revert to the 16MB fixed size. If users need more they can use the "download memory" button which is has more flexibility. Thanks for tracking down the relevent code!

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.