Embedded Systems December 2000 Vol13_13

Issue link:

Contents of this Issue


Page 81 of 197

FICiURE 2 Flash defragmentation ' ' F7 . ...... .'- ' ' F:' F4 I F6 I that removal of a file (even th ough it is not actually erasing the fl ash) sti II frees up some memory space for new fil e storage. Defragmentation As fil es are created within TFS they require memory space; this is fairly obvious. As fil es are deleted within TFS they still require memory space; hey know that the right BIOS is key to the success of em- bedded designs-and that config- urability is key to the right BIOS. T hat's why AMD, Intel, and STMicro ship General Software's Embedded BIOS pre- installed on their embedded platform evaluation boards. With over 400 configuration options, Embedded BIO offers the advanced configurabili ty you need to run your custom target environ- ment without editing the core BIOS source code. Contact us today for detailed information and a free sample BIOS binary for your standard reference des ign, F7 Available ., Flash II ........ Available Flash Space need some way to occasionally clean up (or defragment) the flash space to make the space that is taken up by deleted fil es available for use again. Figure 2 illustrates the defragmenta- tion process. The heavily shaded a reas represent the fil e headers and the lightly shaded a reas represent th e active fil es. Files FI , F2, and F5 have been deleted and will be removed from the fl ash space as a result of the defragmentation. You can pe rrO...,1 th e cl eanup or maybe this isn 't as obvious. The rea- son for this is that the unde rlying fl ash technology does not allow any random range of memory within the device to just be arbitrarily erased; hence, when a fil e is deleted, it is sim- ply marked that way in the heade r and left in the flash. At some point, these deleted fil es can take up a significant amount of space in the devi ce, so we What do the leading silicon vendors know about BIOS? Embedded BIOS™ T 0 Full source code 3uwmarically configured wirh over 400 parameters usi ng BIOSrarr TN expcrr system ROM/RAM/ ~Iash disks, Setup system. console re-d irection , manufucruring mode, WinCE loader, configllrable PCI, integrated debugger, modular callours [0 and CPU-Ievelmodliles ALI- Aladdin V, Finali AMD- 186, S 300, SC400, SC520 lNTE 386EX, 4301-IX/T X, 440BX, 8 10, 840 NSC-Gcodc GXm, GXlv STMicro-STPC fam ily Windows 95/98/CE/NT Embedded, DOS, Linux, and all x86-based operating systems SOFTWARE GENERAC· • 800-850-5755 • 425-454-5755 80 DECEMBER 2000 Embedded Systems Programming d efragmenta ti on process in seve ral diffe rent ways. Like most embedded sys tem issue, th e chosen technique depends largely o n th e environme nt in which th e sys tem will exist, the hardware that is available on board, and th e trade-off between complexi- ty and capa bili ty. Certainly, more complex ways of handling this exi st, but usuall y, that added complexity makes th e impleme nta ti on of th e entire fil e sys tem much more com- plicated. The goal he re was to keep th e fil e storage simple and linear, gua ra nteeing tha t anyone fil e can be assumed by th e application to exist in contiguo us space in th e fl as h. The fo llowing discussion cov- e rs two diffe rent approaches, The first is quite simple, but has its fl aws (which, dependin g on th e sys tem, may be acceptable); th e second is more robust and, with a few added options, can be quite fl ash fri endly. The easiest solution is to concate- chipser. board. nate each of the "non-deleted" files into RAM space, erase all the flash space allocated for TFS file storage, then copy the entire concatenation back into the fl ash. On the positive side, this is simple and there is no need to pre-allocate one of th e fl ash sectors as a spare. On the negative side, it assumes Lhat a block of RAM is available that is statically allocated for this j ob that is as big as the fl ash space allocated to TFS. Worse, if the system is reset or takes a power hit while the fl ash is being erased and prior to it having completed the copy-back, the fil e system will be cOITupted, because

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems December 2000 Vol13_13