This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MCU-PLUS-SDK-AM263X: FreeRTOS _FAT file system on SD card with access from FreeRTOS r5 core (AM64x)

Part Number: MCU-PLUS-SDK-AM263X

Tool/software:

Please refer to the linked issue first - that thread is locked so I have to post a question here.

I tried to port the zipped project from AM263x to AM64x, but I got the following errors.

Here is the snapshot from the referenced thread.

The errors mentioned above are due to some included pathnames and lib files in the .cproject file. When some freertos and freertos_fat files are both included we got the redefinition problem.

   

If AM263x and AM64x don't have difference in this regard, I wonder why the redefinition problem did not occur for the original post (as in the zipped file).

Can anyone help with it?

  • Hi Leo,

    Seems like you missed some step here. The linked original E2E also has these redefinition errors Can you please make sure the below steps are followed at your end:

    1. Inside C:\ti\mcu_plus_sdk_am64x\source\kernel\freertos\config\am64x\r5f\FreeRTOSConfig.h, change the value of configNUM_THREAD_LOCAL_STORAGE_POINTERS to 7

    2.  Rebuild the FreeRTOS library from the top-level mcu-plus-sdk folder using the command:

    # TO CLEAN
    gmake -sj -f makefile.am64x freertos_r5f.ti-arm-clang_clean
    
    # TO BUILD
    gmake -sj -f makefile.am64x freertos_r5f.ti-arm-clang

    3. Inside the makefile for FreeRTOS_FAT library, make the following changes:

       3.1 Open the makefile at: C:\ti\mcu_plus_sdk_am64x\source\fs\freertos_fat\makefile.am64x.r5f.ti-arm-clang

       3.2 From FILES_common list, remove portable.c and add ff_time.c and ff_locking.c

       3.3 In the FILES_PATH_common list, remove the portable/nortos path and add the FreeRTOS include paths, Make sure your FILES_PATH_common, INCLUDES_common and FILES_common look similar: 

    FILES_common := \
        ff_crc.c \
        ff_dir.c \
        ff_error.c \
        ff_fat.c \
        ff_file.c \
        ff_ioman.c \
        ff_memory.c \
        ff_stdio.c \
        ff_string.c \
        ff_sys.c \
        ff_format.c \
        ff_mmcsd.c \
        ff_locking.c \
        ff_time.c \
    
    FILES_PATH_common = \
        ${MCU_PLUS_SDK_PATH}/source/fs/freertos_fat/FreeRTOS-FAT \
        ${MCU_PLUS_SDK_PATH}/source/fs/freertos_fat/portable \
        ${MCU_PLUS_SDK_PATH}/source/kernel/freertos/FreeRTOS-Kernel/include \
        ${MCU_PLUS_SDK_PATH}/source/kernel/freertos/portable/TI_ARM_CLANG/ARM_CR5F \
        ${MCU_PLUS_SDK_PATH}/source/kernel/freertos/config/am263x/r5f \
    
    INCLUDES_common := \
        -I${CG_TOOL_ROOT}/include/c \
        -I${MCU_PLUS_SDK_PATH}/source \
        -I${MCU_PLUS_SDK_PATH}/source/fs/freertos_fat/FreeRTOS-FAT/include \
        -I${MCU_PLUS_SDK_PATH}/source/fs/freertos_fat/config \
        -I${MCU_PLUS_SDK_PATH}/source/fs/freertos_fat/portable \
        -I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/FreeRTOS-Kernel/include \
        -I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/portable/TI_ARM_CLANG/ARM_CR5F \
        -I${MCU_PLUS_SDK_PATH}/source/kernel/freertos/config/am263x/r5f \

    3.4 Now rebuild your FreeRTOS_FAT library

    # TO CLEAN
    gmake -sj -f makefile.am64x freertos_fat_r5f.ti-arm-clang_clean
    
    # TO BUILD
    gmake -sj -f makefile.am64x freertos_fat_r5f.ti-arm-clang

    4. Port the example from AM263x to AM64x and place it in the Path: C:\ti\mcu_plus_sdk_am64x\examples\drivers\mmcsd\mmcsd_file_io\am64x-evm

    5. Inside \source\fs\freertos_fat\portable\ff_mmcsd.c, you will have to create a semaphore required by the struct xParameters, by default this is being assigned as NULL.

    As a part of MCU+ SDK 10.01 release which will be happening later this year, the SDK will have an example which will showcase the co-existence of FreeRTOS lib and the FreeRTOS FAT Lib.

    Please do note from the previous E2E that this is not a complete working solution and just a zip/patch to fix the redefinition errors and compilation errors. Please try the same so I can help you if you run into any more issues

    Regards,
    Shaunak

  • After rebuild the whole library the redefinition error is gone. Still not very sure how to implement the semaphore there.

  • Hi Leo,

    After rebuild the whole library the redefinition error is gone

    Thanks for confirming.

    Still not very sure how to implement the semaphore there.

    In you ff_mmcsd.c file, at mcu_plus_sdk/source/fs/freertos_fat/portable you will have to change the FF_MMCSDDiskInit function to create a semaphore and assign the same to xParameters.pvSemaphore. The semaphore is used to protect FAT data structures and will be controlled by the application. You can refer to some other implementations in teh portable folder for other devices and try the same.

    Regards,
    Shaunak