cancel
Showing results for 
Search instead for 
Did you mean: 

Decompression of SD card Files

PB S.1
Associate II

Hi,

I am using STM32H5 microcontroller with Free-RTOS environment.

Interfaced SD card with the MCU using LittleFS file system.

My SD card has Compressed files, I wanted to decompress them and write to the separate folder. Is there any libraries supported to carryout this procedure in Free-RTOS environment?

Provide if there is any example code

6 REPLIES 6

@PB S.1 wrote:

My SD card has Compressed files, I wanted to decompress them 


Is it a standard compression scheme?

If so, just search for libraries for that scheme - that fact that the file is on an SD Card makes no difference.

GitHub is a good place to search for such things.

 


@PB S.1 wrote:

Is there any libraries supported to carryout this procedure in Free-RTOS environment?


That would be a question for Free-RTOS:

https://www.freertos.org/libraries/categories.html

https://www.freertos.org/FAQ.html

 

PB S.1
Associate II

Hi Team,

Is there a PC-based tool available for storing files on an SD card in the LittleFS file system format? I aim to access and read these files using an STM32H5 MCU-based application, which already has the LittleFS file system implemented.

Isn't one of the benefits of using standard file systems and file formats that you cN just copy files without having to install things on the host. Also why attaching as an USB MSC is also popular.

ZIP files use a couple of compression formats that can be implemented. Files typically need to be processed in a linear fashion where you have read and write functions that pace based on data consumption and generation, as it's often impractical to load the whole image into memory at once. 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

If you have a file system working which stores files on SD card, e.g. in a FAT/FAT32/exFAT formatted disk - you should be able to read/write the card also on a host computer (e.g. Windows).

If you want to "unzip" a compressed file on SD card - done by MCU FW:

  • potentially you find a "zip/unzip" library to do so: just try to add to your FW system
  • but bear in mind the size of temporary memory you would need:
    often, ZIP, using a "Huffman Coding" algorithm, might need to have the entire file content in memory first,
    or the unzipped file content needs a lot of memory where to store temporarily.

I agree with Tesla DeLorean: ZIP/UNZIP on embedded systems can be challenging in terms of memory space you need.

If you store the files on a SD Card and you have an USB connection: you could think about to implement a USB storage device, a MSC Class: then you can see your SD Card on a PC like an external memory device (via USB).

The PC can do the ZIP/UNZIP, without to take the SD Card to the PC: your SD Card in MCU pops up as a USB memory device on the host (it works well for me).


@tjaekel wrote:

If you have a file system working which stores files on SD card, e.g. in a FAT/FAT32/exFAT 


OP states LittleFS is used - not something that PCs support!