EmbeddedRelated.com
Forums
Memfault Beyond the Launch

FAT16 help needed!!!

Started by Sean Whitesell December 29, 2003
Dilton McGowan II wrote:
> "Jim Stewart" <jstewart@jkmicro.com> wrote in message > news:bt280g$f11@library2.airnews.net... > >>Enrico Migliore wrote: >> >> >>>Sean Whitesell wrote: >>> >>> >>> >>>>My code is writting data to a CompactFlash card. I can see the data >>>>with WinHex. But, windows does not acknowledge the file. I'm using >>>>the same functions as examples that work elsewhere in the project. I >>>>need help analyzing the FAT info to see where the problem is so I know >>>>where the problem lies in the code. I have read the FAT specs and >>>>compared my file to good files and the differences are just not >>>>evident. Any help on this would be most appreciated. I'm really >>>>under the gun here. >>>> >>>>Sean W. >>> >>> >>>Dear Sean, >>> >>> during the past year I worked on a project of porting the FreeDOS' >>> filesystem to an embedded architecture. The first thing I did was >>> to compile the fs under MSVC, then I did many tests on a floppy, >>> formatted FAT16 as a 128 kilobytes removeable media. I used a >>> boot sector created by Windows, because I wanted the fs be able >>> to read and write files just like Windows. Initially I had the same >>> problems you had: >> >> >>Any chance you could GPL the version of embedded >>Freedos that you created? >> >> > > > Not long after getting the uFlashTCP and ordering the 8 Meg M-Systems chip I > got FreeDOS to run on it, so it's a good selling point Jim. I thought > FreeDOS was already GPL'd though.
It is. I was wondering if he'd be willing to release his modifications. But my configuration was done using the
> M-Systems chip as I don't have write access to the 512K chip. If I did then > I imagine that the same technique would work for that. IIRC I just used the > files from the FreeDOS download. If you're interested, I can do a short > write-up on the few steps.
I sure would like to see it.
"Sprow" <news@sprow.co.uk> wrote in message
news:2ec0aa9a.0312301555.14b5776@posting.google.com...
> larwe@larwe.com (Lewin A.R.W. Edwards) wrote in message
news:<608b6569.0312300657.6f3e8ade@posting.google.com>...
> > > >You should have an MBR on the card, i.e. it should be a "hard disk" > > > >format card, not a "big floppy". > > > > > > It works either way. In fact, Windows, when formatting a CF card does > > > > It may work either way under some circumstances, but _all_ embedded > > equipment uses the hard disk type format for removable media. Why > > behave strangely when there is a known standard to follow? > > I assume this made-up "big floppy" and "hard disk" terminology serves > mainly to confuse everyone? > > It's perfectly valid to have a fixed disc (media type 0xF8) with or > without a partition table,and not unusual at all to have a partition > table with just one of the four entries occupied - pointing to a fixed > disc FAT image anyway,which always seemed a bit pointless to me. > > Conversely the other media type bytes (0xF9/FC/FD/FE/FF) for removable > media can't have partition tables.It's just that flash cards from > cameras etc are considered by Windows et al as a 'fixed disc' but > which just happens to be removable! > Sprow.
Other removable media, such as zip drives, also use an MBR even though windows can only cope with a single partition on it (other OS's can use more).

Jim Stewart wrote:

> > during the past year I worked on a project of porting the FreeDOS' > > filesystem to an embedded architecture. The first thing I did was > > to compile the fs under MSVC, then I did many tests on a floppy, > > formatted FAT16 as a 128 kilobytes removeable media. I used a > > boot sector created by Windows, because I wanted the fs be able > > to read and write files just like Windows. Initially I had the same > > problems you had: >
> > Any chance you could GPL the version of embedded > Freedos that you created?
Hi Jim, the code is GPL, and I'm waiting for Pat Villani's (the author of FreeDOS) feedback on this work. The homepage of the project is http://www.foskeea.org and the whole project should be on-line by the end of the month. Enrico


Hi

> > Look at the allocation mechanism. An allocated block is, IIRC, at > least 1k, not 512. You are probably simply running into failure > of the translation between block number and the disk address, > involving 0 based or 1 based numbering. >
That might be the answer. I'll check.
> > BTW, one copy of your message will normally suffice :-) >
yes, sorry. I didn't do it on purpose.
>Look at the allocation mechanism. An allocated block is, IIRC, at >least 1k, not 512. You are probably simply running into failure >of the translation between block number and the disk address, >involving 0 based or 1 based numbering.
The size of a block can be any number of sectors. Old 360K or 720K format used normaly 2 sectors. 1.44M floppies used 1 sector blocks. How many blocks you'll need depends on the size of a FAT entry and the size of the medium. The first block starts after the root directory, IIRC its sector address is: 1 (for boot sector) + # of hidden sectors + # of FATs * # of sectors per FAT + # of sectors for the root directory. Ah, and yes, sector numbers start with 1, blocks with 0. --- 42Bastian Do not email to bastian42@yahoo.com, it's a spam-only account :-) Use <same-name>@epost.de instead !
>What is the media type for 'big floppy' ?? > >( I never heard of it )
Don't know the media type, but some BIOSes need USB-memorysticks configured as if it where a floppy, i.e. no MBR only an boot sector. Maybe some of these sticks hide the MBR if they are not accessed by the right driver ?! --- 42Bastian Do not email to bastian42@yahoo.com, it's a spam-only account :-) Use <same-name>@epost.de instead !
"David Brown" <david@no.westcontrol.spam.com> writes:

