Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

+FAT multiple partitions. Readable on Windows?

Posted by spikeroot on July 24, 2017

Hi.

I'm currently using the ELM-FAT library on my embedded system to create two partitions on an SD card, and format them both as FAT32. The problem is that when I then pop that SD card into my PC, I can only access the first partition from Windows. This is a known limitation of that system.

If I do this using the FreeRTOS +FAT system instead, will I be able to access all partitions from Windows?

Thanks. -Spike


+FAT multiple partitions. Readable on Windows?

Posted by rtel on July 24, 2017

If I do this using the FreeRTOS +FAT system instead, will I be able to access all partitions from Windows?

Provided they are formatted in accordance with the Windows requirements, then yes.


+FAT multiple partitions. Readable on Windows?

Posted by spikeroot on July 24, 2017

Thanks for your response. I'm confused though: If I use your FFPartition and FFFormat functions, why wouldn't they be in accordance with the Windows requirements? Is it just a matter of using the right parameters?


+FAT multiple partitions. Readable on Windows?

Posted by rtel on July 24, 2017

Is it just a matter of using the right parameters?

Yes. The official FAT spec has requirements for the minimum size, etc. If you create a disk that does not fall into that spec then +FAT might be happy to use it, but Windows won't.


+FAT multiple partitions. Readable on Windows?

Posted by heinbali01 on July 25, 2017

Hi Michael, in the FreeRTOS+FAT demo projects, in ff_sddisk.c, you will see that :

BaseType_t xPartitionNumber = 0;

Just because 99% percent of the memory cards have a single partition.

But there may be good reasons to use 2 partitions and +FAT will indeed recognise them: both primary as well as extended/logical partitions.

If you are using SD-cards, be aware that only the first partition will have it's FAT table in a FAT-optimised area ( the second 4MB erase block ). So you might notice that subsequent partitions are slower, and maybe even less reliable.

Within ff_ioman.c you see how partitions are being discovered, with the function FF_PartitionSearch():

~~~ xPartitionCount = FFPartitionSearch( pxIOManager, &partsFound ); if( FFisERR( xPartitionCount ) ) { xError = xPartitionCount; break; } ~~~


+FAT multiple partitions. Readable on Windows?

Posted by heinbali01 on July 25, 2017

Forgot to tell how the two ( or more ) partitions will be represented in the file system.

Normally there is an SD-card with a single partition, which will be found in the root ("/").

As an example, the following files are located in the first partition mounted on "/":

~~~ /readme.txt /etc/config.ini /firmware/bootloader.hex ~~~

The modules ff_sys.c and ff_stdio.c allow you to combine several volumes into a single file system. For instance, if you create a RAM disk, you can mount its root on e.g. "/ram" :

~~~ /ram /ram/files/picture1.jpg /ram/tmp/_WM68C7.tmp ~~~

When the first partition of the SD-card is mounted as "/", you can mount the second partition as follows:

~~~ FFFSAdd( "/part2", pxDisk_2 ); ~~~

The user interface of FreeRTOS+TCP has two layers:

1) Lower level functions that work on a single volume. FF_Open(), FF_Read(), FF_Write(). These functions will not recognise your "/part2".

2) STDIO-compatible functions that do recognise mounted volumes, such as "/ram" and "/part2", These functions have a prefix "ff_", such as ff_fopen(), ff_fread()/ff_fwrite(), and ff_fclose().

It sounds all more complicated than it actually is. It works very much like mounting in Linux, except that the mount-points are always located in the root directory.

There have recently been some essential changes to a few +FAT source files, I'm attaching these changes here below in ff_sys.zip.

Attachments

ff_sys.zip (35267 bytes)

+FAT multiple partitions. Readable on Windows?

Posted by spikeroot on August 3, 2017

So, in order to use this system to format an SD card with two partitions, do I need to create two FFDiskt objects with two different calls to FF_SDDiskInit?


+FAT multiple partitions. Readable on Windows?

Posted by heinbali01 on August 4, 2017

That is correct, you will need everything double. Two partitions are being treated as different disks. And it is only in ffsys.c and ffstdio.c where the two drives come together in a single "file system"

But the first thing to do is call FF_PartitionSearch(), as described here above.


+FAT multiple partitions. Readable on Windows?

Posted by spikeroot on August 4, 2017

Edit: deleted. Better questions to follow...


+FAT multiple partitions. Readable on Windows?

Posted by heinbali01 on August 5, 2017

Hi Machael, your original question in the email was:

Why would the two drives come together in a single file system? Shouldn't each partition have its own file system?

I will answer it for the other people following this thread:

you are right, each partition is a file system on its own. But ff_sys.c and ff_stdio.c will map one of the partitions onto a symbolic directory.

All files under e.g."/part2" will refer to the second partition. Other files and directories within the root directory are all located on the first partition.

Better questions to follow...

I'm all curious :-)


+FAT multiple partitions. Readable on Windows?

Posted by richard_damon on August 5, 2017

Another way to look at it is that there are several ways to express a multi-volume/partition file system. In windows we are used to 'Drive Letters' where the main hard drive is C:, and other drivers are given a distinct letter. This has a fundamental limit of 26 volumes/partitions.

A second method, also used in windows is the \servershare prefix.

A third method, used on *nix like systems is that / is the root of all systems and some directory (like /part2) is mapped to point to the other volumes/partitions.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists