Skip to content

Latest commit

 

History

History
68 lines (41 loc) · 3.26 KB

File metadata and controls

68 lines (41 loc) · 3.26 KB

Fx_SRAM_File_Edit_Standalone application description

This application provides an example of FileX stack usage on STM32F767ZI-Nucleo board, running in standalone mode (without ThreadX). It demonstrates how to create a Fat File system on the internal SRAM memory using FileX.

The application is designed to execute file operations on the SRAM-Disk device, it provides all required software code for properly managing it.

The application's main calls the fx_FileXApp() function that handles file operations. At this stage, all FileX resources are created and the SRAM driver is initialized. After that, the fx_FileXApp will start by formatting the SRAM-Disk using FileX services. The resulting file system is a FAT32 compatible, with 512 bytes per sector.

Upon successful opening of the created SRAM-Disk media, FileX continue with creating a file called "STM32.TXT" into the root directory, then write into it some predefined data. Then file is re-opened in read only mode and content is checked.

As stated earlier, the present application runs in standalone mode without ThreadX, for this reason, the standalone variant of fileX is used, plus the following flags need to be set in fx_user.h:

#define FX_SINGLE_THREAD
#define FX_STANDALONE_ENABLE

Expected success behavior

Successful operation is marked by a toggeling green LED light.

Also, information regarding executing operation on the SRAM-Disk is printed to the serial port.

Error behaviors

On failure, the red LED starts toggeling while the green LED is switched OFF.

Assumptions if any

None

Known limitations

None

Notes

  1. If the user code size exceeds the DTCM-RAM size or starts from internal cacheable memories (SRAM1 and SRAM2), that is shared between several processors, then it is highly recommended to enable the CPU cache and maintain its coherence at application level. The address and the size of cacheable buffers (shared between CPU and other masters) must be properly updated to be aligned to cache line size (32 bytes).

FileX/LevelX usage hints

  • When calling the fx_media_format() API, it is highly recommended to understand all the parameters used by the API to correctly generate a valid filesystem.
  • FileX is using data buffers, passed as arguments to fx_media_open(), fx_media_read() and fx_media_write() API, it is recommended that these buffers are multiple of sector size and be "4 bytes" aligned to avoid unaligned access issues.

Keywords

RTOS, ThreadX, FileX, File System, FAT32, SRAM, SRAM-DISK

Hardware and Software environment

  • This application runs on STM32G474xx devices.

  • This application has been tested with STMicroelectronics STM32F767ZI-NUCLEO board MB1137 Revision B-01 and can be easily tailored to any other supported device and development board.

  • This application uses USART3 to display logs, the hyperterminal configuration is as follows:

    • BaudRate = 115200 baud
    • Word Length = 8 Bits
    • Stop Bit = 1
    • Parity = none
    • Flow control = None

How to use it ?

In order to make the program work, you must do the following:

  • Open your preferred toolchain
  • Rebuild all files and load your image into target memory
  • Run the application