How to calculate flash memory end address of a certain file?
Hi, do you have any idea how to calculate (if possible) the end address of an image file in a flash memory. I'm trying to create a checksum and checkheader function and the info that I got is the file's offset, how many sector it consumes and its size. I kinda need the end address, sad thing is, I don't know how to calculate it. Let's say test.img's start address is 0, the size is 0x20000 and consumes 3 sectors. Hoping for a kind reply. Thanks. :)
|
I don't think you can do what you seem to want. If you are talking about a flash memory like a USB thumb drive, then the filesytem will look after the arrangement of the data on the memory device, and it probably won't be contiguous (fragmentation). You simply don't have access to the device at the byte/block level.
Perhaps you have left out some details of your objective. --- rod. |
I don't know why you'd need access to memory addresses to do a checksum, or to check the file headers. Could you explain why you need to access this information?
Also, why are you writing checksum/image-header functions yourself? There are already plenty of available libraries that will do checksums and image file metadata manipulation for you (if you say which language/platform you're using, I'm sure someone can make a recommendation to you). Are you just doing this for fun/learning/etc., or are you just trying to get it done? |
Quote:
|
Quote:
---------- Post added 03-11-11 at 10:49 AM ---------- BTW, forgot to thank you for your kind replies. Thanks guys :) |
It seems you may be confused about the difference between memory and storage, perhaps because of the nature of the storage device, which is fundamentally a memory technology device. While at its heart it is a non-volatile memory device, it is under the control of a filesystem, and as such, the details of how it is accessed, partitioned, and generally organized are hidden from userspace applications. By nature, flash memory is actually not a fully linear address space, and access to the memory is controlled by an even lower level of driver which further conceals the details of access to the device. If you really want to learn the details of how memory technology devices work, then you should study the appropriate kernel mode drivers. Start by looking in the 'drivers/mtd/...' section of the linux kernel sources.
--- rod. |
Quote:
|
All times are GMT -5. The time now is 02:10 AM. |