Author Topic: USB MSD Bootloader hidden files issue  (Read 11293 times)

grantb5

  • Member
  • ***
  • Posts: 34
USB MSD Bootloader hidden files issue
« on: April 18, 2013, 01:54:50 pm »
I've built the early stages of a Mass Storage Device loader for my 8-bit micro and I can write to it and read from it on a PC. What I was hoping to do was use this to transfer firmware updates and/or configuration files from a host using File Explorer drag-n-drop method. And it is working to a point. On Windows the reading and writing is pretty well behaved. But on Mac OS X and Linux (Ubuntu in this case) a bunch of hidden files and folders are written to the "drive" by the OS such as .Trashes and the like.

Any suggestions on how to either stop this behaviour on these OS's or to somehow be immune to it?  Would there be another strategy rather than showing a writeable root directory to the host (user)?  Perhaps some trick of the FAT or directory?

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: USB MSD Bootloader hidden files issue
« Reply #1 on: April 18, 2013, 03:45:31 pm »
For MacOSX, you may change system setting so that the hidden files are not written.
In this topic, a couple of utilities, and command lines are referred.
http://apple.stackexchange.com/questions/6707/how-to-stop-os-x-from-writing-spotlight-and-trash-files-to-memory-cards-and-usb

Other than hidden files/folders, the problem of starting LBA shift is known on Linux and MacOSX. This NXP app note describes well on this issue and its workaround. Also, the zip includes Linux script using dd.

AN11305: USB In-System Programming with the LPC11U3X/LPC11U2X
http://www.nxp.com/documents/software/AN11305.zip
AN11305v.1.pdf
3. USB ISP details (p5)
Unfortunately, FAT filesystems on Mac and Linux machines tend to allocate blocks to files in a different order which results in data being written onto the ISP disk, and consequently firmware being written to flash, being reordered. This will cause the firmware update to be unsuccessful. There are two workarounds for this. The most general workaround is to overwrite the firmware.bin file in place. A more “brute-force” option that requires administrative privileges to do direct disk device writes to /dev.


Tsuneo

grantb5

  • Member
  • ***
  • Posts: 34
Re: USB MSD Bootloader hidden files issue
« Reply #2 on: April 18, 2013, 04:34:36 pm »
Thanks Tsuneo, I will look at both of those!  Where do I sent the internet beer for you?