Wrong image format for "source" command
Dave Higton (281) 668 posts |
I’ve got a version of RISC OS that boots and reads a CMOS file in from an SD and an MMC card, but when I try the same set of files on a 4 GB SDHC card, I get this debug output: mmc1 is available reading boot.scr 120 bytes read Running bootscript from mmc ... ## Executing script at 82000000 Wrong image format for "source" command OMAP3 beagleboard.org # Can anyone give me a clue as to what’s going wrong, please? The files have been written using Fat32Fs. |
Dave Higton (281) 668 posts |
It turns out that what was read back from the card was very different from what was written to the card. The boot.scr file bore no relation to the one I wrote. I repeated the deletion and writing operations, with the same results – dismounting at appropriate times, of course. I have had to reformat the card to get it to work at all sensibly. (Now I just have to fix my code; although RO boots up, my code looks in the wrong place for the root directory.) |
Peter van der Vos (95) 115 posts |
Hi Dave, you know you have to look at different places for it depending on the format of de SD card. FAT12/16 have a Root Directory but FAT32 doesn’t. |
Dave Higton (281) 668 posts |
Absolutely. That wasn’t the problem; I could write to the SDHC card (using Fat32Fs and a SanDisk SDHC reader/writer), dismount it, mount it, and read back (still using Fat32Fs and the SanDisk reader/writer) something other than what was written. On some occasions the “riscos” file was missing. I am getting the impression that Fat32Fs needs to have its devices dismounted more than once to get all its cache flushed to the device. Anyway, I now have code that works for SD, SDHC and MMC, any of which can be in FAT16 or FAT32 format. I still have to add code for FAT12. I also need to read the complete cmos file out – I need to check that it continues to work if the file occupies more than one cluster. Some error handling might be a bonus. Then we would be ready to merge. |
Dave Higton (281) 668 posts |
They all have a root directory, but not necessarily in the same place – though I think they usually are… for FAT12/16, it’s in a fixed number of blocks immediately after the last FAT; for FAT32, it starts in a cluster, habitually cluster 2, which is immediately after the last FAT. |
Peter van der Vos (95) 115 posts |
Yes, you are right. In my code I look for the root directory in FAT12/16/32 at |