> Other removable media, such as zip drives, also use an MBR even though > windows can only cope with a single partition on it (other OS's can use > more).
Other OS's don't have to use the MBR scheme of partitions either. MBR is really only needed so that the BIOS can figure it out. -- Darin Johnson Gravity is a harsh mistress -- The Tick
"Jim Stewart" <jstewart@jkmicro.com> wrote in message
news:bt35oa$r5n@library1.airnews.net...
> Dilton McGowan II wrote: > > "Jim Stewart" <jstewart@jkmicro.com> wrote in message > > news:bt280g$f11@library2.airnews.net... > > > >>Enrico Migliore wrote: > >> > >> > >>>Sean Whitesell wrote: > >>> > >>> > >>> > >>>>My code is writting data to a CompactFlash card. I can see the data > >>>>with WinHex. But, windows does not acknowledge the file. I'm using > >>>>the same functions as examples that work elsewhere in the project. I > >>>>need help analyzing the FAT info to see where the problem is so I know > >>>>where the problem lies in the code. I have read the FAT specs and > >>>>compared my file to good files and the differences are just not > >>>>evident. Any help on this would be most appreciated. I'm really > >>>>under the gun here. > >>>> > >>>>Sean W. > >>> > >>> > >>>Dear Sean, > >>> > >>> during the past year I worked on a project of porting the FreeDOS' > >>> filesystem to an embedded architecture. The first thing I did was > >>> to compile the fs under MSVC, then I did many tests on a floppy, > >>> formatted FAT16 as a 128 kilobytes removeable media. I used a > >>> boot sector created by Windows, because I wanted the fs be able > >>> to read and write files just like Windows. Initially I had the same > >>> problems you had: > >> > >> > >>Any chance you could GPL the version of embedded > >>Freedos that you created? > >> > >> > > > > > > Not long after getting the uFlashTCP and ordering the 8 Meg M-Systems
chip I
> > got FreeDOS to run on it, so it's a good selling point Jim. I thought > > FreeDOS was already GPL'd though. > > It is. I was wondering if he'd be willing to release > his modifications. > > But my configuration was done using the > > M-Systems chip as I don't have write access to the 512K chip. If I did
then
> > I imagine that the same technique would work for that. IIRC I just used
the
> > files from the FreeDOS download. If you're interested, I can do a short > > write-up on the few steps. > > I sure would like to see it. > > > >
Well, I tried today to duplicate it but it's not working like it did before. Generally here are the steps I followed back when this worked for me, this is for uFlashTCP: On the PC: 1) Download the latest FreeDOS and make sure these files are handy: SYS.com, KERNEL.sys, KERNEL1.sys, COMMAND.com and optionally FDCONFIG.sys The handiest way for me was to download the boot image and use Winimage to extract the files. 2) Use the SYS command to create a copy of the boot sector. Use SYS /? for help. Here I used tftp from WATTCP and a private IP address. It's *much* faster than the Xmodem stuff and DOWN.com isn't working anyway. On the unit: 1) Use M-Systems format command: "dformat /win:EE000" where EE000 is the address of their chip IIRC. 2) reboot 3) check C: is clean 4) use a utility that will allow you to write the boot sector, the one I use is makedisk.exe but I don't remember now where I got it from. Optionally write one, which I've also done but mine only worked for the A drive on a PC and I never updated it. Oh, and write the boot sector onto the C: drive using the image you created in PC Step 2. 5) It's fuzzy here, I can't remember if I had to create a dummy 512 area following the boot sector image or if I just proceeded. 6) Copy KERNEL.sys, KERNEL1.sys and COMMAND.com to the C: drive. Note: According to the uFlashTCP doc I'm supposed to change the JP3 jumper to make the C: drive bootable but it seems that if I just lift the 2-4 jumper, remove and apply power then place it back before it reaches the TrueFFS driver in the boot sequence then it tries to boot from the M-Systems (C: drive) chip. Anyway, this worked one time (way back when...) but as I said in the beginning of this post, I wasn't able to get it working today. Several times I got it to print the "FreeDOS" logo then it hangs like the jump into the DOS code fails. I tried with both 512 bytes and 1024 byte images. Suggestions welcome and if this helps in some way, that's also great! Dilton
Dilton McGowan II wrote:
> "Jim Stewart" <jstewart@jkmicro.com> wrote in message > news:bt35oa$r5n@library1.airnews.net... > >>Dilton McGowan II wrote: >> >>>"Jim Stewart" <jstewart@jkmicro.com> wrote in message >>>news:bt280g$f11@library2.airnews.net... >>> >>> >>>>Enrico Migliore wrote: >>>> >>>> >>>> >>>>>Sean Whitesell wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>My code is writting data to a CompactFlash card. I can see the data >>>>>>with WinHex. But, windows does not acknowledge the file. I'm using >>>>>>the same functions as examples that work elsewhere in the project. I >>>>>>need help analyzing the FAT info to see where the problem is so I know >>>>>>where the problem lies in the code. I have read the FAT specs and >>>>>>compared my file to good files and the differences are just not >>>>>>evident. Any help on this would be most appreciated. I'm really >>>>>>under the gun here. >>>>>> >>>>>>Sean W. >>>>> >>>>> >>>>>Dear Sean, >>>>> >>>>>during the past year I worked on a project of porting the FreeDOS' >>>>>filesystem to an embedded architecture. The first thing I did was >>>>>to compile the fs under MSVC, then I did many tests on a floppy, >>>>>formatted FAT16 as a 128 kilobytes removeable media. I used a >>>>>boot sector created by Windows, because I wanted the fs be able >>>>>to read and write files just like Windows. Initially I had the same >>>>>problems you had: >>>> >>>> >>>>Any chance you could GPL the version of embedded >>>>Freedos that you created? >>>> >>>> >>> >>> >>>Not long after getting the uFlashTCP and ordering the 8 Meg M-Systems > > chip I > >>>got FreeDOS to run on it, so it's a good selling point Jim. I thought >>>FreeDOS was already GPL'd though. >> >>It is. I was wondering if he'd be willing to release >>his modifications. >> >>But my configuration was done using the >> >>>M-Systems chip as I don't have write access to the 512K chip. If I did > > then > >>>I imagine that the same technique would work for that. IIRC I just used > > the > >>>files from the FreeDOS download. If you're interested, I can do a short >>>write-up on the few steps. >> >>I sure would like to see it. >> >> >> >> > > > Well, I tried today to duplicate it but it's not working like it did before. > Generally here are the steps I followed back when this worked for me, this > is for uFlashTCP: > > On the PC: > > 1) Download the latest FreeDOS and make sure these files are handy: > > SYS.com, KERNEL.sys, KERNEL1.sys, COMMAND.com and optionally FDCONFIG.sys > > The handiest way for me was to download the boot image and use Winimage to > extract the files. > > 2) Use the SYS command to create a copy of the boot sector. Use SYS /? for > help. > > Here I used tftp from WATTCP and a private IP address. It's *much* faster > than the Xmodem stuff and DOWN.com isn't working anyway. > > On the unit: > > 1) Use M-Systems format command: "dformat /win:EE000" where EE000 is the > address of their chip IIRC. > 2) reboot > 3) check C: is clean > 4) use a utility that will allow you to write the boot sector, the one I use > is makedisk.exe but I don't remember now where I got it from. Optionally > write one, which I've also done but mine only worked for the A drive on a PC > and I never updated it. Oh, and write the boot sector onto the C: drive > using the image you created in PC Step 2. > 5) It's fuzzy here, I can't remember if I had to create a dummy 512 area > following the boot sector image or if I just proceeded. > 6) Copy KERNEL.sys, KERNEL1.sys and COMMAND.com to the C: drive. > > Note: According to the uFlashTCP doc I'm supposed to change the JP3 jumper > to make the C: drive bootable but it seems that if I just lift the 2-4 > jumper, remove and apply power then place it back before it reaches the > TrueFFS driver in the boot sequence then it tries to boot from the M-Systems > (C: drive) chip. > > Anyway, this worked one time (way back when...) but as I said in the > beginning of this post, I wasn't able to get it working today. Several times > I got it to print the "FreeDOS" logo then it hangs like the jump into the > DOS code fails. I tried with both 512 bytes and 1024 byte images. > > Suggestions welcome and if this helps in some way, that's also great!
Thanks for writing it up. I've gotten as far as the freedos logo too, but I'm pleased to know that you've actually gotten it to boot.
"Jim Stewart" <jstewart@jkmicro.com> wrote in message
news:bt5b7e$fci@library2.airnews.net...
> Dilton McGowan II wrote: > > "Jim Stewart" <jstewart@jkmicro.com> wrote in message > > news:bt35oa$r5n@library1.airnews.net... > > > >>Dilton McGowan II wrote: > >> > >>>"Jim Stewart" <jstewart@jkmicro.com> wrote in message > >>>news:bt280g$f11@library2.airnews.net... > >>> > >>> > >>>>Enrico Migliore wrote: > >>>> > >>>> > >>>> > >>>>>Sean Whitesell wrote: > >>>>> > >>>>> > >>>>> > >>>>> > >>>>>>My code is writting data to a CompactFlash card. I can see the data > >>>>>>with WinHex. But, windows does not acknowledge the file. I'm using > >>>>>>the same functions as examples that work elsewhere in the project.
I
> >>>>>>need help analyzing the FAT info to see where the problem is so I
know
> >>>>>>where the problem lies in the code. I have read the FAT specs and > >>>>>>compared my file to good files and the differences are just not > >>>>>>evident. Any help on this would be most appreciated. I'm really > >>>>>>under the gun here. > >>>>>> > >>>>>>Sean W. > >>>>> > >>>>> > >>>>>Dear Sean, > >>>>> > >>>>>during the past year I worked on a project of porting the FreeDOS' > >>>>>filesystem to an embedded architecture. The first thing I did was > >>>>>to compile the fs under MSVC, then I did many tests on a floppy, > >>>>>formatted FAT16 as a 128 kilobytes removeable media. I used a > >>>>>boot sector created by Windows, because I wanted the fs be able > >>>>>to read and write files just like Windows. Initially I had the same > >>>>>problems you had: > >>>> > >>>> > >>>>Any chance you could GPL the version of embedded > >>>>Freedos that you created? > >>>> > >>>> > >>> > >>> > >>>Not long after getting the uFlashTCP and ordering the 8 Meg M-Systems > > > > chip I > > > >>>got FreeDOS to run on it, so it's a good selling point Jim. I thought > >>>FreeDOS was already GPL'd though. > >> > >>It is. I was wondering if he'd be willing to release > >>his modifications. > >> > >>But my configuration was done using the > >> > >>>M-Systems chip as I don't have write access to the 512K chip. If I did > > > > then > > > >>>I imagine that the same technique would work for that. IIRC I just used > > > > the > > > >>>files from the FreeDOS download. If you're interested, I can do a short > >>>write-up on the few steps. > >> > >>I sure would like to see it. > >> > >> > >> > >> > > > > > > Well, I tried today to duplicate it but it's not working like it did
before.
> > Generally here are the steps I followed back when this worked for me,
this
> > is for uFlashTCP: > > > > On the PC: > > > > 1) Download the latest FreeDOS and make sure these files are handy: > > > > SYS.com, KERNEL.sys, KERNEL1.sys, COMMAND.com and optionally
FDCONFIG.sys
> > > > The handiest way for me was to download the boot image and use Winimage
to
> > extract the files. > > > > 2) Use the SYS command to create a copy of the boot sector. Use SYS /?
for
> > help. > > > > Here I used tftp from WATTCP and a private IP address. It's *much*
faster
> > than the Xmodem stuff and DOWN.com isn't working anyway. > > > > On the unit: > > > > 1) Use M-Systems format command: "dformat /win:EE000" where EE000 is the > > address of their chip IIRC. > > 2) reboot > > 3) check C: is clean > > 4) use a utility that will allow you to write the boot sector, the one I
use
> > is makedisk.exe but I don't remember now where I got it from. Optionally > > write one, which I've also done but mine only worked for the A drive on
a PC
> > and I never updated it. Oh, and write the boot sector onto the C: drive > > using the image you created in PC Step 2. > > 5) It's fuzzy here, I can't remember if I had to create a dummy 512 area > > following the boot sector image or if I just proceeded. > > 6) Copy KERNEL.sys, KERNEL1.sys and COMMAND.com to the C: drive. > > > > Note: According to the uFlashTCP doc I'm supposed to change the JP3
jumper
> > to make the C: drive bootable but it seems that if I just lift the 2-4 > > jumper, remove and apply power then place it back before it reaches the > > TrueFFS driver in the boot sequence then it tries to boot from the
M-Systems
> > (C: drive) chip. > > > > Anyway, this worked one time (way back when...) but as I said in the > > beginning of this post, I wasn't able to get it working today. Several
times
> > I got it to print the "FreeDOS" logo then it hangs like the jump into
the
> > DOS code fails. I tried with both 512 bytes and 1024 byte images. > > > > Suggestions welcome and if this helps in some way, that's also great! > > Thanks for writing it up. I've gotten as far as > the freedos logo too, but I'm pleased to know that > you've actually gotten it to boot. > >
I found my old files! I'm going to review them and if I get it working again I'll post the details here.

Memfault Beyond the Launch