Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing SD Card as Os::File #28

Closed
ethancheez opened this issue Apr 20, 2024 · 2 comments
Closed

Implementing SD Card as Os::File #28

ethancheez opened this issue Apr 20, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ethancheez
Copy link
Collaborator

ethancheez commented Apr 20, 2024

Add support for a file system on Arduino platforms, using an SD card.

See these additions:

@LeStarch I would like your expertise/opinion on this. Do you think this is worth adding? Or is work being done to implement a microFS within FPrime that would perform better (or make more sense) compared to an SD card instance?

Edit: An argument to use an SD card over a microFS is memory usage. External storage means the file system would not have to tap into the internal FLASH/RAM, which is already very limited for most Arduino platforms

So far I have done small tests with this and was able to read/write multiple files, create directories, delete files, move files etc.

A possible design flaw with this is that I had to use new ::File within the constructor and store the Arduino File class as a pointer to m_fd.

Adding this new feature will hopefully allow the integrating of FileUplink and FileDownlink for Baremetal applications.
Edit: FileDownlink and Uplink works

@ethancheez ethancheez added the enhancement New feature or request label Apr 20, 2024
@ethancheez
Copy link
Collaborator Author

I also had to comment out two lines in fprime/Os/CMakeLists.txt:87 to:

if (FPRIME_USE_BAREMETAL_SCHEDULER)
    add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Baremetal/TaskRunner/")
    foreach (ITER_ITEM IN LISTS SOURCE_FILES)
        if (ITER_ITEM MATCHES "Task\\.cpp$")
            list(REMOVE_ITEM SOURCE_FILES "${ITER_ITEM}")
        endif()
    endforeach()
    # list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/File.cpp")
    # list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/FileSystem.cpp")
    list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/IntervalTimer.cpp")
    list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/Mutex.cpp")
    list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/Queue.cpp")
    list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/SystemResources.cpp")
    list(APPEND SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Baremetal/Task.cpp")
endif()

These lines would force the use of the Baremetal versions of File.cpp and FileSystem.cpp and would prevent my Arduino versions to be used. Unsure if there is a better way to do this.

@ethancheez
Copy link
Collaborator Author

Closing because of OSAL refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant