EmbeddedRelated.com
Forums

FAT16 help needed!!!

Started by Sean Whitesell December 29, 2003
"Dilton McGowan II" <nospam@nospam.net> wrote in message
news:58uJb.5220$Z76.3802@newssvr29.news.prodigy.com...
> > "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. > >
I went back to the firmware files (downloaded them from M-Systems web site) and used my original files (which was FreeDOS 7 IIRC) and the farthest I get is: Freedos loading... ROOT FAT KERNEL GO! which us supposed to mean that the boot code found KERNEL.sys and attempted the jump there, then it hangs. I've successfully booted these images in a Virtual PC session (and ONCE on the M-Systems disk in the past). So to get a better understanding will require jumping into the FreeDOS source. According to the M-Systems documentation there is no bad sector management using this approach. If we were to write a custom set of firmware using their BDK then we would get bad sector management automaticaly from their source. So I'm suggesting that this could be some sort of contigious sector issue. There are no other indications though. The writing seems to work without error, I even tried to dump the bad sector table and get only a zero length file, which I suppose means there are no bad sectors on the Flash disk. If I turn up anything new I'll probably post it new. Dilton