How to create multiple partitions using filex APIs ?

Vinay 40 Reputation points
2024-03-14T07:05:53.9766667+00:00

In the Filex user guide, it is mentioned that there is support for multiple partitions. But there are no APIs in filex driver as in latest git repo, which can create multiple partitions.

Also there is one function call - _fx_partition_offset_calculate - which returns start and size of partitions.

How do we create multiple partitions and how do we use the offset_calulate function ?

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
329 questions
{count} votes

Accepted answer
  1. Sakshi Kokardekar 195 Reputation points MVP
    2024-04-08T10:49:29.5366667+00:00

    I guess there’s a little misunderstanding here regarding the usage of FileX Partitions.

    The concept of partitions in FileX basically refers to logical divisions within a single file system instance rather than the physical partitions on the storage device.

    We may arrange and manage files within a single file system instance using FileX because partitions are maintained by the file system itself. But FileX does not offer direct APIs for partitioning a storage disk into several physical sections.

     

    If we want to create multiple logical partitions within a single FileX file system instance, we can try it by following these steps:

    1)     Initialization of FileX: Initially, we can initialize the FileX file system using the fx_media_open function to specify the underlying media driver such as NOR flash, etc.

    2)     Formatting Media: This step refers to initialization the file system structures on the media. We can try formatting it using the fx_media_format function to prepare it for use with FileX.

    3)     Mountting the File System: After formatting the media, we can mount the file system using the fx_media_mount function. This makes the file system accessible for file operations.

    4)     Directories Creation: We can create directories using the fx_directory_create function, within the mounted files. These directories serve as logical partitions within the file system instance.

    5)     File Creation and Management: Proceeding with these steps, then we can finally try creating and managing files within the directories/partitions using the various file management APIs provided by FileX, such as fx_file_create, fx_file_read, fx_file_write, etc.

     

    The _fx_partition_offset_calculate function mentioned above, is used to calculate the offset of a specific partition within the file system. This function takes the partition number as input and returns the start offset and size of the partition.

     

    Hope this answer is helpful! :)

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful