Skip to content

Add Altera Agilex 5 SoC FPGA port for SDMMC and USB MSC - #88

Open
AmnaxEhtsham wants to merge 6 commits into
FreeRTOS:mainfrom
shamidx:feature_socfpga
Open

AmnaxEhtsham wants to merge 6 commits into
FreeRTOS:mainfrom
shamidx:feature_socfpga

Conversation

@AmnaxEhtsham

@AmnaxEhtsham AmnaxEhtsham commented Oct 5, 2026 •

Copy link
Copy Markdown

Summary

This PR adds FreeRTOS+FAT support for Altera Agilex 5 SoC FPGA platforms.


Changes

  • Add the portable/SOCFPGA port.
  • Add SDMMC block read/write support.
  • Add USB Mass Storage Class block read/write support.
  • Route block operations to SDMMC or USB based on the disk device address.
  • Add CMake integration for the SOCFPGA port.
  • Add faster free-cluster counting using multi-sector FAT reads.
  • Add FAT32 FSInfo update support.
  • Extend the disk structure to store the device address.
  • Update relevant FreeRTOS+FAT configuration and public interfaces.

Device selection

  • Device address -1 selects SDMMC.
  • Device addresses 0 and above select USB MSC.

Original commits

  • 41d64e2 Add support for Altera Agilex5 SoC FPGA
  • d0a9230 Add portable layer for Agilex 5
  • e7af08d Update SOCFPGA directory name
  • 4910613 Fix SOCFPGA file headers
  • 38f6478 Include msc_app.c in the FATFS CMake target

Testing

  • Tested on Agilex 5 (A5ED065BB32AE4S) with a Kingston DataTraveler 3.0 (57 GB) on USB3.

sourav-ign and others added 5 commits September 25, 2026 14:40
Signed-off-by: souravr <sourav.raj@ignitarium.com>
Signed-off-by: souravr <sourav.raj@ignitarium.com>
Signed-off-by: souravr <sourav.raj@ignitarium.com>
Minor updates to the file headers

Signed-off-by: Abdul Jaleel <abdul.jaleel@ignitarium.com>
Signed-off-by: souravr <sourav.raj@ignitarium.com>
@AmnaxEhtsham AmnaxEhtsham changed the title Feature socfpga Add Altera Agilex 5 SoC FPGA port for SDMMC and USB MSC Oct 5, 2026

@htibosch htibosch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations! And thank you for your big contribution.

I have reviewed it roughly. All part specific code and header files go into directory:

/portable/SOCFPGA

I have also looked at a USB interface. You let it depend on the block address, good idea.

Earlier, I have worked on this project:

\FreeRTOS-Plus-FAT\portable\Cyclone_V_Soc\alt_sdmmc.c
\FreeRTOS-Plus-FAT\portable\Cyclone_V_Soc\alt_sdmmc.h
\FreeRTOS-Plus-FAT\portable\Cyclone_V_Soc\ff_sddisk.c
\FreeRTOS-Plus-FAT\portable\Cyclone_V_Soc\main_fstest.c

but it never got on the rails.

Comment thread include/ff_error.h Outdated
Comment thread include/ff_ioman.h
Comment thread include/FreeRTOSFATConfig.h
Comment thread include/FreeRTOSFATConfigDefaults.h
Comment thread include/FreeRTOSFATConfigDefaults.h
Comment thread ff_fat.c
Comment thread ff_fat.c
{
/* _HT_ : FF_CountFreeClusters was a little too busy, have it call the WDT and sleep */
clearWDT();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, my initials: HT
I used to enable a WDT.

Comment thread ff_fat.c
( FF_getLong( pxBuffer->pucBuffer, 484 ) == 0x61417272 ) )
if( ( FF_getLong( pxBuffer->pucBuffer, 0 ) == FS_INFO_SIGNATURE1_0x41615252 ) &&
( FF_getLong( pxBuffer->pucBuffer, 484 ) == FS_INFO_SIGNATURE2_0x61417272 ) )
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning a number into a macro, very good!

Comment thread ff_fat.c
Comment thread ff_ioman.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants