-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for SD Card and FATFS (#1178)
- Loading branch information
1 parent
7c91268
commit a348269
Showing
36 changed files
with
2,758 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Copyright (c) 2017 The nanoFramework project contributors | ||
# See LICENSE file in the project root for full license information. | ||
# | ||
|
||
# native code directory | ||
set(BASE_PATH_FOR_THIS_MODULE "${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/Windows.Storage") | ||
|
||
|
||
# set include directories | ||
list(APPEND Windows.Storage_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/fatfs/src") | ||
list(APPEND Windows.Storage_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/targets/CMSIS-OS/ChibiOS/Include") | ||
list(APPEND Windows.Storage_INCLUDE_DIRS "${BASE_PATH_FOR_THIS_MODULE}") | ||
|
||
# source files | ||
set(Windows.Storage_SRCS | ||
|
||
win_storage_native_Windows_Storage_StorageFolder.cpp | ||
win_storage_native.cpp | ||
|
||
Target_Windows_Storage.c | ||
) | ||
|
||
foreach(SRC_FILE ${Windows.Storage_SRCS}) | ||
set(Windows.Storage_SRC_FILE SRC_FILE-NOTFOUND) | ||
find_file(Windows.Storage_SRC_FILE ${SRC_FILE} | ||
PATHS | ||
|
||
"${BASE_PATH_FOR_THIS_MODULE}" | ||
"${PROJECT_SOURCE_DIR}/targets/CMSIS-OS/ChibiOS/common" | ||
|
||
CMAKE_FIND_ROOT_PATH_BOTH | ||
) | ||
# message("${SRC_FILE} >> ${Windows.Storage_SRC_FILE}") # debug helper | ||
list(APPEND Windows.Storage_SOURCES ${Windows.Storage_SRC_FILE}) | ||
endforeach() | ||
|
||
|
||
include(FindPackageHandleStandardArgs) | ||
|
||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Windows.Storage DEFAULT_MSG Windows.Storage_INCLUDE_DIRS Windows.Storage_SOURCES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#build matrx with target names and build options | ||
$BuildMatrix = ("MBN_QUAIL", "-DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON", 'True'), | ||
("ST_STM32F4_DISCOVERY", "-DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON", 'False'), | ||
("ST_STM32F429I_DISCOVERY", "-DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON", 'False'), | ||
("ST_NUCLEO64_F091RC", "-DTARGET_SERIES=STM32F0xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=OFF -DNF_PLATFORM_NO_CLR_TRACE=ON -DNF_CLR_NO_IL_INLINE=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON", 'False'), | ||
("ST_NUCLEO144_F746ZG", "-DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON", 'False'), | ||
("ST_STM32F769I_DISCOVERY", "-DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON", 'False'), | ||
("NETDUINO3_WIFI", "-DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DUSE_RNG=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON", 'True') | ||
|
||
# get commit message | ||
$commitMessage = "$env:APPVEYOR_REPO_COMMIT_MESSAGE" + " " + "$env:APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED" | ||
|
||
# is there a target name in the commit message? | ||
$targetCandidate = [regex]::Matches("$commitMessage",'[#]+\w+[#]').Value | ||
|
||
if($targetCandidate -is [array]) | ||
{ | ||
$global:BUILD_MATRIX = @(,@()) | ||
|
||
ForEach($candidate in $targetCandidate) | ||
{ | ||
# remove the leading and trailinig '#' | ||
$thisCandidate = $candidate -replace "#", "" | ||
|
||
# find if there is a target with this name | ||
ForEach($item in $BuildMatrix) | ||
{ | ||
if(!$item[0].CompareTo($thisCandidate)) | ||
{ | ||
if($global:BUILD_MATRIX) | ||
{ | ||
$global:BUILD_MATRIX += , $item | ||
} | ||
else | ||
{ | ||
$global:BUILD_MATRIX = , $item | ||
} | ||
|
||
break; | ||
} | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
if($targetCandidate) | ||
{ | ||
# special case for #ALL_STM32# (build all targets) | ||
if(!$targetCandidate.CompareTo('#ALL_STM32#')) | ||
{ | ||
# target to build is the board name | ||
$env:BOARD_NAME = "STM32" | ||
|
||
$global:BUILD_MATRIX = $BuildMatrix | ||
} | ||
else | ||
{ | ||
# remove the leading and trailinig '#' | ||
$targetCandidate = $targetCandidate -replace "#", "" | ||
|
||
# find if there is a target with this name | ||
ForEach($item in $BuildMatrix) | ||
{ | ||
if(!$item[0].CompareTo($targetCandidate)) | ||
{ | ||
$env:BOARD_NAME = $item[0] | ||
$env:BUILD_OPTIONS = $item[1] | ||
$env:NEEDS_DFU = $item[2] | ||
|
||
break; | ||
} | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
# default is to build all STM32 targets | ||
$env:BOARD_NAME = 'STM32' | ||
|
||
$global:BUILD_MATRIX = $BuildMatrix | ||
} | ||
} | ||
|
||
if($env:BOARD_NAME) | ||
{ | ||
if(!$env:BOARD_NAME.CompareTo('STM32')) | ||
{ | ||
Write-Host "Build all STM32 targets" | ||
} | ||
else | ||
{ | ||
Write-Host "Target board is " $env:BOARD_NAME | ||
} | ||
} | ||
else | ||
{ | ||
if($global:BUILD_MATRIX) | ||
{ | ||
Write-Host "Build targets:" | ||
|
||
ForEach($item in $global:BUILD_MATRIX) | ||
{ | ||
$env:BOARD_NAME += $item[0]+'|' | ||
Write-Host $item[0] | ||
} | ||
} | ||
else | ||
{ | ||
Write-Host "No STM32 target to build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// Copyright (c) 2018 The nanoFramework project contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#ifndef _TARGET_WINDOWS_STORAGE_H_ | ||
#define _TARGET_WINDOWS_STORAGE_H_ 1 | ||
|
||
#include <ch.h> | ||
#include <cmsis_os.h> | ||
#include <hal.h> | ||
#include <ff.h> | ||
|
||
#define POLLING_INTERVAL 10 | ||
#define POLLING_DELAY 10 | ||
|
||
// void RemoveHandler(eventid_t id); | ||
// void InsertHandler(eventid_t id); | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void Target_FileSystemInit(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif //_TARGET_WINDOWS_STORAGE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.