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

Extract System.Collections from mscorlib #1474

Merged
merged 1 commit into from
Nov 4, 2019
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
2 changes: 2 additions & 0 deletions CMake/ChibiOS_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@

#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@

#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@

#endif /* _TARGET_OS_H_ */
2 changes: 2 additions & 0 deletions CMake/ESP32_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@

#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@

#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@

#endif /* _TARGET_OS_H_ */
10 changes: 6 additions & 4 deletions CMake/Modules/FindNF_CoreCLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ set(NF_CoreCLR_SRCS
CLR_RT_HeapBlock_Finalizer.cpp
CLR_RT_HeapBlock_Lock.cpp
CLR_RT_HeapBlock_LockRequest.cpp
CLR_RT_HeapBlock_Queue.cpp
CLR_RT_HeapBlock_Node.cpp
CLR_RT_HeapBlock_Stack.cpp
CLR_RT_HeapBlock_String.cpp
CLR_RT_HeapBlock_Timer.cpp
CLR_RT_HeapBlock_WaitForObject.cpp
Expand Down Expand Up @@ -79,8 +77,6 @@ set(NF_CoreCLR_SRCS
corlib_native_System_Attribute.cpp
corlib_native_System_BitConverter.cpp
corlib_native_System_Collections_ArrayList.cpp
corlib_native_System_Collections_Queue.cpp
corlib_native_System_Collections_Stack.cpp
corlib_native_System_Console.cpp
corlib_native_System_Convert.cpp
corlib_native_System_DateTime.cpp
Expand Down Expand Up @@ -179,6 +175,12 @@ if(NF_FEATURE_SUPPORT_REFLECTION)
list(APPEND NF_CoreCLR_SRCS corlib_native_System_Type.cpp)
endif()

# include Collection support files depending on build option
if(API_nanoFramework.System.Collections)
list(APPEND NF_CoreCLR_SRCS CLR_RT_HeapBlock_Queue.cpp)
list(APPEND NF_CoreCLR_SRCS CLR_RT_HeapBlock_Stack.cpp)
endif()

# need a conditional include because of ESP32 building network as a library
if(NOT USE_SECURITY_MBEDTLS_OPTION)
list(APPEND NF_CoreCLR_SRCS base64.c)
Expand Down
42 changes: 42 additions & 0 deletions CMake/Modules/FindnanoFramework.System.Collections.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Copyright (c) 2019 The nanoFramework project contributors
# See LICENSE file in the project root for full license information.
#


# set include directories
list(APPEND nanoFramework.System.Collections_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/HAL/Include")
list(APPEND nanoFramework.System.Collections_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Collections")


# the following CLR support files are required and added to the build by FindNF_CoreCLR.cmake
# CLR_RT_HeapBlock_Queue.cpp
# CLR_RT_HeapBlock_Stack.cpp

# source files
set(nanoFramework.System.Collections_SRCS

# source files of the assembly
nf_system_collections_System_Collections_Queue.cpp
nf_system_collections_System_Collections_Stack.cpp
nf_system_collections.cpp
)

foreach(SRC_FILE ${nanoFramework.System.Collections_SRCS})
set(nanoFramework.System.Collections_SRC_FILE SRC_FILE-NOTFOUND)
find_file(nanoFramework.System.Collections_SRC_FILE ${SRC_FILE}
PATHS

# path for source files of this module
${PROJECT_SOURCE_DIR}/src/nanoFramework.System.Collections

CMAKE_FIND_ROOT_PATH_BOTH
)
# message("${SRC_FILE} >> ${nanoFramework.System.Collections_SRC_FILE}") # debug helper
list(APPEND nanoFramework.System.Collections_SOURCES ${nanoFramework.System.Collections_SRC_FILE})
endforeach()


include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.System.Collections DEFAULT_MSG nanoFramework.System.Collections_INCLUDE_DIRS nanoFramework.System.Collections_SOURCES)
7 changes: 7 additions & 0 deletions CMake/Modules/NF_NativeAssemblies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ option(API_nanoFramework.Devices.OneWire "option for nanoFramework.Device
option(API_nanoFramework.Networking.Sntp "option for nanoFramework.Networking.Sntp")
option(API_nanoFramework.Runtime.Events "option for nanoFramework.Runtime.Events API")
option(API_nanoFramework.ResourceManager "option for nanoFramework.ResourceManager")
option(API_nanoFramework.System.Collections "option for nanoFramework.System.Collections")
option(API_System.Math "option for System.Math")
option(API_System.Net "option for System.Net")
option(API_Windows.Devices.Adc "option for Windows.Devices.Adc API")
Expand Down Expand Up @@ -111,6 +112,12 @@ macro(ParseNativeAssemblies)
PerformSettingsForApiEntry("nanoFramework.ResourceManager")
endif()

# nanoFramework.System.Collections
if(API_nanoFramework.System.Collections)
##### API name here (doted name)
PerformSettingsForApiEntry("nanoFramework.System.Collections")
endif()

# nanoFramework.Runtime.Events
if(API_nanoFramework.Runtime.Events)
##### API name here (doted name)
Expand Down
2 changes: 2 additions & 0 deletions CMake/TI_SimpleLink_target_os.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@

#define NANOCLR_REFLECTION @TARGET_NANOCLR_REFLECTION@

#define NANOCLR_SYSTEM_COLLECTIONS @TARGET_SYSTEM_COLLECTIONS@

#endif /* _TARGET_OS_H_ */
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,22 @@ endif()

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

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

#############################################
# handles inclusion of System.Collections API
#############################################

if(API_nanoFramework.System.Collections)
set(TARGET_SYSTEM_COLLECTIONS TRUE CACHE INTERNAL "enable support for System.Collections API")
message(STATUS "Support for System.Collections API enabled")
else()
set(TARGET_SYSTEM_COLLECTIONS FALSE CACHE INTERNAL "DISABLE support for System.Collections API")
message(STATUS "Support for System.Collections API **IS NOT** enabled")
endif()

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

#################################################################
# manage HAL/PAL required for API namespaces
#################################################################
Expand Down
12 changes: 6 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ jobs:
matrix:
MBN_QUAIL:
BoardName: MBN_QUAIL
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_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=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_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON
GccArm_Version:
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 -DNF_FEATURE_HAS_SDCARD=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.Devices.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=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.Devices.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON
GccArm_Version:
NeedsDFU: true
ST_STM32F429I_DISCOVERY:
BoardName: ST_STM32F429I_DISCOVERY
BuildOptions: -DTARGET_SERIES=STM32F4xx -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 -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_nanoFramework.Devices.Can=ON -DAPI_nanoFramework.ResourceManager=ON
BuildOptions: -DTARGET_SERIES=STM32F4xx -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 -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_nanoFramework.Devices.Can=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON
GccArm_Version:
NeedsDFU: false
ST_NUCLEO64_F091RC:
Expand All @@ -150,7 +150,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 -DNF_FEATURE_HAS_SDCARD=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.Devices.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON
BuildOptions: -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=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.Devices.Dac=ON -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.Devices.Can=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON
GccArm_Version:
NeedsDFU: false

Expand Down Expand Up @@ -191,7 +191,7 @@ jobs:
matrix:
ESP32_WROOM_32:
BoardName: ESP32_WROOM_32
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_WP_IMPLEMENTS_CRC32=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=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 -DAPI_Windows.Devices.Wifi=ON -DAPI_Windows.Storage=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON
BuildOptions: -DTARGET_SERIES=ESP32 -DRTOS=FREERTOS_ESP32 -DNF_WP_IMPLEMENTS_CRC32=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=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 -DAPI_Windows.Devices.Wifi=ON -DAPI_Windows.Storage=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Hardware.Esp32=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON

variables:
ESP32_TOOLCHAIN_PATH: $(Agent.TempDirectory)\ESP32_Tools
Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
matrix:
TI_CC3220SF_LAUNCHXL:
BoardName: TI_CC3220SF_LAUNCHXL
BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -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=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON
BuildOptions: -DTARGET_SERIES=CC32xx -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -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=OFF -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_nanoFramework.System.Collections=ON
GccArm_Version:

variables:
Expand Down
1 change: 1 addition & 0 deletions cmake-variants.TEMPLATE-ESP32.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"API_System.Net": "ON",
"NF_SECURITY_MBEDTLS": "ON",
"API_nanoFramework.ResourceManager" : "ON",
"API_nanoFramework.System.Collections" : "ON",
"API_Windows.Devices.Wifi": "ON",
"API_Windows.Devices.Adc": "ON",
"API_System.Devices.Dac" : "OFF",
Expand Down
1 change: 1 addition & 0 deletions cmake-variants.TEMPLATE.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"API_nanoFramework.Devices.Can" : "OFF-default-ON-to-add-this-API",
"API_nanoFramework.Devices.OneWire" : "OFF-default-ON-to-add-this-API",
"API_nanoFramework.ResourceManager" : "OFF-default-ON-to-add-this-API",
"API_nanoFramework.System.Collections" : "OFF-default-ON-to-add-this-API",
"API_System.Math" : "OFF-default-ON-to-add-this-API",
"API_System.Net" : "OFF-default-ON-to-add-this-API",
"API_Windows.Devices.Adc" : "OFF-default-ON-to-add-this-API",
Expand Down
2 changes: 0 additions & 2 deletions src/CLR/CorLib/CorLib-vs2019.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
<ClCompile Include="corlib_native_System_Attribute.cpp" />
<ClCompile Include="corlib_native_System_BitConverter.cpp" />
<ClCompile Include="corlib_native_System_Collections_ArrayList.cpp" />
<ClCompile Include="corlib_native_System_Collections_Queue.cpp" />
<ClCompile Include="corlib_native_System_Collections_Stack.cpp" />
<ClCompile Include="corlib_native_System_Console.cpp" />
<ClCompile Include="corlib_native_System_Convert.cpp" />
<ClCompile Include="corlib_native_System_DateTime.cpp" />
Expand Down
2 changes: 0 additions & 2 deletions src/CLR/CorLib/CorLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
<ClCompile Include="corlib_native_System_Attribute.cpp" />
<ClCompile Include="corlib_native_System_BitConverter.cpp" />
<ClCompile Include="corlib_native_System_Collections_ArrayList.cpp" />
<ClCompile Include="corlib_native_System_Collections_Queue.cpp" />
<ClCompile Include="corlib_native_System_Collections_Stack.cpp" />
<ClCompile Include="corlib_native_System_Console.cpp" />
<ClCompile Include="corlib_native_System_Convert.cpp" />
<ClCompile Include="corlib_native_System_DateTime.cpp" />
Expand Down
Loading