Skip to content

Commit

Permalink
Add support for SD Card and FATFS (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Jan 25, 2019
1 parent 7c91268 commit a348269
Show file tree
Hide file tree
Showing 36 changed files with 2,758 additions and 44 deletions.
4 changes: 2 additions & 2 deletions CMake/Modules/CHIBIOS_STM32F4xx_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(CHIBIOS_PORT_SRCS
hal_i2c_lld.c
hal_mac_lld.c
hal_rtc_lld.c
#hal_sdc_lld.c
hal_sdc_lld.c
#hal_i2s_lld.c
hal_spi_lld.c
hal_st_lld.c
Expand Down Expand Up @@ -97,7 +97,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)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SDIOv1)
list(APPEND CHIBIOS_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ChibiOS_Source/os/hal/ports/STM32/LLD/SPIv1)
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/USARTv1)
Expand Down
6 changes: 3 additions & 3 deletions CMake/Modules/CHIBIOS_STM32F7xx_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set(CHIBIOS_PORT_SRCS
hal_i2c_lld.c
hal_mac_lld.c
hal_rtc_lld.c
#hal_sdc_lld.c
hal_sdc_lld.c
#hal_i2s_lld.c
hal_spi_lld.c
hal_st_lld.c
Expand Down Expand Up @@ -68,7 +68,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
${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 @@ -97,7 +97,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)
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
17 changes: 15 additions & 2 deletions CMake/Modules/FindCHIBIOS_FATFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ execute_process(


# 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)


Expand Down Expand Up @@ -43,3 +41,18 @@ endforeach()
include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(CHIBIOS_FATFS DEFAULT_MSG CHIBIOS_FATFS_INCLUDE_DIRS CHIBIOS_FATFS_SOURCES)

# setup target to unzip ChibiOS external filesystem components
add_custom_target( CHIBIOS_FILESYSTEM_COMPONENTS ALL )

add_custom_command(TARGET CHIBIOS_FILESYSTEM_COMPONENTS
PRE_BUILD
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/
DEPENDS ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/fatfs-0.13_patched.7z

VERBATIM
)

# this depends on ChibiOS target being already downloaded
add_dependencies(CHIBIOS_FILESYSTEM_COMPONENTS ChibiOS)
41 changes: 41 additions & 0 deletions CMake/Modules/FindWindows.Storage.cmake
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)
7 changes: 7 additions & 0 deletions CMake/Modules/NF_NativeAssemblies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ option(API_Windows.Devices.Pwm "option for Windows.Devices.Pwm
option(API_Windows.Devices.SerialCommunication "option for Windows.Devices.SerialCommunication API")
option(API_Windows.Devices.Spi "option for Windows.Devices.Spi API")
option(API_Windows.Networking.Sockets "option for Windows.Networking.Sockets")
option(API_Windows.Storage "option for Windows.Storage")


# Esp32 only
Expand Down Expand Up @@ -175,6 +176,12 @@ macro(ParseNativeAssemblies)
##### API name here (doted name)
PerformSettingsForApiEntry("Windows.Devices.Wifi")
endif()

# Windows.Storage
if(API_Windows.Storage)
##### API name here (doted name)
PerformSettingsForApiEntry("Windows.Storage")
endif()

# Interop assemblies
ParseInteropAssemblies()
Expand Down
38 changes: 22 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,20 +374,6 @@ endif()
# set default option for SNTP to ON
option(NF_NETWORKING_SNTP "option to use add SNTP support, requires networking otherwise has no effect" ON)

#################################################################
# 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()

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


Expand Down Expand Up @@ -526,6 +512,21 @@ endif()
#################################################################


#################################################################
# enables filesysytem support in nanoCLR

if(API_Windows.Storage)
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()

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


#################################################################
# RTC (real time clock) (default is OFF so RTC is NOT included)
option(NF_FEATURE_RTC "option to use hardware RTC")
Expand Down Expand Up @@ -645,7 +646,10 @@ if(RTOS_CHIBIOS_CHECK)
TIMEOUT 10
LOG_DOWNLOAD 1

# install command has to perform TWO extracts
# in order to set multiple commands with INSTALL_COMMAND they have to be concatenated by a COMMAND keyword
INSTALL_COMMAND ${CMAKE_COMMAND} -E tar xvf ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/lwip-2.0.3-patched.7z WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/
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/

# Disable all other steps
CONFIGURE_COMMAND ""
Expand Down Expand Up @@ -680,8 +684,10 @@ if(RTOS_CHIBIOS_CHECK)
PREFIX ChibiOS
SOURCE_DIR ${CMAKE_BINARY_DIR}/ChibiOS_Source

INSTALL_COMMAND ${CMAKE_COMMAND} -E tar xvf ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/lwip-2.0.3-patched.7z WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/

# install command has to perform TWO extracts
# in order to set multiple commands with INSTALL_COMMAND they have to be concatenated by a COMMAND keyword
INSTALL_COMMAND ${CMAKE_COMMAND} -E tar xvf ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/lwip-2.0.3-patched.7z WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ChibiOS_Source/ext/ 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/

# Disable all other steps
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
NeedsDFU: true
NETDUINO3_WIFI:
BoardName: NETDUINO3_WIFI
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=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_nanoFramework.Devices.OneWire=ON
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=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_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON
NeedsDFU: true
ST_STM32F429I_DISCOVERY:
BoardName: ST_STM32F429I_DISCOVERY
Expand All @@ -91,7 +91,7 @@ jobs:
NeedsDFU: false
ST_STM32F769I_DISCOVERY:
BoardName: ST_STM32F769I_DISCOVERY
BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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 -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON
BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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 -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_Windows.Storage=ON
NeedsDFU: false

variables:
Expand Down
1 change: 1 addition & 0 deletions cmake-variants.TEMPLATE.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"API_Windows.Devices.SerialCommunication" : "OFF-default-ON-to-add-this-API",
"API_Windows.Devices.Spi" : "OFF-default-ON-to-add-this-API",
"API_Windows.Networking.Sockets" : "OFF-default-ON-to-add-this-API",
"API_Windows.Storage" : "OFF-default-ON-to-add-this-API",
"API_Hardware.Esp32" : "OFF-default-ON-to-add-this-API",
"API_Hardware.Stm32" : "OFF-default-ON-to-add-this-API"
}
Expand Down
111 changes: 111 additions & 0 deletions get-stm32-targets-to-build.ps1
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"
}
}
30 changes: 30 additions & 0 deletions targets/CMSIS-OS/ChibiOS/Include/Target_Windows_Storage.h
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_
7 changes: 7 additions & 0 deletions targets/CMSIS-OS/ChibiOS/MBN_QUAIL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ add_executable(
add_dependencies(${NANOBOOTER_PROJECT_NAME}.elf ChibiOS)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf ChibiOS)

