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

FatFS Integration #551

Merged
merged 5 commits into from
Dec 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMake/Modules/CHIBIOS_STM32F7xx_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ foreach(SRC_FILE ${CHIBIOS_PORT_SRCS})
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/MACv1
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/OTGv1
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/RTCv2
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SDMMCv1 #why not sdio?
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SDMMCv1
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SPIv2
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/TIMv1
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/USARTv2
Expand Down Expand Up @@ -100,7 +100,7 @@ list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/por
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/MACv1)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/OTGv1)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/RTCv2)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SDMMCv1)#why not sdio?
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SDMMCv1)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SPIv2)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/TIMv1)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/USARTv2)
Expand Down
45 changes: 45 additions & 0 deletions CMake/Modules/FindCHIBIOS_FATFS.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2017 The nanoFramework project contributors
# See LICENSE file in the project root for full license information.
#

execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xvf ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/fatfs-0.13-patched.7z
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/
)


# List of the required FatFs include files.
#list(APPEND CHIBIOS_FATFS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/various)
#list(APPEND CHIBIOS_FATFS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/various/fatfs_bindings)
list(APPEND CHIBIOS_FATFS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/fatfs/src)


set(FATFS_SRCS
# bindings
fatfs_diskio.c
fatfs_syscall.c

# fatfs
ff.c
ffunicode.c
)


foreach(SRC_FILE ${FATFS_SRCS})
set(FATFS_SRC_FILE SRC_FILE -NOTFOUND)
find_file(FATFS_SRC_FILE ${SRC_FILE}
PATHS
${PROJECT_BINARY_DIR}/ChibiOS_Source/os/various/fatfs_bindings
${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/fatfs/src

CMAKE_FIND_ROOT_PATH_BOTH
)
# message("${SRC_FILE} >> ${FATFS_SRC_FILE}") # debug helper
list(APPEND CHIBIOS_FATFS_SOURCES ${FATFS_SRC_FILE})
endforeach()


include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(CHIBIOS_FATFS DEFAULT_MSG CHIBIOS_FATFS_INCLUDE_DIRS CHIBIOS_FATFS_SOURCES)
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,22 @@ endif()

#################################################################

#################################################################
# enables filesysytem support in nanoCLR
# (default is OFF so the filesystem is NOT supported)
option(NF_FEATURE_USE_FILESYSTEM "option to use filesystem")

if(NF_FEATURE_USE_FILESYSTEM)
set(USE_FILESYSTEM_OPTION TRUE CACHE INTERNAL "NF feature FILESYSTEM")
set(HAL_USE_SDC_OPTION TRUE CACHE INTERNAL "HAL SDC for NF_FEATURE_USE_FILESYSTEM")
message(STATUS "Support for filesystem enabled")
else()
set(USE_FILESYSTEM_OPTION FALSE CACHE INTERNAL "NF feature FILESYSTEM")
set(HAL_USE_SDC_OPTION FALSE CACHE INTERNAL "HAL SDC for NF_FEATURE_USE_FILESYSTEM")
endif()

#################################################################

#################################################################
# manage nanoFramework API namespaces
#################################################################
Expand Down
2 changes: 2 additions & 0 deletions cmake-variants.TEMPLATE.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"NF_FEATURE_DEBUGGER" : "TRUE-to-include-nF-debugger",
"NF_FEATURE_RTC" : "OFF-default-ON-to-enable-hardware-RTC",
"NF_FEATURE_USE_APPDOMAINS" : "OFF-default-ON-to-enable-support-for-Application-Domains",
"NF_FEATURE_USE_FILESYSTEM" : "OFF-default-ON-to-enable-support",
"NF_FEATURE_USE_NETWORKING" : "OFF-default-ON-to-enable-support",
"API_System.DateTime" : "OFF-default-ON-to-add-this-API",
"API_Windows.Devices.Gpio" : "OFF-default-ON-to-add-this-API",
Expand Down Expand Up @@ -75,6 +76,7 @@
"NF_FEATURE_DEBUGGER" : "TRUE-to-include-nF-debugger",
"NF_FEATURE_RTC" : "OFF-default-ON-to-enable-hardware-RTC",
"NF_FEATURE_USE_APPDOMAINS" : "OFF-default-ON-to-enable-support-for-Application-Domains",
"NF_FEATURE_USE_FILESYSTEM" : "OFF-default-ON-to-enable-support",
"NF_FEATURE_USE_NETWORKING" : "OFF-default-ON-to-enable-support",
"API_System.DateTime" : "OFF-default-ON-to-add-this-API",
"API_Windows.Devices.Gpio" : "OFF-default-ON-to-add-this-API",
Expand Down
5 changes: 5 additions & 0 deletions targets/CMSIS-OS/ChibiOS/MBN_QUAIL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
7 changes: 4 additions & 3 deletions targets/CMSIS-OS/ChibiOS/MBN_QUAIL/nanoCLR/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
5 changes: 5 additions & 0 deletions targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
7 changes: 4 additions & 3 deletions targets/CMSIS-OS/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
5 changes: 5 additions & 0 deletions targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
5 changes: 5 additions & 0 deletions targets/CMSIS-OS/ChibiOS/ST_NUCLEO64_F091RC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
7 changes: 4 additions & 3 deletions targets/CMSIS-OS/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
5 changes: 5 additions & 0 deletions targets/CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@
/**
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
#define HAL_USE_SDC FALSE
#endif
// this option is set at target_board.h (from config file)
// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
// #define HAL_USE_SDC FALSE
// #endif

/**
* @brief Enables the SERIAL subsystem.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
endif()

# nF feature: filesystem
if(USE_FILESYSTEM_OPTION)
find_package(CHIBIOS_FATFS REQUIRED)
endif()

#######################################


Expand Down
Loading