# add dependencies from CHIBIOS_FILESYSTEM_COMPONENTS (this is required to make sure that ChibiOS filesystem components are unzip at the proper locations before the build starts)
# only required if filesystem is ON
if(USE_FILESYSTEM_OPTION)
add_dependencies(${NANOBOOTER_PROJECT_NAME}.elf CHIBIOS_FILESYSTEM_COMPONENTS)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf CHIBIOS_FILESYSTEM_COMPONENTS)
endif()

# include common directories
include_directories(
"${CMAKE_CURRENT_BINARY_DIR}"
Expand Down
4 changes: 2 additions & 2 deletions targets/CMSIS-OS/ChibiOS/MBN_QUAIL/nanoCLR/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@
*/
#define STM32_SDC_SDIO_DMA_PRIORITY 3
#define STM32_SDC_SDIO_IRQ_PRIORITY 9
#define STM32_SDC_WRITE_TIMEOUT_MS 250
#define STM32_SDC_READ_TIMEOUT_MS 25
#define STM32_SDC_WRITE_TIMEOUT_MS 1000
#define STM32_SDC_READ_TIMEOUT_MS 1000
#define STM32_SDC_CLOCK_ACTIVATION_DELAY 10
#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
Expand Down
Loading

0 comments on commit a348269

Please sign in to comment.