diff --git a/.devcontainer/Dockerfile.All b/.devcontainer/Dockerfile.All index d359816bcd..24e3eaeca5 100644 --- a/.devcontainer/Dockerfile.All +++ b/.devcontainer/Dockerfile.All @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-all:v2.1 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-all:v2.5 \ No newline at end of file diff --git a/.devcontainer/Dockerfile.AzureRTOS b/.devcontainer/Dockerfile.AzureRTOS index 5be3b4092c..750110795f 100644 --- a/.devcontainer/Dockerfile.AzureRTOS +++ b/.devcontainer/Dockerfile.AzureRTOS @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-azure-rtos:v1.0 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-azure-rtos:v1.1 \ No newline at end of file diff --git a/.devcontainer/Dockerfile.ChibiOS b/.devcontainer/Dockerfile.ChibiOS index 78eef30d31..afd335d621 100644 --- a/.devcontainer/Dockerfile.ChibiOS +++ b/.devcontainer/Dockerfile.ChibiOS @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-chibios:v1.1 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-chibios:v1.3 \ No newline at end of file diff --git a/.devcontainer/Dockerfile.ESP32 b/.devcontainer/Dockerfile.ESP32 index 4a2a9fa61a..9daf1259c5 100644 --- a/.devcontainer/Dockerfile.ESP32 +++ b/.devcontainer/Dockerfile.ESP32 @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-esp32:v2.1 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-esp32:v2.4 \ No newline at end of file diff --git a/.devcontainer/Dockerfile.TI b/.devcontainer/Dockerfile.TI index f43716746e..3f36bdca23 100644 --- a/.devcontainer/Dockerfile.TI +++ b/.devcontainer/Dockerfile.TI @@ -1 +1 @@ -FROM ghcr.io/nanoframework/dev-container-ti:v1.0 \ No newline at end of file +FROM ghcr.io/nanoframework/dev-container-ti:v1.2 \ No newline at end of file diff --git a/.devcontainer/scripts/git-pull-repos.sh b/.devcontainer/scripts/git-pull-repos.sh index b752449480..5a75c2e714 100644 --- a/.devcontainer/scripts/git-pull-repos.sh +++ b/.devcontainer/scripts/git-pull-repos.sh @@ -11,11 +11,11 @@ cd /sources/AzureRTOS git pull cd / rm -rf /sources/ChibiOs -git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.6.x -rHEAD /sources/ChibiOs +git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.11.x -rHEAD /sources/ChibiOs cd /sources/ChibiOs-Contrib git pull origin nanoframework cd /sources/mbedtls -git pull origin mbedtls-2.26.0 +git pull origin mbedtls-2.28.0 cd /sources/fatfs git pull origin R0.14 cd /sources/FreeRTOS diff --git a/.devcontainer/sources/Dockerfile.All b/.devcontainer/sources/Dockerfile.All index b0de93ce06..724d9c5f5e 100644 --- a/.devcontainer/sources/Dockerfile.All +++ b/.devcontainer/sources/Dockerfile.All @@ -58,10 +58,10 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git --depth 1 ./sources/STM32CubeF4 \ && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ && git clone --recursive https://github.com/azure-rtos/threadx.git --depth 1 ./sources/AzureRTOS \ - && git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.6.x -rHEAD ./sources/ChibiOs \ + && git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.11.x -rHEAD ./sources/ChibiOs \ && git clone --branch nanoframework https://github.com/nanoframework/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib # Clone mbedtls and fatfs -RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ +RUN git clone --branch mbedtls-2.28.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && git clone --branch R0.14 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs # Clone FreeRTOS and what is needed for ESP32 RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ @@ -74,14 +74,14 @@ RUN git clone --branch STABLE-2_0_3_RELEASE https://git.savannah.nongnu.org/git/ ENV GIT_SSL_NO_VERIFY=0 # Clone ESP-IDF -RUN git clone --branch v4.3.1 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf +RUN git clone --branch v4.3.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf # Clone what is needed for TI RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \ # you can't use the nanoFramework repository as it's Windows only # && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git --depth 1 ./sources/TI_XDCTools \ - && git clone --branch 5.10.00.48 https://github.com/nanoframework/SimpleLink_CC13x2_26x2_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ - && git clone --branch 1.8.1 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ + && git clone --branch 5.30.01.01 https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ + && git clone --branch 1.10.0 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ && chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh # Copy from our other container @@ -104,7 +104,7 @@ RUN ln -fs /usr/bin/python3 /usr/bin/python \ ENV IDF_PATH=/sources/esp-idf RUN python -m pip install -r $IDF_PATH/requirements.txt RUN $IDF_PATH/install.sh -ENV PATH=$PATH:/$IDF_PATH/components/esptool_py/esptool:/$IDF_PATH/components/espcoredump:/$IDF_PATH/components/partition_table/:/$IDF_PATH/tools/:$IDF_PATH/components/app_update:/root/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r1-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r1-8.4.0/riscv32-esp-elf/bin +ENV PATH=$PATH:/$IDF_PATH/components/esptool_py/esptool:/$IDF_PATH/components/espcoredump:/$IDF_PATH/components/partition_table/:/$IDF_PATH/tools/:$IDF_PATH/components/app_update:/root/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r2-8.4.0/riscv32-esp-elf/bin # Clean up downloaded files RUN apt-get autoremove -y \ diff --git a/.devcontainer/sources/Dockerfile.AzureRTOS b/.devcontainer/sources/Dockerfile.AzureRTOS index 0815f61af4..30532fa8e2 100644 --- a/.devcontainer/sources/Dockerfile.AzureRTOS +++ b/.devcontainer/sources/Dockerfile.AzureRTOS @@ -47,7 +47,7 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ && git clone --recursive https://github.com/azure-rtos/threadx.git --depth 1 ./sources/AzureRTOS # Clone mbedtls and fatfs -RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ +RUN git clone --branch mbedtls-2.28.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && git clone --branch R0.14 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs diff --git a/.devcontainer/sources/Dockerfile.ChibiOS b/.devcontainer/sources/Dockerfile.ChibiOS index 77125e5fde..460265bf0d 100644 --- a/.devcontainer/sources/Dockerfile.ChibiOS +++ b/.devcontainer/sources/Dockerfile.ChibiOS @@ -47,10 +47,10 @@ RUN git clone --branch nf-build https://github.com/nanoframework/STM32CubeL4.git && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF7.git --depth 1 ./sources/STM32CubeF7 \ && git clone --branch nf-build https://github.com/nanoframework/STM32CubeF4.git --depth 1 ./sources/STM32CubeF4 \ && git clone --branch nf-build https://github.com/nanoframework/STM32CubeH7.git --depth 1 ./sources/STM32CubeH7 \ - && git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.6.x -rHEAD ./sources/ChibiOs \ + && git svn clone https://svn.osdn.net/svnroot/chibios/branches/stable_21.11.x -rHEAD ./sources/ChibiOs \ && git clone --branch nanoframework https://github.com/nanoframework/ChibiOS-Contrib.git --depth 1 ./sources/ChibiOs-Contrib # Clone mbedtls and fatfs -RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ +RUN git clone --branch mbedtls-2.28.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && git clone --branch R0.14 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \ && git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs diff --git a/.devcontainer/sources/Dockerfile.ESP32 b/.devcontainer/sources/Dockerfile.ESP32 index 5d1c54f03b..97a899156f 100644 --- a/.devcontainer/sources/Dockerfile.ESP32 +++ b/.devcontainer/sources/Dockerfile.ESP32 @@ -45,7 +45,7 @@ RUN apt-get update \ RUN mkdir -p /usr/local/bin/gcc # Clone mbedtls and fatfs -RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ +RUN git clone --branch mbedtls-2.28.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && git clone --branch R0.14 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs # Clone FreeRTOS and what is needed for ESP32 RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS-Kernel.git --depth 1 ./sources/FreeRTOS \ @@ -53,7 +53,7 @@ RUN git clone --branch V10.4.1-kernel-only https://github.com/FreeRTOS/FreeRTOS- && git clone --branch nf-build https://github.com/nanoframework/spiffs.git --depth 1 ./sources/spiffs # Clone ESP-IDF -RUN git clone --branch v4.3.1 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf +RUN git clone --branch v4.3.2 https://github.com/espressif/esp-idf --depth 1 --recursive ./sources/esp-idf # Copy from our other container COPY --from=downloader /tmp/dc-extracted/gcc /usr/local/bin/gcc @@ -68,7 +68,7 @@ RUN ln -fs /usr/bin/python3 /usr/bin/python \ ENV IDF_PATH=/sources/esp-idf RUN python -m pip install -r $IDF_PATH/requirements.txt RUN $IDF_PATH/install.sh -ENV PATH=$PATH:/$IDF_PATH/components/esptool_py/esptool:/$IDF_PATH/components/espcoredump:/$IDF_PATH/components/partition_table/:/$IDF_PATH/tools/:$IDF_PATH/components/app_update:/root/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r1-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r1-8.4.0/riscv32-esp-elf/bin +ENV PATH=$PATH:/$IDF_PATH/components/esptool_py/esptool:/$IDF_PATH/components/espcoredump:/$IDF_PATH/components/partition_table/:/$IDF_PATH/tools/:$IDF_PATH/components/app_update:/root/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin:/root/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-8.4.0/xtensa-esp32s2-elf/bin:/root/.espressif/tools/riscv32-esp-elf/esp-2021r2-8.4.0/riscv32-esp-elf/bin # Clean up downloaded files RUN apt-get autoremove -y \ diff --git a/.devcontainer/sources/Dockerfile.TI b/.devcontainer/sources/Dockerfile.TI index 5e0876c96c..15ee8d897c 100644 --- a/.devcontainer/sources/Dockerfile.TI +++ b/.devcontainer/sources/Dockerfile.TI @@ -48,14 +48,14 @@ RUN mkdir -p /usr/local/bin/gcc \ && mkdir -p /usr/local/bin/titools # Clone mbedtls and fatfs -RUN git clone --branch mbedtls-2.26.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ +RUN git clone --branch mbedtls-2.28.0 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \ && git clone --branch R0.14 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs # Clone what is needed for TI RUN git clone --branch 4.10.00.07 https://github.com/nanoframework/SimpleLink_CC32xx_SDK.git --depth 1 ./sources/SimpleLinkCC32 \ # you can't use the nanoFramework repository as it's Windows only # && git clone --branch 3.61.00.16 https://github.com/nanoframework/TI_XDCTools.git --depth 1 ./sources/TI_XDCTools \ - && git clone --branch 5.10.00.48 https://github.com/nanoframework/SimpleLink_CC13x2_26x2_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ - && git clone --branch 1.8.1 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ + && git clone --branch 5.30.01.01 https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK.git --depth 1 ./sources/SimpleLinkCC13 \ + && git clone --branch 1.10.0 https://github.com/nanoframework/TI_SysConfig.git --depth 1 ./sources/TI_SysConfig \ && chmod +x ./sources/TI_SysConfig/sysconfig_cli.sh # Copy from our other container diff --git a/.github/workflows/all.yaml b/.github/workflows/all.yaml index 52dba7bf4d..ad35bb1ceb 100644 --- a/.github/workflows/all.yaml +++ b/.github/workflows/all.yaml @@ -2,7 +2,7 @@ name: Build and push image for all RTOS env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-all - GCR_VERSION: v2.1 + GCR_VERSION: v2.5 GCR_FILE: .devcontainer/sources/Dockerfile.All # Controls when the action will run. diff --git a/.github/workflows/azurertos.yaml b/.github/workflows/azurertos.yaml index bf87285ce9..5f7688105d 100644 --- a/.github/workflows/azurertos.yaml +++ b/.github/workflows/azurertos.yaml @@ -2,7 +2,7 @@ name: Build and push image for Azure RTOS env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-azure-rtos - GCR_VERSION: v1.0 + GCR_VERSION: v1.1 GCR_FILE: .devcontainer/sources/Dockerfile.AzureRTOS # Controls when the action will run. diff --git a/.github/workflows/chibios.yaml b/.github/workflows/chibios.yaml index 650fcc3461..2809adaeb1 100644 --- a/.github/workflows/chibios.yaml +++ b/.github/workflows/chibios.yaml @@ -2,7 +2,7 @@ name: Build and push ChibiOS image env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-chibios - GCR_VERSION: v1.1 + GCR_VERSION: v1.3 GCR_FILE: .devcontainer/sources/Dockerfile.ChibiOS # Controls when the action will run. diff --git a/.github/workflows/esp32.yml b/.github/workflows/esp32.yml index 40e36316c9..d4b7f2dec6 100644 --- a/.github/workflows/esp32.yml +++ b/.github/workflows/esp32.yml @@ -2,7 +2,7 @@ name: Build and push ESP32 image env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-esp32 - GCR_VERSION: v2.1 + GCR_VERSION: v2.4 GCR_FILE: .devcontainer/sources/Dockerfile.ESP32 # Controls when the action will run. diff --git a/.github/workflows/ti.yaml b/.github/workflows/ti.yaml index 860cf61485..55012d71ba 100644 --- a/.github/workflows/ti.yaml +++ b/.github/workflows/ti.yaml @@ -2,7 +2,7 @@ name: Build and push image for TI env: GCR_IMAGE: ghcr.io/nanoframework/dev-container-ti - GCR_VERSION: v1.0 + GCR_VERSION: v1.2 GCR_FILE: .devcontainer/sources/Dockerfile.TI # Controls when the action will run. diff --git a/.gitignore b/.gitignore index 8aff0db967..16aaecc9a2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # ignore build folder /build/ +/out/ /build/.gitkeep # ignore cmake-variants file (will change per user/board setup, developers should derive content from cmake-variants.TEMPLATE.json) @@ -21,7 +22,6 @@ InteropAssemblies/* .vscode/.cmaketools.json .vscode/settings.json .vscode/tasks.json -.vscode/extensions.json .vscode/c_cpp_properties.json .vscode/cmake-kits.json .vscode/ipch diff --git a/.vscode/cmake-variants-DEVCONTAINER.json b/.vscode/cmake-variants-DEVCONTAINER.json index fd40552385..039434f91d 100644 --- a/.vscode/cmake-variants-DEVCONTAINER.json +++ b/.vscode/cmake-variants-DEVCONTAINER.json @@ -98,49 +98,6 @@ "API_nanoFramework.System.Text": "ON" } }, - "NETDUINO3_WIFI": { - "short": "NETDUINO3_WIFI", - "settings": { - "BUILD_VERSION": "0.9.99.999", - "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.arm-none-eabi.cmake", - "TOOLCHAIN_PREFIX": "/usr/local/bin/gcc", - "TOOL_HEX2DFU_PREFIX": "/usr/local/bin/hex2dfu", - "RTOS": "ChibiOS", - "TARGET_SERIES": "STM32F4xx", - "RTOS_SOURCE_FOLDER": "/sources/ChibiOs", - "TARGET_BOARD": "NETDUINO3_WIFI", - "CHIBIOS_CONTRIB_REQUIRED": "OFF", - "CHIBIOS_CONTRIB_SOURCE": "/sources/ChibiOs-Contrib", - "STM32_CUBE_PACKAGE_REQUIRED": "OFF", - "STM32_CUBE_PACKAGE_SOURCE": "/sources/STM32CubeL4", - "MBEDTLS_SOURCE": "/sources/mbedtls", - "FATFS_SOURCE": "/sources/fatfs", - "SUPPORT_ANY_BASE_CONVERSION": "ON", - "NF_FEATURE_DEBUGGER": "ON", - "NF_FEATURE_RTC": "ON", - "NF_FEATURE_HAS_SDCARD": "ON", - "SWO_OUTPUT": "OFF", - "NF_BUILD_RTM": "OFF", - "API_System.Math": "ON", - "API_Hardware.Stm32": "ON", - "API_Windows.Devices.Gpio": "ON", - "API_System.Device.Gpio": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", - "API_Windows.Devices.I2c": "ON", - "API_System.Device.I2c": "ON", - "API_Windows.Devices.Pwm": "ON", - "API_System.Device.Pwm": "ON", - "API_Windows.Devices.SerialCommunication": "ON", - "API_System.IO.Ports": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_nanoFramework.Devices.OneWire": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON" - } - }, "ORGPAL_PALTHREE": { "short": "ORGPAL_PALTHREE", "settings": { @@ -282,7 +239,7 @@ "API_System.Device.Adc": "OFF", "API_System.Device.Adc": "OFF", "API_Windows.Devices.Pwm": "OFF", - "API_Windows.Devices.Wifi": "OFF", + "API_System.Device.WiFi": "OFF", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", "API_nanoFramework.ResourceManager": "ON", @@ -291,16 +248,16 @@ "API_System.Math": "ON" } }, - "ESP32_REV0": { - "short": "ESP32_REV0", + "ESP32_BLE_REV3": { + "short": "ESP32_BLE_REV3", "settings": { "BUILD_VERBOSE": "OFF", "BUILD_VERSION": "0.9.99.999", "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", - "TARGET_NAME": "ESP32_REV0", - "SDK_CONFIG_FILE": "", + "TARGET_NAME": "ESP32_BLE_REV3", + "SDK_CONFIG_FILE": "sdkconfig.default_ble_rev3.esp32", "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", @@ -310,43 +267,44 @@ "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "ON", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.Devices.OneWire": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", - "API_nanoFramework.Devices.OneWire": "ON", - "API_nanoFramework.Graphics": "OFF" + "API_System.Device.Dac": "ON", + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "ON" } }, - "ESP32_REV0_BLE": { - "short": "ESP32_REV0_BLE", + "ESP32_REV0": { + "short": "ESP32_REV0", "settings": { "BUILD_VERBOSE": "OFF", "BUILD_VERSION": "0.9.99.999", "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", - "TARGET_NAME": "ESP32_REV0_BLE", - "SDK_CONFIG_FILE": "sdkconfig.default_ble.esp32", + "TARGET_NAME": "ESP32_REV0", + "SDK_CONFIG_FILE": "sdkconfig.default_nopsram.esp32", "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", @@ -356,32 +314,80 @@ "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "ON", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", + "API_Windows.Devices.Gpio": "ON", + "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", + "API_Windows.Devices.I2c": "ON", + "API_System.Device.I2c": "ON", + "API_Windows.Devices.Pwm": "ON", + "API_System.Device.Pwm": "ON", + "API_Windows.Devices.SerialCommunication": "ON", + "API_System.IO.Ports": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", + "API_Hardware.Esp32": "ON", + "API_nanoFramework.Devices.OneWire": "ON", "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", + "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_System.Device.Dac": "ON", + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "OFF" + } + }, + "ESP32_BLE_REV0": { + "short": "ESP32_BLE_REV0", + "settings": { + "BUILD_VERBOSE": "OFF", + "BUILD_VERSION": "0.9.99.999", + "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", + "TARGET_SERIES": "ESP32", + "TARGET_BOARD": "ESP32", + "TARGET_NAME": "ESP32_BLE_REV0", + "SDK_CONFIG_FILE": "sdkconfig.default_nopsram_ble.esp32", + "ESP32_IDF_PATH": "/sources/esp-idf", + "RTOS": "ESP32", + "NF_BUILD_RTM": "OFF", + "NF_FEATURE_DEBUGGER": "ON", + "NF_FEATURE_RTC": "ON", + "NF_FEATURE_SUPPORT_REFLECTION": "ON", + "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", + "NF_FEATURE_HAS_SDCARD": "ON", + "SUPPORT_ANY_BASE_CONVERSION": "ON", + "API_System.Net": "ON", + "NF_SECURITY_MBEDTLS": "ON", + "MBEDTLS_SOURCE": "/sources/mbedtls", + "API_System.Math": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", - "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", + "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_System.Device.Dac": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "ON" + "API_nanoFramework.Device.Bluetooth": "ON" } }, "ESP32_PICO": { @@ -404,32 +410,32 @@ "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "OFF", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_System.Device.Adc": "ON", + "API_System.Device.Dac": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_Windows.Devices.Adc": "ON", "API_nanoFramework.Devices.OneWire": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "ON" + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "ESP_WROVER_KIT": { @@ -450,31 +456,34 @@ "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "ON", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", "API_Windows.Storage": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.Devices.OneWire": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", "API_nanoFramework.Graphics": "ON", + "API_Windows.Devices.Adc": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", "TOUCHPANEL_DEVICE": "XPT2046.cpp", "GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", @@ -495,37 +504,38 @@ "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_TARGET_HAS_NANOBOOTER": "OFF", + "ESP32_USB_CDC": "ON", "NF_FEATURE_DEBUGGER": "ON", "NF_FEATURE_RTC": "ON", "NF_FEATURE_SUPPORT_REFLECTION": "ON", "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "OFF", - "API_System.Net": "ON", - "ESP32_USB_CDC": "ON", "NF_SECURITY_MBEDTLS": "ON", - "MBEDTLS_SOURCE": "", + "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_System.Device.Dac": "ON", "API_nanoFramework.Devices.OneWire": "OFF", - "API_nanoFramework.Graphics": "OFF" + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "KALUGA_1": { @@ -546,48 +556,47 @@ "NF_FEATURE_RTC": "ON", "NF_FEATURE_SUPPORT_REFLECTION": "ON", "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", - "API_System.Net": "ON", "ESP32_USB_CDC": "OFF", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_System.Device.Dac": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", "API_nanoFramework.Devices.OneWire": "OFF", "API_nanoFramework.Graphics": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", - "TOUCHPANEL_DEVICE": "", "GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", - "TOUCHPANEL_INTERFACE": "Spi_To_TouchPanel.cpp" } }, - "M5Stack": { - "short": "M5Stack", + "M5Core": { + "short": "M5Core", "settings": { "BUILD_VERSION": "0.9.99.999", "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", - "TARGET_NAME": "M5Stack", + "TARGET_NAME": "M5Core", "SDK_CONFIG_FILE": "sdkconfig.default_nopsram.esp32", - "ESP32_IDF_PATH": "E:/GitHub/esp-idf", + "ESP32_IDF_PATH": "/sources/esp-idf", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", "NF_FEATURE_DEBUGGER": "ON", @@ -596,30 +605,30 @@ "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", "NF_FEATURE_HAS_SDCARD": "ON", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", - "API_Windows.Storage": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", + "API_System.Device.Dac": "ON", "API_nanoFramework.Graphics": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", "TOUCHPANEL_DEVICE": "XPT2046.cpp", @@ -648,32 +657,33 @@ "ESP32_ETHERNET_SUPPORT": "ON", "ETH_RMII_CLK_OUT_GPIO": "17", "SUPPORT_ANY_BASE_CONVERSION": "ON", - "API_System.Net": "ON", "NF_SECURITY_MBEDTLS": "ON", "MBEDTLS_SOURCE": "/sources/mbedtls", "API_System.Math": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_System.Device.Dac": "ON", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", "API_Windows.Devices.I2c": "ON", "API_System.Device.I2c": "ON", "API_Windows.Devices.Pwm": "ON", "API_System.Device.Pwm": "ON", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Net": "ON", + "API_System.Device.WiFi": "ON", "API_Hardware.Esp32": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", + "API_System.Device.Dac": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "OFF" + "API_nanoFramework.Device.Bluetooth": "OFF" + } }, "TI_CC1352R1_LAUNCHXL": { @@ -683,10 +693,10 @@ "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.arm-none-eabi.cmake", "TOOLCHAIN_PREFIX": "/usr/local/bin/gcc", "RTOS": "TI_SimpleLink", - "TARGET_SERIES": "CC13x2_26x2", + "TARGET_SERIES": "CC13xx_26xx", "TARGET_BOARD": "TI_CC1352R1_LAUNCHXL", "RADIO_FREQUENCY": "868", - "TI_SL_CC13x2_26x2_SDK_SOURCE": "/sources/SimpleLinkCC13", + "TI_SL_CC13xx_26xx_SDK_SOURCE": "/sources/SimpleLinkCC13", "TI_XDCTOOLS_SOURCE": "/usr/local/bin/titools", "TI_SYSCONFIG_SOURCE": "/sources/TI_SysConfig", "SUPPORT_ANY_BASE_CONVERSION": "OFF", @@ -716,4 +726,4 @@ } } } -} \ No newline at end of file +} diff --git a/.vscode/cmake-variants.TEMPLATE.json b/.vscode/cmake-variants.TEMPLATE.json index a936360789..967bda53da 100644 --- a/.vscode/cmake-variants.TEMPLATE.json +++ b/.vscode/cmake-variants.TEMPLATE.json @@ -49,7 +49,7 @@ "STM32_CUBE_PACKAGE_REQUIRED": "", "STM32_CUBE_PACKAGE_SOURCE": "", "TI_SL_CC32xx_SDK_SOURCE": "", - "TI_SL_CC13x2_26x2_SDK_SOURCE": "", + "TI_SL_CC13xx_26xx_SDK_SOURCE": "", "TI_XDCTOOLS_SOURCE": "", "TI_SYSCONFIG_SOURCE": "", "RADIO_FREQUENCY": "", @@ -113,7 +113,9 @@ "API_Hardware.Esp32": "OFF-default-ON-to-add-this-API", "API_Hardware.Stm32": "OFF-default-ON-to-add-this-API", "API_nanoFramework.TI.EasyLink": "OFF-default-ON-to-add-this-API", - "API_nanoFramework.Hardware.Esp32.Rmt": "OFF-default-ON-to-add-this-API" + "API_nanoFramework.Hardware.Esp32.Rmt": "OFF-default-ON-to-add-this-API", + "API_nanoFramework.Device.Bluetooth": "OFF-default-ON-to-add-this-API", + "API_System.Device.WiFi": "OFF-default-ON-to-add-this-API" } } } diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..915cf03bda --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["ms-vscode.cpptools", "ms-vscode.cmake-tools", "nanoframework.vscode-nanoframework"] +} diff --git a/CMake/Modules/FindChibiOS_F0_HAL.cmake b/CMake/Modules/FindChibiOS_F0_HAL.cmake index d359538a1f..42a68af265 100644 --- a/CMake/Modules/FindChibiOS_F0_HAL.cmake +++ b/CMake/Modules/FindChibiOS_F0_HAL.cmake @@ -107,12 +107,14 @@ set(CHIBIOS_HAL_SRCS hal_buffers.c hal_queues.c + hal_flash.c hal_mmcsd.c hal_adc.c hal_can.c hal_crypto.c hal_dac.c + hal_efl.c hal_gpt.c hal_i2c.c hal_i2s.c @@ -144,7 +146,7 @@ set(CHIBIOS_HAL_SRCS hal_pal_lld.c hal_i2c_lld.c hal_rtc_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c hal_icu_lld.c diff --git a/CMake/Modules/FindChibiOS_F4_HAL.cmake b/CMake/Modules/FindChibiOS_F4_HAL.cmake index d85449ca5b..a35163aafc 100644 --- a/CMake/Modules/FindChibiOS_F4_HAL.cmake +++ b/CMake/Modules/FindChibiOS_F4_HAL.cmake @@ -126,12 +126,14 @@ set(CHIBIOS_HAL_SRCS hal_buffers.c hal_queues.c + hal_flash.c hal_mmcsd.c hal_adc.c hal_can.c hal_crypto.c hal_dac.c + hal_efl.c hal_gpt.c hal_i2c.c hal_i2s.c @@ -171,7 +173,7 @@ set(CHIBIOS_HAL_SRCS hal_sdc_lld.c hal_i2s_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c diff --git a/CMake/Modules/FindChibiOS_F7_HAL.cmake b/CMake/Modules/FindChibiOS_F7_HAL.cmake index 330cd0d358..13c8ea2de9 100644 --- a/CMake/Modules/FindChibiOS_F7_HAL.cmake +++ b/CMake/Modules/FindChibiOS_F7_HAL.cmake @@ -126,12 +126,14 @@ set(CHIBIOS_HAL_SRCS hal_buffers.c hal_queues.c + hal_flash.c hal_mmcsd.c hal_adc.c hal_can.c hal_crypto.c hal_dac.c + hal_efl.c hal_gpt.c hal_i2c.c hal_i2s.c @@ -171,7 +173,7 @@ set(CHIBIOS_HAL_SRCS hal_sdc_lld.c hal_i2s_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c diff --git a/CMake/Modules/FindChibiOS_H7_HAL.cmake b/CMake/Modules/FindChibiOS_H7_HAL.cmake index 250e5b8d34..b6b81771bb 100644 --- a/CMake/Modules/FindChibiOS_H7_HAL.cmake +++ b/CMake/Modules/FindChibiOS_H7_HAL.cmake @@ -123,12 +123,14 @@ set(CHIBIOS_HAL_SRCS hal_buffers.c hal_queues.c + hal_flash.c hal_mmcsd.c hal_adc.c hal_can.c hal_crypto.c hal_dac.c + hal_efl.c hal_gpt.c hal_i2c.c hal_i2s.c @@ -168,7 +170,7 @@ set(CHIBIOS_HAL_SRCS hal_sdc_lld.c #hal_i2s_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c diff --git a/CMake/Modules/FindChibiOS_L0_HAL.cmake b/CMake/Modules/FindChibiOS_L0_HAL.cmake index 4afdaa9117..c082d186b5 100644 --- a/CMake/Modules/FindChibiOS_L0_HAL.cmake +++ b/CMake/Modules/FindChibiOS_L0_HAL.cmake @@ -111,12 +111,14 @@ set(CHIBIOS_HAL_SRCS hal_buffers.c hal_queues.c + hal_flash.c hal_mmcsd.c hal_adc.c hal_can.c hal_crypto.c hal_dac.c + hal_efl.c hal_gpt.c hal_i2c.c hal_i2s.c @@ -151,7 +153,7 @@ set(CHIBIOS_HAL_SRCS hal_rtc_lld.c hal_i2s_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c diff --git a/CMake/Modules/FindChibiOS_L4_HAL.cmake b/CMake/Modules/FindChibiOS_L4_HAL.cmake index e31acb3863..d66f478059 100644 --- a/CMake/Modules/FindChibiOS_L4_HAL.cmake +++ b/CMake/Modules/FindChibiOS_L4_HAL.cmake @@ -159,7 +159,7 @@ set(CHIBIOS_HAL_SRCS hal_sdc_lld.c hal_i2s_lld.c - hal_spi_lld.c + hal_spi_v2_lld.c hal_st_lld.c hal_gpt_lld.c diff --git a/CMake/Modules/FindNF_CoreCLR.cmake b/CMake/Modules/FindNF_CoreCLR.cmake index 0d4a425a7d..d28b3d3e16 100644 --- a/CMake/Modules/FindNF_CoreCLR.cmake +++ b/CMake/Modules/FindNF_CoreCLR.cmake @@ -130,6 +130,7 @@ set(NF_CoreCLR_SRCS nf_rt_native_nanoFramework_Runtime_Native_ExecutionConstraint.cpp nf_rt_native_nanoFramework_Runtime_Native_Power.cpp nf_rt_native_nanoFramework_Runtime_Native_Rtc_stubs.cpp + nf_rt_native_System_Environment.cpp # Core stubs RPC_stub.cpp diff --git a/CMake/Modules/FindNF_NativeAssemblies.cmake b/CMake/Modules/FindNF_NativeAssemblies.cmake index bfccc3c553..97335282d1 100644 --- a/CMake/Modules/FindNF_NativeAssemblies.cmake +++ b/CMake/Modules/FindNF_NativeAssemblies.cmake @@ -34,12 +34,11 @@ option(API_Windows.Devices.Spi "option for Windows.Devices.Spi option(API_System.Device.Spi "option for System.Device.Spi API") option(API_Windows.Storage "option for Windows.Storage") option(API_nanoFramework.Graphics "option for nanoFramework.Graphics") - +option(API_nanoFramework.Device.Bluetooth "option for nanoFramework.Device.Bluetooth") # Esp32 only option(API_Hardware.Esp32 "option for Hardware.Esp32") option(API_nanoFramework.Hardware.Esp32.Rmt "option for nanoFramework.Hardware.Esp32.Rmt") -option(API_nanoFramework.Hardware.Esp32.Ble "option for nanoFramework.Hardware.Esp32.Ble") # Stm32 only @@ -178,10 +177,10 @@ if(API_nanoFramework.Hardware.Esp32.Rmt) PerformSettingsForApiEntry("nanoFramework.Hardware.Esp32.Rmt") endif() -# nanoFramework.Hardware.Esp32.Ble -if(API_nanoFramework.Hardware.Esp32.Ble) +# nanoFramework.Device.Bluetooth +if(API_nanoFramework.Device.Bluetooth) ##### API name here (doted name) - PerformSettingsForApiEntry("nanoFramework.Hardware.Esp32.Ble") + PerformSettingsForApiEntry("nanoFramework.Device.Bluetooth") endif() # Hardware.Stm32 @@ -354,10 +353,10 @@ if(API_System.Device.Spi) PerformSettingsForApiEntry("System.Device.Spi") endif() -# Windows.Devices.Wifi -if(API_Windows.Devices.Wifi) +# System.Device.WiFi +if(API_System.Device.WiFi) ##### API name here (doted name) - PerformSettingsForApiEntry("Windows.Devices.Wifi") + PerformSettingsForApiEntry("System.Device.WiFi") endif() # Windows.Storage diff --git a/CMake/Modules/FindSystem.Device.WiFi.cmake b/CMake/Modules/FindSystem.Device.WiFi.cmake new file mode 100644 index 0000000000..75d069b83d --- /dev/null +++ b/CMake/Modules/FindSystem.Device.WiFi.cmake @@ -0,0 +1,45 @@ +# +# Copyright (c) .NET Foundation and 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}/System.Device.WiFi) + + +# set include directories +list(APPEND System.Device.WiFi_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) +list(APPEND System.Device.WiFi_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/System.Device.WiFi) + + +# source files +set(System.Device.WiFi_SRCS + + sys_dev_wifi_native.cpp + sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter.cpp +) + +foreach(SRC_FILE ${System.Device.WiFi_SRCS}) + + set(System.Device.WiFi_SRC_FILE SRC_FILE-NOTFOUND) + + find_file(System.Device.WiFi_SRC_FILE ${SRC_FILE} + PATHS + ${BASE_PATH_FOR_THIS_MODULE} + ${CMAKE_SOURCE_DIR}/src/System.Device.WiFi + + CMAKE_FIND_ROOT_PATH_BOTH + ) + + if (BUILD_VERBOSE) + message("${SRC_FILE} >> ${System.Device.WiFi_SRC_FILE}") + endif() + + list(APPEND System.Device.WiFi_SOURCES ${System.Device.WiFi_SRC_FILE}) + +endforeach() + + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(System.Device.WiFi DEFAULT_MSG System.Device.WiFi_INCLUDE_DIRS System.Device.WiFi_SOURCES) diff --git a/CMake/Modules/FindSystem.IO.FileSystem.cmake b/CMake/Modules/FindSystem.IO.FileSystem.cmake index 8fe9f8d639..0fcd492c2c 100644 --- a/CMake/Modules/FindSystem.IO.FileSystem.cmake +++ b/CMake/Modules/FindSystem.IO.FileSystem.cmake @@ -6,9 +6,15 @@ # native code directory set(BASE_PATH_FOR_THIS_MODULE ${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/System.IO.FileSystem) +if(RTOS_FREERTOS_CHECK) + set(PROJECT_COMMON_PATH ${PROJECT_SOURCE_DIR}/targets/FreeRTOS/NXP/_common) +else() + set(PROJECT_COMMON_PATH ${PROJECT_SOURCE_DIR}/targets/${RTOS}/_common) +endif() # set include directories list(APPEND System.IO.FileSystem_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) +list(APPEND System.IO.FileSystem_INCLUDE_DIRS ${TARGET_BASE_LOCATION}/Include) list(APPEND System.IO.FileSystem_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/System.IO.FileSystem) # source files @@ -21,6 +27,7 @@ set(System.IO.FileSystem_SRCS nf_sys_io_filesystem_System_IO_File.cpp nf_sys_io_filesystem_System_IO_FileStream.cpp + Target_Windows_Storage.c ) foreach(SRC_FILE ${System.IO.FileSystem_SRCS}) @@ -31,6 +38,7 @@ foreach(SRC_FILE ${System.IO.FileSystem_SRCS}) PATHS ${BASE_PATH_FOR_THIS_MODULE} ${TARGET_BASE_LOCATION} + ${PROJECT_COMMON_PATH} ${PROJECT_SOURCE_DIR}/src/System.IO.FileSystem CMAKE_FIND_ROOT_PATH_BOTH diff --git a/CMake/Modules/FindTI_SimpleLink.cmake b/CMake/Modules/FindTI_SimpleLink.cmake index 68c29a5742..f12794ef68 100644 --- a/CMake/Modules/FindTI_SimpleLink.cmake +++ b/CMake/Modules/FindTI_SimpleLink.cmake @@ -4,7 +4,7 @@ # include(FetchContent) -FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) +FetchContent_GetProperties(simplelinkcc13xx_26xxsdk) ################################################################################################################################### # WHEN ADDING A NEW series add the respective name to the list below along with the CMake files with GCC options and source files @@ -12,7 +12,7 @@ FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) # check if the series name is supported -set(TI_SIMPLELINK_SUPPORTED_SERIES "CC13x2_26x2" "CC32xx" CACHE INTERNAL "supported TI series names") +set(TI_SIMPLELINK_SUPPORTED_SERIES "CC13X2" "CC32xx" CACHE INTERNAL "supported TI series names") list(FIND TI_SIMPLELINK_SUPPORTED_SERIES ${TARGET_SERIES} TARGET_SERIES_NAME_INDEX) if(TI_SIMPLELINK_SUPPORTED_SERIES EQUAL -1) @@ -31,5 +31,5 @@ include(TI_SimpleLink_${TARGET_SERIES}_sources) include(TI_SimpleLink_${TARGET_SERIES}_GCC_options) # includes for TI_RTOS -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/ti/sysbios) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/ti/sysbios) diff --git a/CMake/Modules/FindWindows.Devices.Wifi.cmake b/CMake/Modules/FindWindows.Devices.Wifi.cmake deleted file mode 100644 index 13761f4d1d..0000000000 --- a/CMake/Modules/FindWindows.Devices.Wifi.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (c) .NET Foundation and 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.Devices.Wifi") - - -# set include directories -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/CLR/Core) -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/CLR/Include) -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/HAL/Include) -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/PAL/Include) -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) -list(APPEND Windows.Devices.Wifi_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/Windows.Devices.Wifi) - - -# source files -set(Windows.Devices.Wifi_SRCS - - win_dev_wifi_native.cpp - win_dev_wifi_native_Windows_Devices_WIFI_WifiAdapter.cpp -) - -foreach(SRC_FILE ${Windows.Devices.Wifi_SRCS}) - - set(Windows.Devices.Wifi_SRC_FILE SRC_FILE-NOTFOUND) - - find_file(Windows.Devices.Wifi_SRC_FILE ${SRC_FILE} - PATHS - ${BASE_PATH_FOR_THIS_MODULE} - ${CMAKE_SOURCE_DIR}/src/Windows.Devices.Wifi - - CMAKE_FIND_ROOT_PATH_BOTH - ) - - if (BUILD_VERBOSE) - message("${SRC_FILE} >> ${Windows.Devices.Wifi_SRC_FILE}") - endif() - - list(APPEND Windows.Devices.Wifi_SOURCES ${Windows.Devices.Wifi_SRC_FILE}) - -endforeach() - - -include(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Windows.Devices.Wifi DEFAULT_MSG Windows.Devices.Wifi_INCLUDE_DIRS Windows.Devices.Wifi_SOURCES) diff --git a/CMake/Modules/FindWindows.Storage.cmake b/CMake/Modules/FindWindows.Storage.cmake index dd9608a001..963e57c610 100644 --- a/CMake/Modules/FindWindows.Storage.cmake +++ b/CMake/Modules/FindWindows.Storage.cmake @@ -14,14 +14,11 @@ set(BASE_PATH_FOR_THIS_MODULE "${BASE_PATH_FOR_CLASS_LIBRARIES_MODULES}/Windows. if(RTOS_CHIBIOS_CHECK) #list(APPEND Windows.Storage_INCLUDE_DIRS ${chibios_SOURCE_DIR}/ext/fatfs/src) list(APPEND Windows.Storage_INCLUDE_DIRS ${fatfs_SOURCE_DIR}/source) - set( PROJECT_COMMON_PATH ${CMAKE_SOURCE_DIR}/targets/ChibiOS/_common) elseif(RTOS_ESP32_CHECK) # TODO: this needs to be changed so it's not platform & target dependent - set( PROJECT_COMMON_PATH ${CMAKE_SOURCE_DIR}/targets/ESP32/_common) elseif(RTOS_FREERTOS_CHECK) list(APPEND Windows.Storage_INCLUDE_DIRS ${fatfs_SOURCE_DIR}/source) # TODO: this needs to be changed so it's not platform & target dependent - set( PROJECT_COMMON_PATH ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/NXP/_common) endif() list(APPEND Windows.Storage_INCLUDE_DIRS ${TARGET_BASE_LOCATION}/Include) @@ -36,8 +33,6 @@ set(Windows.Storage_SRCS win_storage_native_Windows_Storage_StorageFolder.cpp win_storage_native_Windows_Storage_Devices_SDCard.cpp win_storage_native.cpp - - Target_Windows_Storage.c ) foreach(SRC_FILE ${Windows.Storage_SRCS}) @@ -49,7 +44,6 @@ foreach(SRC_FILE ${Windows.Storage_SRCS}) ${BASE_PATH_FOR_THIS_MODULE} ${TARGET_BASE_LOCATION} - ${PROJECT_COMMON_PATH} ${CMAKE_SOURCE_DIR}/src/Windows.Storage CMAKE_FIND_ROOT_PATH_BOTH diff --git a/CMake/Modules/FindmbedTLS.cmake b/CMake/Modules/FindmbedTLS.cmake index fa77c1ccc7..3e6ec1e5b9 100644 --- a/CMake/Modules/FindmbedTLS.cmake +++ b/CMake/Modules/FindmbedTLS.cmake @@ -47,6 +47,7 @@ set(src_crypto cipher.c cipher_wrap.c cmac.c + constant_time.c ctr_drbg.c des.c dhm.c diff --git a/CMake/Modules/FindnanoFramework.Device.Bluetooth.cmake b/CMake/Modules/FindnanoFramework.Device.Bluetooth.cmake new file mode 100644 index 0000000000..a856c2ea78 --- /dev/null +++ b/CMake/Modules/FindnanoFramework.Device.Bluetooth.cmake @@ -0,0 +1,59 @@ +# +# Copyright (c) .NET Foundation and 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}/nanoFramework.Device.Bluetooth) + +# set include directories +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Core) +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/CLR/Include) +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/HAL/Include) +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/PAL/Include) +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS ${BASE_PATH_FOR_THIS_MODULE}) + +# set include directories for Esp32 IDF +set(NIMBLE_COMPONENT_PATH "${ESP32_IDF_PATH}/components/bt/host/nimble") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/port/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/nimble/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/esp-hci/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/porting/nimble/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/porting/npl/freertos/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/nimble/host/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/nimble/host/util/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/nimble/host/services/gap/include") +list(APPEND nanoFramework.Device.Bluetooth_INCLUDE_DIRS "${NIMBLE_COMPONENT_PATH}/nimble/nimble/host/services/gatt/include") + +# source files +set(nanoFramework.Device.Bluetooth_SRCS + + sys_ble_nimble_chars.c + + sys_dev_ble_native.cpp + + sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider.cpp + sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest.cpp + sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest.cpp + sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic.cpp + + esp32_nimble.cpp +) + +foreach(SRC_FILE ${nanoFramework.Device.Bluetooth_SRCS}) + set(nanoFramework.Device.Bluetooth_SRC_FILE SRC_FILE-NOTFOUND) + find_file(nanoFramework.Device.Bluetooth_SRC_FILE ${SRC_FILE} + PATHS + ${BASE_PATH_FOR_THIS_MODULE} + ${TARGET_BASE_LOCATION} + ${PROJECT_SOURCE_DIR}/src/nanoFramework.Device.Bluetooth + + CMAKE_FIND_ROOT_PATH_BOTH + ) + # message("${SRC_FILE} >> ${nanoFramework.Device.Bluetooth_SRC_FILE}") # debug helper + list(APPEND nanoFramework.Device.Bluetooth_SOURCES ${nanoFramework.Device.Bluetooth_SRC_FILE}) +endforeach() + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(nanoFramework.Device.Bluetooth DEFAULT_MSG nanoFramework.Device.Bluetooth_INCLUDE_DIRS nanoFramework.Device.Bluetooth_SOURCES) diff --git a/CMake/Modules/STM32_CubePackage.cmake b/CMake/Modules/STM32_CubePackage.cmake index 9f978b6249..871a29e016 100644 --- a/CMake/Modules/STM32_CubePackage.cmake +++ b/CMake/Modules/STM32_CubePackage.cmake @@ -37,23 +37,21 @@ macro(ProcessSTM32CubePackage) else() # STM32 Cube package source was specified - # sanity check is source path exists - if(EXISTS "${STM32_CUBE_PACKAGE_SOURCE}/") - message(STATUS "STM32 Cube package source from: ${STM32_CUBE_PACKAGE_SOURCE}") - - FetchContent_Declare( - stm32${TARGET_SERIES_SHORT}_cubepackage - GIT_REPOSITORY ${STM32_CUBE_PACKAGE_SOURCE} - GIT_TAG nf-build - ) + message(STATUS "STM32 Cube package (source from: ${STM32_CUBE_PACKAGE_SOURCE})") + + FetchContent_Declare( + stm32${TARGET_SERIES_SHORT}_cubepackage + SOURCE_DIR ${STM32_CUBE_PACKAGE_SOURCE} + ) - else() - message(FATAL_ERROR "Couldn't find STM32 Cube package source at ${STM32_CUBE_PACKAGE_SOURCE}/") - endif() endif() + # Check if population has already been performed FetchContent_GetProperties(stm32${TARGET_SERIES_SHORT}_cubepackage) - FetchContent_Populate(stm32${TARGET_SERIES_SHORT}_cubepackage) + if(NOT stm32${TARGET_SERIES_SHORT}_cubepackage_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(stm32${TARGET_SERIES_SHORT}_cubepackage) + endif() endmacro() diff --git a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_GCC_options.cmake b/CMake/Modules/TI_SimpleLink_CC13X2_GCC_options.cmake similarity index 94% rename from CMake/Modules/TI_SimpleLink_CC13x2_26x2_GCC_options.cmake rename to CMake/Modules/TI_SimpleLink_CC13X2_GCC_options.cmake index ea35827b2c..64369fcca9 100644 --- a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_GCC_options.cmake +++ b/CMake/Modules/TI_SimpleLink_CC13X2_GCC_options.cmake @@ -4,7 +4,7 @@ # include(FetchContent) -FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) +FetchContent_GetProperties(simplelinkcc13xx_26xxsdk) ################################################################# # WHEN ADDING A NEW SERIES add the appropriate GCC options below @@ -14,7 +14,7 @@ FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) set(CMAKE_ASM_FLAGS " -mthumb -mcpu=cortex-m4 -x assembler-with-cpp" CACHE INTERNAL "asm compiler flags") # need to specify linker flags here -set(CMAKE_EXE_LINKER_FLAGS " -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -g -gdwarf-3 -gstrict-dwarf -Wall -mcpu=cortex-m4 -nostartfiles -static -Wl,--gc-sections -L${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source -L${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages -L${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wall " CACHE INTERNAL "executable linker flags") +set(CMAKE_EXE_LINKER_FLAGS " -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -g -gdwarf-3 -gstrict-dwarf -Wall -mcpu=cortex-m4 -nostartfiles -static -Wl,--gc-sections -L${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source -L${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages -L${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wall " CACHE INTERNAL "executable linker flags") # TARGET parameter to set the target that's setting them for diff --git a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake b/CMake/Modules/TI_SimpleLink_CC13X2_sources.cmake similarity index 51% rename from CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake rename to CMake/Modules/TI_SimpleLink_CC13X2_sources.cmake index 891a8cb83a..3180d65691 100644 --- a/CMake/Modules/TI_SimpleLink_CC13x2_26x2_sources.cmake +++ b/CMake/Modules/TI_SimpleLink_CC13X2_sources.cmake @@ -4,23 +4,23 @@ # include(FetchContent) -FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) +FetchContent_GetProperties(simplelinkcc13xx_26xxsdk) # grab the board name from the target name # need to strip out the leading 'TI_' like in 'TI_CC1312R1_LAUNCHXL' string(REPLACE "TI_" "" TARGET_NAME_SHORT "${TARGET_NAME}") -# includes for SimpleLink CC13x2_26x2 SDK -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/devices) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/drivers) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/boards/${TARGET_NAME_SHORT}) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2/driverlib) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/net) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/bsd) -list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages) +# includes for SimpleLink CC13xx_26xx SDK +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/devices) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/drivers) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/boards/${TARGET_NAME_SHORT}) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2/driverlib) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/net) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/bsd) +list(APPEND TI_SimpleLink_INCLUDE_DIRS ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages) # the sources files are pulled into the build in the target CMakelists through the XDS tools command line diff --git a/CMake/binutils.ESP32.cmake b/CMake/binutils.ESP32.cmake index 2713f362f1..c870958713 100644 --- a/CMake/binutils.ESP32.cmake +++ b/CMake/binutils.ESP32.cmake @@ -454,7 +454,7 @@ macro(nf_add_idf_as_library) # found it set(SDKCONFIG_DEFAULTS_FILE ${CMAKE_SOURCE_DIR}/targets/ESP32/_IDF/${SDK_CONFIG_FILE}) else() - message(FATAL_ERROR "Couldn't find IDF SDK CONFIG file '${ESP32_IDF_SOURCE}'. Please check the SDK_CONFIG_FILE build option.") + message(FATAL_ERROR "Couldn't find IDF SDK CONFIG file '${SDK_CONFIG_FILE}'. Please check the SDK_CONFIG_FILE build option.") endif() endif() else() @@ -484,7 +484,7 @@ macro(nf_add_idf_as_library) idf::fatfs ) - if(HAL_USE_BLE) + if(HAL_USE_BLE_OPTION) list(APPEND IDF_COMPONENTS_TO_ADD bt) list(APPEND IDF_LIBRARIES_TO_ADD idf::bt) endif() @@ -612,7 +612,6 @@ macro(nf_add_idf_as_library) ) if(USE_NETWORKING_OPTION) - FetchContent_GetProperties(esp32_idf) @@ -671,6 +670,24 @@ macro(nf_add_idf_as_library) PROPERTY COMPILE_DEFINITIONS ${IDF_LWIP_COMPILE_DEFINITIONS} ) + message(STATUS "Adding byteorder functions") + + # need to read the supplied SDK CONFIG file and replace the appropriate options + set(ARCH_CC_FILE "${esp32_idf_SOURCE_DIR}/components/lwip/port/esp32/include/arch/cc.h") + file(READ + ${ARCH_CC_FILE} + ARCH_CC_CONTENTS) + + string(REPLACE + "#endif // BYTE_ORDER" + "#endif // __BYTE_ORDER\n\n#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS\n#define htons(x) __builtin_bswap16(x)\n#define ntohs(x) __builtin_bswap16(x)\n#define htonl(x) __builtin_bswap32(x)\n#define ntohl(x) __builtin_bswap32(x)\n" + ARCH_CC_FINAL_CONTENTS + "${ARCH_CC_CONTENTS}") + + file(WRITE + ${ARCH_CC_FILE} + "${ARCH_CC_FINAL_CONTENTS}") + endif() # need to add include path to find our ffconfig.h and target_platform.h diff --git a/CMake/binutils.TI_SimpleLink.cmake b/CMake/binutils.TI_SimpleLink.cmake index 14fb518902..1cce9cbb28 100644 --- a/CMake/binutils.TI_SimpleLink.cmake +++ b/CMake/binutils.TI_SimpleLink.cmake @@ -4,7 +4,7 @@ # include(FetchContent) -FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) +FetchContent_GetProperties(simplelinkcc13xx_26xxsdk) FetchContent_GetProperties(ti_sysconfig) FetchContent_GetProperties(ti_xdctools) @@ -106,6 +106,9 @@ macro(nf_add_platform_dependencies target) if("${target}" STREQUAL "${NANOCLR_PROJECT_NAME}") nf_add_lib_coreclr( + EXTRA_COMPILE_DEFINITIONS + ${NFSTBC_CLR_EXTRA_COMPILE_DEFINITIONS} + EXTRA_INCLUDES ${TI_SimpleLink_INCLUDE_DIRS} ${TI_XDCTools_INCLUDE_DIR} @@ -125,11 +128,15 @@ macro(nf_add_platform_dependencies target) if(NF_FEATURE_DEBUGGER) - nf_add_lib_debugger(EXTRA_INCLUDES - ${TI_SimpleLink_INCLUDE_DIRS} - ${TI_XDCTools_INCLUDE_DIR} - ${TARGET_TI_SimpleLink_COMMON_INCLUDE_DIRS} - ${TARGET_TI_SimpleLink_NANOCLR_INCLUDE_DIRS}) + nf_add_lib_debugger( + EXTRA_COMPILE_DEFINITIONS + ${NFSTBC_CLR_EXTRA_COMPILE_DEFINITIONS} + + EXTRA_INCLUDES + ${TI_SimpleLink_INCLUDE_DIRS} + ${TI_XDCTools_INCLUDE_DIR} + ${TARGET_TI_SimpleLink_COMMON_INCLUDE_DIRS} + ${TARGET_TI_SimpleLink_NANOCLR_INCLUDE_DIRS}) add_dependencies(${target}.elf nano::NF_Debugger) @@ -226,7 +233,7 @@ macro(nf_add_platform_sysconfig_steps ti_device ti_device_family) # setup target to take care of generating SimpleLink SysConfig files add_custom_target(SYSCONFIG_TASKS ALL) - set(TI_DEVICE_FAMILIES_WITH_RADIO_FREQUENCY "CC13x2_26x2") + set(TI_DEVICE_FAMILIES_WITH_RADIO_FREQUENCY "CC13X2") list(FIND TI_DEVICE_FAMILIES_WITH_RADIO_FREQUENCY ${TARGET_SERIES} TI_DEVICE_FAMILY_NAME_INDEX) @@ -268,7 +275,7 @@ macro(nf_add_platform_sysconfig_steps ti_device ti_device_family) ${CMAKE_CURRENT_BINARY_DIR}/syscfg/ti_easylink_config.c ${CMAKE_CURRENT_BINARY_DIR}/syscfg/ti_radio_config.c - COMMAND ${ti_sysconfig_SOURCE_DIR}/sysconfig_cli.bat --product "${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/.metadata/product.json" --script ${SYS_CONFIG_FILENAME} -o "syscfg" --compiler gcc + COMMAND ${ti_sysconfig_SOURCE_DIR}/sysconfig_cli.bat -s "${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/.metadata/product.json" --script ${SYS_CONFIG_FILENAME} -o "syscfg" --compiler gcc WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generate configuration files" ) @@ -283,7 +290,7 @@ macro(nf_add_platform_sysconfig_steps ti_device ti_device_family) ${CMAKE_CURRENT_BINARY_DIR}/syscfg/ti_easylink_config.c ${CMAKE_CURRENT_BINARY_DIR}/syscfg/ti_radio_config.c - COMMAND ${ti_sysconfig_SOURCE_DIR}/sysconfig_cli.sh --product "${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/.metadata/product.json" --script ${SYS_CONFIG_FILENAME} -o "syscfg" --compiler gcc + COMMAND ${ti_sysconfig_SOURCE_DIR}/sysconfig_cli.sh -s "${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/.metadata/product.json" --script ${SYS_CONFIG_FILENAME} -o "syscfg" --compiler gcc WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generate configuration files" ) @@ -311,13 +318,13 @@ macro(nf_add_platform_sysconfig_steps ti_device ti_device_family) if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) add_custom_target( TIRTOS_CONFIG - COMMAND ${ti_xdctools_SOURCE_DIR}/xs.exe --xdcpath="${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source\;${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages" xdc.tools.configuro -o configPkg -t gnu.targets.arm.M4F -p ti.platforms.simplelink:${ti_device} -r release -c "${TOOLCHAIN_PREFIX}" --compileOptions " -DDeviceFamily_${ti_device_family} " "${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE}" + COMMAND ${ti_xdctools_SOURCE_DIR}/xs.exe --xdcpath="${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source\;${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages" xdc.tools.configuro -o configPkg -t gnu.targets.arm.M4F -p ti.platforms.simplelink:${ti_device} -r release -c "${TOOLCHAIN_PREFIX}" --compileOptions " -DDeviceFamily_${ti_device_family} " "${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE}" COMMENT "Generate TI-RTOS configuration" ) else() add_custom_target( TIRTOS_CONFIG - COMMAND ${ti_xdctools_SOURCE_DIR}/xs --xdcpath="${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source\;${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages" xdc.tools.configuro -o configPkg -t gnu.targets.arm.M4F -p ti.platforms.simplelink:${ti_device} -r release -c "${TOOLCHAIN_PREFIX}" --compileOptions " -DDeviceFamily_${ti_device_family} " "${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE}" + COMMAND ${ti_xdctools_SOURCE_DIR}/xs --xdcpath="${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source\;${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages" xdc.tools.configuro -o configPkg -t gnu.targets.arm.M4F -p ti.platforms.simplelink:${ti_device} -r release -c "${TOOLCHAIN_PREFIX}" --compileOptions " -DDeviceFamily_${ti_device_family} " "${CMAKE_CURRENT_BINARY_DIR}/${TI_RTOS_CONFIG_FILE}" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generate TI-RTOS configuration" ) @@ -340,15 +347,15 @@ macro(nf_setup_target_build) # add extra libraries for SimpleLink set(CLR_EXTRA_LIBRARIES - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/display/lib/gcc/m4f/display.a - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/grlib/lib/gcc/m4f/grlib.a - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.am4fg - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/drivers/lib/gcc/m4f/drivers_cc13x2.a - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/ti/dpl/lib/gcc/m4f/dpl_cc13x2.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/display/lib/gcc/m4f/display_cc13x2.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/grlib/lib/gcc/m4f/grlib.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/drivers/rf/lib/rf_multiMode_cc13x2.am4fg + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/drivers/lib/gcc/m4f/drivers_cc13x2.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/source/ti/devices/cc13x2_cc26x2/driverlib/bin/gcc/driverlib.lib + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/ti/dpl/lib/gcc/m4f/dpl_cc13x2.a - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard/libm.a - ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard/libnosys.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard/libm.a + ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/thumb/v7e-m/hard/libnosys.a ) # add these to the ARGN list diff --git a/CMake/binutils.common.cmake b/CMake/binutils.common.cmake index 5afec9cdad..8a09eec0f7 100644 --- a/CMake/binutils.common.cmake +++ b/CMake/binutils.common.cmake @@ -352,11 +352,11 @@ function(nf_set_linker_options_and_file target linker_file_name) endfunction() # check if a directory exists -# going throuhg the directory to find if it's not empty takes a lot of time because it sweeps all files +# going through the directory to find if it's not empty takes a lot of time because it sweeps all files # simplifying this now to speed up local builds macro(nf_directory_exists_not_empty path pathExists) - if(EXISTS "${path}") + if(IS_DIRECTORY "${path}") set(${pathExists} TRUE) else() set(${pathExists} FALSE) @@ -548,7 +548,7 @@ macro(nf_setup_target_build_common) nf_add_platform_include_directories(${NANOCLR_PROJECT_NAME}) # set compile options - nf_set_compile_options(TARGET ${NANOCLR_PROJECT_NAME}.elf EXTRA_COMPILE_OPTIONS ${NFSTBC_BOOTER_EXTRA_COMPILE_OPTIONS}) + nf_set_compile_options(TARGET ${NANOCLR_PROJECT_NAME}.elf EXTRA_COMPILE_OPTIONS ${NFSTBC_CLR_EXTRA_COMPILE_OPTIONS}) # set compile definitions nf_set_compile_definitions(TARGET ${NANOCLR_PROJECT_NAME}.elf EXTRA_COMPILE_DEFINITIONS ${NFSTBC_CLR_EXTRA_COMPILE_DEFINITIONS} BUILD_TARGET ${NANOCLR_PROJECT_NAME} ) diff --git a/CMakeLists.txt b/CMakeLists.txt index c160b69b47..f631b9f580 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ endif() # optionally add custom logic in the last section of this CMakeLists.txt # to perform custom add_subdirectory() actions. -if(EXISTS ${CMAKE_SOURCE_DIR}/targets/${RTOS}) +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/${RTOS}) message(STATUS "\nSetting RTOS to ${RTOS}\n") string(TOUPPER ${RTOS} RTOS_UPPERCASE) set(RTOS_${RTOS_UPPERCASE}_CHECK TRUE) @@ -520,11 +520,6 @@ if( API_System.Net) set(USE_ENC28J60_DRIVER_OPTION FALSE CACHE INTERNAL "NF ENC28J60 network driver") endif() - if(API_Windows.Devices.Wifi) - set(USE_WIFI_OPTION TRUE CACHE INTERNAL "Wifi for Windows.Devices.WiFi") - else() - set(USE_WIFI_OPTION FALSE CACHE INTERNAL "Wifi for Windows.Devices.WiFi") - endif() else() # need to force SNTP to OFF set(NF_NETWORKING_SNTP FALSE CACHE INTERNAL "SNTP is off as there is no network support") @@ -771,12 +766,12 @@ elseif(RTOS_ESP32_CHECK) nf_set_base_path_for_libraries_modules(${CMAKE_SOURCE_DIR}/targets/ESP32/_nanoCLR) # Only used by ESP32 at the moment - if(API_nanoFramework.Hardware.Esp32.Ble) - set(HAL_USE_BLE TRUE CACHE INTERNAL "BLE Support") - message(STATUS "Support for BLE enabled") + if(API_nanoFramework.Device.Bluetooth) + set(HAL_USE_BLE_OPTION TRUE CACHE INTERNAL "Bluetooth Support") + message(STATUS "Support for Bluetooth enabled") else() - set(HAL_USE_BLE FALSE CACHE INTERNAL "No BLE Support") - message(STATUS "Support for BLE disabled") + set(HAL_USE_BLE_OPTION FALSE CACHE INTERNAL "No Bluetooth Support") + message(STATUS "Support for Bluetooth disabled") endif() if(ESP32_ETHERNET_SUPPORT) @@ -794,7 +789,7 @@ elseif(RTOS_ESP32_CHECK) # now add the subdirectory for the board # try to find board in the targets folder - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/targets/ESP32/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/targets/ESP32/${TARGET_BOARD}) # set target base location set(TARGET_BASE_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/targets/ESP32/${TARGET_BOARD}) @@ -806,7 +801,7 @@ elseif(RTOS_ESP32_CHECK) else() # try to find board in the Community targets folder - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/targets-community/ESP32/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/targets-community/ESP32/${TARGET_BOARD}) # set target base location set(TARGET_BASE_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/targets-community/ESP32/${TARGET_BOARD}) @@ -815,18 +810,9 @@ elseif(RTOS_ESP32_CHECK) message(STATUS "Support for target board '${TARGET_BOARD}' found in Community targets") message(STATUS "${TARGET_BASE_LOCATION}") - # Only used by ESP32 at the moment - if(API_nanoFramework.Hardware.Esp32.Ble) - set(USE_ESP32_BLE TRUE CACHE INTERNAL "BLE Support") - message(STATUS "Support for BLE enabled") - else() - set(USE_ESP32_BLE FALSE CACHE INTERNAL "No BLE Support") - message(STATUS "Support for BLE disabled") + else() # board NOT found in targets folder - # board NOT found in targets folder - message(FATAL_ERROR "\n\nSorry but support for ${TARGET_BOARD} target is not available...\n\You can wait for that to be added or you might want to contribute and start working on a PR for that.\n\n") - endif() - + message(FATAL_ERROR "\n\nSorry but support for ${TARGET_BOARD} target is not available...\n\You can wait for that to be added or you might want to contribute and start working on a PR for that.\n\n") endif() endif() @@ -852,7 +838,7 @@ else() # now add the subdirectory for the board # try to find board in the targets folder - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/targets/${RTOS}/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/targets/${RTOS}/${TARGET_BOARD}) # set target base location set(TARGET_BASE_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/targets/${RTOS}/${TARGET_BOARD}) @@ -862,7 +848,7 @@ else() message(STATUS "${TARGET_BASE_LOCATION}") # try to find board in the Community targets folder - elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/targets-community/${RTOS}/${TARGET_BOARD}) + elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/targets-community/${RTOS}/${TARGET_BOARD}) # set flag for this being a community board set(IS_COMMUNITY_TARGET TRUE CACHE INTERNAL "Community target flag") diff --git a/CMakeSettings.SAMPLE.json b/CMakeSettings.SAMPLE.json index 9ea3572f0e..5de02385a2 100644 --- a/CMakeSettings.SAMPLE.json +++ b/CMakeSettings.SAMPLE.json @@ -239,7 +239,7 @@ "type": "BOOL" }, { - "name": "API_Windows.Devices.Wifi", + "name": "API_System.Device.WiFi", "value": "True", "type": "BOOL" }, diff --git a/CMakeSettings.json b/CMakeSettings.json index a07a3e5b5b..a90f6998c3 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -432,7 +432,7 @@ "value": "ON" }, { - "name": "API_Windows.Devices.Wifi:BOOL", + "name": "API_System.Device.WiFi:BOOL", "value": "True" }, { diff --git a/README.md b/README.md index 87005ca402..101da22126 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,22 @@ Document Language: [English](README.md) | [中文简体](README.zh-cn.md) ## Build status -| Component | Build Status | Build Status (develop) | +| Component | Stable (branch: main) | Preview (branch: develop) | |:-|---|---| | nanoBooter + nanoCLR | [![Build Status](https://dev.azure.com/nanoframework/nf-interpreter/_apis/build/status/nanoframework.nf-interpreter?repoName=nanoframework%2Fnf-interpreter&branchName=main)](https://dev.azure.com/nanoframework/nf-interpreter/_build/latest?definitionId=34&repoName=nanoframework%2Fnf-interpreter&branchName=main) | [![Build Status](https://dev.azure.com/nanoframework/nf-interpreter/_apis/build/status/nanoframework.nf-interpreter?repoName=nanoframework%2Fnf-interpreter&branchName=develop)](https://dev.azure.com/nanoframework/nf-interpreter/_build/latest?definitionId=34&repoName=nanoframework%2Fnf-interpreter&branchName=develop) | | Win32 test project | [![Build Status](https://dev.azure.com/nanoframework/nf-interpreter/_apis/build/status/nanoframework.nf-interpreter?repoName=nanoframework%2Fnf-interpreter&branchName=main)](https://dev.azure.com/nanoframework/nf-interpreter/_build/latest?definitionId=34&repoName=nanoframework%2Fnf-interpreter&branchName=main) | [![Build Status](https://dev.azure.com/nanoframework/nf-interpreter/_apis/build/status/nanoframework.nf-interpreter?repoName=nanoframework%2Fnf-interpreter&branchName=develop)](https://dev.azure.com/nanoframework/nf-interpreter/_build/latest?definitionId=34&repoName=nanoframework%2Fnf-interpreter&branchName=develop) | ## Firmware for reference boards -Each of the following ZIP files contains the image files for nanoBooter and nanoCLR in various formats (HEX, BIN and DFU). They should be flashed in the target boards using an appropriate software utility. +Each of the following ZIP files contain the firmware binaries for nanoBooter (if applicable) and nanoCLR in various formats (HEX, BIN and DFU). They should be flashed to the target board using an appropriate software utility. -The **stable** versions are RTM builds with the smallest possible size. They include the latest stable version. The debugging feature is disabled and only minimal (or none) error messages. +The **stable** firmware versions are `RTM` builds that are updated as per our stable release mandate. These are released with compiler optimizations and the smallest possible size. For these builds, the debugging features are also disabled and only contain no (or minimal) detailed error messages. -The **preview** versions are continuous builds of the reference targets. They include the latest version of all features and bug corrections. They also have the debugging feature enabled along with detailed error messages. +The **preview** firmware versions are the latest available builds of the reference targets. They include the latest bug fixes and features, but are more susceptible to breaking changes and a high release candence. For these builds, debugging features are enabled along with detailed error messages. + +We also have a [Community Targets](https://github.com/nanoframework/nf-Community-Targets) repository where you can find firmware images for several other popular boards that have been contibuted by the community, although limited support is provided. + +### ESP32 modules and boards | Target | Stable | Preview | |:-|---|---| @@ -35,15 +39,38 @@ The **preview** versions are continuous builds of the reference targets. They in | ESP32_LILYGO | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ESP32_LILYGO/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ESP32_LILYGO/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ESP32_LILYGO/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ESP32_LILYGO/latest/) | | FEATHER_S2 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/FEATHER_S2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/FEATHER_S2/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/FEATHER_S2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/FEATHER_S2/latest/) | | KALUGA_1 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/KALUGA_1/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/KALUGA_1/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/KALUGA_1/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/KALUGA_1/latest/) | + +### M5Stack + +| Target | Stable | Preview | +|:-|---|---| +| [M5Core](https://docs.m5stack.com/en/core/gray) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5Core/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5Core/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5Core/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5Core/latest/) | +| [M5StickC](https://docs.m5stack.com/en/core/m5stickc) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5StickC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5StickC/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5StickC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5StickC/latest/) | +| [M5StickCPlus](https://docs.m5stack.com/en/core/m5stickc_plus) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5StickCPlus/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5StickCPlus/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5StickCPlus/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5StickCPlus/latest/) | +| [M5Core2](https://docs.m5stack.com/en/core/core2) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5Core2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5Core2/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5Core2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages-dev/detail/raw/M5Core2/latest/) | + +### STM32 boards and chip based + +| Target | Stable | Preview | +|:-|---|---| | ST_STM32F429I_DISCOVERY | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_STM32F429I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_STM32F429I_DISCOVERY/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_STM32F429I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_STM32F429I_DISCOVERY/latest/) | | ST_NUCLEO64_F091RC | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_NUCLEO64_F091RC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_NUCLEO64_F091RC/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_NUCLEO64_F091RC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_NUCLEO64_F091RC/latest/) | | ST_STM32F769I_DISCOVERY | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_STM32F769I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_STM32F769I_DISCOVERY/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_STM32F769I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_STM32F769I_DISCOVERY/latest/) | | ORGPAL_PALTHREE | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ORGPAL_PALTHREE/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ORGPAL_PALTHREE/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ORGPAL_PALTHREE/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ORGPAL_PALTHREE/latest/) | -| NETDUINO3_WIFI | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NETDUINO3_WIFI/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NETDUINO3_WIFI/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NETDUINO3_WIFI/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NETDUINO3_WIFI/latest/) | + +### NXP boards + +| Target | Stable | Preview | +|:-|---|---| +| NXP_MIMXRT1060_EVK | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | + +### TI boards + +| Target | Stable | Preview | +|:-|---|---| | TI_CC1352R1_LAUNCHXL_868 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC1352R1_LAUNCHXL_868/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC1352R1_LAUNCHXL_868/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC1352R1_LAUNCHXL_868/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC1352R1_LAUNCHXL_868/latest/) | | TI_CC1352R1_LAUNCHXL_915 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC1352R1_LAUNCHXL_915/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC1352R1_LAUNCHXL_915/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC1352R1_LAUNCHXL_915/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC1352R1_LAUNCHXL_915/latest/) | | TI_CC3220SF_LAUNCHXL | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC3220SF_LAUNCHXL/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC3220SF_LAUNCHXL/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC3220SF_LAUNCHXL/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC3220SF_LAUNCHXL/latest/) | -| NXP_MIMXRT1060_EVK | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | The above firmware builds include support for the class libraries and features marked below. @@ -58,16 +85,19 @@ The above firmware builds include support for the class libraries and features m | ESP32_REV3 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | | ESP32_BLE_REV0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | | ESP_WROVER_KIT | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | - | ESP32_PICO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | - | ESP32_LILYGO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: Wifi + Ethernet | :heavy_check_mark: | | | - | FEATHER_S2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | - | KALUGA_1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | + | ESP32_PICO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | + | ESP32_LILYGO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: Wi-Fi + Ethernet | | | | + | FEATHER_S2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | + | KALUGA_1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | :heavy_check_mark: | + | ESP32_OLIMEX_POE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi + Ethernet | | :heavy_check_mark: | | + | M5Core | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5StickC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5StickCPlus | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5Core2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | | ST_STM32F429I_DISCOVERY | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | | ST_NUCLEO64_F091RC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | ST_STM32F769I_DISCOVERY | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | ORGPAL_PALTHREE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | - | MBN_QUAIL | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | - | NETDUINO3_WIFI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | | TI_CC1352R1_LAUNCHXL | :heavy_check_mark: | | | | | | | | | | | | | | | TI_CC3220SF_LAUNCHXL | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | :heavy_check_mark: | | :heavy_check_mark: | | | | | NXP_MIMXRT1060_EVK | :heavy_check_mark: | | | | | | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | @@ -83,12 +113,10 @@ The above firmware builds include support for the class libraries and features m * Target reference for CMSIS OS * [ChibiOS](targets/ChibiOS) * Reference target boards - * [Mikrobus QUAIL](targets/ChibiOS/MBN_QUAIL) * [OrgPal PalThree](targets/ChibiOS/ORGPAL_PALTHREE) * [ST NUCLEO64 F091RC](targets/ChibiOS/ST_NUCLEO64_F091RC) * [ST STM32F429I DISCOVERY](targets/ChibiOS/ST_STM32F429I_DISCOVERY) * [ST STM32F769I DISCOVERY](targets/ChibiOS/ST_STM32F769I_DISCOVERY) - * [Wilderness Labs Netduino3 WiFi](targets/ChibiOS/NETDIUNO3_WIFI) * ChibiOS overlay for **nanoFramework** * [STM32 1.Wire driver](targets/ChibiOS/_nf-overlay/os/hal/src/stm32_onewire) * [STM32 CRC32 driver](targets/ChibiOS/_nf-overlay/os/hal/src/stm32_crc) diff --git a/README.zh-cn.md b/README.zh-cn.md index db3e17adc5..b5009bdab8 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -22,6 +22,7 @@ **稳定** 版是RTM最小大小编译。它包含了最后稳定版本,关闭调试功能,仅有最少或没有错误信息。 **预览** 版是目标板持续编译。它包含所有功能和错误修正的最后版本,也包括调试信息和详细错误信息。 +### ESP32 modules and boards | 目标 | 稳定 | 预览 | |:-|---|---| @@ -35,15 +36,38 @@ | ESP32_LILYGO | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ESP32_LILYGO/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ESP32_LILYGO/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ESP32_LILYGO/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ESP32_LILYGO/latest/) | | FEATHER_S2 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/FEATHER_S2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/FEATHER_S2/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/FEATHER_S2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/FEATHER_S2/latest/) | | KALUGA_1 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/KALUGA_1/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/KALUGA_1/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/KALUGA_1/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/KALUGA_1/latest/) | + +### M5Stack + +| 目标 | 稳定 | 预览 | +|:-|---|---| +| [M5Core](https://docs.m5stack.com/en/core/gray) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5Core/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5Core/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5Core/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5Core/latest/) | +| [M5StickC](https://docs.m5stack.com/en/core/m5stickc) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5StickC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5StickC/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5StickC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5StickC/latest/) | +| [M5StickCPlus](https://docs.m5stack.com/en/core/m5stickc_plus) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5StickCPlus/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5StickCPlus/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5StickCPlus/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/M5StickCPlus/latest/) | +| [M5Core2](https://docs.m5stack.com/en/core/core2) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/M5Core2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/M5Core2/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/M5Core2/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages-dev/detail/raw/M5Core2/latest/) | + +### STM32 boards and chip based + +| 目标 | 稳定 | 预览 | +|:-|---|---| | ST_STM32F429I_DISCOVERY | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_STM32F429I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_STM32F429I_DISCOVERY/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_STM32F429I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_STM32F429I_DISCOVERY/latest/) | | ST_NUCLEO64_F091RC | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_NUCLEO64_F091RC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_NUCLEO64_F091RC/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_NUCLEO64_F091RC/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_NUCLEO64_F091RC/latest/) | | ST_STM32F769I_DISCOVERY | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ST_STM32F769I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ST_STM32F769I_DISCOVERY/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ST_STM32F769I_DISCOVERY/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ST_STM32F769I_DISCOVERY/latest/) | | ORGPAL_PALTHREE | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/ORGPAL_PALTHREE/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/ORGPAL_PALTHREE/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/ORGPAL_PALTHREE/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/ORGPAL_PALTHREE/latest/) | -| NETDUINO3_WIFI | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NETDUINO3_WIFI/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NETDUINO3_WIFI/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NETDUINO3_WIFI/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NETDUINO3_WIFI/latest/) | + +### NXP boards + +| 目标 | 稳定 | 预览 | +|:-|---|---| +| NXP_MIMXRT1060_EVK | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | + +### TI boards + +| 目标 | 稳定 | 预览 | +|:-|---|---| | TI_CC1352R1_LAUNCHXL_868 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC1352R1_LAUNCHXL_868/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC1352R1_LAUNCHXL_868/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC1352R1_LAUNCHXL_868/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC1352R1_LAUNCHXL_868/latest/) | | TI_CC1352R1_LAUNCHXL_915 | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC1352R1_LAUNCHXL_915/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC1352R1_LAUNCHXL_915/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC1352R1_LAUNCHXL_915/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC1352R1_LAUNCHXL_915/latest/) | | TI_CC3220SF_LAUNCHXL | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/TI_CC3220SF_LAUNCHXL/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/TI_CC3220SF_LAUNCHXL/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/TI_CC3220SF_LAUNCHXL/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/TI_CC3220SF_LAUNCHXL/latest/) | -| NXP_MIMXRT1060_EVK | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | [![Latest Version @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/net-nanoframework/nanoframework-images-dev/raw/NXP_MIMXRT1060_EVK/latest/x/?render=true)](https://cloudsmith.io/~net-nanoframework/repos/nanoframework-images-dev/packages/detail/raw/NXP_MIMXRT1060_EVK/latest/) | 以上固件支持以下类库和功能。 @@ -58,16 +82,19 @@ | ESP32_REV3 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | | ESP32_BLE_REV0 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | | ESP_WROVER_KIT | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | - | ESP32_PICO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | - | ESP32_LILYGO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: Wifi + Ethernet | :heavy_check_mark: | | | - | FEATHER_S2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | | - | KALUGA_1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | + | ESP32_PICO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | + | ESP32_LILYGO | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: Wi-Fi + Ethernet | | | | + | FEATHER_S2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | | + | KALUGA_1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | | :heavy_check_mark: | + | ESP32_OLIMEX_POE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi + Ethernet | | :heavy_check_mark: | | + | M5Core | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5StickC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5StickCPlus | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | + | M5Core2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: Wi-Fi | | :heavy_check_mark: | | | ST_STM32F429I_DISCOVERY | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | | ST_NUCLEO64_F091RC | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | ST_STM32F769I_DISCOVERY | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | | ORGPAL_PALTHREE | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | | - | MBN_QUAIL | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | - | NETDUINO3_WIFI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | | | | TI_CC1352R1_LAUNCHXL | :heavy_check_mark: | | | | | | | | | | | | | | | TI_CC3220SF_LAUNCHXL | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | | | :heavy_check_mark: | | :heavy_check_mark: | | | | | NXP_MIMXRT1060_EVK | :heavy_check_mark: | | | | | | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | :heavy_check_mark: | | diff --git a/azure-pipelines-nightly.yml b/azure-pipelines-nightly.yml index 82a30c72bc..bff5bbb590 100644 --- a/azure-pipelines-nightly.yml +++ b/azure-pipelines-nightly.yml @@ -1,5 +1,7 @@ trigger: none -pr: none + +pr: + autoCancel: true # add nf-tools repo to resources (for Azure Pipelines templates) resources: @@ -12,7 +14,7 @@ resources: type: github name: espressif/esp-idf endpoint: nanoframework - ref: refs/tags/v4.3.1 + ref: refs/tags/v4.3.2 # scheduled build schedules: @@ -21,6 +23,7 @@ schedules: include: [ develop ] always: true displayName: Nightly build at 23:58 + jobs: ############################## @@ -49,8 +52,8 @@ jobs: if($commitDate -eq [System.DateTime]::UtcNow.Date) { # last commit is from today, build images - echo "##vso[task.setvariable variable=GO;isOutput=true]true" - "**Commits from today: Build ALL**" | Write-Host + echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]true" + "**Commits from today. Go and check what changed.**" | Write-Host } else { @@ -58,13 +61,13 @@ jobs: "***************************************************" | Write-Host "* Last commit is older than today, skipping build *" | Write-Host "***************************************************" | Write-Host - echo "##vso[task.setvariable variable=GO;isOutput=true]false" + echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]false" } } else { # build for other reasons: build depending on target tag - echo "##vso[task.setvariable variable=GO;isOutput=true]false" + echo "##vso[task.setvariable variable=CHECK_CHANGES;isOutput=true]true" "**build for other reasons**" | Write-Host } @@ -78,19 +81,36 @@ jobs: $auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)"))))" + $buildingPr = $env:System_PullRequest_PullRequestId -ne $null + if($env:StartReleaseCandidate -like "true") { # this is a release prep so NO build } else { - $commitHistory = git log --name-status --since=1.day --format= + if($buildingPr) + { + # get files changed in PR, if this is a PR + $commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/pulls/$env:System_PullRequest_PullRequestNumber/files" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET - # filter removed files - $files = $commitHistory.where{$_[0] -ne 'D'} + # filter removed files + $files = $commit.where{$_.status -ne 'removed'} - # get file names only - $files = $files | % {$_.SubString(2)} + # get file names only + $files = $files | % {$_.filename} + } + else + { + # scheduled build, grab repo history for the last day + $commitHistory = git log --name-status --since=1.day --format= + + # filter removed files + $files = $commitHistory.where{$_[0] -ne 'D'} + + # get file names only + $files = $files | % {$_.SubString(2)} + } Write-host "Files changed:" $files | % { Write-host $_ } @@ -98,12 +118,11 @@ jobs: # set default values echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]false" - echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]false" echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]false" echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false" echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]false" - if( + if( (($files.where{$_.Contains('/')}).Count -eq 0) -Or (($files.where{$_.StartsWith('azure-pipelines-templates')}).Count -gt 0) -Or (($files.where{$_.StartsWith('CMake')}).Count -gt 0) -Or @@ -116,29 +135,55 @@ jobs: # - CMake # - src - echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true" + if($buildingPr) + { + # ChibiOS targets are the only ones needing to be build on a global change + echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" + } + else + { + echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]true" + } Write-host "Building ALL targets" } - - if( ($files.where{$_.Contains('targets/ChibiOS')}).Count -gt 0) + if($buildingPr) { - # files at ChibiOS folder - echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" - - Write-host "Building ChibiOS targets" + if( + ($files.where{$_.Contains('targets/ChibiOS/_common')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_FatFS')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_include')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_Lwip')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_nanoBooter')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_nanoCLR')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_FatFS')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_nf-overlay')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/_spiffs')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/ORGPAL_PALTHREE')}).Count -gt 0 -Or + ($files.where{$_.Contains('targets/ChibiOS/ST_NUCLEO64_F091RC')}).Count -gt 0 + ) + { + # files at ChibiOS global folders or targets being built with this pipeline + echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" + + Write-host "Building ChibiOS targets" + } } - - if( ($files.where{$_.Contains('targets/FreeRTOS')}).Count -gt 0) + else { - # files at FreeRTOS folder - echo "##vso[task.setvariable variable=BUILD_FREERTOS;isOutput=true]true" + if( ($files.where{$_.Contains('targets/ChibiOS')}).Count -gt 0) + { + # files at ChibiOS folder + echo "##vso[task.setvariable variable=BUILD_CHIBIOS;isOutput=true]true" - Write-host "Building FreeRTOS targets" + Write-host "Building ChibiOS targets" + } } - if( ($files.where{$_.Contains('targets/ESP32')}).Count -gt 0) + if( + !$buildingPr -And + ($files.where{$_.Contains('targets/ESP32')}).Count -gt 0) { # files at ESP32 folder echo "##vso[task.setvariable variable=BUILD_ESP32;isOutput=true]true" @@ -146,7 +191,9 @@ jobs: Write-host "Building ESP32 targets" } - if( ($files.where{$_.Contains('targets/TI_SimpleLink')}).Count -gt 0) + if( + !$buildingPr -And + ($files.where{$_.Contains('targets/TI_SimpleLink')}).Count -gt 0) { # files at TI_SimpleLink folder echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]true" @@ -157,55 +204,46 @@ jobs: name: TargetsToBuild displayName: Get targets to build - condition: eq(variables['BuildOptions.GO'], 'True') + condition: eq(variables['BuildOptions.CHECK_CHANGES'], 'True') + +############################## +- job: Check_Code_Style + dependsOn: + - Check_Build_Options + + pool: + vmImage: 'windows-2019' + + steps: + - checkout: self + fetchDepth: 1 + + - template: azure-pipelines-templates/download-install-llvm.yml + - template: azure-pipelines-templates/check-code-style.yml ################ # STM32 - job: Build_STM32_targets condition: >- - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true), - contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), - eq(variables['BUILD_ALL'], 'true'), - eq(variables['BUILD_CHIBIOS'], 'true') + and( + succeeded('Check_Code_Style'), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_CHIBIOS'], true), + contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), + eq(variables['BUILD_ALL'], 'true'), + eq(variables['BUILD_CHIBIOS'], 'true') + ) ) - dependsOn: - Check_Build_Options + - Check_Code_Style pool: vmImage: 'windows-2019' strategy: matrix: - NETDUINO3_WIFI: - TargetBoard: NETDUINO3_WIFI - TargetSeries: 'stm32f4xx' - 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_System.Device.Gpio=ON - -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON - -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON - -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON - -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON - -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON - -DAPI_System.Device.Dac=OFF - -DAPI_nanoFramework.Devices.OneWire=ON - -DAPI_nanoFramework.ResourceManager=ON - -DAPI_nanoFramework.System.Collections=ON - -DAPI_nanoFramework.System.Text=ON - - GccArm_Version: - NeedsDFU: true - NeedsSRECORD: false ORGPAL_PALTHREE: TargetBoard: ORGPAL_PALTHREE TargetSeries: 'stm32f7xx' @@ -286,21 +324,24 @@ jobs: # ESP32 targets - job: Build_ESP32_targets condition: >- - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true), - contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), - eq(variables['BUILD_ALL'], 'true'), - eq(variables['BUILD_ESP32'], 'true') - ) + and( + succeeded('Check_Code_Style'), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ESP32'], true), + contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), + eq(variables['BUILD_ALL'], 'true'), + eq(variables['BUILD_ESP32'], 'true') + ) + ) dependsOn: - Check_Build_Options + - Check_Code_Style pool: vmImage: 'windows-2019' - # there is only a single ESP32 target, but this is already config as a matrix to make it easy to add new ones strategy: matrix: ESP32_REV0: @@ -324,7 +365,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -332,12 +373,12 @@ jobs: -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON - ToolchainFile: toolchain.xtensa-esp32-elf.cmake SDK_config: sdkconfig.default_nopsram.esp32 IDF_Target: esp32 TargetName: ESP32 PackageName: ESP32_REV0 + ESP32_PSRAM_REV3: TargetBoard: ESP32 TargetSeries: 'esp32' @@ -359,7 +400,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -367,12 +408,12 @@ jobs: -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON - ToolchainFile: toolchain.xtensa-esp32-elf.cmake SDK_config: sdkconfig.default_rev3.esp32 IDF_Target: esp32 TargetName: ESP32 PackageName: ESP32_PSRAM_REV3 + ESP32_PSRAM_XTAL26_REV0: TargetBoard: ESP32 TargetSeries: 'esp32' @@ -395,7 +436,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -403,12 +444,12 @@ jobs: -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON - ToolchainFile: toolchain.xtensa-esp32-elf.cmake SDK_config: sdkconfig.default.esp32 IDF_Target: esp32 TargetName: ESP32 PackageName: ESP32_PSRAM_XTAL26_REV0 + ESP32_REV3: TargetBoard: ESP32 TargetSeries: 'esp32' @@ -430,7 +471,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -438,12 +479,12 @@ jobs: -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON - ToolchainFile: toolchain.xtensa-esp32-elf.cmake SDK_config: sdkconfig.default_nopsram_rev3.esp32 IDF_Target: esp32 TargetName: ESP32 PackageName: ESP32_REV3 + ESP32_PICO: TargetBoard: ESP32 TargetSeries: 'esp32' @@ -464,19 +505,20 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON - + -DAPI_Windows.Storage=ON ToolchainFile: toolchain.xtensa-esp32-elf.cmake SDK_config: sdkconfig.default_pico IDF_Target: esp32 TargetName: ESP32_PICO PackageName: ESP32_PICO + KALUGA_1: TargetBoard: ESP32_S2 TargetSeries: 'esp32_s2' @@ -496,7 +538,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON @@ -508,13 +550,253 @@ jobs: -DTOUCHPANEL_DEVICE="XPT2046.cpp" -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" - ToolchainFile: toolchain.xtensa-esp32s2-elf.cmake SDK_config: sdkconfig.default.esp32s2 IDF_Target: esp32s2 TargetName: KALUGA_1 PackageName: KALUGA_1 + ESP32_BLE_REV3: + TargetBoard: ESP32 + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON + -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON + -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON + -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON + -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON + -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.Devices.OneWire=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_System.Device.Dac=ON + -DAPI_nanoFramework.Device.Bluetooth=ON + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_ble_rev3.esp32 + IDF_Target: esp32 + TargetName: ESP32 + PackageName: ESP32_BLE_REV3 + + ESP32_OLIMEX: + TargetBoard: ESP32 + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_System.Device.Dac=ON + -DESP32_ETHERNET_SUPPORT=ON + -DETH_PHY_RST_GPIO=12 + -DETH_RMII_CLK_OUT_GPIO=17 + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: + IDF_Target: esp32 + TargetName: ESP32_OLIMEX + PackageName: ESP32_OLIMEX + + M5StickC: + TargetBoard: ESP32 + TargetPlatform: 'esp32' + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DTARGET_SERIAL_BAUDRATE=115200 + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_nanoFramework.Graphics=ON + -DGRAPHICS_DISPLAY="ST7735S_SPI.cpp" + -DTOUCHPANEL_DEVICE="XPT2046.cpp" + -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" + -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" + -DAPI_System.Device.Dac=ON + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_pico + IDF_Target: esp32 + TargetName: M5StickC + PackageName: M5StickC + + M5StickCPlus: + TargetBoard: ESP32 + TargetPlatform: 'esp32' + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DTARGET_SERIAL_BAUDRATE=115200 + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_nanoFramework.Graphics=ON + -DGRAPHICS_DISPLAY="ST7789V_240x320_SPI.cpp" + -DTOUCHPANEL_DEVICE="XPT2046.cpp" + -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" + -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" + -DAPI_System.Device.Dac=ON + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_pico + IDF_Target: esp32 + TargetName: M5StickCPlus + PackageName: M5StickCPlus + + M5Core: + TargetBoard: ESP32 + TargetPlatform: 'esp32' + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_nanoFramework.Graphics=ON + -DGRAPHICS_DISPLAY="ILI9342_320x240_SPI.cpp" + -DTOUCHPANEL_DEVICE="XPT2046.cpp" + -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" + -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" + -DAPI_System.Device.Dac=ON + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_nopsram.esp32 + IDF_Target: esp32 + TargetName: M5Core + PackageName: M5Core + + M5Core2: + TargetBoard: ESP32 + TargetPlatform: 'esp32' + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_nanoFramework.Graphics=ON + -DGRAPHICS_DISPLAY="ILI9342_320x240_SPI.cpp" + -DTOUCHPANEL_DEVICE="XPT2046.cpp" + -DGRAPHICS_DISPLAY_INTERFACE="Spi_To_Display.cpp" + -DTOUCHPANEL_INTERFACE="Spi_To_TouchPanel.cpp" + -DAPI_System.Device.Dac=ON + -DAPI_nanoFramework.Device.Bluetooth=ON + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_ble_rev3.esp32 + IDF_Target: esp32 + TargetName: M5Core2 + PackageName: M5Core2 + variables: DOTNET_NOLOGO: true # creates a counter and assigns it to the revision variable @@ -534,6 +816,8 @@ jobs: repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' - template: azure-pipelines-templates/download-install-esp32-build-components.yml - template: azure-pipelines-templates/download-install-ninja.yml + parameters: + repoDirectory: '$(Build.SourcesDirectory)\nf-interpreter' - template: azure-pipelines-templates/build-esp32.yml - task: CopyFiles@1 @@ -555,16 +839,20 @@ jobs: # TI SimpleLink - job: Build_TI_SimpleLink_targets condition: >- - or( - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), - eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true), - contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), - eq(variables['BUILD_ALL'], 'true'), - eq(variables['BUILD_TI'], 'true') - ) + and( + succeeded('Check_Code_Style'), + or( + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true), + eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true), + contains(dependencies.Check_Build_Options.outputs['GetCommitDetails.COMMIT_MESSAGE'], '***BUILD_ALL***'), + eq(variables['BUILD_ALL'], 'true'), + eq(variables['BUILD_TI'], 'true') + ) + ) dependsOn: - Check_Build_Options + - Check_Code_Style pool: vmImage: 'windows-2019' @@ -574,9 +862,9 @@ jobs: TI_CC1352R1_LAUNCHXL_868: TargetBoard: TI_CC1352R1_LAUNCHXL PackageName: TI_CC1352R1_LAUNCHXL_868 - TargetSeries: 'cc13x2_26x2' + TargetSeries: 'cc13xx_26xx' BuildOptions: >- - -DTARGET_SERIES=CC13x2_26x2 + -DTARGET_SERIES=CC13X2 -DRTOS=TI_SimpleLink -DRADIO_FREQUENCY=868 -DSUPPORT_ANY_BASE_CONVERSION=OFF @@ -591,7 +879,7 @@ jobs: -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_nanoFramework.TI.EasyLink=ON -DAPI_nanoFramework.Hardware.TI=ON - + GccArm_Version: variables: diff --git a/azure-pipelines-templates/check-code-style.yml b/azure-pipelines-templates/check-code-style.yml index 7e6406c823..af5fcda0fc 100644 --- a/azure-pipelines-templates/check-code-style.yml +++ b/azure-pipelines-templates/check-code-style.yml @@ -6,7 +6,7 @@ steps: - task: PowerShell@2 name: Check_Code_Style displayName: Check code style - condition: eq(variables['Build.Reason'], 'PullRequest') + condition: ne(variables['System.PullRequest.PullRequestId'], '') inputs: failOnStderr: false targetType: 'inline' @@ -130,7 +130,8 @@ steps: 'OK' | Write-Host -ForegroundColor Green # PR submitted, add a comment - $codeStyleFixesComment = @{body="@$($pr.user.login) there are issues with the code style on the source files.`nA PR was submitted with the code style fixes. Please click $($result.html_url), review the changes if you want and merge it.`n`nMake sure to follow the project code style. Check the details [here](https://docs.nanoframework.net/content/contributing/cxx-coding-style.html) on how it works and the tools required to help you with that."} | ConvertTo-Json + # include TAG comment that allows github nfbot to remove it after branch is merged + $codeStyleFixesComment = @{body="@$($pr.user.login) there are issues with the code style on the source files.`nA PR was submitted with the code style fixes. Please click $($result.html_url), review the changes if you want and merge it.`n`nMake sure to follow the project code style. Check the details [here](https://docs.nanoframework.net/content/contributing/cxx-coding-style.html) on how it works and the tools required to help you with that.`n`n"} | ConvertTo-Json Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $($pr.comments_url) -Header @{"Authorization"="$auth"} -ContentType "application/json" -Body $codeStyleFixesComment } catch @@ -147,7 +148,8 @@ steps: # most likely this is a permissions issue because the base repo is read only or protected # report to user - $codeStyleFixesComment = @{body="@$($pr.user.login) there are issues with the code style on the source files.`n`n:warning:Couldn't submit a PR with the fixes against your repo.:warning:`n`nPlease merge the changes from https://github.com/$env:Build_Repository_Name/tree/$branchName."} | ConvertTo-Json + # include TAG comment that allows github nfbot to remove it after branch is merged + $codeStyleFixesComment = @{body="@$($pr.user.login) there are issues with the code style on the source files.`n`n:warning:Couldn't submit a PR with the fixes against your repo.:warning:`n`nPlease merge the changes from https://github.com/$env:Build_Repository_Name/tree/$branchName.`n`n"} | ConvertTo-Json $result = Invoke-RestMethod -Method Post -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer -Uri $($pr.comments_url) -Header @{"Authorization"="$auth"} -ContentType "application/json" -Body $codeStyleFixesComment throw "Error starting PR: $responseBody" @@ -163,7 +165,7 @@ steps: - task: PowerShell@2 name: Check_Code_Style_SKIP displayName: Check code style (SKIP) - condition: ne(variables['Build.Reason'], 'PullRequest') + condition: eq(variables['System.PullRequest.PullRequestId'], '') inputs: targetType: 'inline' script: exit 0 diff --git a/azure-pipelines-templates/download-install-esp32-build-components.yml b/azure-pipelines-templates/download-install-esp32-build-components.yml index 80c9520956..7846ee13d0 100644 --- a/azure-pipelines-templates/download-install-esp32-build-components.yml +++ b/azure-pipelines-templates/download-install-esp32-build-components.yml @@ -7,8 +7,8 @@ steps: - task: Cache@2 displayName: Cache ESP32 tools inputs: - key: 'esp32_tools | 4_3_1' - restoreKeys: 4_3_1 + key: 'esp32_tools | 4_3_2' + restoreKeys: 4_3_2 path: $(UserProfile)\.espressif\tools cacheHitVar: ESP32_TOOLS_CACHE_RESTORED diff --git a/azure-pipelines-templates/download-install-llvm.yml b/azure-pipelines-templates/download-install-llvm.yml index 1558e9ec7f..04a543f956 100644 --- a/azure-pipelines-templates/download-install-llvm.yml +++ b/azure-pipelines-templates/download-install-llvm.yml @@ -3,33 +3,33 @@ steps: - task: Cache@2 - condition: eq(variables['Build.Reason'], 'PullRequest') + condition: ne(variables['System.PullRequest.PullRequestId'], '') displayName: Cache LLVM inputs: - key: 'llvm_12_0_0_0 | llvmUpdateKey' + key: 'llvm_13_0_0_0 | llvmUpdateKey' restoreKeys: llvmUpdateKey path: $(Agent.TempDirectory)\llvm cacheHitVar: LLVM_CACHE_RESTORED - task: PowerShell@2 - displayName: Downloading LLVM 12.0 - condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables.LLVM_CACHE_RESTORED, 'true')) + displayName: Downloading LLVM + condition: and(ne(variables['System.PullRequest.PullRequestId'], ''), ne(variables.LLVM_CACHE_RESTORED, 'true')) inputs: targetType: 'inline' script: | - $url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/LLVM-12.0.0-win64.exe" - $output = "$(Agent.TempDirectory)\LLVM-12.0.0-win64.exe" + $url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/LLVM-13.0.0-win64.exe" + $output = "$(Agent.TempDirectory)\LLVM-13.0.0-win64.exe" (New-Object Net.WebClient).DownloadFile($url, $output) errorActionPreference: 'stop' failOnStderr: 'true' - task: ExtractFiles@1 - displayName: Install LLVM 12 - condition: and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables.LLVM_CACHE_RESTORED, 'true')) + displayName: Install LLVM + condition: and(ne(variables['System.PullRequest.PullRequestId'], ''), ne(variables.LLVM_CACHE_RESTORED, 'true')) inputs: - archiveFilePatterns: '$(Agent.TempDirectory)\LLVM-12.0.0-win64.exe' + archiveFilePatterns: '$(Agent.TempDirectory)\LLVM-13.0.0-win64.exe' destinationFolder: '$(Agent.TempDirectory)\llvm' - script: echo "##vso[task.prependpath]$(Agent.TempDirectory)\llvm\bin" displayName: Add LLVM to PATH - condition: eq(variables['Build.Reason'], 'PullRequest') + condition: ne(variables['System.PullRequest.PullRequestId'], '') diff --git a/azure-pipelines-templates/download-install-ninja.yml b/azure-pipelines-templates/download-install-ninja.yml index df2a7b72e3..4c34dc06ef 100644 --- a/azure-pipelines-templates/download-install-ninja.yml +++ b/azure-pipelines-templates/download-install-ninja.yml @@ -1,6 +1,9 @@ # Copyright (c) .NET Foundation and Contributors # See LICENSE file in the project root for full license information. +parameters: + repoDirectory: '$(Build.SourcesDirectory)' + steps: - task: Cache@2 inputs: @@ -14,9 +17,9 @@ steps: condition: ne(variables.NINJA_CACHE_RESTORED, 'true') displayName: Download Ninja inputs: - targetType: 'filePath' - filePath: '$(Build.Repository.LocalPath)\install-scripts\install-ninja.ps1' - failOnStderr: 'true' + targetType: 'filePath' + filePath: '${{ parameters.repoDirectory }}\install-scripts\install-ninja.ps1' + failOnStderr: 'true' - task: ExtractFiles@1 inputs: diff --git a/azure-pipelines-templates/nb-gitversioning.yml b/azure-pipelines-templates/nb-gitversioning.yml index 39269b1764..385ce3746f 100644 --- a/azure-pipelines-templates/nb-gitversioning.yml +++ b/azure-pipelines-templates/nb-gitversioning.yml @@ -13,7 +13,7 @@ steps: custom: tool arguments: install --tool-path ${{ parameters.repoDirectory }} nbgv - - script: nbgv cloud -a -c + - script: nbgv cloud -a -c -v $(Build.BuildNumber) displayName: Set build number condition: succeeded() workingDirectory: ${{ parameters.repoDirectory }} @@ -34,17 +34,19 @@ steps: - task: PowerShell@2 displayName: Get target build counter inputs: - targetType: 'inline' - script: | - $counter = $env:REVISION - $version = ([int]$counter).ToString() + targetType: 'inline' + script: | + $counter = $env:REVISION + $version = ([int]$counter).ToString() - if($env:Build_SourceBranch.StartsWith('release-') -or - $env:Build_SourceBranch.StartsWith('main')) - { - Write-Host "$("##vso[task.setvariable variable=TARGET_BUILD_COUNTER]")$env:NBGV_BuildNumber" - } - else - { - Write-Host "$("##vso[task.setvariable variable=TARGET_BUILD_COUNTER]")$version" - } + if($env:Build_SourceBranch.StartsWith('release-') -or + $env:Build_SourceBranch.StartsWith('main')) + { + Write-Host "$("##vso[task.setvariable variable=TARGET_BUILD_COUNTER]")$env:NBGV_RevisionNumber" + Write-Host "*** BUILD NUMBER IS: $(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$(NBGV_RevisionNumber) ***" + } + else + { + Write-Host "$("##vso[task.setvariable variable=TARGET_BUILD_COUNTER]")$version" + Write-Host "*** BUILD NUMBER IS: $(NBGV_VersionMajor).$(NBGV_VersionMinor).$(NBGV_BuildNumber).$version ***" + } diff --git a/azure-pipelines-templates/pack-publish-managed-helpers.yml b/azure-pipelines-templates/pack-publish-managed-helpers.yml index ac6345eff6..7cab4b31f2 100644 --- a/azure-pipelines-templates/pack-publish-managed-helpers.yml +++ b/azure-pipelines-templates/pack-publish-managed-helpers.yml @@ -34,8 +34,6 @@ steps: # condition: succeeded() # displayName: Check if managed helpers files were changed - - template: azure-pipelines-templates/download-logo.yml@templates - - task: NuGetCommand@2 inputs: command: 'custom' @@ -60,5 +58,5 @@ steps: nuGetFeedType: external packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' publishFeedCredentials: 'NuGet-$(System.TeamProject)' - condition: and( succeeded(), eq(variables['BUILD_NUGET_PACKAGE'], true), ne(variables['Build.Reason'], 'PullRequest') ) + condition: and( succeeded(), eq(variables['BUILD_NUGET_PACKAGE'], true), eq(variables['System.PullRequest.PullRequestId'], '') ) displayName: Push managed helpers NuGet packages to NuGet diff --git a/azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml b/azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml index 41b736c577..a7a73bb689 100644 --- a/azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml +++ b/azure-pipelines-templates/pack-publish-ti-sl-managed-helpers.yml @@ -34,8 +34,6 @@ steps: condition: succeeded() displayName: Check if managed helpers files were changed - - template: azure-pipelines-templates/download-logo.yml@templates - - task: NuGetCommand@2 inputs: command: 'custom' @@ -60,5 +58,5 @@ steps: nuGetFeedType: external packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' publishFeedCredentials: 'NuGet-$(System.TeamProject)' - condition: and( succeeded(), eq(variables['BUILD_NUGET_PACKAGE'], true), ne(variables['Build.Reason'], 'PullRequest') ) + condition: and( succeeded(), eq(variables['BUILD_NUGET_PACKAGE'], true), eq(variables['System.PullRequest.PullRequestId'], '') ) displayName: Push managed helpers NuGet packages to NuGet diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 131d846e92..4b310ba630 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ trigger: branches: include: ["main", "main", "develop*", "release-*", "refs/tags/*" ] paths: - exclude: [ "doc", "*.md", ".gitignore", "README.md", "README.zh-cn.md" ] + exclude: [ "doc", "*.md", ".gitignore", "README.md", "README.zh-cn.md", ".github", ".devcontainer" ] pr: autoCancel: true @@ -18,7 +18,7 @@ resources: type: github name: espressif/esp-idf endpoint: nanoframework - ref: refs/tags/v4.3.1 + ref: refs/tags/v4.3.2 jobs: @@ -409,7 +409,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -423,89 +423,47 @@ jobs: IDF_Target: esp32 TargetName: ESP32 PackageName: ESP32_PSRAM_REV0 - # BUILD FAILING ON IRAM0 overflow - # ESP32_BLE_REV0: - # TargetBoard: ESP32 - # TargetSeries: 'esp32' - # BuildOptions: >- - # -DTARGET_SERIES=ESP32 - # -DRTOS=ESP32 - # -DNF_FEATURE_DEBUGGER=ON - # -DNF_FEATURE_RTC=ON - # -DNF_FEATURE_HAS_CONFIG_BLOCK=ON - # -DNF_SECURITY_MBEDTLS=ON - # -DSUPPORT_ANY_BASE_CONVERSION=ON - # -DNF_FEATURE_HAS_SDCARD=ON - # -DAPI_System.IO.FileSystem=ON - # -DAPI_System.Math=ON - # -DAPI_Windows.Devices.Gpio=ON - # -DAPI_System.Device.Gpio=ON - # -DAPI_Windows.Devices.Spi=ON - # -DAPI_System.Device.Spi=ON - # -DAPI_Windows.Devices.I2c=ON - # -DAPI_System.Device.I2c=ON - # -DAPI_Windows.Devices.Pwm=ON - # -DAPI_System.Device.Pwm=ON - # -DAPI_Windows.Devices.SerialCommunication=ON - # -DAPI_System.IO.Ports=ON - # -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON - # -DAPI_System.Net=ON - # -DAPI_Windows.Devices.Wifi=ON - # -DAPI_Hardware.Esp32=ON - # -DAPI_nanoFramework.Devices.OneWire=ON - # -DAPI_nanoFramework.ResourceManager=ON - # -DAPI_nanoFramework.System.Collections=ON - # -DAPI_nanoFramework.System.Text=ON - # -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON - # -DAPI_System.Device.Dac=ON - # -DAPI_nanoFramework.Hardware.Esp32.Ble=ON - - # ToolchainFile: toolchain.xtensa-esp32-elf.cmake - # SDK_config: sdkconfig.default_ble.esp32 - # IDF_Target: esp32 - # TargetName: ESP32 - # PackageName: ESP32_BLE_REV0 - # BUILD FAILING ON IRAM0 overflow - # ESP32_BLE_REV3: - # TargetBoard: ESP32 - # TargetSeries: 'esp32' - # BuildOptions: >- - # -DTARGET_SERIES=ESP32 - # -DRTOS=ESP32 - # -DNF_FEATURE_DEBUGGER=ON - # -DNF_FEATURE_RTC=ON - # -DNF_FEATURE_HAS_CONFIG_BLOCK=ON - # -DNF_SECURITY_MBEDTLS=ON - # -DSUPPORT_ANY_BASE_CONVERSION=ON - # -DNF_FEATURE_HAS_SDCARD=ON - # -DAPI_System.IO.FileSystem=ON - # -DAPI_System.Math=ON - # -DAPI_Windows.Devices.Gpio=ON - # -DAPI_System.Device.Gpio=ON - # -DAPI_Windows.Devices.Spi=ON - # -DAPI_System.Device.Spi=ON - # -DAPI_Windows.Devices.I2c=ON - # -DAPI_System.Device.I2c=ON - # -DAPI_Windows.Devices.Pwm=ON - # -DAPI_System.Device.Pwm=ON - # -DAPI_Windows.Devices.SerialCommunication=ON - # -DAPI_System.IO.Ports=ON - # -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON - # -DAPI_System.Net=ON - # -DAPI_Windows.Devices.Wifi=ON - # -DAPI_Hardware.Esp32=ON - # -DAPI_nanoFramework.Devices.OneWire=ON - # -DAPI_nanoFramework.ResourceManager=ON - # -DAPI_nanoFramework.System.Collections=ON - # -DAPI_nanoFramework.System.Text=ON - # -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON - # -DAPI_System.Device.Dac=ON - - # ToolchainFile: toolchain.xtensa-esp32-elf.cmake - # SDK_config: sdkconfig.default_ble_rev3.esp32 - # IDF_Target: esp32 - # TargetName: ESP32 - # PackageName: ESP32_BLE_REV3 + ESP32_BLE_REV0: + TargetBoard: ESP32 + TargetSeries: 'esp32' + BuildOptions: >- + -DTARGET_SERIES=ESP32 + -DRTOS=ESP32 + -DNF_FEATURE_DEBUGGER=ON + -DNF_FEATURE_RTC=ON + -DNF_FEATURE_HAS_CONFIG_BLOCK=ON + -DNF_SECURITY_MBEDTLS=ON + -DSUPPORT_ANY_BASE_CONVERSION=ON + -DNF_FEATURE_HAS_SDCARD=ON + -DAPI_System.IO.FileSystem=ON + -DAPI_System.Math=ON + -DAPI_Windows.Devices.Gpio=ON + -DAPI_System.Device.Gpio=ON + -DAPI_Windows.Devices.Spi=ON + -DAPI_System.Device.Spi=ON + -DAPI_Windows.Devices.I2c=ON + -DAPI_System.Device.I2c=ON + -DAPI_Windows.Devices.Pwm=ON + -DAPI_System.Device.Pwm=ON + -DAPI_Windows.Devices.SerialCommunication=ON + -DAPI_System.IO.Ports=ON + -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON + -DAPI_System.Net=ON + -DAPI_System.Device.WiFi=ON + -DAPI_Hardware.Esp32=ON + -DAPI_nanoFramework.Devices.OneWire=ON + -DAPI_nanoFramework.ResourceManager=ON + -DAPI_nanoFramework.System.Collections=ON + -DAPI_nanoFramework.System.Text=ON + -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON + -DAPI_System.Device.Dac=ON + -DAPI_nanoFramework.Device.Bluetooth=ON + + ToolchainFile: toolchain.xtensa-esp32-elf.cmake + SDK_config: sdkconfig.default_nopsram_ble.esp32 + IDF_Target: esp32 + TargetName: ESP32 + PackageName: ESP32_BLE_REV0 ESP_WROVER_KIT: TargetBoard: ESP32 TargetSeries: 'esp32' @@ -527,7 +485,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_nanoFramework.ResourceManager=ON @@ -567,7 +525,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON @@ -602,7 +560,7 @@ jobs: -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON -DAPI_System.Net=ON - -DAPI_Windows.Devices.Wifi=ON + -DAPI_System.Device.WiFi=ON -DAPI_Hardware.Esp32=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON @@ -768,9 +726,9 @@ jobs: TI_CC1352R1_LAUNCHXL_915: TargetBoard: TI_CC1352R1_LAUNCHXL PackageName: TI_CC1352R1_LAUNCHXL_915 - TargetSeries: 'cc13x2_26x2' + TargetSeries: 'CC13X2' BuildOptions: >- - -DTARGET_SERIES=CC13x2_26x2 + -DTARGET_SERIES=CC13X2 -DRTOS=TI_SimpleLink -DRADIO_FREQUENCY=915 -DSUPPORT_ANY_BASE_CONVERSION=OFF @@ -871,8 +829,6 @@ jobs: eq(variables['System.PullRequest.PullRequestId'], '') ) - - template: azure-pipelines-templates/download-logo.yml@templates - - task: NuGetCommand@2 condition: succeeded() displayName: Pack nanoCLR WIN32 @@ -965,12 +921,12 @@ jobs: succeeded('Build_ESP32_targets'), succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), - not( eq(variables['Build.Reason'], 'PullRequest') - ), - or( - eq(variables['Build.SourceBranchName'], 'main'), - startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), - ne( variables['StartReleaseCandidate'], true ) + eq(variables['System.PullRequest.PullRequestId'], ''), + or( + eq(variables['Build.SourceBranchName'], 'main'), + startsWith(variables['Build.SourceBranch'], 'refs/tags/v') + ), + ne(variables['StartReleaseCandidate'], true) ) pool: @@ -1003,7 +959,7 @@ jobs: condition: >- and( succeeded(), - ne(variables['Build.Reason'], 'PullRequest'), + eq(variables['System.PullRequest.PullRequestId'], ''), or( eq(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') @@ -1019,7 +975,7 @@ jobs: condition: >- and( succeeded(), - ne(variables['Build.Reason'], 'PullRequest'), + eq(variables['System.PullRequest.PullRequestId'], ''), not( or( eq(variables['Build.SourceBranchName'], 'main'), @@ -1074,9 +1030,7 @@ jobs: succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), succeeded('Generate_change_log'), - not( - eq(variables['Build.Reason'], 'PullRequest') - ), + eq(variables['System.PullRequest.PullRequestId'], ''), or( endsWith(variables['Build.SourceBranchName'], 'main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), diff --git a/build.ps1 b/build.ps1 index 5b5176060d..52541c865a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -3,7 +3,7 @@ [CmdletBinding(SupportsShouldProcess = $true)] param ( - [Parameter(HelpMessage = "Please enter the target name [e.g. ESP32_WROOM_32 or ST_STM32F429I_DISCOVERY or NETDUINO3_WIFI].")][string]$TargetBoard, + [Parameter(HelpMessage = "Please enter the target name [e.g. ESP32_WROOM_32 or ST_STM32F429I_DISCOVERY].")][string]$TargetBoard, [Parameter(HelpMessage = "Enter the path to the folder where the tools should be installed.")][string]$Path = "C:\nftools" ) @@ -15,8 +15,7 @@ Set-Location "build" | Out-Null "Running CMake build preparation..." | Write-Host -ForegroundColor White -If ($TargetBoard -eq "NETDUINO3_WIFI" -or - $TargetBoard -eq "ORGPAL_PALTHREE" -or +If ($TargetBoard -eq "ORGPAL_PALTHREE" -or $TargetBoard -eq "ST_NUCLEO64_F091RC" -or $TargetBoard -eq "ST_STM32F429I_DISCOVERY" -or $TargetBoard -eq "ST_STM32F769I_DISCOVERY") { @@ -24,40 +23,177 @@ If ($TargetBoard -eq "NETDUINO3_WIFI" -or # run the install tools to have the build vars filled Invoke-Expression "$PSScriptRoot\install-scripts\install-stm32-tools.ps1 -Path $Path" - If ($TargetBoard -eq "NETDUINO3_WIFI") { - - $cmakeOptions = " -DTOOL_HEX2DFU_PREFIX=$:env:HEX2DFU_PATH -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.Device.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON" - } - elseif ($TargetBoard -eq "ORGPAL_PALTHREE") { - - $cmakeOptions = " -DTOOL_HEX2DFU_PREFIX=$:env:HEX2DFU_PATH -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DCHIBIOS_CONTRIB_REQUIRED=ON -DSTM32_CUBE_PACKAGE_REQUIRED=ON -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_USB_MSD=ON -DNF_FEATURE_HAS_SDCARD=ON -DNF_FEATURE_USE_SPIFFS=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.Device.Dac=OFF -DAPI_System.Net=ON -DNF_SECURITY_MBEDTLS=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON" + If ($TargetBoard -eq "ORGPAL_PALTHREE") { + + $cmakeOptions = @" +-DTOOL_HEX2DFU_PREFIX=$:env:HEX2DFU_PATH +-DTARGET_SERIES=STM32F7xx +-DRTOS=ChibiOS +-DCHIBIOS_CONTRIB_REQUIRED=ON +-DSTM32_CUBE_PACKAGE_REQUIRED=ON +-DSUPPORT_ANY_BASE_CONVERSION=ON +-DNF_FEATURE_DEBUGGER=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_HAS_USB_MSD=ON +-DNF_FEATURE_HAS_SDCARD=ON +-DNF_FEATURE_USE_SPIFFS=ON +-DAPI_System.Math=ON +-DAPI_Hardware.Stm32=ON +-DNF_FEATURE_HAS_CONFIG_BLOCK=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Device.Dac=ON +-DAPI_System.Net=ON +-DNF_SECURITY_MBEDTLS=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "ST_NUCLEO64_F091RC") { - Write-Error "Build not supported because this target requires a different GCC toolchain version" - - Exit 1 + + $cmakeOptions = @" +-DTOOL_HEX2DFU_PREFIX=$:env:HEX2DFU_PATH +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "ST_STM32F429I_DISCOVERY") { - $cmakeOptions = "-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 -DAPI_nanoFramework.System.Text=ON" + $cmakeOptions = @" +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_nanoFramework.Devices.Can=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "ST_STM32F769I_DISCOVERY") { - $cmakeOptions = " -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.Device.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 -DAPI_nanoFramework.System.Text=ON" + $cmakeOptions = @" +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Device.Dac=ON +-DAPI_System.Net=ON +-DNF_SECURITY_MBEDTLS=ON +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_nanoFramework.Devices.Can=ON +-DAPI_System.IO.FileSystem=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.System.Text=ON +-DAPI_nanoFramework.Graphics=ON +-DGRAPHICS_MEMORY=Graphics_Memory.cpp +-DGRAPHICS_DISPLAY=Otm8009a_DSI_Video_Mode.cpp +-DGRAPHICS_DISPLAY_INTERFACE=DSI_To_Display_Video_Mode.cpp +-DTOUCHPANEL_DEVICE=ft6x06_I2C.cpp +-DTOUCHPANEL_INTERFACE=I2C_To_TouchPanel.cpp +"@ } - + # CMake prep - $cmakePrep = " -G Ninja -DCMAKE_TOOLCHAIN_FILE=""CMake/toolchain.arm-none-eabi.cmake"" -DTOOLCHAIN_PREFIX=""$env:GNU_GCC_TOOLCHAIN_PATH"" -DCMAKE_BUILD_TYPE=Debug -DBUILD_VERSION=9.9.99.99 -DTARGET_BOARD=$TargetBoard $cmakeOptions .." + $cmakePrep = @" +-G Ninja +-DCMAKE_TOOLCHAIN_FILE="CMake/toolchain.arm-none-eabi.cmake" +-DTOOLCHAIN_PREFIX="$env:GNU_GCC_TOOLCHAIN_PATH" +-DCMAKE_BUILD_TYPE=Debug +-DBUILD_VERSION=9.9.99.99 +-DTARGET_BOARD=$TargetBoard +$cmakeOptions +.. +"@ } elseif ($TargetBoard -eq "ESP32_WROOM_32") { # run the install tools Invoke-Expression "$PSScriptRoot\install-scripts\install-esp32-tools.ps1 -Path $Path" - $cmakeOptions = " -DTARGET_SERIES=ESP32 -DRTOS=ESP32 -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.IO.FileSystem=ON -DAPI_System.Math=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Net=ON -DAPI_Windows.Devices.Wifi=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 -DAPI_nanoFramework.System.Text=ON -DAPI_nanoFramework.Hardware.Esp32.Rmt=ON -DAPI_System.Device.Dac=ON " - + $cmakeOptions = @" +-DTARGET_SERIES=ESP32 +-DRTOS=ESP32 +-DNF_FEATURE_DEBUGGER=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_HAS_CONFIG_BLOCK=ON +-DNF_FEATURE_HAS_SDCARD=ON +-DAPI_System.IO.FileSystem=ON +-DAPI_System.Math=ON +-DAPI_Windows.Devices.Gpio=ON +-DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON +-DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON +-DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON +-DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON +-DAPI_System.Net=ON +-DAPI_System.Device.WiFi=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 +-DAPI_nanoFramework.System.Text=ON +-DAPI_nanoFramework.Hardware.Esp32.Rmt=ON +-DAPI_System.Device.Dac=ON +"@ + # CMake prep - $cmakePrep = " -G Ninja -DCMAKE_TOOLCHAIN_FILE=""CMake/toolchain.xtensa-esp32-elf.cmake"" -DCMAKE_BUILD_TYPE=Debug -DBUILD_VERSION=9.99.999 -DTARGET_BOARD=$TargetBoard -DTARGET_NAME=$TargetBoard $cmakeOptions .." + $cmakePrep = @" +-G Ninja +"-DCMAKE_TOOLCHAIN_FILE="CMake/toolchain.xtensa-esp32-elf.cmake"" +-DCMAKE_BUILD_TYPE=Debug +-DBUILD_VERSION=9.99.999 +-DTARGET_BOARD=$TargetBoard +-DTARGET_NAME=$TargetBoard +$cmakeOptions +.. +"@ } elseif ($TargetBoard -eq "TI_CC3220SF_LAUNCHXL") { # TODO @@ -71,11 +207,35 @@ elseif ($TargetBoard -eq "TI_CC1352R1_LAUNCHXL") { Invoke-Expression "$PSScriptRoot\install-scripts\install-stm32-tools.ps1 -Path $Path" If ( $TargetBoard -eq "TI_CC1352R1_LAUNCHXL" ) { - $cmakeOptions = " -DTARGET_SERIES=CC13x2_26x2 -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=OFF -DAPI_Windows.Devices.I2c=OFF -DAPI_Windows.Devices.Pwm=OFF -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=OFF -DAPI_nanoFramework.TI.EasyLink=ON" + $cmakeOptions = @" +-DTARGET_SERIES=CC13X2 +-DRTOS=TI_SimpleLink +-DRADIO_FREQUENCY=915 +-DSUPPORT_ANY_BASE_CONVERSION=OFF +-DNF_FEATURE_DEBUGGER=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_WATCHDOG=OFF +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=OFF +-DAPI_Windows.Devices.I2c=OFF +-DAPI_Windows.Devices.Pwm=OFF +-DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_System.IO.Ports=OFF +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_nanoFramework.TI.EasyLink=ON +-DAPI_nanoFramework.Hardware.TI=ON +"@ } - + # CMake prep - $cmakePrep = " -G Ninja -DCMAKE_TOOLCHAIN_FILE=""CMake/toolchain.arm-none-eabi.cmake"" -DTOOLCHAIN_PREFIX=""$env:GNU_GCC_TOOLCHAIN_PATH"" -DCMAKE_BUILD_TYPE=Debug -DBUILD_VERSION=9.99.999 -DTARGET_BOARD=$TargetBoard $cmakeOptions .." + $cmakePrep = @" +-G Ninja +-DCMAKE_TOOLCHAIN_FILE="CMake/toolchain.arm-none-eabi.cmake" +-DTOOLCHAIN_PREFIX="$env:GNU_GCC_TOOLCHAIN_PATH" +-DCMAKE_BUILD_TYPE=Debug +-DBUILD_VERSION=9.99.999 +-DTARGET_BOARD=$TargetBoard $cmakeOptions +.. +"@ } elseif ($TargetBoard -eq "NXP_MIMXRT1060_EVK") { # TODO @@ -83,7 +243,8 @@ elseif ($TargetBoard -eq "NXP_MIMXRT1060_EVK") { Exit 1 } -elseif ($TargetBoard -eq "GHI_FEZ_CERB40_NF" -or +elseif ($TargetBoard -eq "GHI_FEZ_CERB40_NF" -or + $TargetBoard -eq "NETDUINO3_WIFI" -or $TargetBoard -eq "I2M_ELECTRON_NF" -or $TargetBoard -eq "I2M_OXYGEN_NF" -or $TargetBoard -eq "ST_NUCLEO64_F401RE_NF" -or @@ -100,49 +261,274 @@ elseif ($TargetBoard -eq "GHI_FEZ_CERB40_NF" -or # community targets with STM32 If ($TargetBoard -eq "GHI_FEZ_CERB40_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +"@ + } + elseif ($TargetBoard -eq "NETDUINO3_WIFI") { + $cmakeOptions = @" +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Device.Dac=OFF +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "I2M_ELECTRON_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=OFF -DNF_FEATURE_RTC=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DUSE_RNG=OFF +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +"@ } elseif ($TargetBoard -eq "I2M_OXYGEN_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=OFF -DNF_FEATURE_RTC=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DUSE_RNG=OFF +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Math=ON +-DAPI_Hardware.Stm32=ON +"@ } elseif ($TargetBoard -eq "ST_NUCLEO64_F401RE_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=OFF -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DNF_FEATURE_DEBUGGER=ON +-DUSE_RNG=OFF +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=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 +"@ } elseif ($TargetBoard -eq "ST_NUCLEO64_F411RE_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=OFF -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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.System.Collections=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Text=ON" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DUSE_RNG=OFF +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Text=ON +-DAPI_System.Math=ON +-DAPI_Hardware.Stm32=ON +"@ } elseif ($TargetBoard -eq "ST_STM32F411_DISCOVERY") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DUSE_RNG=OFF -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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.System.Collections=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Text=ON" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DUSE_RNG=OFF +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "ST_NUCLEO144_F412ZG_NF") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +"@ } elseif ($TargetBoard -eq "ST_NUCLEO144_F746ZG") { - $cmakeOptions = " -DTARGET_SERIES=STM32F7xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=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 -DAPI_nanoFramework.Devices.OneWire=ON" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F7xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_HAS_CONFIG_BLOCK=ON +-DAPI_System.Math=ON +-DAPI_Hardware.Stm32=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Net=ON +-DNF_SECURITY_MBEDTLS=ON +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Text=ON +"@ } elseif ($TargetBoard -eq "ST_STM32F4_DISCOVERY") { - $cmakeOptions = " -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" + $cmakeOptions = @" +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_nanoFramework.Devices.Can=ON +"@ } elseif ($TargetBoard -eq "ST_NUCLEO144_F439ZI") { - $cmakeOptions = " -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DNF_FEATURE_DEBUGGER=ON -DSWO_OUTPUT=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_CONFIG_BLOCK=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" + $cmakeOptions = @" +-DTARGET_SERIES=STM32F4xx +-DRTOS=ChibiOS +-DNF_FEATURE_DEBUGGER=ON +-DSWO_OUTPUT=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_HAS_CONFIG_BLOCK=ON +-DAPI_System.Math=ON +-DAPI_Hardware.Stm32=ON +-DAPI_Windows.Devices.Gpio=ON -DAPI_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_Windows.Devices.Adc=ON -DAPI_System.Device.Adc=ON +-DAPI_System.Net=ON +-DNF_SECURITY_MBEDTLS=ON +"@ } elseif ( $TargetBoard -eq "MBN_QUAIL" ) { - $cmakeOptions = " -DTOOL_HEX2DFU_PREFIX=$:env:HEX2DFU_PATH -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 -DAPI_nanoFramework.System.Text=ON" + $cmakeOptions = @" +-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_System.Device.Gpio=ON +-DAPI_Windows.Devices.Spi=ON -DAPI_System.Device.Spi=ON +-DAPI_Windows.Devices.I2c=ON -DAPI_System.Device.I2c=ON +-DAPI_Windows.Devices.Pwm=ON -DAPI_System.Device.Pwm=ON +-DAPI_Windows.Devices.SerialCommunication=ON -DAPI_System.IO.Ports=ON +-DAPI_nanoFramework.Devices.OneWire=ON +-DAPI_Windows.Storage=ON +-DAPI_nanoFramework.ResourceManager=ON +-DAPI_nanoFramework.System.Collections=ON +-DAPI_nanoFramework.System.Text=ON +"@ } - + # CMake prep - $cmakePrep = " -G Ninja -DCMAKE_TOOLCHAIN_FILE=""CMake/toolchain.arm-none-eabi.cmake"" -DTOOLCHAIN_PREFIX=""$env:GNU_GCC_TOOLCHAIN_PATH"" -DCMAKE_BUILD_TYPE=Debug -DBUILD_VERSION=9.9.99.99 -DTARGET_BOARD=$TargetBoard $cmakeOptions .." + $cmakePrep = @" +-G Ninja +-DCMAKE_TOOLCHAIN_FILE="CMake/toolchain.arm-none-eabi.cmake" +-DTOOLCHAIN_PREFIX="$env:GNU_GCC_TOOLCHAIN_PATH" +-DCMAKE_BUILD_TYPE=Debug +-DBUILD_VERSION=9.9.99.99 +-DTARGET_BOARD=$TargetBoard +$cmakeOptions +.. +"@ } elseif ($TargetBoard -eq "TI_CC1352P1_LAUNCHXL") { # community targets with TI CC13xx - $cmakeOptions = " -DTARGET_SERIES=CC13x2_26x2 -DRTOS=TI_SIMPLELINK -DSUPPORT_ANY_BASE_CONVERSION=OFF -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_WATCHDOG=OFF -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=OFF -DAPI_Windows.Devices.I2c=OFF -DAPI_Windows.Devices.Pwm=OFF -DAPI_Windows.Devices.SerialCommunication=OFF -DAPI_Windows.Devices.Adc=OFF -DAPI_nanoFramework.TI.EasyLink=ON" - + $cmakeOptions = @" +-DTARGET_SERIES=CC13x2_26x2 +-DRTOS=TI_SIMPLELINK +-DSUPPORT_ANY_BASE_CONVERSION=OFF +-DNF_FEATURE_DEBUGGER=ON +-DNF_FEATURE_RTC=ON +-DNF_FEATURE_WATCHDOG=OFF +-DAPI_Windows.Devices.Gpio=ON +-DAPI_Windows.Devices.Spi=OFF +-DAPI_Windows.Devices.I2c=OFF +-DAPI_Windows.Devices.Pwm=OFF +-DAPI_Windows.Devices.SerialCommunication=OFF +-DAPI_Windows.Devices.Adc=OFF +-DAPI_nanoFramework.TI.EasyLink=ON +"@ + # CMake prep - $cmakePrep = " -G Ninja -DCMAKE_TOOLCHAIN_FILE=""CMake/toolchain.arm-none-eabi.cmake"" -DTOOLCHAIN_PREFIX=""$env:GNU_GCC_TOOLCHAIN_PATH"" -DCMAKE_BUILD_TYPE=Debug -DBUILD_VERSION=9.9.99.99 -DTARGET_BOARD=$TargetBoard $cmakeOptions .." + $cmakePrep = @" +-G Ninja +-DCMAKE_TOOLCHAIN_FILE="CMake/toolchain.arm-none-eabi.cmake" +-DTOOLCHAIN_PREFIX="$env:GNU_GCC_TOOLCHAIN_PATH" +-DCMAKE_BUILD_TYPE=Debug +-DBUILD_VERSION=9.9.99.99 +-DTARGET_BOARD=$TargetBoard +$cmakeOptions +.. +"@ } else { Write-Error "Unknown target name." @@ -152,6 +538,7 @@ else { $cmake = (Get-Command "cmake.exe" -ErrorAction SilentlyContinue) # output CMake command +$cmakePrep = $cmakePrep -replace "`r`n",' ' "Just in case you're curious on what the call to CMake is, here's the command line for preparation:" | Write-Host -ForegroundColor White Write-Host "'cmake $cmakePrep'" | Write-Host -ForegroundColor White diff --git a/src/CLR/CorLib/corlib_native.cpp b/src/CLR/CorLib/corlib_native.cpp index 15c6caba15..4cb578e0bc 100644 --- a/src/CLR/CorLib/corlib_native.cpp +++ b/src/CLR/CorLib/corlib_native.cpp @@ -71,6 +71,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, Library_corlib_native_System_Type::InvokeMember___OBJECT__STRING__SystemReflectionBindingFlags__SystemReflectionBinder__OBJECT__SZARRAY_OBJECT, Library_corlib_native_System_Type::GetConstructor___SystemReflectionConstructorInfo__SZARRAY_SystemType, + Library_corlib_native_System_Type::GetConstructors___SZARRAY_SystemReflectionConstructorInfo, Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING__SZARRAY_SystemType, Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING, NULL, @@ -106,6 +107,11 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, + NULL, + NULL, + NULL, Library_corlib_native_System_String::CompareTo___I4__OBJECT, NULL, Library_corlib_native_System_String::get_Chars___CHAR__I4, @@ -290,6 +296,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Collections_ArrayList::get_Item___OBJECT__I4, Library_corlib_native_System_Collections_ArrayList::set_Item___VOID__I4__OBJECT, Library_corlib_native_System_Collections_ArrayList::Add___I4__OBJECT, @@ -318,9 +325,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, Library_corlib_native_System_Double::CompareTo___STATIC__I4__R8__R8, Library_corlib_native_System_Double::IsInfinity___STATIC__BOOLEAN__R8, Library_corlib_native_System_Double::IsNaN___STATIC__BOOLEAN__R8, @@ -328,8 +332,6 @@ static const CLR_RT_MethodHandler method_lookup[] = Library_corlib_native_System_Double::IsPositiveInfinity___STATIC__BOOLEAN__R8, NULL, NULL, - Library_corlib_native_System_Convert::NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4, - Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING, NULL, NULL, NULL, @@ -347,15 +349,18 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_Convert::ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN, - Library_corlib_native_System_Convert::FromBase64String___STATIC__SZARRAY_U1__STRING, NULL, NULL, NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::Equals___BOOLEAN__OBJECT, + Library_corlib_native_System_TimeSpan::ToString___STRING, NULL, NULL, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -368,17 +373,15 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::CompareTo___I4__OBJECT, NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::Compare___STATIC__I4__SystemTimeSpan__SystemTimeSpan, + Library_corlib_native_System_TimeSpan::Equals___STATIC__BOOLEAN__SystemTimeSpan__SystemTimeSpan, NULL, - Library_corlib_native_System_TimeSpan::Equals___BOOLEAN__OBJECT, - Library_corlib_native_System_TimeSpan::ToString___STRING, NULL, NULL, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -391,18 +394,16 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_TimeSpan::CompareTo___I4__OBJECT, NULL, NULL, NULL, - Library_corlib_native_System_TimeSpan::Compare___STATIC__I4__SystemTimeSpan__SystemTimeSpan, - Library_corlib_native_System_TimeSpan::Equals___STATIC__BOOLEAN__SystemTimeSpan__SystemTimeSpan, NULL, NULL, NULL, NULL, NULL, NULL, + Library_corlib_native_System_DateTime::_ctor___VOID__I4__I4__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -421,7 +422,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_DateTime::_ctor___VOID__I4__I4__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -431,8 +431,12 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_DateTime::GetDateTimePart___I4__SystemDateTimeDateTimePart, NULL, + Library_corlib_native_System_DateTime::DaysInMonth___STATIC__I4__I4__I4, NULL, + Library_corlib_native_System_DateTime::get_UtcNow___STATIC__SystemDateTime, + Library_corlib_native_System_DateTime::get_Today___STATIC__SystemDateTime, NULL, NULL, NULL, @@ -446,15 +450,15 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_Convert::NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4__BOOLEAN__BYREF_BOOLEAN, + Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING__BOOLEAN__BYREF_BOOLEAN, + Library_corlib_native_System_Convert::NativeToDateTime___STATIC__SystemDateTime__STRING__BOOLEAN__BYREF_BOOLEAN, + NULL, NULL, NULL, NULL, - Library_corlib_native_System_DateTime::GetDateTimePart___I4__SystemDateTimeDateTimePart, NULL, - Library_corlib_native_System_DateTime::DaysInMonth___STATIC__I4__I4__I4, NULL, - Library_corlib_native_System_DateTime::get_UtcNow___STATIC__SystemDateTime, - Library_corlib_native_System_DateTime::get_Today___STATIC__SystemDateTime, NULL, NULL, NULL, @@ -466,6 +470,10 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + Library_corlib_native_System_Convert::ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN, + Library_corlib_native_System_Convert::FromBase64String___STATIC__SZARRAY_U1__STRING, + NULL, Library_corlib_native_System_Delegate::Equals___BOOLEAN__OBJECT, Library_corlib_native_System_Delegate::GetInvocationList___SZARRAY_SystemDelegate, Library_corlib_native_System_Delegate::get_Method___SystemReflectionMethodInfo, @@ -488,6 +496,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Reflection_Assembly::get_FullName___STRING, Library_corlib_native_System_Reflection_Assembly::GetType___SystemType__STRING, NULL, @@ -560,6 +569,8 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, Library_corlib_native_System_Guid::GenerateNewGuid___STATIC__SZARRAY_U1, NULL, NULL, @@ -653,6 +664,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Reflection_MethodBase::get_Name___STRING, Library_corlib_native_System_Reflection_MethodBase::get_DeclaringType___SystemType, Library_corlib_native_System_Reflection_MethodBase::get_IsPublic___BOOLEAN, @@ -661,12 +673,16 @@ static const CLR_RT_MethodHandler method_lookup[] = Library_corlib_native_System_Reflection_MethodBase::get_IsVirtual___BOOLEAN, Library_corlib_native_System_Reflection_MethodBase::get_IsAbstract___BOOLEAN, Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJECT__SZARRAY_OBJECT, + Library_corlib_native_System_Reflection_MethodBase::GetParametersNative___SZARRAY_SystemReflectionParameterInfo, + NULL, + NULL, NULL, NULL, Library_corlib_native_System_Reflection_PropertyInfo::GetValue___OBJECT__OBJECT__SZARRAY_OBJECT, Library_corlib_native_System_Reflection_PropertyInfo::SetValue___VOID__OBJECT__OBJECT__SZARRAY_OBJECT, NULL, NULL, + NULL, Library_corlib_native_System_Reflection_RuntimeFieldInfo::get_Name___STRING, Library_corlib_native_System_Reflection_RuntimeFieldInfo::get_DeclaringType___SystemType, Library_corlib_native_System_Reflection_RuntimeFieldInfo::get_FieldType___SystemType, @@ -674,6 +690,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, Library_corlib_native_System_Reflection_RuntimeMethodInfo::get_ReturnType___SystemType, NULL, + NULL, Library_corlib_native_System_Reflection_RuntimeMethodInfo::GetCustomAttributesNative___SZARRAY_OBJECT__BOOLEAN, NULL, NULL, @@ -732,6 +749,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Threading_AutoResetEvent::_ctor___VOID__BOOLEAN, Library_corlib_native_System_Threading_AutoResetEvent::Reset___BOOLEAN, Library_corlib_native_System_Threading_AutoResetEvent::Set___BOOLEAN, @@ -793,6 +811,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_ValueType::Equals___BOOLEAN__OBJECT, NULL, NULL, @@ -862,6 +881,11 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, + NULL, + NULL, + NULL, Library_corlib_native_System_String::CompareTo___I4__OBJECT, NULL, Library_corlib_native_System_String::get_Chars___CHAR__I4, @@ -1044,6 +1068,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Collections_ArrayList::get_Item___OBJECT__I4, Library_corlib_native_System_Collections_ArrayList::set_Item___VOID__I4__OBJECT, Library_corlib_native_System_Collections_ArrayList::Add___I4__OBJECT, @@ -1070,9 +1095,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - NULL, - NULL, - NULL, Library_corlib_native_System_Double::CompareTo___STATIC__I4__R8__R8, Library_corlib_native_System_Double::IsInfinity___STATIC__BOOLEAN__R8, Library_corlib_native_System_Double::IsNaN___STATIC__BOOLEAN__R8, @@ -1080,8 +1102,6 @@ static const CLR_RT_MethodHandler method_lookup[] = Library_corlib_native_System_Double::IsPositiveInfinity___STATIC__BOOLEAN__R8, NULL, NULL, - Library_corlib_native_System_Convert::NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4, - Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING, NULL, NULL, NULL, @@ -1099,15 +1119,18 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_Convert::ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN, - Library_corlib_native_System_Convert::FromBase64String___STATIC__SZARRAY_U1__STRING, NULL, NULL, NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::Equals___BOOLEAN__OBJECT, + Library_corlib_native_System_TimeSpan::ToString___STRING, NULL, NULL, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4, + Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -1120,17 +1143,15 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::CompareTo___I4__OBJECT, NULL, NULL, NULL, + Library_corlib_native_System_TimeSpan::Compare___STATIC__I4__SystemTimeSpan__SystemTimeSpan, + Library_corlib_native_System_TimeSpan::Equals___STATIC__BOOLEAN__SystemTimeSpan__SystemTimeSpan, NULL, - Library_corlib_native_System_TimeSpan::Equals___BOOLEAN__OBJECT, - Library_corlib_native_System_TimeSpan::ToString___STRING, NULL, NULL, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4, - Library_corlib_native_System_TimeSpan::_ctor___VOID__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -1143,18 +1164,16 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_TimeSpan::CompareTo___I4__OBJECT, NULL, NULL, NULL, - Library_corlib_native_System_TimeSpan::Compare___STATIC__I4__SystemTimeSpan__SystemTimeSpan, - Library_corlib_native_System_TimeSpan::Equals___STATIC__BOOLEAN__SystemTimeSpan__SystemTimeSpan, NULL, NULL, NULL, NULL, NULL, NULL, + Library_corlib_native_System_DateTime::_ctor___VOID__I4__I4__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -1173,7 +1192,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_corlib_native_System_DateTime::_ctor___VOID__I4__I4__I4__I4__I4__I4__I4, NULL, NULL, NULL, @@ -1183,8 +1201,12 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_DateTime::GetDateTimePart___I4__SystemDateTimeDateTimePart, NULL, + Library_corlib_native_System_DateTime::DaysInMonth___STATIC__I4__I4__I4, NULL, + Library_corlib_native_System_DateTime::get_UtcNow___STATIC__SystemDateTime, + Library_corlib_native_System_DateTime::get_Today___STATIC__SystemDateTime, NULL, NULL, NULL, @@ -1198,15 +1220,15 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_corlib_native_System_Convert::NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4__BOOLEAN__BYREF_BOOLEAN, + Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING__BOOLEAN__BYREF_BOOLEAN, + Library_corlib_native_System_Convert::NativeToDateTime___STATIC__SystemDateTime__STRING__BOOLEAN__BYREF_BOOLEAN, + NULL, NULL, NULL, NULL, - Library_corlib_native_System_DateTime::GetDateTimePart___I4__SystemDateTimeDateTimePart, NULL, - Library_corlib_native_System_DateTime::DaysInMonth___STATIC__I4__I4__I4, NULL, - Library_corlib_native_System_DateTime::get_UtcNow___STATIC__SystemDateTime, - Library_corlib_native_System_DateTime::get_Today___STATIC__SystemDateTime, NULL, NULL, NULL, @@ -1218,6 +1240,10 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + Library_corlib_native_System_Convert::ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN, + Library_corlib_native_System_Convert::FromBase64String___STATIC__SZARRAY_U1__STRING, + NULL, Library_corlib_native_System_Delegate::Equals___BOOLEAN__OBJECT, NULL, Library_corlib_native_System_Delegate::Combine___STATIC__SystemDelegate__SystemDelegate__SystemDelegate, @@ -1290,6 +1316,8 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, Library_corlib_native_System_Guid::GenerateNewGuid___STATIC__SZARRAY_U1, NULL, NULL, @@ -1406,6 +1434,7 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, Library_corlib_native_System_Threading_AutoResetEvent::_ctor___VOID__BOOLEAN, Library_corlib_native_System_Threading_AutoResetEvent::Reset___BOOLEAN, Library_corlib_native_System_Threading_AutoResetEvent::Set___BOOLEAN, @@ -1467,6 +1496,8 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, Library_corlib_native_System_ValueType::Equals___BOOLEAN__OBJECT, NULL, NULL, @@ -1494,18 +1525,18 @@ const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib = #if (NANOCLR_REFLECTION == TRUE) - 0xC5322585, + 0xE7505F22, #elif (NANOCLR_REFLECTION == FALSE) - 0xB0016E1F, + 0xEFFF17F8, #else #error "NANOCLR_REFLECTION has to be define either TRUE or FALSE. Check the build options." #endif method_lookup, - { 100, 5, 0, 14 } + { 100, 5, 0, 16 } }; // clang-format on diff --git a/src/CLR/CorLib/corlib_native.h b/src/CLR/CorLib/corlib_native.h index cfd5a5c4dc..6522e59d77 100644 --- a/src/CLR/CorLib/corlib_native.h +++ b/src/CLR/CorLib/corlib_native.h @@ -116,6 +116,7 @@ struct Library_corlib_native_System_Type NANOCLR_NATIVE_DECLARE( InvokeMember___OBJECT__STRING__SystemReflectionBindingFlags__SystemReflectionBinder__OBJECT__SZARRAY_OBJECT); NANOCLR_NATIVE_DECLARE(GetConstructor___SystemReflectionConstructorInfo__SZARRAY_SystemType); + NANOCLR_NATIVE_DECLARE(GetConstructors___SZARRAY_SystemReflectionConstructorInfo); NANOCLR_NATIVE_DECLARE(GetMethod___SystemReflectionMethodInfo__STRING__SZARRAY_SystemType); NANOCLR_NATIVE_DECLARE(GetMethod___SystemReflectionMethodInfo__STRING); NANOCLR_NATIVE_DECLARE(get_IsNotPublic___BOOLEAN); @@ -487,8 +488,9 @@ struct Library_corlib_native_System_Double struct Library_corlib_native_System_Convert { - NANOCLR_NATIVE_DECLARE(NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4); - NANOCLR_NATIVE_DECLARE(NativeToDouble___STATIC__R8__STRING); + NANOCLR_NATIVE_DECLARE(NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4__BOOLEAN__BYREF_BOOLEAN); + NANOCLR_NATIVE_DECLARE(NativeToDouble___STATIC__R8__STRING__BOOLEAN__BYREF_BOOLEAN); + NANOCLR_NATIVE_DECLARE(NativeToDateTime___STATIC__SystemDateTime__STRING__BOOLEAN__BYREF_BOOLEAN); NANOCLR_NATIVE_DECLARE(ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN); NANOCLR_NATIVE_DECLARE(FromBase64String___STATIC__SZARRAY_U1__STRING); @@ -497,6 +499,7 @@ struct Library_corlib_native_System_Convert static double GetDoubleFractionalPart(char *str, int length); static int64_t GetIntegerPart(char *str, int length); static int64_t GetIntegerFromHexString(char *str); + static char *Nano_strptime(const char *buf, const char *fmt, uint64_t *ticks); }; struct Library_corlib_native_System_Globalization_DateTimeFormatInfo @@ -857,6 +860,7 @@ struct Library_corlib_native_System_Reflection_MemberTypes struct Library_corlib_native_System_Reflection_MethodBase { + static const int FIELD___token = 1; NANOCLR_NATIVE_DECLARE(get_Name___STRING); NANOCLR_NATIVE_DECLARE(get_DeclaringType___SystemType); @@ -866,6 +870,7 @@ struct Library_corlib_native_System_Reflection_MethodBase NANOCLR_NATIVE_DECLARE(get_IsVirtual___BOOLEAN); NANOCLR_NATIVE_DECLARE(get_IsAbstract___BOOLEAN); NANOCLR_NATIVE_DECLARE(Invoke___OBJECT__OBJECT__SZARRAY_OBJECT); + NANOCLR_NATIVE_DECLARE(GetParametersNative___SZARRAY_SystemReflectionParameterInfo); //--// @@ -878,6 +883,15 @@ struct Library_corlib_native_System_Reflection_MethodBase #endif // NANOCLR_REFLECTION }; +#if (NANOCLR_REFLECTION == TRUE) +struct Library_corlib_native_System_Reflection_ParameterInfo +{ + static const int FIELD___parameterType = 1; + + //--// +}; +#endif // NANOCLR_REFLECTION + struct Library_corlib_native_System_Reflection_ProcessorArchitecture { @@ -1207,4 +1221,4 @@ struct Library_corlib_native_System_WeakReference extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib; -#endif //CORLIB_NATIVE_H +#endif // CORLIB_NATIVE_H diff --git a/src/CLR/CorLib/corlib_native_System_Convert.cpp b/src/CLR/CorLib/corlib_native_System_Convert.cpp index 4f4a0a55ac..8b5fe57b71 100644 --- a/src/CLR/CorLib/corlib_native_System_Convert.cpp +++ b/src/CLR/CorLib/corlib_native_System_Convert.cpp @@ -1,6 +1,7 @@ // // Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// Portions Copyright (C) 2002-2019 Free Software Foundation, Inc. All rights reserved. // See LICENSE file in the project root for full license information. // @@ -12,456 +13,578 @@ // and lower (HAL). Win32 does not use it #include -HRESULT Library_corlib_native_System_Convert::NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4( - CLR_RT_StackFrame &stack) +// remap this namespace to have better code readability +typedef Library_corlib_native_System_DateTime DateTime; + +HRESULT Library_corlib_native_System_Convert:: + NativeToInt64___STATIC__I8__STRING__BOOLEAN__I8__I8__I4__BOOLEAN__BYREF_BOOLEAN(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); - { - int64_t result = 0; - char *str = (char *)stack.Arg0().RecoverString(); - signed int radix = stack.Arg4().NumericByRef().s4; - bool isUInt64 = false; + char *endptr; + int64_t result = 0; - bool isSigned = (bool)stack.Arg1().NumericByRef().u1; - bool negReturnExpected = false; +#if (SUPPORT_ANY_BASE_CONVERSION == TRUE) + // convert via strtoll / strtoull + int error_code; +#else + uint64_t intPart = 0; + uint64_t lastValue = 0; +#endif - long long minValue = stack.Arg2().NumericByRef().s8; - long long maxValue = stack.Arg3().NumericByRef().s8; - if (minValue == 0 && maxValue == 0) - { - isUInt64 = true; - isSigned = false; - } + char *str = (char *)stack.Arg0().RecoverString(); + signed int radix = stack.Arg4().NumericByRef().s4; + bool isUInt64 = false; - // allow spaces before digits - while (*str == ' ') - { - str++; - } - char *endptr = NULL; + bool isSigned = (bool)stack.Arg1().NumericByRef().u1; + bool negReturnExpected = false; - // empty string gets a format exception - if (*str == 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + long long minValue = stack.Arg2().NumericByRef().s8; + long long maxValue = stack.Arg3().NumericByRef().s8; + if (minValue == 0 && maxValue == 0) + { + isUInt64 = true; + isSigned = false; + } -#if (SUPPORT_ANY_BASE_CONVERSION == TRUE) - // suport for conversion from any base + // grab parameter with flag to throw on failure + bool throwOnFailure = (bool)stack.Arg5().NumericByRefConst().u1; - if (*str == '-') - { - negReturnExpected = true; - } + // check string parameter for null + FAULT_ON_NULL_ARG(str); + + // allow spaces before digits + while (*str == ' ') + { + str++; + } + endptr = NULL; - // convert via strtoll / strtoull - int error_code; +#if (SUPPORT_ANY_BASE_CONVERSION == TRUE) + // support for conversion from any base + + if (*str == '-') + { + negReturnExpected = true; + } - // Have to use reentrant version of strtoll because lwip sets _REENT_ONLY to require all stdlib calls - // to be reentrant + // Have to use reentrant version of strtoll because lwip sets _REENT_ONLY to require all stdlib calls + // to be reentrant #ifdef _REENT_ONLY - _reent reent_data; - reent_data._errno = 0; - result = isSigned ? _strtoll_r(&reent_data, str, &endptr, radix) - : (long long)_strtoull_r(&reent_data, str, &endptr, radix); - error_code = (int)reent_data._errno; + _reent reent_data; + reent_data._errno = 0; + result = isSigned ? _strtoll_r(&reent_data, str, &endptr, radix) + : (long long)_strtoull_r(&reent_data, str, &endptr, radix); + error_code = (int)reent_data._errno; #else - errno = 0; - result = isSigned ? strtoll(str, &endptr, radix) : (long long)strtoull(str, &endptr, radix); - error_code = errno; + errno = 0; + result = isSigned ? strtoll(str, &endptr, radix) : (long long)strtoull(str, &endptr, radix); + error_code = errno; #endif //_REENT_ONLY - // catch the case of exceeding signed/unsigned int64. Catch formatting errors in the next statement - if (error_code == ERANGE) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } + // catch the case of exceeding signed/unsigned int64. Catch formatting errors in the next statement + if (error_code == ERANGE) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } - // if no valid conversion endptr is equal str - if (str == endptr) - { - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + // if no valid conversion endptr is equal str + if (str == endptr) + { + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } - // allow spaces after digits - while (*endptr == ' ') - { - endptr++; - } + // allow spaces after digits + while (*endptr == ' ') + { + endptr++; + } - // should reach end of string no aditional chars - if (*endptr != 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + // should reach end of string no aditional chars + if (*endptr != 0) + { + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } - // the signed values for SByte, Int16 and Int32 are always positive for base 2, 8 or 16 conversions - // because the 64-bit function strtoll is used; need the post process the value - // if the result is greater max and smaller (max + 1) * 2 this value should be subtracted - if (radix == 2 || radix == 8 || radix == 16) + // the signed values for SByte, Int16 and Int32 are always positive for base 2, 8 or 16 conversions + // because the 64-bit function strtoll is used; need the post process the value + // if the result is greater max and smaller (max + 1) * 2 this value should be subtracted + if (radix == 2 || radix == 8 || radix == 16) + { + if (isSigned && result > maxValue && result < (maxValue + 1) * 2) { - if (isSigned && result > maxValue && result < (maxValue + 1) * 2) - { - result -= (maxValue + 1) * 2; - } + result -= (maxValue + 1) * 2; } + } - if (negReturnExpected && isSigned == false && result != 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } + if (negReturnExpected && isSigned == false && result != 0) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } - // Check min and max values for the smaller integers - the stroll and stroull will catch int64 excesses - if (!isUInt64 && !isSigned && (uint64_t)result > (uint64_t)maxValue) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } - else if (!isUInt64 && (result > maxValue || result < minValue)) + // Check min and max values for the smaller integers - the stroll and stroull will catch int64 excesses + if (!isUInt64 && !isSigned && (uint64_t)result > (uint64_t)maxValue) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } + else if (!isUInt64 && (result > maxValue || result < minValue)) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } + else + { + stack.SetResult_I8(result); + } + +#else + + // support for conversion from base 10 and 16 (partial) + if (radix == 10) + { + // conversion from base 10 + + // check for minus sign + if (*str == '-') { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + negReturnExpected = true; + str++; } - else + else if (*str == '+') { - stack.SetResult_I8(result); + str++; } - } - NANOCLR_NOCLEANUP(); -#else - // support for conversion from base 10 and 16 (partial) - if (radix == 10) - { - // conversion from base 10 - - // check for minus sign - if (*str == '-') - { - negReturnExpected = true; - str++; - } - else if (*str == '+') - { - str++; - } - uint64_t intPart = 0; - uint64_t lastValue = 0; + intPart = 0; + lastValue = 0; - // guess at no more than 99 characters - for (int i = 0; i < 99; i++) + // guess at no more than 99 characters + for (int i = 0; i < 99; i++) + { + if (*str < '0' || *str > '9') { - if (*str < '0' || *str > '9') - { - endptr = str; - - // allow spaces after digits - while (*endptr == ' ') - { - endptr++; - } - - // should reach end of string no aditional chars - if (*endptr == 0) - { - break; - } + endptr = str; - // non-numeric (and not trailing space) - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } - - // advance the digits and add the current number - intPart = (intPart * 10) + (*str - '0'); - - if (intPart < lastValue) + // allow spaces after digits + while (*endptr == ' ') { - // the above operation overflowed the value - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + endptr++; } - lastValue = intPart; - - str++; - if (*str == '\0') + // should reach end of string no aditional chars + if (*endptr == 0) { break; } + + // non-numeric (and not trailing space) + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); } - // intPart now holds a positive number from the string. - if (negReturnExpected) + // advance the digits and add the current number + intPart = (intPart * 10) + (*str - '0'); + + if (intPart < lastValue) { - // it's ok to use -0 even for unsigned types, but otherwise - NO. - if (isSigned == false && intPart > 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } + // the above operation overflowed the value + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } - // too big to make a negative value? - if (intPart > (uint64_t)(minValue * -1)) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } + lastValue = intPart; - result = intPart * -1; - } - else + str++; + if (*str == '\0') { - // result will be negative for large uints, and we checked for overflow above - if (isUInt64 == false && intPart > (uint64_t)maxValue) - { - NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); - } - - // this MAY have made the result negative by overflowing the buffer - which we do - // for uint64 logic. The c# code will cast the int64 to uint64 removing the sign - result = (int64_t)intPart; + break; } } - else if (radix == 16) + + // intPart now holds a positive number from the string. + if (negReturnExpected) { - // conversion from base 16 - result = GetIntegerFromHexString(str); - //??? check against min/max? Signed possible? + // it's ok to use -0 even for unsigned types, but otherwise - NO. + if (isSigned == false && intPart > 0) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } + + // too big to make a negative value? + if (intPart > (uint64_t)(minValue * -1)) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } + + result = intPart * -1; } else { - // all other bases are not supported - return stack.NotImplementedStub(); - } + // result will be negative for large uints, and we checked for overflow above + if (isUInt64 == false && intPart > (uint64_t)maxValue) + { + NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); + } - stack.SetResult_I8(result); - NANOCLR_NOCLEANUP(); + // this MAY have made the result negative by overflowing the buffer - which we do + // for uint64 logic. The c# code will cast the int64 to uint64 removing the sign + result = (int64_t)intPart; + } } + else if (radix == 16) + { + // conversion from base 16 + result = GetIntegerFromHexString(str); + //??? check against min/max? Signed possible? + } + else + { + // all other bases are not supported + return stack.NotImplementedStub(); + } + + stack.SetResult_I8(result); #endif // defined(SUPPORT_ANY_BASE_CONVERSION) + + NANOCLR_CLEANUP(); + + // set parameter reporting conversion success/failure + stack.Arg6().Dereference()->NumericByRef().u1 = (hr == S_OK); + + // should we throw an exception? + if (hr != S_OK && !throwOnFailure) + { + // nope! so clear the exception + hr = S_OK; + + // set return value with minimum value + stack.SetResult_I8(minValue); + } + + NANOCLR_CLEANUP_END(); } -HRESULT Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING(CLR_RT_StackFrame &stack) +HRESULT Library_corlib_native_System_Convert::NativeToDouble___STATIC__R8__STRING__BOOLEAN__BYREF_BOOLEAN( + CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); - { - char *str = (char *)stack.Arg0().RecoverString(); - // skip spaces before digits - while (*str == ' ') - { - str++; - } - // empty string gets a format exception - if (*str == 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + double returnValue = 0; #if (SUPPORT_ANY_BASE_CONVERSION == TRUE) - // suport for conversion from any base - char *endptr = str; + char *endptr; - // notice we don't try to catch errno=ERANGE - IEEE574 says overflows should just convert to infinity values - double returnValue = strtod(str, &endptr); +#else - if (endptr == str) - { - // didn't parse the string completely - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + int endOrExponentialPart; + int exponent; + double outExponent; + int length = 0; + bool hasMinusSign = false; + bool hasPlusSign = false; + int decimalPoint = -1; + int exponentialSign = -1; + bool hasMinusExponentialSign = false; + bool hasPlusExponentialSign = false; + char *temp; - // allow spaces after digits - while (*endptr == ' ') - { - endptr++; - } +#endif - // should reach end of string no aditional chars - if (*endptr != 0) - { - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + char *str = (char *)stack.Arg0().RecoverString(); - stack.SetResult_R8(returnValue); + // grab parameter with flag to throw on failure + bool throwOnFailure = (bool)stack.Arg1().NumericByRefConst().u1; + + // check string parameter for null + FAULT_ON_NULL_ARG(str); + + // skip spaces before digits + while (*str == ' ') + { + str++; } - NANOCLR_NOCLEANUP(); + +#if (SUPPORT_ANY_BASE_CONVERSION == TRUE) + // support for conversion from any base + + endptr = str; + + // notice we don't try to catch errno=ERANGE - IEEE574 says overflows should just convert to infinity values + returnValue = strtod(str, &endptr); + + if (endptr == str) + { + // didn't parse the string completely + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + + // allow spaces after digits + while (*endptr == ' ') + { + endptr++; + } + + // should reach end of string no aditional chars + if (*endptr != 0) + { + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + + stack.SetResult_R8(returnValue); #else - // support for conversion from base 10 and 16 (partial) - // in this particular function the base isn't relevant - - int length = 0; - bool hasMinusSign = false; - bool hasPlusSign = false; - int decimalPoint = -1; - int exponentialSign = -1; - bool hasMinusExponentialSign = false; - bool hasPlusExponentialSign = false; - double returnValue = 0.0; - - // first pass, get count of decimal places, integer part and check for valid chars - char *temp = str; - while (*temp != '\0') + + // support for conversion from base 10 and 16 (partial) + // in this particular function the base isn't relevant + + // first pass, get count of decimal places, integer part and check for valid chars + temp = str; + + while (*temp != '\0') + { + switch (*temp) { - switch (*temp) - { - case '-': - if (exponentialSign == -1) + case '-': + if (exponentialSign == -1) + { + if (length == 0 && hasMinusSign == false) { - if (length == 0 && hasMinusSign == false) - { - hasMinusSign = true; - - // point past the leading sign - str++; - - // don't count this in the length - length--; - } - else - { - // found a minus signal NOT at the start of the string - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + hasMinusSign = true; + + // point past the leading sign + str++; + + // don't count this in the length + length--; } else { - if (length == exponentialSign + 1) - { - hasMinusExponentialSign = true; - } - else - { - // found a minus signal NOT at the start of the exponent - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + // found a minus signal NOT at the start of the string + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); } - break; - - case '+': - if (exponentialSign == -1) + } + else + { + if (length == exponentialSign + 1) { - if (length == 0 && hasPlusSign == false) - { - hasPlusSign = true; - - // point past the leading sign - str++; - - // don't count this in the length - length--; - } - else - { - // found a plus signal NOT at the start of the string - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + hasMinusExponentialSign = true; } else { - if (length == exponentialSign + 1) - { - hasPlusExponentialSign = true; - } - else - { - // found a plus signal NOT at the start of the exponent - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } + // found a minus signal NOT at the start of the exponent + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); } - break; + } + break; - case '.': - if (decimalPoint == -1) + case '+': + if (exponentialSign == -1) + { + if (length == 0 && hasPlusSign == false) { - decimalPoint = length; + hasPlusSign = true; + + // point past the leading sign + str++; + + // don't count this in the length + length--; } else { - // already found a decimal point, can't have another + // found a plus signal NOT at the start of the string NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); } - break; - - case 'e': - case 'E': - if (exponentialSign == -1) + } + else + { + if (length == exponentialSign + 1) { - exponentialSign = length; + hasPlusExponentialSign = true; } else { - // already found a exponential sign, can't have another + // found a plus signal NOT at the start of the exponent NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); } - break; + } + break; - default: - if (*temp < '0' || *temp > '9') - { - // there is an invalid char in the string - NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); - } - } - length++; - temp++; + case '.': + if (decimalPoint == -1) + { + decimalPoint = length; + } + else + { + // already found a decimal point, can't have another + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + break; + + case 'e': + case 'E': + if (exponentialSign == -1) + { + exponentialSign = length; + } + else + { + // already found a exponential sign, can't have another + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + break; + + default: + if (*temp < '0' || *temp > '9') + { + // there is an invalid char in the string + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + } + length++; + temp++; + } + + // now parse the string according to it's format + endOrExponentialPart = exponentialSign == -1 ? length : exponentialSign; + if (decimalPoint == -1) + { + // string doesn't have fractional part, treat as integer + returnValue = GetIntegerPart(str, endOrExponentialPart); + } + else if (decimalPoint == 0) + { + // string starts with the decimal point, only has fractional part + returnValue = GetDoubleFractionalPart((str + decimalPoint + 1), (endOrExponentialPart - decimalPoint - 1)); + } + else + { + // string has integer and fractional parts + returnValue = GetIntegerPart(str, decimalPoint); + returnValue = + returnValue + GetDoubleFractionalPart((str + decimalPoint + 1), (endOrExponentialPart - decimalPoint - 1)); + if (hasMinusSign) + { + returnValue *= -1; } + } - // now parse the string according to it's format - int endOrExponentialPart = exponentialSign == -1 ? length : exponentialSign; - if (decimalPoint == -1) + // exponential part found? + if (exponentialSign != -1) + { + // advance by one if a sign (+ or -) is after the exponential sign + if (hasMinusExponentialSign || hasPlusExponentialSign) { - // string doesn't have fractional part, treat as integer - returnValue = GetIntegerPart(str, endOrExponentialPart); + exponentialSign++; } - else if (decimalPoint == 0) + + // get the exponential part + exponent = GetIntegerPart((str + exponentialSign + 1), (length - exponentialSign - 1)); + outExponent = pow(10, exponent); + + if (hasMinusExponentialSign) { - // string starts with the decimal point, only has fractional part - returnValue = GetDoubleFractionalPart((str + decimalPoint + 1), (endOrExponentialPart - decimalPoint - 1)); + returnValue = returnValue / outExponent; } else { - // string has integer and fractional parts - returnValue = GetIntegerPart(str, decimalPoint); - returnValue = returnValue + - GetDoubleFractionalPart((str + decimalPoint + 1), (endOrExponentialPart - decimalPoint - 1)); - if (hasMinusSign) - { - returnValue *= -1; - } + returnValue = returnValue * outExponent; } + } - // exponential part found? - if (exponentialSign != -1) - { - // advance by one if a sign (+ or -) is after the exponential sign - if (hasMinusExponentialSign || hasPlusExponentialSign) - { - exponentialSign++; - } + stack.SetResult_R8(returnValue); - // get the exponential part - int exponent = GetIntegerPart((str + exponentialSign + 1), (length - exponentialSign - 1)); - double outExponent = pow(10, exponent); +#endif // defined(SUPPORT_ANY_BASE_CONVERSION) - if (hasMinusExponentialSign) - { - returnValue = returnValue / outExponent; - } - else - { - returnValue = returnValue * outExponent; - } - } + NANOCLR_CLEANUP(); + + // set parameter reporting conversion success/failure + stack.Arg2().Dereference()->NumericByRef().u1 = (hr == S_OK); + // should we throw an exception? + if (hr != S_OK && !throwOnFailure) + { + // nope! so clear the exception + hr = S_OK; + + // need to set result value to 0 stack.SetResult_R8(returnValue); } - NANOCLR_NOCLEANUP(); + NANOCLR_CLEANUP_END(); +} -#endif // defined(SUPPORT_ANY_BASE_CONVERSION) +HRESULT Library_corlib_native_System_Convert::NativeToDateTime___STATIC__SystemDateTime__STRING__BOOLEAN__BYREF_BOOLEAN( + CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + + CLR_RT_TypeDescriptor dtType; + CLR_INT64 *pRes; + + char *str = (char *)stack.Arg0().RecoverString(); + char *conversionResult = NULL; + // char *str = (char *)"1999-10-31 10:00:00Z"; + uint64_t ticks; + + // grab parameter with flag to throw on failure + bool throwOnFailure = (bool)stack.Arg1().NumericByRefConst().u1; + + CLR_RT_HeapBlock &ref = stack.PushValue(); + + // check string parameter for null + FAULT_ON_NULL_ARG(str); + + // initialize type descriptor + NANOCLR_CHECK_HRESULT(dtType.InitializeFromType(g_CLR_RT_WellKnownTypes.m_DateTime)); + + // create an instance of + NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObject(ref, dtType.m_handlerCls)); + + pRes = Library_corlib_native_System_DateTime::GetValuePtr(ref); + + // try 'u' Universal time with sortable format (yyyy-MM-dd' 'HH:mm:ss) + conversionResult = Nano_strptime(str, "%Y-%m-%d %H:%M:%SZ", &ticks); + if (conversionResult == NULL) + { + // try 'o/O' Round Trip ISO 8601 compatible (yyyy-MM-ddTHH:mm:ss.fffffff) + conversionResult = Nano_strptime(str, "%Y-%m-%dT%H:%M:%S.%f", &ticks); + } + + if (conversionResult == NULL) + { + // try 'r/R' RFC 1123 date (ddd, dd MMM yyyy HH:mm:ss) + conversionResult = Nano_strptime(str, "%a, %d %b %Y %H:%M:%S", &ticks); + } + + if (conversionResult == NULL) + { + // failed to parse string + + NANOCLR_SET_AND_LEAVE(CLR_E_FORMAT_EXCEPTION); + } + else + { + *pRes = ticks; + } + + NANOCLR_CLEANUP(); + + // set parameter reporting conversion success/failure + stack.Arg2().Dereference()->NumericByRef().u1 = (hr == S_OK); + + // should we throw an exception? + if (hr != S_OK && !throwOnFailure) + { + // nope! so clear the exception + hr = S_OK; + } + + NANOCLR_CLEANUP_END(); } HRESULT Library_corlib_native_System_Convert::ToBase64String___STATIC__STRING__SZARRAY_U1__I4__I4__BOOLEAN( @@ -736,3 +859,248 @@ int64_t Library_corlib_native_System_Convert::GetIntegerFromHexString(char *str) return returnValue; } + +///////////////////////////////////////////////////////////// +// support functions for string to date/time conversion // +// heavily inspired in the strptime from the GNU C library // +///////////////////////////////////////////////////////////// + +static const char *abday[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; +static const char *abmon[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + +static int nano_strncasecmp(const char *s1, const char *s2, size_t n) +{ + if (n != 0) + { + const unsigned char *us1 = (const unsigned char *)s1; + const unsigned char *us2 = (const unsigned char *)s2; + + do + { + if (tolower(*us1) != tolower(*us2++)) + { + return tolower(*us1) - tolower(*--us2); + } + + if (*us1++ == '\0') + { + break; + } + + } while (--n != 0); + } + + return 0; +} + +static int nano_conv_num(const char **buf, int *dest, int lowerLimit, int upperLimit) +{ + int result = 0; + + // The limit also determines the number of valid digits + int runningLimit = upperLimit; + + if (**buf < '0' || **buf > '9') + { + return 0; + } + + do + { + result *= 10; + result += *(*buf)++ - '0'; + runningLimit /= 10; + } while ((result * 10 <= upperLimit) && runningLimit && **buf >= '0' && **buf <= '9'); + + if (result < lowerLimit || result > upperLimit) + { + return 0; + } + + *dest = result; + + return (1); +} + +char *Library_corlib_native_System_Convert::Nano_strptime(const char *buf, const char *format, uint64_t *ticks) +{ + char c; + const char *bufPointer; + size_t len = 0; + int i, value = 0; + int extraTicks = 0; + SYSTEMTIME st; + + memset(&st, 0, sizeof(SYSTEMTIME)); + + // reset this so it doesn't return wrong values in case of error + *ticks = 0; + + bufPointer = buf; + + while ((c = *format) != '\0') + { + // consume white-space + if (isspace((int)c)) + { + while (isspace((int)*bufPointer)) + { + bufPointer++; + } + + format++; + continue; + } + + if ((c = *format++) != '%') + { + goto literal; + } + + switch (c = *format++) + { + // "%%" is converted to "%" + case '%': + literal: + if (c != *bufPointer++) + { + return NULL; + } + break; + + // "Elementary" conversion rules. + // day of week (abbreviation) + case 'a': + for (i = 0; i < 7; i++) + { + // Full name not implemented + + // Abbreviated name + len = hal_strlen_s(abday[i]); + if (nano_strncasecmp(abday[i], bufPointer, len) == 0) + { + break; + } + } + + // no match + if (i == 7) + { + return NULL; + } + + st.wDayOfWeek = i; + bufPointer += len; + break; + + // month (2 digits) + case 'b': + for (i = 0; i < 12; i++) + { + // Full name not implemented + + // Abbreviated name + len = hal_strlen_s(abmon[i]); + if (nano_strncasecmp(abmon[i], bufPointer, len) == 0) + { + break; + } + } + + // no match + if (i == 12) + { + return NULL; + } + + st.wMonth = i + 1; + bufPointer += len; + break; + + // day of month (2 digits) + case 'd': + if (!(nano_conv_num(&bufPointer, &value, 1, 31))) + { + return NULL; + } + st.wDay = value; + break; + + // hour (24-hour) + case 'H': + if (!(nano_conv_num(&bufPointer, &value, 0, 23))) + { + return NULL; + } + st.wHour = value; + break; + + // minutes (2 digits) + case 'M': + if (!(nano_conv_num(&bufPointer, &value, 0, 59))) + { + return NULL; + } + st.wMinute = value; + break; + + // month (2 digits) + case 'm': + if (!(nano_conv_num(&bufPointer, &value, 1, 12))) + { + return NULL; + } + st.wMonth = value; + break; + + // seconds (2 digits) + case 'S': + if (!(nano_conv_num(&bufPointer, &value, 0, 59))) + { + return NULL; + } + st.wSecond = value; + break; + + // year (4 digits) + case 'Y': + if (!(nano_conv_num(&bufPointer, &value, 0, 9999))) + { + return NULL; + } + + st.wYear = value; + break; + + // ticks (any length) + case 'f': + if (!(nano_conv_num(&bufPointer, &value, 0, 9999999))) + { + return NULL; + } + + extraTicks = value; + break; + + // Miscellaneous conversions + // Any kind of white-space + case 'n': + case 't': + while (isspace((int)*bufPointer)) + { + bufPointer++; + } + break; + + // Unknown/unsupported conversion + default: + return NULL; + } + } + + // convert to .NET ticks + *ticks = HAL_Time_ConvertFromSystemTimeWithTicks(&st, extraTicks); + + // return whatever is left on the buffer + return ((char *)bufPointer); +} diff --git a/src/CLR/CorLib/corlib_native_System_Reflection_MethodBase.cpp b/src/CLR/CorLib/corlib_native_System_Reflection_MethodBase.cpp index 4418a30cd0..067a70df3d 100644 --- a/src/CLR/CorLib/corlib_native_System_Reflection_MethodBase.cpp +++ b/src/CLR/CorLib/corlib_native_System_Reflection_MethodBase.cpp @@ -5,143 +5,143 @@ // #include "CorLib.h" - - - -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_Name___STRING( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_Name___STRING(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_MethodDef_Instance md; - CLR_RT_HeapBlock* hbMeth = stack.Arg0().Dereference(); + CLR_RT_HeapBlock *hbMeth = stack.Arg0().Dereference(); - NANOCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md )); + NANOCLR_CHECK_HRESULT(GetMethodDescriptor(stack, *hbMeth, md)); - NANOCLR_SET_AND_LEAVE(CLR_RT_HeapBlock_String::CreateInstance( stack.PushValue(), md.m_target->name, md.m_assm )); + NANOCLR_SET_AND_LEAVE(CLR_RT_HeapBlock_String::CreateInstance(stack.PushValue(), md.m_target->name, md.m_assm)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_DeclaringType___SystemType( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_DeclaringType___SystemType(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_MethodDef_Instance md; - CLR_RT_TypeDef_Instance cls; - CLR_RT_HeapBlock* hbMeth = stack.Arg0().Dereference(); + CLR_RT_TypeDef_Instance cls; + CLR_RT_HeapBlock *hbMeth = stack.Arg0().Dereference(); - NANOCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md )); + NANOCLR_CHECK_HRESULT(GetMethodDescriptor(stack, *hbMeth, md)); - if(cls.InitializeFromMethod( md ) == false) NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE); + if (cls.InitializeFromMethod(md) == false) + NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE); { - CLR_RT_HeapBlock& top = stack.PushValue(); - CLR_RT_HeapBlock* hbObj; + CLR_RT_HeapBlock &top = stack.PushValue(); + CLR_RT_HeapBlock *hbObj; NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); - + hbObj = top.Dereference(); - hbObj->SetReflection( cls ); + hbObj->SetReflection(cls); } NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsPublic___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsPublic___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_METHODDEF::MD_Scope_Mask, CLR_RECORD_METHODDEF::MD_Scope_Public )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_METHODDEF::MD_Scope_Mask, CLR_RECORD_METHODDEF::MD_Scope_Public)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsStatic___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsStatic___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_METHODDEF::MD_Static, CLR_RECORD_METHODDEF::MD_Static )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_METHODDEF::MD_Static, CLR_RECORD_METHODDEF::MD_Static)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsFinal___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsFinal___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_METHODDEF::MD_Final, CLR_RECORD_METHODDEF::MD_Final )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_METHODDEF::MD_Final, CLR_RECORD_METHODDEF::MD_Final)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsVirtual___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsVirtual___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_METHODDEF::MD_Virtual, CLR_RECORD_METHODDEF::MD_Virtual )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_METHODDEF::MD_Virtual, CLR_RECORD_METHODDEF::MD_Virtual)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsAbstract___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::get_IsAbstract___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_METHODDEF::MD_Abstract, CLR_RECORD_METHODDEF::MD_Abstract )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_METHODDEF::MD_Abstract, CLR_RECORD_METHODDEF::MD_Abstract)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJECT__SZARRAY_OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJECT__SZARRAY_OBJECT( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_HeapBlock& obj = stack.Arg1(); - CLR_RT_MethodDef_Instance md; - const CLR_RECORD_METHODDEF* mdR; - CLR_RT_HeapBlock_Array* pArray = stack.Arg2().DereferenceArray(); - CLR_RT_HeapBlock* args = NULL; - int numArgs = 0; - CLR_RT_HeapBlock* hbMeth = stack.Arg0().Dereference(); + CLR_RT_HeapBlock &obj = stack.Arg1(); + CLR_RT_MethodDef_Instance md; + const CLR_RECORD_METHODDEF *mdR; + CLR_RT_HeapBlock_Array *pArray = stack.Arg2().DereferenceArray(); + CLR_RT_HeapBlock *args = NULL; + int numArgs = 0; + CLR_RT_HeapBlock *hbMeth = stack.Arg0().Dereference(); - NANOCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md )); + NANOCLR_CHECK_HRESULT(GetMethodDescriptor(stack, *hbMeth, md)); mdR = md.m_target; - if(stack.m_customState == 0) + if (stack.m_customState == 0) { stack.m_customState = 1; - if(pArray) + if (pArray) { - args = (CLR_RT_HeapBlock*)pArray->GetFirstElement(); - numArgs = pArray->m_numOfElements; + args = (CLR_RT_HeapBlock *)pArray->GetFirstElement(); + numArgs = pArray->m_numOfElements; } - NANOCLR_CHECK_HRESULT(stack.MakeCall( md, &obj, args, numArgs )); + NANOCLR_CHECK_HRESULT(stack.MakeCall(md, &obj, args, numArgs)); } else - { - if(mdR->retVal != DATATYPE_VOID) - { - if(mdR->retVal < DATATYPE_I4) + { + if (mdR->retVal != DATATYPE_VOID) + { + if (mdR->retVal < DATATYPE_I4) { - stack.TopValue().ChangeDataType( mdR->retVal ); + stack.TopValue().ChangeDataType(mdR->retVal); } NANOCLR_CHECK_HRESULT(stack.TopValue().PerformBoxingIfNeeded()); } else - { - stack.SetResult_Object( NULL ); + { + stack.SetResult_Object(NULL); } } @@ -150,26 +150,32 @@ HRESULT Library_corlib_native_System_Reflection_MethodBase::Invoke___OBJECT__OBJ //--// -HRESULT Library_corlib_native_System_Reflection_MethodBase::GetMethodDescriptor( CLR_RT_StackFrame& stack, CLR_RT_HeapBlock& arg, CLR_RT_MethodDef_Instance& inst ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::GetMethodDescriptor( + CLR_RT_StackFrame &stack, + CLR_RT_HeapBlock &arg, + CLR_RT_MethodDef_Instance &inst) { (void)stack; NATIVE_PROFILE_CLR_CORE(); - return CLR_RT_ReflectionDef_Index::Convert( arg, inst ) ? S_OK : CLR_E_NULL_REFERENCE; + return CLR_RT_ReflectionDef_Index::Convert(arg, inst) ? S_OK : CLR_E_NULL_REFERENCE; } -HRESULT Library_corlib_native_System_Reflection_MethodBase::CheckFlags( CLR_RT_StackFrame& stack, CLR_UINT32 mask, CLR_UINT32 flag ) +HRESULT Library_corlib_native_System_Reflection_MethodBase::CheckFlags( + CLR_RT_StackFrame &stack, + CLR_UINT32 mask, + CLR_UINT32 flag) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_MethodDef_Instance md; - bool fRes; - CLR_RT_HeapBlock* hbMeth = stack.Arg0().Dereference(); + bool fRes; + CLR_RT_HeapBlock *hbMeth = stack.Arg0().Dereference(); - NANOCLR_CHECK_HRESULT(GetMethodDescriptor( stack, *hbMeth, md )); + NANOCLR_CHECK_HRESULT(GetMethodDescriptor(stack, *hbMeth, md)); - if((md.m_target->flags & mask) == flag) + if ((md.m_target->flags & mask) == flag) { fRes = true; } @@ -178,7 +184,81 @@ HRESULT Library_corlib_native_System_Reflection_MethodBase::CheckFlags( CLR_RT_S fRes = false; } - stack.SetResult_Boolean( fRes ); + stack.SetResult_Boolean(fRes); + + NANOCLR_NOCLEANUP(); +} + +HRESULT Library_corlib_native_System_Reflection_MethodBase::GetParametersNative___SZARRAY_SystemReflectionParameterInfo( + CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + + CLR_RT_MethodDef_Instance inst; + CLR_RT_MethodDef_Index idx; + CLR_RT_SignatureParser sigParser; + CLR_RT_TypeDef_Index paramInfoTypeDef; + CLR_RT_SignatureParser::Element paramElement; + CLR_RT_HeapBlock *hbObj; + CLR_RT_HeapBlock *paramInfoElement; + + uint32_t paramCount = 0; + + CLR_RT_HeapBlock &top = stack.PushValueAndClear(); + + CLR_RT_HeapBlock *hbMethodInfo = stack.Arg0().Dereference(); + + idx.m_data = hbMethodInfo[Library_corlib_native_System_Reflection_MethodBase::FIELD___token].NumericByRef().u4; + inst.InitializeFromIndex(idx); + + // 1st pass: get the number of parameters + sigParser.Initialize_MethodSignature(inst.m_assm, inst.m_target); + + // discard return value + sigParser.Advance(paramElement); + + // loop through all the parameters + while (sigParser.Available() > 0) + { + paramCount++; + + sigParser.Advance(paramElement); + } + + // find type definition, don't bother checking the result as it exists for sure + g_CLR_RT_TypeSystem.FindTypeDef("ParameterInfo", "System.Reflection", paramInfoTypeDef); + + // create return array with the appropriate type + NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(top, paramCount, paramInfoTypeDef)); + paramInfoElement = (CLR_RT_HeapBlock *)top.DereferenceArray()->GetFirstElement(); + + // 2nd pass: get the actual type of each parameter + sigParser.Initialize_MethodSignature(inst.m_assm, inst.m_target); + + // discard return value + sigParser.Advance(paramElement); + + while (sigParser.Available() > 0) + { + sigParser.Advance(paramElement); + + // create a new instance of + NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*paramInfoElement, paramInfoTypeDef)); + hbObj = paramInfoElement->Dereference(); + + // get reference to the instance + CLR_RT_HeapBlock ¶TypeHB = + hbObj[Library_corlib_native_System_Reflection_ParameterInfo::FIELD___parameterType]; + + // create a new instance of the parameter type + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(paraTypeHB, g_CLR_RT_WellKnownTypes.m_TypeStatic)); + hbObj = paraTypeHB.Dereference(); + hbObj->SetReflection(paramElement.m_cls); + + // move pointer to the next element + paramInfoElement++; + } NANOCLR_NOCLEANUP(); } diff --git a/src/CLR/CorLib/corlib_native_System_Type.cpp b/src/CLR/CorLib/corlib_native_System_Type.cpp index 87f2f0abd0..b515e24526 100644 --- a/src/CLR/CorLib/corlib_native_System_Type.cpp +++ b/src/CLR/CorLib/corlib_native_System_Type.cpp @@ -5,63 +5,67 @@ // #include "CorLib.h" - -HRESULT Library_corlib_native_System_Type::get_DeclaringType___SystemType( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_DeclaringType___SystemType(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_TypeDef_Instance td; - CLR_RT_HeapBlock& top = stack.PushValueAndClear(); - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); - - NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, td )); + CLR_RT_HeapBlock &top = stack.PushValueAndClear(); + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); + + NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor(*hbType, td)); - if(td.m_target->enclosingType != CLR_EmptyIndex) + if (td.m_target->enclosingType != CLR_EmptyIndex) { - CLR_RT_HeapBlock* hbObj; - td.Set( td.Assembly(), td.m_target->enclosingType ); + CLR_RT_HeapBlock *hbObj; + td.Set(td.Assembly(), td.m_target->enclosingType); NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); hbObj = top.Dereference(); - hbObj->SetReflection( td ); - } + hbObj->SetReflection(td); + } NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING__SystemReflectionBindingFlags( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING__SystemReflectionBindingFlags( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - const char* szText = stack.Arg1().RecoverString(); FAULT_ON_NULL(szText); + const char *szText = stack.Arg1().RecoverString(); + FAULT_ON_NULL(szText); - NANOCLR_SET_AND_LEAVE(GetMethods( stack, szText, stack.Arg2().NumericByRef().s4, NULL, 0, false )); + NANOCLR_SET_AND_LEAVE(GetMethods(stack, szText, stack.Arg2().NumericByRef().s4, NULL, 0, false)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::IsInstanceOfType___BOOLEAN__OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::IsInstanceOfType___BOOLEAN__OBJECT(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_TypeDescriptor descTarget; CLR_RT_TypeDescriptor desc; - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); - if(hbType->DataType() != DATATYPE_REFLECTION) NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE); + if (hbType->DataType() != DATATYPE_REFLECTION) + NANOCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE); - NANOCLR_CHECK_HRESULT(descTarget.InitializeFromReflection( hbType->ReflectionDataConst() )); - NANOCLR_CHECK_HRESULT(desc .InitializeFromObject ( stack.Arg1() )); + NANOCLR_CHECK_HRESULT(descTarget.InitializeFromReflection(hbType->ReflectionDataConst())); + NANOCLR_CHECK_HRESULT(desc.InitializeFromObject(stack.Arg1())); - stack.SetResult_Boolean( CLR_RT_ExecutionEngine::IsInstanceOf( desc, descTarget, false ) ); + stack.SetResult_Boolean(CLR_RT_ExecutionEngine::IsInstanceOf(desc, descTarget, false)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::InvokeMember___OBJECT__STRING__SystemReflectionBindingFlags__SystemReflectionBinder__OBJECT__SZARRAY_OBJECT( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type:: + InvokeMember___OBJECT__STRING__SystemReflectionBindingFlags__SystemReflectionBinder__OBJECT__SZARRAY_OBJECT( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); @@ -71,36 +75,61 @@ HRESULT Library_corlib_native_System_Type::InvokeMember___OBJECT__STRING__System NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetConstructor___SystemReflectionConstructorInfo__SZARRAY_SystemType( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetConstructor___SystemReflectionConstructorInfo__SZARRAY_SystemType( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_HeapBlock_Array* array = stack.Arg1().DereferenceArray(); FAULT_ON_NULL(array); - CLR_RT_HeapBlock* pParams; - int iParams; + CLR_RT_HeapBlock_Array *array = stack.Arg1().DereferenceArray(); + FAULT_ON_NULL(array); + CLR_RT_HeapBlock *pParams; + int iParams; - pParams = (CLR_RT_HeapBlock*)array->GetFirstElement(); - iParams = array->m_numOfElements; + pParams = (CLR_RT_HeapBlock *)array->GetFirstElement(); + iParams = array->m_numOfElements; - NANOCLR_SET_AND_LEAVE(GetMethods( stack, NULL, c_BindingFlags_CreateInstance | c_BindingFlags_Instance | c_BindingFlags_Public | c_BindingFlags_NonPublic, pParams, iParams, false )); + NANOCLR_SET_AND_LEAVE(GetMethods( + stack, + NULL, + c_BindingFlags_CreateInstance | c_BindingFlags_Instance | c_BindingFlags_Public | c_BindingFlags_NonPublic, + pParams, + iParams, + false)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING__SZARRAY_SystemType( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetConstructors___SZARRAY_SystemReflectionConstructorInfo( + CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + + NANOCLR_SET_AND_LEAVE(GetMethods( + stack, + NULL, + c_BindingFlags_CreateInstance | c_BindingFlags_Instance | c_BindingFlags_Public, + NULL, + 0, + true)); + + NANOCLR_NOCLEANUP(); +} + +HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING__SZARRAY_SystemType( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_HeapBlock_Array* array = stack.Arg2().DereferenceArray(); - CLR_RT_HeapBlock* pParams; - int iParams; + CLR_RT_HeapBlock_Array *array = stack.Arg2().DereferenceArray(); + CLR_RT_HeapBlock *pParams; + int iParams; - if(array) + if (array) { - pParams = (CLR_RT_HeapBlock*)array->GetFirstElement(); - iParams = array->m_numOfElements; + pParams = (CLR_RT_HeapBlock *)array->GetFirstElement(); + iParams = array->m_numOfElements; } else { @@ -108,351 +137,380 @@ HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInf iParams = 0; } - const char* szText = stack.Arg1().RecoverString(); FAULT_ON_NULL(szText); + const char *szText = stack.Arg1().RecoverString(); + FAULT_ON_NULL(szText); - NANOCLR_SET_AND_LEAVE(GetMethods( stack, szText, c_BindingFlags_DefaultLookup, pParams, iParams, false )); + NANOCLR_SET_AND_LEAVE(GetMethods(stack, szText, c_BindingFlags_DefaultLookup, pParams, iParams, false)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetMethod___SystemReflectionMethodInfo__STRING(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - const char* szText = stack.Arg1().RecoverString(); FAULT_ON_NULL(szText); + const char *szText = stack.Arg1().RecoverString(); + FAULT_ON_NULL(szText); - NANOCLR_SET_AND_LEAVE(GetMethods( stack, szText, c_BindingFlags_DefaultLookup, NULL, 0, false )); + NANOCLR_SET_AND_LEAVE(GetMethods(stack, szText, c_BindingFlags_DefaultLookup, NULL, 0, false)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsNotPublic___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsNotPublic___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Scope_Mask, CLR_RECORD_TYPEDEF::TD_Scope_NotPublic )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Scope_Mask, CLR_RECORD_TYPEDEF::TD_Scope_NotPublic)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsPublic___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsPublic___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Scope_Mask, CLR_RECORD_TYPEDEF::TD_Scope_Public )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Scope_Mask, CLR_RECORD_TYPEDEF::TD_Scope_Public)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsClass___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsClass___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Class )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Class)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsInterface___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsInterface___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Interface )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Interface)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsValueType___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsValueType___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_ValueType )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_ValueType)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsAbstract___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsAbstract___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Abstract, CLR_RECORD_TYPEDEF::TD_Abstract )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Abstract, CLR_RECORD_TYPEDEF::TD_Abstract)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsEnum___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsEnum___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Enum )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Enum)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsSerializable___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsSerializable___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Serializable, CLR_RECORD_TYPEDEF::TD_Serializable )); + NANOCLR_SET_AND_LEAVE(CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Serializable, CLR_RECORD_TYPEDEF::TD_Serializable)); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::get_IsArray___BOOLEAN( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::get_IsArray___BOOLEAN(CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_TypeDef_Instance td; - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); - - NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, td )); - - stack.SetResult_Boolean(td.m_data == g_CLR_RT_WellKnownTypes.m_Array.m_data); + CLR_RT_TypeDef_Instance td; + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); + + NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor(*hbType, td)); + + stack.SetResult_Boolean(td.m_data == g_CLR_RT_WellKnownTypes.m_Array.m_data); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetTypeInternal___STATIC__SystemType__STRING__STRING__BOOLEAN__SZARRAY_I4( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetTypeInternal___STATIC__SystemType__STRING__STRING__BOOLEAN__SZARRAY_I4( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - const char* szClass; - const char* szAssembly; - CLR_RT_HeapBlock_Array* verArray; - CLR_RT_Assembly* assm; + const char *szClass; + const char *szAssembly; + CLR_RT_HeapBlock_Array *verArray; + CLR_RT_Assembly *assm; CLR_RT_TypeDef_Index td; - CLR_INT32* ver; + CLR_INT32 *ver; bool fVersion; CLR_RECORD_VERSION version; - - CLR_RT_HeapBlock& top = stack.PushValueAndClear(); - CLR_RT_HeapBlock* hbObj; - szClass = stack.Arg0().RecoverString(); FAULT_ON_NULL(szClass); - szAssembly = stack.Arg1().RecoverString(); - - fVersion = stack.Arg2().NumericByRef().u1 != 0; - - if(fVersion) + + CLR_RT_HeapBlock &top = stack.PushValueAndClear(); + CLR_RT_HeapBlock *hbObj; + szClass = stack.Arg0().RecoverString(); + FAULT_ON_NULL(szClass); + szAssembly = stack.Arg1().RecoverString(); + + fVersion = stack.Arg2().NumericByRef().u1 != 0; + + if (fVersion) { - verArray = stack.Arg3().DereferenceArray(); FAULT_ON_NULL(verArray); - ver = (CLR_INT32*)verArray->GetFirstElement(); + verArray = stack.Arg3().DereferenceArray(); + FAULT_ON_NULL(verArray); + ver = (CLR_INT32 *)verArray->GetFirstElement(); - version.iMajorVersion = ver[0]; - version.iMinorVersion = ver[1]; - version.iBuildNumber = ver[2]; + version.iMajorVersion = ver[0]; + version.iMinorVersion = ver[1]; + version.iBuildNumber = ver[2]; version.iRevisionNumber = ver[3]; } else { - memset( &version, 0, sizeof(CLR_RECORD_VERSION)); + memset(&version, 0, sizeof(CLR_RECORD_VERSION)); } - if(szAssembly) + if (szAssembly) { - assm = g_CLR_RT_TypeSystem.FindAssembly( szAssembly, fVersion ? &version : NULL, fVersion ); + assm = g_CLR_RT_TypeSystem.FindAssembly(szAssembly, fVersion ? &version : NULL, fVersion); } else { assm = NULL; } - - if(g_CLR_RT_TypeSystem.FindTypeDef( szClass, assm, td )) + + if (g_CLR_RT_TypeSystem.FindTypeDef(szClass, assm, td)) { #if defined(NANOCLR_APPDOMAINS) - CLR_RT_TypeDef_Instance inst; + CLR_RT_TypeDef_Instance inst; - inst.InitializeFromIndex( td ); - if(!g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->FindAppDomainAssembly( inst.m_assm )) NANOCLR_SET_AND_LEAVE(S_OK); + inst.InitializeFromIndex(td); + if (!g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->FindAppDomainAssembly(inst.m_assm)) + NANOCLR_SET_AND_LEAVE(S_OK); #endif NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); hbObj = top.Dereference(); - hbObj->SetReflection( td ); + hbObj->SetReflection(td); } else { CLR_RT_ReflectionDef_Index reflex; - if(g_CLR_RT_TypeSystem.FindTypeDef( szClass, assm, reflex )) + if (g_CLR_RT_TypeSystem.FindTypeDef(szClass, assm, reflex)) { #if defined(NANOCLR_APPDOMAINS) - CLR_RT_TypeDef_Instance inst; + CLR_RT_TypeDef_Instance inst; - inst.InitializeFromIndex( reflex.m_data.m_type ); - if(!g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->FindAppDomainAssembly( inst.m_assm )) NANOCLR_SET_AND_LEAVE(S_OK); + inst.InitializeFromIndex(reflex.m_data.m_type); + if (!g_CLR_RT_ExecutionEngine.GetCurrentAppDomain()->FindAppDomainAssembly(inst.m_assm)) + NANOCLR_SET_AND_LEAVE(S_OK); #endif - NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); hbObj = top.Dereference(); - hbObj->SetReflection( reflex ); + hbObj->SetReflection(reflex); } } NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetTypeFromHandle___STATIC__SystemType__SystemRuntimeTypeHandle( CLR_RT_StackFrame& stack ) +HRESULT Library_corlib_native_System_Type::GetTypeFromHandle___STATIC__SystemType__SystemRuntimeTypeHandle( + CLR_RT_StackFrame &stack) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_HeapBlock& pThis = stack.Arg0(); - CLR_RT_HeapBlock& top = stack.PushValue(); - CLR_RT_HeapBlock* hbObj; + CLR_RT_HeapBlock &pThis = stack.Arg0(); + CLR_RT_HeapBlock &top = stack.PushValue(); + CLR_RT_HeapBlock *hbObj; NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); hbObj = top.Dereference(); - hbObj->Assign(pThis); // RuntimeTypeHandle and Type have the same representation. - + hbObj->Assign(pThis); // RuntimeTypeHandle and Type have the same representation. + NANOCLR_NOCLEANUP(); } //--// -HRESULT Library_corlib_native_System_Type::CheckFlags( CLR_RT_StackFrame& stack, CLR_UINT32 mask, CLR_UINT32 flag ) +HRESULT Library_corlib_native_System_Type::CheckFlags(CLR_RT_StackFrame &stack, CLR_UINT32 mask, CLR_UINT32 flag) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_TypeDef_Instance td; - bool fRes; - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); + bool fRes; + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); - NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, td )); + NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor(*hbType, td)); - if((td.m_target->flags & mask) == flag) + if ((td.m_target->flags & mask) == flag) { fRes = true; } // // Special case, an enum is a valuetype, so let's check for that one. // - else if(mask == CLR_RECORD_TYPEDEF::TD_Semantics_Mask && flag == CLR_RECORD_TYPEDEF::TD_Semantics_ValueType) + else if (mask == CLR_RECORD_TYPEDEF::TD_Semantics_Mask && flag == CLR_RECORD_TYPEDEF::TD_Semantics_ValueType) { - NANOCLR_SET_AND_LEAVE(CheckFlags( stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Enum )); + NANOCLR_SET_AND_LEAVE( + CheckFlags(stack, CLR_RECORD_TYPEDEF::TD_Semantics_Mask, CLR_RECORD_TYPEDEF::TD_Semantics_Enum)); } else { fRes = false; } - stack.SetResult_Boolean( fRes ); + stack.SetResult_Boolean(fRes); NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetFields( CLR_RT_StackFrame& stack, const char* szText, CLR_UINT32 bindingFlags, bool fAllMatches ) +HRESULT Library_corlib_native_System_Type::GetFields( + CLR_RT_StackFrame &stack, + const char *szText, + CLR_UINT32 bindingFlags, + bool fAllMatches) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_TypeDef_Instance td; + CLR_RT_TypeDef_Instance td; CLR_RT_TypeDef_Instance tdArg; int iField; - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); - - if(bindingFlags == c_BindingFlags_Default) bindingFlags = c_BindingFlags_DefaultLookup; + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); + + if (bindingFlags == c_BindingFlags_Default) + bindingFlags = c_BindingFlags_DefaultLookup; - NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, tdArg )); + NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor(*hbType, tdArg)); { - CLR_RT_HeapBlock& top = stack.PushValueAndClear(); + CLR_RT_HeapBlock &top = stack.PushValueAndClear(); - for(int pass=0; pass < 2; pass++) + for (int pass = 0; pass < 2; pass++) { - td = tdArg; + td = tdArg; iField = 0; - + do { - CLR_RT_Assembly* assm = td.m_assm; - const CLR_RECORD_TYPEDEF* tdR = td.m_target; - const CLR_RECORD_FIELDDEF* fd = td.m_assm->GetFieldDef( tdR->sFields_First ); - int iTot = tdR->iFields_Num + tdR->sFields_Num; - int i; - CLR_RT_FieldDef_Index idx; - - for(i=0; iGetFieldDef(tdR->sFields_First); + int iTot = tdR->iFields_Num + tdR->sFields_Num; + int i; + CLR_RT_FieldDef_Index idx; + + for (i = 0; i < iTot; i++, fd++) { - const char* fieldName = assm->GetString( fd->name ); + const char *fieldName = assm->GetString(fd->name); - if(fd->flags & CLR_RECORD_FIELDDEF::FD_NoReflection) + if (fd->flags & CLR_RECORD_FIELDDEF::FD_NoReflection) { continue; } - if(fd->flags & CLR_RECORD_FIELDDEF::FD_Static) + if (fd->flags & CLR_RECORD_FIELDDEF::FD_Static) { - if((bindingFlags & c_BindingFlags_Static) == 0) continue; + if ((bindingFlags & c_BindingFlags_Static) == 0) + continue; } else { - if((bindingFlags & c_BindingFlags_Instance) == 0) continue; + if ((bindingFlags & c_BindingFlags_Instance) == 0) + continue; } - if((fd->flags & CLR_RECORD_FIELDDEF::FD_Scope_Mask) == CLR_RECORD_FIELDDEF::FD_Scope_Public) + if ((fd->flags & CLR_RECORD_FIELDDEF::FD_Scope_Mask) == CLR_RECORD_FIELDDEF::FD_Scope_Public) { - if((bindingFlags & c_BindingFlags_Public) == 0) continue; + if ((bindingFlags & c_BindingFlags_Public) == 0) + continue; } else { - if((bindingFlags & c_BindingFlags_NonPublic) == 0) continue; + if ((bindingFlags & c_BindingFlags_NonPublic) == 0) + continue; } // In this block we check if requested name szText is the same as examined field name. // We check if compare is case insensitive. if (bindingFlags & c_BindingFlags_IgnoreCase) - { + { // If strings are not eqaul - continue - if(szText != NULL && hal_stricmp( fieldName, szText )) continue; + if (szText != NULL && hal_stricmp(fieldName, szText)) + continue; } else // Case sensitive compare - { + { // If strings are not eqaul - continue - if(szText != NULL && strcmp( fieldName, szText )) continue; + if (szText != NULL && strcmp(fieldName, szText)) + continue; } - - idx.Set( td.Assembly(), i + tdR->sFields_First ); - if(!fAllMatches) + idx.Set(td.Assembly(), i + tdR->sFields_First); + + if (!fAllMatches) { - CLR_RT_HeapBlock* hbObj; - NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_FieldInfo)); + CLR_RT_HeapBlock *hbObj; + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_FieldInfo)); hbObj = top.Dereference(); - hbObj->SetReflection( idx ); + hbObj->SetReflection(idx); NANOCLR_SET_AND_LEAVE(S_OK); } - else if(pass == 1) + else if (pass == 1) { - CLR_RT_HeapBlock* elem = (CLR_RT_HeapBlock*)top.DereferenceArray()->GetElement(iField); - CLR_RT_HeapBlock* hbObj; - NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*elem, g_CLR_RT_WellKnownTypes.m_FieldInfo)); + CLR_RT_HeapBlock *elem = (CLR_RT_HeapBlock *)top.DereferenceArray()->GetElement(iField); + CLR_RT_HeapBlock *hbObj; + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*elem, g_CLR_RT_WellKnownTypes.m_FieldInfo)); hbObj = elem->Dereference(); - NANOCLR_CHECK_HRESULT(hbObj->SetReflection( idx )); + NANOCLR_CHECK_HRESULT(hbObj->SetReflection(idx)); } - iField++; + iField++; } - - if(bindingFlags & c_BindingFlags_DeclaredOnly) break; - } - while(td.SwitchToParent()); - if(pass == 0) + if (bindingFlags & c_BindingFlags_DeclaredOnly) + break; + } while (td.SwitchToParent()); + + if (pass == 0) { - if(!fAllMatches) NANOCLR_SET_AND_LEAVE(S_OK); + if (!fAllMatches) + NANOCLR_SET_AND_LEAVE(S_OK); - NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( top, iField, g_CLR_RT_WellKnownTypes.m_FieldInfo )); + NANOCLR_CHECK_HRESULT( + CLR_RT_HeapBlock_Array::CreateInstance(top, iField, g_CLR_RT_WellKnownTypes.m_FieldInfo)); } } } @@ -460,26 +518,40 @@ HRESULT Library_corlib_native_System_Type::GetFields( CLR_RT_StackFrame& stack, NANOCLR_NOCLEANUP(); } -HRESULT Library_corlib_native_System_Type::GetMethods( CLR_RT_StackFrame& stack, const char* szText, CLR_UINT32 bindingFlags, CLR_RT_HeapBlock* pParams, int iParams, bool fAllMatches ) +HRESULT Library_corlib_native_System_Type::GetMethods( + CLR_RT_StackFrame &stack, + const char *szText, + CLR_UINT32 bindingFlags, + CLR_RT_HeapBlock *pParams, + int iParams, + bool fAllMatches) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); - CLR_RT_MethodDef_Instance inst; inst.Clear(); - CLR_RT_TypeDef_Instance td; - CLR_RT_TypeDef_Instance tdArg; + CLR_RT_MethodDef_Instance inst; + inst.Clear(); + CLR_RT_TypeDef_Instance td; + CLR_RT_TypeDef_Instance tdArg; int iMethod; - CLR_RT_HeapBlock& top = stack.PushValueAndClear(); - CLR_RT_HeapBlock* hbType = stack.Arg0().Dereference(); + CLR_RT_HeapBlock &top = stack.PushValueAndClear(); + CLR_RT_HeapBlock *hbType = stack.Arg0().Dereference(); bool staticInstanceOnly = false; - if(bindingFlags == c_BindingFlags_Default) bindingFlags = c_BindingFlags_DefaultLookup; - // in default lookup mode we want the static methods only from the instance not from the base classes - if(bindingFlags == c_BindingFlags_DefaultLookup) staticInstanceOnly = true; - - NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor( *hbType, tdArg )); - - for(int pass = 0; pass < 2; pass++) + if (bindingFlags == c_BindingFlags_Default) + { + bindingFlags = c_BindingFlags_DefaultLookup; + } + + // in default lookup mode we want the static methods only from the instance not from the base classes + if (bindingFlags == c_BindingFlags_DefaultLookup) + { + staticInstanceOnly = true; + } + + NANOCLR_CHECK_HRESULT(Library_corlib_native_System_RuntimeType::GetTypeDescriptor(*hbType, tdArg)); + + for (int pass = 0; pass < 2; pass++) { td = tdArg; iMethod = 0; @@ -487,11 +559,11 @@ HRESULT Library_corlib_native_System_Type::GetMethods( CLR_RT_StackFrame& stack, do { - CLR_RT_Assembly* assm = td.m_assm; - const CLR_RECORD_TYPEDEF* tdR = td.m_target; - const CLR_RECORD_METHODDEF* md = assm->GetMethodDef( tdR->methods_First ); - int iTot = tdR->sMethods_Num + tdR->iMethods_Num + tdR->vMethods_Num; - int i; + CLR_RT_Assembly *assm = td.m_assm; + const CLR_RECORD_TYPEDEF *tdR = td.m_target; + const CLR_RECORD_METHODDEF *md = assm->GetMethodDef(tdR->methods_First); + int iTot = tdR->sMethods_Num + tdR->iMethods_Num + tdR->vMethods_Num; + int i; if (staticInstanceOnly) { @@ -508,151 +580,212 @@ HRESULT Library_corlib_native_System_Type::GetMethods( CLR_RT_StackFrame& stack, bindingFlags = c_BindingFlags_Instance | c_BindingFlags_Public; } } - - for(i=0; iflags & CLR_RECORD_METHODDEF::MD_Static) + if (md->flags & CLR_RECORD_METHODDEF::MD_Static) { - if((bindingFlags & c_BindingFlags_Static) == 0) continue; + if ((bindingFlags & c_BindingFlags_Static) == 0) + { + continue; + } } else { - if((bindingFlags & c_BindingFlags_Instance) == 0) continue; + if ((bindingFlags & c_BindingFlags_Instance) == 0) + { + continue; + } } - if((md->flags & CLR_RECORD_METHODDEF::MD_Scope_Mask) == CLR_RECORD_METHODDEF::MD_Scope_Public) + if ((md->flags & CLR_RECORD_METHODDEF::MD_Scope_Mask) == CLR_RECORD_METHODDEF::MD_Scope_Public) { - if((bindingFlags & c_BindingFlags_Public) == 0) continue; + if ((bindingFlags & c_BindingFlags_Public) == 0) + { + continue; + } } else { - if((bindingFlags & c_BindingFlags_NonPublic) == 0) continue; + if ((bindingFlags & c_BindingFlags_NonPublic) == 0) + { + continue; + } } //--// - if(md->flags & CLR_RECORD_METHODDEF::MD_Constructor) + if (md->flags & CLR_RECORD_METHODDEF::MD_Constructor) { - if((bindingFlags & c_BindingFlags_CreateInstance) == 0) continue; + if ((bindingFlags & c_BindingFlags_CreateInstance) == 0) + { + continue; + } } else { - if((bindingFlags & c_BindingFlags_CreateInstance) != 0) continue; + if ((bindingFlags & c_BindingFlags_CreateInstance) != 0) + { + continue; + } - if(szText != NULL && !strcmp( assm->GetString( md->name ), szText ) == false) continue; + if (szText != NULL && !strcmp(assm->GetString(md->name), szText) == false) + { + continue; + } } - if(pParams) + if (pParams) { - CLR_RT_SignatureParser parserLeft ; parserLeft .Initialize_MethodSignature( assm, md ); - CLR_RT_SignatureParser parserRight; parserRight.Initialize_Objects ( pParams, iParams, true ); + CLR_RT_SignatureParser parserLeft; + parserLeft.Initialize_MethodSignature(assm, md); + CLR_RT_SignatureParser parserRight; + parserRight.Initialize_Objects(pParams, iParams, true); CLR_RT_SignatureParser::Element res; - + // // Skip return value. // - NANOCLR_CHECK_HRESULT(parserLeft.Advance( res )); + NANOCLR_CHECK_HRESULT(parserLeft.Advance(res)); - if(CLR_RT_TypeSystem::MatchSignatureDirect( parserLeft, parserRight, true ) == false) continue; + if (CLR_RT_TypeSystem::MatchSignatureDirect(parserLeft, parserRight, true) == false) + { + continue; + } } - CLR_RT_MethodDef_Index idx; idx.Set( td.Assembly(), i + tdR->methods_First ); - CLR_RT_MethodDef_Instance inst2; inst2.InitializeFromIndex( idx ); - - if(fAllMatches) + CLR_RT_MethodDef_Index idx; + idx.Set(td.Assembly(), i + tdR->methods_First); + CLR_RT_MethodDef_Instance inst2; + inst2.InitializeFromIndex(idx); + + if (fAllMatches) { - if(pass==1) - { - CLR_RT_HeapBlock* elem = (CLR_RT_HeapBlock*)top.DereferenceArray()->GetElement(iMethod); - CLR_RT_HeapBlock* hbObj; - NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*elem, g_CLR_RT_WellKnownTypes.m_MethodInfo)); + if (pass == 1) + { + CLR_RT_HeapBlock *elem = (CLR_RT_HeapBlock *)top.DereferenceArray()->GetElement(iMethod); + CLR_RT_HeapBlock *hbObj; + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(*elem, g_CLR_RT_WellKnownTypes.m_MethodInfo)); hbObj = elem->Dereference(); - NANOCLR_CHECK_HRESULT(hbObj->SetReflection( idx )); + NANOCLR_CHECK_HRESULT(hbObj->SetReflection(idx)); + + // store token for type + hbObj[Library_corlib_native_System_Reflection_MethodBase::FIELD___token].NumericByRef().u4 = + idx.m_data; } - iMethod++; + iMethod++; } else { - CLR_RT_HeapBlock* hbObj; - - if(NANOCLR_INDEX_IS_VALID(inst)) - { - CLR_RT_SignatureParser parserLeft ; parserLeft .Initialize_MethodSignature( inst .m_assm, inst .m_target ); - CLR_RT_SignatureParser parserRight; parserRight.Initialize_MethodSignature( inst2.m_assm, inst2.m_target ); + CLR_RT_HeapBlock *hbObj; + + if (NANOCLR_INDEX_IS_VALID(inst)) + { + CLR_RT_SignatureParser parserLeft; + parserLeft.Initialize_MethodSignature(inst.m_assm, inst.m_target); + CLR_RT_SignatureParser parserRight; + parserRight.Initialize_MethodSignature(inst2.m_assm, inst2.m_target); CLR_RT_SignatureParser::Element resLeft; - CLR_RT_SignatureParser::Element resRight; + CLR_RT_SignatureParser::Element resRight; // // Skip return value. // - NANOCLR_CHECK_HRESULT(parserLeft.Advance ( resLeft )); - NANOCLR_CHECK_HRESULT(parserRight.Advance( resRight )); + NANOCLR_CHECK_HRESULT(parserLeft.Advance(resLeft)); + NANOCLR_CHECK_HRESULT(parserRight.Advance(resRight)); - if(!pParams) - { - if(CLR_RT_TypeSystem::MatchSignatureDirect( parserLeft, parserRight, false ) == false) + if (!pParams) + { + if (CLR_RT_TypeSystem::MatchSignatureDirect(parserLeft, parserRight, false) == false) { - //Two methods with different signatures, we cannot distinguish between the two. + // Two methods with different signatures, we cannot distinguish between the two. NANOCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); - } + } - //If they are identical signatures, the first one wins (subclass takes precendence) + // If they are identical signatures, the first one wins (subclass takes precendence) continue; } else - { - bool fLeftBetterMatch = false; - bool fRightBetterMatch = false; + { + bool fLeftBetterMatch = false; + bool fRightBetterMatch = false; - while(parserLeft.Available() > 0) + while (parserLeft.Available() > 0) { - NANOCLR_CHECK_HRESULT(parserLeft.Advance ( resLeft )); - NANOCLR_CHECK_HRESULT(parserRight.Advance( resRight )); - - bool fRightBetterMatchT = CLR_RT_TypeSystem::MatchSignatureElement( resLeft , resRight, true ); - bool fLeftBetterMatchT = CLR_RT_TypeSystem::MatchSignatureElement( resRight, resLeft , true ); - - //If fLeftBetterMatchT && fRightBetterMatchT, one is assignable from the other, they must be the same - // !fLeftBetterMatchT && !fRightBetterMatchT cannot happen, since this signature matches pParams + NANOCLR_CHECK_HRESULT(parserLeft.Advance(resLeft)); + NANOCLR_CHECK_HRESULT(parserRight.Advance(resRight)); + + bool fRightBetterMatchT = + CLR_RT_TypeSystem::MatchSignatureElement(resLeft, resRight, true); + bool fLeftBetterMatchT = + CLR_RT_TypeSystem::MatchSignatureElement(resRight, resLeft, true); + + // If fLeftBetterMatchT && fRightBetterMatchT, one is assignable from the other, they + // must be the same + // !fLeftBetterMatchT && !fRightBetterMatchT cannot happen, since this signature + // matches pParams + + if (fLeftBetterMatchT && !fRightBetterMatchT) + { + fLeftBetterMatch = true; + } + + if (!fLeftBetterMatchT && fRightBetterMatchT) + { + fRightBetterMatch = true; + } + } - if(fLeftBetterMatchT && !fRightBetterMatchT) fLeftBetterMatch = true; - if(!fLeftBetterMatchT && fRightBetterMatchT) fRightBetterMatch = true; + if (fLeftBetterMatch && fRightBetterMatch) + { + // If the params match both Foo(Super, Sub) and Foo(Sub, Super) + // we cannot choose between the two + NANOCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); } - if(fLeftBetterMatch && fRightBetterMatch) + // If they are identical signatures, the first one wins (subclass takes precendence) + // Only if Right is better do we have a strictly better match + if (!fRightBetterMatch) { - //If the params match both Foo(Super, Sub) and Foo(Sub, Super) - //we cannot choose between the two - NANOCLR_SET_AND_LEAVE( CLR_E_INVALID_PARAMETER ); + continue; } - //If they are identical signatures, the first one wins (subclass takes precendence) - //Only if Right is better do we have a strictly better match - if(!fRightBetterMatch) continue; - - //Found a better match + // Found a better match } } - - inst.InitializeFromIndex( idx ); - NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_MethodInfo)); + inst.InitializeFromIndex(idx); + + NANOCLR_CHECK_HRESULT( + g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_MethodInfo)); hbObj = top.Dereference(); - hbObj->SetReflection( inst ); - } + hbObj->SetReflection(inst); + + // store token for type + hbObj[Library_corlib_native_System_Reflection_MethodBase::FIELD___token].NumericByRef().u4 = + inst.m_data; + } } - if(bindingFlags & (c_BindingFlags_DeclaredOnly | c_BindingFlags_CreateInstance)) break; - } - while(td.SwitchToParent()); + if (bindingFlags & (c_BindingFlags_DeclaredOnly | c_BindingFlags_CreateInstance)) + { + break; + } + + } while (td.SwitchToParent()); - if(pass == 0) + if (pass == 0) { - if(!fAllMatches) NANOCLR_SET_AND_LEAVE(S_OK); + if (!fAllMatches) + { + NANOCLR_SET_AND_LEAVE(S_OK); + } - NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( top, iMethod, g_CLR_RT_WellKnownTypes.m_MethodInfo )); + NANOCLR_CHECK_HRESULT( + CLR_RT_HeapBlock_Array::CreateInstance(top, iMethod, g_CLR_RT_WellKnownTypes.m_MethodInfo)); } } diff --git a/src/CLR/Core/CLR_RT_HeapBlock.cpp b/src/CLR/Core/CLR_RT_HeapBlock.cpp index 6681bb1828..1f036212b6 100644 --- a/src/CLR/Core/CLR_RT_HeapBlock.cpp +++ b/src/CLR/Core/CLR_RT_HeapBlock.cpp @@ -1042,7 +1042,7 @@ void CLR_RT_HeapBlock::Promote() //--// -CLR_INT32 CLR_RT_HeapBlock::GetHashCode(CLR_RT_HeapBlock *ptr, bool fRecurse, CLR_INT32 crc = 0) +CLR_UINT32 CLR_RT_HeapBlock::GetHashCode(CLR_RT_HeapBlock *ptr, bool fRecurse, CLR_UINT32 crc = 0) { NATIVE_PROFILE_CLR_CORE(); @@ -1159,12 +1159,18 @@ bool CLR_RT_HeapBlock::ObjectsEqual( bool fSameReference) { NATIVE_PROFILE_CLR_CORE(); + if (&pArgLeft == &pArgRight) + { return true; + } - if (pArgLeft.DataType() == pArgRight.DataType()) + CLR_DataType leftDataType = pArgLeft.DataType(); + CLR_DataType rightDataType = pArgRight.DataType(); + + if (leftDataType == rightDataType) { - switch (pArgLeft.DataType()) + switch (leftDataType) { case DATATYPE_VALUETYPE: if (pArgLeft.ObjectCls().m_data == pArgRight.ObjectCls().m_data) @@ -1190,13 +1196,18 @@ bool CLR_RT_HeapBlock::ObjectsEqual( { CLR_RT_HeapBlock *objLeft = pArgLeft.Dereference(); CLR_RT_HeapBlock *objRight = pArgRight.Dereference(); + if (objLeft == objRight) + { return true; + } if (objLeft && objRight) { if (!fSameReference || (objLeft->DataType() == DATATYPE_REFLECTION)) + { return ObjectsEqual(*objLeft, *objRight, false); + } } } break; @@ -1226,10 +1237,14 @@ bool CLR_RT_HeapBlock::ObjectsEqual( } } break; + case DATATYPE_REFLECTION: if (pArgLeft.SameHeader(pArgRight)) + { return true; + } break; + default: if (fSameReference == false) { @@ -1248,6 +1263,44 @@ bool CLR_RT_HeapBlock::ObjectsEqual( break; } } + else + { + if ((leftDataType == DATATYPE_BYREF && rightDataType == DATATYPE_OBJECT)) + { + // this is to handle the special case for calls to callvirt with constrained type + // namely with Objects, ValueType and Enum. + // https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.constrained?view=net-6.0 + + CLR_RT_HeapBlock *leftObj = pArgLeft.Dereference(); + CLR_RT_HeapBlock *rightObj = pArgRight.Dereference(); + + if (rightObj->DataType() == DATATYPE_VALUETYPE) + { + CLR_RT_TypeDef_Instance inst; + CLR_RT_HeapBlock *obj = NULL; + + if (!inst.InitializeFromIndex(rightObj->ObjectCls())) + { + } + + if (inst.m_target->dataType != DATATYPE_VALUETYPE) + { + // boxed primitive or enum type + obj = &rightObj[1]; + } + + return ObjectsEqual(*leftObj, *obj, false); + } + else + { + return ObjectsEqual(*leftObj, *rightObj, false); + } + } + else + { + _ASSERTE(false); + } + } return false; } diff --git a/src/CLR/Core/Hardware/Hardware.cpp b/src/CLR/Core/Hardware/Hardware.cpp index 3b48989101..d1da5d5258 100644 --- a/src/CLR/Core/Hardware/Hardware.cpp +++ b/src/CLR/Core/Hardware/Hardware.cpp @@ -178,6 +178,11 @@ void CLR_HW_Hardware::ProcessActivity() eventsCLR |= Event_Wifi_Station; } + if (events & SYSTEM_EVENT_FLAG_BLUETOOTH) + { + eventsCLR |= Event_Bluetooth; + } + if (eventsCLR) { g_CLR_RT_ExecutionEngine.SignalEvents(eventsCLR); diff --git a/src/CLR/Helpers/Base64/base64.c b/src/CLR/Helpers/Base64/base64.c index e4b7a0622c..f7741e09e1 100644 --- a/src/CLR/Helpers/Base64/base64.c +++ b/src/CLR/Helpers/Base64/base64.c @@ -14,159 +14,119 @@ // Any changes here should be refelected in targets\win32\nanoCLR\base64.cpp // /////////////////////////////////////////////////////////////////////////////// +// clang-format off + #include "base64.h" -static void mbedtls_base64_cond_assign_uint32(uint32_t *dest, const uint32_t src, uint32_t condition) +// from mbedTLS common.h +#define MBEDTLS_BYTE_0( x ) ( (uint8_t) ( ( x ) & 0xff ) ) +#define MBEDTLS_BYTE_1( x ) ( (uint8_t) ( ( ( x ) >> 8 ) & 0xff ) ) +#define MBEDTLS_BYTE_2( x ) ( (uint8_t) ( ( ( x ) >> 16 ) & 0xff ) ) +#define MBEDTLS_BYTE_3( x ) ( (uint8_t) ( ( ( x ) >> 24 ) & 0xff ) ) +#define MBEDTLS_BYTE_4( x ) ( (uint8_t) ( ( ( x ) >> 32 ) & 0xff ) ) +#define MBEDTLS_BYTE_5( x ) ( (uint8_t) ( ( ( x ) >> 40 ) & 0xff ) ) +#define MBEDTLS_BYTE_6( x ) ( (uint8_t) ( ( ( x ) >> 48 ) & 0xff ) ) +#define MBEDTLS_BYTE_7( x ) ( (uint8_t) ( ( ( x ) >> 56 ) & 0xff ) ) + +unsigned char mbedtls_ct_uchar_mask_of_range( unsigned char low, + unsigned char high, + unsigned char c ) { - /* MSVC has a warning about unary minus on unsigned integer types, - * but this is well-defined and precisely what we want to do here. */ -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4146) -#endif - - /* Generate bitmask from condition, mask will either be 0xFFFFFFFF or 0 */ - uint32_t mask = (condition | -condition); - mask >>= 31; - mask = -mask; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - - *dest = (src & mask) | ((*dest) & ~mask); + /* low_mask is: 0 if low <= c, 0x...ff if low > c */ + unsigned low_mask = ( (unsigned) c - low ) >> 8; + /* high_mask is: 0 if c <= high, 0x...ff if c > high */ + unsigned high_mask = ( (unsigned) high - c ) >> 8; + return( ~( low_mask | high_mask ) & 0xff ); } -static unsigned char mbedtls_base64_eq(size_t in_a, size_t in_b) +unsigned char mbedtls_ct_base64_enc_char( unsigned char value ) { - size_t difference = in_a ^ in_b; - - /* MSVC has a warning about unary minus on unsigned integer types, - * but this is well-defined and precisely what we want to do here. */ -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4146) -#endif - - difference |= -difference; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - - /* cope with the varying size of size_t per platform */ - difference >>= (sizeof(difference) * 8 - 1); - - return (unsigned char)(1 ^ difference); + unsigned char digit = 0; + /* For each range of values, if value is in that range, mask digit with + * the corresponding value. Since value can only be in a single range, + * only at most one masking will change digit. */ + digit |= mbedtls_ct_uchar_mask_of_range( 0, 25, value ) & ( 'A' + value ); + digit |= mbedtls_ct_uchar_mask_of_range( 26, 51, value ) & ( 'a' + value - 26 ); + digit |= mbedtls_ct_uchar_mask_of_range( 52, 61, value ) & ( '0' + value - 52 ); + digit |= mbedtls_ct_uchar_mask_of_range( 62, 62, value ) & '+'; + digit |= mbedtls_ct_uchar_mask_of_range( 63, 63, value ) & '/'; + return( digit ); } -static void mbedtls_base64_cond_assign_uchar( - unsigned char *dest, - const unsigned char *const src, - unsigned char condition) +signed char mbedtls_ct_base64_dec_value( unsigned char c ) { - /* MSVC has a warning about unary minus on unsigned integer types, - * but this is well-defined and precisely what we want to do here. */ -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4146) -#endif - - /* Generate bitmask from condition, mask will either be 0xFF or 0 */ - unsigned char mask = (condition | -condition); - mask >>= 7; - mask = -mask; - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - - *dest = ((*src) & mask) | ((*dest) & ~mask); + unsigned char val = 0; + /* For each range of digits, if c is in that range, mask val with + * the corresponding value. Since c can only be in a single range, + * only at most one masking will change val. Set val to one plus + * the desired value so that it stays 0 if c is in none of the ranges. */ + val |= mbedtls_ct_uchar_mask_of_range( 'A', 'Z', c ) & ( c - 'A' + 0 + 1 ); + val |= mbedtls_ct_uchar_mask_of_range( 'a', 'z', c ) & ( c - 'a' + 26 + 1 ); + val |= mbedtls_ct_uchar_mask_of_range( '0', '9', c ) & ( c - '0' + 52 + 1 ); + val |= mbedtls_ct_uchar_mask_of_range( '+', '+', c ) & ( c - '+' + 62 + 1 ); + val |= mbedtls_ct_uchar_mask_of_range( '/', '/', c ) & ( c - '/' + 63 + 1 ); + /* At this point, val is 0 if c is an invalid digit and v+1 if c is + * a digit with the value v. */ + return( val - 1 ); } -static unsigned char mbedtls_base64_table_lookup( - const unsigned char *const table, - const size_t table_size, - const size_t table_index) -{ - size_t i; - unsigned char result = 0; - - for (i = 0; i < table_size; ++i) - { - mbedtls_base64_cond_assign_uchar(&result, &table[i], mbedtls_base64_eq(i, table_index)); - } - - return result; -} - -__nfweak int mbedtls_base64_encode(unsigned char *dst, size_t dlen, size_t *olen, const unsigned char *src, size_t slen) +__nfweak int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen, + const unsigned char *src, size_t slen ) { size_t i, n; int C1, C2, C3; unsigned char *p; - if (slen == 0) + if( slen == 0 ) { *olen = 0; - return (0); + return( 0 ); } - n = slen / 3 + (slen % 3 != 0); + n = slen / 3 + ( slen % 3 != 0 ); - if (n > (BASE64_SIZE_T_MAX - 1) / 4) + if( n > ( BASE64_SIZE_T_MAX - 1 ) / 4 ) { *olen = BASE64_SIZE_T_MAX; - return (MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL); + return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL ); } n *= 4; - if ((dlen < n + 1) || (NULL == dst)) + if( ( dlen < n + 1 ) || ( NULL == dst ) ) { *olen = n + 1; - return (MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL); + return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL ); } - n = (slen / 3) * 3; + n = ( slen / 3 ) * 3; - for (i = 0, p = dst; i < n; i += 3) + for( i = 0, p = dst; i < n; i += 3 ) { C1 = *src++; C2 = *src++; C3 = *src++; - *p++ = mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), ((C1 >> 2) & 0x3F)); - - *p++ = - mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), ((((C1 & 3) << 4) + (C2 >> 4)) & 0x3F)); - - *p++ = mbedtls_base64_table_lookup( - base64_enc_map, - sizeof(base64_enc_map), - ((((C2 & 15) << 2) + (C3 >> 6)) & 0x3F)); - - *p++ = mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), (C3 & 0x3F)); + *p++ = mbedtls_ct_base64_enc_char( ( C1 >> 2 ) & 0x3F ); + *p++ = mbedtls_ct_base64_enc_char( ( ( ( C1 & 3 ) << 4 ) + ( C2 >> 4 ) ) + & 0x3F ); + *p++ = mbedtls_ct_base64_enc_char( ( ( ( C2 & 15 ) << 2 ) + ( C3 >> 6 ) ) + & 0x3F ); + *p++ = mbedtls_ct_base64_enc_char( C3 & 0x3F ); } - if (i < slen) + if( i < slen ) { C1 = *src++; - C2 = ((i + 1) < slen) ? *src++ : 0; + C2 = ( ( i + 1 ) < slen ) ? *src++ : 0; - *p++ = mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), ((C1 >> 2) & 0x3F)); + *p++ = mbedtls_ct_base64_enc_char( ( C1 >> 2 ) & 0x3F ); + *p++ = mbedtls_ct_base64_enc_char( ( ( ( C1 & 3 ) << 4 ) + ( C2 >> 4 ) ) + & 0x3F ); - *p++ = - mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), ((((C1 & 3) << 4) + (C2 >> 4)) & 0x3F)); - - if ((i + 1) < slen) - { - *p++ = mbedtls_base64_table_lookup(base64_enc_map, sizeof(base64_enc_map), (((C2 & 15) << 2) & 0x3F)); - } - else - { - *p++ = '='; - } + if( ( i + 1 ) < slen ) + *p++ = mbedtls_ct_base64_enc_char( ( ( C2 & 15 ) << 2 ) & 0x3F ); + else *p++ = '='; *p++ = '='; } @@ -174,121 +134,107 @@ __nfweak int mbedtls_base64_encode(unsigned char *dst, size_t dlen, size_t *olen *olen = p - dst; *p = 0; - return 0; + return( 0 ); } -__nfweak int mbedtls_base64_decode(unsigned char *dst, size_t dlen, size_t *olen, const unsigned char *src, size_t slen) +__nfweak int mbedtls_base64_decode( unsigned char *dst, size_t dlen, size_t *olen, + const unsigned char *src, size_t slen ) { - size_t i, n; - uint32_t j, x; + size_t i; /* index in source */ + size_t n; /* number of digits or trailing = in source */ + uint32_t x; /* value accumulator */ + unsigned accumulated_digits = 0; + unsigned equals = 0; + int spaces_present = 0; unsigned char *p; - unsigned char dec_map_lookup; /* First pass: check for validity and get output length */ - for (i = n = j = 0; i < slen; i++) + for( i = n = 0; i < slen; i++ ) { /* Skip spaces before checking for EOL */ - x = 0; - while (i < slen && src[i] == ' ') + spaces_present = 0; + while( i < slen && src[i] == ' ' ) { ++i; - ++x; + spaces_present = 1; } /* Spaces at end of buffer are OK */ - if (i == slen) - { + if( i == slen ) break; - } - if ((slen - i) >= 2 && src[i] == '\r' && src[i + 1] == '\n') - { + if( ( slen - i ) >= 2 && + src[i] == '\r' && src[i + 1] == '\n' ) continue; - } - if (src[i] == '\n') - { + if( src[i] == '\n' ) continue; - } /* Space inside a line is an error */ - if (x != 0) - { - return (MBEDTLS_ERR_BASE64_INVALID_CHARACTER); - } + if( spaces_present ) + return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER ); - if (src[i] == '=' && ++j > 2) - { - return (MBEDTLS_ERR_BASE64_INVALID_CHARACTER); - } - - dec_map_lookup = mbedtls_base64_table_lookup(base64_dec_map, sizeof(base64_dec_map), src[i]); + if( src[i] > 127 ) + return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER ); - if (src[i] > 127 || dec_map_lookup == 127) + if( src[i] == '=' ) { - return (MBEDTLS_ERR_BASE64_INVALID_CHARACTER); + if( ++equals > 2 ) + return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER ); } - - if (dec_map_lookup < 64 && j != 0) + else { - return (MBEDTLS_ERR_BASE64_INVALID_CHARACTER); + if( equals != 0 ) + return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER ); + if( mbedtls_ct_base64_dec_value( src[i] ) < 0 ) + return( MBEDTLS_ERR_BASE64_INVALID_CHARACTER ); } - n++; } - if (n == 0) + if( n == 0 ) { *olen = 0; - return (0); + return( 0 ); } /* The following expression is to calculate the following formula without * risk of integer overflow in n: * n = ( ( n * 6 ) + 7 ) >> 3; */ - n = (6 * (n >> 3)) + ((6 * (n & 0x7) + 7) >> 3); - n -= j; + n = ( 6 * ( n >> 3 ) ) + ( ( 6 * ( n & 0x7 ) + 7 ) >> 3 ); + n -= equals; - if (dst == NULL || dlen < n) + if( dst == NULL || dlen < n ) { *olen = n; - return (MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL); + return( MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL ); } - for (j = 3, n = x = 0, p = dst; i > 0; i--, src++) + equals = 0; + for( x = 0, p = dst; i > 0; i--, src++ ) { - if (*src == '\r' || *src == '\n' || *src == ' ') - { + if( *src == '\r' || *src == '\n' || *src == ' ' ) continue; - } - - dec_map_lookup = mbedtls_base64_table_lookup(base64_dec_map, sizeof(base64_dec_map), *src); - mbedtls_base64_cond_assign_uint32(&j, j - 1, mbedtls_base64_eq(dec_map_lookup, 64)); - x = (x << 6) | (dec_map_lookup & 0x3F); + x = x << 6; + if( *src == '=' ) + ++equals; + else + x |= mbedtls_ct_base64_dec_value( *src ); - if (++n == 4) + if( ++accumulated_digits == 4 ) { - n = 0; - if (j > 0) - { - *p++ = (unsigned char)(x >> 16); - } - - if (j > 1) - { - *p++ = (unsigned char)(x >> 8); - } - - if (j > 2) - { - *p++ = (unsigned char)(x); - } + accumulated_digits = 0; + *p++ = MBEDTLS_BYTE_2( x ); + if( equals <= 1 ) *p++ = MBEDTLS_BYTE_1( x ); + if( equals <= 0 ) *p++ = MBEDTLS_BYTE_0( x ); } } *olen = p - dst; - return (0); + return( 0 ); } + +// clang-format on \ No newline at end of file diff --git a/src/CLR/Include/nanoCLR_Runtime.h b/src/CLR/Include/nanoCLR_Runtime.h index 885034f8fb..cb86e1f791 100644 --- a/src/CLR/Include/nanoCLR_Runtime.h +++ b/src/CLR/Include/nanoCLR_Runtime.h @@ -3378,6 +3378,7 @@ typedef enum Events Event_OneWireMaster = 0x00000200, Event_Radio = 0x00000400, Event_Wifi_Station = 0x00000800, + Event_Bluetooth = 0x00001000, Event_AppDomain = 0x02000000, Event_Socket = 0x20000000, Event_IdleCPU = 0x40000000, diff --git a/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h b/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h index 4d87c3e02c..18a46aa05b 100644 --- a/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h +++ b/src/CLR/Include/nanoCLR_Runtime__HeapBlock.h @@ -1307,7 +1307,7 @@ struct CLR_RT_HeapBlock bool IsZero() const; void Promote(); - static CLR_INT32 GetHashCode(CLR_RT_HeapBlock *ptr, bool fRecurse, CLR_INT32 crc); + static CLR_UINT32 GetHashCode(CLR_RT_HeapBlock *ptr, bool fRecurse, CLR_UINT32 crc); static bool ObjectsEqual(const CLR_RT_HeapBlock &left, const CLR_RT_HeapBlock &right, bool fSameReference); static CLR_INT32 Compare_Values(const CLR_RT_HeapBlock &left, const CLR_RT_HeapBlock &right, bool fSigned); diff --git a/src/CLR/Include/nf_errors_exceptions.h b/src/CLR/Include/nf_errors_exceptions.h index cec5d02af2..7a2f957a7a 100644 --- a/src/CLR/Include/nf_errors_exceptions.h +++ b/src/CLR/Include/nf_errors_exceptions.h @@ -3,6 +3,7 @@ // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // + #ifndef NF_ERRORS_H #define NF_ERRORS_H @@ -166,6 +167,6 @@ typedef int HRESULT; #define CLR_S_NO_THREADS MAKE_HRESULT(SEVERITY_SUCCESS, 0x0400, 0x0000) #define CLR_S_RESTART_EXECUTION MAKE_HRESULT(SEVERITY_SUCCESS, 0x0500, 0x0000) -// clang-format off +// clang-format on -#endif // NF_ERRORS_H +#endif // NF_ERRORS_H diff --git a/src/CLR/WireProtocol/WireProtocol_MonitorCommands.c b/src/CLR/WireProtocol/WireProtocol_MonitorCommands.c index 4f1073a794..2f1ccc5ad8 100644 --- a/src/CLR/WireProtocol/WireProtocol_MonitorCommands.c +++ b/src/CLR/WireProtocol/WireProtocol_MonitorCommands.c @@ -219,6 +219,7 @@ int Monitor_UpdateConfiguration(WP_Message *message) case DeviceConfigurationOption_Network: case DeviceConfigurationOption_Wireless80211Network: case DeviceConfigurationOption_X509CaRootBundle: + case DeviceConfigurationOption_X509DeviceCertificates: case DeviceConfigurationOption_All: if (ConfigurationManager_StoreConfigurationBlock( cmd->Data, diff --git a/src/DeviceInterfaces/System.Net/sys_net_native.cpp b/src/DeviceInterfaces/System.Net/sys_net_native.cpp index 23b2283a57..995f25bbc5 100644 --- a/src/DeviceInterfaces/System.Net/sys_net_native.cpp +++ b/src/DeviceInterfaces/System.Net/sys_net_native.cpp @@ -1,4 +1,4 @@ -// +// // Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. @@ -37,6 +37,11 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, + NULL, + NULL, + NULL, Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::InitializeNetworkInterfaceSettings___VOID, Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::UpdateConfiguration___VOID__I4, Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::GetIsNetworkAvailable___STATIC__BOOLEAN, @@ -53,7 +58,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_sys_net_native_System_Net_IPAddress::IPv4ToString___STATIC__STRING__U4, NULL, NULL, NULL, @@ -68,7 +72,6 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, - Library_sys_net_native_System_Net_NetworkInformation_IPGlobalProperties::GetIPAddress___STATIC__SystemNetIPAddress, NULL, NULL, NULL, @@ -81,6 +84,31 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + Library_sys_net_native_System_Net_IPAddress::IPv4ToString___STATIC__STRING__U4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_net_native_System_Net_NetworkInformation_IPGlobalProperties::GetIPAddress___STATIC__SystemNetIPAddress, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, NULL, NULL, NULL, @@ -245,6 +273,8 @@ static const CLR_RT_MethodHandler method_lookup[] = NULL, NULL, NULL, + NULL, + NULL, Library_sys_net_native_System_Net_Sockets_NativeSocket::socket___STATIC__I4__I4__I4__I4, Library_sys_net_native_System_Net_Sockets_NativeSocket::bind___STATIC__VOID__OBJECT__SystemNetEndPoint, Library_sys_net_native_System_Net_Sockets_NativeSocket::connect___STATIC__VOID__OBJECT__SystemNetEndPoint__BOOLEAN, @@ -306,9 +336,9 @@ static const CLR_RT_MethodHandler method_lookup[] = const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_System_Net = { "System.Net", - 0xC74796C2, + 0x5B533478, method_lookup, - { 100, 1, 3, 4 } + { 100, 1, 4, 0 } }; // clang-format on diff --git a/src/DeviceInterfaces/System.Net/sys_net_native.h b/src/DeviceInterfaces/System.Net/sys_net_native.h index 5fed7a0ee7..783b03a4f8 100644 --- a/src/DeviceInterfaces/System.Net/sys_net_native.h +++ b/src/DeviceInterfaces/System.Net/sys_net_native.h @@ -142,10 +142,24 @@ struct Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface //--// }; +struct Library_sys_net_native_nanoFramework_Networking_NetworkHelper +{ + static const int FIELD_STATIC___ipAddressAvailable = 0; + static const int FIELD_STATIC___networkReady = 1; + static const int FIELD_STATIC___requiresDateTime = 2; + static const int FIELD_STATIC___networkHelperStatus = 3; + static const int FIELD_STATIC___helperException = 4; + static const int FIELD_STATIC___workingNetworkInterface = 5; + static const int FIELD_STATIC___ipConfiguration = 6; + static const int FIELD_STATIC___helperInstanciated = 7; + + //--// +}; + struct Library_sys_net_native_System_Net_IPAddress { - static const int FIELD_STATIC__Any = 0; - static const int FIELD_STATIC__Loopback = 1; + static const int FIELD_STATIC__Any = 8; + static const int FIELD_STATIC__Loopback = 9; static const int FIELD__Address = 1; static const int FIELD___family = 2; @@ -196,9 +210,9 @@ struct Library_sys_net_native_System_Net_NetworkInformation_NetworkAvailabilityE struct Library_sys_net_native_System_Net_NetworkInformation_NetworkChange { - static const int FIELD_STATIC__NetworkAddressChanged = 2; - static const int FIELD_STATIC__NetworkAvailabilityChanged = 3; - static const int FIELD_STATIC__NetworkAPStationChanged = 4; + static const int FIELD_STATIC__NetworkAddressChanged = 10; + static const int FIELD_STATIC__NetworkAvailabilityChanged = 11; + static const int FIELD_STATIC__NetworkAPStationChanged = 12; //--// }; diff --git a/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_IPGlobalProperties.cpp b/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_IPGlobalProperties.cpp index 952dbfc4c7..f48b1a8628 100644 --- a/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_IPGlobalProperties.cpp +++ b/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_IPGlobalProperties.cpp @@ -17,6 +17,7 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_IPGlobalProperties: CLR_RT_HeapBlock *ipAddressHbObj; CLR_RT_HeapBlock ipAddress; CLR_INT64 *pRes; + bool ipAddressValid = false; CLR_RT_HeapBlock &top = stack.PushValue(); @@ -35,8 +36,9 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_IPGlobalProperties: CLR_RT_HeapBlock &addressFieldRef = ipAddressHbObj[Library_sys_net_native_System_Net_IPAddress::FIELD__Address]; pRes = (CLR_INT64 *)&addressFieldRef.NumericByRef().s8; - // default to IP Any Address - *pRes = 0; + // IPAddress _family field + // IP v4: AddressFamily.InterNetwork + ipAddressHbObj[Library_sys_net_native_System_Net_IPAddress::FIELD___family].NumericByRef().s4 = SOCK_AF_INET; } // loop through all the network interface and check if any is up @@ -63,18 +65,26 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_IPGlobalProperties: { *pRes = config.IPv4Address; - // IPAddress _family field - // IP v4: AddressFamily.InterNetwork - ipAddressHbObj[Library_sys_net_native_System_Net_IPAddress::FIELD___family].NumericByRef().s4 = - SOCK_AF_INET; - - // set address field with IPAddress heap block object - top.SetObjectReference(ipAddressHbObj); + // we have an IP... + ipAddressValid = true; - // we have an IP, no need to check any other + // .. no need to check any other break; } } + if (ipAddressValid) + { + // set address field with IPAddress heap block object + top.SetObjectReference(ipAddressHbObj); + } + else + { + // default to IP Any Address + top.SetObjectReference(g_CLR_RT_TypeSystem.m_assemblies[ipAddressTypeDef.Assembly() - 1] + ->GetStaticField(Library_sys_net_native_System_Net_IPAddress::FIELD_STATIC__Any) + ->Dereference()); + } + NANOCLR_NOCLEANUP(); } diff --git a/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_NetworkInterface.cpp b/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_NetworkInterface.cpp index d02d231aff..2301d2a79c 100644 --- a/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_NetworkInterface.cpp +++ b/src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_NetworkInterface.cpp @@ -219,8 +219,7 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::G for (int interfaceIndex = 0; interfaceIndex < g_TargetConfiguration.NetworkInterfaceConfigs->Count; interfaceIndex++) { - NANOCLR_CHECK_HRESULT(SOCK_CONFIGURATION_LinkStatus(interfaceIndex, &networkIsAvailable)); - + SOCK_CONFIGURATION_LinkStatus(interfaceIndex, &networkIsAvailable); if (networkIsAvailable) { // network interface is UP, no need to check any other @@ -230,7 +229,7 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::G stack.SetResult_Boolean(networkIsAvailable); - NANOCLR_NOCLEANUP(); + NANOCLR_NOCLEANUP_NOLABEL(); } HRESULT Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::GetNetworkInterfaceCount___STATIC__I4( @@ -316,4 +315,4 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_NetworkInterface::I stack.PushValue().SetInteger((CLR_UINT64)address); NANOCLR_NOCLEANUP(); -} \ No newline at end of file +} diff --git a/src/HAL/Include/nanoHAL_ConfigurationManager.h b/src/HAL/Include/nanoHAL_ConfigurationManager.h index 59d61be5ea..ffe1457ef4 100644 --- a/src/HAL/Include/nanoHAL_ConfigurationManager.h +++ b/src/HAL/Include/nanoHAL_ConfigurationManager.h @@ -131,6 +131,8 @@ extern "C" // StoreConfigurationBlock() is defined in targetHAL_ConfigurationManager.cpp at target level because the target // needs to be free to implement the storage of the configuration block as they see fit + // X509 certs can be large and are usually received in chunks. In this case, the block size parameter is the size of + // the current chunck. bool ConfigurationManager_StoreConfigurationBlock( void *configurationBlock, DeviceConfigurationOption configuration, diff --git a/src/HAL/Include/nanoHAL_Time.h b/src/HAL/Include/nanoHAL_Time.h index 545b94f86a..acc5c22582 100644 --- a/src/HAL/Include/nanoHAL_Time.h +++ b/src/HAL/Include/nanoHAL_Time.h @@ -105,6 +105,13 @@ extern "C" /// Time value. uint64_t HAL_Time_ConvertFromSystemTime(const SYSTEMTIME *systemTime); + /// + /// Converts SYSTEMTIME structure to 64bit time, which is assumed as an offset from 1/1/1601:00:00:00.000 in 100ns. + /// Allows adding extra ticks which will be added to the time value. + /// + /// Time value. + uint64_t HAL_Time_ConvertFromSystemTimeWithTicks(const SYSTEMTIME *systemTime, const uint32_t extraTicks); + /// APIs to convert between types bool HAL_Time_TimeSpanToStringEx(const int64_t &ticks, char *&buf, size_t &len); const char *HAL_Time_CurrentDateTimeToString(); diff --git a/src/HAL/Include/nanoHAL_v2.h b/src/HAL/Include/nanoHAL_v2.h index e312012eaa..3bd5acc3a8 100644 --- a/src/HAL/Include/nanoHAL_v2.h +++ b/src/HAL/Include/nanoHAL_v2.h @@ -73,6 +73,7 @@ typedef enum SLEEP_LEVEL #define SYSTEM_EVENT_FLAG_SOCKET 0x00004000 #define SYSTEM_EVENT_FLAG_ONEWIRE_MASTER 0x00008000 #define SYSTEM_EVENT_FLAG_RADIO 0x00010000 +#define SYSTEM_EVENT_FLAG_BLUETOOTH 0x00020000 //#define SYSTEM_EVENT_FLAG_SPI 0x00008000 //#define SYSTEM_EVENT_FLAG_OEM_RESERVED_1 0x00020000 @@ -106,6 +107,7 @@ typedef enum SLEEP_LEVEL #define EVENT_STORAGE 70 #define EVENT_RADIO 80 #define EVENT_HIGH_RESOLUTION_TIMER 90 +#define EVENT_BLUETOOTH 100 #define EVENT_TOUCH 120 #define EVENT_GESTURE 130 diff --git a/src/HAL/nanoHAL_Time.cpp b/src/HAL/nanoHAL_Time.cpp index 5b45d0ae69..79c26bdd10 100644 --- a/src/HAL/nanoHAL_Time.cpp +++ b/src/HAL/nanoHAL_Time.cpp @@ -48,6 +48,23 @@ uint64_t HAL_Time_ConvertFromSystemTime(const SYSTEMTIME *systemTime) return r; } +/// +/// Converts a SYSTEMTIME value to HAL time value, with extra ticks +/// +uint64_t HAL_Time_ConvertFromSystemTimeWithTicks(const SYSTEMTIME *systemTime, const uint32_t extraTicks) +{ + uint64_t r = + YEARS_TO_DAYS(systemTime->wYear) + MONTH_TO_DAYS(systemTime->wYear, systemTime->wMonth) + systemTime->wDay - 1; + r = (((((r * HOURS_TO_DAY) + systemTime->wHour) * MINUTES_TO_HOUR + systemTime->wMinute) * SECONDS_TO_MINUTES + + systemTime->wSecond) * + MILLISECONDS_TO_SECONDS + + systemTime->wMilliseconds) * + TIMEUNIT_TO_MILLISECONDS + + extraTicks; + + return r; +} + bool HAL_Time_ToSystemTime(uint64_t time, SYSTEMTIME *systemTime) { uint32_t ytd = 0; diff --git a/src/PAL/COM/sockets/ssl/mbedTLS/ssl_generic_init_internal.cpp b/src/PAL/COM/sockets/ssl/mbedTLS/ssl_generic_init_internal.cpp index 35bfb0df09..d081ad0c97 100644 --- a/src/PAL/COM/sockets/ssl/mbedTLS/ssl_generic_init_internal.cpp +++ b/src/PAL/COM/sockets/ssl/mbedTLS/ssl_generic_init_internal.cpp @@ -207,9 +207,9 @@ bool ssl_generic_init_internal( certificate = (const char *)deviceCert->Certificate; certLength = deviceCert->CertificateSize; - // clear private keys, just in case - privateKey = NULL; - privateKeyLength = 0; + // the private key is also part of the device certificate + privateKey = (const uint8_t *)deviceCert->Certificate; + privateKeyLength = deviceCert->CertificateSize; } } diff --git a/src/PAL/Include/nanoPAL_Sockets.h b/src/PAL/Include/nanoPAL_Sockets.h index 7ff1e0a1d9..b665658a93 100644 --- a/src/PAL/Include/nanoPAL_Sockets.h +++ b/src/PAL/Include/nanoPAL_Sockets.h @@ -549,15 +549,13 @@ typedef enum __nfpack NetworkChange_NetworkEventType NetworkChange_NetworkEventType_APStationChanged = 3, } NetworkChange_NetworkEventType; -////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH Windows.Devices.WiFi.WiFiEventType (in managed code) !!! // -////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -enum WiFiEventType +////////////////////////////////////////////////////////////////// +// moved here from src\System.Device.WiFi\sys_dev_wifi_native.h // +////////////////////////////////////////////////////////////////// +typedef enum __nfpack WiFiEventType { - WiFiEventType_Invalid = 0, WiFiEventType_ScanComplete = 1, -}; +} WiFiEventType; /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // !!! KEEP IN SYNC WITH System.Net.NetworkInformation.NetworkChange.NetworkEventFlags (in managed code) !!! // diff --git a/src/PAL/Lwip/lwIP_Sockets.cpp b/src/PAL/Lwip/lwIP_Sockets.cpp index 8a2a2dd45a..808ef9d29d 100644 --- a/src/PAL/Lwip/lwIP_Sockets.cpp +++ b/src/PAL/Lwip/lwIP_Sockets.cpp @@ -727,26 +727,43 @@ int LWIP_SOCKETS_Driver::SetSockOpt(SOCK_SOCKET socket, int level, int optname, switch (optname) { - // If linger value negative then linger off - // otherwise enabled and linger value is number of seconds case SOCK_SOCKO_LINGER: { int lingerValue = *(int *)optval; - if (lingerValue >= 0) + + if (lingerValue < 0) + { + // invalid value, not supported + return SOCK_SOCKET_ERROR; + } + else { + // set linger to ON lopt.l_onoff = 1; - lopt.l_linger = abs(lingerValue); + // set linger value + lopt.l_linger = lingerValue; } + + // set option value pointer and length pNativeOptionValue = (char *)&lopt; optlen = sizeof(lopt); } break; case SOCK_SOCKO_DONTLINGER: + // set linger to OFF + lopt.l_onoff = 0; + + // set option value pointer and length + pNativeOptionValue = (char *)&lopt; + optlen = sizeof(lopt); + break; + case SOCK_SOCKO_EXCLUSIVEADDRESSUSE: nativeIntValue = !*(int *)optval; pNativeOptionValue = (char *)&nativeIntValue; break; + default: break; } @@ -757,7 +774,9 @@ int LWIP_SOCKETS_Driver::SetSockOpt(SOCK_SOCKET socket, int level, int optname, break; } - return lwip_setsockopt(socket, nativeLevel, nativeOptionName, pNativeOptionValue, optlen); + // developer note: consider success if return is 0, because this can return a lwIP error code for some options + errorCode = lwip_setsockopt(socket, nativeLevel, nativeOptionName, pNativeOptionValue, optlen); + return errorCode == 0 ? 0 : SOCK_SOCKET_ERROR; } int LWIP_SOCKETS_Driver::GetSockOpt(SOCK_SOCKET socket, int level, int optname, char *optval, int *optlen) @@ -766,7 +785,6 @@ int LWIP_SOCKETS_Driver::GetSockOpt(SOCK_SOCKET socket, int level, int optname, int nativeLevel; int nativeOptionName; char *pNativeOptval = optval; - int ret; switch (level) { @@ -792,9 +810,10 @@ int LWIP_SOCKETS_Driver::GetSockOpt(SOCK_SOCKET socket, int level, int optname, break; } - ret = lwip_getsockopt(socket, nativeLevel, nativeOptionName, pNativeOptval, (u32_t *)optlen); + // developer note: consider success if return is 0, because this can return a lwIP error code for some options + errorCode = lwip_getsockopt(socket, nativeLevel, nativeOptionName, pNativeOptval, (u32_t *)optlen); - if (ret == 0) + if (errorCode == 0) { switch (level) { @@ -816,7 +835,7 @@ int LWIP_SOCKETS_Driver::GetSockOpt(SOCK_SOCKET socket, int level, int optname, } } - return ret; + return errorCode == 0 ? 0 : SOCK_SOCKET_ERROR; } int LWIP_SOCKETS_Driver::GetPeerName(SOCK_SOCKET socket, SOCK_sockaddr *name, int *namelen) diff --git a/src/System.Device.WiFi/sys_dev_wifi_native.cpp b/src/System.Device.WiFi/sys_dev_wifi_native.cpp new file mode 100644 index 0000000000..c1b680b4f1 --- /dev/null +++ b/src/System.Device.WiFi/sys_dev_wifi_native.cpp @@ -0,0 +1,87 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_wifi_native.h" + +// clang-format off + +static const CLR_RT_MethodHandler method_lookup[] = +{ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::DisposeNative___VOID, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeInit___VOID, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeConnect___SystemDeviceWiFiWiFiConnectionStatus__STRING__STRING__SystemDeviceWiFiWiFiReconnectionKind, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeDisconnect___VOID, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeScanAsync___VOID, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::GetNativeScanReport___SZARRAY_U1, + NULL, + Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeFindWirelessAdapters___STATIC__SZARRAY_U1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_System_Device_WiFi = +{ + "System.Device.WiFi", + 0x5C9E06C4, + method_lookup, + { 100, 0, 6, 3 } +}; + +// clang-format on diff --git a/src/System.Device.WiFi/sys_dev_wifi_native.h b/src/System.Device.WiFi/sys_dev_wifi_native.h new file mode 100644 index 0000000000..a21af1bce8 --- /dev/null +++ b/src/System.Device.WiFi/sys_dev_wifi_native.h @@ -0,0 +1,128 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +#ifndef SYS_DEV_WIFI_NATIVE_H +#define SYS_DEV_WIFI_NATIVE_H + +#include +#include +#include +#include + +typedef enum __nfpack WiFiConnectionStatus +{ + WiFiConnectionStatus_AccessRevoked = 0, + WiFiConnectionStatus_InvalidCredential = 1, + WiFiConnectionStatus_NetworkNotAvailable = 2, + WiFiConnectionStatus_Success = 3, + WiFiConnectionStatus_Timeout = 4, + WiFiConnectionStatus_UnspecifiedFailure = 5, + WiFiConnectionStatus_UnsupportedAuthenticationProtocol = 6, +} WiFiConnectionStatus; + +//////////////////////////////////////////////// +// moved to nanoPAL_Sockets.h for convenience // +//////////////////////////////////////////////// +// typedef enum __nfpack WiFiEventType +// { +// WiFiEventType_ScanComplete = 1, +// } WiFiEventType; + +typedef enum __nfpack WiFiNetworkKind +{ + WiFiNetworkKind_Adhoc = 0, + WiFiNetworkKind_Any = 1, + WiFiNetworkKind_Infrastructure = 2, +} WiFiNetworkKind; + +typedef enum __nfpack WiFiReconnectionKind +{ + WiFiReconnectionKind_Automatic = 0, + WiFiReconnectionKind_Manual = 1, +} WiFiReconnectionKind; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAvailableNetwork +{ + static const int FIELD___bsid = 1; + static const int FIELD___ssid = 2; + static const int FIELD___rssi = 3; + static const int FIELD___networkKind = 4; + + //--// +}; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiConnectionResult +{ + static const int FIELD___ConnectionStatus = 1; + + //--// +}; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter +{ + static const int FIELD_STATIC__s_eventListener = 0; + + static const int FIELD___networkInterface = 1; + static const int FIELD___syncLock = 2; + static const int FIELD__AvailableNetworksChanged = 3; + static const int FIELD___disposedValue = 4; + + NANOCLR_NATIVE_DECLARE(DisposeNative___VOID); + NANOCLR_NATIVE_DECLARE(NativeInit___VOID); + NANOCLR_NATIVE_DECLARE( + NativeConnect___SystemDeviceWiFiWiFiConnectionStatus__STRING__STRING__SystemDeviceWiFiWiFiReconnectionKind); + NANOCLR_NATIVE_DECLARE(NativeDisconnect___VOID); + NANOCLR_NATIVE_DECLARE(NativeScanAsync___VOID); + NANOCLR_NATIVE_DECLARE(GetNativeScanReport___SZARRAY_U1); + NANOCLR_NATIVE_DECLARE(NativeFindWirelessAdapters___STATIC__SZARRAY_U1); + + //--// + static HRESULT GetNetInterfaceIndex(CLR_RT_StackFrame &stack, int *pNetIndex); + static int StoreApRecordsToString(uint8_t *pTarget, wifi_ap_record_t *apRecords, uint16_t recordCount); +}; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiNetworkReport +{ + static const int FIELD___wifiNetworks = 1; + + //--// +}; + +struct Library_sys_dev_wifi_native_nanoFramework_Networking_WiFiNetworkHelper +{ + static const int FIELD_STATIC___ipAddressAvailable = 1; + static const int FIELD_STATIC___networkReady = 2; + static const int FIELD_STATIC___requiresDateTime = 3; + static const int FIELD_STATIC___ssid = 4; + static const int FIELD_STATIC___password = 5; + static const int FIELD_STATIC___wifi = 6; + static const int FIELD_STATIC___reconnectionKind = 7; + static const int FIELD_STATIC___ipConfiguration = 8; + static const int FIELD_STATIC___networkHelperStatus = 9; + static const int FIELD_STATIC___helperException = 10; + static const int FIELD_STATIC___workingNetworkInterface = 11; + static const int FIELD_STATIC___helperInstanciated = 12; + + //--// +}; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiEvent +{ + static const int FIELD__EventType = 3; + static const int FIELD__Time = 4; + + //--// +}; + +struct Library_sys_dev_wifi_native_System_Device_WiFi_WiFiEventListener +{ + static const int FIELD__wifiAdapters = 1; + + //--// +}; + +extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_System_Device_WiFi; + +#endif // SYS_DEV_WIFI_NATIVE_H diff --git a/src/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp b/src/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp index 63784597f4..e91775fc81 100644 --- a/src/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp +++ b/src/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp @@ -231,15 +231,17 @@ HRESULT Library_nf_sys_io_filesystem_System_IO_Directory::GetFilesNative___STATI } } } + + f_closedir(¤tDirectory); } NANOCLR_CLEANUP(); - if (stringBuffer == NULL) + if (stringBuffer != NULL) { platform_free(stringBuffer); } - if (workingBuffer == NULL) + if (workingBuffer != NULL) { platform_free(workingBuffer); } diff --git a/src/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort__.cpp b/src/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort__.cpp index 399948a2be..500023b64c 100644 --- a/src/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort__.cpp +++ b/src/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort__.cpp @@ -129,6 +129,7 @@ bool Library_sys_io_ser_native_System_IO_Ports_SerialPort::GetLineFromRxBuffer( if (newLineIndex == 0) { // found and nothing else to compare + index++; break; } else @@ -168,16 +169,16 @@ bool Library_sys_io_ser_native_System_IO_Ports_SerialPort::GetLineFromRxBuffer( { // allocate memory for the string, including the new line char(s) // the new line char allow enough room in the buffer for for the terminator - line = (uint8_t *)platform_malloc(index + newLineLength); + line = (uint8_t *)platform_malloc(index); if (line != NULL) { // pop string AND new line from buffer - ringBuffer->Pop(line, index + newLineLength); + ringBuffer->Pop(line, index); // the returned string DOES NOT include the new line char(s) // put a terminator at index 0 where the new line char(s) are, so the real string ends there - line[index] = 0; + line[index - newLineLength] = 0; } } } diff --git a/src/Windows.Devices.Wifi/win_dev_wifi_native.cpp b/src/Windows.Devices.Wifi/win_dev_wifi_native.cpp deleted file mode 100644 index 35fe0ddbee..0000000000 --- a/src/Windows.Devices.Wifi/win_dev_wifi_native.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include "win_dev_wifi_native.h" - -// clang-format off - -static const CLR_RT_MethodHandler method_lookup[] = -{ - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::DisposeNative___VOID, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeInit___VOID, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeConnect___WindowsDevicesWiFiWiFiConnectionStatus__STRING__STRING__WindowsDevicesWiFiWiFiReconnectionKind, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeDisconnect___VOID, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeScanAsync___VOID, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNativeScanReport___SZARRAY_U1, - NULL, - Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeFindWirelessAdapters___STATIC__SZARRAY_U1, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, -}; - -const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_Windows_Devices_Wifi = -{ - "Windows.Devices.Wifi", - 0xA94A849E, - method_lookup, - { 100, 0, 6, 2 } -}; - -// clang-format on diff --git a/src/Windows.Devices.Wifi/win_dev_wifi_native.h b/src/Windows.Devices.Wifi/win_dev_wifi_native.h deleted file mode 100644 index 0f1f49eb3d..0000000000 --- a/src/Windows.Devices.Wifi/win_dev_wifi_native.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef WIN_DEV_WIFI_NATIVE_H -#define WIN_DEV_WIFI_NATIVE_H - -#include -#include -#include - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAvailableNetwork -{ - static const int FIELD___bsid = 1; - static const int FIELD___ssid = 2; - static const int FIELD___rssi = 3; - static const int FIELD___networkKind = 4; - - //--// -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiConnectionResult -{ - static const int FIELD___ConnectionStatus = 1; - - //--// -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter -{ - static const int FIELD_STATIC__s_eventListener = 0; - - static const int FIELD___networkInterface = 1; - static const int FIELD___syncLock = 2; - static const int FIELD__AvailableNetworksChanged = 3; - static const int FIELD___disposedValue = 4; - - NANOCLR_NATIVE_DECLARE(DisposeNative___VOID); - NANOCLR_NATIVE_DECLARE(NativeInit___VOID); - NANOCLR_NATIVE_DECLARE( - NativeConnect___WindowsDevicesWiFiWiFiConnectionStatus__STRING__STRING__WindowsDevicesWiFiWiFiReconnectionKind); - NANOCLR_NATIVE_DECLARE(NativeDisconnect___VOID); - NANOCLR_NATIVE_DECLARE(NativeScanAsync___VOID); - NANOCLR_NATIVE_DECLARE(GetNativeScanReport___SZARRAY_U1); - NANOCLR_NATIVE_DECLARE(NativeFindWirelessAdapters___STATIC__SZARRAY_U1); - - //--// -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiEvent -{ - static const int FIELD__EventType = 3; - static const int FIELD__Time = 4; - - //--// -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiEventListener -{ - static const int FIELD__wifiAdapters = 1; - - //--// -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiNetworkReport -{ - static const int FIELD___wifiNetworks = 1; - - //--// -}; - -extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_Windows_Devices_Wifi; - -#endif //WIN_DEV_WIFI_NATIVE_H diff --git a/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj b/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj index 5b28371bef..da4ae55a96 100644 --- a/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj +++ b/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj @@ -24,6 +24,7 @@ + diff --git a/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj.filters b/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj.filters index c28493a364..a995bfae7f 100644 --- a/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj.filters +++ b/src/nanoFramework.Runtime.Native/Runtime.Native.vcxproj.filters @@ -35,6 +35,9 @@ Source Files + + Source Files + Source Files diff --git a/src/nanoFramework.Runtime.Native/nf_rt_native.cpp b/src/nanoFramework.Runtime.Native/nf_rt_native.cpp index e435383708..aa77cd5ef2 100644 --- a/src/nanoFramework.Runtime.Native/nf_rt_native.cpp +++ b/src/nanoFramework.Runtime.Native/nf_rt_native.cpp @@ -6,6 +6,7 @@ #include "nf_rt_native.h" +// clang-format off static const CLR_RT_MethodHandler method_lookup[] = { @@ -35,12 +36,15 @@ static const CLR_RT_MethodHandler method_lookup[] = Library_nf_rt_native_nanoFramework_Runtime_Native_SystemInfo::get_Platform___STATIC__STRING, NULL, Library_nf_rt_native_nanoFramework_Runtime_Native_SystemInfo::GetNativeFloatingPointSupport___STATIC__U1, + Library_nf_rt_native_System_Environment::get_TickCount64___STATIC__I8, }; const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Runtime_Native = { "nanoFramework.Runtime.Native", - 0x2307A8F3, + 0x109F6F22, method_lookup, - { 100, 0, 8, 0 } + { 100, 0, 9, 0 } }; + +// clang-format on diff --git a/src/nanoFramework.Runtime.Native/nf_rt_native.h b/src/nanoFramework.Runtime.Native/nf_rt_native.h index 9a7da292cf..2b994874a8 100644 --- a/src/nanoFramework.Runtime.Native/nf_rt_native.h +++ b/src/nanoFramework.Runtime.Native/nf_rt_native.h @@ -10,26 +10,20 @@ #include #include - -////////////////////////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH nanoFramework.Runtime.Native.SystemInfo.FloatingPoint (in managed code) !!! // -////////////////////////////////////////////////////////////////////////////////////////////////////////// - -enum FloatingPoint +typedef enum __nfpack SystemInfo_FloatingPoint { - FloatingPoint_None = 0, - FloatingPoint_SinglePrecisionSoftware = 1, - FloatingPoint_SinglePrecisionHardware = 2, - FloatingPoint_DoublePrecisionSoftware = 3, - FloatingPoint_DoublePrecisionHardware = 4, -}; + SystemInfo_FloatingPoint_None = 0, + SystemInfo_FloatingPoint_SinglePrecisionSoftware = 1, + SystemInfo_FloatingPoint_SinglePrecisionHardware = 2, + SystemInfo_FloatingPoint_DoublePrecisionSoftware = 3, + SystemInfo_FloatingPoint_DoublePrecisionHardware = 4, +} SystemInfo_FloatingPoint; struct Library_nf_rt_native_nanoFramework_Runtime_Native_ExecutionConstraint { NANOCLR_NATIVE_DECLARE(Install___STATIC__VOID__I4__I4); //--// - }; struct Library_nf_rt_native_nanoFramework_Runtime_Native_GC @@ -38,7 +32,6 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_GC NANOCLR_NATIVE_DECLARE(EnableGCMessages___STATIC__VOID__BOOLEAN); //--// - }; struct Library_nf_rt_native_nanoFramework_Runtime_Native_Power @@ -48,7 +41,6 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_Power NANOCLR_NATIVE_DECLARE(NativeReboot___STATIC__VOID); //--// - }; struct Library_nf_rt_native_nanoFramework_Runtime_Native_Rtc @@ -56,7 +48,6 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_Rtc NANOCLR_NATIVE_DECLARE(Native_RTC_SetSystemTime___STATIC__BOOLEAN__I4__U1__U1__U1__U1__U1__U1); //--// - }; struct Library_nf_rt_native_nanoFramework_Runtime_Native_SystemInfo @@ -71,9 +62,15 @@ struct Library_nf_rt_native_nanoFramework_Runtime_Native_SystemInfo NANOCLR_NATIVE_DECLARE(GetNativeFloatingPointSupport___STATIC__U1); //--// +}; +struct Library_nf_rt_native_System_Environment +{ + NANOCLR_NATIVE_DECLARE(get_TickCount64___STATIC__I8); + + //--// }; extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Runtime_Native; -#endif // NF_RT_NATIVE_H +#endif //_NF_RT_NATIVE_H_ diff --git a/src/nanoFramework.Runtime.Native/nf_rt_native_System_Environment.cpp b/src/nanoFramework.Runtime.Native/nf_rt_native_System_Environment.cpp new file mode 100644 index 0000000000..90d609b611 --- /dev/null +++ b/src/nanoFramework.Runtime.Native/nf_rt_native_System_Environment.cpp @@ -0,0 +1,18 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +#include "nf_rt_native.h" + +HRESULT Library_nf_rt_native_System_Environment::get_TickCount64___STATIC__I8(CLR_RT_StackFrame &stack) +{ + NATIVE_PROFILE_CLR_CORE(); + NANOCLR_HEADER(); + + int64_t ticksValue = CLR_RT_ExecutionEngine::GetUptime(); + + stack.SetResult_I8(ticksValue); + + NANOCLR_NOCLEANUP_NOLABEL(); +} diff --git a/src/nanoFramework.Runtime.Native/nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo.cpp b/src/nanoFramework.Runtime.Native/nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo.cpp index 863508e51a..4b7298601c 100644 --- a/src/nanoFramework.Runtime.Native/nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo.cpp +++ b/src/nanoFramework.Runtime.Native/nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo.cpp @@ -135,24 +135,24 @@ HRESULT Library_nf_rt_native_nanoFramework_Runtime_Native_SystemInfo::GetNativeF { NANOCLR_HEADER(); { - FloatingPoint floatingPointOption = FloatingPoint_None; + SystemInfo_FloatingPoint floatingPointOption = SystemInfo_FloatingPoint_None; #if !defined(NANOCLR_EMULATED_FLOATINGPOINT) #if (USE_FPU == TRUE) #if (DP_FLOATINGPOINT == TRUE) - floatingPointOption = FloatingPoint_DoublePrecisionHardware; + floatingPointOption = SystemInfo_FloatingPoint_DoublePrecisionHardware; #else - floatingPointOption = FloatingPoint_SinglePrecisionHardware; + floatingPointOption = SystemInfo_FloatingPoint_SinglePrecisionHardware; #endif #else #if (DP_FLOATINGPOINT == TRUE) - floatingPointOption = FloatingPoint_DoublePrecisionSoftware; + floatingPointOption = SystemInfo_FloatingPoint_DoublePrecisionSoftware; #else - floatingPointOption = FloatingPoint_SinglePrecisionSoftware; + floatingPointOption = SystemInfo_FloatingPoint_SinglePrecisionSoftware; #endif #endif // (USE_FPU == TRUE) diff --git a/targets-community b/targets-community index be900ed42a..e74cd6291b 160000 --- a/targets-community +++ b/targets-community @@ -1 +1 @@ -Subproject commit be900ed42adc9251657330da137638d60ea8a0cf +Subproject commit e74cd6291bb8c1686b21f9f9c0756b455adeda1b diff --git a/targets/ChibiOS/CMakeLists.txt b/targets/ChibiOS/CMakeLists.txt index 5dff199797..8d49336b1c 100644 --- a/targets/ChibiOS/CMakeLists.txt +++ b/targets/ChibiOS/CMakeLists.txt @@ -75,7 +75,7 @@ endif() if(RTOS_VERSION_EMPTY) # no ChibiOS version actualy specified, must be empty which is fine, we'll default to a known good version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(RTOS_VERSION "stable_21.6.x") + set(RTOS_VERSION "stable_21.11.x") endif() if(NO_RTOS_SOURCE_FOLDER) @@ -91,36 +91,22 @@ if(NO_RTOS_SOURCE_FOLDER) else() # ChibiOS source was specified - # sanity check is source path exists - if(EXISTS ${RTOS_SOURCE_FOLDER}/) - if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows) - message(STATUS "RTOS is: ChibiOS ${RTOS_VERSION} (source from: ${RTOS_SOURCE_FOLDER})") - FetchContent_Declare( - chibios - SOURCE_DIR ${RTOS_SOURCE_FOLDER} - ) - - else() - # running on *nix requires setting up a local git repo from SVN - # with git svn clone https://svn.osdn.net/svnroot/chibios/branches/${RTOS_VERSION} -rHEAD - message(STATUS "RTOS is: ChibiOS ${RTOS_VERSION} (source from: ${RTOS_SOURCE_FOLDER})") - - FetchContent_Declare( - chibios - GIT_REPOSITORY ${RTOS_SOURCE_FOLDER} - GIT_TAG master - ) + message(STATUS "RTOS is: ChibiOS ${RTOS_VERSION} (source from: ${RTOS_SOURCE_FOLDER})") + FetchContent_Declare( + chibios + SOURCE_DIR ${RTOS_SOURCE_FOLDER} + ) - endif() - else() - message(FATAL_ERROR "Couldn't find ChibiOS source at ${RTOS_SOURCE_FOLDER}/") - endif() endif() +# Check if population has already been performed FetchContent_GetProperties(chibios) -FetchContent_Populate(chibios) +if(NOT chibios_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(chibios) +endif() if(CHIBIOS_CONTRIB_REQUIRED) if(NO_CHIBIOS_CONTRIB_SOURCE) @@ -137,23 +123,21 @@ if(CHIBIOS_CONTRIB_REQUIRED) else() # ChibiOS-Contrib source was specified - # sanity check is source path exists - if(EXISTS ${CHIBIOS_CONTRIB_SOURCE}/) - message(STATUS "ChibiOS-Contrib (source from: ${CHIBIOS_CONTRIB_SOURCE})") + message(STATUS "ChibiOS-Contrib (source from: ${CHIBIOS_CONTRIB_SOURCE})") - FetchContent_Declare( - chibios-contrib - SOURCE_DIR ${CHIBIOS_CONTRIB_SOURCE} - ) - - else() - message(FATAL_ERROR "Couldn't find ChibiOS-Contrib source at ${CHIBIOS_CONTRIB_SOURCE}/") - endif() + FetchContent_Declare( + chibios-contrib + SOURCE_DIR ${CHIBIOS_CONTRIB_SOURCE} + ) endif() + # Check if population has already been performed FetchContent_GetProperties(chibios-contrib) - FetchContent_Populate(chibios-contrib) + if(NOT chibios-contrib_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(chibios-contrib) + endif() endif() @@ -201,23 +185,21 @@ if(NF_FEATURE_HAS_SDCARD OR NF_FEATURE_HAS_USB_MSD) else() # FatFS source was specified - # sanity check is source path exists - if(EXISTS ${FATFS_SOURCE}/) - message(STATUS "FatFS ${FATFS_VERSION_TAG} source from: ${FATFS_SOURCE})") - - FetchContent_Declare( - fatfs - SOURCE_DIR ${FATFS_SOURCE} - ) + message(STATUS "FatFS ${FATFS_VERSION_TAG} source from: ${FATFS_SOURCE})") - else() - message(FATAL_ERROR "Couldn't find FatFS source at ${FATFS_SOURCE}/") - endif() + FetchContent_Declare( + fatfs + SOURCE_DIR ${FATFS_SOURCE} + ) endif() + # Check if population has already been performed FetchContent_GetProperties(fatfs) - FetchContent_Populate(fatfs) + if(NOT fatfs_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(fatfs) + endif() # have to delete the ffconf.h template from the repo execute_process( @@ -240,7 +222,7 @@ if(NF_SECURITY_MBEDTLS) # set tag for currently supported version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(MBEDTLS_GIT_TAG "mbedtls-2.26.0") + set(MBEDTLS_GIT_TAG "mbedtls-2.28.0") # set options for mbed TLS option(ENABLE_TESTING "no testing when building mbed TLS." OFF) @@ -257,26 +239,22 @@ if(NF_SECURITY_MBEDTLS) else() # mbedTLS source was specified - # message(FATAL_ERROR ${mbedtls_SOURCE_DIR}") - - # sanity check is source path exists - if(EXISTS ${MBEDTLS_SOURCE}/) message(STATUS "mbedTLS ${MBEDTLS_GIT_TAG} (source from: ${MBEDTLS_SOURCE})") - FetchContent_Declare( - mbedtls - SOURCE_DIR ${MBEDTLS_SOURCE} - ) - - else() - message(FATAL_ERROR "Couldn't find mbedTLS source at ${MBEDTLS_SOURCE}/") - endif() + FetchContent_Declare( + mbedtls + SOURCE_DIR ${MBEDTLS_SOURCE} + ) endif() + # Check if population has already been performed FetchContent_GetProperties(mbedtls) - FetchContent_Populate(mbedtls) + if(NOT mbedtls_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(mbedtls) + endif() set(mbedTLS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/3rdparty/humblelogging/include) set(mbedTLS_LIBRARIES ${CMAKE_SHARED_LIBRARY_PREFIX}mbedTLS${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -285,12 +263,12 @@ endif() # set target base location # this has to be set before the class library modules are pulled in -if(EXISTS ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD}) +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD}) # set target base location set(TARGET_BASE_LOCATION ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD} CACHE INTERNAL "make global") else() # try to find board in the Community targets folder - if(EXISTS ${CMAKE_SOURCE_DIR}/targets-community/ChibiOS/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets-community/ChibiOS/${TARGET_BOARD}) # set target base location set(TARGET_BASE_LOCATION ${CMAKE_SOURCE_DIR}/targets-community/ChibiOS/${TARGET_BOARD} CACHE INTERNAL "make global") else() @@ -306,7 +284,7 @@ include_directories( ${CMSIS_RTOS_INCLUDE_DIR}) # need to find board definition files (board.c and board.h) # start search in nanoFramework ChibiOS 'overlay' folder -if(EXISTS ${CMAKE_SOURCE_DIR}/targets/ChibiOS/_nf-overlay/os/hal/boards/${TARGET_BOARD}) +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/ChibiOS/_nf-overlay/os/hal/boards/${TARGET_BOARD}) # board found # if it's on nF overlay board.c and board.h exist there for sure set(CHIBIOS_BOARD_DEFINITIONS_LOCATION "Board definition files taken from nanoFramework overlay" CACHE INTERNAL "Location of board definition files") @@ -315,7 +293,7 @@ else() # board NOT found in ChibiOS 'overlay' # try to find it in the target boards - if(EXISTS ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD}) # board found # check if the board definition files are available at the target folder if( EXISTS ${CMAKE_SOURCE_DIR}/targets/ChibiOS/${TARGET_BOARD}/board.c AND @@ -327,7 +305,7 @@ else() else() # board.c and board.h are NOT in the target folder, try to find them in the official distribution - if(EXISTS ${chibios_SOURCE_DIR}/os/hal/boards/${TARGET_BOARD}) + if(IS_DIRECTORY ${chibios_SOURCE_DIR}/os/hal/boards/${TARGET_BOARD}) # board found # if it's on the ChibiOS official distribution board.c and board.h exist here for sure set(CHIBIOS_BOARD_DEFINITIONS_LOCATION "Board definition files taken from official ChibiOS distribution" CACHE INTERNAL "Location of board definition files") @@ -344,7 +322,7 @@ else() else() # try to find board in the Community targets folder - if(EXISTS ${CMAKE_SOURCE_DIR}/targets-community/ChibiOS/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets-community/ChibiOS/${TARGET_BOARD}) # set flag for this being a community board set(IS_COMMUNITY_TARGET TRUE CACHE INTERNAL "Community target flag") @@ -360,7 +338,7 @@ else() else() # board.c and board.h are NOT in the target folder, try to find them in the official distribution - if(EXISTS ${chibios_SOURCE_DIR}/os/hal/boards/${TARGET_BOARD}) + if(IS_DIRECTORY ${chibios_SOURCE_DIR}/os/hal/boards/${TARGET_BOARD}) # board found # if it's on the ChibiOS official distribution board.c and board.h exist here for sure set(CHIBIOS_BOARD_DEFINITIONS_LOCATION "Board definition files taken from official ChibiOS distribution" CACHE INTERNAL "Location of board definition files") @@ -416,24 +394,21 @@ if(NF_FEATURE_USE_SPIFFS) else() # SPIFFS source was specified - # sanity check is source path exists - if(EXISTS ${SPIFFS_SOURCE}/) - message(STATUS "SPIFFS source from: ${SPIFFS_SOURCE}") - - FetchContent_Declare( - spiffs - GIT_REPOSITORY ${SPIFFS_SOURCE} - GIT_TAG "nf-build" - ) + message(STATUS "SPIFFS source from: ${SPIFFS_SOURCE}") - else() - message(FATAL_ERROR "Couldn't find SPIFFS source at ${SPIFFS_SOURCE}/") - endif() + FetchContent_Declare( + spiffs + SOURCE_DIR ${SPIFFS_SOURCE} + ) endif() - + + # Check if population has already been performed FetchContent_GetProperties(spiffs) - FetchContent_Populate(spiffs) + if(NOT spiffs_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(spiffs) + endif() add_subdirectory(_spiffs) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt b/targets/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt deleted file mode 100644 index 17f880a930..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. -# - -include(binutils.common) -include(binutils.ChibiOS) - -nf_setup_target_build( - HAS_NANOBOOTER - - BOOTER_LINKER_FILE - netduino3wifi_booter - - CLR_LINKER_FILE - netduino3wifi_CLR - - BOOTER_EXTRA_LINKMAP_PROPERTIES - ",--library-path=${CMAKE_SOURCE_DIR}/targets/ChibiOS/_common,--defsym=__main_stack_size__=0x400,--defsym=__process_stack_size__=0x400,--defsym=__crt_heap_size__=0x10000" - - CLR_EXTRA_LINKMAP_PROPERTIES - ",--library-path=${CMAKE_SOURCE_DIR}/targets/ChibiOS/_common,--defsym=__main_stack_size__=0x400,--defsym=__process_stack_size__=0x800,--defsym=__crt_heap_size__=0x10000" -) - -# if HEX2DFU tool is available pack the binaries into a DFU package -if(HEX2DFU_TOOL_AVAILABLE) - - #################################################################################################### - ## when changing the linker file make sure to update the new addresses for the image files below ## - ## DO NOT use the leading 0x notation, just the address in plain hexadecimal formating ## - #################################################################################################### - - if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) - nf_generate_dfu_package( - ${CMAKE_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000 - ${CMAKE_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08008000 - ${CMAKE_SOURCE_DIR}/build/nanobooter-nanoclr.dfu - ) - else() - nf_generate_dfu_package( - ${CMAKE_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000 - ${CMAKE_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08004000 - ${CMAKE_SOURCE_DIR}/build/nanobooter-nanoclr.dfu - ) - endif() - -endif() diff --git a/targets/ChibiOS/NETDUINO3_WIFI/README.md b/targets/ChibiOS/NETDUINO3_WIFI/README.md deleted file mode 100644 index f42f6d2581..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/README.md +++ /dev/null @@ -1,28 +0,0 @@ -## Configuration of Chibios, HAL and MCU ## - -In this folder you'll find a 'port' of the nanoframework to work on a WildernessLabs Netduino 3 Wifi board. You can find [here] some more information on the board specifics, used MCU, RAM and FLASH memory available. - - - -**NOTE: the configuration was successfully tested on a WildernessLabs NETDUINO3_WIFI board using the Serial over USB connection on USB port 1 that creates a virtual COM port.** - -## ADC configurations - -The following ADC channels (and respective GPIO pins) are available to the managed API, in the respective index: -- PC0, ADC1 IN10 -- PC1 ADC1 IN11 -- PC2 ADC2 IN14 -- PC3 ADC2 IN15 -- PC4 ADC3 IN12 -- PC5 ADC3 IN13 -- Temp Sensor ADC1 -- VrefInt ADC1 -- Vbatt ADC1 - -These first 6 channels are exposed in the board J4 connector as A0 to A5. - - -## Floating point - -The current build is set to add support for single-precision floating point. -Meaning that `System.Math` API supports only the `float` overloads. The `double` ones will throw a `NotImplementedException`. diff --git a/targets/ChibiOS/NETDUINO3_WIFI/board.c b/targets/ChibiOS/NETDUINO3_WIFI/board.c deleted file mode 100644 index 5d508db9ca..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/board.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * This file has been automatically generated using ChibiStudio board - * generator plugin. Do not edit manually. - */ - -#include "hal.h" -#include "stm32_gpio.h" - -/*===========================================================================*/ -/* Driver local definitions. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver local variables and types. */ -/*===========================================================================*/ - -/** - * @brief Type of STM32 GPIO port setup. - */ -typedef struct { - uint32_t moder; - uint32_t otyper; - uint32_t ospeedr; - uint32_t pupdr; - uint32_t odr; - uint32_t afrl; - uint32_t afrh; -} gpio_setup_t; - -/** - * @brief Type of STM32 GPIO initialization data. - */ -typedef struct { -#if STM32_HAS_GPIOA || defined(__DOXYGEN__) - gpio_setup_t PAData; -#endif -#if STM32_HAS_GPIOB || defined(__DOXYGEN__) - gpio_setup_t PBData; -#endif -#if STM32_HAS_GPIOC || defined(__DOXYGEN__) - gpio_setup_t PCData; -#endif -#if STM32_HAS_GPIOD || defined(__DOXYGEN__) - gpio_setup_t PDData; -#endif -#if STM32_HAS_GPIOE || defined(__DOXYGEN__) - gpio_setup_t PEData; -#endif -// #if STM32_HAS_GPIOF || defined(__DOXYGEN__) -// gpio_setup_t PFData; -// #endif -// #if STM32_HAS_GPIOG || defined(__DOXYGEN__) -// gpio_setup_t PGData; -// #endif -#if STM32_HAS_GPIOH || defined(__DOXYGEN__) - gpio_setup_t PHData; -#endif -// #if STM32_HAS_GPIOI || defined(__DOXYGEN__) -// gpio_setup_t PIData; -// #endif -// #if STM32_HAS_GPIOJ || defined(__DOXYGEN__) -// gpio_setup_t PJData; -// #endif -// #if STM32_HAS_GPIOK || defined(__DOXYGEN__) -// gpio_setup_t PKData; -// #endif -} gpio_config_t; - -/** - * @brief STM32 GPIO static initialization data. - */ -static const gpio_config_t gpio_default_config = { -#if STM32_HAS_GPIOA - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, -#endif -#if STM32_HAS_GPIOB - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, -#endif -#if STM32_HAS_GPIOC - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, -#endif -#if STM32_HAS_GPIOD - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, -#endif -#if STM32_HAS_GPIOE - {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, - VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, -#endif -// #if STM32_HAS_GPIOF -// {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, -// VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, -// #endif -// #if STM32_HAS_GPIOG -// {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, -// VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, -// #endif -#if STM32_HAS_GPIOH - {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, - VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, -#endif -// #if STM32_HAS_GPIOI -// {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, -// VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, -// #endif -// #if STM32_HAS_GPIOJ -// {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, -// VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, -// #endif -// #if STM32_HAS_GPIOK -// {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, -// VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} -// #endif -}; - -/*===========================================================================*/ -/* Driver local functions. */ -/*===========================================================================*/ - -static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { - - gpiop->OTYPER = config->otyper; - gpiop->OSPEEDR = config->ospeedr; - gpiop->PUPDR = config->pupdr; - gpiop->ODR = config->odr; - gpiop->AFRL = config->afrl; - gpiop->AFRH = config->afrh; - gpiop->MODER = config->moder; -} - -static void stm32_gpio_init(void) { - - /* Enabling GPIO-related clocks, the mask comes from the - registry header file.*/ - rccResetAHB1(STM32_GPIO_EN_MASK); - rccEnableAHB1(STM32_GPIO_EN_MASK, true); - - /* Initializing all the defined GPIO ports.*/ -#if STM32_HAS_GPIOA - gpio_init(GPIOA, &gpio_default_config.PAData); -#endif -#if STM32_HAS_GPIOB - gpio_init(GPIOB, &gpio_default_config.PBData); -#endif -#if STM32_HAS_GPIOC - gpio_init(GPIOC, &gpio_default_config.PCData); -#endif -#if STM32_HAS_GPIOD - gpio_init(GPIOD, &gpio_default_config.PDData); -#endif -#if STM32_HAS_GPIOE - gpio_init(GPIOE, &gpio_default_config.PEData); -#endif -// #if STM32_HAS_GPIOF -// gpio_init(GPIOF, &gpio_default_config.PFData); -// #endif -// #if STM32_HAS_GPIOG -// gpio_init(GPIOG, &gpio_default_config.PGData); -// #endif -#if STM32_HAS_GPIOH - gpio_init(GPIOH, &gpio_default_config.PHData); -#endif -// #if STM32_HAS_GPIOI -// gpio_init(GPIOI, &gpio_default_config.PIData); -// #endif -// #if STM32_HAS_GPIOJ -// gpio_init(GPIOJ, &gpio_default_config.PJData); -// #endif -// #if STM32_HAS_GPIOK -// gpio_init(GPIOK, &gpio_default_config.PKData); -// #endif -} - -/*===========================================================================*/ -/* Driver interrupt handlers. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported functions. */ -/*===========================================================================*/ - -/** - * @brief Early initialization code. - * @details GPIO ports and system clocks are initialized before everything - * else. - */ -void __early_init(void) { - - stm32_gpio_init(); - stm32_clock_init(); -} - -#if HAL_USE_SDC || defined(__DOXYGEN__) -/** - * @brief SDC card detection. - */ -bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { - - (void)sdcp; - - return !palReadLine(LINE_SD_DETECT); -} - -/** - * @brief SDC card write protection detection. - */ -bool sdc_lld_is_write_protected(SDCDriver *sdcp) { - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return false; -} -#endif /* HAL_USE_SDC */ - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return true; -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool mmc_lld_is_write_protected(MMCDriver *mmcp) { - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return false; -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { - -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/board.h b/targets/ChibiOS/NETDUINO3_WIFI/board.h deleted file mode 100644 index 3072ad0c38..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/board.h +++ /dev/null @@ -1,893 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef BOARD_H -#define BOARD_H - -/* - * Board identifier. - */ -#define BOARD_NETDUINO3WIFI -#define BOARD_NAME "Netduino 3 Wifi" - -#define BOARD_OTG_NOVBUSSENS - -/* - * Board oscillators-related settings. - * NOTE: LSE not fitted. - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK 32768U -#endif - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK 25000000U -#endif - -/* - * Board voltages. - * Required for performance limits calculation. - */ -#define STM32_VDD 300U - -/* - * MCU type as defined in the ST header. - */ -#define STM32F427xx - -/* - * IO pins assignments. - */ -#define GPIOA_D8 0U -#define GPIOA_D7 1U -#define GPIOA_D3 2U -#define GPIOA_D2 3U -#define GPIOA_CC_IRQ 4U -#define GPIOA_CC_SCK 5U -#define GPIOA_CC_MISO 6U -#define GPIOA_CC_MOSI 7U -#define GPIOA_STATE_LED 8U -#define GPIOA_VBUS 9U -#define GPIOA_USR_LED 10U -#define GPIOA_OTG_FS_DM 11U -#define GPIOA_OTG_FS_DP 12U -#define GPIOA_JTMS 13U -#define GPIOA_JTCK 14U -#define GPIOA_JTDI 15U - -#define GPIOB_MICROSD_CS 0U -#define GPIOB_MICROSD_CTRL 1U -#define GPIOB_BOOT1 2U -#define GPIOB_JTDO 3U -#define GPIOB_PB4 4U -#define GPIOB_SWITCH1 5U -#define GPIOB_I2C1_SCL 6U -#define GPIOB_I2C1_SDA 7U -#define GPIOB_D5 8U -#define GPIOB_D6 9U -#define GPIOB_D10 10U -#define GPIOB_MICROSD_INS 11U -#define GPIOB_D4 12U -#define GPIOB_D13 13U -#define GPIOB_D12 14U -#define GPIOB_D11 15U - -#define GPIOC_A0 0U -#define GPIOC_A1 1U -#define GPIOC_A2 2U -#define GPIOC_A3 3U -#define GPIOC_A4 4U -#define GPIOC_A5 5U -#define GPIOC_D1 6U -#define GPIOC_D0 7U -#define GPIOC_CC_CS 8U -#define GPIOC_LINK_LED 9U -#define GPIOC_SPI3_CLK 10U -#define GPIOC_SPI3_MISO 11U -#define GPIOC_SPI3_MOSI 12U -#define GPIOC_POWER_LED 13U -#define GPIOC_OSC32_IN 14U -#define GPIOC_OSC32_OUT 15U - -#define GPIOD_SPI_CS_GOPORT1 0U -#define GPIOD_SPI_CS_GOPORT2 1U -#define GPIOD_SPI_CS_GOPORT3 2U -#define GPIOD_CC_RTS 3U -#define GPIOD_CC_CTS 4U -#define GPIOD_CC_RX 5U -#define GPIOD_CC_TX 6U -#define GPIOD_PWR_ON_GOPORT1 7U -#define GPIOD_USART3_TX_GOPORT1 8U -#define GPIOD_USART3_RX_GOPORT1 9U -#define GPIOD_PWR_ON_GOPORT2 10U -#define GPIOD_SWITCH1 11U -#define GPIOD_PWR_ON_GOPORT3 12U -#define GPIOD_INT_GOPORT1 13U -#define GPIOD_INT_GOPORT2 14U -#define GPIOD_INT_GOPORT3 15U - -#define GPIOE_USART8_RX_GOPORT3 0U -#define GPIOE_USART8_TX_GOPORT3 1U -#define GPIOE_SPI4_SCK 2U -#define GPIOE_EN_UART_TX_PU_GOPORT1 3U -#define GPIOE_CC_HIB 4U -#define GPIOE_D9 5U -#define GPIOE_SPI4_MOSI 6U -#define GPIOE_USART7_RX_GOPORT2 7U -#define GPIOE_USART7_TX_GOPORT2 8U -#define GPIOE_LED_GOPORT1 9U -#define GPIOE_EN_UART_TX_PU_GOPORT2 10U -#define GPIOE_LED_GOPORT2 11U -#define GPIOE_EN_UART_TX_PU_GOPORT3 12U -#define GPIOE_SPI4_MISO 13U -#define GPIOE_LED_GOPORT3 14U -#define GPIOE_CC_TCXO_EN_SOP2 15U - -#define GPIOH_OSC_IN 0U -#define GPIOH_OSC_OUT 1U -#define GPIOH_PIN2 2U -#define GPIOH_PIN3 3U -#define GPIOH_PIN4 4U -#define GPIOH_PIN5 5U -#define GPIOH_PIN6 6U -#define GPIOH_PIN7 7U -#define GPIOH_PIN8 8U -#define GPIOH_PIN9 9U -#define GPIOH_PIN10 10U -#define GPIOH_PIN11 11U -#define GPIOH_PIN12 12U -#define GPIOH_PIN13 13U -#define GPIOH_PIN14 14U -#define GPIOH_PIN15 15U - -/* - * IO lines assignments. - */ -#define LINE_LED1 PAL_LINE(GPIOA, 10U) -#define LINE_SD_DETECT PAL_LINE(GPIOB, 11U) - -#define LINE_LED_GOPORT1 PAL_LINE(GPIOE, 9U) - -#define LINE_LED_GOPORT2 PAL_LINE(GPIOE, 11U) - -#define LINE_LED_GOPORT3 PAL_LINE(GPIOE, 14U) - -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) -#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) -#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) -#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) -#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) - -/* - * GPIOA setup: - * - * PA0 - D8 - * PA1 - D7 - * PA2 - D3 - * PA3 - D2 - * PA4 - CC_IRQ - * PA5 - CC_SCK - * PA6 - CC_MISO - * PA7 - CC_MOSI - * PA8 - STATE_LED - * PA9 - VBUS - * PA10 - USR_LED - * PA11 - OTG_FS_DM - * PA12 - OTG_FS_DP - * PA13 - JTMS - * PA14 - JTCK - * PA15 - JTDI - */ -#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_D8) | \ - PIN_MODE_INPUT(GPIOA_D7) | \ - PIN_MODE_INPUT(GPIOA_D3) | \ - PIN_MODE_INPUT(GPIOA_D2) | \ - PIN_MODE_INPUT(GPIOA_CC_IRQ) | \ - PIN_MODE_ALTERNATE(GPIOA_CC_SCK) | \ - PIN_MODE_ALTERNATE(GPIOA_CC_MISO) | \ - PIN_MODE_ALTERNATE(GPIOA_CC_MOSI) | \ - PIN_MODE_OUTPUT(GPIOA_STATE_LED) | \ - PIN_MODE_INPUT(GPIOA_VBUS) | \ - PIN_MODE_OUTPUT(GPIOA_USR_LED) | \ - PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \ - PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \ - PIN_MODE_INPUT(GPIOA_JTMS) | \ - PIN_MODE_INPUT(GPIOA_JTCK) | \ - PIN_MODE_INPUT(GPIOA_JTDI)) -#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_D8) | \ - PIN_OTYPE_PUSHPULL(GPIOA_D7) | \ - PIN_OTYPE_PUSHPULL(GPIOA_D3) | \ - PIN_OTYPE_PUSHPULL(GPIOA_D2) | \ - PIN_OTYPE_PUSHPULL(GPIOA_CC_IRQ) | \ - PIN_OTYPE_PUSHPULL(GPIOA_CC_SCK) | \ - PIN_OTYPE_PUSHPULL(GPIOA_CC_MISO) | \ - PIN_OTYPE_PUSHPULL(GPIOA_CC_MOSI) | \ - PIN_OTYPE_PUSHPULL(GPIOA_STATE_LED) | \ - PIN_OTYPE_PUSHPULL(GPIOA_VBUS) | \ - PIN_OTYPE_PUSHPULL(GPIOA_USR_LED) | \ - PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \ - PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTMS) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTCK) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTDI)) -#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_D8) | \ - PIN_OSPEED_HIGH(GPIOA_D7) | \ - PIN_OSPEED_HIGH(GPIOA_D3) | \ - PIN_OSPEED_HIGH(GPIOA_D2) | \ - PIN_OSPEED_HIGH(GPIOA_CC_IRQ) | \ - PIN_OSPEED_HIGH(GPIOA_CC_SCK) | \ - PIN_OSPEED_HIGH(GPIOA_CC_MISO) | \ - PIN_OSPEED_HIGH(GPIOA_CC_MOSI) | \ - PIN_OSPEED_HIGH(GPIOA_STATE_LED) | \ - PIN_OSPEED_HIGH(GPIOA_VBUS) | \ - PIN_OSPEED_HIGH(GPIOA_USR_LED) | \ - PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \ - PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \ - PIN_OSPEED_HIGH(GPIOA_JTMS) | \ - PIN_OSPEED_HIGH(GPIOA_JTCK) | \ - PIN_OSPEED_HIGH(GPIOA_JTDI)) -#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_D8) | \ - PIN_PUPDR_FLOATING(GPIOA_D7) | \ - PIN_PUPDR_FLOATING(GPIOA_D3) | \ - PIN_PUPDR_FLOATING(GPIOA_D2) | \ - PIN_PUPDR_FLOATING(GPIOA_CC_IRQ) | \ - PIN_PUPDR_FLOATING(GPIOA_CC_SCK) | \ - PIN_PUPDR_FLOATING(GPIOA_CC_MISO) | \ - PIN_PUPDR_FLOATING(GPIOA_CC_MOSI) | \ - PIN_PUPDR_FLOATING(GPIOA_STATE_LED) | \ - PIN_PUPDR_FLOATING(GPIOA_VBUS) | \ - PIN_PUPDR_FLOATING(GPIOA_USR_LED) | \ - PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \ - PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \ - PIN_PUPDR_FLOATING(GPIOA_JTMS) | \ - PIN_PUPDR_FLOATING(GPIOA_JTCK) | \ - PIN_PUPDR_FLOATING(GPIOA_JTDI)) -#define VAL_GPIOA_ODR (PIN_ODR_LOW(GPIOA_D8) | \ - PIN_ODR_LOW(GPIOA_D7) | \ - PIN_ODR_LOW(GPIOA_D3) | \ - PIN_ODR_LOW(GPIOA_D2) | \ - PIN_ODR_LOW(GPIOA_CC_IRQ) | \ - PIN_ODR_LOW(GPIOA_CC_SCK) | \ - PIN_ODR_LOW(GPIOA_CC_MISO) | \ - PIN_ODR_LOW(GPIOA_CC_MOSI) | \ - PIN_ODR_LOW(GPIOA_STATE_LED) | \ - PIN_ODR_LOW(GPIOA_VBUS) | \ - PIN_ODR_LOW(GPIOA_USR_LED) | \ - PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \ - PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \ - PIN_ODR_LOW(GPIOA_JTMS) | \ - PIN_ODR_LOW(GPIOA_JTCK) | \ - PIN_ODR_LOW(GPIOA_JTDI)) -#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_D8, 0U) | \ - PIN_AFIO_AF(GPIOA_D7, 0U) | \ - PIN_AFIO_AF(GPIOA_D3, 0U) | \ - PIN_AFIO_AF(GPIOA_D2, 0U) | \ - PIN_AFIO_AF(GPIOA_CC_IRQ, 0U) | \ - PIN_AFIO_AF(GPIOA_CC_SCK, 5U) | \ - PIN_AFIO_AF(GPIOA_CC_MISO, 5U) | \ - PIN_AFIO_AF(GPIOA_CC_MOSI, 5U)) -#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_STATE_LED, 0U) | \ - PIN_AFIO_AF(GPIOA_VBUS, 0U) | \ - PIN_AFIO_AF(GPIOA_USR_LED, 0U) | \ - PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \ - PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \ - PIN_AFIO_AF(GPIOA_JTMS, 0U) | \ - PIN_AFIO_AF(GPIOA_JTCK, 0U) | \ - PIN_AFIO_AF(GPIOA_JTDI, 0U)) - -/* - * GPIOB setup: - * - * PB0 - MICROSD_CS - * PB1 - MICROSD_CTRL - * PB2 - BOOT1 - * PB3 - JTDO - * PB4 - PB4 - * PB5 - SWITCH1 - * PB6 - I2C1_SCL - * PB7 - I2C1_SDA - * PB8 - D5 - * PB9 - D6 - * PB10 - D10 (=SPI2_SS) - * PB11 - MICROSD_INS - * PB12 - D4 - * PB13 - D13 (=SPI2_SCK) - * PB14 - D12 (=SPI2_MISO) - * PB15 - D11 (=SPI2_MOSI) - */ -#define VAL_GPIOB_MODER (PIN_MODE_OUTPUT(GPIOB_MICROSD_CS) | \ - PIN_MODE_OUTPUT(GPIOB_MICROSD_CTRL) | \ - PIN_MODE_OUTPUT(GPIOB_BOOT1) | \ - PIN_MODE_OUTPUT(GPIOB_JTDO) | \ - PIN_MODE_INPUT(GPIOB_PB4) | \ - PIN_MODE_INPUT(GPIOB_SWITCH1) | \ - PIN_MODE_ALTERNATE(GPIOB_I2C1_SCL) | \ - PIN_MODE_ALTERNATE(GPIOB_I2C1_SDA) | \ - PIN_MODE_INPUT(GPIOB_D5) | \ - PIN_MODE_INPUT(GPIOB_D6) | \ - PIN_MODE_OUTPUT(GPIOB_D10) | \ - PIN_MODE_INPUT(GPIOB_MICROSD_INS) | \ - PIN_MODE_INPUT(GPIOB_D4) | \ - PIN_MODE_ALTERNATE(GPIOB_D13) | \ - PIN_MODE_ALTERNATE(GPIOB_D12) | \ - PIN_MODE_ALTERNATE(GPIOB_D11)) -#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_MICROSD_CS) | \ - PIN_OTYPE_PUSHPULL(GPIOB_MICROSD_CTRL) | \ - PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \ - PIN_OTYPE_PUSHPULL(GPIOB_JTDO) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PB4) | \ - PIN_OTYPE_PUSHPULL(GPIOB_SWITCH1) | \ - PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SCL) | \ - PIN_OTYPE_OPENDRAIN(GPIOB_I2C1_SDA) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D5) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D6) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D10) | \ - PIN_OTYPE_PUSHPULL(GPIOB_MICROSD_INS) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D4) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D13) |\ - PIN_OTYPE_PUSHPULL(GPIOB_D12) | \ - PIN_OTYPE_PUSHPULL(GPIOB_D11)) -#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_MICROSD_CS) | \ - PIN_OSPEED_HIGH(GPIOB_MICROSD_CTRL) | \ - PIN_OSPEED_HIGH(GPIOB_BOOT1) | \ - PIN_OSPEED_HIGH(GPIOB_JTDO) | \ - PIN_OSPEED_HIGH(GPIOB_PB4) | \ - PIN_OSPEED_HIGH(GPIOB_SWITCH1) | \ - PIN_OSPEED_HIGH(GPIOB_I2C1_SCL) | \ - PIN_OSPEED_HIGH(GPIOB_I2C1_SDA) | \ - PIN_OSPEED_HIGH(GPIOB_D5) | \ - PIN_OSPEED_HIGH(GPIOB_D6) | \ - PIN_OSPEED_HIGH(GPIOB_D10) | \ - PIN_OSPEED_HIGH(GPIOB_MICROSD_INS) | \ - PIN_OSPEED_HIGH(GPIOB_D4) | \ - PIN_OSPEED_HIGH(GPIOB_D13) |\ - PIN_OSPEED_HIGH(GPIOB_D12) | \ - PIN_OSPEED_HIGH(GPIOB_D11)) -#define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(GPIOB_MICROSD_CS) | \ - PIN_PUPDR_FLOATING(GPIOB_MICROSD_CTRL) | \ - PIN_PUPDR_FLOATING(GPIOB_BOOT1) | \ - PIN_PUPDR_FLOATING(GPIOB_JTDO) | \ - PIN_PUPDR_FLOATING(GPIOB_PB4) | \ - PIN_PUPDR_FLOATING(GPIOB_SWITCH1) | \ - PIN_PUPDR_FLOATING(GPIOB_I2C1_SCL) | \ - PIN_PUPDR_FLOATING(GPIOB_I2C1_SDA) | \ - PIN_PUPDR_FLOATING(GPIOB_D5) | \ - PIN_PUPDR_FLOATING(GPIOB_D6) | \ - PIN_PUPDR_FLOATING(GPIOB_D10) | \ - PIN_PUPDR_FLOATING(GPIOB_MICROSD_INS) | \ - PIN_PUPDR_FLOATING(GPIOB_D4) | \ - PIN_PUPDR_FLOATING(GPIOB_D13) |\ - PIN_PUPDR_FLOATING(GPIOB_D12) | \ - PIN_PUPDR_FLOATING(GPIOB_D11)) -#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_MICROSD_CS) | \ - PIN_ODR_HIGH(GPIOB_MICROSD_CTRL) | \ - PIN_ODR_HIGH(GPIOB_BOOT1) | \ - PIN_ODR_LOW(GPIOB_JTDO) | \ - PIN_ODR_LOW(GPIOB_PB4) | \ - PIN_ODR_LOW(GPIOB_SWITCH1) | \ - PIN_ODR_LOW(GPIOB_I2C1_SCL) | \ - PIN_ODR_LOW(GPIOB_I2C1_SDA) | \ - PIN_ODR_LOW(GPIOB_D5) | \ - PIN_ODR_LOW(GPIOB_D6) | \ - PIN_ODR_LOW(GPIOB_D10) | \ - PIN_ODR_HIGH(GPIOB_MICROSD_INS) | \ - PIN_ODR_LOW(GPIOB_D4) | \ - PIN_ODR_LOW(GPIOB_D13) | \ - PIN_ODR_LOW(GPIOB_D12) | \ - PIN_ODR_LOW(GPIOB_D11)) -#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_MICROSD_CS, 0U) | \ - PIN_AFIO_AF(GPIOB_MICROSD_CTRL, 0U) | \ - PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \ - PIN_AFIO_AF(GPIOB_JTDO, 0U) | \ - PIN_AFIO_AF(GPIOB_PB4, 0U) | \ - PIN_AFIO_AF(GPIOB_SWITCH1, 0U) | \ - PIN_AFIO_AF(GPIOB_I2C1_SCL, 4U) | \ - PIN_AFIO_AF(GPIOB_I2C1_SDA, 4U)) -#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_D5, 0U) | \ - PIN_AFIO_AF(GPIOB_D6, 0U) | \ - PIN_AFIO_AF(GPIOB_D10, 0U) | \ - PIN_AFIO_AF(GPIOB_MICROSD_INS, 0U) | \ - PIN_AFIO_AF(GPIOB_D4, 0U) | \ - PIN_AFIO_AF(GPIOB_D13, 5U) | \ - PIN_AFIO_AF(GPIOB_D12, 5U) | \ - PIN_AFIO_AF(GPIOB_D11, 5U)) - -/* - * GPIOC setup: - * - * PC0 - A0 - * PC1 - A1 - * PC2 - A2 - * PC3 - A3 - * PC4 - A4 - * PC5 - A5 - * PC6 - USART6_TX_D1 - * PC7 - USART6_RX_D0 - * PC8 - CC_CS - * PC9 - LINK_LED - * PC10 - SPI3_CLK - * PC11 - SPI3_MISO - * PC12 - SPI3_MOSI - * PC13 - POWER_LED - * PC14 - OSC32_IN - * PC15 - OSC32_OUT - */ -#define VAL_GPIOC_MODER (PIN_MODE_ANALOG(GPIOC_A0) | \ - PIN_MODE_ANALOG(GPIOC_A1) | \ - PIN_MODE_ANALOG(GPIOC_A2) | \ - PIN_MODE_ANALOG(GPIOC_A3) | \ - PIN_MODE_ANALOG(GPIOC_A4) | \ - PIN_MODE_ANALOG(GPIOC_A5) | \ - PIN_MODE_ALTERNATE(GPIOC_D1) | \ - PIN_MODE_ALTERNATE(GPIOC_D0) | \ - PIN_MODE_OUTPUT(GPIOC_CC_CS) | \ - PIN_MODE_OUTPUT(GPIOC_LINK_LED) | \ - PIN_MODE_ALTERNATE(GPIOC_SPI3_CLK) | \ - PIN_MODE_ALTERNATE(GPIOC_SPI3_MISO) | \ - PIN_MODE_ALTERNATE(GPIOC_SPI3_MOSI) | \ - PIN_MODE_OUTPUT(GPIOC_POWER_LED) | \ - PIN_MODE_ALTERNATE(GPIOC_OSC32_IN) | \ - PIN_MODE_ALTERNATE(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_A0) | \ - PIN_OTYPE_PUSHPULL(GPIOC_A1) |\ - PIN_OTYPE_PUSHPULL(GPIOC_A2) |\ - PIN_OTYPE_PUSHPULL(GPIOC_A3) | \ - PIN_OTYPE_PUSHPULL(GPIOC_A4) | \ - PIN_OTYPE_PUSHPULL(GPIOC_A5) | \ - PIN_OTYPE_PUSHPULL(GPIOC_D1) | \ - PIN_OTYPE_PUSHPULL(GPIOC_D0) | \ - PIN_OTYPE_PUSHPULL(GPIOC_CC_CS) | \ - PIN_OTYPE_PUSHPULL(GPIOC_LINK_LED) | \ - PIN_OTYPE_PUSHPULL(GPIOC_SPI3_CLK) | \ - PIN_OTYPE_PUSHPULL(GPIOC_SPI3_MISO) | \ - PIN_OTYPE_PUSHPULL(GPIOC_SPI3_MOSI) | \ - PIN_OTYPE_PUSHPULL(GPIOC_POWER_LED) | \ - PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \ - PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_A0) | \ - PIN_OSPEED_HIGH(GPIOC_A1) | \ - PIN_OSPEED_HIGH(GPIOC_A2) | \ - PIN_OSPEED_HIGH(GPIOC_A3) | \ - PIN_OSPEED_HIGH(GPIOC_A4) | \ - PIN_OSPEED_HIGH(GPIOC_A5) | \ - PIN_OSPEED_HIGH(GPIOC_D1) | \ - PIN_OSPEED_HIGH(GPIOC_D0) | \ - PIN_OSPEED_HIGH(GPIOC_CC_CS) | \ - PIN_OSPEED_HIGH(GPIOC_LINK_LED) | \ - PIN_OSPEED_HIGH(GPIOC_SPI3_CLK) | \ - PIN_OSPEED_HIGH(GPIOC_SPI3_MISO) | \ - PIN_OSPEED_HIGH(GPIOC_SPI3_MOSI) | \ - PIN_OSPEED_HIGH(GPIOC_POWER_LED) | \ - PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \ - PIN_OSPEED_HIGH(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_A0) | \ - PIN_PUPDR_FLOATING(GPIOC_A1) |\ - PIN_PUPDR_FLOATING(GPIOC_A2) |\ - PIN_PUPDR_FLOATING(GPIOC_A3) | \ - PIN_PUPDR_FLOATING(GPIOC_A4) | \ - PIN_PUPDR_FLOATING(GPIOC_A5) | \ - PIN_PUPDR_FLOATING(GPIOC_D1) | \ - PIN_PUPDR_FLOATING(GPIOC_D0) | \ - PIN_PUPDR_FLOATING(GPIOC_CC_CS) | \ - PIN_PUPDR_FLOATING(GPIOC_LINK_LED) | \ - PIN_PUPDR_FLOATING(GPIOC_SPI3_CLK) | \ - PIN_PUPDR_FLOATING(GPIOC_SPI3_MISO) | \ - PIN_PUPDR_FLOATING(GPIOC_SPI3_MOSI) | \ - PIN_PUPDR_FLOATING(GPIOC_POWER_LED) | \ - PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \ - PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_ODR (PIN_ODR_LOW(GPIOC_A0) | \ - PIN_ODR_LOW(GPIOC_A1) | \ - PIN_ODR_LOW(GPIOC_A2) | \ - PIN_ODR_LOW(GPIOC_A3) | \ - PIN_ODR_LOW(GPIOC_A4) | \ - PIN_ODR_LOW(GPIOC_A5) | \ - PIN_ODR_LOW(GPIOC_D1) | \ - PIN_ODR_LOW(GPIOC_D0) | \ - PIN_ODR_LOW(GPIOC_CC_CS) | \ - PIN_ODR_LOW(GPIOC_LINK_LED) | \ - PIN_ODR_LOW(GPIOC_SPI3_CLK) | \ - PIN_ODR_LOW(GPIOC_SPI3_MISO) | \ - PIN_ODR_LOW(GPIOC_SPI3_MOSI) | \ - PIN_ODR_LOW(GPIOC_POWER_LED) | \ - PIN_ODR_LOW(GPIOC_OSC32_IN) | \ - PIN_ODR_LOW(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_A0, 0U) | \ - PIN_AFIO_AF(GPIOC_A1, 0U) | \ - PIN_AFIO_AF(GPIOC_A2, 0U) | \ - PIN_AFIO_AF(GPIOC_A3, 0U) | \ - PIN_AFIO_AF(GPIOC_A4, 0U) | \ - PIN_AFIO_AF(GPIOC_A5, 0U) | \ - PIN_AFIO_AF(GPIOC_D1, 8U) | \ - PIN_AFIO_AF(GPIOC_D0, 8U)) -#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_CC_CS, 0U) | \ - PIN_AFIO_AF(GPIOC_LINK_LED, 0U) | \ - PIN_AFIO_AF(GPIOC_SPI3_CLK, 6U) | \ - PIN_AFIO_AF(GPIOC_SPI3_MISO, 6U) | \ - PIN_AFIO_AF(GPIOC_SPI3_MOSI, 6U) | \ - PIN_AFIO_AF(GPIOC_POWER_LED, 0U) | \ - PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \ - PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U)) - -/* - * GPIOD setup: - * - * PD0 - SPI_CS_GOPORT1 - * PD1 - SPI_CS_GOPORT2 - * PD2 - SPI_CS_GOPORT3 - * PD3 - CC_RTS - * PD4 - CC_CTS - * PD5 - CC_RX - * PD6 - CC_TX - * PD7 - PWR_ON_GOPORT1 - * PD8 - USART3_TX_GOPORT1 - * PD9 - USART3_RX_GOPORT1 - * PD10 - PWR_ON_GOPORT2 - * PD11 - SWITCH1 - * PD12 - PWR_ON_GOPORT3 - * PD13 - INT_GOPORT1 - * PD14 - INT_GOPORT2 - * PD15 - INT_GOPORT3 - */ -#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_SPI_CS_GOPORT1) | \ - PIN_MODE_INPUT(GPIOD_SPI_CS_GOPORT2) | \ - PIN_MODE_INPUT(GPIOD_SPI_CS_GOPORT3) | \ - PIN_MODE_ALTERNATE(GPIOD_CC_RTS) | \ - PIN_MODE_ALTERNATE(GPIOD_CC_CTS) | \ - PIN_MODE_ALTERNATE(GPIOD_CC_RX) | \ - PIN_MODE_ALTERNATE(GPIOD_CC_TX) | \ - PIN_MODE_OUTPUT(GPIOD_PWR_ON_GOPORT1) | \ - PIN_MODE_ALTERNATE(GPIOD_USART3_TX_GOPORT1) | \ - PIN_MODE_ALTERNATE(GPIOD_USART3_RX_GOPORT1) | \ - PIN_MODE_OUTPUT(GPIOD_PWR_ON_GOPORT2) | \ - PIN_MODE_INPUT(GPIOD_SWITCH1) | \ - PIN_MODE_OUTPUT(GPIOD_PWR_ON_GOPORT3) | \ - PIN_MODE_OUTPUT(GPIOD_INT_GOPORT1) | \ - PIN_MODE_OUTPUT(GPIOD_INT_GOPORT2) | \ - PIN_MODE_OUTPUT(GPIOD_INT_GOPORT3)) -#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_SPI_CS_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_SPI_CS_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOD_SPI_CS_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOD_CC_RTS) | \ - PIN_OTYPE_PUSHPULL(GPIOD_CC_CTS) | \ - PIN_OTYPE_PUSHPULL(GPIOD_CC_RX) | \ - PIN_OTYPE_PUSHPULL(GPIOD_CC_TX) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PWR_ON_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_USART3_TX_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_USART3_RX_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PWR_ON_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOD_SWITCH1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PWR_ON_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOD_INT_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_INT_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOD_INT_GOPORT3)) -#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_SPI_CS_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOD_SPI_CS_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOD_SPI_CS_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOD_CC_RTS) | \ - PIN_OSPEED_HIGH(GPIOD_CC_CTS) | \ - PIN_OSPEED_HIGH(GPIOD_CC_RX) | \ - PIN_OSPEED_HIGH(GPIOD_CC_TX) | \ - PIN_OSPEED_HIGH(GPIOD_PWR_ON_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOD_USART3_TX_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOD_USART3_RX_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOD_PWR_ON_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOD_SWITCH1) | \ - PIN_OSPEED_HIGH(GPIOD_PWR_ON_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOD_INT_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOD_INT_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOD_INT_GOPORT3)) -#define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_SPI_CS_GOPORT1) | \ - PIN_PUPDR_FLOATING(GPIOD_SPI_CS_GOPORT2) | \ - PIN_PUPDR_FLOATING(GPIOD_SPI_CS_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOD_CC_RTS) | \ - PIN_PUPDR_FLOATING(GPIOD_CC_CTS) | \ - PIN_PUPDR_FLOATING(GPIOD_CC_RX) | \ - PIN_PUPDR_FLOATING(GPIOD_CC_TX) | \ - PIN_PUPDR_FLOATING(GPIOD_PWR_ON_GOPORT1) | \ - PIN_PUPDR_FLOATING(GPIOD_USART3_TX_GOPORT1) | \ - PIN_PUPDR_FLOATING(GPIOD_USART3_RX_GOPORT1) | \ - PIN_PUPDR_FLOATING(GPIOD_PWR_ON_GOPORT2) | \ - PIN_PUPDR_PULLDOWN(GPIOD_SWITCH1) | \ - PIN_PUPDR_FLOATING(GPIOD_PWR_ON_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOD_INT_GOPORT1) | \ - PIN_PUPDR_FLOATING(GPIOD_INT_GOPORT2) | \ - PIN_PUPDR_FLOATING(GPIOD_INT_GOPORT3)) -#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_SPI_CS_GOPORT1) | \ - PIN_ODR_HIGH(GPIOD_SPI_CS_GOPORT2) | \ - PIN_ODR_HIGH(GPIOD_SPI_CS_GOPORT3) | \ - PIN_ODR_LOW(GPIOD_CC_RTS) | \ - PIN_ODR_LOW(GPIOD_CC_CTS) | \ - PIN_ODR_LOW(GPIOD_CC_RX) | \ - PIN_ODR_LOW(GPIOD_CC_TX) | \ - PIN_ODR_LOW(GPIOD_PWR_ON_GOPORT1) | \ - PIN_ODR_LOW(GPIOD_USART3_TX_GOPORT1) | \ - PIN_ODR_LOW(GPIOD_USART3_RX_GOPORT1) | \ - PIN_ODR_LOW(GPIOD_PWR_ON_GOPORT2) | \ - PIN_ODR_LOW(GPIOD_SWITCH1) | \ - PIN_ODR_LOW(GPIOD_PWR_ON_GOPORT3) | \ - PIN_ODR_HIGH(GPIOD_INT_GOPORT1) | \ - PIN_ODR_HIGH(GPIOD_INT_GOPORT2) | \ - PIN_ODR_HIGH(GPIOD_INT_GOPORT3)) -#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_SPI_CS_GOPORT1, 0U) | \ - PIN_AFIO_AF(GPIOD_SPI_CS_GOPORT2, 0U) | \ - PIN_AFIO_AF(GPIOD_SPI_CS_GOPORT3, 0U) | \ - PIN_AFIO_AF(GPIOD_CC_RTS, 7U) | \ - PIN_AFIO_AF(GPIOD_CC_CTS, 7U) | \ - PIN_AFIO_AF(GPIOD_CC_RX, 7U) | \ - PIN_AFIO_AF(GPIOD_CC_TX, 7U) | \ - PIN_AFIO_AF(GPIOD_PWR_ON_GOPORT1, 0U)) -#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_USART3_TX_GOPORT1, 7U) | \ - PIN_AFIO_AF(GPIOD_USART3_RX_GOPORT1, 7U) | \ - PIN_AFIO_AF(GPIOD_PWR_ON_GOPORT2, 0U) | \ - PIN_AFIO_AF(GPIOD_SWITCH1, 0U) | \ - PIN_AFIO_AF(GPIOD_PWR_ON_GOPORT3, 0U) | \ - PIN_AFIO_AF(GPIOD_INT_GOPORT1, 0U) | \ - PIN_AFIO_AF(GPIOD_INT_GOPORT2, 0U) | \ - PIN_AFIO_AF(GPIOD_INT_GOPORT3, 0U)) - -/* - * GPIOE setup: - * - * PE0 - USART8_RX_GOPORT3 - * PE1 - USART8_TX_GOPORT3 - * PE2 - SPI4_SCK - * PE3 - EN_UART_TX_PU_GOPORT1 - * PE4 - CC_HIB - * PE5 - D9 - * PE6 - SPI4_MOSI - * PE7 - USART7_RX_GOPORT2 - * PE8 - USART7_TX_GOPORT2 - * PE9 - LED_GOPORT1 - * PE10 - EN_UART_TX_PU_GOPORT2 - * PE11 - LED_GOPORT2 - * PE12 - EN_UART_TX_PU_GOPORT3 - * PE13 - SPI4_MISO - * PE14 - LED_GOPORT3 - * PE15 - CC_TCXO_EN_SOP2 - */ -#define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(GPIOE_USART8_RX_GOPORT3) | \ - PIN_MODE_ALTERNATE(GPIOE_USART8_TX_GOPORT3) | \ - PIN_MODE_ALTERNATE(GPIOE_SPI4_SCK) | \ - PIN_MODE_ALTERNATE(GPIOE_EN_UART_TX_PU_GOPORT1) | \ - PIN_MODE_OUTPUT(GPIOE_CC_HIB) | \ - PIN_MODE_INPUT(GPIOE_D9) | \ - PIN_MODE_ALTERNATE(GPIOE_SPI4_MOSI) | \ - PIN_MODE_ALTERNATE(GPIOE_USART7_RX_GOPORT2) | \ - PIN_MODE_ALTERNATE(GPIOE_USART7_TX_GOPORT2) | \ - PIN_MODE_OUTPUT(GPIOE_LED_GOPORT1) | \ - PIN_MODE_OUTPUT(GPIOE_EN_UART_TX_PU_GOPORT2) | \ - PIN_MODE_OUTPUT(GPIOE_LED_GOPORT2) | \ - PIN_MODE_OUTPUT(GPIOE_EN_UART_TX_PU_GOPORT3) | \ - PIN_MODE_ALTERNATE(GPIOE_SPI4_MISO) | \ - PIN_MODE_OUTPUT(GPIOE_LED_GOPORT3) | \ - PIN_MODE_INPUT(GPIOE_CC_TCXO_EN_SOP2)) -#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_USART8_RX_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOE_USART8_TX_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOE_SPI4_SCK) | \ - PIN_OTYPE_PUSHPULL(GPIOE_EN_UART_TX_PU_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOE_CC_HIB) | \ - PIN_OTYPE_PUSHPULL(GPIOE_D9) | \ - PIN_OTYPE_PUSHPULL(GPIOE_SPI4_MOSI) | \ - PIN_OTYPE_PUSHPULL(GPIOE_USART7_RX_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOE_USART7_TX_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOE_LED_GOPORT1) | \ - PIN_OTYPE_PUSHPULL(GPIOE_EN_UART_TX_PU_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOE_LED_GOPORT2) | \ - PIN_OTYPE_PUSHPULL(GPIOE_EN_UART_TX_PU_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOE_SPI4_MISO) | \ - PIN_OTYPE_PUSHPULL(GPIOE_LED_GOPORT3) | \ - PIN_OTYPE_PUSHPULL(GPIOE_CC_TCXO_EN_SOP2)) -#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_USART8_RX_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOE_USART8_TX_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOE_SPI4_SCK) | \ - PIN_OSPEED_HIGH(GPIOE_EN_UART_TX_PU_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOE_CC_HIB) | \ - PIN_OSPEED_HIGH(GPIOE_D9) | \ - PIN_OSPEED_HIGH(GPIOE_SPI4_MOSI) | \ - PIN_OSPEED_HIGH(GPIOE_USART7_RX_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOE_USART7_TX_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOE_LED_GOPORT1) | \ - PIN_OSPEED_HIGH(GPIOE_EN_UART_TX_PU_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOE_LED_GOPORT2) | \ - PIN_OSPEED_HIGH(GPIOE_EN_UART_TX_PU_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOE_SPI4_MISO) | \ - PIN_OSPEED_HIGH(GPIOE_LED_GOPORT3) | \ - PIN_OSPEED_HIGH(GPIOE_CC_TCXO_EN_SOP2)) -#define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_USART8_RX_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOE_USART8_TX_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOE_SPI4_SCK) | \ - PIN_PUPDR_PULLDOWN(GPIOE_EN_UART_TX_PU_GOPORT1) | \ - PIN_PUPDR_PULLDOWN(GPIOE_CC_HIB) | \ - PIN_PUPDR_FLOATING(GPIOE_D9) | \ - PIN_PUPDR_FLOATING(GPIOE_SPI4_MOSI) | \ - PIN_PUPDR_FLOATING(GPIOE_USART7_RX_GOPORT2) | \ - PIN_PUPDR_FLOATING(GPIOE_USART7_TX_GOPORT2) | \ - PIN_PUPDR_FLOATING(GPIOE_LED_GOPORT1) | \ - PIN_PUPDR_PULLDOWN(GPIOE_EN_UART_TX_PU_GOPORT2) | \ - PIN_PUPDR_FLOATING(GPIOE_LED_GOPORT2) | \ - PIN_PUPDR_PULLDOWN(GPIOE_EN_UART_TX_PU_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOE_SPI4_MISO) | \ - PIN_PUPDR_FLOATING(GPIOE_LED_GOPORT3) | \ - PIN_PUPDR_FLOATING(GPIOE_CC_TCXO_EN_SOP2)) -#define VAL_GPIOE_ODR (PIN_ODR_LOW(GPIOE_USART8_RX_GOPORT3) | \ - PIN_ODR_LOW(GPIOE_USART8_TX_GOPORT3) | \ - PIN_ODR_LOW(GPIOE_SPI4_SCK) | \ - PIN_ODR_LOW(GPIOE_EN_UART_TX_PU_GOPORT1) | \ - PIN_ODR_LOW(GPIOE_CC_HIB) | \ - PIN_ODR_LOW(GPIOE_D9) | \ - PIN_ODR_LOW(GPIOE_SPI4_MOSI) | \ - PIN_ODR_LOW(GPIOE_USART7_RX_GOPORT2) | \ - PIN_ODR_LOW(GPIOE_USART7_TX_GOPORT2) | \ - PIN_ODR_LOW(GPIOE_LED_GOPORT1) | \ - PIN_ODR_LOW(GPIOE_EN_UART_TX_PU_GOPORT2) | \ - PIN_ODR_LOW(GPIOE_LED_GOPORT2) | \ - PIN_ODR_LOW(GPIOE_EN_UART_TX_PU_GOPORT3) | \ - PIN_ODR_LOW(GPIOE_SPI4_MISO) | \ - PIN_ODR_LOW(GPIOE_LED_GOPORT3) | \ - PIN_ODR_LOW(GPIOE_CC_TCXO_EN_SOP2)) -#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_USART8_RX_GOPORT3, 8U) | \ - PIN_AFIO_AF(GPIOE_USART8_TX_GOPORT3, 8U) | \ - PIN_AFIO_AF(GPIOE_SPI4_SCK, 5U) | \ - PIN_AFIO_AF(GPIOE_EN_UART_TX_PU_GOPORT1, 0U) | \ - PIN_AFIO_AF(GPIOE_CC_HIB, 0U) | \ - PIN_AFIO_AF(GPIOE_D9, 0U) | \ - PIN_AFIO_AF(GPIOE_SPI4_MOSI, 5U) | \ - PIN_AFIO_AF(GPIOE_USART7_RX_GOPORT2, 8U)) -#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_USART7_TX_GOPORT2, 8U) | \ - PIN_AFIO_AF(GPIOE_LED_GOPORT1, 0U) | \ - PIN_AFIO_AF(GPIOE_EN_UART_TX_PU_GOPORT2, 0U) | \ - PIN_AFIO_AF(GPIOE_LED_GOPORT2, 0U) | \ - PIN_AFIO_AF(GPIOE_EN_UART_TX_PU_GOPORT3, 0U) | \ - PIN_AFIO_AF(GPIOE_SPI4_MISO, 0U) | \ - PIN_AFIO_AF(GPIOE_LED_GOPORT3, 0U) | \ - PIN_AFIO_AF(GPIOE_CC_TCXO_EN_SOP2, 0U)) - - -/* - * GPIOH setup: - * - * PH0 - OSC_IN - * PH1 - OSC_OUT - * PH2 - PIN2 - * PH3 - PIN3 - * PH4 - PIN4 - * PH5 - PIN5 - * PH6 - PIN6 - * PH7 - PIN7 - * PH8 - PIN8 - * PH9 - PIN9 - * PH10 - PIN10 - * PH11 - PIN11 - * PH12 - PIN12 - * PH13 - PIN13 - * PH14 - PIN14 - * PH15 - PIN15 - */ -#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \ - PIN_MODE_INPUT(GPIOH_OSC_OUT) | \ - PIN_MODE_INPUT(GPIOH_PIN2) | \ - PIN_MODE_INPUT(GPIOH_PIN3) | \ - PIN_MODE_INPUT(GPIOH_PIN4) | \ - PIN_MODE_INPUT(GPIOH_PIN5) | \ - PIN_MODE_INPUT(GPIOH_PIN6) | \ - PIN_MODE_INPUT(GPIOH_PIN7) | \ - PIN_MODE_INPUT(GPIOH_PIN8) | \ - PIN_MODE_INPUT(GPIOH_PIN9) | \ - PIN_MODE_INPUT(GPIOH_PIN10) | \ - PIN_MODE_INPUT(GPIOH_PIN11) | \ - PIN_MODE_INPUT(GPIOH_PIN12) | \ - PIN_MODE_INPUT(GPIOH_PIN13) | \ - PIN_MODE_INPUT(GPIOH_PIN14) | \ - PIN_MODE_INPUT(GPIOH_PIN15)) -#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \ - PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) -#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \ - PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN15)) -#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \ - PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN15)) -#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \ - PIN_ODR_HIGH(GPIOH_OSC_OUT) | \ - PIN_ODR_HIGH(GPIOH_PIN2) | \ - PIN_ODR_HIGH(GPIOH_PIN3) | \ - PIN_ODR_HIGH(GPIOH_PIN4) | \ - PIN_ODR_HIGH(GPIOH_PIN5) | \ - PIN_ODR_HIGH(GPIOH_PIN6) | \ - PIN_ODR_HIGH(GPIOH_PIN7) | \ - PIN_ODR_HIGH(GPIOH_PIN8) | \ - PIN_ODR_HIGH(GPIOH_PIN9) | \ - PIN_ODR_HIGH(GPIOH_PIN10) | \ - PIN_ODR_HIGH(GPIOH_PIN11) | \ - PIN_ODR_HIGH(GPIOH_PIN12) | \ - PIN_ODR_HIGH(GPIOH_PIN13) | \ - PIN_ODR_HIGH(GPIOH_PIN14) | \ - PIN_ODR_HIGH(GPIOH_PIN15)) -#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \ - PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN7, 0U)) -#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN14, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN15, 0U)) - - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif // FROM_ASM_ - -#endif // BOARD_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/cmake-variants.json b/targets/ChibiOS/NETDUINO3_WIFI/cmake-variants.json deleted file mode 100644 index 3ec5ded4bb..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/cmake-variants.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "buildType": { - "default": "debug", - "choices": { - "debug": { - "short": "Debug", - "long": "Emit debug information without performing optimizations", - "buildType": "Debug" - }, - "minsize": { - "short": "MinSizeRel", - "long": "Optimize for smallest binary size", - "buildType": "MinSizeRel" - }, - "reldeb": { - "short": "RelWithDebInfo", - "long": "Perform optimizations AND include debugging information", - "buildType": "RelWithDebInfo" - } - } - }, - "linkage": { - "default": "", - "choices": { - "NETDUINO3_WIFI": { - "short": "NETDUINO3_WIFI", - "settings": { - "BUILD_VERSION": "0.9.99.999", - "BUILD_VERBOSE": "OFF", - "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.arm-none-eabi.cmake", - "TOOLCHAIN_PREFIX": "", - "TOOL_HEX2DFU_PREFIX": "", - "RTOS": "ChibiOS", - "TARGET_SERIES": "STM32F4xx", - "RTOS_SOURCE_FOLDER": "", - "TARGET_BOARD": "NETDUINO3_WIFI", - "CHIBIOS_CONTRIB_REQUIRED": "OFF", - "CHIBIOS_CONTRIB_SOURCE": "", - "STM32_CUBE_PACKAGE_REQUIRED": "OFF", - "STM32_CUBE_PACKAGE_SOURCE": "", - "MBEDTLS_SOURCE": "", - "SUPPORT_ANY_BASE_CONVERSION": "ON", - "NF_FEATURE_DEBUGGER": "ON", - "NF_FEATURE_RTC": "ON", - "NF_FEATURE_HAS_SDCARD": "ON", - "SWO_OUTPUT": "OFF", - "NF_BUILD_RTM": "OFF", - "API_System.Math": "ON", - "API_Hardware.Stm32": "ON", - "API_Windows.Devices.Gpio": "ON", - "API_System.Device.Gpio": "ON", - "API_Windows.Devices.Spi": "ON", - "API_System.Device.Spi": "ON", - "API_Windows.Devices.I2c": "ON", - "API_System.Device.I2c": "ON", - "API_Windows.Devices.Pwm": "ON", - "API_System.Device.Pwm": "ON", - "API_Windows.Devices.SerialCommunication": "ON", - "API_System.IO.Ports": "ON", - "API_Windows.Devices.Adc": "ON", - "API_System.Device.Adc": "ON", - "API_nanoFramework.Devices.OneWire": "ON", - "API_nanoFramework.ResourceManager": "ON", - "API_nanoFramework.System.Collections": "ON", - "API_nanoFramework.System.Text": "ON" - } - } - } - } -} \ No newline at end of file diff --git a/targets/ChibiOS/NETDUINO3_WIFI/common/CMakeLists.txt b/targets/ChibiOS/NETDUINO3_WIFI/common/CMakeLists.txt deleted file mode 100644 index e363bd4e5f..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/common/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. -# - -# append common source files -list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/usbcfg.c") -list(APPEND COMMON_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Device_BlockStorage$<$,$>:-DEBUG>.c") - -# make var global -set(COMMON_PROJECT_SOURCES ${COMMON_PROJECT_SOURCES} CACHE INTERNAL "make global") diff --git a/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage-DEBUG.c b/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage-DEBUG.c deleted file mode 100644 index 25d78df213..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage-DEBUG.c +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include - -//16kB block -const BlockRange BlockRange1[] = -{ - { BlockRange_BLOCKTYPE_BOOTSTRAP , 0, 1 }, // 0x08000000 nanoBooter - { BlockRange_BLOCKTYPE_CODE , 2, 3 } // 0x08008000 nanoCLR -}; - -//64kB block -const BlockRange BlockRange2[] = -{ - { BlockRange_BLOCKTYPE_CODE , 0, 0 } // 0x08010000 nanoCLR -}; - -//128kB block -const BlockRange BlockRange3[] = -{ - { BlockRange_BLOCKTYPE_CODE , 0, 3 }, // 0x08020000 nanoCLR - { BlockRange_BLOCKTYPE_DEPLOYMENT, 4, 6 }, // 0x080A0000 deployment -}; - -//16kB block -const BlockRange BlockRange4[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 3 } // 0x08100000 deployment -}; - -//64kB block -const BlockRange BlockRange5[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 0 } // 0x08110000 deployment -}; - -//128kB block -const BlockRange BlockRange6[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 6 } // 0x08120000 deployment -}; - -const BlockRegionInfo BlockRegions[] = -{ - { - (0), // no attributes for this region - 0x08000000, // start address for block region - 4, // total number of blocks in this region - 0x4000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange1), - BlockRange1, - }, - - { - (0), // no attributes for this region - 0x08010000, // start address for block region - 1, // total number of blocks in this region - 0x10000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange2), - BlockRange2, - }, - - { - (0), // no attributes for this region - 0x08020000, // start address for block region - 7, // total number of blocks in this region - 0x20000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange3), - BlockRange3, - }, - - { - (0), // no attributes for this region - 0x08100000, // start address for block region - 4, // total number of blocks in this region - 0x4000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange4), - BlockRange4, - }, - - { - (0), // no attributes for this region - 0x08110000, // start address for block region - 1, // total number of blocks in this region - 0x10000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange5), - BlockRange5, - }, - - { - (0), // no attributes for this region - 0x08120000, // start address for block region - 7, // total number of blocks in this region - 0x20000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange6), - BlockRange6, - }, - -}; - -const DeviceBlockInfo Device_BlockInfo = -{ - (MediaAttribute_SupportsXIP), // STM32 flash memory is XIP - 2, // UINT32 BytesPerSector - ARRAYSIZE_CONST_EXPR(BlockRegions), // UINT32 NumRegions; - (BlockRegionInfo*)BlockRegions, // const BlockRegionInfo* pRegions; -}; - -MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig = -{ - { // BLOCK_CONFIG - { - 0, // GPIO_PIN Pin; - false, // BOOL ActiveState; - }, - - (DeviceBlockInfo*)&Device_BlockInfo, // BlockDeviceinfo - }, - - { // CPU_MEMORY_CONFIG - 0, // UINT8 CPU_MEMORY_CONFIG::ChipSelect; - true, // UINT8 CPU_MEMORY_CONFIG::ReadOnly; - 0, // UINT32 CPU_MEMORY_CONFIG::WaitStates; - 0, // UINT32 CPU_MEMORY_CONFIG::ReleaseCounts; - 16, // UINT32 CPU_MEMORY_CONFIG::BitWidth; - 0x08000000, // UINT32 CPU_MEMORY_CONFIG::BaseAddress; - 0x00200000, // UINT32 CPU_MEMORY_CONFIG::SizeInBytes; - 0, // UINT8 CPU_MEMORY_CONFIG::XREADYEnable - 0, // UINT8 CPU_MEMORY_CONFIG::ByteSignalsForRead - 0, // UINT8 CPU_MEMORY_CONFIG::ExternalBufferEnable - }, - - 0, // UINT32 ChipProtection; - 0, // UINT32 ManufacturerCode; - 0, // UINT32 DeviceCode; -}; - -BlockStorageDevice Device_BlockStorage; diff --git a/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage.c b/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage.c deleted file mode 100644 index 5598400676..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/common/Device_BlockStorage.c +++ /dev/null @@ -1,142 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include - -//16kB block -const BlockRange BlockRange1[] = -{ - { BlockRange_BLOCKTYPE_BOOTSTRAP , 0, 0 }, // 0x08000000 nanoBooter - { BlockRange_BLOCKTYPE_CODE , 1, 3 } // 0x08004000 nanoCLR -}; - -//64kB block -const BlockRange BlockRange2[] = -{ - { BlockRange_BLOCKTYPE_CODE , 0, 0 } // 0x08010000 nanoCLR -}; - -//128kB block -const BlockRange BlockRange3[] = -{ - { BlockRange_BLOCKTYPE_CODE , 0, 0 }, // 0x08020000 nanoCLR - { BlockRange_BLOCKTYPE_DEPLOYMENT, 1, 6 }, // 0x08040000 deployment -}; - -//16kB block -const BlockRange BlockRange4[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 3 } // 0x08100000 deployment -}; - -//64kB block -const BlockRange BlockRange5[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 0 } // 0x08110000 deployment -}; - -//128kB block -const BlockRange BlockRange6[] = -{ - { BlockRange_BLOCKTYPE_DEPLOYMENT, 0, 6 } // 0x08120000 deployment -}; - -const BlockRegionInfo BlockRegions[] = -{ - { - (0), // no attributes for this region - 0x08000000, // start address for block region - 4, // total number of blocks in this region - 0x4000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange1), - BlockRange1, - }, - - { - (0), // no attributes for this region - 0x08010000, // start address for block region - 1, // total number of blocks in this region - 0x10000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange2), - BlockRange2, - }, - - { - (0), // no attributes for this region - 0x08020000, // start address for block region - 7, // total number of blocks in this region - 0x20000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange3), - BlockRange3, - }, - - { - (0), // no attributes for this region - 0x08100000, // start address for block region - 4, // total number of blocks in this region - 0x4000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange4), - BlockRange4, - }, - - { - (0), // no attributes for this region - 0x08110000, // start address for block region - 1, // total number of blocks in this region - 0x10000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange5), - BlockRange5, - }, - - { - (0), // no attributes for this region - 0x08120000, // start address for block region - 7, // total number of blocks in this region - 0x20000, // total number of bytes per block - ARRAYSIZE_CONST_EXPR(BlockRange6), - BlockRange6, - }, - -}; - -const DeviceBlockInfo Device_BlockInfo = -{ - (MediaAttribute_SupportsXIP), // STM32 flash memory is XIP - 2, // UINT32 BytesPerSector - ARRAYSIZE_CONST_EXPR(BlockRegions), // UINT32 NumRegions; - (BlockRegionInfo*)BlockRegions, // const BlockRegionInfo* pRegions; -}; - -MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig = -{ - { // BLOCK_CONFIG - { - 0, // GPIO_PIN Pin; - false, // BOOL ActiveState; - }, - - (DeviceBlockInfo*)&Device_BlockInfo, // BlockDeviceinfo - }, - - { // CPU_MEMORY_CONFIG - 0, // UINT8 CPU_MEMORY_CONFIG::ChipSelect; - true, // UINT8 CPU_MEMORY_CONFIG::ReadOnly; - 0, // UINT32 CPU_MEMORY_CONFIG::WaitStates; - 0, // UINT32 CPU_MEMORY_CONFIG::ReleaseCounts; - 16, // UINT32 CPU_MEMORY_CONFIG::BitWidth; - 0x08000000, // UINT32 CPU_MEMORY_CONFIG::BaseAddress; - 0x00200000, // UINT32 CPU_MEMORY_CONFIG::SizeInBytes; - 0, // UINT8 CPU_MEMORY_CONFIG::XREADYEnable - 0, // UINT8 CPU_MEMORY_CONFIG::ByteSignalsForRead - 0, // UINT8 CPU_MEMORY_CONFIG::ExternalBufferEnable - }, - - 0, // UINT32 ChipProtection; - 0, // UINT32 ManufacturerCode; - 0, // UINT32 DeviceCode; -}; - -BlockStorageDevice Device_BlockStorage; diff --git a/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.c b/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.c deleted file mode 100644 index b976bbf343..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.c +++ /dev/null @@ -1,454 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#include "hal.h" - -/* Virtual serial port over USB.*/ -SerialUSBDriver SDU1; - -/* - * Endpoints to be used for USBD2. - */ -#define USBD2_DATA_REQUEST_EP 1 -#define USBD2_DATA_AVAILABLE_EP 1 -#define USBD2_INTERRUPT_REQUEST_EP 2 - -// address for device unique ID -// valid for STM32F4 series -#define DEVICE_ID1 (0x1FFF7A10) -#define DEVICE_ID2 (0x1FFF7A14) -#define DEVICE_ID3 (0x1FFF7A18) - -// // size of string serial is 36 = 2 + 5x2 + 26 from silicon unique ID precedeed of string "NANO_" and descriptor codes -// #define USB_SIZ_STRING_SERIAL 36 - -//////////////////////////////////////////////// -// vendor -#define USB_STRING_VENDOR L"WildernessLabs" -//////////////////////////////////////////////// - -// structure for USB Vendor with Unicode string -typedef struct usb_string_vendor -{ - uint8_t bLength; - uint8_t bDescriptorType; - wchar_t bPropertyData[sizeof(USB_STRING_VENDOR)/sizeof(wchar_t) - 1]; // that's the 'w_char' string length less 1 because we are not storing the terminator (according to the USB spec) - -}usb_string_vendor; - - -///////////////////////////////////////////////////////////////////////// -// device description -#define USB_STRING_DEVICE_DESCRIPTION L"Netduino3_Wifi" -///////////////////////////////////////////////////////////////////////// - -// structure for USB device descriptor with Unicode string -typedef struct usb_string_device_description -{ - uint8_t bLength; - uint8_t bDescriptorType; - wchar_t bPropertyData[sizeof(USB_STRING_DEVICE_DESCRIPTION)/sizeof(wchar_t) - 1]; // that's the 'w_char' string length less 1 because we are not storing the terminator (according to the USB spec) - -}usb_string_device_description; - - -///////////////////////////////////////////////////////////////////////// -// device serial number -// this will produce a string with NANO_ prefix followed -// by the hexadecimal representation of the silicon unique ID of the CPU -#define USB_STRING_SERIAL_NUMBER L"NANO_xxxxxxxxxxx" -///////////////////////////////////////////////////////////////////////// -#define INDEX_OF_WCHAR_FOR_UNIQUE_ID 5 - -// structure for USB serial number descriptor with Unicode string -typedef struct usb_string_serial_number -{ - uint8_t bLength; - uint8_t bDescriptorType; - wchar_t bPropertyData[sizeof(USB_STRING_SERIAL_NUMBER)/sizeof(wchar_t) - 1]; // that's the 'w_char' string length less 1 because we are not storing the terminator (according to the USB spec) - -}usb_string_serial_number; - - -/* - * USB Device Descriptor. - */ -static const uint8_t vcom_device_descriptor_data[] = { - USB_DESC_DEVICE (0x0200, /* bcdUSB (2.0). */ - 0x02, /* bDeviceClass (CDC). */ - 0x00, /* bDeviceSubClass. */ - 0x00, /* bDeviceProtocol. */ - 0x40, /* bMaxPacketSize. */ - 0x0483, /* idVendor (ST). */ - 0x5740, /* idProduct. */ - 0x0200, /* bcdDevice. */ - 1, /* iManufacturer. */ - 2, /* iProduct. */ - 3, /* iSerialNumber. */ - 1) /* bNumConfigurations. */ -}; - -/* - * Device Descriptor wrapper. - */ -static const USBDescriptor vcom_device_descriptor = { - sizeof vcom_device_descriptor_data, - vcom_device_descriptor_data -}; - -/* Configuration Descriptor tree for a CDC.*/ -static const uint8_t vcom_configuration_descriptor_data[] = { - /* Configuration Descriptor.*/ - USB_DESC_CONFIGURATION(0x0043, /* wTotalLength. */ - 0x02, /* bNumInterfaces. */ - 0x01, /* bConfigurationValue. */ - 0, /* iConfiguration. */ - 0xC0, /* bmAttributes (self powered). */ - 50), /* bMaxPower (100mA). */ - /* Interface Descriptor.*/ - USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */ - 0x00, /* bAlternateSetting. */ - 0x01, /* bNumEndpoints. */ - 0x02, /* bInterfaceClass (Communications - Interface Class, CDC section - 4.2). */ - 0x02, /* bInterfaceSubClass (Abstract - Control Model, CDC section 4.3). */ - 0x01, /* bInterfaceProtocol (AT commands, - CDC section 4.4). */ - 0), /* iInterface. */ - /* Header Functional Descriptor (CDC section 5.2.3).*/ - USB_DESC_BYTE (5), /* bLength. */ - USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ - USB_DESC_BYTE (0x00), /* bDescriptorSubtype (Header - Functional Descriptor. */ - USB_DESC_BCD (0x0110), /* bcdCDC. */ - /* Call Management Functional Descriptor. */ - USB_DESC_BYTE (5), /* bFunctionLength. */ - USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ - USB_DESC_BYTE (0x01), /* bDescriptorSubtype (Call Management - Functional Descriptor). */ - USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1). */ - USB_DESC_BYTE (0x01), /* bDataInterface. */ - /* ACM Functional Descriptor.*/ - USB_DESC_BYTE (4), /* bFunctionLength. */ - USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ - USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract - Control Management Descriptor). */ - USB_DESC_BYTE (0x02), /* bmCapabilities. */ - /* Union Functional Descriptor.*/ - USB_DESC_BYTE (5), /* bFunctionLength. */ - USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */ - USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union - Functional Descriptor). */ - USB_DESC_BYTE (0x00), /* bMasterInterface (Communication - Class Interface). */ - USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class - Interface). */ - /* Endpoint 2 Descriptor.*/ - USB_DESC_ENDPOINT (USBD2_INTERRUPT_REQUEST_EP|0x80, - 0x03, /* bmAttributes (Interrupt). */ - 0x0008, /* wMaxPacketSize. */ - 0xFF), /* bInterval. */ - /* Interface Descriptor.*/ - USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */ - 0x00, /* bAlternateSetting. */ - 0x02, /* bNumEndpoints. */ - 0x0A, /* bInterfaceClass (Data Class - Interface, CDC section 4.5). */ - 0x00, /* bInterfaceSubClass (CDC section - 4.6). */ - 0x00, /* bInterfaceProtocol (CDC section - 4.7). */ - 0x00), /* iInterface. */ - /* Endpoint 3 Descriptor.*/ - USB_DESC_ENDPOINT (USBD2_DATA_AVAILABLE_EP, /* bEndpointAddress.*/ - 0x02, /* bmAttributes (Bulk). */ - 0x0040, /* wMaxPacketSize. */ - 0x00), /* bInterval. */ - /* Endpoint 1 Descriptor.*/ - USB_DESC_ENDPOINT (USBD2_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/ - 0x02, /* bmAttributes (Bulk). */ - 0x0040, /* wMaxPacketSize. */ - 0x00) /* bInterval. */ -}; - -/* - * Configuration Descriptor wrapper. - */ -static const USBDescriptor vcom_configuration_descriptor = { - sizeof vcom_configuration_descriptor_data, - vcom_configuration_descriptor_data -}; - -/* - * U.S. English language identifier. - */ -static const uint8_t vcom_string0[] = { - USB_DESC_BYTE(4), /* bLength. */ - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */ - USB_DESC_WORD(0x0409) /* wLANGID (U.S. English). */ -}; - - -// Vendor string -static const usb_string_vendor usb_vendor = { - sizeof(usb_vendor), - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), - USB_STRING_VENDOR -}; - - -// Device Description string -static const usb_string_device_description usb_device_description = { - sizeof(usb_device_description), - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), - USB_STRING_DEVICE_DESCRIPTION -}; - - -// Serial Number string. -static usb_string_serial_number usb_serial_number = { - sizeof(usb_serial_number), - USB_DESC_BYTE(USB_DESCRIPTOR_STRING), - USB_STRING_SERIAL_NUMBER -}; - - -/* - * Strings wrappers array. - */ -static const USBDescriptor vcom_strings[] = { - {sizeof vcom_string0, vcom_string0}, - {sizeof usb_vendor, (uint8_t*)(&usb_vendor)}, - {sizeof usb_device_description, (uint8_t*)(&usb_device_description)}, - {sizeof usb_serial_number, (uint8_t*)(&usb_serial_number)}, -}; - - -// Convert Hex 32Bits value into char -// value: value to convert -// pbuf: pointer to the buffer -// len: buffer length -void IntToUnicode(uint32_t value , uint8_t *pbuf, uint8_t len) -{ - uint8_t idx = 0; - - for( idx = 0; idx < len; idx ++) - { - if( ((value >> 28)) < 0xA ) - { - pbuf[ 2* idx] = (value >> 28) + '0'; - } - else - { - pbuf[2* idx] = (value >> 28) + 'A' - 10; - } - - value = value << 4; - - pbuf[ 2* idx + 1] = 0; - } -} - -// Create the serial number string descriptor -void Get_SerialNum(uint8_t* pbuf) -{ - uint32_t deviceserial0, deviceserial1, deviceserial2; - - deviceserial0 = *(uint32_t*)DEVICE_ID1; - deviceserial1 = *(uint32_t*)DEVICE_ID2; - deviceserial2 = *(uint32_t*)DEVICE_ID3; - - deviceserial0 += deviceserial2; - - if (deviceserial0 != 0) - { - IntToUnicode(deviceserial0, pbuf, 8); - pbuf += 16; - IntToUnicode(deviceserial1, pbuf, 4); - } -} - -/* - * Handles the GET_DESCRIPTOR callback. All required descriptors must be - * handled here. - */ -static const USBDescriptor *get_descriptor(USBDriver *usbp, - uint8_t dtype, - uint8_t dindex, - uint16_t lang) { - - (void)usbp; - (void)lang; - - switch (dtype) { - case USB_DESCRIPTOR_DEVICE: - return &vcom_device_descriptor; - case USB_DESCRIPTOR_CONFIGURATION: - return &vcom_configuration_descriptor; - case USB_DESCRIPTOR_STRING: - if (dindex < 4) - { - if(dindex == 3) - { - // request is for serial number - // get it from the silicon unique ID - Get_SerialNum((uint8_t*)&usb_serial_number.bPropertyData[INDEX_OF_WCHAR_FOR_UNIQUE_ID]); - } - - return &vcom_strings[dindex]; - } - } - return NULL; -} - -/** - * @brief IN EP1 state. - */ -static USBInEndpointState ep1instate; - -/** - * @brief OUT EP1 state. - */ -static USBOutEndpointState ep1outstate; - -/** - * @brief EP1 initialization structure (both IN and OUT). - */ -static const USBEndpointConfig ep1config = { - USB_EP_MODE_TYPE_BULK, - NULL, - sduDataTransmitted, - sduDataReceived, - 0x0040, - 0x0040, - &ep1instate, - &ep1outstate, - 2, - NULL -}; - -/** - * @brief IN EP2 state. - */ -static USBInEndpointState ep2instate; - -/** - * @brief EP2 initialization structure (IN only). - */ -static const USBEndpointConfig ep2config = { - USB_EP_MODE_TYPE_INTR, - NULL, - sduInterruptTransmitted, - NULL, - 0x0010, - 0x0000, - &ep2instate, - NULL, - 1, - NULL -}; - -/* - * Handles the USB driver global events. - */ -static void usb_event(USBDriver *usbp, usbevent_t event) { - extern SerialUSBDriver SDU1; - - switch (event) { - case USB_EVENT_ADDRESS: - return; - case USB_EVENT_CONFIGURED: - chSysLockFromISR(); - - if (usbp->state == USB_ACTIVE) { - /* Enables the endpoints specified into the configuration. - Note, this callback is invoked from an ISR so I-Class functions - must be used.*/ - usbInitEndpointI(usbp, USBD2_DATA_REQUEST_EP, &ep1config); - usbInitEndpointI(usbp, USBD2_INTERRUPT_REQUEST_EP, &ep2config); - - /* Resetting the state of the CDC subsystem.*/ - sduConfigureHookI(&SDU1); - } - else if (usbp->state == USB_SELECTED) { - usbDisableEndpointsI(usbp); - } - - chSysUnlockFromISR(); - return; - case USB_EVENT_RESET: - /* Falls into.*/ - case USB_EVENT_UNCONFIGURED: - /* Falls into.*/ - case USB_EVENT_SUSPEND: - chSysLockFromISR(); - - /* Disconnection event on suspend.*/ - sduSuspendHookI(&SDU1); - - chSysUnlockFromISR(); - return; - case USB_EVENT_WAKEUP: - chSysLockFromISR(); - - /* Disconnection event on suspend.*/ - sduWakeupHookI(&SDU1); - - chSysUnlockFromISR(); - return; - case USB_EVENT_STALLED: - return; - } - return; -} - -/* - * Handling messages not implemented in the default handler nor in the - * SerialUSB handler. - */ -static bool requests_hook(USBDriver *usbp) { - - if (((usbp->setup[0] & USB_RTYPE_RECIPIENT_MASK) == USB_RTYPE_RECIPIENT_INTERFACE) && - (usbp->setup[1] == USB_REQ_SET_INTERFACE)) { - usbSetupTransfer(usbp, NULL, 0, NULL); - return true; - } - return sduRequestsHook(usbp); -} - -/* - * Handles the USB driver global events. - */ -static void sof_handler(USBDriver *usbp) { - - (void)usbp; - - osalSysLockFromISR(); - sduSOFHookI(&SDU1); - osalSysUnlockFromISR(); -} - -/* - * USB driver configuration. - */ -const USBConfig usbcfg = { - usb_event, - get_descriptor, - requests_hook, - sof_handler -}; - -/* - * Serial over USB driver configuration. - */ -const SerialUSBConfig serusbcfg = { - &USBD1, - USBD2_DATA_REQUEST_EP, - USBD2_DATA_AVAILABLE_EP, - USBD2_INTERRUPT_REQUEST_EP -}; diff --git a/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.h b/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.h deleted file mode 100644 index 47d4546acb..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/common/usbcfg.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#ifndef USBCFG_H -#define USBCFG_H - -extern const USBConfig usbcfg; -extern SerialUSBConfig serusbcfg; -extern SerialUSBDriver SDU1; - -#endif /* USBCFG_H */ - -/** @} */ - diff --git a/targets/ChibiOS/NETDUINO3_WIFI/ffconf.h b/targets/ChibiOS/NETDUINO3_WIFI/ffconf.h deleted file mode 100644 index a043bda54c..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/ffconf.h +++ /dev/null @@ -1,269 +0,0 @@ -/* CHIBIOS FIX */ -#include "ch.h" - -/*---------------------------------------------------------------------------/ -/ FatFs Functional Configurations -/---------------------------------------------------------------------------*/ - -#define FFCONF_DEF 86606 /* Revision ID */ - -/*---------------------------------------------------------------------------/ -/ Function Configurations -/---------------------------------------------------------------------------*/ - -#define FF_FS_READONLY 0 -/* This option switches read-only configuration. (0:Read/Write or 1:Read-only) -/ Read-only configuration removes writing API functions, f_write(), f_sync(), -/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() -/ and optional writing functions as well. */ - -#define FF_FS_MINIMIZE 0 -/* This option defines minimization level to remove some basic API functions. -/ -/ 0: Basic functions are fully enabled. -/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() -/ are removed. -/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. -/ 3: f_lseek() function is removed in addition to 2. */ - -#define FF_USE_STRFUNC 1 -/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf(). -/ -/ 0: Disable string functions. -/ 1: Enable without LF-CRLF conversion. -/ 2: Enable with LF-CRLF conversion. */ - -#define FF_USE_FIND 1 -/* This option switches filtered directory read functions, f_findfirst() and -/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ - -#define FF_USE_MKFS 0 -/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ - -#define FF_USE_FASTSEEK 0 -/* This option switches fast seek function. (0:Disable or 1:Enable) */ - -#define FF_USE_EXPAND 0 -/* This option switches f_expand function. (0:Disable or 1:Enable) */ - -#define FF_USE_CHMOD 1 -/* This option switches attribute manipulation functions, f_chmod() and f_utime(). -/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */ - -#define FF_USE_LABEL 1 -/* This option switches volume label functions, f_getlabel() and f_setlabel(). -/ (0:Disable or 1:Enable) */ - -#define FF_USE_FORWARD 0 -/* This option switches f_forward() function. (0:Disable or 1:Enable) */ - -/*---------------------------------------------------------------------------/ -/ Locale and Namespace Configurations -/---------------------------------------------------------------------------*/ - -#define FF_CODE_PAGE 850 -/* This option specifies the OEM code page to be used on the target system. -/ Incorrect code page setting can cause a file open failure. -/ -/ 437 - U.S. -/ 720 - Arabic -/ 737 - Greek -/ 771 - KBL -/ 775 - Baltic -/ 850 - Latin 1 -/ 852 - Latin 2 -/ 855 - Cyrillic -/ 857 - Turkish -/ 860 - Portuguese -/ 861 - Icelandic -/ 862 - Hebrew -/ 863 - Canadian French -/ 864 - Arabic -/ 865 - Nordic -/ 866 - Russian -/ 869 - Greek 2 -/ 932 - Japanese (DBCS) -/ 936 - Simplified Chinese (DBCS) -/ 949 - Korean (DBCS) -/ 950 - Traditional Chinese (DBCS) -/ 0 - Include all code pages above and configured by f_setcp() -*/ - -#define FF_USE_LFN 3 -#define FF_MAX_LFN 255 -/* The FF_USE_LFN switches the support for LFN (long file name). -/ -/ 0: Disable LFN. FF_MAX_LFN has no effect. -/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. -/ 2: Enable LFN with dynamic working buffer on the STACK. -/ 3: Enable LFN with dynamic working buffer on the HEAP. -/ -/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function -/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and -/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled. -/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can -/ be in range of 12 to 255. It is recommended to be set it 255 to fully support LFN -/ specification. -/ When use stack for the working buffer, take care on stack overflow. When use heap -/ memory for the working buffer, memory management functions, ff_memalloc() and -/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */ - -#define FF_LFN_UNICODE 0 -/* This option switches the character encoding on the API when LFN is enabled. -/ -/ 0: ANSI/OEM in current CP (TCHAR = char) -/ 1: Unicode in UTF-16 (TCHAR = WCHAR) -/ 2: Unicode in UTF-8 (TCHAR = char) -/ 3: Unicode in UTF-32 (TCHAR = DWORD) -/ -/ Also behavior of string I/O functions will be affected by this option. -/ When LFN is not enabled, this option has no effect. */ - -#define FF_LFN_BUF 255 -#define FF_SFN_BUF 12 -/* This set of options defines size of file name members in the FILINFO structure -/ which is used to read out directory items. These values should be suffcient for -/ the file names to read. The maximum possible length of the read file name depends -/ on character encoding. When LFN is not enabled, these options have no effect. */ - -#define FF_STRF_ENCODE 3 -/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(), -/ f_putc(), f_puts and f_printf() convert the character encoding in it. -/ This option selects assumption of character encoding ON THE FILE to be -/ read/written via those functions. -/ -/ 0: ANSI/OEM in current CP -/ 1: Unicode in UTF-16LE -/ 2: Unicode in UTF-16BE -/ 3: Unicode in UTF-8 -*/ - -#define FF_FS_RPATH 2 -/* This option configures support for relative path. -/ -/ 0: Disable relative path and remove related functions. -/ 1: Enable relative path. f_chdir() and f_chdrive() are available. -/ 2: f_getcwd() function is available in addition to 1. -*/ - -/*---------------------------------------------------------------------------/ -/ Drive/Volume Configurations -/---------------------------------------------------------------------------*/ - -#define FF_VOLUMES 3 -/* Number of volumes (logical drives) to be used. (1-10) */ - -#define FF_STR_VOLUME_ID 1 -#define FF_VOLUME_STRS "D", "E", "F" -/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings. -/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive -/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each -/ logical drives. Number of items must not be less than FF_VOLUMES. Valid -/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are -/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is -/ not defined, a user defined volume string table needs to be defined as: -/ -/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",... -*/ - -#define FF_MULTI_PARTITION 0 -/* This option switches support for multiple volumes on the physical drive. -/ By default (0), each logical drive number is bound to the same physical drive -/ number and only an FAT volume found on the physical drive will be mounted. -/ When this function is enabled (1), each logical drive number can be bound to -/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() -/ funciton will be available. */ - -#define FF_MIN_SS 512 -#define FF_MAX_SS 512 -/* This set of options configures the range of sector size to be supported. (512, -/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and -/ harddisk. But a larger value may be required for on-board flash memory and some -/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured -/ for variable sector size mode and disk_ioctl() function needs to implement -/ GET_SECTOR_SIZE command. */ - -#define FF_LBA64 0 -/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable) -/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */ - -#define FF_MIN_GPT 0x100000000 -/* Minimum number of sectors to switch GPT format to create partition in f_mkfs and -/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */ - -#define FF_USE_TRIM 0 -/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) -/ To enable Trim function, also CTRL_TRIM command should be implemented to the -/ disk_ioctl() function. */ - -/*---------------------------------------------------------------------------/ -/ System Configurations -/---------------------------------------------------------------------------*/ - -#define FF_FS_TINY 0 -/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) -/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes. -/ Instead of private sector buffer eliminated from the file object, common sector -/ buffer in the filesystem object (FATFS) is used for the file data transfer. */ - -#define FF_FS_EXFAT 0 -/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable) -/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1) -/ Note that enabling exFAT discards ANSI C (C89) compatibility. */ - -#define FF_FS_NORTC 1 -#define FF_NORTC_MON 1 -#define FF_NORTC_MDAY 1 -#define FF_NORTC_YEAR 2020 -/* The option FF_FS_NORTC switches timestamp function. If the system does not have -/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable -/ the timestamp function. Every object modified by FatFs will have a fixed timestamp -/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time. -/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be -/ added to the project to read current time form real-time clock. FF_NORTC_MON, -/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect. -/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */ - -#define FF_FS_NOFSINFO 0 -/* If you need to know correct free space on the FAT32 volume, set bit 0 of this -/ option, and f_getfree() function at first time after volume mount will force -/ a full FAT scan. Bit 1 controls the use of last allocated cluster number. -/ -/ bit0=0: Use free cluster count in the FSINFO if available. -/ bit0=1: Do not trust free cluster count in the FSINFO. -/ bit1=0: Use last allocated cluster number in the FSINFO if available. -/ bit1=1: Do not trust last allocated cluster number in the FSINFO. -*/ - -#define FF_FS_LOCK 0 -/* The option FF_FS_LOCK switches file lock function to control duplicated file open -/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY -/ is 1. -/ -/ 0: Disable file lock function. To avoid volume corruption, application program -/ should avoid illegal open, remove and rename to the open objects. -/ >0: Enable file lock function. The value defines how many files/sub-directories -/ can be opened simultaneously under file lock control. Note that the file -/ lock control is independent of re-entrancy. */ - -#define FF_FS_REENTRANT 1 -#define FF_FS_TIMEOUT TIME_MS2I(1000) -#define FF_SYNC_t semaphore_t * -/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs -/ module itself. Note that regardless of this option, file access to different -/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs() -/ and f_fdisk() function, are always not re-entrant. Only file/directory access -/ to the same volume is under control of this function. -/ -/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect. -/ 1: Enable re-entrancy. Also user provided synchronization handlers, -/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() -/ function, must be added to the project. Samples are available in -/ option/syscall.c. -/ -/ The FF_FS_TIMEOUT defines timeout period in unit of time tick. -/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, -/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be -/ included somewhere in the scope of ff.h. */ - -/*--- End of configuration options ---*/ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/launch.json b/targets/ChibiOS/NETDUINO3_WIFI/launch.json deleted file mode 100644 index 3b08d9ea59..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/launch.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "NETDUINO3_WIFI nanoBooter", - "type": "cppdbg", - "request": "launch", - "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", - "program": "${workspaceRoot}/build/nanoBooter.elf", - "setupCommands": [ - { - "text": "target extended-remote localhost:3333" - }, - { - "text": "monitor reset_config none separate" - }, - { - "text": "monitor reset halt" - }, - { - "text": "monitor flash write_image erase \"/build/nanoBooter.hex\" " - }, - { - "text": "file /build/nanoBooter.elf" - }, - { - "text": "monitor reset halt" - }, - { - "text": "set output-radix 16", - "description": "set the default numeric base to 16", - "ignoreFailures": false - } - ], - "customLaunchSetupCommands": [ - { - "text": "monitor reset_config none separate" - }, - { - "text": "monitor reset halt" - } - ], - "logging": { - "moduleLoad": false, - "trace": false, - "engineLogging": false, - "programOutput": true, - "exceptions": true - }, - "launchCompleteCommand": "exec-continue", - "debugServerPath": "/bin/openocd.exe", - "debugServerArgs": "-s \"/scripts/\" -f board/stm32f4discovery.cfg", - "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware", - "filterStderr": true, - "externalConsole": true, - "cwd": "${cwd}" - }, - { - "name": "NETDUINO3_WIFI nanoCLR", - "type": "cppdbg", - "request": "launch", - "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", - "program": "${workspaceRoot}/build/nanoCLR.elf", - "setupCommands": [ - { - "text": "target extended-remote localhost:3333" - }, - { - "text": "monitor reset_config none separate" - }, - { - "text": "monitor reset halt" - }, - { - "text": "monitor flash write_image erase \"/build/nanoCLR.hex\" " - }, - { - "text": "file /build/nanoCLR.elf" - }, - { - "text": "monitor reset halt" - }, - { - "text": "set output-radix 16", - "description": "set the default numeric base to 16", - "ignoreFailures": false - } - ], - "customLaunchSetupCommands": [ - { - "text": "monitor reset_config none separate" - }, - { - "text": "monitor reset halt" - } - ], - "logging": { - "moduleLoad": false, - "trace": false, - "engineLogging": false, - "programOutput": true, - "exceptions": true - }, - "launchCompleteCommand": "exec-continue", - "debugServerPath": "/bin/openocd.exe", - "debugServerArgs": "-s \"/scripts/\" -f board/stm32429i_eval_stlink.cfg", - "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware", - "filterStderr": true, - "externalConsole": true, - "cwd": "${cwd}" - } - ] -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/NETDUINO3_WIFI.Adc.cs b/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/NETDUINO3_WIFI.Adc.cs deleted file mode 100644 index 4bdb79d61f..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/NETDUINO3_WIFI.Adc.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace nanoFramework.Targets.NETDUINO3_WIFI -{ - /// - /// Enumeration of ADC channels available in NETDUINO3_WIFI - /// - public static class AdcChannels - { - /// - /// Channel 0, connected to PC0 (ADC1 - IN10) - /// - public const int Channel_0 = 0; - - /// - /// Channel 1, connected to PC1 (ADC1 - IN11) - /// - public const int Channel_1 = 1; - - /// - /// Channel 2, connected to PC2 (ADC2 - IN14) - /// - public const int Channel_2 = 2; - - /// - /// Channel 3, connected to PC3 (ADC2 - IN15) - /// - public const int Channel_3 = 3; - - /// - /// Channel 4, connected to PC4 (ADC3 - IN12) - /// - public const int Channel_4 = 4; - - /// - /// Channel 5, connected to PC5 (ADC3 - IN13) - /// - public const int Channel_5 = 5; - - /// - /// Channel 6, internal temperature sensor, connected to ADC1 - /// - public const int Channel_TemperatureSensor = 6; - - /// - /// Channel 7, internal voltage reference, connected to ADC1 - /// - public const int Channel_VrefIn = 7; - - /// - /// Channel 8, connected to VBatt pin, ADC1 - /// - public const int Channel_Vbatt = 8; - } -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/README.md b/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/README.md deleted file mode 100644 index d3c16dd112..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## Managed code helpers - -This folder contains helper classes to make developers life easier when coding for this target board. - -* [Adc](NETDUINO3_WIFI.Adc.cs) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/package.nuspec b/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/package.nuspec deleted file mode 100644 index 860a61a44c..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/managed_helpers/package.nuspec +++ /dev/null @@ -1,28 +0,0 @@ - - - - nanoFramework.Targets.NETDUINO3_WIFI - nanoFramework.Targets.NETDUINO3_WIFI - 1.0.0 - nanoFramework project contributors - nanoFramework project contributors - false - - Helper classes to use NETDUINO3_WIFI target in C# applications. - - - - - This is an extension for .NET nanoFramework enhacing support for Windows.Devices.Gpio.GpioController when using STM32 MCUs. - - https://github.com/nanoframework - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - https://github.com/nanoframework/nf-interpreter/blob/develop/LICENSE.md - Copyright (c) .NET Foundation and Contributors - - nanoFramework, nano Framework, NETNF, NETMF, Micro Framework, STM32, .net, NETDUINO3_WIFI - - - - - diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/CMakeLists.txt b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/CMakeLists.txt deleted file mode 100644 index 09b9337e00..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. -# - -# # append nanoBooter source files -list(APPEND NANOBOOTER_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.c") -# make var global -set(NANOBOOTER_PROJECT_SOURCES ${NANOBOOTER_PROJECT_SOURCES} CACHE INTERNAL "make global") diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/chconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/chconf.h deleted file mode 100644 index 7d04091405..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/chconf.h +++ /dev/null @@ -1,819 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -/** - * @file rt/templates/chconf.h - * @brief Configuration file template. - * @details A copy of this file must be placed in each project directory, it - * contains the application specific kernel settings. - * - * @addtogroup config - * @details Kernel related settings and hooks. - * @{ - */ - -#ifndef CHCONF_H -#define CHCONF_H - -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_7_0_ - -/*===========================================================================*/ -/** - * @name System settings - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Handling of instances. - * @note If enabled then threads assigned to various instances can - * interact each other using the same synchronization objects. - * If disabled then each OS instance is a separate world, no - * direct interactions are handled by the OS. - */ -#if !defined(CH_CFG_SMP_MODE) -#define CH_CFG_SMP_MODE FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name System timers settings - * @{ - */ -/*===========================================================================*/ - -/** - * @brief System time counter resolution. - * @note Allowed values are 16, 32 or 64 bits. - */ -#if !defined(CH_CFG_ST_RESOLUTION) -#define CH_CFG_ST_RESOLUTION 32 -#endif - -/** - * @brief System tick frequency. - * @details Frequency of the system timer that drives the system ticks. This - * setting also defines the system tick time unit. - */ -#if !defined(CH_CFG_ST_FREQUENCY) -#define CH_CFG_ST_FREQUENCY 10000 -#endif - -/** - * @brief Time intervals data size. - * @note Allowed values are 16, 32 or 64 bits. - */ -#if !defined(CH_CFG_INTERVALS_SIZE) -#define CH_CFG_INTERVALS_SIZE 32 -#endif - -/** - * @brief Time types data size. - * @note Allowed values are 16 or 32 bits. - */ -#if !defined(CH_CFG_TIME_TYPES_SIZE) -#define CH_CFG_TIME_TYPES_SIZE 32 -#endif - -/** - * @brief Time delta constant for the tick-less mode. - * @note If this value is zero then the system uses the classic - * periodic tick. This value represents the minimum number - * of ticks that is safe to specify in a timeout directive. - * The value one is not valid, timeouts are rounded up to - * this value. - */ -#if !defined(CH_CFG_ST_TIMEDELTA) -#define CH_CFG_ST_TIMEDELTA 2 -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Kernel parameters and options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Round robin interval. - * @details This constant is the number of system ticks allowed for the - * threads before preemption occurs. Setting this value to zero - * disables the preemption for threads with equal priority and the - * round robin becomes cooperative. Note that higher priority - * threads can still preempt, the kernel is always preemptive. - * @note Disabling the round robin preemption makes the kernel more compact - * and generally faster. - * @note The round robin preemption is not supported in tickless mode and - * must be set to zero in that case. - */ -#if !defined(CH_CFG_TIME_QUANTUM) -#define CH_CFG_TIME_QUANTUM 0 -#endif - -/** - * @brief Idle thread automatic spawn suppression. - * @details When this option is activated the function @p chSysInit() - * does not spawn the idle thread. The application @p main() - * function becomes the idle thread and must implement an - * infinite loop. - */ -#if !defined(CH_CFG_NO_IDLE_THREAD) -#define CH_CFG_NO_IDLE_THREAD FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Performance options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief OS optimization. - * @details If enabled then time efficient rather than space efficient code - * is used when two possible implementations exist. - * - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_OPTIMIZE_SPEED) -#define CH_CFG_OPTIMIZE_SPEED TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Subsystem options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Time Measurement APIs. - * @details If enabled then the time measurement APIs are included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_TM) -#define CH_CFG_USE_TM FALSE -#endif - -/** - * @brief Time Stamps APIs. - * @details If enabled then the time time stamps APIs are included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_TIMESTAMP) -#define CH_CFG_USE_TIMESTAMP FALSE -#endif - -/** - * @brief Threads registry APIs. - * @details If enabled then the registry APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_REGISTRY) -#define CH_CFG_USE_REGISTRY TRUE -#endif - -/** - * @brief Threads synchronization APIs. - * @details If enabled then the @p chThdWait() function is included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_WAITEXIT) -#define CH_CFG_USE_WAITEXIT TRUE -#endif - -/** - * @brief Semaphores APIs. - * @details If enabled then the Semaphores APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_SEMAPHORES) -#define CH_CFG_USE_SEMAPHORES TRUE -#endif - -/** - * @brief Semaphores queuing mode. - * @details If enabled then the threads are enqueued on semaphores by - * priority rather than in FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) -#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE -#endif - -/** - * @brief Mutexes APIs. - * @details If enabled then the mutexes APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MUTEXES) -#define CH_CFG_USE_MUTEXES FALSE -#endif - -/** - * @brief Enables recursive behavior on mutexes. - * @note Recursive mutexes are heavier and have an increased - * memory footprint. - * - * @note The default is @p FALSE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) -#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE -#endif - -/** - * @brief Conditional Variables APIs. - * @details If enabled then the conditional variables APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_CONDVARS) -#define CH_CFG_USE_CONDVARS FALSE -#endif - -/** - * @brief Conditional Variables APIs with timeout. - * @details If enabled then the conditional variables APIs with timeout - * specification are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_CONDVARS. - */ -#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) -#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE -#endif - -/** - * @brief Events Flags APIs. - * @details If enabled then the event flags APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_EVENTS) -#define CH_CFG_USE_EVENTS TRUE -#endif - -/** - * @brief Events Flags APIs with timeout. - * @details If enabled then the events APIs with timeout specification - * are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_EVENTS. - */ -#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) -#define CH_CFG_USE_EVENTS_TIMEOUT TRUE -#endif - -/** - * @brief Synchronous Messages APIs. - * @details If enabled then the synchronous messages APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MESSAGES) -#define CH_CFG_USE_MESSAGES FALSE -#endif - -/** - * @brief Synchronous Messages queuing mode. - * @details If enabled then messages are served by priority rather than in - * FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_MESSAGES. - */ -#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) -#define CH_CFG_USE_MESSAGES_PRIORITY FALSE -#endif - -/** - * @brief Dynamic Threads APIs. - * @details If enabled then the dynamic threads creation APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_WAITEXIT. - * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. - */ -#if !defined(CH_CFG_USE_DYNAMIC) -#define CH_CFG_USE_DYNAMIC TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name OSLIB options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Mailboxes APIs. - * @details If enabled then the asynchronous messages (mailboxes) APIs are - * included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_MAILBOXES) -#define CH_CFG_USE_MAILBOXES TRUE -#endif - -/** - * @brief Core Memory Manager APIs. - * @details If enabled then the core memory manager APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMCORE) -#define CH_CFG_USE_MEMCORE TRUE -#endif - -/** - * @brief Managed RAM size. - * @details Size of the RAM area to be managed by the OS. If set to zero - * then the whole available RAM is used. The core memory is made - * available to the heap allocator and/or can be used directly through - * the simplified core memory allocator. - * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_CFG_USE_MEMCORE. - */ -#if !defined(CH_CFG_MEMCORE_SIZE) -#define CH_CFG_MEMCORE_SIZE 0 -#endif - -/** - * @brief Heap Allocator APIs. - * @details If enabled then the memory heap allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or - * @p CH_CFG_USE_SEMAPHORES. - * @note Mutexes are recommended. - */ -#if !defined(CH_CFG_USE_HEAP) -#define CH_CFG_USE_HEAP TRUE -#endif - -/** - * @brief Memory Pools Allocator APIs. - * @details If enabled then the memory pools allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMPOOLS) -#define CH_CFG_USE_MEMPOOLS TRUE -#endif - -/** - * @brief Objects FIFOs APIs. - * @details If enabled then the objects FIFOs APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_OBJ_FIFOS) -#define CH_CFG_USE_OBJ_FIFOS TRUE -#endif - -/** - * @brief Pipes APIs. - * @details If enabled then the pipes APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_PIPES) -#define CH_CFG_USE_PIPES TRUE -#endif - -/** - * @brief Objects Caches APIs. - * @details If enabled then the objects caches APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_OBJ_CACHES) -#define CH_CFG_USE_OBJ_CACHES FALSE -#endif - -/** - * @brief Delegate threads APIs. - * @details If enabled then the delegate threads APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_DELEGATES) -#define CH_CFG_USE_DELEGATES FALSE -#endif - -/** - * @brief Jobs Queues APIs. - * @details If enabled then the jobs queues APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_JOBS) -#define CH_CFG_USE_JOBS FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Objects factory options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Objects Factory APIs. - * @details If enabled then the objects factory APIs are included in the - * kernel. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_CFG_USE_FACTORY) -#define CH_CFG_USE_FACTORY FALSE -#endif - -/** - * @brief Maximum length for object names. - * @details If the specified length is zero then the name is stored by - * pointer but this could have unintended side effects. - */ -#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) -#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 -#endif - -/** - * @brief Enables the registry of generic objects. - */ -#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) -#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE -#endif - -/** - * @brief Enables factory for generic buffers. - */ -#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) -#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE -#endif - -/** - * @brief Enables factory for semaphores. - */ -#if !defined(CH_CFG_FACTORY_SEMAPHORES) -#define CH_CFG_FACTORY_SEMAPHORES TRUE -#endif - -/** - * @brief Enables factory for mailboxes. - */ -#if !defined(CH_CFG_FACTORY_MAILBOXES) -#define CH_CFG_FACTORY_MAILBOXES TRUE -#endif - -/** - * @brief Enables factory for objects FIFOs. - */ -#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) -#define CH_CFG_FACTORY_OBJ_FIFOS TRUE -#endif - -/** - * @brief Enables factory for Pipes. - */ -#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) -#define CH_CFG_FACTORY_PIPES TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Debug options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Debug option, kernel statistics. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_STATISTICS) -#define CH_DBG_STATISTICS FALSE -#endif - -/** - * @brief Debug option, system state check. - * @details If enabled the correct call protocol for system APIs is checked - * at runtime. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_SYSTEM_STATE_CHECK) -#define CH_DBG_SYSTEM_STATE_CHECK FALSE -#endif - -/** - * @brief Debug option, parameters checks. - * @details If enabled then the checks on the API functions input - * parameters are activated. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_CHECKS) -#define CH_DBG_ENABLE_CHECKS FALSE -#endif - -/** - * @brief Debug option, consistency checks. - * @details If enabled then all the assertions in the kernel code are - * activated. This includes consistency checks inside the kernel, - * runtime anomalies and port-defined checks. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_ASSERTS) -#define CH_DBG_ENABLE_ASSERTS FALSE -#endif - -/** - * @brief Debug option, trace buffer. - * @details If enabled then the trace buffer is activated. - * - * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_MASK) -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED -#endif - -/** - * @brief Trace buffer entries. - * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is - * different from @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_BUFFER_SIZE) -#define CH_DBG_TRACE_BUFFER_SIZE 128 -#endif - -/** - * @brief Debug option, stack checks. - * @details If enabled then a runtime stack check is performed. - * - * @note The default is @p FALSE. - * @note The stack check is performed in a architecture/port dependent way. - * It may not be implemented or some ports. - * @note The default failure mode is to halt the system with the global - * @p panic_msg variable set to @p NULL. - */ -#if !defined(CH_DBG_ENABLE_STACK_CHECK) -#define CH_DBG_ENABLE_STACK_CHECK FALSE -#endif - -/** - * @brief Debug option, stacks initialization. - * @details If enabled then the threads working area is filled with a byte - * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_FILL_THREADS) -#define CH_DBG_FILL_THREADS FALSE -#endif - -/** - * @brief Debug option, threads profiling. - * @details If enabled then a field is added to the @p thread_t structure that - * counts the system ticks occurred while executing the thread. - * - * @note The default is @p FALSE. - * @note This debug option is not currently compatible with the - * tickless mode. - */ -#if !defined(CH_DBG_THREADS_PROFILING) -#define CH_DBG_THREADS_PROFILING FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Kernel hooks - * @{ - */ -/*===========================================================================*/ - -/** - * @brief System structure extension. - * @details User fields added to the end of the @p ch_system_t structure. - */ -#define CH_CFG_SYSTEM_EXTRA_FIELDS /* Add system custom fields here.*/ - -/** - * @brief System initialization hook. - * @details User initialization code added to the @p chSysInit() function - * just before interrupts are enabled globally. - */ -#define CH_CFG_SYSTEM_INIT_HOOK() \ - { \ - /* Add system initialization code here.*/ \ - } - -/** - * @brief OS instance structure extension. - * @details User fields added to the end of the @p os_instance_t structure. - */ -#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS /* Add OS instance custom fields here.*/ - -/** - * @brief OS instance initialization hook. - * - * @param[in] oip pointer to the @p os_instance_t structure - */ -#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) \ - { \ - /* Add OS instance initialization code here.*/ \ - } - -/** - * @brief Threads descriptor structure extension. - * @details User fields added to the end of the @p thread_t structure. - */ -#define CH_CFG_THREAD_EXTRA_FIELDS /* Add threads custom fields here.*/ - -/** - * @brief Threads initialization hook. - * @details User initialization code added to the @p _thread_init() function. - * - * @note It is invoked from within @p _thread_init() and implicitly from all - * the threads creation APIs. - * - * @param[in] tp pointer to the @p thread_t structure - */ -#define CH_CFG_THREAD_INIT_HOOK(tp) \ - { \ - /* Add threads initialization code here.*/ \ - } - -/** - * @brief Threads finalization hook. - * @details User finalization code added to the @p chThdExit() API. - * - * @param[in] tp pointer to the @p thread_t structure - */ -#define CH_CFG_THREAD_EXIT_HOOK(tp) \ - { \ - /* Add threads finalization code here.*/ \ - } - -/** - * @brief Context switch hook. - * @details This hook is invoked just before switching between threads. - * - * @param[in] ntp thread being switched in - * @param[in] otp thread being switched out - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) \ - { \ - /* Context switch code here.*/ \ - } - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() \ - { \ - /* IRQ prologue code here.*/ \ - } - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() \ - { \ - /* IRQ epilogue code here.*/ \ - } - -/** - * @brief Idle thread enter hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to activate a power saving mode. - */ -#define CH_CFG_IDLE_ENTER_HOOK() \ - { \ - /* Idle-enter code here.*/ \ - } - -/** - * @brief Idle thread leave hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to deactivate a power saving mode. - */ -#define CH_CFG_IDLE_LEAVE_HOOK() \ - { \ - /* Idle-leave code here.*/ \ - } - -/** - * @brief Idle Loop hook. - * @details This hook is continuously invoked by the idle thread loop. - */ -#define CH_CFG_IDLE_LOOP_HOOK() \ - { \ - /* Idle loop code here.*/ \ - } - -/** - * @brief System tick event hook. - * @details This hook is invoked in the system tick handler immediately - * after processing the virtual timers queue. - */ -#define CH_CFG_SYSTEM_TICK_HOOK() \ - { \ - /* System tick event code here.*/ \ - } - -/** - * @brief System halt hook. - * @details This hook is invoked in case to a system halting error before - * the system is halted. - */ -#define CH_CFG_SYSTEM_HALT_HOOK(reason) \ - { \ - /* System halt code here.*/ \ - } - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) \ - { \ - /* Trace code here.*/ \ - } - -/** - * @brief Runtime Faults Collection Unit hook. - * @details This hook is invoked each time new faults are collected and stored. - */ -#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) \ - { \ - /* Faults handling code here.*/ \ - } - -/** @} */ - -/*===========================================================================*/ -/* Port-specific settings (override port settings defaulted in chcore.h). */ -/*===========================================================================*/ - -#endif /* CHCONF_H */ - -/** @} */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf.h deleted file mode 100644 index 2aa384cd33..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf.h +++ /dev/null @@ -1,544 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -/** - * @file templates/halconf.h - * @brief HAL configuration header. - * @details HAL configuration file, this file allows to enable or disable the - * various device drivers from your application. You may also use - * this file in order to override the device drivers default settings. - * - * @addtogroup HAL_CONF - * @{ - */ - -#ifndef HALCONF_H -#define HALCONF_H - -#define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ - -#include "mcuconf.h" - -/** - * @brief Enables the PAL subsystem. - */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif - -/** - * @brief Enables the ADC subsystem. - */ -#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -#define HAL_USE_ADC FALSE -#endif - -/** - * @brief Enables the CAN subsystem. - */ -#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN FALSE -#endif - -/** - * @brief Enables the cryptographic subsystem. - */ -#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) -#define HAL_USE_CRY FALSE -#endif - -/** - * @brief Enables the DAC subsystem. - */ -#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) -#define HAL_USE_DAC FALSE -#endif - -/** - * @brief Enables the EFlash subsystem. - */ -#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) -#define HAL_USE_EFL FALSE -#endif - -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT FALSE -#endif - -/** - * @brief Enables the I2C subsystem. - */ -#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) -#define HAL_USE_I2C FALSE -#endif - -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif - -/** - * @brief Enables the ICU subsystem. - */ -#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU FALSE -#endif - -/** - * @brief Enables the MAC subsystem. - */ -#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE -#endif - -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI FALSE -#endif - -/** - * @brief Enables the PWM subsystem. - */ -#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) -#define HAL_USE_PWM FALSE -#endif - -/** - * @brief Enables the RTC subsystem. - */ -#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) -#define HAL_USE_RTC FALSE -#endif - -/** - * @brief Enables the SDC subsystem. - */ -#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -#define HAL_USE_SDC FALSE -#endif - -/** - * @brief Enables the SERIAL subsystem. - */ -#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL FALSE -#endif - -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif - -/** - * @brief Enables the SIO subsystem. - */ -#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) -#define HAL_USE_SIO FALSE -#endif - -/** - * @brief Enables the SPI subsystem. - */ -#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) -#define HAL_USE_SPI FALSE -#endif - -/** - * @brief Enables the TRNG subsystem. - */ -#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) -#define HAL_USE_TRNG FALSE -#endif - -/** - * @brief Enables the UART subsystem. - */ -#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) -#define HAL_USE_UART FALSE -#endif - -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - -/** - * @brief Enables the WDG subsystem. - */ -#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) -#define HAL_USE_WDG FALSE -#endif - -/** - * @brief Enables the WSPI subsystem. - */ -#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) -#define HAL_USE_WSPI FALSE -#endif - -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS FALSE -#endif - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) -#define PAL_USE_WAIT FALSE -#endif - -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* CAN driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif - -/** - * @brief Enforces the driver to use direct callbacks rather than OSAL events. - */ -#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) -#define CAN_ENFORCE_USE_CALLBACKS FALSE -#endif - -/*===========================================================================*/ -/* CRY driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the SW fall-back of the cryptographic driver. - * @details When enabled, this option, activates a fall-back software - * implementation for algorithms not supported by the underlying - * hardware. - * @note Fall-back implementations may not be present for all algorithms. - */ -#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_USE_FALLBACK FALSE -#endif - -/** - * @brief Makes the driver forcibly use the fall-back implementations. - */ -#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_ENFORCE_FALLBACK FALSE -#endif - -/*===========================================================================*/ -/* DAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) -#define DAC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define DAC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the zero-copy API. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - -/*===========================================================================*/ -/* SDC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Number of initialization attempts before rejecting the card. - * @note Attempts are performed at 10mS intervals. - */ -#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) -#define SDC_INIT_RETRY 100 -#endif - -/** - * @brief Include support for MMC cards. - * @note MMC support is not yet implemented so this option must be kept - * at @p FALSE. - */ -#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) -#define SDC_MMC_SUPPORT FALSE -#endif - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - */ -#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) -#define SDC_NICE_WAITING TRUE -#endif - -/** - * @brief OCR initialization constant for V20 cards. - */ -#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) -#define SDC_INIT_OCR_V20 0x50FF8000U -#endif - -/** - * @brief OCR initialization constant for non-V20 cards. - */ -#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) -#define SDC_INIT_OCR 0x80100000U -#endif - -/*===========================================================================*/ -/* SERIAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Default bit rate. - * @details Configuration parameter, this is the baud rate selected for the - * default configuration. - */ -#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SERIAL_DEFAULT_BITRATE 921600 -#endif - -/** - * @brief Serial buffers size. - * @details Configuration parameter, you can change the depth of the queue - * buffers depending on the requirements of your application. - * @note The default is 16 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 -#endif - -/*===========================================================================*/ -/* SIO driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Default bit rate. - * @details Configuration parameter, this is the baud rate selected for the - * default configuration. - */ -#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SIO_DEFAULT_BITRATE 38400 -#endif - -/** - * @brief Support for thread synchronization API. - */ -#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__) -#define SIO_USE_SYNCHRONIZATION TRUE -#endif - -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 64 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 1 -#endif - -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE -#endif - -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE -#endif - -/** - * @brief Handling method for SPI CS line. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD -#endif - -/*===========================================================================*/ -/* UART driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) -#define UART_USE_WAIT FALSE -#endif - -/** - * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define UART_USE_MUTUAL_EXCLUSION FALSE -#endif - -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT FALSE -#endif - -/*===========================================================================*/ -/* WSPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) -#define WSPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define WSPI_USE_MUTUAL_EXCLUSION TRUE -#endif - -// header for nanoFramework overlay -#include "halconf_nf.h" - -#endif /* HALCONF_H */ - -/** @} */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf_nf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf_nf.h deleted file mode 100644 index 1b4a9bd8ed..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/halconf_nf.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef HALCONF_NF_H -#define HALCONF_NF_H - -// enables STM32 Flash driver -#if !defined(HAL_NF_USE_STM32_FLASH) -#define HAL_NF_USE_STM32_FLASH TRUE -#endif - -#endif // HALCONF_NF_H - diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/main.c b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/main.c deleted file mode 100644 index b6182fcd16..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/main.c +++ /dev/null @@ -1,94 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -// need to declare the Receiver thread here -osThreadDef(ReceiverThread, osPriorityHigh, 2048, "ReceiverThread"); - -// Application entry point. -int main(void) -{ - // HAL initialization, this also initializes the configured device drivers - // and performs the board-specific initializations. - halInit(); - - // init boot clipboard - InitBootClipboard(); - - // check if there is a request to remain on nanoBooter - if (!IsToRemainInBooter()) - { - // check for valid CLR image at address contiguous to nanoBooter - // this target DOES NOT have configuration block, so we need to use the __nanoImage_end__ address here - if (CheckValidCLRImage((uint32_t)&__nanoImage_end__)) - { - // there seems to be a valid CLR image - // launch nanoCLR - LaunchCLR((uint32_t)&__nanoImage_end__); - } - } - - // The kernel is initialized but not started yet, this means that - // main() is executing with absolute priority but interrupts are already enabled. - osKernelInitialize(); - -#if (HAL_NF_USE_STM32_CRC == TRUE) - // startup crc - crcStart(NULL); -#endif - - // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); - - // Activates the USB driver and then the USB bus pull-up on D+. - // Note, a delay is inserted in order to not have to disconnect the cable after a reset. - usbDisconnectBus(serusbcfg.usbp); - chThdSleepMilliseconds(100); - usbStart(serusbcfg.usbp, &usbcfg); - usbConnectBus(serusbcfg.usbp); - - // create the receiver thread - osThreadCreate(osThread(ReceiverThread), NULL); - - // start kernel, after this main() will behave like a thread with priority osPriorityNormal - osKernelStart(); - - // initialize block storage list and devices - // in CLR this is called in nanoHAL_Initialize() - // for nanoBooter we have to init it in order to provide the flash map for Monitor_FlashSectorMap command - BlockStorageList_Initialize(); - BlockStorage_AddDevices(); - - // report successfull nanoBooter execution - ReportSuccessfullNanoBooter(); - - // Normal main() thread - while (true) - { - palClearPad(GPIOE, GPIOE_LED_GOPORT3); - palSetPad(GPIOA, GPIOA_USR_LED); - osDelay(250); - palClearPad(GPIOA, GPIOA_USR_LED); - palSetPad(GPIOE, GPIOE_LED_GOPORT1); - osDelay(250); - palClearPad(GPIOE, GPIOE_LED_GOPORT1); - palSetPad(GPIOE, GPIOE_LED_GOPORT2); - osDelay(250); - palClearPad(GPIOE, GPIOE_LED_GOPORT2); - palSetPad(GPIOE, GPIOE_LED_GOPORT3); - osDelay(250); - } -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf.h deleted file mode 100644 index fb2da4df8b..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf.h +++ /dev/null @@ -1,360 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#ifndef MCUCONF_H -#define MCUCONF_H - -/* - * STM32F4xx drivers configuration. - * The following settings override the default settings present in - * the various device driver implementation headers. - * Note that the settings for each driver only have effect if the whole - * driver is enabled in halconf.h. - * - * IRQ priorities: - * 15...0 Lowest...Highest. - * - * DMA priorities: - * 0...3 Lowest...Highest. - */ - -#define STM32F4xx_MCUCONF -#define STM32F427_MCUCONF - -/* - * HAL driver system settings. - */ -#define STM32_NO_INIT FALSE -#define STM32_HSI_ENABLED TRUE -#define STM32_LSI_ENABLED TRUE -#define STM32_HSE_ENABLED TRUE -#define STM32_LSE_ENABLED FALSE -#define STM32_CLOCK48_REQUIRED TRUE -#define STM32_SW STM32_SW_PLL -#define STM32_PLLSRC STM32_PLLSRC_HSE -#define STM32_PLLM_VALUE 25 -#define STM32_PLLN_VALUE 336 -#define STM32_PLLP_VALUE 2 -#define STM32_PLLQ_VALUE 7 -#define STM32_HPRE STM32_HPRE_DIV1 -#define STM32_PPRE1 STM32_PPRE1_DIV4 -#define STM32_PPRE2 STM32_PPRE2_DIV2 -#define STM32_RTCSEL STM32_RTCSEL_LSI -#define STM32_RTCPRE_VALUE 8 -#define STM32_MCO1SEL STM32_MCO1SEL_HSI -#define STM32_MCO1PRE STM32_MCO1PRE_DIV1 -#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK -#define STM32_MCO2PRE STM32_MCO2PRE_DIV1 -#define STM32_I2SSRC STM32_I2SSRC_PLLI2S -#define STM32_PLLI2SN_VALUE 192 -#define STM32_PLLI2SR_VALUE 2 -#define STM32_PVD_ENABLE FALSE -#define STM32_PLS STM32_PLS_LEV0 -#define STM32_BKPRAM_ENABLE FALSE - -/* - * IRQ system settings. - */ -#define STM32_IRQ_EXTI0_PRIORITY 6 -#define STM32_IRQ_EXTI1_PRIORITY 6 -#define STM32_IRQ_EXTI2_PRIORITY 6 -#define STM32_IRQ_EXTI3_PRIORITY 6 -#define STM32_IRQ_EXTI4_PRIORITY 6 -#define STM32_IRQ_EXTI5_9_PRIORITY 6 -#define STM32_IRQ_EXTI10_15_PRIORITY 6 -#define STM32_IRQ_EXTI16_PRIORITY 6 -#define STM32_IRQ_EXTI17_PRIORITY 15 -#define STM32_IRQ_EXTI18_PRIORITY 6 -#define STM32_IRQ_EXTI19_PRIORITY 6 -#define STM32_IRQ_EXTI20_PRIORITY 6 -#define STM32_IRQ_EXTI21_PRIORITY 15 -#define STM32_IRQ_EXTI22_PRIORITY 15 - -#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7 -#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7 -#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7 -#define STM32_IRQ_TIM1_CC_PRIORITY 7 -#define STM32_IRQ_TIM2_PRIORITY 7 -#define STM32_IRQ_TIM3_PRIORITY 7 -#define STM32_IRQ_TIM4_PRIORITY 7 -#define STM32_IRQ_TIM5_PRIORITY 7 -#define STM32_IRQ_TIM6_PRIORITY 7 -#define STM32_IRQ_TIM7_PRIORITY 7 -#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7 -#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7 -#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7 -#define STM32_IRQ_TIM8_CC_PRIORITY 7 - -#define STM32_IRQ_USART1_PRIORITY 12 -#define STM32_IRQ_USART2_PRIORITY 12 -#define STM32_IRQ_USART3_PRIORITY 12 -#define STM32_IRQ_UART4_PRIORITY 12 -#define STM32_IRQ_UART5_PRIORITY 12 -#define STM32_IRQ_USART6_PRIORITY 12 -#define STM32_IRQ_UART7_PRIORITY 12 -#define STM32_IRQ_UART8_PRIORITY 12 - -/* - * ADC driver system settings. - */ -#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4 -#define STM32_ADC_USE_ADC1 FALSE -#define STM32_ADC_USE_ADC2 FALSE -#define STM32_ADC_USE_ADC3 FALSE -#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) -#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_ADC_ADC1_DMA_PRIORITY 2 -#define STM32_ADC_ADC2_DMA_PRIORITY 2 -#define STM32_ADC_ADC3_DMA_PRIORITY 2 -#define STM32_ADC_IRQ_PRIORITY 6 -#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 -#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6 -#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6 - -/* - * CAN driver system settings. - */ -#define STM32_CAN_USE_CAN1 FALSE -#define STM32_CAN_USE_CAN2 FALSE -#define STM32_CAN_CAN1_IRQ_PRIORITY 11 -#define STM32_CAN_CAN2_IRQ_PRIORITY 11 - -/* - * DAC driver system settings. - */ -#define STM32_DAC_DUAL_MODE FALSE -#define STM32_DAC_USE_DAC1_CH1 FALSE -#define STM32_DAC_USE_DAC1_CH2 FALSE -#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 -#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 -#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 -#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 -#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) - -/* - * GPT driver system settings. - */ -#define STM32_GPT_USE_TIM1 FALSE -#define STM32_GPT_USE_TIM2 FALSE -#define STM32_GPT_USE_TIM3 FALSE -#define STM32_GPT_USE_TIM4 FALSE -#define STM32_GPT_USE_TIM5 FALSE -#define STM32_GPT_USE_TIM6 FALSE -#define STM32_GPT_USE_TIM7 FALSE -#define STM32_GPT_USE_TIM8 FALSE -#define STM32_GPT_USE_TIM9 FALSE -#define STM32_GPT_USE_TIM11 FALSE -#define STM32_GPT_USE_TIM12 FALSE -#define STM32_GPT_USE_TIM14 FALSE -#define STM32_GPT_TIM1_IRQ_PRIORITY 7 -#define STM32_GPT_TIM2_IRQ_PRIORITY 7 -#define STM32_GPT_TIM3_IRQ_PRIORITY 7 -#define STM32_GPT_TIM4_IRQ_PRIORITY 7 -#define STM32_GPT_TIM5_IRQ_PRIORITY 7 -#define STM32_GPT_TIM6_IRQ_PRIORITY 7 -#define STM32_GPT_TIM7_IRQ_PRIORITY 7 -#define STM32_GPT_TIM8_IRQ_PRIORITY 7 -#define STM32_GPT_TIM9_IRQ_PRIORITY 7 -#define STM32_GPT_TIM11_IRQ_PRIORITY 7 -#define STM32_GPT_TIM12_IRQ_PRIORITY 7 -#define STM32_GPT_TIM14_IRQ_PRIORITY 7 - -/* - * I2C driver system settings. - */ -#define STM32_I2C_USE_I2C1 FALSE -#define STM32_I2C_USE_I2C2 FALSE -#define STM32_I2C_USE_I2C3 FALSE -#define STM32_I2C_BUSY_TIMEOUT 50 -#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_I2C_I2C1_IRQ_PRIORITY 5 -#define STM32_I2C_I2C2_IRQ_PRIORITY 5 -#define STM32_I2C_I2C3_IRQ_PRIORITY 5 -#define STM32_I2C_I2C1_DMA_PRIORITY 3 -#define STM32_I2C_I2C2_DMA_PRIORITY 3 -#define STM32_I2C_I2C3_DMA_PRIORITY 3 -#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") - -/* - * I2S driver system settings. - */ -#define STM32_I2S_USE_SPI2 FALSE -#define STM32_I2S_USE_SPI3 FALSE -#define STM32_I2S_SPI2_IRQ_PRIORITY 10 -#define STM32_I2S_SPI3_IRQ_PRIORITY 10 -#define STM32_I2S_SPI2_DMA_PRIORITY 1 -#define STM32_I2S_SPI3_DMA_PRIORITY 1 -#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure") - -/* - * ICU driver system settings. - */ -#define STM32_ICU_USE_TIM1 FALSE -#define STM32_ICU_USE_TIM2 FALSE -#define STM32_ICU_USE_TIM3 FALSE -#define STM32_ICU_USE_TIM4 FALSE -#define STM32_ICU_USE_TIM5 FALSE -#define STM32_ICU_USE_TIM8 FALSE -#define STM32_ICU_USE_TIM9 FALSE -#define STM32_ICU_TIM1_IRQ_PRIORITY 7 -#define STM32_ICU_TIM2_IRQ_PRIORITY 7 -#define STM32_ICU_TIM3_IRQ_PRIORITY 7 -#define STM32_ICU_TIM4_IRQ_PRIORITY 7 -#define STM32_ICU_TIM5_IRQ_PRIORITY 7 -#define STM32_ICU_TIM8_IRQ_PRIORITY 7 -#define STM32_ICU_TIM9_IRQ_PRIORITY 7 - -/* - * MAC driver system settings. - */ -#define STM32_MAC_TRANSMIT_BUFFERS 2 -#define STM32_MAC_RECEIVE_BUFFERS 4 -#define STM32_MAC_BUFFERS_SIZE 1522 -#define STM32_MAC_PHY_TIMEOUT 100 -#define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE -#define STM32_MAC_ETH1_IRQ_PRIORITY 13 -#define STM32_MAC_IP_CHECKSUM_OFFLOAD 0 - -/* - * PWM driver system settings. - */ -#define STM32_PWM_USE_ADVANCED FALSE -#define STM32_PWM_USE_TIM1 FALSE -#define STM32_PWM_USE_TIM2 FALSE -#define STM32_PWM_USE_TIM3 FALSE -#define STM32_PWM_USE_TIM4 FALSE -#define STM32_PWM_USE_TIM5 FALSE -#define STM32_PWM_USE_TIM8 FALSE -#define STM32_PWM_USE_TIM9 FALSE -#define STM32_PWM_TIM1_IRQ_PRIORITY 7 -#define STM32_PWM_TIM2_IRQ_PRIORITY 7 -#define STM32_PWM_TIM3_IRQ_PRIORITY 7 -#define STM32_PWM_TIM4_IRQ_PRIORITY 7 -#define STM32_PWM_TIM5_IRQ_PRIORITY 7 -#define STM32_PWM_TIM8_IRQ_PRIORITY 7 -#define STM32_PWM_TIM9_IRQ_PRIORITY 7 - -/* - * SDC driver system settings. - */ -#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_CLOCK_ACTIVATION_DELAY 10 -#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE -#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) - -/* - * SERIAL driver system settings. - */ -#define STM32_SERIAL_USE_USART1 FALSE -#define STM32_SERIAL_USE_USART2 TRUE -#define STM32_SERIAL_USE_USART3 FALSE -#define STM32_SERIAL_USE_UART4 FALSE -#define STM32_SERIAL_USE_UART5 FALSE -#define STM32_SERIAL_USE_USART6 FALSE -#define STM32_SERIAL_USART1_PRIORITY 12 -#define STM32_SERIAL_USART2_PRIORITY 12 -#define STM32_SERIAL_USART3_PRIORITY 12 -#define STM32_SERIAL_UART4_PRIORITY 12 -#define STM32_SERIAL_UART5_PRIORITY 12 -#define STM32_SERIAL_USART6_PRIORITY 12 - -/* - * SPI driver system settings. - */ -#define STM32_SPI_USE_SPI1 FALSE -#define STM32_SPI_USE_SPI2 FALSE -#define STM32_SPI_USE_SPI3 FALSE -#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) -#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) -#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_SPI_SPI1_DMA_PRIORITY 1 -#define STM32_SPI_SPI2_DMA_PRIORITY 1 -#define STM32_SPI_SPI3_DMA_PRIORITY 1 -#define STM32_SPI_SPI1_IRQ_PRIORITY 10 -#define STM32_SPI_SPI2_IRQ_PRIORITY 10 -#define STM32_SPI_SPI3_IRQ_PRIORITY 10 -#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") - -/* - * ST driver system settings. - */ -#define STM32_ST_IRQ_PRIORITY 8 -#define STM32_ST_USE_TIMER 2 - -/* - * UART driver system settings. - */ -#define STM32_UART_USE_USART1 FALSE -#define STM32_UART_USE_USART2 FALSE -#define STM32_UART_USE_USART3 FALSE -#define STM32_UART_USE_UART4 FALSE -#define STM32_UART_USE_UART5 FALSE -#define STM32_UART_USE_USART6 FALSE -#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) -#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) -#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) -#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) -#define STM32_UART_USART1_IRQ_PRIORITY 12 -#define STM32_UART_USART2_IRQ_PRIORITY 12 -#define STM32_UART_USART3_IRQ_PRIORITY 12 -#define STM32_UART_UART4_IRQ_PRIORITY 12 -#define STM32_UART_UART5_IRQ_PRIORITY 12 -#define STM32_UART_USART6_IRQ_PRIORITY 12 -#define STM32_UART_USART1_DMA_PRIORITY 0 -#define STM32_UART_USART2_DMA_PRIORITY 0 -#define STM32_UART_USART3_DMA_PRIORITY 0 -#define STM32_UART_UART4_DMA_PRIORITY 0 -#define STM32_UART_UART5_DMA_PRIORITY 0 -#define STM32_UART_USART6_DMA_PRIORITY 0 -#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") - -/* - * USB driver system settings. - */ -#define STM32_USB_USE_OTG1 TRUE -#define STM32_USB_USE_OTG2 FALSE -#define STM32_USB_OTG1_IRQ_PRIORITY 14 -#define STM32_USB_OTG2_IRQ_PRIORITY 14 -#define STM32_USB_OTG1_RX_FIFO_SIZE 512 -#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 -#define STM32_USB_OTG_THREAD_PRIO LOWPRIO -#define STM32_USB_OTG_THREAD_STACK_SIZE 128 -#define STM32_USB_OTGFIFO_FILL_BASEPRI 0 - -/* - * WDG driver system settings. - */ -#define STM32_WDG_USE_IWDG FALSE - -// header for nanoFramework overlay drivers -#include "mcuconf_nf.h" - -#endif /* MCUCONF_H */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf_nf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf_nf.h deleted file mode 100644 index b9f9ee0c70..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/mcuconf_nf.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef MCUCONF_NF_H -#define MCUCONF_NF_H - -#endif // MCUCONF_NF_H - diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter-DEBUG.ld b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter-DEBUG.ld deleted file mode 100644 index a204320aa0..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter-DEBUG.ld +++ /dev/null @@ -1,97 +0,0 @@ -/* -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// -*/ - -/* - * STM32F427Vx memory setup. - * Note: Use of ram1, ram2 and ram3 is mutually exclusive with use of ram0. - */ -MEMORY -{ - flash0 (rx) : org = 0x08000000, len = 32k /* space reserved for nanoBooter (1st two sectors 0x08000000 to 0x08007FFF)*/ - flash1 (rx) : org = 0x00000000, len = 0 - flash2 (rx) : org = 0x00000000, len = 0 - flash3 (rx) : org = 0x00000000, len = 0 - flash4 (rx) : org = 0x00000000, len = 0 - flash5 (rx) : org = 0x00000000, len = 0 - flash6 (rx) : org = 0x00000000, len = 0 - flash7 (rx) : org = 0x00000000, len = 0 - config (rw) : org = 0x00000000, len = 0 /* space reserved for configuration block */ - deployment (rx) : org = 0x00000000, len = 0 /* space reserved for application deployment */ - ramvt (wx) : org = 0x00000000, len = 0 /* initial RAM address is reserved for a copy of the vector table */ - ram0 (wx) : org = 0x20000030, len = 192k-48 /* SRAM1 + SRAM2 + SRAM3 */ - ram1 (wx) : org = 0x20000000, len = 112k /* SRAM1 */ - ram2 (wx) : org = 0x2001C000, len = 16k /* SRAM2 */ - ram3 (wx) : org = 0x20020000, len = 64k /* SRAM3 */ - ram4 (wx) : org = 0x10000000, len = 64k /* CCM SRAM */ - ram5 (wx) : org = 0x40024000, len = 4k /* BCKP SRAM */ - ram6 (wx) : org = 0x00000000, len = 0 - ram7 (wx) : org = 0x00000000, len = 0 - bootclpbrd (wx) : org = 0x20000000, len = 48 /* boot clipboard area */ -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram4); - -/* RAM region to be used for the boot clipboard.*/ -REGION_ALIAS("SECTION_FOR_BOOTCLIPBOARD", bootclpbrd); - -/* Stacks rules inclusion.*/ -INCLUDE rules_stacks.ld - -/* Code rules inclusion.*/ -INCLUDE rules_code.ld - -/* Data rules inclusion.*/ -INCLUDE rules_data.ld - -/* Data rules inclusion.*/ -INCLUDE rules_memory.ld - -/* boot clipboard rules inclusion.*/ -INCLUDE rules_bootclipboard.ld diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter.ld b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter.ld deleted file mode 100644 index 7c579df535..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/netduino3wifi_booter.ld +++ /dev/null @@ -1,97 +0,0 @@ -/* -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// -*/ - -/* - * STM32F427Vx memory setup. - * Note: Use of ram1, ram2 and ram3 is mutually exclusive with use of ram0. - */ -MEMORY -{ - flash0 (rx) : org = 0x08000000, len = 16k /* space reserved for nanoBooter (1st sector 0x08000000 to 0x08003FFF)*/ - flash1 (rx) : org = 0x00000000, len = 0 - flash2 (rx) : org = 0x00000000, len = 0 - flash3 (rx) : org = 0x00000000, len = 0 - flash4 (rx) : org = 0x00000000, len = 0 - flash5 (rx) : org = 0x00000000, len = 0 - flash6 (rx) : org = 0x00000000, len = 0 - flash7 (rx) : org = 0x00000000, len = 0 - config (rw) : org = 0x00000000, len = 0 /* space reserved for configuration block */ - deployment (rx) : org = 0x00000000, len = 0 /* space reserved for application deployment */ - ramvt (wx) : org = 0x00000000, len = 0 /* initial RAM address is reserved for a copy of the vector table */ - ram0 (wx) : org = 0x20000030, len = 192k-48 /* SRAM1 + SRAM2 + SRAM3 */ - ram1 (wx) : org = 0x20000000, len = 112k /* SRAM1 */ - ram2 (wx) : org = 0x2001C000, len = 16k /* SRAM2 */ - ram3 (wx) : org = 0x20020000, len = 64k /* SRAM3 */ - ram4 (wx) : org = 0x10000000, len = 64k /* CCM SRAM */ - ram5 (wx) : org = 0x40024000, len = 4k /* BCKP SRAM */ - ram6 (wx) : org = 0x00000000, len = 0 - ram7 (wx) : org = 0x00000000, len = 0 - bootclpbrd (wx) : org = 0x20000000, len = 48 /* boot clipboard area */ -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram4); - -/* RAM region to be used for the boot clipboard.*/ -REGION_ALIAS("SECTION_FOR_BOOTCLIPBOARD", bootclpbrd); - -/* Stacks rules inclusion.*/ -INCLUDE rules_stacks.ld - -/* Code rules inclusion.*/ -INCLUDE rules_code.ld - -/* Data rules inclusion.*/ -INCLUDE rules_data.ld - -/* Data rules inclusion.*/ -INCLUDE rules_memory.ld - -/* boot clipboard rules inclusion.*/ -INCLUDE rules_bootclipboard.ld diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/target_board.h.in b/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/target_board.h.in deleted file mode 100644 index ac85c850b9..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoBooter/target_board.h.in +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -////////////////////////////////////////////////////////////////////////////// -// This file was automatically generated by a tool. // -// Any changes you make here will be overwritten when it's generated again. // -////////////////////////////////////////////////////////////////////////////// - -#ifndef TARGET_BOARD_NANOBOOTER_H -#define TARGET_BOARD_NANOBOOTER_H - -#include - -#define OEMSYSTEMINFOSTRING "nanoBooter running @ @TARGET_NAME@" - -#endif // TARGET_BOARD_NANOBOOTER_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/CMakeLists.txt b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/CMakeLists.txt deleted file mode 100644 index f5fab75926..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# -# Copyright (c) .NET Foundation and Contributors -# See LICENSE file in the project root for full license information. -# - -# append nanoCLR source files -list(APPEND NANOCLR_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.c") -list(APPEND NANOCLR_PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/nanoHAL.cpp") - -# make var global -set(NANOCLR_PROJECT_SOURCES ${NANOCLR_PROJECT_SOURCES} CACHE INTERNAL "make global") diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/chconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/chconf.h deleted file mode 100644 index 0f0f0988cf..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/chconf.h +++ /dev/null @@ -1,819 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -/** - * @file rt/templates/chconf.h - * @brief Configuration file template. - * @details A copy of this file must be placed in each project directory, it - * contains the application specific kernel settings. - * - * @addtogroup config - * @details Kernel related settings and hooks. - * @{ - */ - -#ifndef CHCONF_H -#define CHCONF_H - -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_7_0_ - -/*===========================================================================*/ -/** - * @name System settings - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Handling of instances. - * @note If enabled then threads assigned to various instances can - * interact each other using the same synchronization objects. - * If disabled then each OS instance is a separate world, no - * direct interactions are handled by the OS. - */ -#if !defined(CH_CFG_SMP_MODE) -#define CH_CFG_SMP_MODE FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name System timers settings - * @{ - */ -/*===========================================================================*/ - -/** - * @brief System time counter resolution. - * @note Allowed values are 16, 32 or 64 bits. - */ -#if !defined(CH_CFG_ST_RESOLUTION) -#define CH_CFG_ST_RESOLUTION 32 -#endif - -/** - * @brief System tick frequency. - * @details Frequency of the system timer that drives the system ticks. This - * setting also defines the system tick time unit. - */ -#if !defined(CH_CFG_ST_FREQUENCY) -#define CH_CFG_ST_FREQUENCY 10000 -#endif - -/** - * @brief Time intervals data size. - * @note Allowed values are 16, 32 or 64 bits. - */ -#if !defined(CH_CFG_INTERVALS_SIZE) -#define CH_CFG_INTERVALS_SIZE 32 -#endif - -/** - * @brief Time types data size. - * @note Allowed values are 16 or 32 bits. - */ -#if !defined(CH_CFG_TIME_TYPES_SIZE) -#define CH_CFG_TIME_TYPES_SIZE 32 -#endif - -/** - * @brief Time delta constant for the tick-less mode. - * @note If this value is zero then the system uses the classic - * periodic tick. This value represents the minimum number - * of ticks that is safe to specify in a timeout directive. - * The value one is not valid, timeouts are rounded up to - * this value. - */ -#if !defined(CH_CFG_ST_TIMEDELTA) -#define CH_CFG_ST_TIMEDELTA 2 -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Kernel parameters and options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Round robin interval. - * @details This constant is the number of system ticks allowed for the - * threads before preemption occurs. Setting this value to zero - * disables the preemption for threads with equal priority and the - * round robin becomes cooperative. Note that higher priority - * threads can still preempt, the kernel is always preemptive. - * @note Disabling the round robin preemption makes the kernel more compact - * and generally faster. - * @note The round robin preemption is not supported in tickless mode and - * must be set to zero in that case. - */ -#if !defined(CH_CFG_TIME_QUANTUM) -#define CH_CFG_TIME_QUANTUM 0 -#endif - -/** - * @brief Idle thread automatic spawn suppression. - * @details When this option is activated the function @p chSysInit() - * does not spawn the idle thread. The application @p main() - * function becomes the idle thread and must implement an - * infinite loop. - */ -#if !defined(CH_CFG_NO_IDLE_THREAD) -#define CH_CFG_NO_IDLE_THREAD FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Performance options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief OS optimization. - * @details If enabled then time efficient rather than space efficient code - * is used when two possible implementations exist. - * - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_OPTIMIZE_SPEED) -#define CH_CFG_OPTIMIZE_SPEED TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Subsystem options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Time Measurement APIs. - * @details If enabled then the time measurement APIs are included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_TM) -#define CH_CFG_USE_TM FALSE -#endif - -/** - * @brief Time Stamps APIs. - * @details If enabled then the time time stamps APIs are included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_TIMESTAMP) -#define CH_CFG_USE_TIMESTAMP FALSE -#endif - -/** - * @brief Threads registry APIs. - * @details If enabled then the registry APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_REGISTRY) -#define CH_CFG_USE_REGISTRY TRUE -#endif - -/** - * @brief Threads synchronization APIs. - * @details If enabled then the @p chThdWait() function is included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_WAITEXIT) -#define CH_CFG_USE_WAITEXIT TRUE -#endif - -/** - * @brief Semaphores APIs. - * @details If enabled then the Semaphores APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_SEMAPHORES) -#define CH_CFG_USE_SEMAPHORES TRUE -#endif - -/** - * @brief Semaphores queuing mode. - * @details If enabled then the threads are enqueued on semaphores by - * priority rather than in FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) -#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE -#endif - -/** - * @brief Mutexes APIs. - * @details If enabled then the mutexes APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MUTEXES) -#define CH_CFG_USE_MUTEXES TRUE -#endif - -/** - * @brief Enables recursive behavior on mutexes. - * @note Recursive mutexes are heavier and have an increased - * memory footprint. - * - * @note The default is @p FALSE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) -#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE -#endif - -/** - * @brief Conditional Variables APIs. - * @details If enabled then the conditional variables APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_CONDVARS) -#define CH_CFG_USE_CONDVARS TRUE -#endif - -/** - * @brief Conditional Variables APIs with timeout. - * @details If enabled then the conditional variables APIs with timeout - * specification are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_CONDVARS. - */ -#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) -#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE -#endif - -/** - * @brief Events Flags APIs. - * @details If enabled then the event flags APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_EVENTS) -#define CH_CFG_USE_EVENTS TRUE -#endif - -/** - * @brief Events Flags APIs with timeout. - * @details If enabled then the events APIs with timeout specification - * are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_EVENTS. - */ -#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) -#define CH_CFG_USE_EVENTS_TIMEOUT TRUE -#endif - -/** - * @brief Synchronous Messages APIs. - * @details If enabled then the synchronous messages APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MESSAGES) -#define CH_CFG_USE_MESSAGES TRUE -#endif - -/** - * @brief Synchronous Messages queuing mode. - * @details If enabled then messages are served by priority rather than in - * FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_MESSAGES. - */ -#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) -#define CH_CFG_USE_MESSAGES_PRIORITY FALSE -#endif - -/** - * @brief Dynamic Threads APIs. - * @details If enabled then the dynamic threads creation APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_WAITEXIT. - * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. - */ -#if !defined(CH_CFG_USE_DYNAMIC) -#define CH_CFG_USE_DYNAMIC TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name OSLIB options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Mailboxes APIs. - * @details If enabled then the asynchronous messages (mailboxes) APIs are - * included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_MAILBOXES) -#define CH_CFG_USE_MAILBOXES TRUE -#endif - -/** - * @brief Core Memory Manager APIs. - * @details If enabled then the core memory manager APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMCORE) -#define CH_CFG_USE_MEMCORE TRUE -#endif - -/** - * @brief Managed RAM size. - * @details Size of the RAM area to be managed by the OS. If set to zero - * then the whole available RAM is used. The core memory is made - * available to the heap allocator and/or can be used directly through - * the simplified core memory allocator. - * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_CFG_USE_MEMCORE. - */ -#if !defined(CH_CFG_MEMCORE_SIZE) -#define CH_CFG_MEMCORE_SIZE 0 -#endif - -/** - * @brief Heap Allocator APIs. - * @details If enabled then the memory heap allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or - * @p CH_CFG_USE_SEMAPHORES. - * @note Mutexes are recommended. - */ -#if !defined(CH_CFG_USE_HEAP) -#define CH_CFG_USE_HEAP TRUE -#endif - -/** - * @brief Memory Pools Allocator APIs. - * @details If enabled then the memory pools allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMPOOLS) -#define CH_CFG_USE_MEMPOOLS TRUE -#endif - -/** - * @brief Objects FIFOs APIs. - * @details If enabled then the objects FIFOs APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_OBJ_FIFOS) -#define CH_CFG_USE_OBJ_FIFOS TRUE -#endif - -/** - * @brief Pipes APIs. - * @details If enabled then the pipes APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_PIPES) -#define CH_CFG_USE_PIPES TRUE -#endif - -/** - * @brief Objects Caches APIs. - * @details If enabled then the objects caches APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_OBJ_CACHES) -#define CH_CFG_USE_OBJ_CACHES FALSE -#endif - -/** - * @brief Delegate threads APIs. - * @details If enabled then the delegate threads APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_DELEGATES) -#define CH_CFG_USE_DELEGATES FALSE -#endif - -/** - * @brief Jobs Queues APIs. - * @details If enabled then the jobs queues APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_JOBS) -#define CH_CFG_USE_JOBS FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Objects factory options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Objects Factory APIs. - * @details If enabled then the objects factory APIs are included in the - * kernel. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_CFG_USE_FACTORY) -#define CH_CFG_USE_FACTORY FALSE -#endif - -/** - * @brief Maximum length for object names. - * @details If the specified length is zero then the name is stored by - * pointer but this could have unintended side effects. - */ -#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) -#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 -#endif - -/** - * @brief Enables the registry of generic objects. - */ -#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) -#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE -#endif - -/** - * @brief Enables factory for generic buffers. - */ -#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) -#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE -#endif - -/** - * @brief Enables factory for semaphores. - */ -#if !defined(CH_CFG_FACTORY_SEMAPHORES) -#define CH_CFG_FACTORY_SEMAPHORES TRUE -#endif - -/** - * @brief Enables factory for mailboxes. - */ -#if !defined(CH_CFG_FACTORY_MAILBOXES) -#define CH_CFG_FACTORY_MAILBOXES TRUE -#endif - -/** - * @brief Enables factory for objects FIFOs. - */ -#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) -#define CH_CFG_FACTORY_OBJ_FIFOS TRUE -#endif - -/** - * @brief Enables factory for Pipes. - */ -#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) -#define CH_CFG_FACTORY_PIPES TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Debug options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Debug option, kernel statistics. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_STATISTICS) -#define CH_DBG_STATISTICS FALSE -#endif - -/** - * @brief Debug option, system state check. - * @details If enabled the correct call protocol for system APIs is checked - * at runtime. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_SYSTEM_STATE_CHECK) -#define CH_DBG_SYSTEM_STATE_CHECK FALSE -#endif - -/** - * @brief Debug option, parameters checks. - * @details If enabled then the checks on the API functions input - * parameters are activated. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_CHECKS) -#define CH_DBG_ENABLE_CHECKS FALSE -#endif - -/** - * @brief Debug option, consistency checks. - * @details If enabled then all the assertions in the kernel code are - * activated. This includes consistency checks inside the kernel, - * runtime anomalies and port-defined checks. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_ASSERTS) -#define CH_DBG_ENABLE_ASSERTS FALSE -#endif - -/** - * @brief Debug option, trace buffer. - * @details If enabled then the trace buffer is activated. - * - * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_MASK) -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED -#endif - -/** - * @brief Trace buffer entries. - * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is - * different from @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_BUFFER_SIZE) -#define CH_DBG_TRACE_BUFFER_SIZE 128 -#endif - -/** - * @brief Debug option, stack checks. - * @details If enabled then a runtime stack check is performed. - * - * @note The default is @p FALSE. - * @note The stack check is performed in a architecture/port dependent way. - * It may not be implemented or some ports. - * @note The default failure mode is to halt the system with the global - * @p panic_msg variable set to @p NULL. - */ -#if !defined(CH_DBG_ENABLE_STACK_CHECK) -#define CH_DBG_ENABLE_STACK_CHECK FALSE -#endif - -/** - * @brief Debug option, stacks initialization. - * @details If enabled then the threads working area is filled with a byte - * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_FILL_THREADS) -#define CH_DBG_FILL_THREADS FALSE -#endif - -/** - * @brief Debug option, threads profiling. - * @details If enabled then a field is added to the @p thread_t structure that - * counts the system ticks occurred while executing the thread. - * - * @note The default is @p FALSE. - * @note This debug option is not currently compatible with the - * tickless mode. - */ -#if !defined(CH_DBG_THREADS_PROFILING) -#define CH_DBG_THREADS_PROFILING FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Kernel hooks - * @{ - */ -/*===========================================================================*/ - -/** - * @brief System structure extension. - * @details User fields added to the end of the @p ch_system_t structure. - */ -#define CH_CFG_SYSTEM_EXTRA_FIELDS /* Add system custom fields here.*/ - -/** - * @brief System initialization hook. - * @details User initialization code added to the @p chSysInit() function - * just before interrupts are enabled globally. - */ -#define CH_CFG_SYSTEM_INIT_HOOK() \ - { \ - /* Add system initialization code here.*/ \ - } - -/** - * @brief OS instance structure extension. - * @details User fields added to the end of the @p os_instance_t structure. - */ -#define CH_CFG_OS_INSTANCE_EXTRA_FIELDS /* Add OS instance custom fields here.*/ - -/** - * @brief OS instance initialization hook. - * - * @param[in] oip pointer to the @p os_instance_t structure - */ -#define CH_CFG_OS_INSTANCE_INIT_HOOK(oip) \ - { \ - /* Add OS instance initialization code here.*/ \ - } - -/** - * @brief Threads descriptor structure extension. - * @details User fields added to the end of the @p thread_t structure. - */ -#define CH_CFG_THREAD_EXTRA_FIELDS /* Add threads custom fields here.*/ - -/** - * @brief Threads initialization hook. - * @details User initialization code added to the @p _thread_init() function. - * - * @note It is invoked from within @p _thread_init() and implicitly from all - * the threads creation APIs. - * - * @param[in] tp pointer to the @p thread_t structure - */ -#define CH_CFG_THREAD_INIT_HOOK(tp) \ - { \ - /* Add threads initialization code here.*/ \ - } - -/** - * @brief Threads finalization hook. - * @details User finalization code added to the @p chThdExit() API. - * - * @param[in] tp pointer to the @p thread_t structure - */ -#define CH_CFG_THREAD_EXIT_HOOK(tp) \ - { \ - /* Add threads finalization code here.*/ \ - } - -/** - * @brief Context switch hook. - * @details This hook is invoked just before switching between threads. - * - * @param[in] ntp thread being switched in - * @param[in] otp thread being switched out - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) \ - { \ - /* Context switch code here.*/ \ - } - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() \ - { \ - /* IRQ prologue code here.*/ \ - } - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() \ - { \ - /* IRQ epilogue code here.*/ \ - } - -/** - * @brief Idle thread enter hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to activate a power saving mode. - */ -#define CH_CFG_IDLE_ENTER_HOOK() \ - { \ - /* Idle-enter code here.*/ \ - } - -/** - * @brief Idle thread leave hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to deactivate a power saving mode. - */ -#define CH_CFG_IDLE_LEAVE_HOOK() \ - { \ - /* Idle-leave code here.*/ \ - } - -/** - * @brief Idle Loop hook. - * @details This hook is continuously invoked by the idle thread loop. - */ -#define CH_CFG_IDLE_LOOP_HOOK() \ - { \ - /* Idle loop code here.*/ \ - } - -/** - * @brief System tick event hook. - * @details This hook is invoked in the system tick handler immediately - * after processing the virtual timers queue. - */ -#define CH_CFG_SYSTEM_TICK_HOOK() \ - { \ - /* System tick event code here.*/ \ - } - -/** - * @brief System halt hook. - * @details This hook is invoked in case to a system halting error before - * the system is halted. - */ -#define CH_CFG_SYSTEM_HALT_HOOK(reason) \ - { \ - /* System halt code here.*/ \ - } - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) \ - { \ - /* Trace code here.*/ \ - } - -/** - * @brief Runtime Faults Collection Unit hook. - * @details This hook is invoked each time new faults are collected and stored. - */ -#define CH_CFG_RUNTIME_FAULTS_HOOK(mask) \ - { \ - /* Faults handling code here.*/ \ - } - -/** @} */ - -/*===========================================================================*/ -/* Port-specific settings (override port settings defaulted in chcore.h). */ -/*===========================================================================*/ - -#endif /* CHCONF_H */ - -/** @} */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf.h deleted file mode 100644 index b52ca80fc6..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf.h +++ /dev/null @@ -1,555 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -/** - * @file templates/halconf.h - * @brief HAL configuration header. - * @details HAL configuration file, this file allows to enable or disable the - * various device drivers from your application. You may also use - * this file in order to override the device drivers default settings. - * - * @addtogroup HAL_CONF - * @{ - */ - -#ifndef HALCONF_H -#define HALCONF_H - -#define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ - -#include -#include "mcuconf.h" - -/** - * @brief Enables the PAL subsystem. - */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif - -/** - * @brief Enables the ADC subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -// #define HAL_USE_ADC TRUE -// #endif - -/** - * @brief Enables the CAN subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -// #define HAL_USE_CAN FALSE -// #endif - -/** - * @brief Enables the cryptographic subsystem. - */ -#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) -#define HAL_USE_CRY FALSE -#endif - -// /** -// * @brief Enables the DAC subsystem. -// */ -// #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) -// #define HAL_USE_DAC FALSE -// #endif - -/** - * @brief Enables the EFlash subsystem. - */ -#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) -#define HAL_USE_EFL FALSE -#endif - -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT FALSE -#endif - -/** - * @brief Enables the I2C subsystem. - */ -// this option is set at target_platform.h (from config file) -//#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) -//#define HAL_USE_I2C TRUE -//#endif - -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif - -/** - * @brief Enables the ICU subsystem. - */ -#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU FALSE -#endif - -/** - * @brief Enables the MAC subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -// #define HAL_USE_MAC TRUE -// #endif - -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI FALSE -#endif - -/** - * @brief Enables the PWM subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) -// #define HAL_USE_PWM TRUE -// #endif - -/** - * @brief Enables the RTC subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) -// #define HAL_USE_RTC TRUE -// #endif - -/** - * @brief Enables the SDC subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -// #define HAL_USE_SDC FALSE -// #endif - -/** - * @brief Enables the SERIAL subsystem. - */ -#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL FALSE -#endif - -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif - -/** - * @brief Enables the SIO subsystem. - */ -#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) -#define HAL_USE_SIO FALSE -#endif - -/** - * @brief Enables the SPI subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) -// #define HAL_USE_SPI TRUE -// #endif - -/** - * @brief Enables the TRNG subsystem. - */ -#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) -#define HAL_USE_TRNG FALSE -#endif - -/** - * @brief Enables the UART subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) -// #define HAL_USE_UART FALSE -// #endif - -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - -/** - * @brief Enables the WDG subsystem. - */ -// this option is set at target_platform.h (from config file) -// #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) -// #define HAL_USE_WDG FALSE -// #endif - -/** - * @brief Enables the WSPI subsystem. - */ -#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) -#define HAL_USE_WSPI FALSE -#endif - -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS TRUE -#endif - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) -#define PAL_USE_WAIT FALSE -#endif - -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* CAN driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif - -/** - * @brief Enforces the driver to use direct callbacks rather than OSAL events. - */ -#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) -#define CAN_ENFORCE_USE_CALLBACKS TRUE -#endif - -/*===========================================================================*/ -/* CRY driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the SW fall-back of the cryptographic driver. - * @details When enabled, this option, activates a fall-back software - * implementation for algorithms not supported by the underlying - * hardware. - * @note Fall-back implementations may not be present for all algorithms. - */ -#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_USE_FALLBACK FALSE -#endif - -/** - * @brief Makes the driver forcibly use the fall-back implementations. - */ -#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_ENFORCE_FALLBACK FALSE -#endif - -/*===========================================================================*/ -/* DAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) -#define DAC_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define DAC_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the zero-copy API. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - -/*===========================================================================*/ -/* SDC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Number of initialization attempts before rejecting the card. - * @note Attempts are performed at 10mS intervals. - */ -#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) -#define SDC_INIT_RETRY 100 -#endif - -/** - * @brief Include support for MMC cards. - * @note MMC support is not yet implemented so this option must be kept - * at @p FALSE. - */ -#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) -#define SDC_MMC_SUPPORT FALSE -#endif - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - */ -#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) -#define SDC_NICE_WAITING TRUE -#endif - -/** - * @brief OCR initialization constant for V20 cards. - */ -#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) -#define SDC_INIT_OCR_V20 0x50FF8000U -#endif - -/** - * @brief OCR initialization constant for non-V20 cards. - */ -#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) -#define SDC_INIT_OCR 0x80100000U -#endif - -/*===========================================================================*/ -/* SERIAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Default bit rate. - * @details Configuration parameter, this is the baud rate selected for the - * default configuration. - */ -#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SERIAL_DEFAULT_BITRATE 921600 -#endif - -/** - * @brief Serial buffers size. - * @details Configuration parameter, you can change the depth of the queue - * buffers depending on the requirements of your application. - * @note The default is 16 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 -#endif - -/*===========================================================================*/ -/* SIO driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Default bit rate. - * @details Configuration parameter, this is the baud rate selected for the - * default configuration. - */ -#if !defined(SIO_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SIO_DEFAULT_BITRATE 38400 -#endif - -/** - * @brief Support for thread synchronization API. - */ -#if !defined(SIO_USE_SYNCHRONIZATION) || defined(__DOXYGEN__) -#define SIO_USE_SYNCHRONIZATION TRUE -#endif - -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 64 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 1 -#endif - -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE -#endif - -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE -#endif - -/** - * @brief Handling method for SPI CS line. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD -#endif - -/*===========================================================================*/ -/* UART driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) -#define UART_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define UART_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT FALSE -#endif - -/*===========================================================================*/ -/* WSPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) -#define WSPI_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define WSPI_USE_MUTUAL_EXCLUSION TRUE -#endif - -// header for nanoFramework overlay -#include "halconf_nf.h" - -#endif /* HALCONF_H */ - -/** @} */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf_nf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf_nf.h deleted file mode 100644 index e979c1fa3a..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/halconf_nf.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef HALCONF_NF_H -#define HALCONF_NF_H - -// enables STM32 Flash driver -#if !defined(HAL_NF_USE_STM32_FLASH) -#define HAL_NF_USE_STM32_FLASH TRUE -#endif - -#endif // HALCONF_NF_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/main.c b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/main.c deleted file mode 100644 index 6ae8c75923..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/main.c +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include -#include -#include - -#include "usbcfg.h" -#include -#include -#include -#include -#include -#include -#include - -// need to declare the Receiver thread here -osThreadDef(ReceiverThread, osPriorityHigh, 2048, "ReceiverThread"); -// declare CLRStartup thread here -osThreadDef(CLRStartupThread, osPriorityNormal, 4096, "CLRStartupThread"); - -// Application entry point. -int main(void) -{ - // find out wakeup reason - if ((RTC->ISR & RTC_ISR_ALRAF) == RTC_ISR_ALRAF) - { - // standby, match WakeupReason_FromStandby enum - WakeupReasonStore = 1; - } - else if ((PWR->CSR & PWR_CSR_WUF) == PWR_CSR_WUF) - { - // wake from pin, match WakeupReason_FromPin enum - WakeupReasonStore = 2; - } - else - { - // undetermined reason, match WakeupReason_Undetermined enum - WakeupReasonStore = 0; - } - - // first things first: need to clear any possible wakeup flags - // if this is not done here the next standby -> wakeup sequence won't work - CLEAR_BIT(RTC->CR, RTC_CR_ALRAIE); - CLEAR_BIT(RTC->ISR, RTC_ISR_ALRAF); - SET_BIT(PWR->CR, PWR_CR_CWUF); - - // HAL initialization, this also initializes the configured device drivers - // and performs the board-specific initializations. - halInit(); - - // init boot clipboard - InitBootClipboard(); - -// init SWO as soon as possible to make it available to output ASAP -#if (SWO_OUTPUT == TRUE) - SwoInit(); -#endif - - // The kernel is initialized but not started yet, this means that - // main() is executing with absolute priority but interrupts are already enabled. - osKernelInitialize(); - - // start watchdog - /////////////////////////////////////////////////////////////////////////////////////////////////////// - // for STM32F4 family if watchdog is enabled can't use standby mode because the IWDG can't be stoped // - /////////////////////////////////////////////////////////////////////////////////////////////////////// - Watchdog_Init(); - -#if (HAL_NF_USE_STM32_CRC == TRUE) - // startup crc - crcStart(NULL); -#endif - - // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); - - // Activates the USB driver and then the USB bus pull-up on D+. - // Note, a delay is inserted in order to not have to disconnect the cable after a reset - usbDisconnectBus(serusbcfg.usbp); - chThdSleepMilliseconds(100); - usbStart(serusbcfg.usbp, &usbcfg); - usbConnectBus(serusbcfg.usbp); - - // create the receiver thread - osThreadCreate(osThread(ReceiverThread), NULL); - - // CLR settings to launch CLR thread - CLR_SETTINGS clrSettings; - (void)memset(&clrSettings, 0, sizeof(CLR_SETTINGS)); - - clrSettings.MaxContextSwitches = 50; - clrSettings.WaitForDebugger = false; - clrSettings.EnterDebuggerLoopAfterExit = true; - - // create the CLR Startup thread - osThreadCreate(osThread(CLRStartupThread), &clrSettings); - - // start kernel, after this main() will behave like a thread with priority osPriorityNormal - osKernelStart(); - - while (true) - { - osDelay(100); - } -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf.h deleted file mode 100644 index cde08c526a..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf.h +++ /dev/null @@ -1,382 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#ifndef MCUCONF_H -#define MCUCONF_H - -/* - * STM32F4xx drivers configuration. - * The following settings override the default settings present in - * the various device driver implementation headers. - * Note that the settings for each driver only have effect if the whole - * driver is enabled in halconf.h. - * - * IRQ priorities: - * 15...0 Lowest...Highest. - * - * DMA priorities: - * 0...3 Lowest...Highest. - */ - -#define STM32F4xx_MCUCONF -#define STM32F427_MCUCONF - -/* - * HAL driver system settings. - */ -#define STM32_NO_INIT FALSE -#define STM32_HSI_ENABLED TRUE -#define STM32_LSI_ENABLED TRUE -#define STM32_HSE_ENABLED TRUE -#define STM32_LSE_ENABLED FALSE -#define STM32_CLOCK48_REQUIRED TRUE -#define STM32_SW STM32_SW_PLL -#define STM32_PLLSRC STM32_PLLSRC_HSE -#define STM32_PLLM_VALUE 25 -#define STM32_PLLN_VALUE 336 -#define STM32_PLLP_VALUE 2 -#define STM32_PLLQ_VALUE 7 -#define STM32_HPRE STM32_HPRE_DIV1 -#define STM32_PPRE1 STM32_PPRE1_DIV4 -#define STM32_PPRE2 STM32_PPRE2_DIV2 -#define STM32_RTCSEL STM32_RTCSEL_HSEDIV -#define STM32_RTCPRE_VALUE 25 -#define STM32_RTC_PRESA_VALUE 125 -#define STM32_RTC_PRESS_VALUE 8000 -#define STM32_MCO1SEL STM32_MCO1SEL_HSI -#define STM32_MCO1PRE STM32_MCO1PRE_DIV1 -#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK -#define STM32_MCO2PRE STM32_MCO2PRE_DIV1 -#define STM32_I2SSRC STM32_I2SSRC_PLLI2S -#define STM32_PLLI2SN_VALUE 192 -#define STM32_PLLI2SR_VALUE 2 -#define STM32_PLLI2SQ_VALUE 2 -#define STM32_PVD_ENABLE FALSE -#define STM32_PLS STM32_PLS_LEV0 -#define STM32_BKPRAM_ENABLE FALSE - -/* - * IRQ system settings. - */ -#define STM32_IRQ_EXTI0_PRIORITY 6 -#define STM32_IRQ_EXTI1_PRIORITY 6 -#define STM32_IRQ_EXTI2_PRIORITY 6 -#define STM32_IRQ_EXTI3_PRIORITY 6 -#define STM32_IRQ_EXTI4_PRIORITY 6 -#define STM32_IRQ_EXTI5_9_PRIORITY 6 -#define STM32_IRQ_EXTI10_15_PRIORITY 6 -#define STM32_IRQ_EXTI16_PRIORITY 6 -#define STM32_IRQ_EXTI17_PRIORITY 15 -#define STM32_IRQ_EXTI18_PRIORITY 6 -#define STM32_IRQ_EXTI19_PRIORITY 6 -#define STM32_IRQ_EXTI20_PRIORITY 6 -#define STM32_IRQ_EXTI21_PRIORITY 15 -#define STM32_IRQ_EXTI22_PRIORITY 15 - -#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7 -#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7 -#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7 -#define STM32_IRQ_TIM1_CC_PRIORITY 7 -#define STM32_IRQ_TIM2_PRIORITY 7 -#define STM32_IRQ_TIM3_PRIORITY 7 -#define STM32_IRQ_TIM4_PRIORITY 7 -#define STM32_IRQ_TIM5_PRIORITY 7 -#define STM32_IRQ_TIM6_PRIORITY 7 -#define STM32_IRQ_TIM7_PRIORITY 7 -#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7 -#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7 -#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7 -#define STM32_IRQ_TIM8_CC_PRIORITY 7 - -#define STM32_IRQ_USART1_PRIORITY 12 -#define STM32_IRQ_USART2_PRIORITY 12 -#define STM32_IRQ_USART3_PRIORITY 12 -#define STM32_IRQ_UART4_PRIORITY 12 -#define STM32_IRQ_UART5_PRIORITY 12 -#define STM32_IRQ_USART6_PRIORITY 12 -#define STM32_IRQ_UART7_PRIORITY 12 -#define STM32_IRQ_UART8_PRIORITY 12 - -/* - * ADC driver system settings. - */ -#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4 -#define STM32_ADC_USE_ADC1 TRUE -#define STM32_ADC_USE_ADC2 TRUE -#define STM32_ADC_USE_ADC3 TRUE -#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) -#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_ADC_ADC1_DMA_PRIORITY 2 -#define STM32_ADC_ADC2_DMA_PRIORITY 2 -#define STM32_ADC_ADC3_DMA_PRIORITY 2 -#define STM32_ADC_IRQ_PRIORITY 6 -#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 -#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6 -#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6 - -/* - * CAN driver system settings. - */ -#define STM32_CAN_USE_CAN1 TRUE -#define STM32_CAN_USE_CAN2 TRUE -#define STM32_CAN_CAN1_IRQ_PRIORITY 11 -#define STM32_CAN_CAN2_IRQ_PRIORITY 11 - -/* - * DAC driver system settings. - */ -#define STM32_DAC_DUAL_MODE TRUE -#define STM32_DAC_USE_DAC1_CH1 TRUE -#define STM32_DAC_USE_DAC1_CH2 TRUE -#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 -#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 -#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 -#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 -#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) - -/* - * GPT driver system settings. - */ -#define STM32_GPT_USE_TIM1 FALSE -#define STM32_GPT_USE_TIM2 FALSE -#define STM32_GPT_USE_TIM3 FALSE -#define STM32_GPT_USE_TIM4 FALSE -#define STM32_GPT_USE_TIM5 FALSE -#define STM32_GPT_USE_TIM6 FALSE -#define STM32_GPT_USE_TIM7 FALSE -#define STM32_GPT_USE_TIM8 FALSE -#define STM32_GPT_USE_TIM9 FALSE -#define STM32_GPT_USE_TIM11 FALSE -#define STM32_GPT_USE_TIM12 FALSE -#define STM32_GPT_USE_TIM14 FALSE -#define STM32_GPT_TIM1_IRQ_PRIORITY 7 -#define STM32_GPT_TIM2_IRQ_PRIORITY 7 -#define STM32_GPT_TIM3_IRQ_PRIORITY 7 -#define STM32_GPT_TIM4_IRQ_PRIORITY 7 -#define STM32_GPT_TIM5_IRQ_PRIORITY 7 -#define STM32_GPT_TIM6_IRQ_PRIORITY 7 -#define STM32_GPT_TIM7_IRQ_PRIORITY 7 -#define STM32_GPT_TIM8_IRQ_PRIORITY 7 -#define STM32_GPT_TIM9_IRQ_PRIORITY 7 -#define STM32_GPT_TIM11_IRQ_PRIORITY 7 -#define STM32_GPT_TIM12_IRQ_PRIORITY 7 -#define STM32_GPT_TIM14_IRQ_PRIORITY 7 - -/* - * I2C driver system settings. - */ -#define STM32_I2C_USE_I2C1 TRUE -#define STM32_I2C_USE_I2C2 FALSE -#define STM32_I2C_USE_I2C3 FALSE -#define STM32_I2C_BUSY_TIMEOUT 50 -#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) -#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_I2C_I2C1_IRQ_PRIORITY 5 -#define STM32_I2C_I2C2_IRQ_PRIORITY 5 -#define STM32_I2C_I2C3_IRQ_PRIORITY 5 -#define STM32_I2C_I2C1_DMA_PRIORITY 3 -#define STM32_I2C_I2C2_DMA_PRIORITY 3 -#define STM32_I2C_I2C3_DMA_PRIORITY 3 -#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") - -/* - * I2S driver system settings. - */ -#define STM32_I2S_USE_SPI2 FALSE -#define STM32_I2S_USE_SPI3 FALSE -#define STM32_I2S_SPI2_IRQ_PRIORITY 10 -#define STM32_I2S_SPI3_IRQ_PRIORITY 10 -#define STM32_I2S_SPI2_DMA_PRIORITY 1 -#define STM32_I2S_SPI3_DMA_PRIORITY 1 -#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure") - -/* - * ICU driver system settings. - */ -#define STM32_ICU_USE_TIM1 FALSE -#define STM32_ICU_USE_TIM2 FALSE -#define STM32_ICU_USE_TIM3 FALSE -#define STM32_ICU_USE_TIM4 FALSE -#define STM32_ICU_USE_TIM5 FALSE -#define STM32_ICU_USE_TIM8 FALSE -#define STM32_ICU_USE_TIM9 FALSE -#define STM32_ICU_TIM1_IRQ_PRIORITY 7 -#define STM32_ICU_TIM2_IRQ_PRIORITY 7 -#define STM32_ICU_TIM3_IRQ_PRIORITY 7 -#define STM32_ICU_TIM4_IRQ_PRIORITY 7 -#define STM32_ICU_TIM5_IRQ_PRIORITY 7 -#define STM32_ICU_TIM8_IRQ_PRIORITY 7 -#define STM32_ICU_TIM9_IRQ_PRIORITY 7 - -/* - * MAC driver system settings. - */ -#define STM32_MAC_TRANSMIT_BUFFERS 2 -#define STM32_MAC_RECEIVE_BUFFERS 4 -#define STM32_MAC_BUFFERS_SIZE 1522 -#define STM32_MAC_PHY_TIMEOUT 100 -#define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE -#define STM32_MAC_ETH1_IRQ_PRIORITY 13 -#define STM32_MAC_IP_CHECKSUM_OFFLOAD 0 - -/* - * PWM driver system settings. - */ -#define STM32_PWM_USE_ADVANCED TRUE -#define STM32_PWM_USE_TIM1 TRUE -#define STM32_PWM_USE_TIM2 FALSE -#define STM32_PWM_USE_TIM3 TRUE -#define STM32_PWM_USE_TIM4 TRUE -#define STM32_PWM_USE_TIM5 TRUE -#define STM32_PWM_USE_TIM8 TRUE -#define STM32_PWM_USE_TIM9 FALSE // Turned off as not yet supported in 20.3 -#define STM32_PWM_TIM1_IRQ_PRIORITY 7 -#define STM32_PWM_TIM2_IRQ_PRIORITY 7 -#define STM32_PWM_TIM3_IRQ_PRIORITY 7 -#define STM32_PWM_TIM4_IRQ_PRIORITY 7 -#define STM32_PWM_TIM5_IRQ_PRIORITY 7 -#define STM32_PWM_TIM8_IRQ_PRIORITY 7 -#define STM32_PWM_TIM9_IRQ_PRIORITY 7 - -/* - * SDC driver system settings. - */ -#define STM32_SDC_SDIO_DMA_PRIORITY 3 -#define STM32_SDC_SDIO_IRQ_PRIORITY 9 -#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) - -/* - * SERIAL driver system settings. - */ -#define STM32_SERIAL_USE_USART1 TRUE -#define STM32_SERIAL_USE_USART2 TRUE -#define STM32_SERIAL_USE_USART3 FALSE -#define STM32_SERIAL_USE_UART4 FALSE -#define STM32_SERIAL_USE_UART5 FALSE -#define STM32_SERIAL_USE_USART6 FALSE -#define STM32_SERIAL_USE_UART7 FALSE -#define STM32_SERIAL_USE_UART8 FALSE -#define STM32_SERIAL_USART1_PRIORITY 12 -#define STM32_SERIAL_USART2_PRIORITY 12 -#define STM32_SERIAL_USART3_PRIORITY 12 -#define STM32_SERIAL_UART4_PRIORITY 12 -#define STM32_SERIAL_UART5_PRIORITY 12 -#define STM32_SERIAL_USART6_PRIORITY 12 -#define STM32_SERIAL_UART7_PRIORITY 12 -#define STM32_SERIAL_UART8_PRIORITY 12 - -/* - * SPI driver system settings. - */ -#define STM32_SPI_USE_SPI1 TRUE -#define STM32_SPI_USE_SPI2 TRUE -#define STM32_SPI_USE_SPI3 TRUE -#define STM32_SPI_USE_SPI4 TRUE -#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) -#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) -#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) -#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) -#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_SPI_SPI1_DMA_PRIORITY 1 -#define STM32_SPI_SPI2_DMA_PRIORITY 1 -#define STM32_SPI_SPI3_DMA_PRIORITY 1 -#define STM32_SPI_SPI4_DMA_PRIORITY 1 -#define STM32_SPI_SPI1_IRQ_PRIORITY 10 -#define STM32_SPI_SPI2_IRQ_PRIORITY 10 -#define STM32_SPI_SPI3_IRQ_PRIORITY 10 -#define STM32_SPI_SPI4_IRQ_PRIORITY 10 -#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") - -/* - * ST driver system settings. - */ -#define STM32_ST_IRQ_PRIORITY 8 -#define STM32_ST_USE_TIMER 2 - -/* - * UART driver system settings. - */ -#define STM32_UART_USE_USART1 FALSE -#define STM32_UART_USE_USART2 FALSE -#define STM32_UART_USE_USART3 TRUE -#define STM32_UART_USE_UART4 FALSE -#define STM32_UART_USE_UART5 FALSE -#define STM32_UART_USE_USART6 TRUE -#define STM32_UART_USE_UART7 FALSE -#define STM32_UART_USE_UART8 FALSE -#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) -#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) -#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) -#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) -#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) -#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(0, 0) -#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(0, 0) -#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) -#define STM32_UART_UART7_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) -#define STM32_UART_UART7_TX_DMA_STREAM STM32_DMA_STREAM_ID(0, 0) -#define STM32_UART_UART8_RX_DMA_STREAM STM32_DMA_STREAM_ID(0, 0) -#define STM32_UART_UART8_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) -#define STM32_UART_USART1_IRQ_PRIORITY 12 -#define STM32_UART_USART2_IRQ_PRIORITY 12 -#define STM32_UART_USART3_IRQ_PRIORITY 12 -#define STM32_UART_UART4_IRQ_PRIORITY 12 -#define STM32_UART_UART5_IRQ_PRIORITY 12 -#define STM32_UART_USART6_IRQ_PRIORITY 12 -#define STM32_UART_UART7_IRQ_PRIORITY 12 -#define STM32_UART_UART8_IRQ_PRIORITY 12 -#define STM32_UART_USART1_DMA_PRIORITY 0 -#define STM32_UART_USART2_DMA_PRIORITY 0 -#define STM32_UART_USART3_DMA_PRIORITY 0 -#define STM32_UART_UART4_DMA_PRIORITY 0 -#define STM32_UART_UART5_DMA_PRIORITY 0 -#define STM32_UART_USART6_DMA_PRIORITY 0 -#define STM32_UART_UART7_DMA_PRIORITY 0 -#define STM32_UART_UART8_DMA_PRIORITY 0 -#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") - -/* - * USB driver system settings. - */ -#define STM32_USB_USE_OTG1 TRUE -#define STM32_USB_USE_OTG2 FALSE -#define STM32_USB_OTG1_IRQ_PRIORITY 14 -#define STM32_USB_OTG2_IRQ_PRIORITY 14 -#define STM32_USB_OTG1_RX_FIFO_SIZE 512 -#define STM32_USB_OTG2_RX_FIFO_SIZE 1024 -#define STM32_USB_OTG_THREAD_PRIO LOWPRIO -#define STM32_USB_OTG_THREAD_STACK_SIZE 128 -#define STM32_USB_OTGFIFO_FILL_BASEPRI 0 - -/* - * WDG driver system settings. - */ -#define STM32_WDG_USE_IWDG TRUE - -// header for nanoFramework overlay drivers -#include "mcuconf_nf.h" - -#endif /* MCUCONF_H */ diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf_nf.h b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf_nf.h deleted file mode 100644 index 35e74e10aa..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/mcuconf_nf.h +++ /dev/null @@ -1,9 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef MCUCONF_NF_H -#define MCUCONF_NF_H - -#endif // MCUCONF_NF_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/nanoHAL.cpp b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/nanoHAL.cpp deleted file mode 100644 index e754dd5f80..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/nanoHAL.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -bool g_fDoNotUninitializeDebuggerPort = false; diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR-DEBUG.ld b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR-DEBUG.ld deleted file mode 100644 index 52f46ed2ef..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR-DEBUG.ld +++ /dev/null @@ -1,87 +0,0 @@ -/* -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// -*/ - -/* - * STM32F427Vx memory setup. - * Note: Use of ram1, ram2 and ram3 is mutually exclusive with use of ram0. - */ -MEMORY -{ - flash0 (rx) : org = 0x08008000, len = 2M - 32k - 1408k /* flash size less the space reserved for nanoBooter and application deployment*/ - flash1 (rx) : org = 0x00000000, len = 0 - flash2 (rx) : org = 0x00000000, len = 0 - flash3 (rx) : org = 0x00000000, len = 0 - flash4 (rx) : org = 0x00000000, len = 0 - flash5 (rx) : org = 0x00000000, len = 0 - flash6 (rx) : org = 0x00000000, len = 0 - flash7 (rx) : org = 0x00000000, len = 0 - config (rw) : org = 0x00000000, len = 0 /* space reserved for configuration block */ - deployment (rx) : org = 0x080A0000, len = 1408k /* space reserved for application deployment */ - ramvt (wx) : org = 0x00000000, len = 0 /* initial RAM address is reserved for a copy of the vector table */ - ram0 (wx) : org = 0x20000030, len = 192k-48 /* SRAM1 + SRAM2 + SRAM3 */ - ram1 (wx) : org = 0x20000000, len = 112k /* SRAM1 */ - ram2 (wx) : org = 0x2001C030, len = 16k /* SRAM2 */ - ram3 (wx) : org = 0x20020000, len = 64k /* SRAM3 */ - ram4 (wx) : org = 0x10000000, len = 64k /* CCM SRAM */ - ram5 (wx) : org = 0x40024000, len = 4k /* BCKP SRAM */ - ram6 (wx) : org = 0x00000000, len = 0 - ram7 (wx) : org = 0x00000000, len = 0 - bootclpbrd (wx) : org = 0x20000000, len = 48 /* boot clipboard area */ -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram4); - -/* RAM region to be used for the nanoFramework CLR managed heap.*/ -REGION_ALIAS("CLR_MANAGED_HEAP_RAM", ram0); - -/* RAM region to be used for the boot clipboard.*/ -REGION_ALIAS("SECTION_FOR_BOOTCLIPBOARD", bootclpbrd); - -INCLUDE rules.ld diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR.ld b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR.ld deleted file mode 100644 index 117dd5742b..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/netduino3wifi_CLR.ld +++ /dev/null @@ -1,87 +0,0 @@ -/* -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) 2006..2015 Giovanni Di Sirio. All rights reserved. -// See LICENSE file in the project root for full license information. -// -*/ - -/* - * STM32F427Vx memory setup. - * Note: Use of ram1, ram2 and ram3 is mutually exclusive with use of ram0. - */ -MEMORY -{ - flash0 (rx) : org = 0x08004000, len = 2M - 16k - 1792k /* flash size less the space reserved for nanoBooter and application deployment*/ - flash1 (rx) : org = 0x00000000, len = 0 - flash2 (rx) : org = 0x00000000, len = 0 - flash3 (rx) : org = 0x00000000, len = 0 - flash4 (rx) : org = 0x00000000, len = 0 - flash5 (rx) : org = 0x00000000, len = 0 - flash6 (rx) : org = 0x00000000, len = 0 - flash7 (rx) : org = 0x00000000, len = 0 - config (rw) : org = 0x00000000, len = 0 /* space reserved for configuration block */ - deployment (rx) : org = 0x08040000, len = 1792k /* space reserved for application deployment */ - ramvt (wx) : org = 0x00000000, len = 0 /* initial RAM address is reserved for a copy of the vector table */ - ram0 (wx) : org = 0x20000030, len = 192k-48 /* SRAM1 + SRAM2 + SRAM3 */ - ram1 (wx) : org = 0x20000000, len = 112k /* SRAM1 */ - ram2 (wx) : org = 0x2001C030, len = 16k /* SRAM2 */ - ram3 (wx) : org = 0x20020000, len = 64k /* SRAM3 */ - ram4 (wx) : org = 0x10000000, len = 64k /* CCM SRAM */ - ram5 (wx) : org = 0x40024000, len = 4k /* BCKP SRAM */ - ram6 (wx) : org = 0x00000000, len = 0 - ram7 (wx) : org = 0x00000000, len = 0 - bootclpbrd (wx) : org = 0x20000000, len = 48 /* boot clipboard area */ -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram4); - -/* RAM region to be used for the nanoFramework CLR managed heap.*/ -REGION_ALIAS("CLR_MANAGED_HEAP_RAM", ram0); - -/* RAM region to be used for the boot clipboard.*/ -REGION_ALIAS("SECTION_FOR_BOOTCLIPBOARD", bootclpbrd); - -INCLUDE rules.ld diff --git a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/target_board.h.in b/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/target_board.h.in deleted file mode 100644 index 53a87fce3d..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/nanoCLR/target_board.h.in +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -////////////////////////////////////////////////////////////////////////////// -// This file was automatically generated by a tool. // -// Any changes you make here will be overwritten when it's generated again. // -////////////////////////////////////////////////////////////////////////////// - -#ifndef TARGET_BOARD_NANOCLR_H -#define TARGET_BOARD_NANOCLR_H - -#include - -#define OEMSYSTEMINFOSTRING "nanoCLR running @ @TARGET_NAME@" - -#endif // TARGET_BOARD_NANOCLR_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.c b/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.c deleted file mode 100644 index db45d1a411..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.c +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -extern struct BlockStorageDevice Device_BlockStorage; -extern struct MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig; -extern IBlockStorageDevice STM32Flash_BlockStorageInterface; - -void BlockStorage_AddDevices() -{ - BlockStorageList_AddDevice( (BlockStorageDevice*)&Device_BlockStorage, &STM32Flash_BlockStorageInterface, &Device_BlockStorageConfig, false); -} diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.h b/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.h deleted file mode 100644 index eac9e104e5..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_BlockStorage.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef TARGETPAL_BLOCKSTORAGE_H -#define TARGETPAL_BLOCKSTORAGE_H - -// this device has 1 block storage devices -#define TARGET_BLOCKSTORAGE_COUNT 1 - -#endif //TARGETPAL_BLOCKSTORAGE_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_common.c b/targets/ChibiOS/NETDUINO3_WIFI/target_common.c deleted file mode 100644 index 41069ca735..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_common.c +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Microsoft Corporation. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#include -#include "target_board.h" -#include "target_common.h" -#include - -HAL_SYSTEM_CONFIG HalSystemConfig = { - {true}, // HAL_DRIVER_CONFIG_HEADER Header; - - 1, // ConvertCOM_DebugHandle(1), - 0, // ConvertCOM_DebugHandle(0), - 921600, - 0, // STDIO = COM2 or COM1 - - {RAM1_MEMORY_StartAddress, RAM1_MEMORY_Size}, - {FLASH1_MEMORY_StartAddress, FLASH1_MEMORY_Size}}; - -HAL_TARGET_CONFIGURATION g_TargetConfiguration; - -// this target uses DFU for updates -inline GET_TARGET_CAPABILITIES(TargetCapabilities_DfuUpdate); -inline TARGET_HAS_PROPRIETARY_BOOTER(true); \ No newline at end of file diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_common.h.in b/targets/ChibiOS/NETDUINO3_WIFI/target_common.h.in deleted file mode 100644 index a57cc29abd..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_common.h.in +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -////////////////////////////////////////////////////////////////////////////// -// This file was automatically generated by a tool. // -// Any changes you make here will be overwritten when it's generated again. // -////////////////////////////////////////////////////////////////////////////// - -#ifndef TARGET_COMMON_H -#define TARGET_COMMON_H - -///////////////////////////////////////////////////////////////////////////////////////// -// The following addresses and sizes should be filled in according to the SoC data-sheet -// they also must be coherent with what's in the linker file for nanoBooter and nanoCLR - -// RAM base address -#define RAM1_MEMORY_StartAddress ((uint32_t)0x200000C0) -// RAM size -#define RAM1_MEMORY_Size ((uint32_t)0x00030000) - -// FLASH base address -#define FLASH1_MEMORY_StartAddress ((uint32_t)0x08000000) -// FLASH size -#define FLASH1_MEMORY_Size ((uint32_t)0x00200000) - -///////////////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////// -#define TARGETNAMESTRING "@TARGET_NAME@" -#define PLATFORMNAMESTRING "STM32F4" -////////////////////////////////////////////// - - -#endif // TARGET_COMMON_H diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.cpp deleted file mode 100644 index c7d263b871..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include "target_nf_devices_can_config.h" -#include - -/////////// -// CAN1 // -/////////// - -// pin configuration for CAN1 -// port for TX pin is: GPIOB -// TX pin: is GPIOB_09 -// port for RX pin is: GPIOB -// RX pin: is GPIOB_08 -// GPIO alternate pin function is 9 (see "Table 9. STM32F405xx and STM32F407xx alternate function mapping" in STM32F405xx/STM32F407xx datasheet) -CAN_CONFIG_PINS(1, GPIOB, GPIOB, 9, 8, 9) - -// buffer -CANRxFrame Can1_MsgBuffer[CAN1_RX_BUFFER_SIZE]; - -// initialization for CAN1 -CAN_INIT(1, CAN1_RX_BUFFER_SIZE) - -/////////// -// CAN2 // -/////////// - -// pin configuration for CAN2 -// port for TX pin is: GPIOB -// TX pin: is GPIOB_06 -// port for RX pin is: GPIOB -// RX pin: is GPIOB_05 -// GPIO alternate pin function is 9 (see "Table 9. STM32F405xx and STM32F407xx alternate function mapping" in STM32F405xx/STM32F407xx datasheet) -CAN_CONFIG_PINS(2, GPIOB, GPIOB, 6, 5, 9) - -// buffer -CANRxFrame Can2_MsgBuffer[CAN2_RX_BUFFER_SIZE]; - -// initialization for CAN1 -CAN_INIT(2, CAN2_RX_BUFFER_SIZE) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.h b/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.h deleted file mode 100644 index db3e146a08..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_can_config.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - - -////////// -// CAN1 // -////////// - -// enable CAN1 -#define NF_CAN_STM32_CAN_USE_CAN1 TRUE - -// buffers size -#define CAN1_RX_BUFFER_SIZE 16 - -////////// -// CAN2 // -////////// - -// enable CAN2 -#define NF_CAN_STM32_CAN_USE_CAN2 TRUE - -// buffers size -#define CAN2_RX_BUFFER_SIZE 16 diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.cpp deleted file mode 100644 index 774baf30e5..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include "target_nf_devices_onewire_config.h" -#include - -/////////// -// UART6 // -/////////// - -// pin configuration for UART6 -// port for TX pin is: GPIOC -// TX pin: is GPIOC_6 -// GPIO alternate pin function is 8 (see "Table 9. STM32F405xx and STM32F407xx alternate function mapping" in STM32F405xx/STM32F407xx datasheet) -UART_CONFIG_PINS(6, GPIOC, 6, 8) - -// buffers -// buffers that are R/W by DMA are recommended to be aligned with 32 bytes cache page size boundary -// because of issues with cache coherency and DMA (this is particularly important with Cortex-M7 because of cache) -#if defined(__GNUC__) -__attribute__((aligned (32))) -#endif -uint8_t Uart6_TxBuffer[UART6_TX_SIZE]; -#if defined(__GNUC__) -__attribute__((aligned (32))) -#endif -uint8_t Uart6_RxBuffer[UART6_RX_SIZE]; diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.h b/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.h deleted file mode 100644 index e54cfb0f9b..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_nf_devices_onewire_config.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -/////////// -// UART6 // -/////////// - -// enable USART6 -#define NF_ONEWIRE_STM32_UART_USE_USART6 TRUE - -// buffers size -// tx buffer size: 32 bytes -#define UART6_TX_SIZE 32 -// rx buffer size: 32 bytes -#define UART6_RX_SIZE 32 \ No newline at end of file diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_adc_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_adc_config.cpp deleted file mode 100644 index c0ce1949c0..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_adc_config.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -const NF_PAL_ADC_PORT_PIN_CHANNEL AdcPortPinConfig[] = { - - // ADC1 - {1, GPIOC, 0, ADC_CHANNEL_IN10}, - {1, GPIOC, 1, ADC_CHANNEL_IN11}, - - // ADC2 - {2, GPIOC, 2, ADC_CHANNEL_IN14}, - {2, GPIOC, 3, ADC_CHANNEL_IN15}, - - // ADC3 - {3, GPIOC, 4, ADC_CHANNEL_IN12}, - {3, GPIOC, 5, ADC_CHANNEL_IN13}, - - // these are the internal sources, available only at ADC1 - {1, NULL, 0, ADC_CHANNEL_SENSOR}, - {1, NULL, 0, ADC_CHANNEL_VREFINT}, - {1, NULL, 0, ADC_CHANNEL_VBAT}, -}; - -const int AdcChannelCount = ARRAYSIZE(AdcPortPinConfig); diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_i2c_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_i2c_config.cpp deleted file mode 100644 index 27bbbf60d6..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_i2c_config.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -////////// -// I2C1 // -////////// - -// pin configuration for I2C1 -// port for SCL pin is: GPIOB -// port for SDA pin is: GPIOB -// SCL pin: is GPIOB_6 -// SDA pin: is GPIOB_7 -// GPIO alternate pin function is 4 (see alternate function mapping table in device datasheet) -I2C_CONFIG_PINS(1, GPIOB, GPIOB, 6, 7, 4) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_spi_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_spi_config.cpp deleted file mode 100644 index 9690db97b9..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_device_spi_config.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -////////// -// SPI1 // -////////// - -// pin configuration for SPI1 -// port for SCK pin is: GPIOA_CC_SCK -// port for MISO pin is: GPIOA_CC_MISO -// port for MOSI pin is: GPIOA_CC_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(1, GPIOA, 5, GPIOA, 6, GPIOA, 7, 5) - -////////// -// SPI2 // -////////// - -// pin configuration for SPI2 -// port for SCK pin is: GPIOB_D13 -// port for MISO pin is: GPIOB_D12 -// port for MOSI pin is: GPIOB_D11 - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(2, GPIOB, 13, GPIOB, 14, GPIOB, 15, 5) - -////////// -// SPI3 // -////////// - -// pin configuration for SPI3 -// port for SCK pin is: GPIOC_SPI3_CLK -// port for MISO pin is: GPIOC_SPI3_MISO -// port for MOSI pin is: GPIOC_SPI3_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(3, GPIOC, 13, GPIOC, 11, GPIOC, 12, 5) - -////////// -// SPI4 // -////////// - -// pin configuration for SPI4 -// port for SCK pin is: GPIOE_SPI4_SCK -// port for MISO pin is: GPIOE_SPI4_MISO -// port for MOSI pin is: GPIOE_SPI4_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(4, GPIOE, 2, GPIOE, 13, GPIOE, 6, 5) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_devices_dac_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_system_devices_dac_config.cpp deleted file mode 100644 index 35a61746cb..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_devices_dac_config.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -////////////////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS BLANK ON PURPOSE BECAUSE THIS TARGET DOESN'T HAVE SUPPORT FOR DAC PINS // -////////////////////////////////////////////////////////////////////////////////////////// diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.cpp deleted file mode 100644 index a21511d630..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include "target_system_io_ports_config.h" -#include - -/////////// -// UART3 // -/////////// - -// pin configuration for UART3 -// port for TX pin is: GPIOD -// port for RX pin is: GPIOD -// TX pin: is GPIOD_8 -// RX pin: is GPIOD_9 -// GPIO alternate pin function is 7 (see "Table 12. STM32F427xx and STM32F429xx alternate function mapping" in -// STM32F427xx and STM32F429xx datasheet) -UART_CONFIG_PINS(3, GPIOD, GPIOD, 8, 9, 7) - -// buffers -// buffers that are R/W by DMA are recommended to be aligned with 32 bytes cache page size boundary -// because of issues with cache coherency and DMA (this is particularly important with Cortex-M7 because of cache) -#if defined(__GNUC__) -__attribute__((aligned(32))) -#endif -uint8_t Uart3_RxBuffer[UART3_RX_SIZE]; - -// initialization for UART3 -UART_INIT(3, UART3_RX_SIZE) - -// un-initialization for UART3 -UART_UNINIT(3) - -// /////////// -// // UART6 // -// /////////// - -// // pin configuration for UART6 -// // port for TX pin is: GPIOC -// // port for RX pin is: GPIOC -// // TX pin: is GPIOC_6 -// // RX pin: is GPIOC_7 -// // GPIO alternate pin function is 7 (see "Table 12. STM32F427xx and STM32F429xx alternate function mapping" in -// STM32F427xx and STM32F429xx datasheet) UART_CONFIG_PINS(6, GPIOC, GPIOC, 6, 7, 8) - -// // buffers -// // buffers that are R/W by DMA are recommended to be aligned with 32 bytes cache page size boundary -// // because of issues with cache coherency and DMA (this is particularly important with Cortex-M7 because of cache) -// #if defined(__GNUC__) -// __attribute__((aligned (32))) -// #endif -// uint8_t Uart6_RxBuffer[UART6_RX_SIZE]; - -// // initialization for UART6 -// UART_INIT(6, UART6_RX_SIZE) - -// // un-initialization for UART6 -// UART_UNINIT(6) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.h b/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.h deleted file mode 100644 index 7e207e16ec..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_system_io_ports_config.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -/////////// -// UART3 // -/////////// - -// enable USART3 -#define NF_SERIAL_COMM_STM32_UART_USE_USART3 TRUE - -// buffers size -// rx buffer size: 256 bytes -#define UART3_RX_SIZE 256 - -// /////////// -// // UART6 // -// /////////// - -// // enable USART6 -// #define NF_SERIAL_COMM_STM32_UART_USE_USART6 TRUE - -// // buffers size -// // rx buffer size: 256 bytes -// #define UART6_RX_SIZE 256 diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_adc_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_adc_config.cpp deleted file mode 100644 index d28be63ea2..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_adc_config.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -const NF_PAL_ADC_PORT_PIN_CHANNEL__ AdcPortPinConfig__[] = { - - // ADC1 - {1, GPIOC, 0, ADC_CHANNEL_IN10}, - {1, GPIOC, 1, ADC_CHANNEL_IN11}, - - // ADC2 - {2, GPIOC, 2, ADC_CHANNEL_IN14}, - {2, GPIOC, 3, ADC_CHANNEL_IN15}, - - // ADC3 - {3, GPIOC, 4, ADC_CHANNEL_IN12}, - {3, GPIOC, 5, ADC_CHANNEL_IN13}, - - // these are the internal sources, available only at ADC1 - {1, NULL, 0, ADC_CHANNEL_SENSOR}, - {1, NULL, 0, ADC_CHANNEL_VREFINT}, - {1, NULL, 0, ADC_CHANNEL_VBAT}, -}; - -const int AdcChannelCount__ = ARRAYSIZE(AdcPortPinConfig__); diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_i2c_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_i2c_config.cpp deleted file mode 100644 index 45bb32f24e..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_i2c_config.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -////////// -// I2C1 // -////////// - -// pin configuration for I2C1 -// port for SCL pin is: GPIOB -// port for SDA pin is: GPIOB -// SCL pin: is GPIOB_6 -// SDA pin: is GPIOB_7 -// GPIO alternate pin function is 4 (see alternate function mapping table in device datasheet) -I2C_CONFIG_PINS(1, GPIOB, GPIOB, 6, 7, 4) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.cpp deleted file mode 100644 index a21e535864..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include "target_windows_devices_serialcommunication_config.h" -#include - -/////////// -// UART3 // -/////////// - -// pin configuration for UART3 -// port for TX pin is: GPIOD -// port for RX pin is: GPIOD -// TX pin: is GPIOD_8 -// RX pin: is GPIOD_9 -// GPIO alternate pin function is 7 (see "Table 12. STM32F427xx and STM32F429xx alternate function mapping" in -// STM32F427xx and STM32F429xx datasheet) -UART_CONFIG_PINS__(3, GPIOD, GPIOD, 8, 9, 7) - -// buffers -// buffers that are R/W by DMA are recommended to be aligned with 32 bytes cache page size boundary -// because of issues with cache coherency and DMA (this is particularly important with Cortex-M7 because of cache) -#if defined(__GNUC__) -__attribute__((aligned(32))) -#endif -uint8_t Uart3_TxBuffer__[UART3_TX_SIZE]; -#if defined(__GNUC__) -__attribute__((aligned(32))) -#endif -uint8_t Uart3_RxBuffer__[UART3_RX_SIZE]; - -// initialization for UART3 -UART_INIT__(3, UART3_TX_SIZE, UART3_RX_SIZE) - -// un-initialization for UART3 -UART_UNINIT__(3) - -// /////////// -// // UART6 // -// /////////// - -// // pin configuration for UART6 -// // port for TX pin is: GPIOC -// // port for RX pin is: GPIOC -// // TX pin: is GPIOC_6 -// // RX pin: is GPIOC_7 -// // GPIO alternate pin function is 7 (see "Table 12. STM32F427xx and STM32F429xx alternate function mapping" in -// STM32F427xx and STM32F429xx datasheet) UART_CONFIG_PINS(6, GPIOC, GPIOC, 6, 7, 8) - -// // buffers -// // buffers that are R/W by DMA are recommended to be aligned with 32 bytes cache page size boundary -// // because of issues with cache coherency and DMA (this is particularly important with Cortex-M7 because of cache) -// #if defined(__GNUC__) -// __attribute__((aligned (32))) -// #endif -// uint8_t Uart6_TxBuffer[UART6_TX_SIZE]; -// #if defined(__GNUC__) -// __attribute__((aligned (32))) -// #endif -// uint8_t Uart6_RxBuffer[UART6_RX_SIZE]; - -// // initialization for UART6 -// UART_INIT(6, UART6_TX_SIZE, UART6_RX_SIZE) - -// // un-initialization for UART6 -// UART_UNINIT(6) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.h b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.h deleted file mode 100644 index b6ed534214..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_serialcommunication_config.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -/////////// -// UART3 // -/////////// - -// enable USART3 -#define NF_SERIAL_COMM_STM32_UART_USE_USART3 TRUE - -// buffers size -// tx buffer size: 256 bytes -#define UART3_TX_SIZE 256 -// rx buffer size: 256 bytes -#define UART3_RX_SIZE 256 - -// /////////// -// // UART6 // -// /////////// - -// // enable USART6 -// #define NF_SERIAL_COMM_STM32_UART_USE_USART6 TRUE - -// // buffers size -// // tx buffer size: 256 bytes -// #define UART6_TX_SIZE 256 -// // rx buffer size: 256 bytes -// #define UART6_RX_SIZE 256 diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_spi_config.cpp b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_spi_config.cpp deleted file mode 100644 index be568b9ca2..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_devices_spi_config.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include - -////////// -// SPI1 // -////////// - -// pin configuration for SPI1 -// port for SCK pin is: GPIOA_CC_SCK -// port for MISO pin is: GPIOA_CC_MISO -// port for MOSI pin is: GPIOA_CC_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(1, GPIOA, 5, GPIOA, 6, GPIOA, 7, 5) - -////////// -// SPI2 // -////////// - -// pin configuration for SPI2 -// port for SCK pin is: GPIOB_D13 -// port for MISO pin is: GPIOB_D12 -// port for MOSI pin is: GPIOB_D11 - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(2, GPIOB, 13, GPIOB, 14, GPIOB, 15, 5) - -////////// -// SPI3 // -////////// - -// pin configuration for SPI3 -// port for SCK pin is: GPIOC_SPI3_CLK -// port for MISO pin is: GPIOC_SPI3_MISO -// port for MOSI pin is: GPIOC_SPI3_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(3, GPIOC, 13, GPIOC, 11, GPIOC, 12, 5) - -////////// -// SPI4 // -////////// - -// pin configuration for SPI4 -// port for SCK pin is: GPIOE_SPI4_SCK -// port for MISO pin is: GPIOE_SPI4_MISO -// port for MOSI pin is: GPIOE_SPI4_MOSI - -// GPIO alternate pin function is 5 (see alternate function mapping table in device datasheet) -SPI_CONFIG_PINS(4, GPIOE, 2, GPIOE, 13, GPIOE, 6, 5) diff --git a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_storage_config.h b/targets/ChibiOS/NETDUINO3_WIFI/target_windows_storage_config.h deleted file mode 100644 index a9a27a7454..0000000000 --- a/targets/ChibiOS/NETDUINO3_WIFI/target_windows_storage_config.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -// maps the SD Card driver -#define SD_CARD_DRIVER SDCD1 - -// maps the SD Card detect GPIO definition (in Target_Windows_Storage.c) to board GPIO line (in board.h) -#define SDCARD_LINE_DETECT LINE_SD_DETECT - -// includes SPIFFS in storage -#define USE_SPIFFS_FOR_STORAGE FALSE diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/common/usbcfg.h b/targets/ChibiOS/ORGPAL_PALTHREE/common/usbcfg.h index a41d20143e..173c74aa67 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/common/usbcfg.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/common/usbcfg.h @@ -7,10 +7,11 @@ #ifndef USBCFG_H #define USBCFG_H +// define which serial driver the Wire Protocol will be using +#define SERIAL_DRIVER SDU1 + extern const USBConfig usbcfg; extern SerialUSBConfig serusbcfg; extern SerialUSBDriver SDU1; -#endif /* USBCFG_H */ - -/** @} */ +#endif /* USBCFG_H */ diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/launch.json b/targets/ChibiOS/ORGPAL_PALTHREE/launch.json index 880532cf4a..6f4997ad21 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/launch.json +++ b/targets/ChibiOS/ORGPAL_PALTHREE/launch.json @@ -6,7 +6,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoBooter.elf", "setupCommands": [ { @@ -58,7 +57,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoCLR.elf", "setupCommands": [ { diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/halconf.h b/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/halconf.h index 15c0ae3ad8..c01b5f1181 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/halconf.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include "mcuconf.h" @@ -461,11 +463,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -542,3 +543,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/main.c b/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/main.c index f00cc00c62..799ca29988 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/main.c +++ b/targets/ChibiOS/ORGPAL_PALTHREE/nanoBooter/main.c @@ -73,8 +73,8 @@ int main(void) #endif // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); + sduObjectInit(&SERIAL_DRIVER); + sduStart(&SERIAL_DRIVER, &serusbcfg); // Activates the USB driver and then the USB bus pull-up on D+. // Note, a delay is inserted in order to not have to disconnect the cable after a reset. diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/halconf.h b/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/halconf.h index ccc3d647cb..cace0870e4 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/halconf.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include #include "mcuconf.h" @@ -473,11 +475,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -571,3 +572,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/main.c b/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/main.c index 1899bd91fa..631a4370fe 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/main.c +++ b/targets/ChibiOS/ORGPAL_PALTHREE/nanoCLR/main.c @@ -96,14 +96,14 @@ int main(void) // this has to be called after osKernelInitialize, otherwise an hard fault will occur Target_ExternalMemoryInit(); -#if NF_FEATURE_USE_SPIFFS +#if (NF_FEATURE_USE_SPIFFS == TRUE) // config and init SPIFFS hal_spiffs_config(); #endif // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); + sduObjectInit(&SERIAL_DRIVER); + sduStart(&SERIAL_DRIVER, &serusbcfg); // Activates the USB driver and then the USB bus pull-up on D+. // Note, a delay is inserted in order to not have to disconnect the cable after a reset diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/target_spiffs.c b/targets/ChibiOS/ORGPAL_PALTHREE/target_spiffs.c index 430bbb4067..2e1be06d82 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/target_spiffs.c +++ b/targets/ChibiOS/ORGPAL_PALTHREE/target_spiffs.c @@ -10,14 +10,16 @@ #ifdef SPIFFS_SPI1 static const SPIConfig spiConfig = { - false, - NULL, - PAL_PORT(LINE_FLASH_SPI1_CS), - PAL_PAD(LINE_FLASH_SPI1_CS), + .circular = false, + .slave = false, + .data_cb = NULL, + .error_cb = NULL, + .ssport = PAL_PORT(LINE_FLASH_SPI1_CS), + .sspad = PAL_PAD(LINE_FLASH_SPI1_CS), // CPHA=0, CPOL=0, MSb first - 0, // SPI_CR1_CPOL | SPI_CR1_BR_0, + .cr1 = 0U, // SPI_CR1_CPOL | SPI_CR1_BR_0, // transfer length to 8bit - SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0}; + .cr2 = SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0}; #if defined(__GNUC__) __attribute__((aligned(32))) diff --git a/targets/ChibiOS/ORGPAL_PALTHREE/target_windows_storage_config.h b/targets/ChibiOS/ORGPAL_PALTHREE/target_windows_storage_config.h index 1b3a66e5a3..7bc1934cbc 100644 --- a/targets/ChibiOS/ORGPAL_PALTHREE/target_windows_storage_config.h +++ b/targets/ChibiOS/ORGPAL_PALTHREE/target_windows_storage_config.h @@ -4,13 +4,10 @@ // // the following macro maps the SD card driver -#define SD_CARD_DRIVER SDCD1 +#define SD_CARD_DRIVER SDCD1 // maps the SD Card detect GPIO definition (in Target_Windows_Storage.c) to board GPIO line (in board.h) -#define SDCARD_LINE_DETECT LINE_SD_CARD_DETECT +#define SDCARD_LINE_DETECT LINE_SD_CARD_DETECT // the following macro maps the USB mass storage device driver -#define USB_MSD_DRIVER USBHD2 - -// includes SPIFFS in storage -#define USE_SPIFFS_FOR_STORAGE TRUE +#define USB_MSD_DRIVER USBHD2 diff --git a/targets/ChibiOS/ST_NUCLEO64_F091RC/common/Device_BlockStorage.c b/targets/ChibiOS/ST_NUCLEO64_F091RC/common/Device_BlockStorage.c index 28f73a9720..d37e998f63 100644 --- a/targets/ChibiOS/ST_NUCLEO64_F091RC/common/Device_BlockStorage.c +++ b/targets/ChibiOS/ST_NUCLEO64_F091RC/common/Device_BlockStorage.c @@ -12,10 +12,10 @@ const BlockRange BlockRange1[] = { {BlockRange_BLOCKTYPE_BOOTSTRAP, 0, 4}, // 0x08002800 nanoCLR - {BlockRange_BLOCKTYPE_CODE, 5, 84}, + {BlockRange_BLOCKTYPE_CODE, 5, 85}, - // 0x0802A800 deployment - {BlockRange_BLOCKTYPE_DEPLOYMENT, 85, 127}}; + // 0x0802B000 deployment + {BlockRange_BLOCKTYPE_DEPLOYMENT, 86, 127}}; const BlockRegionInfo BlockRegions[] = { { diff --git a/targets/ChibiOS/ST_NUCLEO64_F091RC/launch.json b/targets/ChibiOS/ST_NUCLEO64_F091RC/launch.json index 2dea792394..8f34790f8c 100644 --- a/targets/ChibiOS/ST_NUCLEO64_F091RC/launch.json +++ b/targets/ChibiOS/ST_NUCLEO64_F091RC/launch.json @@ -6,7 +6,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoBooter.elf", "setupCommands": [ { @@ -61,7 +60,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoCLR.elf", "setupCommands": [ { diff --git a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoBooter/halconf.h b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoBooter/halconf.h index 8f0ff525a3..5ecf23338f 100644 --- a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoBooter/halconf.h +++ b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoBooter/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include "mcuconf.h" @@ -461,11 +463,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -542,3 +543,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/STM32F091xC_CLR.ld b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/STM32F091xC_CLR.ld index 10f4d6018c..729f785a49 100644 --- a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/STM32F091xC_CLR.ld +++ b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/STM32F091xC_CLR.ld @@ -17,7 +17,7 @@ MEMORY { - flash0 (rx) : org = 0x08002800, len = 256k - 10k - 86k /* flash size less the space reserved for nanoBooter and application deployment*/ + flash0 (rx) : org = 0x08002800, len = 256k - 10k - 84k /* flash size less the space reserved for nanoBooter and application deployment*/ flash1 (rx) : org = 0x00000000, len = 0 flash2 (rx) : org = 0x00000000, len = 0 flash3 (rx) : org = 0x00000000, len = 0 @@ -26,7 +26,7 @@ MEMORY flash6 (rx) : org = 0x00000000, len = 0 flash7 (rx) : org = 0x00000000, len = 0 config (rw) : org = 0x00000000, len = 0 /* space reserved for configuration block */ - deployment (rx) : org = 0x0802A800, len = 86k /* space reserved for application deployment */ + deployment (rx) : org = 0x0802B000, len = 84k /* space reserved for application deployment */ ramvt (wx) : org = 0x20000000, len = 0xC0 /* initial RAM address is reserved for a copy of the vector table */ ram0 (wx) : org = 0x200000C0, len = 32k - 0xC0 - 48 /* remaining RAM is free for use */ ram1 (wx) : org = 0x00000000, len = 0 diff --git a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/halconf.h b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/halconf.h index df71b06e45..f8b5401e69 100644 --- a/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/halconf.h +++ b/targets/ChibiOS/ST_NUCLEO64_F091RC/nanoCLR/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include #include "mcuconf.h" @@ -473,11 +475,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif @@ -556,3 +557,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/common/usbcfg.h b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/common/usbcfg.h index 47d4546acb..b8c7c4b0e0 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/common/usbcfg.h +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/common/usbcfg.h @@ -7,11 +7,11 @@ #ifndef USBCFG_H #define USBCFG_H +// define which serial driver the Wire Protocol will be using +#define SERIAL_DRIVER SDU1 + extern const USBConfig usbcfg; extern SerialUSBConfig serusbcfg; extern SerialUSBDriver SDU1; -#endif /* USBCFG_H */ - -/** @} */ - +#endif // USBCFG_H diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/launch.json b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/launch.json index 7e88f202b6..1b3d1e7128 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/launch.json +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/launch.json @@ -6,7 +6,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoBooter.elf", "setupCommands": [ { @@ -61,7 +60,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoCLR.elf", "setupCommands": [ { diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/halconf.h b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/halconf.h index 07c510bffa..b70feb4ef0 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/halconf.h +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include "mcuconf.h" @@ -461,11 +463,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -543,3 +544,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c index c21ea47509..0570e276ab 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c @@ -65,8 +65,8 @@ int main(void) } // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); + sduObjectInit(&SERIAL_DRIVER); + sduStart(&SERIAL_DRIVER, &serusbcfg); // Activates the USB driver and then the USB bus pull-up on D+. // Note, a delay is inserted in order to not have to disconnect the cable after a reset. diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/halconf.h b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/halconf.h index ce2ed04e34..a4a4fcee1f 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/halconf.h +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include #include "mcuconf.h" @@ -473,11 +475,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -571,3 +572,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/main.c b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/main.c index 593ef9603a..34472acd73 100644 --- a/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/main.c +++ b/targets/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/main.c @@ -80,8 +80,8 @@ int main(void) Target_ExternalMemoryInit(); // Initializes a serial-over-USB CDC driver. - sduObjectInit(&SDU1); - sduStart(&SDU1, &serusbcfg); + sduObjectInit(&SERIAL_DRIVER); + sduStart(&SERIAL_DRIVER, &serusbcfg); // Activates the USB driver and then the USB bus pull-up on D+. // Note, a delay is inserted in order to not have to disconnect the cable after a reset diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/launch.json b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/launch.json index 13ca18f992..158a3df18b 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/launch.json +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/launch.json @@ -6,7 +6,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoBooter.elf", "setupCommands": [ { @@ -58,7 +57,6 @@ "type": "cppdbg", "request": "launch", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoCLR.elf", "setupCommands": [ { diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoBooter/halconf.h b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoBooter/halconf.h index b38a2ebd68..dcf964e115 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoBooter/halconf.h +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoBooter/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include "mcuconf.h" @@ -461,11 +463,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -542,3 +543,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/halconf.h b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/halconf.h index 90c7601a0a..a7eda430f8 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/halconf.h +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/halconf.h @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + /** * @file templates/halconf.h * @brief HAL configuration header. @@ -19,7 +21,7 @@ #define HALCONF_H #define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ +#define _CHIBIOS_HAL_CONF_VER_8_0_ #include #include "mcuconf.h" @@ -482,11 +484,10 @@ #endif /** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. + * @brief Inserts an assertion on function errors before returning. */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE +#if !defined(SPI_USE_ASSERT_ON_ERROR) || defined(__DOXYGEN__) +#define SPI_USE_ASSERT_ON_ERROR TRUE #endif /** @@ -563,3 +564,5 @@ #endif /* HALCONF_H */ /** @} */ + +// clang-format on diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/main.c b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/main.c index 992641cf02..f4b3d4ea75 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/main.c +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/nanoCLR/main.c @@ -65,7 +65,7 @@ int main(void) // this has to be called after osKernelInitialize, otherwise an hard fault will occur Target_ExternalMemoryInit(); -#if NF_FEATURE_USE_SPIFFS +#if (NF_FEATURE_USE_SPIFFS == TRUE) // config and init SPIFFS hal_spiffs_config(); #endif diff --git a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/target_windows_storage_config.h b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/target_windows_storage_config.h index a7bf747bf3..4974ef05fd 100644 --- a/targets/ChibiOS/ST_STM32F769I_DISCOVERY/target_windows_storage_config.h +++ b/targets/ChibiOS/ST_STM32F769I_DISCOVERY/target_windows_storage_config.h @@ -4,10 +4,7 @@ // // maps the SD Card driver -#define SD_CARD_DRIVER SDCD2 +#define SD_CARD_DRIVER SDCD2 // maps the SD Card detect GPIO definition (in Target_Windows_Storage.c) to board GPIO line (in board.h) -#define SDCARD_LINE_DETECT LINE_SD_DETECT - -// includes SPIFFS in storage -#define USE_SPIFFS_FOR_STORAGE FALSE +#define SDCARD_LINE_DETECT LINE_SD_DETECT diff --git a/targets/ChibiOS/_Lwip/arch/cc.h b/targets/ChibiOS/_Lwip/arch/cc.h index 203a36f750..a38bb4dcdf 100644 --- a/targets/ChibiOS/_Lwip/arch/cc.h +++ b/targets/ChibiOS/_Lwip/arch/cc.h @@ -51,4 +51,11 @@ extern void debug_printf(const char *format, ...); #endif #define LWIP_NETIF_API 1 +// disable byte order functions +#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS +#define htons(x) __builtin_bswap16(x) +#define ntohs(x) __builtin_bswap16(x) +#define htonl(x) __builtin_bswap32(x) +#define ntohl(x) __builtin_bswap32(x) + #endif // CC_H diff --git a/targets/ChibiOS/_Lwip/nf_sockets.c b/targets/ChibiOS/_Lwip/nf_sockets.c index 7435acafa0..269d0c5171 100644 --- a/targets/ChibiOS/_Lwip/nf_sockets.c +++ b/targets/ChibiOS/_Lwip/nf_sockets.c @@ -1109,6 +1109,7 @@ int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) { LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) operation in progress\n", s)); sock_set_errno(sock, err_to_errno(err)); + done_socket(sock); return -1; } // [END_NF_CHANGE] @@ -1742,8 +1743,8 @@ ssize_t lwip_send(int s, const void *data, size_t size, int flags) #endif /* (LWIP_UDP || LWIP_RAW) */ } - write_flags = (u8_t)( - NETCONN_COPY | ((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0)); + write_flags = + (u8_t)(NETCONN_COPY | ((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0)); written = 0; err = netconn_write_partly(sock->conn, data, size, write_flags, &written); @@ -1792,8 +1793,8 @@ ssize_t lwip_sendmsg(int s, const struct msghdr *msg, int flags) if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { #if LWIP_TCP - write_flags = (u8_t)( - NETCONN_COPY | ((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0)); + write_flags = + (u8_t)(NETCONN_COPY | ((flags & MSG_MORE) ? NETCONN_MORE : 0) | ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0)); written = 0; err = netconn_write_vectors_partly( @@ -4904,6 +4905,7 @@ static void lwip_socket_drop_registered_mld6_memberships(int s) uint32_t lwip_socket_get_err(int s) { struct lwip_sock *sock = get_socket(s); + done_socket(sock); return sock->err; } // [END_NF_CHANGE] diff --git a/targets/ChibiOS/_common/WireProtocol_HAL_Interface.c b/targets/ChibiOS/_common/WireProtocol_HAL_Interface.c index efbb42bdba..14c28e0625 100644 --- a/targets/ChibiOS/_common/WireProtocol_HAL_Interface.c +++ b/targets/ChibiOS/_common/WireProtocol_HAL_Interface.c @@ -16,34 +16,11 @@ extern uint32_t traceLoopCounter; #endif #if (HAL_USE_SERIAL_USB == TRUE) -#include "usbcfg.h" +#include #elif (HAL_USE_SERIAL == TRUE) #include #endif -#if (HAL_USE_SERIAL_USB == TRUE) - -void WP_ReceiveBytes(uint8_t **ptr, uint32_t *size) -{ - // save for later comparison - uint32_t requestedSize = *size; - (void)requestedSize; - - // check for request with 0 size - if (*size) - { - // read from serial stream with 100ms timeout - size_t read = chnReadTimeout(&SDU1, *ptr, requestedSize, TIME_MS2I(100)); - - *ptr += read; - *size -= read; - // Warning: Includeing TRACE_VERBOSE will NOT output the following TRACE on every loop - // of the statemachine to avoid flooding the trace. - TRACE_LIMIT(TRACE_VERBOSE, 100, "RXMSG: Expecting %d bytes, received %d.\n", requestedSize, read); - } -} -#elif (HAL_USE_SERIAL == TRUE) - void WP_ReceiveBytes(uint8_t **ptr, uint32_t *size) { // save for later comparison @@ -56,7 +33,7 @@ void WP_ReceiveBytes(uint8_t **ptr, uint32_t *size) // non blocking read from serial port with 100ms timeout size_t read = chnReadTimeout(&SERIAL_DRIVER, *ptr, requestedSize, TIME_MS2I(100)); - // Warning: Includeing TRACE_VERBOSE will NOT output the following TRACE on every loop + // Warning: Including TRACE_VERBOSE will NOT output the following TRACE on every loop // of the statemachine to avoid flooding the trace. TRACE_LIMIT(TRACE_VERBOSE, 100, "RXMSG: Expecting %d bytes, received %d.\n", requestedSize, read); @@ -65,48 +42,6 @@ void WP_ReceiveBytes(uint8_t **ptr, uint32_t *size) } } -#else -#error \ - "Wire Protocol needs a transport. Please make sure that HAL_USE_SERIAL and/or HAL_USE_SERIAL_USB are set to TRUE in 'halconf.h'" -#endif - -#if (HAL_USE_SERIAL_USB == TRUE) - -uint8_t WP_TransmitMessage(WP_Message *message) -{ - uint32_t writeResult; - bool operationResult = false; - - TRACE_WP_HEADER(WP_TXMSG, message); - - // write header to output stream - writeResult = chnWriteTimeout(&SDU1, (const uint8_t *)&message->m_header, sizeof(message->m_header), TIME_MS2I(10)); - - if (writeResult == sizeof(message->m_header)) - { - operationResult = true; - - // if there is anything on the payload send it to the output stream - if (message->m_header.m_size && message->m_payload) - { - // reset flag - operationResult = false; - - writeResult = chnWriteTimeout(&SDU1, message->m_payload, message->m_header.m_size, TIME_MS2I(50)); - - if (writeResult == message->m_header.m_size) - { - operationResult = true; - - TRACE0(TRACE_ERRORS, "TXMSG: OK\n"); - } - } - } - - return operationResult; -} -#elif (HAL_USE_SERIAL == TRUE) - uint8_t WP_TransmitMessage(WP_Message *message) { uint32_t writeResult; @@ -141,8 +76,3 @@ uint8_t WP_TransmitMessage(WP_Message *message) return operationResult; } - -#else -#error \ - "Wire Protocol needs a transport. Please make sure that HAL_USE_SERIAL and/or HAL_USE_SERIAL_USB are set to TRUE in 'halconf.h'" -#endif diff --git a/targets/ChibiOS/_common/syscalls.c b/targets/ChibiOS/_common/syscalls.c index 6f47e6fdbc..5f7144233a 100644 --- a/targets/ChibiOS/_common/syscalls.c +++ b/targets/ChibiOS/_common/syscalls.c @@ -3,61 +3,45 @@ // See LICENSE file in the project root for full license information. // -// these are stubs to keep the linker happy when these are pulled in +// these are stubs to keep the linker happy when these are pulled in #ifdef __cplusplus -extern "C" { -#endif - -/* - * _gettimeofday primitive (Stub function) - * */ - -/* - * Structure used in select() call, taken from the BSD file sys/time.h. - */ -struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ -}; - -struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -int _gettimeofday (struct timeval * tp, struct timezone * tzp) -{ - (void)tp; - - /* Return fixed data for the timezone. */ - if (tzp) - { - tzp->tz_minuteswest = 0; - tzp->tz_dsttime = 0; - } - - return 0; -} - -extern void _exit(int status) +extern "C" { - (void)status; - - for (;;); -} - -extern void _kill(int pid, int sig) -{ - (void) pid; - (void) sig; - return; -} +#endif -extern int _getpid(void) -{ - return -1; -} + /* + * _gettimeofday primitive (Stub function) + * */ + + /* + * Structure used in select() call, taken from the BSD file sys/time.h. + */ + struct timeval + { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; + + struct timezone + { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ + }; + + int _gettimeofday(struct timeval *tp, struct timezone *tzp) + { + (void)tp; + + /* Return fixed data for the timezone. */ + if (tzp) + { + tzp->tz_minuteswest = 0; + tzp->tz_dsttime = 0; + } + + return 0; + } #ifdef __cplusplus } diff --git a/targets/ChibiOS/_common/targetHAL_Network.cpp b/targets/ChibiOS/_common/targetHAL_Network.cpp index 22104ae82f..fc81188c17 100644 --- a/targets/ChibiOS/_common/targetHAL_Network.cpp +++ b/targets/ChibiOS/_common/targetHAL_Network.cpp @@ -8,35 +8,38 @@ #include #include +// this is the declaration for the callback implement in nf_sys_arch.c +extern "C" void set_signal_sock_function(void (*funcPtr)()); -// this is the declaration for the callback implement in nf_sys_arch.c -extern "C" void set_signal_sock_function( void (*funcPtr)() ); +// buffer with host name +char hostName[18] = "nanodevice_"; // // Callback from lwIP on event // void sys_signal_sock_event() { - Events_Set(SYSTEM_EVENT_FLAG_SOCKET); + Events_Set(SYSTEM_EVENT_FLAG_SOCKET); } void nanoHAL_Network_Initialize() { // Initialise the lwIP CLR signal callback - set_signal_sock_function( &sys_signal_sock_event ); + set_signal_sock_function(&sys_signal_sock_event); // get network configuration, if available - if(g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0) + if (g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0) { // there is no networking configuration block, can't proceed return; } HAL_Configuration_NetworkInterface networkConfig; - - if(ConfigurationManager_GetConfigurationBlock((void *)&networkConfig, DeviceConfigurationOption_Network, 0) == true) + + if (ConfigurationManager_GetConfigurationBlock((void *)&networkConfig, DeviceConfigurationOption_Network, 0) == + true) { - // build lwIP configuration + // build lwIP configuration lwipthread_opts lwipOptions; // init config @@ -46,14 +49,14 @@ void nanoHAL_Network_Initialize() lwipOptions.macaddress = (uint8_t *)networkConfig.MacAddress; // static or dinamic address - if(networkConfig.StartupAddressMode == AddressMode_Static) + if (networkConfig.StartupAddressMode == AddressMode_Static) { // IPv4 configs lwipOptions.address = networkConfig.IPv4Address; lwipOptions.netmask = networkConfig.IPv4NetMask; lwipOptions.gateway = networkConfig.IPv4GatewayAddress; } - else if(networkConfig.StartupAddressMode == AddressMode_DHCP) + else if (networkConfig.StartupAddressMode == AddressMode_DHCP) { // clear IPv4 configs lwipOptions.address = 0; @@ -65,8 +68,19 @@ void nanoHAL_Network_Initialize() // our enum follows lwIP defines for address mode lwipOptions.addrMode = (net_addr_mode_t)networkConfig.StartupAddressMode; - // we could consider making the device name configurable (or maybe not) - lwipOptions.ourHostName = "nanodevice"; + // compose host name with nanodevice and last 3 bytes of MAC address + // nanodevice_XXXXXX + char *macPosition = hostName + 11; + + // copy over last 3 bytes of MAC address + for (int index = 3; index < 6; index++) + { + sprintf(macPosition, "%02X", (int)networkConfig.MacAddress[index]); + macPosition += 2; + } + + // set host name + lwipOptions.ourHostName = hostName; // Start lwIP thread in ChibiOS bindings using the above options lwipInit(&lwipOptions); diff --git a/targets/ChibiOS/_include/Target_Windows_Storage.h b/targets/ChibiOS/_include/Target_Windows_Storage.h index 05f5d9ac75..26041af758 100644 --- a/targets/ChibiOS/_include/Target_Windows_Storage.h +++ b/targets/ChibiOS/_include/Target_Windows_Storage.h @@ -22,19 +22,19 @@ // and those have to follow the sequence that is used in ChibiOS FatFS wrappers // SD Card (or SPI) is 1st and USB MAS is 2nd (if SD Card is enabled) // this is also mapped in the FatFS configuration -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) #define SD_CARD_DRIVE_INDEX "0:" #define SD_CARD_DRIVE_INDEX_NUMERIC (0) #endif -#if defined(HAL_USE_SDC) && defined(HAL_USBH_USE_MSD) +#if (HAL_USE_SDC == TRUE) && defined(HAL_USBH_USE_MSD) #define USB_MSD_DRIVE_INDEX "1:" #define USB_MSD_DRIVE_INDEX_NUMERIC (1) -#elif !defined(HAL_USE_SDC) && defined(HAL_USBH_USE_MSD) +#elif !#if (HAL_USE_SDC == TRUE) && defined(HAL_USBH_USE_MSD) #define USB_MSD_DRIVE_INDEX "0:" #define USB_MSD_DRIVE_INDEX_NUMERIC (0) @@ -54,4 +54,4 @@ extern "C" } #endif -#endif //TARGET_WINDOWS_STORAGE_H +#endif // TARGET_WINDOWS_STORAGE_H diff --git a/targets/ChibiOS/_include/lwipopts.h b/targets/ChibiOS/_include/lwipopts.h index ea5cd89b44..1977c7737a 100644 --- a/targets/ChibiOS/_include/lwipopts.h +++ b/targets/ChibiOS/_include/lwipopts.h @@ -418,7 +418,7 @@ * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. */ #if !defined LWIP_RAW -#define LWIP_RAW 1 +#define LWIP_RAW 0 #endif /* diff --git a/targets/ChibiOS/_nanoBooter/WireProtocol_MonitorCommands.c b/targets/ChibiOS/_nanoBooter/WireProtocol_MonitorCommands.c index 9d9f57e0b1..f244c40de6 100644 --- a/targets/ChibiOS/_nanoBooter/WireProtocol_MonitorCommands.c +++ b/targets/ChibiOS/_nanoBooter/WireProtocol_MonitorCommands.c @@ -22,12 +22,12 @@ int AccessMemory(uint32_t location, uint32_t lengthInBytes, uint8_t *buffer, int { case AccessMemory_Write: // use FLASH driver to perform write operation - // this requires that HAL_USE_STM32_FLASH is set to TRUE on halconf_nf.h + // this requires that HAL_NF_USE_STM32_FLASH is set to TRUE on halconf_nf.h return stm32FlashWrite(location, lengthInBytes, buffer); case AccessMemory_Erase: // erase using FLASH driver - // this requires that HAL_USE_STM32_FLASH is set to TRUE on halconf_nf.h + // this requires that HAL_NF_USE_STM32_FLASH is set to TRUE on halconf_nf.h return stm32FlashErase(location); case AccessMemory_Check: diff --git a/targets/ChibiOS/_nanoCLR/System.Device.Spi/cpu_spi.cpp b/targets/ChibiOS/_nanoCLR/System.Device.Spi/cpu_spi.cpp index 2c9b0e98cc..76c5dca019 100644 --- a/targets/ChibiOS/_nanoCLR/System.Device.Spi/cpu_spi.cpp +++ b/targets/ChibiOS/_nanoCLR/System.Device.Spi/cpu_spi.cpp @@ -337,10 +337,7 @@ void GetSPIConfig(SPI_DEVICE_CONFIGURATION &config, SPI_WRITE_READ_SETTINGS &wrc } // Create the low level configuration -#if (SPI_SUPPORTS_CIRCULAR == TRUE) - llConfig->circular = SPI_USE_CIRCULAR; -#endif - llConfig->end_cb = SpiCallback; + llConfig->data_cb = SpiCallback; // make sure the CS pin is properly configured as GPIO, output & pushpull palSetPadMode(GPIO_PORT(csPin), csPin % 16, (PAL_STM32_OSPEED_HIGHEST | PAL_MODE_OUTPUT_PUSHPULL)); @@ -411,7 +408,7 @@ HRESULT CPU_SPI_nWrite_nRead( // Clear callback if sync if (sync) - palSpi->Configuration.end_cb = NULL; + palSpi->Configuration.data_cb = NULL; if (writeBuffer != NULL) { diff --git a/targets/ChibiOS/_nanoCLR/Windows.Devices.Spi/cpu_spi.cpp b/targets/ChibiOS/_nanoCLR/Windows.Devices.Spi/cpu_spi.cpp index 75f4835878..1a1a43af18 100644 --- a/targets/ChibiOS/_nanoCLR/Windows.Devices.Spi/cpu_spi.cpp +++ b/targets/ChibiOS/_nanoCLR/Windows.Devices.Spi/cpu_spi.cpp @@ -337,10 +337,7 @@ void GetSPIConfig(SPI_DEVICE_CONFIGURATION &config, SPI_WRITE_READ_SETTINGS &wrc } // Create the low level configuration -#if (SPI_SUPPORTS_CIRCULAR == TRUE) - llConfig->circular = SPI_USE_CIRCULAR; -#endif - llConfig->end_cb = SpiCallback; + llConfig->data_cb = SpiCallback; // make sure the CS pin is properly configured as GPIO, output & pushpull palSetPadMode(GPIO_PORT(csPin), csPin % 16, (PAL_STM32_OSPEED_HIGHEST | PAL_MODE_OUTPUT_PUSHPULL)); @@ -411,7 +408,7 @@ HRESULT CPU_SPI_nWrite_nRead( // Clear callback if sync if (sync) - palSpi->Configuration.end_cb = NULL; + palSpi->Configuration.data_cb = NULL; if (writeBuffer != NULL) { diff --git a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp index 53f6384214..d607895eed 100644 --- a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp +++ b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp @@ -12,7 +12,7 @@ #if (HAL_USBH_USE_MSD == TRUE) #include "usbh/dev/msd.h" #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) #include #endif @@ -51,7 +51,7 @@ struct FileOperation #if (HAL_USE_SDC == TRUE) || (HAL_USBH_USE_MSD == TRUE) FIL *FatFile; #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs_file *SpiffsFile; spiffs *SpiffsInstance; #endif @@ -106,7 +106,7 @@ static THD_FUNCTION(ReadTextWorkingThread, arg) platform_free(fileIoOperation->FatFile); } #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (fileIoOperation->SpiffsFile != NULL) { uint32_t bytesRead = SPIFFS_read( @@ -181,7 +181,7 @@ static THD_FUNCTION(WriteTextWorkingThread, arg) platform_free(fileIoOperation->FatFile); } #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (fileIoOperation->SpiffsFile != NULL) { if (SPIFFS_write( @@ -254,7 +254,7 @@ static THD_FUNCTION(WriteBinaryWorkingThread, arg) platform_free(fileIoOperation->FatFile); } #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (fileIoOperation->SpiffsFile != NULL) { if (SPIFFS_write( @@ -328,7 +328,7 @@ static THD_FUNCTION(ReadBinaryWorkingThread, arg) platform_free(fileIoOperation->FatFile); } #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (fileIoOperation->SpiffsFile != NULL) { uint32_t bytesRead = SPIFFS_read( @@ -398,7 +398,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: FIL *fatFile = NULL; FRESULT operationResult; #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs_file *spiffsFile = NULL; spiffs *driveFs = NULL; int32_t driveIndex; @@ -431,7 +431,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -502,7 +502,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: #if ((HAL_USE_SDC == TRUE) || (HAL_USBH_USE_MSD == TRUE)) fileIoOperation->FatFile = fatFile; #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) fileIoOperation->SpiffsFile = spiffsFile; fileIoOperation->SpiffsInstance = driveFs; #endif @@ -598,7 +598,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO::WriteText___STATIC__V FIL *fatFile = NULL; FRESULT operationResult; #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs_file *spiffsFile = NULL; spiffs *driveFs = NULL; int32_t driveIndex; @@ -627,7 +627,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO::WriteText___STATIC__V if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -695,7 +695,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO::WriteText___STATIC__V #if ((HAL_USE_SDC == TRUE) || (HAL_USBH_USE_MSD == TRUE)) fileIoOperation->FatFile = fatFile; #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) fileIoOperation->SpiffsFile = spiffsFile; fileIoOperation->SpiffsInstance = driveFs; #endif @@ -790,7 +790,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: FIL *fatFile = NULL; FRESULT operationResult; #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs_file *spiffsFile = NULL; spiffs *driveFs = NULL; int32_t driveIndex; @@ -816,7 +816,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -908,7 +908,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: #if ((HAL_USE_SDC == TRUE) || (HAL_USBH_USE_MSD == TRUE)) fileIoOperation->FatFile = fatFile; #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) fileIoOperation->SpiffsFile = spiffsFile; fileIoOperation->SpiffsInstance = driveFs; #endif @@ -1003,7 +1003,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: FIL *fatFile = NULL; FRESULT operationResult; #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs_file *spiffsFile = NULL; spiffs *driveFs = NULL; int32_t driveIndex; @@ -1029,7 +1029,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -1121,7 +1121,7 @@ HRESULT Library_win_storage_native_Windows_Storage_FileIO:: #if ((HAL_USE_SDC == TRUE) || (HAL_USBH_USE_MSD == TRUE)) fileIoOperation->FatFile = fatFile; #endif -#if USE_SPIFFS_FOR_STORAGE +#if (NF_FEATURE_USE_SPIFFS == TRUE) fileIoOperation->SpiffsFile = spiffsFile; fileIoOperation->SpiffsInstance = driveFs; #endif diff --git a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFile.cpp b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFile.cpp index c171dfe06b..970e8a6052 100644 --- a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFile.cpp +++ b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFile.cpp @@ -12,7 +12,7 @@ #if (HAL_USBH_USE_MSD == TRUE) #include "usbh/dev/msd.h" #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) #include #endif @@ -27,7 +27,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile::DeleteFileNative const char *workingPath; char *workingBuffer = NULL; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs *driveFs = NULL; int32_t driveIndex; #endif @@ -46,7 +46,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile::DeleteFileNative if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -108,7 +108,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile::RenameFileNative char *workingBuffer = NULL; char *workingBuffer1 = NULL; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs *driveFs = NULL; int32_t driveIndex; #endif @@ -130,7 +130,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile::RenameFileNative if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... @@ -215,7 +215,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile:: const char *filePath; const char *fileName; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs *driveFs = NULL; int32_t driveIndex; #endif @@ -232,7 +232,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFile:: if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS drive workflow // get SPIFFS drive index... diff --git a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp index ecd825399d..3b4054d0b9 100644 --- a/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp +++ b/targets/ChibiOS/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_StorageFolder.cpp @@ -13,7 +13,7 @@ #if (HAL_USBH_USE_MSD == TRUE) #include "usbh/dev/msd.h" #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) #include #endif @@ -24,7 +24,7 @@ extern bool sdCardFileSystemReady; #if (HAL_USBH_USE_MSD == TRUE) extern bool usbMsdFileSystemReady; #endif -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) extern bool spiffsFileSystemReady; #endif @@ -244,7 +244,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: CLR_RT_HeapBlock *hbObj; CLR_RT_HeapBlock &top = stack.PushValue(); -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) // is the SPIFFS file system available and mounted? if (spiffsFileSystemReady) { @@ -353,7 +353,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: // failed to change drive // check if the working drive is the SPIFFS drive -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { // this is the SPIFFS drive, @@ -485,7 +485,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // SPIFFS doesn't support folders so return an empty collection CLR_RT_HeapBlock &top = stack.PushValue(); @@ -542,7 +542,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: uint32_t maxItemsToRetrieve; uint32_t itemIndex = 0; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs *driveFs = NULL; int32_t driveIndex = -1; #endif @@ -581,7 +581,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: // check if the working drive is the SPIFFS drive and... // ... that the path is the drive root (because SPIFFS doesn't support folders) -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if ((WORKING_DRIVE_IS_INTERNAL_DRIVE) && (hal_strlen_s(workingPath) == DRIVE_PATH_LENGTH - 1)) { // get SPIFFS drive index... @@ -842,7 +842,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) CLR_RT_HeapBlock &top = stack.PushValue(); @@ -975,7 +975,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: CreationCollisionOption options; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) spiffs *driveFs = NULL; int32_t driveIndex; #endif @@ -1034,7 +1034,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: if (operationResult == FR_INVALID_DRIVE) { // check if the working drive is the SPIFFS drive -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { // this is the SPIFFS drive @@ -1220,7 +1220,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // get a pointer to the managed object instance and check that it's not NULL CLR_RT_HeapBlock *pThis = stack.This(); @@ -1473,7 +1473,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder:: NANOCLR_SET_AND_LEAVE(CLR_E_FILE_IO); } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // throw not supported exception because folders aren't supported in SPIFFS NANOCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED); @@ -1556,7 +1556,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::DeleteFolderNa else if (operationResult != FR_OK) { // folder doesn't exist -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { // this is the SPIFFS drive @@ -1572,7 +1572,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::DeleteFolderNa } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // throw not supported exception because folders aren't supported in SPIFFS NANOCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED); @@ -1625,7 +1625,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::RenameFolderNa else if (operationResult != FR_OK) { // folder doesn't exist -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { // this is the SPIFFS drive @@ -1641,7 +1641,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::RenameFolderNa } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // throw not supported exception because folders aren't supported in SPIFFS NANOCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED); @@ -1665,7 +1665,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::GetFolderNativ const char *workingPath; char *folderPath = NULL; -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) char workingDrive[DRIVE_LETTER_LENGTH]; #endif @@ -1707,7 +1707,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::GetFolderNativ if (operationResult != FR_OK) { // folder doesn't exist -#if (USE_SPIFFS_FOR_STORAGE == TRUE) +#if (NF_FEATURE_USE_SPIFFS == TRUE) if (WORKING_DRIVE_IS_INTERNAL_DRIVE) { // this is the SPIFFS drive @@ -1763,7 +1763,7 @@ HRESULT Library_win_storage_native_Windows_Storage_StorageFolder::GetFolderNativ } } -#elif (USE_SPIFFS_FOR_STORAGE == TRUE) +#elif (NF_FEATURE_USE_SPIFFS == TRUE) // throw not supported exception because folders aren't supported in SPIFFS NANOCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED); diff --git a/targets/ChibiOS/_nf-overlay/README.md b/targets/ChibiOS/_nf-overlay/README.md index 460e0849dc..38ae841b73 100644 --- a/targets/ChibiOS/_nf-overlay/README.md +++ b/targets/ChibiOS/_nf-overlay/README.md @@ -3,7 +3,7 @@ This folder contains code that _extends_ ChibiOS features/functionalities for the purpose of **nanoFramework**. ChibiOS core code is architecture to include seamless integration of third party code (HAL drivers, boards, etc). That is explained [here](http://wiki.chibios.org/dokuwiki/doku.php?id=chibios:community:guides:community_overlay). The structure below this folder mimics the structure and organization of ChibiOS Community overlay. -Note that this is designed in a way that in order to use a specific driver, the only thing that a developer has to do is enable the corresponding define in the HAL configuration file at the target folder e.g. HAL_USE_STM32_FLASH in order to enable the flash driver. +Note that this is designed in a way that in order to use a specific driver, the only thing that a developer has to do is enable the corresponding define in the HAL configuration file at the target folder e.g. HAL_NF_USE_STM32_FLASH in order to enable the flash driver. ## Adding components to **nanoFramework** overlay diff --git a/targets/ChibiOS/_nf-overlay/os/hal/src/stm32_fsmc/hal_stm32_fsmc.c b/targets/ChibiOS/_nf-overlay/os/hal/src/stm32_fsmc/hal_stm32_fsmc.c index 65f60e5b16..237615e717 100644 --- a/targets/ChibiOS/_nf-overlay/os/hal/src/stm32_fsmc/hal_stm32_fsmc.c +++ b/targets/ChibiOS/_nf-overlay/os/hal/src/stm32_fsmc/hal_stm32_fsmc.c @@ -135,10 +135,10 @@ void fsmc_stop(FSMCDriver *fsmcp) } // FSMC shared interrupt handler. -CH_IRQ_HANDLER(STM32_FSMC_HANDLER) +OSAL_IRQ_HANDLER(STM32_FSMC_HANDLER) { - CH_IRQ_PROLOGUE(); + OSAL_IRQ_PROLOGUE(); #if STM32_NAND_USE_FSMC_NAND1 if (FSMCD1.nand1->SR & FSMC_SR_ISR_MASK) { @@ -151,7 +151,7 @@ CH_IRQ_HANDLER(STM32_FSMC_HANDLER) NANDD2.isr_handler(&NANDD2); } #endif - CH_IRQ_EPILOGUE(); + OSAL_IRQ_EPILOGUE(); } #endif /* HAL_NF_USE_FSMC */ diff --git a/targets/ChibiOS/_nf-overlay/stm32-internal-flash-driver.md b/targets/ChibiOS/_nf-overlay/stm32-internal-flash-driver.md index 13a8b260b2..22c193bf28 100644 --- a/targets/ChibiOS/_nf-overlay/stm32-internal-flash-driver.md +++ b/targets/ChibiOS/_nf-overlay/stm32-internal-flash-driver.md @@ -2,12 +2,13 @@ This driver enables **nanoFramework** to access the internal flash for STM32 parts taking care of the low level details and implementation specifics. -In order to enable/use it the developer has to set HAL_USE_STM32_FLASH to TRUE on the halconf_nf.h provided in the reference implementations. -_Note: to enable the driver the developer has to also enable the HAL_USE_COMMUNITY 'master switch' on that same file._ +In order to enable/use it the developer has to set HAL_NF_USE_STM32_FLASH to TRUE on the halconf_nf.h provided in the reference implementations. -There are currently two versions of the driver: +The following versions of the driver are available: - FLASHv1: suitable for F0 series -- FLASHv2: suitable for F4 series +- FLASHv2: suitable for F4 and F7 series +- FLASHv3: suitable for L0 series +- FLASHv4: suitable for L4 series The functions provided by driver are: diff --git a/targets/ESP32/CMakeLists.txt b/targets/ESP32/CMakeLists.txt index 964af4410a..eb1d4a45b3 100644 --- a/targets/ESP32/CMakeLists.txt +++ b/targets/ESP32/CMakeLists.txt @@ -23,7 +23,7 @@ if(ESP32_IDF_PATH) endif() # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS -set(ESP32_IDF_TAG "4.3.1" CACHE INTERNAL "ESP32 IDF tag") +set(ESP32_IDF_TAG "4.3.2" CACHE INTERNAL "ESP32 IDF tag") if(NO_ESP32_IDF_PATH) # no ESP32 IDF source specified, download it from official repo @@ -39,23 +39,20 @@ if(NO_ESP32_IDF_PATH) else() # ESP32 IDF source was specified - # sanity check if source path exists - if(EXISTS "${ESP32_IDF_PATH}/") - message(STATUS "ESP32 IDF v${ESP32_IDF_TAG} source from: ${ESP32_IDF_PATH}") + message(STATUS "ESP32 IDF v${ESP32_IDF_TAG} source from: ${ESP32_IDF_PATH}") - FetchContent_Declare( - esp32_idf - SOURCE_DIR ${ESP32_IDF_PATH} - ) - - else() - message(FATAL_ERROR "Couldn't find ESP32 IDF source at ${ESP32_IDF_PATH}/") - endif() + FetchContent_Declare( + esp32_idf + SOURCE_DIR ${ESP32_IDF_PATH} + ) endif() FetchContent_GetProperties(esp32_idf) -FetchContent_Populate(esp32_idf) +if(NOT esp32_idf_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(esp32_idf) +endif() # add IDF CMake dir to modules path list(APPEND CMAKE_MODULE_PATH ${esp32_idf_SOURCE_DIR}/CMake) @@ -100,7 +97,7 @@ if(NF_SECURITY_MBEDTLS) # set tag for currently supported version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(MBEDTLS_GIT_TAG "mbedtls-2.26.0") + set(MBEDTLS_GIT_TAG "mbedtls-2.28.0") # set options for mbed TLS option(ENABLE_TESTING "no testing when building mbed TLS." OFF) @@ -117,26 +114,21 @@ if(NF_SECURITY_MBEDTLS) else() # mbedTLS source was specified - # message(FATAL_ERROR ${mbedtls_SOURCE_DIR}") - - # sanity check is source path exists - if(EXISTS ${MBEDTLS_SOURCE}/) message(STATUS "mbedTLS ${MBEDTLS_GIT_TAG} (source from: ${MBEDTLS_SOURCE})") - FetchContent_Declare( - mbedtls - SOURCE_DIR ${MBEDTLS_SOURCE} - ) - - else() - message(FATAL_ERROR "Couldn't find mbedTLS source at ${MBEDTLS_SOURCE}/") - endif() + FetchContent_Declare( + mbedtls + SOURCE_DIR ${MBEDTLS_SOURCE} + ) endif() FetchContent_GetProperties(mbedtls) - FetchContent_Populate(mbedtls) + if(NOT mbedtls_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(mbedtls) + endif() set(mbedTLS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/3rdparty/humblelogging/include) set(mbedTLS_LIBRARIES ${CMAKE_SHARED_LIBRARY_PREFIX}mbedTLS${CMAKE_SHARED_LIBRARY_SUFFIX}) diff --git a/targets/ESP32/ESP32/cmake-variants.json b/targets/ESP32/ESP32/cmake-variants.json index e53d921ce9..8831ac70ca 100644 --- a/targets/ESP32/ESP32/cmake-variants.json +++ b/targets/ESP32/ESP32/cmake-variants.json @@ -48,7 +48,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -65,7 +65,8 @@ "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", - "API_nanoFramework.Graphics": "OFF" + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "ESP32_REV0": { @@ -94,7 +95,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -111,7 +112,8 @@ "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", - "API_nanoFramework.Graphics": "OFF" + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "ESP32_BLE_REV0": { @@ -124,7 +126,7 @@ "TARGET_SERIES": "ESP32", "TARGET_BOARD": "ESP32", "TARGET_NAME": "ESP32_BLE_REV0", - "SDK_CONFIG_FILE": "sdkconfig.default_ble.esp32", + "SDK_CONFIG_FILE": "sdkconfig.default_nopsram_ble.esp32", "ESP32_IDF_PATH": "", "RTOS": "ESP32", "NF_BUILD_RTM": "OFF", @@ -141,7 +143,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -159,7 +161,7 @@ "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "ON" + "API_nanoFramework.Device.Bluetooth": "ON" } }, "ESP32_PICO": { @@ -190,7 +192,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -208,7 +210,7 @@ "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "ON" + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "ESP_WROVER_KIT": { @@ -236,7 +238,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -253,6 +255,7 @@ "API_Windows.Storage": "ON", "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", "API_nanoFramework.Graphics": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", "TOUCHPANEL_DEVICE": "XPT2046.cpp", @@ -285,7 +288,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -302,6 +305,7 @@ "API_Windows.Storage": "ON", "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", "API_nanoFramework.Graphics": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", "TOUCHPANEL_DEVICE": "XPT2046.cpp", @@ -309,6 +313,56 @@ "TOUCHPANEL_INTERFACE": "Spi_To_TouchPanel.cpp" } }, + "M5Core2": { + "short": "M5Core2", + "settings": { + "BUILD_VERSION": "0.9.99.999", + "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.xtensa-esp32-elf.cmake", + "TARGET_SERIES": "ESP32", + "TARGET_BOARD": "ESP32", + "TARGET_NAME": "M5Core2", + "SDK_CONFIG_FILE": "sdkconfig.default_ble_rev3.esp32", + "ESP32_IDF_PATH": "E:/GitHub/esp-idf", + "RTOS": "ESP32", + "NF_BUILD_RTM": "OFF", + "NF_FEATURE_DEBUGGER": "ON", + "NF_FEATURE_RTC": "ON", + "NF_FEATURE_SUPPORT_REFLECTION": "ON", + "NF_FEATURE_HAS_CONFIG_BLOCK": "ON", + "NF_FEATURE_HAS_SDCARD": "ON", + "SUPPORT_ANY_BASE_CONVERSION": "ON", + "API_System.Net": "ON", + "NF_SECURITY_MBEDTLS": "ON", + "MBEDTLS_SOURCE": "", + "API_System.Math": "ON", + "API_nanoFramework.ResourceManager": "ON", + "API_nanoFramework.System.Collections": "ON", + "API_nanoFramework.System.Text": "ON", + "API_System.Device.WiFi": "ON", + "API_Windows.Devices.Adc": "ON", + "API_System.Device.Adc": "ON", + "API_System.Device.Dac": "ON", + "API_Windows.Devices.Gpio": "ON", + "API_System.Device.Gpio": "ON", + "API_Windows.Devices.I2c": "ON", + "API_System.Device.I2c": "ON", + "API_Windows.Devices.Pwm": "ON", + "API_System.Device.Pwm": "ON", + "API_Windows.Devices.SerialCommunication": "ON", + "API_System.IO.Ports": "ON", + "API_Windows.Devices.Spi": "ON", + "API_System.Device.Spi": "ON", + "API_Windows.Storage": "ON", + "API_Hardware.Esp32": "ON", + "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "ON", + "API_nanoFramework.Graphics": "ON", + "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", + "TOUCHPANEL_DEVICE": "XPT2046.cpp", + "GRAPHICS_DISPLAY_INTERFACE": "Spi_To_Display.cpp", + "TOUCHPANEL_INTERFACE": "Spi_To_TouchPanel.cpp" + } + }, "ESP32_LILYGO": { "short": "ESP32_LILYGO", "settings": { @@ -338,7 +392,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -356,7 +410,7 @@ "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "ON", "API_nanoFramework.Graphics": "OFF", - "API_nanoFramework.Hardware.Esp32.Ble": "OFF" + "API_nanoFramework.Device.Bluetooth": "OFF" } } } diff --git a/targets/ESP32/ESP32/ffconf.h b/targets/ESP32/ESP32/ffconf.h index eadb60bfa4..0dbd625ead 100644 --- a/targets/ESP32/ESP32/ffconf.h +++ b/targets/ESP32/ESP32/ffconf.h @@ -10,7 +10,7 @@ #include #include -#if !defined(HAL_USE_SDC) +#if (HAL_USE_SDC != TRUE) // need this include here when not using SDCARD so it can load the one from IDF #include #endif diff --git a/targets/ESP32/ESP32_S2/cmake-variants.json b/targets/ESP32/ESP32_S2/cmake-variants.json index 481fa5d373..7aa78cfa57 100644 --- a/targets/ESP32/ESP32_S2/cmake-variants.json +++ b/targets/ESP32/ESP32_S2/cmake-variants.json @@ -53,7 +53,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -69,7 +69,8 @@ "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", "API_nanoFramework.Devices.OneWire": "OFF", - "API_nanoFramework.Graphics": "OFF" + "API_nanoFramework.Graphics": "OFF", + "API_nanoFramework.Device.Bluetooth": "OFF" } }, "KALUGA_1": { @@ -98,7 +99,7 @@ "API_nanoFramework.ResourceManager": "ON", "API_nanoFramework.System.Collections": "ON", "API_nanoFramework.System.Text": "ON", - "API_Windows.Devices.Wifi": "ON", + "API_System.Device.WiFi": "ON", "API_Windows.Devices.Adc": "ON", "API_System.Device.Adc": "ON", "API_System.Device.Dac": "ON", @@ -113,6 +114,7 @@ "API_System.Device.Spi": "ON", "API_Hardware.Esp32": "ON", "API_nanoFramework.Hardware.Esp32.Rmt": "ON", + "API_nanoFramework.Device.Bluetooth": "OFF", "API_nanoFramework.Devices.OneWire": "OFF", "API_nanoFramework.Graphics": "ON", "GRAPHICS_DISPLAY": "ILI9341_240x320_SPI.cpp", diff --git a/targets/ESP32/ESP32_S2/ffconf.h b/targets/ESP32/ESP32_S2/ffconf.h index a0521eb4ec..aaf7d49a53 100644 --- a/targets/ESP32/ESP32_S2/ffconf.h +++ b/targets/ESP32/ESP32_S2/ffconf.h @@ -10,7 +10,7 @@ #include #include -#if !defined(HAL_USE_SDC) +#if (HAL_USE_SDC != TRUE) // need this include here when not using SDCARD so it can load the one from IDF #include #endif diff --git a/targets/ESP32/_IDF/esp32/app_main.c b/targets/ESP32/_IDF/esp32/app_main.c index 063448a7ee..0e62ae92a2 100644 --- a/targets/ESP32/_IDF/esp32/app_main.c +++ b/targets/ESP32/_IDF/esp32/app_main.c @@ -61,7 +61,7 @@ void app_main() ESP_ERROR_CHECK(nvs_flash_init()); // start receiver task pinned to core 1 - xTaskCreatePinnedToCore(&receiver_task, "ReceiverThread", 2048, NULL, 5, NULL, 1); + xTaskCreatePinnedToCore(&receiver_task, "ReceiverThread", 3072, NULL, 5, NULL, 1); // start the CLR main task pinned to core 0 xTaskCreatePinnedToCore(&main_task, "main_task", 15000, NULL, 5, NULL, 0); diff --git a/targets/ESP32/_IDF/sdkconfig.default b/targets/ESP32/_IDF/sdkconfig.default index 9257cc2fd3..d677fdb5a7 100644 --- a/targets/ESP32/_IDF/sdkconfig.default +++ b/targets/ESP32/_IDF/sdkconfig.default @@ -559,7 +559,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -597,7 +597,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -621,7 +621,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -652,7 +652,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default.esp32 b/targets/ESP32/_IDF/sdkconfig.default.esp32 index 614b4c8b96..16139c13b0 100644 --- a/targets/ESP32/_IDF/sdkconfig.default.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default.esp32 @@ -642,7 +642,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -680,7 +680,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -704,7 +704,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -735,7 +735,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default.esp32s2 b/targets/ESP32/_IDF/sdkconfig.default.esp32s2 index 1f316c6766..22345f235b 100644 --- a/targets/ESP32/_IDF/sdkconfig.default.esp32s2 +++ b/targets/ESP32/_IDF/sdkconfig.default.esp32s2 @@ -660,7 +660,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -698,7 +698,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -722,7 +722,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -753,7 +753,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_ble.esp32 b/targets/ESP32/_IDF/sdkconfig.default_ble.esp32 index 76d6d277af..f042e6dbdd 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_ble.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default_ble.esp32 @@ -655,7 +655,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -693,7 +693,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -717,7 +717,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -748,7 +748,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_ble _rev3.esp32 b/targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 similarity index 98% rename from targets/ESP32/_IDF/sdkconfig.default_ble _rev3.esp32 rename to targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 index b822a74bcf..3ee9bac7ce 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_ble _rev3.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 @@ -129,7 +129,6 @@ CONFIG_PARTITION_TABLE_MD5=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG=y CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set @@ -243,9 +242,6 @@ CONFIG_EFUSE_MAX_BLK_LEN=256 # # ESP32-specific # -# CONFIG_ESP32_REV_MIN_0 is not set -# CONFIG_ESP32_REV_MIN_1 is not se -# CONFIG_ESP32_REV_MIN_2 is not set CONFIG_ESP32_REV_MIN_3=y CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y @@ -264,7 +260,7 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=n CONFIG_SPIRAM_SIZE=-1 CONFIG_SPIRAM_SPEED_40M=y # CONFIG_SPIRAM_MEMTEST is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y +# CONFIG_SPIRAM_CACHE_WORKAROUND is not set CONFIG_SPIRAM_BANKSWITCH_ENABLE=y CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 @@ -484,7 +480,7 @@ CONFIG_WIFI_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_WIFI_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_WIFI_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_RX_IRAM_OPT=n CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_FTM_ENABLE is not set @@ -658,7 +654,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -696,7 +692,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -720,7 +716,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -751,7 +747,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32 b/targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32 index 7b58f7279b..fcba013375 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default_nopsram.esp32 @@ -625,7 +625,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -663,7 +663,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -687,7 +687,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -718,7 +718,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32 b/targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32 new file mode 100644 index 0000000000..a7ff88641a --- /dev/null +++ b/targets/ESP32/_IDF/sdkconfig.default_nopsram_ble.esp32 @@ -0,0 +1,1445 @@ +# +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 + +# +# SDK tool configuration +# +CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set +# end of SDK tool configuration + +# +# Build type +# +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +CONFIG_APP_BUILD_GENERATE_BINARIES=y +CONFIG_APP_BUILD_BOOTLOADER=y +CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# end of Build type + +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +# +# Bootloader config +# +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set +CONFIG_BOOTLOADER_LOG_LEVEL=3 +# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set +CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y +# CONFIG_BOOTLOADER_FACTORY_RESET is not set +# CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_WDT_ENABLE=y +# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set +CONFIG_BOOTLOADER_WDT_TIME_MS=9000 +# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set +CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 +# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set +# end of Bootloader config + +# +# Security features +# +# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set +# CONFIG_SECURE_BOOT is not set +# CONFIG_SECURE_FLASH_ENC_ENABLED is not set +# end of Security features + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +# CONFIG_ESPTOOLPY_NO_STUB is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="40m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B=y +# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_MONITOR_BAUD=921600 +# end of Serial flasher config + +# +# Partition Table +# +CONFIG_PARTITION_TABLE_SINGLE_APP=y +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table + +# +# Compiler options +# +# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set +CONFIG_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set +# end of Compiler options + +# +# Component config +# + +# +# Application Level Tracing +# +# CONFIG_APPTRACE_DEST_TRAX is not set +CONFIG_APPTRACE_DEST_NONE=y +CONFIG_APPTRACE_LOCK_ENABLE=y +# end of Application Level Tracing + +# +# ESP-ASIO +# +# CONFIG_ASIO_SSL_SUPPORT is not set +# end of ESP-ASIO + +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_CTRL_ESP32=y + +# +# Bluetooth controller(ESP32 Dual Mode Bluetooth) +# +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set +# CONFIG_BTDM_CTRL_MODE_BTDM is not set +CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 +CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 +CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 +CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 +CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 +CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set +CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 +CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y +# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set + +# +# MODEM SLEEP Options +# +CONFIG_BTDM_CTRL_MODEM_SLEEP=y +CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG=y +# CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED is not set +CONFIG_BTDM_CTRL_LPCLK_SEL_MAIN_XTAL=y +# end of MODEM SLEEP Options + +CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y +CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 +CONFIG_BTDM_BLE_SCAN_DUPL=y +CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set +CONFIG_BTDM_SCAN_DUPL_TYPE=0 +CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=200 +# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set +CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +# end of Bluetooth controller(ESP32 Dual Mode Bluetooth) + +CONFIG_BT_CTRL_MODE_EFF=1 +CONFIG_BT_CTRL_BLE_MAX_ACT=10 +CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 +CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 +CONFIG_BT_CTRL_PINNED_TO_CORE=0 +CONFIG_BT_CTRL_HCI_TL=1 +CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 +CONFIG_BT_CTRL_HW_CCA_EFF=0 +CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=0 +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +CONFIG_BT_CTRL_BLE_SCAN_DUPL=y +CONFIG_BT_CTRL_SCAN_DUPL_TYPE=0 +CONFIG_BT_CTRL_SCAN_DUPL_CACHE_SIZE=100 + +# +# MODEM SLEEP Options +# +# end of MODEM SLEEP Options + +CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 +CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 +CONFIG_BT_CTRL_HCI_TL_EFF=1 + +# +# MODEM SLEEP Options +# +# end of MODEM SLEEP Options + +# CONFIG_BT_BLUEDROID_ENABLED is not set +CONFIG_BT_NIMBLE_ENABLED=y +# CONFIG_BT_CONTROLLER_ONLY is not set +CONFIG_BT_RESERVE_DRAM=0xdb5c + +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y +# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set +# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set +# CONFIG_BT_NIMBLE_LOG_LEVEL_CRIT is not set +# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set +# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set +CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y +# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set +CONFIG_BT_NIMBLE_LOG_LEVEL=1 +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 +CONFIG_BT_NIMBLE_MAX_BONDS=3 +CONFIG_BT_NIMBLE_MAX_CCCDS=8 +CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 +CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y +# CONFIG_BT_NIMBLE_PINNED_TO_CORE_1 is not set +CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 +CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096 +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +CONFIG_BT_NIMBLE_SM_LEGACY=y +CONFIG_BT_NIMBLE_SM_SC=y +# CONFIG_BT_NIMBLE_DEBUG is not set +# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set +CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" +CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 +CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256 +CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0 +CONFIG_BT_NIMBLE_ACL_BUF_COUNT=10 +CONFIG_BT_NIMBLE_ACL_BUF_SIZE=255 +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=20 +CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 +CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=12 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL=y +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL=1000 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH=2 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT=y +CONFIG_BT_NIMBLE_RPA_TIMEOUT=900 +# CONFIG_BT_NIMBLE_MESH is not set +CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y +CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS=2000 +# CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT is not set +CONFIG_BT_NIMBLE_USE_ESP_TIMER=y +# CONFIG_BT_NIMBLE_BLUFI_ENABLE is not set +# end of NimBLE Options +# end of Bluetooth + +# CONFIG_BLE_MESH is not set + +# +# CoAP Configuration +# +CONFIG_COAP_MBEDTLS_PSK=y +# CONFIG_COAP_MBEDTLS_PKI is not set +# CONFIG_COAP_MBEDTLS_DEBUG is not set +CONFIG_COAP_LOG_DEFAULT_LEVEL=0 +# end of CoAP Configuration + +# +# Driver configurations +# + +# +# ADC configuration +# +# CONFIG_ADC_FORCE_XPD_FSM is not set +CONFIG_ADC_DISABLE_DAC=y +# end of ADC configuration + +# +# SPI configuration +# +# CONFIG_SPI_MASTER_IN_IRAM is not set +CONFIG_SPI_MASTER_ISR_IN_IRAM=y +# CONFIG_SPI_SLAVE_IN_IRAM is not set +CONFIG_SPI_SLAVE_ISR_IN_IRAM=y +# end of SPI configuration + +# +# TWAI configuration +# +# CONFIG_TWAI_ISR_IN_IRAM is not set +# CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set +# CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set +# end of TWAI configuration + +# +# UART configuration +# +CONFIG_UART_ISR_IN_IRAM=y +# end of UART configuration + +# +# RTCIO configuration +# +# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set +# end of RTCIO configuration + +# +# GPIO Configuration +# +# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# end of GPIO Configuration +# end of Driver configurations + +# +# eFuse Bit Manager +# +# CONFIG_EFUSE_CUSTOM_TABLE is not set +# CONFIG_EFUSE_VIRTUAL is not set +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set +CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set +CONFIG_EFUSE_MAX_BLK_LEN=192 +# end of eFuse Bit Manager + +# +# ESP-TLS +# +CONFIG_ESP_TLS_USING_MBEDTLS=y +# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_SERVER is not set +# CONFIG_ESP_TLS_PSK_VERIFICATION is not set +# CONFIG_ESP_TLS_INSECURE is not set +# end of ESP-TLS + +# +# ESP32-specific +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_DPORT_WORKAROUND=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +# CONFIG_ESP32_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +CONFIG_ESP32_ULP_COPROC_ENABLED=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=512 +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_ESP32_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP32_BROWNOUT_DET_LVL=0 +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_26 is not set +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set +CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 +# end of ESP32-specific + +# +# ADC-Calibration +# +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# end of ADC-Calibration + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3584 +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +# CONFIG_ESP_TASK_WDT is not set +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +# end of Common ESP-related + +# +# Ethernet +# +CONFIG_ETH_ENABLED=y +CONFIG_ETH_USE_ESP32_EMAC=y +CONFIG_ETH_PHY_INTERFACE_RMII=y +# CONFIG_ETH_PHY_INTERFACE_MII is not set +CONFIG_ETH_RMII_CLK_INPUT=y +# CONFIG_ETH_RMII_CLK_OUTPUT is not set +CONFIG_ETH_RMII_CLK_IN_GPIO=0 +CONFIG_ETH_DMA_BUFFER_SIZE=512 +CONFIG_ETH_DMA_RX_BUFFER_NUM=10 +CONFIG_ETH_DMA_TX_BUFFER_NUM=10 +CONFIG_ETH_USE_SPI_ETHERNET=y +# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_USE_OPENETH is not set +# end of Ethernet + +# +# Event Loop Library +# +# CONFIG_ESP_EVENT_LOOP_PROFILING is not set +CONFIG_ESP_EVENT_POST_FROM_ISR=y +CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y +# end of Event Loop Library + +# +# GDB Stub +# +# end of GDB Stub + +# +# ESP HTTP client +# +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# end of ESP HTTP client + +# +# HTTP Server +# +CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 +CONFIG_HTTPD_MAX_URI_LEN=512 +CONFIG_HTTPD_ERR_RESP_NO_DELAY=y +CONFIG_HTTPD_PURGE_BUF_LEN=32 +# CONFIG_HTTPD_LOG_PURGE_DATA is not set +# CONFIG_HTTPD_WS_SUPPORT is not set +# end of HTTP Server + +# +# ESP HTTPS OTA +# +# CONFIG_OTA_ALLOW_HTTP is not set +# end of ESP HTTPS OTA + +# +# ESP HTTPS server +# +# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set +# end of ESP HTTPS server + +# +# ESP NETIF Adapter +# +CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 +CONFIG_ESP_NETIF_TCPIP_LWIP=y +# CONFIG_ESP_NETIF_LOOPBACK is not set +# CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set +# end of ESP NETIF Adapter + +# +# Power Management +# +CONFIG_PM_ENABLE=y +# CONFIG_PM_DFS_INIT_AUTO is not set +# CONFIG_PM_PROFILING is not set +# CONFIG_PM_TRACE is not set +# CONFIG_PM_SLP_IRAM_OPT is not set +# CONFIG_PM_RTOS_IDLE_OPT is not set +# CONFIG_PM_SLP_DISABLE_GPIO is not set +# end of Power Management + +# +# ESP System Settings +# +# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set +CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +CONFIG_ESP_SYSTEM_PD_FLASH=y + +# +# Memory protection +# +# end of Memory protection +# end of ESP System Settings + +# +# High resolution timer (esp_timer) +# +# CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 +# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +# end of High resolution timer (esp_timer) + +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=6 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=6 +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_WIFI_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_WIFI_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_WIFI_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_WIFI_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_WIFI_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_WIFI_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_ESP32_WIFI_IRAM_OPT=y +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# end of Wi-Fi + +# +# PHY +# +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +# end of PHY + +# +# Core dump +# +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# end of Core dump + +# +# FAT Filesystem support +# +# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set +CONFIG_FATFS_CODEPAGE_437=y +# CONFIG_FATFS_CODEPAGE_720 is not set +# CONFIG_FATFS_CODEPAGE_737 is not set +# CONFIG_FATFS_CODEPAGE_771 is not set +# CONFIG_FATFS_CODEPAGE_775 is not set +# CONFIG_FATFS_CODEPAGE_850 is not set +# CONFIG_FATFS_CODEPAGE_852 is not set +# CONFIG_FATFS_CODEPAGE_855 is not set +# CONFIG_FATFS_CODEPAGE_857 is not set +# CONFIG_FATFS_CODEPAGE_860 is not set +# CONFIG_FATFS_CODEPAGE_861 is not set +# CONFIG_FATFS_CODEPAGE_862 is not set +# CONFIG_FATFS_CODEPAGE_863 is not set +# CONFIG_FATFS_CODEPAGE_864 is not set +# CONFIG_FATFS_CODEPAGE_865 is not set +# CONFIG_FATFS_CODEPAGE_866 is not set +# CONFIG_FATFS_CODEPAGE_869 is not set +# CONFIG_FATFS_CODEPAGE_932 is not set +# CONFIG_FATFS_CODEPAGE_936 is not set +# CONFIG_FATFS_CODEPAGE_949 is not set +# CONFIG_FATFS_CODEPAGE_950 is not set +CONFIG_FATFS_CODEPAGE=437 +# CONFIG_FATFS_LFN_NONE is not set +CONFIG_FATFS_LFN_HEAP=y +# CONFIG_FATFS_LFN_STACK is not set +CONFIG_FATFS_MAX_LFN=255 +CONFIG_FATFS_API_ENCODING_ANSI_OEM=y +# CONFIG_FATFS_API_ENCODING_UTF_16 is not set +# CONFIG_FATFS_API_ENCODING_UTF_8 is not set +CONFIG_FATFS_FS_LOCK=0 +CONFIG_FATFS_TIMEOUT_MS=10000 +CONFIG_FATFS_PER_FILE_CACHE=y +# CONFIG_FATFS_USE_FASTSEEK is not set +# end of FAT Filesystem support + +# +# Modbus configuration +# +CONFIG_FMB_COMM_MODE_TCP_EN=y +CONFIG_FMB_TCP_PORT_DEFAULT=502 +CONFIG_FMB_TCP_PORT_MAX_CONN=5 +CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 +CONFIG_FMB_COMM_MODE_RTU_EN=y +CONFIG_FMB_COMM_MODE_ASCII_EN=y +CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 +CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 +CONFIG_FMB_QUEUE_LENGTH=20 +CONFIG_FMB_PORT_TASK_STACK_SIZE=4096 +CONFIG_FMB_SERIAL_BUF_SIZE=256 +CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 +CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 +CONFIG_FMB_PORT_TASK_PRIO=10 +CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y +CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233 +CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 +CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 +CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 +CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 +CONFIG_FMB_TIMER_PORT_ENABLED=y +CONFIG_FMB_TIMER_GROUP=0 +CONFIG_FMB_TIMER_INDEX=0 +# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set +# end of Modbus configuration + +# +# FreeRTOS +# +# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set +CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set +CONFIG_FREERTOS_ASSERT_DISABLE=y +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +# CONFIG_FREERTOS_LEGACY_HOOKS is not set +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=5 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +CONFIG_FREERTOS_USE_TICKLESS_IDLE=y +CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP=3 +CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set +CONFIG_FREERTOS_DEBUG_OCDAWARE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +# end of FreeRTOS + +# +# Heap memory debugging +# +CONFIG_HEAP_POISONING_DISABLED=y +# CONFIG_HEAP_POISONING_LIGHT is not set +# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set +CONFIG_HEAP_TRACING_OFF=y +# CONFIG_HEAP_TRACING_STANDALONE is not set +# CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# end of Heap memory debugging + +# +# jsmn +# +# CONFIG_JSMN_PARENT_LINKS is not set +# CONFIG_JSMN_STRICT is not set +# end of jsmn + +# +# libsodium +# +# end of libsodium + +# +# Log output +# +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_COLORS=y +CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y +# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set +# end of Log output + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="nanodevice" +CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y +# CONFIG_LWIP_L2_TO_L3_COPY is not set +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set +CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_MAX_SOCKETS=16 +# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set +CONFIG_LWIP_SO_LINGER=y +CONFIG_LWIP_SO_REUSE=y +CONFIG_LWIP_SO_REUSE_RXTOALL=y +CONFIG_LWIP_SO_RCVBUF=y +# CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP4_FRAG=y +CONFIG_LWIP_IP6_FRAG=y +# CONFIG_LWIP_IP4_REASSEMBLY is not set +# CONFIG_LWIP_IP6_REASSEMBLY is not set +# CONFIG_LWIP_IP_FORWARD is not set +# CONFIG_LWIP_STATS is not set +# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set +CONFIG_LWIP_ESP_GRATUITOUS_ARP=y +CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y +# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set + +# +# DHCP server +# +# CONFIG_LWIP_DHCPS is not set +CONFIG_LWIP_DHCPS_LEASE_UNIT=60 +CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 +# end of DHCP server + +# CONFIG_LWIP_AUTOIP is not set +# CONFIG_LWIP_IPV6 is not set +# CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_NETIF_LOOPBACK=y +CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 + +# +# TCP +# +CONFIG_LWIP_MAX_ACTIVE_TCP=16 +CONFIG_LWIP_MAX_LISTENING_TCP=8 +CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y +CONFIG_LWIP_TCP_MAXRTX=12 +CONFIG_LWIP_TCP_SYNMAXRTX=12 +CONFIG_LWIP_TCP_MSS=1440 +CONFIG_LWIP_TCP_TMR_INTERVAL=250 +CONFIG_LWIP_TCP_MSL=60000 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744 +CONFIG_LWIP_TCP_WND_DEFAULT=5744 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 +CONFIG_LWIP_TCP_QUEUE_OOSEQ=y +# CONFIG_LWIP_TCP_SACK_OUT is not set +# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set +CONFIG_LWIP_TCP_OVERSIZE_MSS=y +# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set +CONFIG_LWIP_TCP_RTO_TIME=1500 +# end of TCP + +# +# UDP +# +CONFIG_LWIP_MAX_UDP_PCBS=16 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 +# end of UDP + +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF +# CONFIG_LWIP_PPP_SUPPORT is not set +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 +# CONFIG_LWIP_SLIP_SUPPORT is not set + +# +# ICMP +# +CONFIG_LWIP_ICMP=y +# CONFIG_LWIP_MULTICAST_PING is not set +# CONFIG_LWIP_BROADCAST_PING is not set +# end of ICMP + +# +# LWIP RAW API +# +CONFIG_LWIP_MAX_RAW_PCBS=16 +# end of LWIP RAW API + +# +# SNTP +# +CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 +CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 +# end of SNTP + +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +# end of Hooks + +# CONFIG_LWIP_DEBUG is not set +# end of LWIP + +# +# mbedTLS +# +CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y +# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set +# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set +CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y +CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +# CONFIG_MBEDTLS_DEBUG is not set + +# +# Certificate Bundle +# +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE is not set +# end of Certificate Bundle + +CONFIG_MBEDTLS_ECP_RESTARTABLE=y +CONFIG_MBEDTLS_CMAC_C=y +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +CONFIG_MBEDTLS_ROM_MD5=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set +CONFIG_MBEDTLS_HAVE_TIME=y +CONFIG_MBEDTLS_HAVE_TIME_DATE=y +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y +CONFIG_MBEDTLS_SHA512_C=y +CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y +# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set +# CONFIG_MBEDTLS_TLS_DISABLED is not set +CONFIG_MBEDTLS_TLS_SERVER=y +CONFIG_MBEDTLS_TLS_CLIENT=y +CONFIG_MBEDTLS_TLS_ENABLED=y + +# +# TLS Key Exchange Methods +# +# CONFIG_MBEDTLS_PSK_MODES is not set +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y +# end of TLS Key Exchange Methods + +CONFIG_MBEDTLS_SSL_RENEGOTIATION=y +# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set +CONFIG_MBEDTLS_SSL_PROTO_TLS1=y +CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +CONFIG_MBEDTLS_SSL_PROTO_DTLS=y +CONFIG_MBEDTLS_SSL_ALPN=y +CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y +CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y +CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y +CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +CONFIG_MBEDTLS_DES_C=y +CONFIG_MBEDTLS_RC4_DISABLED=y +# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set +# CONFIG_MBEDTLS_RC4_ENABLED is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +CONFIG_MBEDTLS_XTEA_C=y +CONFIG_MBEDTLS_CCM_C=y +CONFIG_MBEDTLS_GCM_C=y +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +CONFIG_MBEDTLS_PEM_PARSE_C=y +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +CONFIG_MBEDTLS_X509_CRL_PARSE_C=y +CONFIG_MBEDTLS_X509_CSR_PARSE_C=y +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECJPAKE_C is not set +CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y +CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set +# CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + +# +# mDNS +# +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_TASK_STACK_SIZE=4096 +# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_MDNS_TASK_AFFINITY_CPU0=y +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x0 +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# end of mDNS + +# +# ESP-MQTT Configurations +# +CONFIG_MQTT_PROTOCOL_311=y +CONFIG_MQTT_TRANSPORT_SSL=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y +# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set +# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set +# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set +# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set +# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set +# CONFIG_MQTT_CUSTOM_OUTBOX is not set +# end of ESP-MQTT Configurations + +# +# Newlib +# +CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set +CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y +# CONFIG_NEWLIB_NANO_FORMAT is not set +# end of Newlib + +# +# NVS +# +# end of NVS + +# +# OpenSSL +# +# CONFIG_OPENSSL_DEBUG is not set +CONFIG_OPENSSL_ERROR_STACK=y +# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set +CONFIG_OPENSSL_ASSERT_EXIT=y +# end of OpenSSL + +# +# PThreads +# +CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_PTHREAD_STACK_MIN=768 +CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y +# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set +# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set +CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" +# end of PThreads + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_VERIFY_WRITE is not set +# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set +CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set +# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set +# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set +# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set +# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set + +# +# Auto-detect flash chips +# +CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y +# end of Auto-detect flash chips + +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y +# end of SPI Flash driver + +# +# SPIFFS Configuration +# +CONFIG_SPIFFS_MAX_PARTITIONS=3 + +# +# SPIFFS Cache Configuration +# +CONFIG_SPIFFS_CACHE=y +CONFIG_SPIFFS_CACHE_WR=y +# CONFIG_SPIFFS_CACHE_STATS is not set +# end of SPIFFS Cache Configuration + +CONFIG_SPIFFS_PAGE_CHECK=y +CONFIG_SPIFFS_GC_MAX_RUNS=10 +# CONFIG_SPIFFS_GC_STATS is not set +CONFIG_SPIFFS_PAGE_SIZE=256 +CONFIG_SPIFFS_OBJ_NAME_LEN=32 +# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set +CONFIG_SPIFFS_USE_MAGIC=y +CONFIG_SPIFFS_USE_MAGIC_LENGTH=y +CONFIG_SPIFFS_META_LENGTH=4 +CONFIG_SPIFFS_USE_MTIME=y + +# +# Debug Configuration +# +# CONFIG_SPIFFS_DBG is not set +# CONFIG_SPIFFS_API_DBG is not set +# CONFIG_SPIFFS_GC_DBG is not set +# CONFIG_SPIFFS_CACHE_DBG is not set +# CONFIG_SPIFFS_CHECK_DBG is not set +# CONFIG_SPIFFS_TEST_VISUALISATION is not set +# end of Debug Configuration +# end of SPIFFS Configuration + +# +# TCP Transport +# + +# +# Websocket +# +CONFIG_WS_TRANSPORT=y +CONFIG_WS_BUFFER_SIZE=1024 +# end of Websocket +# end of TCP Transport + +# +# TinyUSB +# +# end of TinyUSB + +# +# Unity unit testing library +# +CONFIG_UNITY_ENABLE_FLOAT=y +CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_COLOR is not set +CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y +# CONFIG_UNITY_ENABLE_FIXTURE is not set +# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set +# end of Unity unit testing library + +# +# Virtual file system +# +CONFIG_VFS_SUPPORT_IO=y +CONFIG_VFS_SUPPORT_DIR=y +CONFIG_VFS_SUPPORT_SELECT=y +CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_VFS_SUPPORT_TERMIOS=y + +# +# Host File System I/O (Semihosting) +# +CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 +# end of Host File System I/O (Semihosting) +# end of Virtual file system + +# +# Wear Levelling +# +# CONFIG_WL_SECTOR_SIZE_512 is not set +CONFIG_WL_SECTOR_SIZE_4096=y +CONFIG_WL_SECTOR_SIZE=4096 +# end of Wear Levelling + +# +# Wi-Fi Provisioning Manager +# +CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 +CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# end of Wi-Fi Provisioning Manager + +# +# Supplicant +# +CONFIG_WPA_MBEDTLS_CRYPTO=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# end of Supplicant +# end of Component config + +# +# Compatibility options +# +# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set +# end of Compatibility options + +# Deprecated options for backward compatibility +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set +CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set +CONFIG_LOG_BOOTLOADER_LEVEL=3 +# CONFIG_APP_ROLLBACK_ENABLE is not set +# CONFIG_FLASH_ENCRYPTION_ENABLED is not set +# CONFIG_FLASHMODE_QIO is not set +# CONFIG_FLASHMODE_QOUT is not set +CONFIG_FLASHMODE_DIO=y +# CONFIG_FLASHMODE_DOUT is not set +# CONFIG_MONITOR_BAUD_9600B is not set +# CONFIG_MONITOR_BAUD_57600B is not set +# CONFIG_MONITOR_BAUD_115200B is not set +# CONFIG_MONITOR_BAUD_230400B is not set +CONFIG_MONITOR_BAUD_921600B=y +# CONFIG_MONITOR_BAUD_2MB is not set +# CONFIG_MONITOR_BAUD_OTHER is not set +CONFIG_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_MONITOR_BAUD=921600 +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +# CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED is not set +# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set +CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED=y +# CONFIG_CXX_EXCEPTIONS is not set +CONFIG_STACK_CHECK_NONE=y +# CONFIG_STACK_CHECK_NORM is not set +# CONFIG_STACK_CHECK_STRONG is not set +# CONFIG_STACK_CHECK_ALL is not set +# CONFIG_WARN_WRITE_STRINGS is not set +# CONFIG_DISABLE_GCC8_WARNINGS is not set +# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set +CONFIG_ESP32_APPTRACE_DEST_NONE=y +CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y +# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set +# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 +CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y +# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set +CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y +CONFIG_BLE_SCAN_DUPLICATE=y +CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y +# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA is not set +# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR is not set +CONFIG_SCAN_DUPLICATE_TYPE=0 +CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 +# CONFIG_BLE_MESH_SCAN_DUPLICATE_EN is not set +CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 +CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +# CONFIG_BLUEDROID_ENABLED is not set +CONFIG_NIMBLE_ENABLED=y +CONFIG_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y +# CONFIG_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set +CONFIG_NIMBLE_MAX_CONNECTIONS=2 +CONFIG_NIMBLE_MAX_BONDS=3 +CONFIG_NIMBLE_MAX_CCCDS=8 +CONFIG_NIMBLE_L2CAP_COC_MAX_NUM=0 +CONFIG_NIMBLE_PINNED_TO_CORE_0=y +# CONFIG_NIMBLE_PINNED_TO_CORE_1 is not set +CONFIG_NIMBLE_PINNED_TO_CORE=0 +CONFIG_NIMBLE_TASK_STACK_SIZE=4096 +CONFIG_NIMBLE_ROLE_CENTRAL=y +CONFIG_NIMBLE_ROLE_PERIPHERAL=y +CONFIG_NIMBLE_ROLE_BROADCASTER=y +CONFIG_NIMBLE_ROLE_OBSERVER=y +CONFIG_NIMBLE_NVS_PERSIST=y +CONFIG_NIMBLE_SM_LEGACY=y +CONFIG_NIMBLE_SM_SC=y +# CONFIG_NIMBLE_DEBUG is not set +# CONFIG_NIMBLE_SM_SC_DEBUG_KEYS is not set +CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" +CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 +CONFIG_NIMBLE_ATT_PREFERRED_MTU=256 +CONFIG_NIMBLE_SVC_GAP_APPEARANCE=0 +CONFIG_NIMBLE_ACL_BUF_COUNT=10 +CONFIG_NIMBLE_ACL_BUF_SIZE=255 +CONFIG_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT=20 +CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 +CONFIG_NIMBLE_MSYS1_BLOCK_COUNT=12 +CONFIG_NIMBLE_HS_FLOW_CTRL=y +CONFIG_NIMBLE_HS_FLOW_CTRL_ITVL=1000 +CONFIG_NIMBLE_HS_FLOW_CTRL_THRESH=2 +CONFIG_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT=y +CONFIG_NIMBLE_RPA_TIMEOUT=900 +# CONFIG_NIMBLE_MESH is not set +CONFIG_NIMBLE_CRYPTO_STACK_MBEDTLS=y +CONFIG_ADC2_DISABLE_DAC=y +# CONFIG_SPIRAM_SUPPORT is not set +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set +CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y +CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_RESERVE_MEM=512 +CONFIG_BROWNOUT_DET=y +CONFIG_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=0 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_MAIN_TASK_STACK_SIZE=3584 +CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_CONSOLE_UART_DEFAULT=y +# CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_UART_NONE is not set +CONFIG_CONSOLE_UART=y +CONFIG_CONSOLE_UART_NUM=0 +CONFIG_CONSOLE_UART_BAUDRATE=115200 +CONFIG_INT_WDT=y +CONFIG_INT_WDT_TIMEOUT_MS=300 +CONFIG_INT_WDT_CHECK_CPU1=y +# CONFIG_TASK_WDT is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set +CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +CONFIG_TIMER_TASK_STACK_SIZE=3584 +CONFIG_SW_COEXIST_ENABLE=y +# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 +CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 +CONFIG_MB_QUEUE_LENGTH=20 +CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 +CONFIG_MB_SERIAL_BUF_SIZE=256 +CONFIG_MB_SERIAL_TASK_PRIO=10 +CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y +CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 +CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 +CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 +CONFIG_MB_CONTROLLER_STACK_SIZE=4096 +CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 +CONFIG_MB_TIMER_PORT_ENABLED=y +CONFIG_MB_TIMER_GROUP=0 +CONFIG_MB_TIMER_INDEX=0 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +CONFIG_TIMER_TASK_PRIORITY=1 +CONFIG_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_TIMER_QUEUE_LENGTH=10 +# CONFIG_L2_TO_L3_COPY is not set +# CONFIG_USE_ONLY_LWIP_SELECT is not set +CONFIG_ESP_GRATUITOUS_ARP=y +CONFIG_GARP_TMR_INTERVAL=60 +CONFIG_TCPIP_RECVMBOX_SIZE=32 +CONFIG_TCP_MAXRTX=12 +CONFIG_TCP_SYNMAXRTX=12 +CONFIG_TCP_MSS=1440 +CONFIG_TCP_MSL=60000 +CONFIG_TCP_SND_BUF_DEFAULT=5744 +CONFIG_TCP_WND_DEFAULT=5744 +CONFIG_TCP_RECVMBOX_SIZE=6 +CONFIG_TCP_QUEUE_OOSEQ=y +# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set +CONFIG_TCP_OVERSIZE_MSS=y +# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_TCP_OVERSIZE_DISABLE is not set +CONFIG_UDP_RECVMBOX_SIZE=6 +CONFIG_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF +# CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_ESP32_PTHREAD_STACK_MIN=768 +CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set +CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" +CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_SUPPORT_TERMIOS=y +CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 +# End of deprecated options diff --git a/targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 b/targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 index 23a042f7dd..6252e3fb87 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 @@ -626,7 +626,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -664,7 +664,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -688,7 +688,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -719,7 +719,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_pico b/targets/ESP32/_IDF/sdkconfig.default_pico index ee0a7a0eac..0f406f8882 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_pico +++ b/targets/ESP32/_IDF/sdkconfig.default_pico @@ -625,7 +625,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -663,7 +663,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -687,7 +687,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -718,7 +718,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 b/targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 index 735f34cf16..33929ffde6 100644 --- a/targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 +++ b/targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 @@ -654,7 +654,7 @@ CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_MAX_SOCKETS=16 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set CONFIG_LWIP_SO_LINGER=y CONFIG_LWIP_SO_REUSE=y @@ -692,7 +692,7 @@ CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 # # TCP # -CONFIG_LWIP_MAX_ACTIVE_TCP=5 +CONFIG_LWIP_MAX_ACTIVE_TCP=16 CONFIG_LWIP_MAX_LISTENING_TCP=8 CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y CONFIG_LWIP_TCP_MAXRTX=12 @@ -716,7 +716,7 @@ CONFIG_LWIP_TCP_RTO_TIME=1500 # UDP # CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=4 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 # end of UDP # @@ -747,7 +747,7 @@ CONFIG_LWIP_ICMP=y # # LWIP RAW API # -CONFIG_LWIP_MAX_RAW_PCBS=4 +CONFIG_LWIP_MAX_RAW_PCBS=16 # end of LWIP RAW API # diff --git a/targets/ESP32/_Include/Target_Windows_Storage.h b/targets/ESP32/_Include/Target_Windows_Storage.h index 671af9516c..9b7357b175 100644 --- a/targets/ESP32/_Include/Target_Windows_Storage.h +++ b/targets/ESP32/_Include/Target_Windows_Storage.h @@ -13,8 +13,8 @@ extern "C" #include - bool Storage_InitSDCardSPI(char *vfsName, int maxFiles, int pin_Miso, int pin_Mosi, int pin_Clk, int pin_Cs); - bool Storage_InitSDCardMMC(char *vfsName, int maxFiles, bool bit1Mode); + bool Storage_MountMMC(bool bit1Mode, int driveIndex); + bool Storage_MountSpi(int spiBus, uint32_t CSPin, int driveIndex); bool Storage_UnMountSDCard(); #ifdef __cplusplus diff --git a/targets/ESP32/_Include/lwipopts.h b/targets/ESP32/_Include/lwipopts.h index d43797aeb1..b134c7456f 100644 --- a/targets/ESP32/_Include/lwipopts.h +++ b/targets/ESP32/_Include/lwipopts.h @@ -213,7 +213,7 @@ /** * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. */ -#define LWIP_RAW 1 +#define LWIP_RAW 0 /* ---------------------------------- diff --git a/targets/ESP32/_Include/targetHAL_ConfigStorage.h b/targets/ESP32/_Include/targetHAL_ConfigStorage.h index 92cb4e9c9d..194148588d 100644 --- a/targets/ESP32/_Include/targetHAL_ConfigStorage.h +++ b/targets/ESP32/_Include/targetHAL_ConfigStorage.h @@ -26,13 +26,18 @@ extern "C" // Parameters:- // configuration : Type of configuration block to open // configurationIndex : Index of type to open - // write : True to create/overwrite file + // isWrite : flag to signal writting to the file + // isAppend : flag to signal appending to the file // // Return :- // true : returns handle // false -1 // - FILE *ConfigStorage_OpenFile(DeviceConfigurationOption configuration, uint32_t configurationIndex, bool write); + FILE *ConfigStorage_OpenFile( + DeviceConfigurationOption configuration, + uint32_t configurationIndex, + bool isWrite, + bool isAppend); // // ConfigStorage_CloseFile - Close opened file / NVS system @@ -72,6 +77,20 @@ extern "C" // bool ConfigStorage_WriteFile(FILE *handle, uint8_t *pData, int32_t writeSize); + // + // ConfigStorage_AppendFile - Append data to file system + // + // Parameters:- + // handle : Handle returned from ConfigStorage_OpenFile + // pData : Pointer data to write + // writeSize : Size of data to write + // + // return:- + // true - OK + // false- Error/Not found + // + bool ConfigStorage_AppendFile(FILE *handle, uint8_t *pData, int32_t writeSize); + // // ConfigStorage_ReadFile - Read the data from opened file // diff --git a/targets/ESP32/_Network/NF_ESP32_Wireless.cpp b/targets/ESP32/_Network/NF_ESP32_Wireless.cpp index 74feb293b2..32042f7c70 100644 --- a/targets/ESP32/_Network/NF_ESP32_Wireless.cpp +++ b/targets/ESP32/_Network/NF_ESP32_Wireless.cpp @@ -28,6 +28,7 @@ wifi_mode_t NF_ESP32_CheckExpectedWifiMode() wifi_mode_t mode = WIFI_MODE_NULL; HAL_Configuration_Wireless80211 *wirelessConfig = NULL; + HAL_Configuration_WirelessAP *wirelessAPConfig = NULL; HAL_Configuration_NetworkInterface *networkConfig = (HAL_Configuration_NetworkInterface *)platform_malloc(sizeof(HAL_Configuration_NetworkInterface)); @@ -69,11 +70,12 @@ wifi_mode_t NF_ESP32_CheckExpectedWifiMode() // Wireless Config with SSID setup if (networkConfig->InterfaceType == NetworkInterfaceType::NetworkInterfaceType_WirelessAP) { - wirelessConfig = ConfigurationManager_GetWirelessConfigurationFromId(networkConfig->SpecificConfigId); + wirelessAPConfig = + ConfigurationManager_GetWirelessAPConfigurationFromId(networkConfig->SpecificConfigId); - if (wirelessConfig != NULL) + if (wirelessAPConfig != NULL) { - if (wirelessConfig->Options & WirelessAPConfiguration_ConfigurationOptions_Enable) + if (wirelessAPConfig->Options & WirelessAPConfiguration_ConfigurationOptions_Enable) { // Use STATION + AP or just AP mode = (mode == WIFI_MODE_STA) ? WIFI_MODE_APSTA : WIFI_MODE_AP; diff --git a/targets/ESP32/_common/Target_Windows_Storage.c b/targets/ESP32/_common/Target_Windows_Storage.c index 006d5ee6d5..e500f4acd4 100644 --- a/targets/ESP32/_common/Target_Windows_Storage.c +++ b/targets/ESP32/_common/Target_Windows_Storage.c @@ -33,78 +33,59 @@ #include #include #include + #include #include +#include static const char *TAG = "SDCard"; -// Pin mapping when using SPI mode. -// With this mapping, SD card can be used both in SPI and 1-line SD mode. -// Note that a pull-up on CS line is required in SD mode. -//#define PIN_NUM_MISO 2 -//#define PIN_NUM_MOSI 15 -//#define PIN_NUM_CLK 14 -//#define PIN_NUM_CS 13 - -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) +// +// Unmount SD card ( MMC/SDIO or SPI) +// bool Storage_UnMountSDCard() { if (esp_vfs_fat_sdmmc_unmount() != ESP_OK) + { return false; - + } return true; } -// -// Mount the SDCard device as a FAT device on the VFS -// -bool Storage_MountSDCard(char *vfsName, sdmmc_host_t *host, void *slot_config, bool formatOnMount, int maxFiles) +bool LogMountResult(esp_err_t errCode) { - - esp_vfs_fat_sdmmc_mount_config_t mount_config = { - .format_if_mount_failed = formatOnMount, - .max_files = maxFiles, - .allocation_unit_size = 16 * 1024}; - - sdmmc_card_t *card; - esp_err_t ret = esp_vfs_fat_sdmmc_mount(vfsName, host, (sdmmc_slot_config_t *)slot_config, &mount_config, &card); - if (ret == ESP_ERR_INVALID_STATE) + if (errCode != ESP_OK) { - // Invalid state means its already mounted, this can happen if you are trying to debug mount from managed code - // and the code has already run & mounted - Storage_UnMountSDCard(); - ret = esp_vfs_fat_sdmmc_mount(vfsName, host, (sdmmc_slot_config_t *)slot_config, &mount_config, &card); - } - - if (ret != ESP_OK) - { - if (ret == ESP_FAIL) + if (errCode == ESP_FAIL) { ESP_LOGE(TAG, "Failed to mount filesystem. "); } else { - ESP_LOGE(TAG, "Failed to initialize the card (%s). ", esp_err_to_name(ret)); + ESP_LOGE(TAG, "Failed to initialize the card (%s). ", esp_err_to_name(errCode)); } return false; } - return true; } - -// Storage_InitSDCardMMC -// Initial the SD card Slot 1 - 4/1 bit ( hs2_* signals ) // -// vfsName - Name of disk for vfs - i.e "/SDSPI" -// maxFiles- Maximum number of open files -// bit1Mode- true to use 1 bit MMC interface +// Mount SDcard on MMC/SDIO bus // -// return true if OK +// bit1Mode- true to use 1 bit MMC interface +// driveIndex = 0 = first drive // -bool Storage_InitSDCardMMC(char *vfsName, int maxFiles, bool bit1Mode) +bool Storage_MountMMC(bool bit1Mode, int driveIndex) { + esp_err_t errCode; + char mountPoint[] = INDEX0_DRIVE_LETTER; + + // Change fatfs drive letter to mount point D: -> /D for ESP32 VFS + mountPoint[1] = mountPoint[0] + driveIndex; + mountPoint[0] = '/'; + ESP_LOGI(TAG, "Initializing MMC SD card"); sdmmc_host_t host = SDMMC_HOST_DEFAULT(); @@ -123,39 +104,82 @@ bool Storage_InitSDCardMMC(char *vfsName, int maxFiles, bool bit1Mode) // GPIOs 15, 2, 4, 12, 13 should have external 10k pull-ups. // Internal pull-ups are not sufficient. However, enabling internal pull-ups // does make a difference some boards, so we do that here. - gpio_set_pull_mode(15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes - gpio_set_pull_mode(2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes + gpio_set_pull_mode((gpio_num_t)15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes + gpio_set_pull_mode((gpio_num_t)2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes if (!bit1Mode) { - gpio_set_pull_mode(4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only - gpio_set_pull_mode(12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only - gpio_set_pull_mode(13, GPIO_PULLUP_ONLY); // D3, needed in 4-line modes only + gpio_set_pull_mode((gpio_num_t)4, GPIO_PULLUP_ONLY); // D1, needed in 4-line mode only + gpio_set_pull_mode((gpio_num_t)12, GPIO_PULLUP_ONLY); // D2, needed in 4-line mode only + gpio_set_pull_mode((gpio_num_t)13, GPIO_PULLUP_ONLY); // D3, needed in 4-line modes only } - return Storage_MountSDCard(vfsName, &host, &slot_config, false, maxFiles); + // Mount the SDCard device as a FAT device on the VFS + esp_vfs_fat_sdmmc_mount_config_t mount_config = { + .format_if_mount_failed = false, + .max_files = SDC_MAX_OPEN_FILES, + .allocation_unit_size = 16 * 1024}; + + sdmmc_card_t *card; + errCode = esp_vfs_fat_sdmmc_mount(mountPoint, &host, &slot_config, &mount_config, &card); + if (errCode == ESP_ERR_INVALID_STATE) + { + // Invalid state means its already mounted, this can happen if you are trying to debug mount from managed code + // and the code has already run & mounted + Storage_UnMountSDCard(); + errCode = esp_vfs_fat_sdmmc_mount(mountPoint, &host, &slot_config, &mount_config, &card); + } + + return LogMountResult(errCode); } -// Storage_InitSDCardSPI -// Initial the SD card connected by SPI) // -// vfsName - Name of disk for vfs - i.e "/SDSPI" -// maxFiles- Maximum number of open files +// Mount card on SPI bus +// Expects SPI bus to be already initialised +// +// spiBus - SPI bus index (0 based) +// csPin - Chip select pin for SD card +// driveIndex - 0 = first drive // // return true if OK // -bool Storage_InitSDCardSPI(char *vfsName, int maxFiles, int pin_Miso, int pin_Mosi, int pin_Clk, int pin_Cs) +bool Storage_MountSpi(int spiBus, uint32_t csPin, int driveIndex) { + esp_err_t errCode; + char mountPoint[] = INDEX0_DRIVE_LETTER; + + // Change fatfs drive letter to mount point D: -> /D for ESP32 VFS + mountPoint[1] = mountPoint[0] + driveIndex; + mountPoint[0] = '/'; + ESP_LOGI(TAG, "Initializing SPI SD card"); sdmmc_host_t host = SDSPI_HOST_DEFAULT(); - sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT(); - slot_config.gpio_miso = pin_Miso; - slot_config.gpio_mosi = pin_Mosi; - slot_config.gpio_sck = pin_Clk; - slot_config.gpio_cs = pin_Cs; + host.slot = spiBus + HSPI_HOST; + + esp_vfs_fat_sdmmc_mount_config_t mount_config = { + .format_if_mount_failed = false, + .max_files = 5, + .allocation_unit_size = 16 * 1024}; + + sdmmc_card_t *card; + + // This initializes the slot without card detect (CD) and write protect (WP) signals. + // Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals. + sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT(); + slot_config.gpio_cs = (gpio_num_t)csPin; + slot_config.host_id = (spi_host_device_t)host.slot; + + errCode = esp_vfs_fat_sdspi_mount(mountPoint, &host, &slot_config, &mount_config, &card); + if (errCode == ESP_ERR_INVALID_STATE) + { + // Invalid state means its already mounted, this can happen if you are trying to debug mount from managed code + // and the code has already run & mounted + Storage_UnMountSDCard(); + errCode = esp_vfs_fat_sdspi_mount(mountPoint, &host, &slot_config, &mount_config, &card); + } - return Storage_MountSDCard(vfsName, &host, &slot_config, false, maxFiles); + return LogMountResult(errCode); } #endif diff --git a/targets/ESP32/_common/targetHAL_ConfigStorageSPIFFS.c b/targets/ESP32/_common/targetHAL_ConfigStorageSPIFFS.c index c2390dd9a4..35e61311a9 100644 --- a/targets/ESP32/_common/targetHAL_ConfigStorageSPIFFS.c +++ b/targets/ESP32/_common/targetHAL_ConfigStorageSPIFFS.c @@ -21,7 +21,8 @@ typedef enum ConfigIoType { ConfigIoType_Read, ConfigIoType_Write, - ConfigIoType_GetSize + ConfigIoType_GetSize, + ConfigIoType_Append, } ConfigIoType; // Initialise SPIFFS @@ -136,10 +137,16 @@ void ConfigStorage_GetConfigFileName( // Parameters:- // configuration : Type of configuration block to open // configurationIndex : Index of type to open +// isWrite : flag to signal writting to the file +// isAppend : flag to signal appending to the file // // Return :handle // -FILE *ConfigStorage_OpenFile(DeviceConfigurationOption configuration, uint32_t configurationIndex, bool write) +FILE *ConfigStorage_OpenFile( + DeviceConfigurationOption configuration, + uint32_t configurationIndex, + bool isWrite, + bool isAppend) { // buffer for file name // add extra position for terminator @@ -148,7 +155,7 @@ FILE *ConfigStorage_OpenFile(DeviceConfigurationOption configuration, uint32_t c ConfigStorage_GetConfigFileName(configuration, configurationIndex, fileName); // Open SPIFFS config storage - FILE *file = fopen(fileName, write ? "wb" : "rb"); + FILE *file = fopen(fileName, isWrite ? (isAppend ? "a" : "w") : "r"); if (file != NULL) { @@ -250,6 +257,16 @@ int32_t Config_IO(FILE *handle, ConfigIoType ioType, uint8_t *pData, int32_t siz break; } + else if (ioType == ConfigIoType_Append) + { + // get to the end of the file + fseek(file, 0, SEEK_END); + + // append more data + result = fwrite((const void *)pData, 1, (size_t)size, file); + + break; + } else { break; @@ -291,6 +308,23 @@ bool ConfigStorage_WriteFile(FILE *handle, uint8_t *pData, int32_t writeSize) return (Config_IO(handle, ConfigIoType_Write, pData, writeSize) == writeSize); } +// +// ConfigStorage_AppendFile - Append data to NVS system +// +// Parameters:- +// handle : Handle returned from ConfigStorage_OpenFile +// pData : Pointer data to write +// writeSize : Size of data to write +// +// return:- +// true - OK +// false- Error/Not found +// +bool ConfigStorage_AppendFile(FILE *handle, uint8_t *pData, int32_t writeSize) +{ + return (Config_IO(handle, ConfigIoType_Append, pData, writeSize) == writeSize); +} + // // ConfigStorage_ReadFile - Read the data from file opened in NVS // @@ -449,7 +483,7 @@ HAL_CONFIGURATION_X509_CERTIFICATE *ConfigStorage_FindX509CertificateConfigurati DIR *dir = opendir(NANO_SPIFFS_BASE_PATH); struct dirent *dirInfo = {0}; - uint32_t configCount = 0; + uint32_t certCount = 0; // 1st pass, count the config files for (;;) @@ -464,7 +498,7 @@ HAL_CONFIGURATION_X509_CERTIFICATE *ConfigStorage_FindX509CertificateConfigurati if (strstr(dirInfo->d_name, (const char *)c_MARKER_CONFIGURATION_X509CAROOTBUNDLE_V1)) { - configCount++; + certCount++; // there is only one CA root bundle, so we're good here break; @@ -472,7 +506,8 @@ HAL_CONFIGURATION_X509_CERTIFICATE *ConfigStorage_FindX509CertificateConfigurati } // allocate config struct - int32_t allocationSize = sizeof(HAL_Configuration_X509CaRootBundle); + int32_t allocationSize = offsetof(HAL_CONFIGURATION_X509_CERTIFICATE, Certificates) + + certCount * sizeof(HAL_Configuration_X509CaRootBundle *); // allocate config struct HAL_CONFIGURATION_X509_CERTIFICATE *certificateStore = @@ -488,17 +523,45 @@ HAL_CONFIGURATION_X509_CERTIFICATE *ConfigStorage_FindX509CertificateConfigurati memset(certificateStore, 0, allocationSize); // set collection count - certificateStore->Count = configCount; + certificateStore->Count = certCount; + + if (certCount > 0) + { + // allocate cert struct + HAL_Configuration_X509CaRootBundle *certificate = + (HAL_Configuration_X509CaRootBundle *)platform_malloc(sizeof(HAL_Configuration_X509CaRootBundle)); + + // check allocation + if (certificate == NULL) + { + return NULL; + } + + // clear memory + memset(certificate, 0, sizeof(HAL_Configuration_X509CaRootBundle)); + + // make sure the config block marker is set + memcpy( + certificate, + c_MARKER_CONFIGURATION_X509CAROOTBUNDLE_V1, + sizeof(c_MARKER_CONFIGURATION_X509CAROOTBUNDLE_V1)); + + // get size of certificate + certificate->CertificateSize = + ConfigurationManager_GetConfigurationBlockSize(DeviceConfigurationOption_X509CaRootBundle, 0); + + certificateStore->Certificates[0] = certificate; + } return certificateStore; } -HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *ConfigStorage_FindX509DeviceCertificatesConfigurationBlocks() +HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *IRAM_ATTR ConfigStorage_FindX509DeviceCertificatesConfigurationBlocks() { DIR *dir = opendir(NANO_SPIFFS_BASE_PATH); struct dirent *dirInfo = {0}; - uint32_t configCount = 0; + uint32_t certCount = 0; // 1st pass, count the config files for (;;) @@ -513,7 +576,7 @@ HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *ConfigStorage_FindX509DeviceCertifica if (strstr(dirInfo->d_name, (const char *)c_MARKER_CONFIGURATION_X509DEVICECERTIFICATE_V1)) { - configCount++; + certCount++; // there is only one device cert, so we're good here break; @@ -521,7 +584,8 @@ HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *ConfigStorage_FindX509DeviceCertifica } // allocate config struct - int32_t allocationSize = sizeof(HAL_Configuration_X509DeviceCertificate); + int32_t allocationSize = offsetof(HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE, Certificates) + + certCount * sizeof(HAL_Configuration_X509DeviceCertificate *); // allocate config struct HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *deviceCertificate = @@ -537,7 +601,35 @@ HAL_CONFIGURATION_X509_DEVICE_CERTIFICATE *ConfigStorage_FindX509DeviceCertifica memset(deviceCertificate, 0, allocationSize); // set collection count - deviceCertificate->Count = configCount; + deviceCertificate->Count = certCount; + + if (certCount > 0) + { + // allocate cert struct + HAL_Configuration_X509DeviceCertificate *certificate = + (HAL_Configuration_X509DeviceCertificate *)platform_malloc(sizeof(HAL_Configuration_X509DeviceCertificate)); + + // check allocation + if (certificate == NULL) + { + return NULL; + } + + // clear memory + memset(certificate, 0, sizeof(HAL_Configuration_X509DeviceCertificate)); + + // make sure the config block marker is set + memcpy( + certificate, + c_MARKER_CONFIGURATION_X509DEVICECERTIFICATE_V1, + sizeof(c_MARKER_CONFIGURATION_X509DEVICECERTIFICATE_V1)); + + // get size of certificate + certificate->CertificateSize = + ConfigurationManager_GetConfigurationBlockSize(DeviceConfigurationOption_X509DeviceCertificates, 0); + + deviceCertificate->Certificates[0] = certificate; + } return deviceCertificate; } @@ -555,7 +647,7 @@ bool ConfigurationManager_GetConfigurationBlockFromStorage( ets_printf("GetConfigFromStorage %d, %d\n", (int)configuration, configurationIndex); #endif - handle = ConfigStorage_OpenFile(configuration, configurationIndex, false); + handle = ConfigStorage_OpenFile(configuration, configurationIndex, false, false); if (handle != NULL) { @@ -578,7 +670,7 @@ int32_t ConfigurationManager_GetConfigurationBlockSize( FILE *handle; int32_t readSize = 0; - handle = ConfigStorage_OpenFile(configuration, configurationIndex, false); + handle = ConfigStorage_OpenFile(configuration, configurationIndex, false, false); if (handle != NULL) { diff --git a/targets/ESP32/_common/targetHAL_ConfigurationManager.cpp b/targets/ESP32/_common/targetHAL_ConfigurationManager.cpp index 47c63b2011..e55eb92ce3 100644 --- a/targets/ESP32/_common/targetHAL_ConfigurationManager.cpp +++ b/targets/ESP32/_common/targetHAL_ConfigurationManager.cpp @@ -15,11 +15,6 @@ // #define DEBUG_CONFIG 1 -// Saves the remaining bundle size for multiple block cert configs -static int32_t savedBundleSize; -static int32_t remainingBundleSize; -static int32_t savedBundleOffset; - #ifdef DEBUG_CONFIG void PrintBlock(char *pBlock, int bsize) { @@ -77,7 +72,7 @@ int32_t ConfigurationManager_FindConfigurationBlockSize( FILE *handle; int32_t configSize = 0; - handle = ConfigStorage_OpenFile(configuration, configurationIndex, false); + handle = ConfigStorage_OpenFile(configuration, configurationIndex, false, false); if (handle != NULL) { configSize = ConfigStorage_FileSize(handle); @@ -99,7 +94,7 @@ bool StoreConfigBlock( bool result = false; FILE *fileHandle; - fileHandle = ConfigStorage_OpenFile(configType, configurationIndex, true); + fileHandle = ConfigStorage_OpenFile(configType, configurationIndex, true, false); if (fileHandle != NULL) { result = ConfigStorage_WriteFile(fileHandle, (uint8_t *)configBlock, writeSize); @@ -117,6 +112,36 @@ bool StoreConfigBlock( return result; } +bool AppendConfigBlock( + DeviceConfigurationOption configType, + uint32_t configurationIndex, + void *configBlock, + size_t writeSize) +{ + bool result = false; + FILE *fileHandle; + + fileHandle = ConfigStorage_OpenFile(configType, configurationIndex, true, true); + + if (fileHandle != NULL) + { + result = ConfigStorage_AppendFile(fileHandle, (uint8_t *)configBlock, writeSize); + +#ifdef DEBUG_CONFIG + ets_printf( + "store type %d index %d, length %d result %d\n", + (int)configType, + configurationIndex, + writeSize, + (int)result); +#endif + + ConfigStorage_CloseFile(fileHandle); + } + + return result; +} + // Enumerates the configuration blocks from the configuration flash sector // it's implemented with 'weak' attribute so it can be replaced at target level if a different persistence mechanism is // used @@ -413,10 +438,10 @@ bool ConfigurationManager_GetConfigurationBlock( // set block size sizeOfBlock = ConfigurationManager_GetConfigurationBlockSize(DeviceConfigurationOption_X509CaRootBundle, 0); } - else if (configuration == DeviceConfigurationOption_X509CaRootBundle) + else if (configuration == DeviceConfigurationOption_X509DeviceCertificates) { - if (g_TargetConfiguration.CertificateStore->Count == 0 || - (configurationIndex + 1) > g_TargetConfiguration.CertificateStore->Count) + if (g_TargetConfiguration.DeviceCertificates->Count == 0 || + (configurationIndex + 1) > g_TargetConfiguration.DeviceCertificates->Count) { #ifdef DEBUG_CONFIG ets_printf("GetConfig XC exit false\n"); @@ -445,260 +470,45 @@ bool ConfigurationManager_GetConfigurationBlock( sizeOfBlock); } -DeviceConfigurationOption GetConfigOption(char *config) -{ - if (!memcmp(c_MARKER_CONFIGURATION_NETWORK_V1, config, sizeof(c_MARKER_CONFIGURATION_NETWORK_V1))) - { - return DeviceConfigurationOption_Network; - } - else if (!memcmp(c_MARKER_CONFIGURATION_WIRELESS80211_V1, config, sizeof(c_MARKER_CONFIGURATION_WIRELESS80211_V1))) - { - return DeviceConfigurationOption_Wireless80211Network; - } - else if (!memcmp(c_MARKER_CONFIGURATION_WIRELESS_AP_V1, config, sizeof(c_MARKER_CONFIGURATION_WIRELESS_AP_V1))) - { - return DeviceConfigurationOption_WirelessNetworkAP; - } - else if (!memcmp( - c_MARKER_CONFIGURATION_X509CAROOTBUNDLE_V1, - config, - sizeof(c_MARKER_CONFIGURATION_X509CAROOTBUNDLE_V1))) - { - return DeviceConfigurationOption_X509CaRootBundle; - } - else if (!memcmp( - c_MARKER_CONFIGURATION_X509DEVICECERTIFICATE_V1, - config, - sizeof(c_MARKER_CONFIGURATION_X509DEVICECERTIFICATE_V1))) - { - return DeviceConfigurationOption_X509DeviceCertificates; - } - else - { - // shouldn't EVER EVER get here - ASSERT(false); - return (DeviceConfigurationOption)0; - } -} - -bool ConfigurationManager_StoreConfigurationBlockAll(void *configurationBlock, uint32_t blockSize, uint32_t offset) +bool ConfigurationManager_StoreConfigurationBlockCertificate( + DeviceConfigurationOption configuration, + uint32_t configurationIndex, + void *configurationBlock, + uint32_t blockSize, + uint32_t offset) { - size_t chunkSize = 0; - uint32_t certificateIndex = 0; - bool result = false; - uint32_t configurationIndex = 0; - - // All configuration blocks in one block - // Separate and update - -#ifdef DEBUG_CONFIG - ets_printf("Block size %d\n", blockSize); - - ets_printf("sizeof HAL_Configuration_NetworkInterface %d\n", sizeof(HAL_Configuration_NetworkInterface)); - ets_printf("sizeof HAL_Configuration_Wireless80211 %d\n", sizeof(HAL_Configuration_Wireless80211)); - ets_printf("sizeof of X509Certificate varies\n"); -#endif - - configurationIndex = 0; - - char *config = (char *)configurationBlock; - char *pEndConfig = (config + blockSize); - DeviceConfigurationOption currentConfigType; - - while (config < pEndConfig) + if (offset == 0) { - int remainingBlockSize = pEndConfig - config; - -#ifdef DEBUG_CONFIG - ets_printf("Parse block %d:%d\n", config, pEndConfig); - PrintBlock((char *)config, 16); -#endif - currentConfigType = GetConfigOption(config); - - // X509 certificate block ? - if (currentConfigType == DeviceConfigurationOption_X509CaRootBundle) + // if this is the 1st chunk of data for a certificate, delete the existing one, if that exists + if (ConfigStorage_DeleteFile(configuration, configurationIndex)) { - if (offset == 0) + if (configuration == DeviceConfigurationOption_X509CaRootBundle) { - HAL_Configuration_X509CaRootBundle *pX509Certificate = (HAL_Configuration_X509CaRootBundle *)config; - - // First block of certificate bundle - // set total bundle size including header - // because X509 certificate has a variable length need to compute the block size in two steps - savedBundleSize = offsetof(HAL_Configuration_X509CaRootBundle, Certificate); - savedBundleSize += pX509Certificate->CertificateSize; - remainingBundleSize = savedBundleSize; - savedBundleOffset = 0; - - // Free if already allocated ( could be different size ) - if (g_TargetConfiguration.CertificateStore->Certificates[certificateIndex] != 0) + // need to free memory before enumerating again + if (g_TargetConfiguration.CertificateStore->Count > 0) { - platform_free((void *)g_TargetConfiguration.CertificateStore->Certificates); + platform_free(g_TargetConfiguration.CertificateStore->Certificates[0]); } + platform_free(g_TargetConfiguration.CertificateStore); - g_TargetConfiguration.CertificateStore->Certificates[certificateIndex] = - (HAL_Configuration_X509CaRootBundle *)platform_malloc(savedBundleSize); - -#ifdef DEBUG_CONFIG - ets_printf("X509 certificate block total size:%d\n", pX509Certificate->CertificateSize); -#endif - } - - // The current chunk size is what remains in current block - // we can't use offset as it relates to flash memory offset, not useful - chunkSize = remainingBlockSize; - - // Copy into correct position in memory - memcpy( - (void *)(g_TargetConfiguration.CertificateStore->Certificates[0] + savedBundleOffset), - (const void *)config, - chunkSize); -#ifdef DEBUG_CONFIG - ets_printf("X509 certificate chunksize:%d reminaing:%d\n", chunkSize, savedBundleSize); - PrintBlock((char *)config, 32); -#endif - config += chunkSize; - remainingBundleSize -= chunkSize; - savedBundleOffset += chunkSize; - // Return true for partial blocks - result = true; - - if (remainingBundleSize <= 0) - { - // Save Certificate Bundle to storage - result = StoreConfigBlock( - DeviceConfigurationOption_X509CaRootBundle, - certificateIndex, - (void *)g_TargetConfiguration.CertificateStore->Certificates[certificateIndex], - savedBundleSize); - certificateIndex++; -#ifdef DEBUG_CONFIG - ets_printf("X509 certificate complete, saving\n"); -#endif + g_TargetConfiguration.CertificateStore = ConfigStorage_FindX509CertificateConfigurationBlocks(); } - -#ifdef DEBUG_CONFIG - ets_printf("X509 certificate block ret:%d\n", result); -#endif - } - // X509 device certificate block ? - else if (currentConfigType == DeviceConfigurationOption_X509DeviceCertificates) - { - if (offset == 0) + else if (configuration == DeviceConfigurationOption_X509DeviceCertificates) { - HAL_Configuration_X509DeviceCertificate *deviceCertificate = - (HAL_Configuration_X509DeviceCertificate *)config; - - // First block of certificate bundle - // set total bundle size including header - // because X509 certificate has a variable length need to compute the block size in two steps - savedBundleSize = offsetof(HAL_Configuration_X509DeviceCertificate, Certificate); - savedBundleSize += deviceCertificate->CertificateSize; - remainingBundleSize = savedBundleSize; - savedBundleOffset = 0; - - // Free if already allocated ( could be different size ) - if (g_TargetConfiguration.DeviceCertificates->Certificates[certificateIndex] != 0) + // need to free memory before enumerating again + if (g_TargetConfiguration.DeviceCertificates->Count > 0) { - platform_free((void *)g_TargetConfiguration.DeviceCertificates->Certificates); + platform_free(g_TargetConfiguration.DeviceCertificates->Certificates[0]); } + platform_free(g_TargetConfiguration.DeviceCertificates); - g_TargetConfiguration.DeviceCertificates->Certificates[certificateIndex] = - (HAL_Configuration_X509DeviceCertificate *)platform_malloc(savedBundleSize); - -#ifdef DEBUG_CONFIG - ets_printf("Device certificate block total size:%d\n", deviceCertificate->CertificateSize); -#endif - } - - // The current chunk size is what remains in current block - // we can't use offset as it relates to flash memory offset, not useful - chunkSize = remainingBlockSize; - - // Copy into correct position in memory - memcpy( - (void *)(g_TargetConfiguration.DeviceCertificates->Certificates[0] + savedBundleOffset), - (const void *)config, - chunkSize); -#ifdef DEBUG_CONFIG - ets_printf("Device certificate chunksize:%d reminaing:%d\n", chunkSize, savedBundleSize); - PrintBlock((char *)config, 32); -#endif - config += chunkSize; - remainingBundleSize -= chunkSize; - savedBundleOffset += chunkSize; - // Return true for partial blocks - result = true; - - if (remainingBundleSize <= 0) - { - // Save Certificate Bundle to storage - result = StoreConfigBlock( - DeviceConfigurationOption_X509CaRootBundle, - certificateIndex, - (void *)g_TargetConfiguration.DeviceCertificates->Certificates[certificateIndex], - savedBundleSize); - certificateIndex++; -#ifdef DEBUG_CONFIG - ets_printf("Device certificate complete, saving\n"); -#endif + g_TargetConfiguration.DeviceCertificates = + ConfigStorage_FindX509DeviceCertificatesConfigurationBlocks(); } - -#ifdef DEBUG_CONFIG - ets_printf("X509 certificate block ret:%d\n", result); -#endif - } - // Network interface block ? - else if (currentConfigType == DeviceConfigurationOption_Network) - { - HAL_Configuration_NetworkInterface *pNetConfig = (HAL_Configuration_NetworkInterface *)config; - config += sizeof(HAL_Configuration_NetworkInterface); - - result = StoreConfigBlock( - currentConfigType, - configurationIndex, - (void *)pNetConfig, - sizeof(HAL_Configuration_NetworkInterface)); - configurationIndex++; - -#ifdef DEBUG_CONFIG - ets_printf("Network block %X %X ret:%d\n", pNetConfig->InterfaceType, pNetConfig->SpecificConfigId, result); - PrintBlock((char *)pNetConfig, sizeof(HAL_Configuration_NetworkInterface)); -#endif } - // Wireless block ? - else if (currentConfigType == DeviceConfigurationOption_Wireless80211Network) - { - HAL_Configuration_Wireless80211 *pWirelessConfig = (HAL_Configuration_Wireless80211 *)config; - config += sizeof(HAL_Configuration_Wireless80211); - - result = StoreConfigBlock( - currentConfigType, - pWirelessConfig->Id, - (void *)pWirelessConfig, - sizeof(HAL_Configuration_Wireless80211)); - -#ifdef DEBUG_CONFIG - ets_printf( - "Wireless block %d ssid:%s password:%s ret:%d\n", - pWirelessConfig->Id, - pWirelessConfig->Ssid, - pWirelessConfig->Password, - result); - PrintBlock((char *)pWirelessConfig, sizeof(HAL_Configuration_Wireless80211)); -#endif - } - else - { - break; - } - - } // while + } -#ifdef DEBUG_CONFIG - ets_printf("StoreConfig ALL exit %d\n", (int)result); -#endif - return result; + return AppendConfigBlock(configuration, configurationIndex, configurationBlock, blockSize); } // @@ -709,8 +519,8 @@ bool ConfigurationManager_StoreConfigurationBlockAll(void *configurationBlock, u // configuration : Type of configuration block to store or All for block with multiple types // configurationIndex : Index of type to store ( not used for All ) // blockSize : Size of data pointed to by configurationBlock -// offset : Offset of data when multiple blocks ( currently Certificate Bundles only ), For single type -// this is offset withing the type +// offset : Offset of data when multiple blocks (used for X502 CA Root and device certificate). +// For remaining types this should be zero. // For ALL type blocks this is the offset in the total data of multiple types. // Return:- // true - OK @@ -738,10 +548,8 @@ bool ConfigurationManager_StoreConfigurationBlock( if (configuration == DeviceConfigurationOption_All) { - result = ConfigurationManager_StoreConfigurationBlockAll(configurationBlock, blockSize, offset); - - // enumeration is required after we are DONE with SUCCESSFULLY storing all the config chunks - requiresEnumeration = (result && done); + // not supported + return false; } else { @@ -765,10 +573,18 @@ bool ConfigurationManager_StoreConfigurationBlock( // check for 0 size on certificate if (((HAL_Configuration_X509CaRootBundle *)configurationBlock)->CertificateSize) { - // set blockSize size ( Total size of X509 certificate ) - // because X509 certificate has a variable length need to compute the block size in two steps - blockSize = offsetof(HAL_Configuration_X509CaRootBundle, Certificate); - blockSize += ((HAL_Configuration_X509CaRootBundle *)configurationBlock)->CertificateSize; + result = ConfigurationManager_StoreConfigurationBlockCertificate( + configuration, + configurationIndex, + configurationBlock, + blockSize, + offset); + + // reset blockSize because storing has been handled + blockSize = 0; + + // enumeration is required after we are DONE with SUCCESSFULLY storing all the config chunks + requiresEnumeration = (result && done); } else { @@ -780,12 +596,12 @@ bool ConfigurationManager_StoreConfigurationBlock( { // reset this blockSize = 0; + + // enumeration is required + requiresEnumeration = true; } } - // removing or adding a config, enumeration is required - requiresEnumeration = true; - #ifdef DEBUG_CONFIG ets_printf( "StoreConfig x509 blockSize:%d, certsize:%d", @@ -798,10 +614,18 @@ bool ConfigurationManager_StoreConfigurationBlock( // check for 0 size on certificate if (((HAL_Configuration_X509DeviceCertificate *)configurationBlock)->CertificateSize) { - // set blockSize size ( Total size of X509 certificate ) - // because X509 certificate has a variable length need to compute the block size in two steps - blockSize = offsetof(HAL_Configuration_X509DeviceCertificate, Certificate); - blockSize += ((HAL_Configuration_X509DeviceCertificate *)configurationBlock)->CertificateSize; + result = ConfigurationManager_StoreConfigurationBlockCertificate( + configuration, + configurationIndex, + configurationBlock, + blockSize, + offset); + + // reset blockSize because storing has been handled + blockSize = 0; + + // enumeration is required after we are DONE with SUCCESSFULLY storing all the config chunks + requiresEnumeration = (result && done); } else { @@ -813,12 +637,12 @@ bool ConfigurationManager_StoreConfigurationBlock( { // reset this blockSize = 0; + + // enumeration is required + requiresEnumeration = true; } } - // removing or adding a config, enumeration is required - requiresEnumeration = true; - #ifdef DEBUG_CONFIG ets_printf( "StoreDeviceCert blockSize:%d, certsize:%d", @@ -999,7 +823,7 @@ HAL_Configuration_X509CaRootBundle *ConfigurationManager_GetCertificateStore() HAL_Configuration_X509DeviceCertificate *ConfigurationManager_GetDeviceCertificate() { - if (g_TargetConfiguration.CertificateStore->Count) + if (g_TargetConfiguration.DeviceCertificates->Count) { // get cert store size int32_t certSize = diff --git a/targets/ESP32/_common/targetHAL_Network.cpp b/targets/ESP32/_common/targetHAL_Network.cpp index b098ed6478..3611996b52 100644 --- a/targets/ESP32/_common/targetHAL_Network.cpp +++ b/targets/ESP32/_common/targetHAL_Network.cpp @@ -16,6 +16,9 @@ extern "C" void set_signal_sock_function(void (*funcPtr)()); //#define PRINT_NET_EVENT 1 +// buffer with host name +char hostName[18] = "nanodevice_"; + // // Call-back from LWIP on event // @@ -77,6 +80,24 @@ static void initialize_sntp() sntp_init(); } +static void compose_esp32_hostname() +{ + // compose host name with nanodevice and last 3 bytes of MAC address + // nanodevice_XXXXXX + uint8_t mac[6]; + char *macPosition = hostName + 11; + + // get MAC address + esp_efuse_mac_get_default(mac); + + // copy over last 3 bytes of MAC address + for (int index = 3; index < 6; index++) + { + sprintf(macPosition, "%02X", (int)mac[index]); + macPosition += 2; + } +} + // // Network event loop handler // @@ -84,6 +105,7 @@ static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_ { esp_err_t result; int stationIndex; + esp_netif_t *espNetif; wifi_event_ap_staconnected_t *apConnectedEvent; wifi_event_ap_stadisconnected_t *apDisconnectedEvent; wifi_event_sta_disconnected_t *staDisconnectedEvent; @@ -102,6 +124,12 @@ static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_ ets_printf("WIFI_EVENT_STA_START\n"); #endif + // get Netif for STA + espNetif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF"); + + // set host name for STA + esp_netif_set_hostname(espNetif, hostName); + if (NF_ESP32_IsToConnect) { // start connect @@ -271,6 +299,12 @@ static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_ #ifdef PRINT_NET_EVENT ets_printf("ETHERNET_EVENT_START\n"); #endif + // get Netif for ETH + espNetif = esp_netif_get_handle_from_ifkey("ETH_DEF"); + + // set host name for ETH + esp_netif_set_hostname(espNetif, hostName); + break; case ETHERNET_EVENT_STOP: @@ -307,6 +341,9 @@ void nanoHAL_Network_Initialize() // initialize network interface ESP_ERROR_CHECK(esp_netif_init()); + // set hostname + compose_esp32_hostname(); + // create the default event loop ESP_ERROR_CHECK(esp_event_loop_create_default()); diff --git a/targets/ESP32/_lwIP/nf_sockets.c b/targets/ESP32/_lwIP/nf_sockets.c index 480d6df033..11b5d93621 100644 --- a/targets/ESP32/_lwIP/nf_sockets.c +++ b/targets/ESP32/_lwIP/nf_sockets.c @@ -85,9 +85,8 @@ struct lwip_sock #endif #if ESP_LWIP_LOCK - sys_mutex_t lock; + sys_mutex_t lock; #endif - }; #ifndef set_errno @@ -1171,6 +1170,7 @@ int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) { LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) operation in progress\n", s)); sock_set_errno(sock, err_to_errno(err)); + done_socket(sock); return -1; } // [END_NF_CHANGE] @@ -5078,6 +5078,7 @@ static void lwip_socket_drop_registered_mld6_memberships(int s) uint32_t lwip_socket_get_err(int s) { struct lwip_sock *sock = get_socket(s); + done_socket(sock); return sock->err; } // [END_NF_CHANGE] diff --git a/targets/ESP32/_nanoCLR/Memory.cpp b/targets/ESP32/_nanoCLR/Memory.cpp index 938a502316..7d69bd5966 100644 --- a/targets/ESP32/_nanoCLR/Memory.cpp +++ b/targets/ESP32/_nanoCLR/Memory.cpp @@ -23,12 +23,17 @@ static const char *TAG = "Memory"; // Space to leave free in SPIRAM for allocation by IDF malloc #define SPIRAM_MEMORY_LEAVE_FOR_ALLOCATION (256 * 1024) -// You can't go much bigger than this when allocating in internal memory to -// get memory in one continuous lump. -#define INTERNAL_MEMORY_SIZE (84 * 1024) +#if HAL_USE_BLE +// Reduce Managed heap if using BLE without spiram +#define INTERNAL_RAM_LEAVE_FREE_FOR_ALLOCATION (30 * 1024) +#else +// Space to leave free in internal RAM for allocation by IDF malloc +// no need to leave any RAM free at this time +#define INTERNAL_RAM_LEAVE_FREE_FOR_ALLOCATION (0 * 1024) +#endif // Saved memory allocation for when heap is reset so we can return same value. -unsigned char *pManagedHeap = NULL; +unsigned char *managedHeap = NULL; size_t managedHeapSize = 0; extern "C" @@ -89,73 +94,68 @@ void HeapLocation(unsigned char *&baseAddress, unsigned int &sizeInBytes) NATIVE_PROFILE_PAL_HEAP(); // Memory allocated yet ? - if (pManagedHeap == NULL) + if (managedHeap == NULL) { - // Memory size to allocate in normal memory if PSRAM not available - managedHeapSize = INTERNAL_MEMORY_SIZE; - ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// // uncomment, in case there is a need to check the heap info - // print_heap_info(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM); + // print_heap_info(MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_SPIRAM); ////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////// - // See if we have any SPIRAM - size_t spiramMaxSize = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_SPIRAM); + // default memory caps + uint32_t memoryCaps = MALLOC_CAP_8BIT | MALLOC_CAP_32BIT; + size_t largestFreeBlock; + + // check if we have any SPIRAM + size_t spiramMaxSize = heap_caps_get_largest_free_block(memoryCaps | MALLOC_CAP_SPIRAM); // Sanity check - Make sure there is at least managedHeapSize available in SPIRAM if (spiramMaxSize) { - // Allocate heap from SPIRAM + // add SPIRAM to request memory caps + memoryCaps |= MALLOC_CAP_SPIRAM; + + // store max allocation size + largestFreeBlock = spiramMaxSize; + + // get heap size to allocate managedHeapSize = spiramMaxSize - SPIRAM_MEMORY_LEAVE_FOR_ALLOCATION; - pManagedHeap = (unsigned char *)heap_caps_malloc( - managedHeapSize, - MALLOC_CAP_8BIT | MALLOC_CAP_32BIT | MALLOC_CAP_SPIRAM); - - if (pManagedHeap) - { - // managed heap successfully allocated from SPIRAM - ESP_LOGI(TAG, "Managed heap allocated from SPIRAM: %d (from max:%d)", managedHeapSize, spiramMaxSize); - } - else - { - // failed to allocation managed heap from SPIRAM - ESP_LOGI(TAG, "Failed to allocate managed heap from SPIRAM"); - } + ESP_LOGI(TAG, "Allocating managed heap from SPIRAM"); + } + else + { + // allocate from internal RAM + + // find out how much can be allocated? + largestFreeBlock = heap_caps_get_largest_free_block(memoryCaps); + + // get heap size to allocate + managedHeapSize = largestFreeBlock - INTERNAL_RAM_LEAVE_FREE_FOR_ALLOCATION; + + ESP_LOGI(TAG, "Allocating managed heap from internal RAM"); } - while (pManagedHeap == NULL) + // allocate managed heap + managedHeap = (unsigned char *)heap_caps_malloc(managedHeapSize, memoryCaps); + + if (managedHeap) + { + // managed heap successfully allocated + ESP_LOGI(TAG, "Managed heap allocated: %d (from max:%d)", managedHeapSize, largestFreeBlock); + } + else { - // Allocate heap from Internal RAM - pManagedHeap = (unsigned char *)heap_caps_malloc(managedHeapSize, MALLOC_CAP_8BIT | MALLOC_CAP_32BIT); - - if (pManagedHeap) - { - ESP_LOGI(TAG, "Managed heap allocated from internal RAM: %d", managedHeapSize); - } - else - { - // Subtract 1K and try again - managedHeapSize -= 1024; - - if (managedHeapSize <= 0) - { - ESP_LOGE(TAG, "Unable to allocate memory for managed heap"); - - ASSERT(false); - - return; - } - } + // failed to allocate + ESP_LOGI(TAG, "Failed to allocate managed heap"); } } - baseAddress = pManagedHeap; + baseAddress = managedHeap; sizeInBytes = managedHeapSize; // Update System configuration with Heap location and size HalSystemConfig.RAM1.Size = managedHeapSize; - HalSystemConfig.RAM1.Base = (unsigned int)pManagedHeap; + HalSystemConfig.RAM1.Base = (unsigned int)managedHeap; } diff --git a/targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native_Windows_Devices_WIFI_WifiAdapter.cpp b/targets/ESP32/_nanoCLR/System.Device.WiFi/sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter.cpp similarity index 76% rename from targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native_Windows_Devices_WIFI_WifiAdapter.cpp rename to targets/ESP32/_nanoCLR/System.Device.WiFi/sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter.cpp index debbde279c..76caf84b83 100644 --- a/targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native_Windows_Devices_WIFI_WifiAdapter.cpp +++ b/targets/ESP32/_nanoCLR/System.Device.WiFi/sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter.cpp @@ -4,12 +4,12 @@ // See LICENSE file in the project root for full license information. // -#include "win_dev_wifi_native.h" -#include "nf_rt_events_native.h" -#include "esp_wifi_types.h" +#include +#include +#include /////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH Windows.Devices.WiFi (in managed code) !!! // +// !!! KEEP IN SYNC WITH System.Device.WiFi (in managed code) !!! // /////////////////////////////////////////////////////////////////////////////////////// struct ScanRecord { @@ -20,40 +20,7 @@ struct ScanRecord uint8_t cypherType; }; -/////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH Windows.Devices.WiFi (in managed code) !!! // -/////////////////////////////////////////////////////////////////////////////////////// -enum WiFiConnectionStatus -{ - AccessRevoked = 0, - InvalidCredential, - NetworkNotAvailable, - Success, - Timeout, - UnspecifiedFailure, - UnsupportedAuthenticationProtocol -}; - -/////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH Windows.Devices.WiFi (in managed code) !!! // -/////////////////////////////////////////////////////////////////////////////////////// -enum WiFiNetworkKind -{ - Adhoc = 0, - Any, - Infrastructure -}; - -/////////////////////////////////////////////////////////////////////////////////////// -// !!! KEEP IN SYNC WITH Windows.Devices.WiFi (in managed code) !!! // -/////////////////////////////////////////////////////////////////////////////////////// -enum WiFiReconnectionKind -{ - Automatic = 0, - Manual -}; - -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::DisposeNative___VOID(CLR_RT_StackFrame &stack) +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::DisposeNative___VOID(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); (void)stack; @@ -61,7 +28,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::DisposeNat NANOCLR_NOCLEANUP_NOLABEL(); } -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeInit___VOID(CLR_RT_StackFrame &stack) +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeInit___VOID(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); (void)stack; @@ -72,7 +39,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeInit // // Pickup Net interface index and do checks // -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNetInterfaceIndex( +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::GetNetInterfaceIndex( CLR_RT_StackFrame &stack, int *pNetIndex) { @@ -81,7 +48,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNetInte CLR_RT_HeapBlock *pThis = stack.This(); FAULT_ON_NULL(pThis); - if (pThis[Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::FIELD___disposedValue] + if (pThis[Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::FIELD___disposedValue] .NumericByRef() .u1 != 0) { @@ -96,8 +63,8 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNetInte // // Connect to Wireless connection to passed SSID / passPhase // -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: - NativeConnect___WindowsDevicesWiFiWiFiConnectionStatus__STRING__STRING__WindowsDevicesWiFiWiFiReconnectionKind( +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter:: + NativeConnect___SystemDeviceWiFiWiFiConnectionStatus__STRING__STRING__SystemDeviceWiFiWiFiReconnectionKind( CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); @@ -110,7 +77,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: CLR_RT_HeapBlock hbTimeout; CLR_INT64 *timeout; bool eventResult = true; - WiFiConnectionStatus Status = UnspecifiedFailure; + WiFiConnectionStatus Status = WiFiConnectionStatus_UnspecifiedFailure; NANOCLR_CHECK_HRESULT(GetNetInterfaceIndex(stack, &netIndex)); @@ -135,7 +102,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: res = (esp_err_t)Network_Interface_Start_Connect(netIndex, szSsid, szPassPhase, reconnectionKind); if (res != ESP_OK) { - Status = UnspecifiedFailure; + Status = WiFiConnectionStatus_UnspecifiedFailure; eventResult = false; } } @@ -150,11 +117,11 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: switch (connectResult) { case 0: - Status = Success; + Status = WiFiConnectionStatus_Success; break; case WIFI_REASON_NO_AP_FOUND: - Status = NetworkNotAvailable; + Status = WiFiConnectionStatus_NetworkNotAvailable; break; case WIFI_REASON_AUTH_EXPIRE: @@ -163,11 +130,11 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: case WIFI_REASON_AUTH_FAIL: case WIFI_REASON_ASSOC_FAIL: case WIFI_REASON_HANDSHAKE_TIMEOUT: - Status = InvalidCredential; + Status = WiFiConnectionStatus_InvalidCredential; break; default: - Status = UnspecifiedFailure; + Status = WiFiConnectionStatus_UnspecifiedFailure; break; } break; @@ -183,7 +150,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: if (!eventResult) { // Timeout - Status = Timeout; + Status = WiFiConnectionStatus_Timeout; break; } } @@ -197,7 +164,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter:: // // Disconnect WiFi connection // -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeDisconnect___VOID(CLR_RT_StackFrame &stack) +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeDisconnect___VOID(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); { @@ -210,7 +177,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeDisc NANOCLR_NOCLEANUP(); } -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeScanAsync___VOID(CLR_RT_StackFrame &stack) +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeScanAsync___VOID(CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); { @@ -236,7 +203,10 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeScan // unit8_t RSSI // // Return : length in pTarget -int StoreApRecordsToString(uint8_t *pTarget, wifi_ap_record_t *apRecords, uint16_t recordCount) +int Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::StoreApRecordsToString( + uint8_t *pTarget, + wifi_ap_record_t *apRecords, + uint16_t recordCount) { int index; @@ -263,7 +233,7 @@ int StoreApRecordsToString(uint8_t *pTarget, wifi_ap_record_t *apRecords, uint16 } // private extern WiFiNetworkReport NativeNetworkReport(); -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNativeScanReport___SZARRAY_U1( +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::GetNativeScanReport___SZARRAY_U1( CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); @@ -321,7 +291,7 @@ HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::GetNativeS NANOCLR_CLEANUP_END(); } -HRESULT Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter::NativeFindWirelessAdapters___STATIC__SZARRAY_U1( +HRESULT Library_sys_dev_wifi_native_System_Device_WiFi_WiFiAdapter::NativeFindWirelessAdapters___STATIC__SZARRAY_U1( CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); diff --git a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp index 3fe455b937..a14fd447c5 100644 --- a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp +++ b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_Directory.cpp @@ -204,6 +204,8 @@ int CountEntries(const char *folderPath, int type) } } + closedir(currentDirectory); + return count; } @@ -211,11 +213,11 @@ HRESULT BuildPathsArray(const char *vfsFolderPath, const char *folderPath, CLR_R { char *stringBuffer = NULL; char *workingBuffer = NULL; + DIR *currentDirectory = NULL; NANOCLR_HEADER(); { CLR_RT_HeapBlock *pathEntry; - DIR *currentDirectory; struct dirent *fileInfo; // get a pointer to the first object in the array (which is of type ) @@ -271,11 +273,17 @@ HRESULT BuildPathsArray(const char *vfsFolderPath, const char *folderPath, CLR_R } NANOCLR_CLEANUP(); - if (stringBuffer == NULL) + if (currentDirectory != NULL) + { + closedir(currentDirectory); + } + + if (stringBuffer != NULL) { platform_free(stringBuffer); } - if (workingBuffer == NULL) + + if (workingBuffer != NULL) { platform_free(workingBuffer); } diff --git a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_FileStream.cpp b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_FileStream.cpp index b8fa17c25a..25fe01c911 100644 --- a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_FileStream.cpp +++ b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_System_IO_FileStream.cpp @@ -334,8 +334,8 @@ HRESULT Library_nf_sys_io_filesystem_System_IO_FileStream::WriteNative___VOID__S // Convert to ESP32 VFS path vfsPath = ConvertToVfsPath(filePath); - // open file for write - file = fopen(vfsPath, "w"); + // open file for write / read + file = fopen(vfsPath, "a+"); if (file != NULL) { // Change to actual position in file to start write diff --git a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard.cpp b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard.cpp index f60d7a0d45..133c4cb486 100644 --- a/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard.cpp +++ b/targets/ESP32/_nanoCLR/System.IO.FileSystem/nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard.cpp @@ -5,14 +5,6 @@ #include "nf_sys_io_filesystem.h" -// these live at targets\FreeRTOS_ESP32\_nanoCLR\Windows.Storage\win_storage_native_Windows_Storage_Devices_SDCard.cpp -// TODO move code here after removing Windows.Storage.Devices -bool Storage_MountMMC(bool bit1Mode, int driveIndex); -bool Storage_MountSpi(int spiBus, uint32_t CSPin, int driveIndex); -bool Storage_InitSDCardSPI(char *vfsName, int maxFiles, int pin_Miso, int pin_Mosi, int pin_Clk, int pin_Cs); -bool Storage_InitSDCardMMC(char *vfsName, int maxFiles, bool bit1Mode); -bool Storage_UnMountSDCard(); - StorageEventType GetStorageEventType(bool pinState) { // Low means card inserted @@ -210,7 +202,7 @@ HRESULT Library_nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard:: { NANOCLR_HEADER(); -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) SDCard_SDInterfaceType cardType; @@ -251,6 +243,10 @@ HRESULT Library_nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard:: // Get current Gpio pins used by SPI device spiBus--; // Spi devnumber 0 & 1 + // Try to initialised SPI bus in case it's not open, mount requires bus to be already initialised + // Ignore errors as it may already been opened by managed code if trying to share bus + CPU_SPI_Initialize(spiBus); + // Try mount twice if (!Storage_MountSpi(spiBus, chipSelectPin, 0)) { @@ -285,7 +281,7 @@ HRESULT Library_nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard:: { NANOCLR_HEADER(); -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) SDCard_SDInterfaceType cardType; @@ -335,7 +331,7 @@ HRESULT Library_nf_sys_io_filesystem_nanoFramework_System_IO_FileSystem_SDCard:: { NANOCLR_HEADER(); -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) int cardDetectPin; CLR_RT_HeapBlock *pThis = stack.This(); diff --git a/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp b/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp index c75f3952e9..a4783dd511 100644 --- a/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp +++ b/targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp @@ -63,6 +63,7 @@ void UnitializePalUart_sys(NF_PAL_UART *palUart) uart_event_t event; event.type = UART_EVENT_MAX; xQueueSend(palUart->UartEventQueue, &event, (portTickType)0); + palUart->UartEventTask = NULL; // free buffer memory platform_free(palUart->RxBuffer); @@ -74,14 +75,6 @@ void UnitializePalUart_sys(NF_PAL_UART *palUart) // delete driver uart_driver_delete((uart_port_t)palUart->UartNum); - - // delete task, if any - if (palUart->UartEventTask) - { - vTaskDelete(palUart->UartEventTask); - } - - palUart->UartEventTask = NULL; } } diff --git a/targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native.h b/targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native.h deleted file mode 100644 index 44976f9227..0000000000 --- a/targets/ESP32/_nanoCLR/Windows.Devices.Wifi/win_dev_wifi_native.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - - -#ifndef WIN_DEV_WIFI_NATIVE_TARGET_H -#define WIN_DEV_WIFI_NATIVE_TARGET_H - -#include -#include -#include -#include - - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAdapter -{ - static const int FIELD_STATIC__s_eventListener = 0; - - static const int FIELD___networkInterface = 1; - static const int FIELD___syncLock = 2; - static const int FIELD__AvailableNetworksChanged = 3; - static const int FIELD___disposedValue = 4; - - NANOCLR_NATIVE_DECLARE(DisposeNative___VOID); - NANOCLR_NATIVE_DECLARE(NativeInit___VOID); - NANOCLR_NATIVE_DECLARE(NativeConnect___WindowsDevicesWiFiWiFiConnectionStatus__STRING__STRING__WindowsDevicesWiFiWiFiReconnectionKind); - NANOCLR_NATIVE_DECLARE(NativeDisconnect___VOID); - NANOCLR_NATIVE_DECLARE(NativeScanAsync___VOID); - NANOCLR_NATIVE_DECLARE(GetNativeScanReport___SZARRAY_U1); - NANOCLR_NATIVE_DECLARE(NativeFindWirelessAdapters___STATIC__SZARRAY_U1); - - //--// - - static HRESULT GetNetInterfaceIndex(CLR_RT_StackFrame& stack, int * pNetIndex); -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiAvailableNetwork -{ - static const int FIELD___bsid = 1; - static const int FIELD___ssid = 2; - static const int FIELD___rssi = 3; - static const int FIELD___networkKind = 4; - - - //--// - -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiConnectionResult -{ - static const int FIELD___ConnectionStatus = 1; - - - //--// - -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiEvent -{ - static const int FIELD__EventType = 3; - static const int FIELD__Time = 4; - - - //--// - -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiEventListener -{ - static const int FIELD__wifiAdapters = 1; - - - //--// - -}; - -struct Library_win_dev_wifi_native_Windows_Devices_WiFi_WiFiNetworkReport -{ - static const int FIELD___wifiNetworks = 1; - - - //--// - -}; - -extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_Windows_Devices_Wifi; - -#endif //WIN_DEV_WIFI_NATIVE_TARGET_H diff --git a/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_Devices_SDCard.cpp b/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_Devices_SDCard.cpp index 55b63978b5..8a76c6b071 100644 --- a/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_Devices_SDCard.cpp +++ b/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_Devices_SDCard.cpp @@ -9,54 +9,14 @@ #include #include -#if defined(HAL_USE_SDC) - -bool Storage_MountMMC(bool bit1Mode, int driveIndex = 0) -{ - char mountPoint[] = INDEX0_DRIVE_LETTER; - - // Change fatfs drive letter to mount point D: -> /D - mountPoint[1] = mountPoint[0] + driveIndex; - mountPoint[0] = '/'; - - // Try mounting - if (!Storage_InitSDCardMMC(mountPoint, SDC_MAX_OPEN_FILES, bit1Mode)) - { - return false; - } - return true; -} - -bool Storage_MountSpi(int spiBus, uint32_t CSPin, int driveIndex = 0) -{ - char mountPoint[] = INDEX0_DRIVE_LETTER; - - // Change fatfs drive letter to mount point D: -> /D for ESP32 VTFS - mountPoint[1] = mountPoint[0] + driveIndex; - mountPoint[0] = '/'; - - int mosiPin = Esp32_GetMappedDevicePins(DEV_TYPE_SPI, spiBus, 0); - int misoPin = Esp32_GetMappedDevicePins(DEV_TYPE_SPI, spiBus, 1); - int clockPin = Esp32_GetMappedDevicePins(DEV_TYPE_SPI, spiBus, 2); - - // Try mounting - if (!Storage_InitSDCardSPI(mountPoint, SDC_MAX_OPEN_FILES, misoPin, mosiPin, clockPin, CSPin)) - { - return false; - } - return true; -} - -#endif - HRESULT Library_win_storage_native_Windows_Storage_Devices_SDCard::MountMMCNative___STATIC__VOID__BOOLEAN( CLR_RT_StackFrame &stack) { NANOCLR_HEADER(); -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) bool bit1Mode = stack.Arg0().NumericByRef().s4; - if (!Storage_MountMMC(bit1Mode)) + if (!Storage_MountMMC(bit1Mode, 0)) { NANOCLR_SET_AND_LEAVE(CLR_E_VOLUME_NOT_FOUND); } @@ -72,7 +32,7 @@ HRESULT Library_win_storage_native_Windows_Storage_Devices_SDCard::MountSpiNativ { NANOCLR_HEADER(); -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) // Get passed SPi bus number 1 or 2 int spiBus = stack.Arg0().NumericByRef().s4; @@ -82,7 +42,11 @@ HRESULT Library_win_storage_native_Windows_Storage_Devices_SDCard::MountSpiNativ // Get current Gpio pins used by SPI device spiBus--; // Spi devnumber 0 & 1 - if (!Storage_MountSpi(spiBus, CSPin)) + // Try to initialised SPI bus in case it's not open, mount requires bus to be already initialised + // Ignore errors as it may already been opened by managed code if trying to share bus + CPU_SPI_Initialize(spiBus); + + if (!Storage_MountSpi(spiBus, CSPin, 0)) { NANOCLR_SET_AND_LEAVE(CLR_E_VOLUME_NOT_FOUND); } @@ -100,7 +64,7 @@ HRESULT Library_win_storage_native_Windows_Storage_Devices_SDCard::UnmountNative NANOCLR_HEADER(); (void)stack; -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) // Unmount SPI device if (!Storage_UnMountSDCard()) diff --git a/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp b/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp index 79926cae2a..d4a4de9ef6 100644 --- a/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp +++ b/targets/ESP32/_nanoCLR/Windows.Storage/win_storage_native_Windows_Storage_FileIO.cpp @@ -13,12 +13,6 @@ typedef Library_win_storage_native_Windows_Storage_StorageFolder StorageFolder; typedef Library_win_storage_native_Windows_Storage_StorageFile StorageFile; -extern "C" -{ - bool Storage_InitSDCardMMC(char *vfsName, int maxFiles, bool bit1Mode); - bool Storage_InitSDCardSPI(char *vfsName, int maxFiles, int pin_Miso, int pin_Mosi, int pin_Clk, int pin_Cs); -}; - // Queue length for IO task #define StorageQueueLength 4 diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/esp32_nimble.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/esp32_nimble.cpp new file mode 100644 index 0000000000..b277a7ff16 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/esp32_nimble.cpp @@ -0,0 +1,432 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include +#include "Esp32_DeviceMapping.h" +#include "nanoPAL.h" +#include "sys_dev_ble_native.h" + +static const char *tag = "BLE"; +static uint8_t esp32_addr_type; + +void esp32_ble_start_advertise(ble_context *context); + +uint16_t ble_event_next_id = 1; +device_ble_event_data ble_event_data; +EventGroupHandle_t ble_event_waitgroup; +bool ble_initialized = false; +// +// Look up Attr_handle in characteristicsDefs table to find our characteristicsId +// return 0xffff if not found otherwise characteristicsId +uint16_t FindIdFromHandle(ble_gatt_chr_def *characteristicsDefs, int countDefs, uint16_t attr_handle) +{ + uint16_t id = 0xffff; + + for (int index = 0; index < countDefs; index++) + { + // ESP_LOGI(tag, "FindIdFromHandle; find ah=%d - vh %d arg %d\n", attr_handle, + // *(characteristicsDefs[index].val_handle), (uint32_t)characteristicsDefs[index].arg ); + if (*(characteristicsDefs[index].val_handle) == attr_handle) + { + id = (uint16_t)(uint32_t)characteristicsDefs[index].arg; + break; + } + } + + return id; +} + +uint16_t FindHandleIdFromId(ble_gatt_chr_def *characteristicsDefs, int countDefs, uint16_t characteristicId) +{ + uint16_t handle = 0xffff; + + for (int index = 0; index < countDefs; index++) + { + // ESP_LOGI(tag, "FindHandleIdFromId; find ah=%d - vh %d arg %d\n", attr_handle, + // *(characteristicsDefs[index].val_handle), (uint32_t)characteristicsDefs[index].arg ); + if ((uint32_t)characteristicsDefs[index].arg == (uint32_t)characteristicId) + { + handle = *(characteristicsDefs[index].val_handle); + break; + } + } + + return handle; +} + +static int esp32_gap_event(struct ble_gap_event *event, void *arg) +{ + ble_context *con = (ble_context *)arg; + + switch (event->type) + { + + case BLE_GAP_EVENT_CONNECT: + // A new connection was established or a connection attempt failed + ESP_LOGI( + tag, + "connection %s; status=%d\n", + event->connect.status == 0 ? "established" : "failed", + event->connect.status); + + break; + + case BLE_GAP_EVENT_DISCONNECT: + ESP_LOGI(tag, "BLE_GAP_EVENT_DISCONNECT; reason=%d\n", event->disconnect.reason); + + // Connection terminated; resume advertising + esp32_ble_start_advertise(con); + break; + + case BLE_GAP_EVENT_ADV_COMPLETE: + ESP_LOGI(tag, "BLE_GAP_EVENT_ADV_COMPLETE adv complete"); + break; + + case BLE_GAP_EVENT_SUBSCRIBE: + { + BluetoothEventType op = BluetoothEventType_Read; + + // Find characteristicId from attr_handle + uint16_t characteristicId = + FindIdFromHandle(con->characteristicsDefs, con->characteristicsCount, event->subscribe.attr_handle); + + ESP_LOGI( + tag, + "BLE_GAP_EVENT_SUBSCRIBE conn_handle=%d attr_handle=%d " + "reason=%d prevn=%d curn=%d previ=%d curi=%d arg=%d\n", + event->subscribe.conn_handle, + event->subscribe.attr_handle, + event->subscribe.reason, + event->subscribe.prev_notify, + event->subscribe.cur_notify, + event->subscribe.prev_indicate, + event->subscribe.cur_indicate, + characteristicId); + + // Valid characteristicId + if (characteristicId == 0xffff) + { + break; // ignore + } + + switch (event->subscribe.reason) + { + // Peer's CCCD subscription state changed due to a descriptor write. + case BLE_GAP_SUBSCRIBE_REASON_WRITE: + if (event->subscribe.prev_indicate == 0 && event->subscribe.cur_indicate == 1) + { + op = BluetoothEventType_ClientSubscribed; + } + else if (event->subscribe.prev_notify == 0 && event->subscribe.cur_notify == 1) + { + op = BluetoothEventType_ClientSubscribed; + } + else if (event->subscribe.prev_indicate == 1 && event->subscribe.cur_indicate == 0) + { + op = BluetoothEventType_ClientUnsubscribed; + } + else if (event->subscribe.prev_notify == 1 && event->subscribe.cur_notify == 0) + { + op = BluetoothEventType_ClientUnsubscribed; + } + break; + + // Peer's CCCD subscription state cleared due to connection termination. + case BLE_GAP_SUBSCRIBE_REASON_TERM: + op = BluetoothEventType_ClientUnsubscribed; + break; + + // Peer's CCCD subscription state changed due to restore from persistence + case BLE_GAP_SUBSCRIBE_REASON_RESTORE: + op = BluetoothEventType_ClientSubscribed; + break; + } + + if (op != BluetoothEventType_Read) + { + PostManagedEvent(EVENT_BLUETOOTH, op, characteristicId, event->subscribe.conn_handle); + } + + // ESP_LOGI(tag, "BLE_GAP_SUBSCRIBE_EVENT conn_handle from subscribe=%d\n", conn_handle); + } + break; + + case BLE_GAP_EVENT_MTU: + ESP_LOGI( + tag, + "BLE_GAP_EVENT_MTU mtu update event; conn_handle=%d mtu=%d\n", + event->mtu.conn_handle, + event->mtu.value); + break; + } + + return 0; +} + +// +// Enables advertising with parameters: +// o General discoverable mode +// o Undirected connectable mode +// +void esp32_ble_start_advertise(ble_context *context) +{ + struct ble_gap_adv_params adv_params; + struct ble_hs_adv_fields fields; + int rc; + + // + // Set the advertisement data included in our advertisements: + // o Flags (indicates advertisement type and other general info) + // o Advertising tx power + // o Device name + // + memset(&fields, 0, sizeof(fields)); + + // + // Advertise two flags: + // o Discoverability in forthcoming advertisement (general) + // o BLE-only (BR/EDR unsupported) + // + fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; + + // + // Indicate that the TX power level field should be included; have the + // stack fill this value automatically. This is done by assigning the + // special value BLE_HS_ADV_TX_PWR_LVL_AUTO. + // + fields.tx_pwr_lvl_is_present = 1; + fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; + + fields.name = (uint8_t *)context->pDeviceName; + fields.name_len = hal_strlen_s(context->pDeviceName); + fields.name_is_complete = 1; + + rc = ble_gap_adv_set_fields(&fields); + if (rc != 0) + { + ESP_LOGI(tag, "error setting advertisement data; rc=%d\n", rc); + return; + } + + // Begin advertising + memset(&adv_params, 0, sizeof(adv_params)); + + if (context->isConnectable) + { + adv_params.conn_mode |= BLE_GAP_CONN_MODE_UND; + } + if (context->isDiscoverable) + { + adv_params.conn_mode |= BLE_GAP_DISC_MODE_GEN; + } + rc = ble_gap_adv_start(esp32_addr_type, NULL, BLE_HS_FOREVER, &adv_params, esp32_gap_event, (void *)&blecontext); + if (rc != 0) + { + ESP_LOGI(tag, "error enabling advertisement; rc=%d\n", rc); + return; + } +} + +static void esp32_ble_on_sync(void) +{ + int rc; + + rc = ble_hs_id_infer_auto(0, &esp32_addr_type); + if (rc != 0) + { + ESP_LOGI(tag, "error ble_hs_id_infer_auto; rc=%d\n", rc); + return; + } + + uint8_t addr_val[6] = {0}; + rc = ble_hs_id_copy_addr(esp32_addr_type, addr_val, NULL); + if (rc != 0) + { + ESP_LOGI(tag, "error ble_hs_id_copy_addr; rc=%d\n", rc); + return; + } + + ESP_LOGI( + tag, + "BLE on sync, adr %02x:%02x:%02x:%02x:%02x:%02x", + addr_val[5], + addr_val[4], + addr_val[3], + addr_val[2], + addr_val[1], + addr_val[0]); + + // Begin advertising + // debug_printf("Begin advertising\n"); + esp32_ble_start_advertise(&blecontext); +} + +static void esp32_ble_on_reset(int reason) +{ + ESP_LOGI(tag, "BLE on reset %d\n", reason); +} + +void esp32_ble_host_task(void *param) +{ + (void)param; + + ESP_LOGI(tag, "Bluetooth LE Host Task Started"); + // This function will return only when nimble_port_stop() is execute + nimble_port_run(); + + nimble_port_freertos_deinit(); +} + +void device_ble_dispose() +{ + int rc = nimble_port_stop(); + if (rc == 0) + { + nimble_port_deinit(); + + rc = esp_nimble_hci_and_controller_deinit(); + if (rc != ESP_OK) + { + ESP_LOGE(tag, "esp_nimble_hci_and_controller_deinit() failed with error: %d", rc); + } + } + + vEventGroupDelete(ble_event_waitgroup); + + ble_initialized = false; +} + +bool device_ble_init() +{ + // If already initialized then dispose first + // This can happen when you start debugger + if (ble_initialized) + { + device_ble_dispose(); + } + + ble_event_waitgroup = xEventGroupCreate(); + + // ESP_ERROR_CHECK(esp_nimble_hci_and_controller_init()); + if (esp_nimble_hci_and_controller_init() != ESP_OK) + { + device_ble_dispose(); + return false; + } + + nimble_port_init(); + + // Initialize the NimBLE host configuration + ble_hs_cfg.sync_cb = esp32_ble_on_sync; + ble_hs_cfg.reset_cb = esp32_ble_on_reset; + + ble_initialized = true; + + return true; +} + +int device_ble_start(ble_context *con) +{ + int rc; + ble_gatt_svc_def *gatt_svr_svcs = con->gatt_service_def; + + ble_svc_gap_init(); + ble_svc_gatt_init(); + + rc = ble_gatts_count_cfg(gatt_svr_svcs); + if (rc != 0) + { + return rc; + } + + rc = ble_gatts_add_svcs(gatt_svr_svcs); + if (rc != 0) + { + return rc; + } + + // Set the default device name + rc = ble_svc_gap_device_name_set(con->pDeviceName); + assert(rc == 0); + + // Start the BLE task + nimble_port_freertos_init(esp32_ble_host_task); + + return 0; +} + +// +// Read data for attribute from managed code +// +void device_ble_read(uint8_t *buffer, int buffer_length) +{ + int rc; + + rc = os_mbuf_append(ble_event_data.ctxt->om, buffer, buffer_length); + ble_event_data.result = rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + + // Signal BLE callback + xEventGroupSetBits(ble_event_waitgroup, 1); +} + +// +// Callback from Nimble for characteristic events +// These are posted to Managed code and if not handled within 500ms an error is reported to Nimble back to client +// This could be due to no event handler set up in managed code or just taking too long. +// +int device_ble_callback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) +{ + EventBits_t uxBits; + + // Save event context + ble_event_data.eventId = ble_event_next_id++; + ble_event_data.conn_handle = conn_handle; + ble_event_data.characteristicId = (uint16_t)(int)arg; + ble_event_data.ctxt = ctxt; + + BluetoothEventType op; + + // debug_printf("device_ble_callback attr %d op %d\n", attr_handle, ctxt->op); + + switch (ctxt->op) + { + case BLE_GATT_ACCESS_OP_READ_CHR: + op = BluetoothEventType_Read; + break; + + case BLE_GATT_ACCESS_OP_WRITE_CHR: + op = BluetoothEventType_Write; + break; + + // TODO handle descriptors + //#define BLE_GATT_ACCESS_OP_READ_DSC 2 + // #define BLE_GATT_ACCESS_OP_WRITE_DSC 3 + + default: + return BLE_ATT_ERR_REQ_NOT_SUPPORTED; + } + + // Post event to managed code + PostManagedEvent(EVENT_BLUETOOTH, op, ble_event_data.characteristicId, ble_event_data.eventId); + + // debug_printf("xEventGroupWaitBits\n"); + + // Wait for 1 second for event to be handled in managed code otherwise fail request + uxBits = xEventGroupWaitBits(ble_event_waitgroup, 1, pdTRUE, pdFALSE, (TickType_t)(1000 / portTICK_PERIOD_MS)); + // debug_printf("xEventGroupWaitBits exit %d\n", uxBits); + if (uxBits & 1) + { + // Event handled in managed code + return ble_event_data.result; + } + + // Reset eventid so managed code callback doesn't try to do anything + ble_event_data.eventId = -1; + + // Event not handled in manged code, timeout + // Return bluetooth error BLE_ATT_ERR_UNLIKELY + return BLE_ATT_ERR_UNLIKELY; +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble.h b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble.h new file mode 100644 index 0000000000..7dcace2c5f --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble.h @@ -0,0 +1,53 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#ifndef SYS_BLE_H +#define SYS_BLE_H + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include "esp_nimble_hci.h" +#include "nimble/nimble_port.h" +#include "nimble/nimble_port_freertos.h" +#include "host/ble_hs.h" +#include "host/ble_uuid.h" +#include "host/util/util.h" +#include "services/gap/ble_svc_gap.h" +#include "services/gatt/ble_svc_gatt.h" +#pragma GCC diagnostic pop + +typedef struct +{ + uint16_t eventId; + uint16_t conn_handle; + uint16_t characteristicId; + struct ble_gatt_access_ctxt *ctxt; + int result; +} device_ble_event_data; + +struct ble_context +{ + bool isDiscoverable; + bool isConnectable; + char *pDeviceName; + + int serviceCount; + ble_gatt_svc_def *gatt_service_def; + + int characteristicsCount; + ble_gatt_chr_def *characteristicsDefs; + ble_uuid_any_t *characteristicsUuids; + uint16_t *attrHandles; + + int descriptorCount; + ble_gatt_dsc_def *descriptorDefs; + ble_uuid_any_t *descriptorUuids; +}; + +extern ble_context blecontext; +extern device_ble_event_data ble_event_data; + +#endif // SYS_BLE_H diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble_nimble_chars.c b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble_nimble_chars.c new file mode 100644 index 0000000000..990254ec79 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_ble_nimble_chars.c @@ -0,0 +1,79 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +// +// Handling for Fixed characteristics for device information (Maybe this should be done in managed code) +// Note: Using "C" file as struct initializers don't work in CPP when using nimble, i.e. BLE_UUID16_DECLARE + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" + +#include "host/ble_hs.h" +#include "host/ble_uuid.h" +#include "services/gap/ble_svc_gap.h" +#include "services/gatt/ble_svc_gatt.h" + +#pragma GCC diagnostic pop + +#define GATT_MANUFACTURER_NAME_UUID 0x2A29 +#define GATT_MODEL_NUMBER_UUID 0x2A24 + +static const char *manuf_name = "Nanoframework"; +static const char *model_num = "ESP32"; + +static int gatt_svr_chr_access_device_info( + uint16_t conn_handle, + uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt, + void *arg); + +const struct ble_gatt_chr_def gatt_char_device_info[] = { + { + // Characteristic: Manufacturer name + .uuid = BLE_UUID16_DECLARE(GATT_MANUFACTURER_NAME_UUID), + .access_cb = gatt_svr_chr_access_device_info, + .flags = BLE_GATT_CHR_F_READ, + }, + { + // Characteristic: Model number string + .uuid = BLE_UUID16_DECLARE(GATT_MODEL_NUMBER_UUID), + .access_cb = gatt_svr_chr_access_device_info, + .flags = BLE_GATT_CHR_F_READ, + }, + { + // No more characteristics in this service + 0, + }}; + +static int gatt_svr_chr_access_device_info( + uint16_t conn_handle, + uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt, + void *arg) +{ + (void)conn_handle; + (void)attr_handle; + (void)arg; + + uint16_t uuid; + int rc; + + uuid = ble_uuid_u16(ctxt->chr->uuid); + + if (uuid == GATT_MODEL_NUMBER_UUID) + { + rc = os_mbuf_append(ctxt->om, model_num, strlen(model_num)); + return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + + if (uuid == GATT_MANUFACTURER_NAME_UUID) + { + rc = os_mbuf_append(ctxt->om, manuf_name, strlen(manuf_name)); + return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + + return BLE_ATT_ERR_UNLIKELY; +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.cpp new file mode 100644 index 0000000000..b85ba4a595 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.cpp @@ -0,0 +1,429 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_ble_native.h" + +// clang-format off + +static const CLR_RT_MethodHandler method_lookup[] = +{ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest::NativeReadRespondWithValue___VOID__U2__SZARRAY_U1, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest::NativeReadRespondWithProtocolError___VOID__U2__U1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest::NativeWriteGetData___SZARRAY_U1__U2, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest::NativeWriteRespond___VOID__U2, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest::NativeWriteRespondWithProtocolError___VOID__U2__U1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic::NativeNotifyClient___I4__U2__U2__SZARRAY_U1, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider::NativeInitService___BOOLEAN, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider::NativeStartAdvertising___BOOLEAN, + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider::NativeStopAdvertising___VOID, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Device_Bluetooth = +{ + "nanoFramework.Device.Bluetooth", + 0x9D2D4094, + method_lookup, + { 100, 0, 0, 1 } +}; + +// clang-format on diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.h b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.h new file mode 100644 index 0000000000..e4441e6f8b --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native.h @@ -0,0 +1,375 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#ifndef _SYS_DEV_BLE_NATIVE_H_ +#define _SYS_DEV_BLE_NATIVE_H_ + +#include +#include +#include + +#include + +#include "sys_ble.h" + +typedef enum __nfpack BluetoothError +{ + BluetoothError_Success = 0, + BluetoothError_RadioNotAvailable = 1, + BluetoothError_ResourceInUse = 2, + BluetoothError_DeviceNotConnected = 3, + BluetoothError_OtherError = 4, + BluetoothError_DisabledByPolicy = 5, + BluetoothError_NotSupported = 6, + BluetoothError_DisabledByUser = 7, + BluetoothError_ConsentRequired = 8, + BluetoothError_TransportNotSupported = 9, +} BluetoothError; + +typedef enum __nfpack BluetoothEventType +{ + BluetoothEventType_Read = 0, + BluetoothEventType_Write = 1, + BluetoothEventType_ClientSubscribed = 2, + BluetoothEventType_ClientUnsubscribed = 3, +} BluetoothEventType; + +typedef enum __nfpack GattCharacteristicProperties +{ + GattCharacteristicProperties_None = 0, + GattCharacteristicProperties_Broadcast = 1, + GattCharacteristicProperties_Read = 2, + GattCharacteristicProperties_WriteWithoutResponse = 4, + GattCharacteristicProperties_Write = 8, + GattCharacteristicProperties_Notify = 16, + GattCharacteristicProperties_Indicate = 32, + GattCharacteristicProperties_AuthenticatedSignedWrites = 64, + GattCharacteristicProperties_ExtendedProperties = 128, + GattCharacteristicProperties_ReliableWrites = 256, + GattCharacteristicProperties_WritableAuxiliaries = 512, +} GattCharacteristicProperties; + +typedef enum __nfpack GattCommunicationStatus +{ + GattCommunicationStatus_Success = 0, + GattCommunicationStatus_Unreachable = 1, + GattCommunicationStatus_ProtocolError = 2, + GattCommunicationStatus_AccessDenied = 3, +} GattCommunicationStatus; + +typedef enum __nfpack GattProtectionLevel +{ + GattProtectionLevel_Plain = 0, + GattProtectionLevel_AuthenticationRequired = 1, + GattProtectionLevel_EncryptionRequired = 2, + GattProtectionLevel_EncryptionAndAuthenticationRequired = 3, +} GattProtectionLevel; + +typedef enum __nfpack GattServiceProviderAdvertisementStatus +{ + GattServiceProviderAdvertisementStatus_Created = 0, + GattServiceProviderAdvertisementStatus_Stopped = 1, + GattServiceProviderAdvertisementStatus_Started = 2, + GattServiceProviderAdvertisementStatus_Aborted = 3, + GattServiceProviderAdvertisementStatus_StartedWithoutAllAdvertisementData = 4, +} GattServiceProviderAdvertisementStatus; + +typedef enum __nfpack GattSessionStatus +{ + GattSessionStatus_Closed = 0, + GattSessionStatus_Active = 1, +} GattSessionStatus; + +typedef enum __nfpack GattWriteOption +{ + GattWriteOption_WriteWithResponse = 0, + GattWriteOption_WriteWithoutResponse = 1, +} GattWriteOption; + +typedef enum __nfpack Utilities_GattNativeDescriptorUuid +{ + Utilities_GattNativeDescriptorUuid_CharacteristicExtendedProperties = 10496, + Utilities_GattNativeDescriptorUuid_CharacteristicUserDescription = 10497, + Utilities_GattNativeDescriptorUuid_ClientCharacteristicConfiguration = 10498, + Utilities_GattNativeDescriptorUuid_ServerCharacteristicConfiguration = 10499, + Utilities_GattNativeDescriptorUuid_CharacteristicPresentationFormat = 10500, + Utilities_GattNativeDescriptorUuid_CharacteristicAggregateFormat = 10501, + Utilities_GattNativeDescriptorUuid_ValidRange = 10502, + Utilities_GattNativeDescriptorUuid_ExternalReportReference = 10503, + Utilities_GattNativeDescriptorUuid_ReportReference = 10504, +} Utilities_GattNativeDescriptorUuid; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_BluetoothDeviceId +{ + static const int FIELD___id = 1; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_BluetoothEvent +{ + static const int FIELD__type = 3; + static const int FIELD__ID = 4; + static const int FIELD__characteristicId = 5; + static const int FIELD__descriptorId = 6; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_Buffer +{ + static const int FIELD___buffer = 1; + static const int FIELD___length = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalDescriptorParameters +{ + static const int FIELD___writeProtectionLevel = 1; + static const int FIELD___readProtectionLevel = 2; + static const int FIELD___staticValue = 3; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattPresentationFormat +{ + static const int FIELD___formatType = 1; + static const int FIELD___exponent = 2; + static const int FIELD___unit = 3; + static const int FIELD___namespaceId = 4; + static const int FIELD___description = 5; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest +{ + static const int FIELD___readValue = 1; + static const int FIELD___eventID = 2; + + NANOCLR_NATIVE_DECLARE(NativeReadRespondWithValue___VOID__U2__SZARRAY_U1); + NANOCLR_NATIVE_DECLARE(NativeReadRespondWithProtocolError___VOID__U2__U1); + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequestedEventArgs +{ + static const int FIELD___eventID = 1; + static const int FIELD___session = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequestedEventArgs +{ + static const int FIELD___eventID = 1; + static const int FIELD___session = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalDescriptor +{ + static const int FIELD_STATIC__GattLocalDescriptorIndex = 0; + + static const int FIELD___descriptorId = 1; + static const int FIELD___charactisic = 2; + static const int FIELD___writeProtectionLevel = 3; + static const int FIELD___readProtectionLevel = 4; + static const int FIELD___uuid = 5; + static const int FIELD___staticValue = 6; + static const int FIELD__ReadRequested = 7; + static const int FIELD__WriteRequested = 8; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattClientNotificationResult +{ + static const int FIELD___result = 1; + static const int FIELD___status = 2; + static const int FIELD___client = 3; + static const int FIELD___bytesSent = 4; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattSubscribedClient +{ + static const int FIELD___session = 1; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattSession +{ + static const int FIELD___deviceId = 1; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest +{ + static const int FIELD___option = 1; + static const int FIELD___offset = 2; + static const int FIELD___value = 3; + static const int FIELD___eventID = 4; + + NANOCLR_NATIVE_DECLARE(NativeWriteGetData___SZARRAY_U1__U2); + NANOCLR_NATIVE_DECLARE(NativeWriteRespond___VOID__U2); + NANOCLR_NATIVE_DECLARE(NativeWriteRespondWithProtocolError___VOID__U2__U1); + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic +{ + static const int FIELD_STATIC__GattLocalCharacteristicIndex = 1; + + static const int FIELD___characteristicId = 1; + static const int FIELD___characteristicUuid = 2; + static const int FIELD___writeProtectionLevel = 3; + static const int FIELD___readProtectionLevel = 4; + static const int FIELD___properties = 5; + static const int FIELD___descriptors = 6; + static const int FIELD___subscribedClients = 7; + static const int FIELD___userDescription = 8; + static const int FIELD___userDescriptionDescriptor = 9; + static const int FIELD___presentationFormats = 10; + static const int FIELD___presentationFormatsDescriptors = 11; + static const int FIELD___staticValue = 12; + static const int FIELD__ReadRequested = 13; + static const int FIELD__WriteRequested = 14; + static const int FIELD__SubscribedClientsChanged = 15; + + NANOCLR_NATIVE_DECLARE(NativeNotifyClient___I4__U2__U2__SZARRAY_U1); + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_BluetoothEventListener +{ + static const int FIELD_STATIC___characteristicMap = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_DataReader +{ + static const int FIELD___buffer = 1; + static const int FIELD___currentReadPosition = 2; + + //--// +}; + +struct + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristicParameters +{ + static const int FIELD___writeProtectionLevel = 1; + static const int FIELD___readProtectionLevel = 2; + static const int FIELD___userDescription = 3; + static const int FIELD___properties = 4; + static const int FIELD___staticValue = 5; + static const int FIELD___presentationFormats = 6; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristicResult +{ + static const int FIELD___characteristic = 1; + static const int FIELD___error = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalDescriptorResult +{ + static const int FIELD___error = 1; + static const int FIELD___descriptor = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalService +{ + static const int FIELD___serviceUuid = 1; + static const int FIELD___characteristics = 2; + + //--// +}; + +struct + Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProviderAdvertisingParameters +{ + static const int FIELD___deviceName = 1; + static const int FIELD___isDiscoverable = 2; + static const int FIELD___isConnectable = 3; + static const int FIELD___serviceData = 4; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider +{ + static const int FIELD_STATIC___bluetoothEventManager = 3; + + static const int FIELD___service = 1; + static const int FIELD___status = 2; + static const int FIELD___deviceName = 3; + static const int FIELD___isDiscoverable = 4; + static const int FIELD___isConnectable = 5; + static const int FIELD___serviceData = 6; + + NANOCLR_NATIVE_DECLARE(NativeInitService___BOOLEAN); + NANOCLR_NATIVE_DECLARE(NativeStartAdvertising___BOOLEAN); + NANOCLR_NATIVE_DECLARE(NativeStopAdvertising___VOID); + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProviderResult +{ + static const int FIELD___serviceProvider = 1; + static const int FIELD___error = 2; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_Spp_SppReceivedDataEventArgs +{ + static const int FIELD___data = 1; + + //--// +}; + +struct Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_Spp_NordicSpp +{ + static const int FIELD__ServiceUUID = 1; + static const int FIELD__RxCharacteristicUUID = 2; + static const int FIELD__TxCharacteristicUUID = 3; + static const int FIELD___serviceProvider = 4; + static const int FIELD___txCharacteristic = 5; + static const int FIELD___isConnected = 6; + static const int FIELD__ReceivedData = 7; + static const int FIELD__ConnectedEvent = 8; + + //--// +}; + +struct Library_sys_dev_ble_native_ThisAssembly +{ + static const int FIELD_STATIC__GitCommitDate = 4; + + //--// +}; + +extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Device_Bluetooth; + +#endif //_SYS_DEV_BLE_NATIVE_H_ diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic.cpp new file mode 100644 index 0000000000..3e2355809e --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic.cpp @@ -0,0 +1,54 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_ble_native.h" + +extern uint16_t FindHandleIdFromId(ble_gatt_chr_def *characteristicsDefs, int countDefs, uint16_t characteristicId); + +// +// Notify a Client +// Arg1 - Client Connection +// Arg2 - Characteristic ID +// Arg3 - Notify Byte buffer +// +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic:: + NativeNotifyClient___I4__U2__U2__SZARRAY_U1(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + uint16_t characteristicId; + uint16_t connectionHandle; + uint16_t attHandle; + CLR_RT_HeapBlock_Array *notifyBuffer; + uint8_t *bufPtr; + int bufLen; + // error characteristicId not known + int rc = 1; + + connectionHandle = stack.Arg1().NumericByRef().u2; + characteristicId = stack.Arg2().NumericByRef().u2; + + notifyBuffer = stack.Arg3().DereferenceArray(); + FAULT_ON_NULL(notifyBuffer); + + bufPtr = notifyBuffer->GetFirstElement(); + bufLen = notifyBuffer->m_numOfElements; + + // Find attr handle from Characteristic ID + attHandle = + FindHandleIdFromId(blecontext.characteristicsDefs, blecontext.characteristicsCount, characteristicId); + + if (attHandle != 0xffff) + { + // Send Notify buffer + struct os_mbuf *om = ble_hs_mbuf_from_flat(bufPtr, bufLen); + rc = ble_gattc_notify_custom(connectionHandle, attHandle, om); + } + + stack.SetResult_I4(rc); + } + NANOCLR_NOCLEANUP(); +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest.cpp new file mode 100644 index 0000000000..1f78de5f55 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest.cpp @@ -0,0 +1,63 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_ble_native.h" + +extern EventGroupHandle_t ble_event_waitgroup; + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest:: + NativeReadRespondWithValue___VOID__U2__SZARRAY_U1(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + CLR_RT_HeapBlock_Array *buffer; + uint8_t *bufPtr; + int bufLen; + int rc; + + // debug_printf("NativeReadRespondWithValue\n"); + + // Response to correct event, or is it too late + // Otherwise ignore + if (ble_event_data.eventId == stack.Arg1().NumericByRef().u2) + { + // correct event + buffer = stack.Arg2().DereferenceArray(); + FAULT_ON_NULL(buffer); + + bufPtr = buffer->GetFirstElement(); + bufLen = buffer->m_numOfElements; + + // debug_printf("NativeReadRespondWithValue data length %d\n",bufLen); + + rc = os_mbuf_append(ble_event_data.ctxt->om, bufPtr, bufLen); + ble_event_data.result = rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + + // Signal BLE callback, event complete + xEventGroupSetBits(ble_event_waitgroup, 1); + } + } + NANOCLR_NOCLEANUP(); +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattReadRequest:: + NativeReadRespondWithProtocolError___VOID__U2__U1(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + // Response to correct event, or is it too late + // Otherwise ignore + if (ble_event_data.eventId == stack.Arg1().NumericByRef().u2) + { + // Get protocol error code + ble_event_data.result = stack.Arg2().NumericByRef().u2; + + // Signal BLE callback, event complete + xEventGroupSetBits(ble_event_waitgroup, 1); + } + } + NANOCLR_NOCLEANUP_NOLABEL(); +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider.cpp new file mode 100644 index 0000000000..3311861d88 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider.cpp @@ -0,0 +1,522 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_ble_native.h" + +extern bool device_ble_init(); +extern void device_ble_dispose(); +extern int device_ble_start(ble_context *context); +extern int device_ble_callback( + uint16_t conn_handle, + uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt, + void *arg); +extern void esp32_ble_start_advertise(int flags); + +extern const struct ble_gatt_chr_def gatt_char_device_info[]; + +typedef Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalService + GattLocalService; +typedef Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider + GattServiceProvider; +typedef Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalCharacteristic + GattLocalCharacteristic; +typedef Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattPresentationFormat + GattPresentationFormat; +typedef Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattLocalDescriptor + GattLocalDescriptor; + +#define GATT_DEVICE_INFO_UUID 0x180A + +ble_context blecontext; + +static void InitContext(ble_context *context) +{ + memset(context, 0, sizeof(ble_context)); +} + +static void FreeContext(ble_context *context) +{ + if (context->pDeviceName) + { + platform_free((void *)context->pDeviceName); + context->pDeviceName = NULL; + } + + if (context->gatt_service_def) + { + platform_free((void *)context->gatt_service_def); + context->gatt_service_def = NULL; + } + + if (context->characteristicsDefs) + { + platform_free(context->characteristicsDefs); + context->characteristicsDefs = NULL; + } + + if (context->characteristicsUuids) + { + platform_free(context->characteristicsUuids); + context->characteristicsUuids = NULL; + } + + if (context->attrHandles) + { + platform_free(context->attrHandles); + context->attrHandles = NULL; + } + + if (context->descriptorDefs) + { + platform_free(context->descriptorDefs); + context->descriptorDefs = NULL; + } + + if (context->descriptorUuids) + { + platform_free(context->descriptorUuids); + context->descriptorUuids = NULL; + } +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider:: + NativeInitService___BOOLEAN(CLR_RT_StackFrame &stack) +{ + (void)stack; + + NANOCLR_HEADER(); + { + InitContext(&blecontext); + + stack.SetResult_Boolean(true); + } + NANOCLR_NOCLEANUP_NOLABEL(); +} + +ble_uuid_t *Ble_uuid16_declare(uint16_t id16) +{ + ble_uuid16_t *pU16 = (ble_uuid16_t *)platform_malloc(sizeof(ble_uuid16_t)); + pU16->u.type = BLE_UUID_TYPE_16; + pU16->value = id16; + return (ble_uuid_t *)pU16; +} + +// Assumes UUID is 16 bytes length +void BuildUUID(uint8_t *pUuid, ble_uuid_any_t *pUany) +{ + // Build UUID based on size/ leading zeroes, 16, 32 or 128 + // 00 00 00 00 - 00 00 - 00 00 - 00 00 - 00 00 00 00 00 00 - 128 bits + // 00 00 xx xx - 00 00 - 10 00 - 80 00 - 00 80 5F 9B 34 FB - 16 bits + // xx xx xx xx " " " " - 32 bits + + uint8_t BlueSig[12] = {0, 0, 0x10, 0, 0x80, 0, 0, 0x80, 0x5f, 0x9b, 0x34, 0xfb}; + + // 16 or 32 bit ? + if (memcmp(pUuid + 4, BlueSig, sizeof(BlueSig)) == 0) + { + // 16 Bit + if (pUuid[0] == 0 && pUuid[1] == 0) + { + pUany->u16.u.type = BLE_UUID_TYPE_16; + pUany->u16.value = (uint16_t)(pUuid[2] << 8) + pUuid[3]; + } + else + { + pUany->u32.u.type = BLE_UUID_TYPE_32; + pUany->u32.value = (uint32_t)(pUuid[0] << 24) + (pUuid[1] << 16) + (pUuid[2] << 8) + pUuid[3]; + } + } + else + { + int map[16]{15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 4, 5, 0, 1, 2, 3}; + + pUany->u128.u.type = BLE_UUID_TYPE_128; + + // Map bytes to correct LSB order + uint8_t *pDest = &pUany->u128.value[0]; + for (int x = 0; x < 16; x++) + { + pDest[x] = pUuid[map[x]]; + } + } +} + +ble_uuid_any_t *BuildUuidAlloc(uint8_t *pUuid) +{ + ble_uuid_any_t *pUany = (ble_uuid_any_t *)platform_malloc(sizeof(ble_uuid_any_t)); + BuildUUID(pUuid, pUany); + return pUany; +} + +// Build single service with terminator +ble_gatt_svc_def *BuildGattService(uint8_t type, uint8_t *pUuid, const ble_gatt_chr_def *characteristics, int *count) +{ + *count = 3; // 3 service entries + + // Define 3 services, custom, device_info and null service(end) + ble_gatt_svc_def *pSvcDef = (ble_gatt_svc_def *)platform_malloc(sizeof(ble_gatt_svc_def) * (*count)); + ble_gatt_svc_def *pCurSvcDef = pSvcDef; + + // 1st + pCurSvcDef->type = type; + pCurSvcDef->uuid = (ble_uuid_t *)BuildUuidAlloc(pUuid); + pCurSvcDef->includes = 0; + pCurSvcDef->characteristics = characteristics; + + // 2nd Device Info + pCurSvcDef++; + pCurSvcDef->type = BLE_GATT_SVC_TYPE_PRIMARY; + pCurSvcDef->uuid = Ble_uuid16_declare(GATT_DEVICE_INFO_UUID); + pCurSvcDef->includes = 0; + pCurSvcDef->characteristics = gatt_char_device_info; + + // 3rd - Terminator for services + pCurSvcDef++; + pCurSvcDef->type = BLE_GATT_SVC_TYPE_END; + + return pSvcDef; +} + +void SetUuid(CLR_RT_HeapBlock *pItem, int sourceFieldIndex, ble_uuid_any_t *targetUuidValue, ble_uuid_t **pUuid) +{ + CLR_RT_HeapBlock_Array *charUuidArray = (CLR_RT_HeapBlock_Array *)pItem[sourceFieldIndex].Array(); + uint8_t *uuid = charUuidArray->GetFirstElement(); + BuildUUID(uuid, targetUuidValue); + + *pUuid = (ble_uuid_t *)targetUuidValue; +} + +void AssignDescriptor(ble_gatt_dsc_def *pDsc, CLR_RT_HeapBlock *pPfItem, ble_uuid_any_t *pUuid) +{ + SetUuid(pPfItem, GattLocalDescriptor::FIELD___uuid, pUuid, (ble_uuid_t **)&pDsc->uuid); + + pDsc->att_flags = 0; + if (pPfItem[GattLocalDescriptor::FIELD___writeProtectionLevel].NumericByRef().u4) + { + pDsc->att_flags |= BLE_GATT_CHR_F_WRITE; + } + if (pPfItem[GattLocalDescriptor::FIELD___readProtectionLevel].NumericByRef().u4) + { + pDsc->att_flags |= BLE_GATT_CHR_F_READ; + } + + pDsc->access_cb = device_ble_callback; + + pDsc->arg = (void *)(int32_t)pPfItem[GattLocalDescriptor::FIELD___descriptorId].NumericByRef().u2; + + pDsc->min_key_size = 0; +} + +void AssignArrayDescriptors(ble_context &context, CLR_RT_HeapBlock *pArray, int sourceFieldIndex, int &descIndex) +{ + CLR_RT_HeapBlock *pArItem; + CLR_RT_HeapBlock_ArrayList *pArrayDescriptors = + (CLR_RT_HeapBlock_ArrayList *)pArray[sourceFieldIndex].Dereference(); + + CLR_INT32 arrayCount = pArrayDescriptors->GetSize(); + + // Set up array of descriptors if any + for (int i = 0; i < arrayCount; i++) + { + if (SUCCEEDED(pArrayDescriptors->GetItem(i, pArItem))) + { + // Allocate descriptor + ble_gatt_dsc_def *pDsc = &context.descriptorDefs[descIndex]; + + // Fill in details + AssignDescriptor(pDsc, pArItem, &context.descriptorUuids[descIndex]); + + // debug_printf("Array descriptors id=%X flags=%x cb=%x dindex=%d\n ", + // (int)pDsc->arg, + // pDsc->att_flags, + // pDsc->access_cb, + // descIndex + // ); + + descIndex++; + } + } +} + +void SetUuid( + CLR_RT_HeapBlock *pItem, + int sourceFieldIndex, + ble_uuid_any_t *targetUuid, + ble_gatt_chr_def *pCharacteristicsDef) +{ + CLR_RT_HeapBlock_Array *charUuidArray = (CLR_RT_HeapBlock_Array *)pItem[sourceFieldIndex].Array(); + uint8_t *uuid = charUuidArray->GetFirstElement(); + BuildUUID(uuid, targetUuid); + + pCharacteristicsDef->uuid = (ble_uuid_t *)targetUuid; +} + +void ParseAndBuildNimbleDefinition(ble_context &context, CLR_RT_HeapBlock *pGattLocalService) +{ + uint8_t *pUuid; + CLR_RT_HeapBlock *pItem; + int descriptorCount = 0; + int charIndex = 0; + int descIndex = 0; + + CLR_RT_HeapBlock_Array *pUuidArray = + (CLR_RT_HeapBlock_Array *)pGattLocalService[GattLocalService::FIELD___serviceUuid].Array(); + + pUuid = pUuidArray->GetFirstElement(); + + CLR_RT_HeapBlock_ArrayList *pCharacteristics = + (CLR_RT_HeapBlock_ArrayList *)pGattLocalService[GattLocalService::FIELD___characteristics].Dereference(); + + CLR_INT32 CharacteristicsCount = pCharacteristics->GetSize(); + + // +1 for Terminator definition + CharacteristicsCount++; + + // Allocate an array of Characteristics definitions + null definition and save in context + context.characteristicsCount = CharacteristicsCount; + context.characteristicsDefs = + (ble_gatt_chr_def *)platform_malloc(sizeof(ble_gatt_chr_def) * context.characteristicsCount); + + // Initial pass to count number of descriptors required so we can allocate things in 1 lump and keep reference for + // freeing Descriptors include user descriptors and presentation formats + for (int index = 0; index < CharacteristicsCount; index++) + { + if (SUCCEEDED(pCharacteristics->GetItem(index, pItem))) + { + CLR_RT_HeapBlock *pUserDescriptionDescriptors = + (CLR_RT_HeapBlock *)pItem[GattLocalCharacteristic::FIELD___userDescriptionDescriptor].Dereference(); + if (pUserDescriptionDescriptors != NULL) + { + descriptorCount++; + } + + CLR_RT_HeapBlock_ArrayList *pPresentationFormatsDiscriptors = + (CLR_RT_HeapBlock_ArrayList *)pItem[GattLocalCharacteristic::FIELD___presentationFormatsDescriptors] + .Dereference(); + + descriptorCount += pPresentationFormatsDiscriptors->GetSize(); + + CLR_RT_HeapBlock_ArrayList *pDescriptors = + (CLR_RT_HeapBlock_ArrayList *)pItem[GattLocalCharacteristic::FIELD___presentationFormats].Dereference(); + + descriptorCount += pDescriptors->GetSize(); + + // Plus terminator + descriptorCount++; + } + } + + context.descriptorCount = descriptorCount; + + // Allocate attribute handles for characteristics + context.attrHandles = (uint16_t *)platform_malloc(sizeof(uint16_t) * context.characteristicsCount); + + // Allocate UUID table + context.characteristicsUuids = + (ble_uuid_any_t *)platform_malloc(sizeof(ble_uuid_any_t) * context.characteristicsCount); + + // Allocate tables + context.descriptorDefs = (ble_gatt_dsc_def *)platform_malloc(sizeof(ble_gatt_dsc_def) * descriptorCount); + context.descriptorUuids = (ble_uuid_any_t *)platform_malloc(sizeof(ble_uuid_any_t) * descriptorCount); + + // debug_printf("characteristicsCount = %d\n ", CharacteristicsCount); + // debug_printf("descriptorCount = %d\n ", descriptorCount); + // debug_printf("characteristicsDefs %X end %X\n", context.characteristicsDefs, context.characteristicsDefs + + // (sizeof(ble_gatt_chr_def) * context.characteristicsCount) ); debug_printf("characteristicsUuids %X end %X\n", + // context.characteristicsUuids, context.characteristicsUuids + (sizeof(ble_uuid_any_t) * + // context.characteristicsCount)); debug_printf("attrHandles %X end %X\n", context.attrHandles, + // context.attrHandles + (sizeof(uint16_t) * context.characteristicsCount)); debug_printf("descriptorDefs %X end + // %X\n", context.descriptorDefs, context.descriptorDefs + (sizeof(ble_gatt_dsc_def) * context.descriptorCount)); + // debug_printf("descriptorUuids %X end %X\n", context.descriptorUuids, context.descriptorUuids + + // (sizeof(ble_uuid_any_t) * context.descriptorCount)); + + // Build definitions require for Nimble + for (charIndex = 0; charIndex < CharacteristicsCount; charIndex++) + { + if (SUCCEEDED(pCharacteristics->GetItem(charIndex, pItem))) + { + + // Build entry for nimble characteristic definition + // UUID + SetUuid( + pItem, + GattLocalCharacteristic::FIELD___characteristicUuid, + &context.characteristicsUuids[charIndex], + (ble_uuid_t **)&context.characteristicsDefs[charIndex].uuid); + + // Save CharacteristicId in arg field for callback + int characteristicId = pItem[GattLocalCharacteristic::FIELD___characteristicId].NumericByRef().u2; + context.characteristicsDefs[charIndex].arg = (void *)characteristicId; + + // Save ptr for attr handle to be saved + context.characteristicsDefs[charIndex].val_handle = &context.attrHandles[charIndex]; + + // Set up Flags + GattCharacteristicProperties properties = + (GattCharacteristicProperties)pItem[GattLocalCharacteristic::FIELD___properties].NumericByRef().u4; + ble_gatt_chr_flags flags = 0; + + if (properties & GattCharacteristicProperties_Read) + flags |= BLE_GATT_CHR_F_READ; + if (properties & GattCharacteristicProperties_WriteWithoutResponse) + flags |= BLE_GATT_CHR_F_WRITE_NO_RSP; + if (properties & GattCharacteristicProperties_Write) + flags |= BLE_GATT_CHR_F_WRITE; + if (properties & GattCharacteristicProperties_Notify) + flags |= BLE_GATT_CHR_F_NOTIFY; + if (properties & GattCharacteristicProperties_Broadcast) + flags |= BLE_GATT_CHR_F_BROADCAST; + if (properties & GattCharacteristicProperties_Indicate) + flags |= BLE_GATT_CHR_F_INDICATE; + if (properties & GattCharacteristicProperties_AuthenticatedSignedWrites) + flags |= BLE_GATT_CHR_F_AUTH_SIGN_WRITE; + if (properties & GattCharacteristicProperties_ReliableWrites) + flags |= BLE_GATT_CHR_F_RELIABLE_WRITE; + if (properties & GattCharacteristicProperties_WritableAuxiliaries) + flags |= BLE_GATT_CHR_F_AUTH_SIGN_WRITE; + + // Unhandled TODO + // #define BLE_GATT_CHR_F_READ_ENC 0x0200 + // #define BLE_GATT_CHR_F_READ_AUTHEN 0x0400 + // #define BLE_GATT_CHR_F_READ_AUTHOR 0x0800 + // #define BLE_GATT_CHR_F_WRITE_ENC 0x1000 + // #define BLE_GATT_CHR_F_WRITE_AUTHEN 0x2000 + // #define BLE_GATT_CHR_F_WRITE_AUTHOR 0x400 + + // TODO handle later + // GattCharacteristicProperties_None: + // GattCharacteristicProperties_ExtendedProperties: + + context.characteristicsDefs[charIndex].flags = flags; + + // Set callback used for all characteristics + context.characteristicsDefs[charIndex].access_cb = device_ble_callback; + + // CLR_INT32 writeProtectionLevel = + // pItem[GattLocalCharacteristic::FIELD___writeProtectionLevel].NumericByRef().s4; + + context.characteristicsDefs[charIndex].min_key_size = 0; // TODO + + // Assign next descriptor as start for this characteristics + context.characteristicsDefs[charIndex].descriptors = &context.descriptorDefs[descIndex]; + + // Set up User description descriptor if any + CLR_RT_HeapBlock *pUserDescriptionDescriptors = + (CLR_RT_HeapBlock *)pItem[GattLocalCharacteristic::FIELD___userDescriptionDescriptor].Dereference(); + if (pUserDescriptionDescriptors != NULL) + { + // Allocate descriptor for each PresentationFormat + ble_gatt_dsc_def *pDsc = &context.descriptorDefs[descIndex]; + + // Fill in descriptor details + AssignDescriptor(pDsc, pUserDescriptionDescriptors, &context.descriptorUuids[descIndex++]); + + // debug_printf("User description id=%X flags=%x cb=%x dindex=%d\n ", + // pDsc->arg, + // pDsc->att_flags, + // pDsc->access_cb, + // descIndex - 1 + //); + } + + // Set up Presentation Format descriptors if any + AssignArrayDescriptors( + context, + pItem, + GattLocalCharacteristic::FIELD___presentationFormatsDescriptors, + descIndex); + + // Set up user descriptors if any + AssignArrayDescriptors(context, pItem, GattLocalCharacteristic::FIELD___descriptors, descIndex); + + // Add terminator + ble_gatt_dsc_def *pDsc = &context.descriptorDefs[descIndex++]; + pDsc->uuid = 0; + + // debug_printf("Characteristic id=%X flags=%x cb=%x dindex=%d\n ", + // characteristicId, + // context.characteristicsDefs[index].flags, + // context.characteristicsDefs[index].access_cb, + // descIndex + //); + + // debug_printf("Characteristic item %d\n", index); + // debug_printf("writeProtectionLevel %d CharacteristicHandle:%d\n", writeProtectionLevel, + // CharacteristicHandle); + } + } + + // Terminate characteristics + context.characteristicsDefs[CharacteristicsCount - 1].uuid = NULL; + + // debug_printf("characteristics start %X last def %X \n ", context.characteristicsDefs, + // &context.characteristicsDefs[CharacteristicsCount-1]); debug_printf("characteristics index %d descriptor index + // %d\n",charIndex, descIndex); + + context.gatt_service_def = + BuildGattService(BLE_GATT_SVC_TYPE_PRIMARY, pUuid, context.characteristicsDefs, &context.serviceCount); +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider:: + NativeStartAdvertising___BOOLEAN(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + bool result; + + CLR_RT_HeapBlock *pThis = stack.This(); // ptr to GattServiceProvider + FAULT_ON_NULL(pThis); + + CLR_RT_HeapBlock *pGattLocalService = pThis[GattServiceProvider::FIELD___service].Dereference(); + FAULT_ON_NULL(pGattLocalService); + + // Save Discoverable & Connectable flags in context + bool isDiscoverable = pThis[GattServiceProvider::FIELD___isDiscoverable].NumericByRef().s4 != 0; + bool isConnectable = pThis[GattServiceProvider::FIELD___isConnectable].NumericByRef().s4 != 0; + blecontext.isDiscoverable = isDiscoverable; + blecontext.isConnectable = isConnectable; + + // Save Device name in context + CLR_RT_HeapBlock_Array *pDeviceNameField = + (CLR_RT_HeapBlock_Array *)pThis[GattServiceProvider::FIELD___deviceName].Array(); + char *pDeviceName = (char *)pDeviceNameField->GetFirstElement(); + int deviceNameLen = pDeviceNameField->m_numOfElements; + + blecontext.pDeviceName = (char *)platform_malloc(deviceNameLen + 1); + memcpy(blecontext.pDeviceName, pDeviceName, deviceNameLen); + blecontext.pDeviceName[deviceNameLen] = 0; + + ParseAndBuildNimbleDefinition(blecontext, pGattLocalService); + + result = device_ble_init(); + if (result) + { + // debug_printf("device_ble_init complete\n"); + + device_ble_start(&blecontext); + + // debug_printf("device_ble_start complete\n"); + } + + stack.SetResult_Boolean(result); + } + NANOCLR_NOCLEANUP(); +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattServiceProvider:: + NativeStopAdvertising___VOID(CLR_RT_StackFrame &stack) +{ + (void)stack; + + NANOCLR_HEADER(); + { + device_ble_dispose(); + + FreeContext(&blecontext); + } + NANOCLR_NOCLEANUP_NOLABEL(); +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest.cpp new file mode 100644 index 0000000000..789e8df039 --- /dev/null +++ b/targets/ESP32/_nanoCLR/nanoFramework.Device.Bluetooth/sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest.cpp @@ -0,0 +1,89 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#include "sys_dev_ble_native.h" + +extern EventGroupHandle_t ble_event_waitgroup; + +// +// Get data written to an attribute +// +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest:: + NativeWriteGetData___SZARRAY_U1__U2(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + uint8_t *pReturnBuffer; + uint16_t om_len; + uint16_t out_len; + uint16_t eventid = stack.Arg1().NumericByRef().u2; + + // Make sure correct event, or is it too late + // Otherwise ignore + if (ble_event_data.eventId == eventid) + { + // Get length of available data + om_len = OS_MBUF_PKTLEN(ble_event_data.ctxt->om); + + // Create managed byte array of correct size as per OM buffer + NANOCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( + stack.PushValueAndClear(), + om_len, + g_CLR_RT_WellKnownTypes.m_UInt8)); + + // get a pointer to the first object in the array + pReturnBuffer = stack.TopValue().DereferenceArray()->GetFirstElement(); + + // Copy OM buffer to return byte buffer + ble_hs_mbuf_to_flat(ble_event_data.ctxt->om, pReturnBuffer, om_len, &out_len); + } + else + { + // Error return empty array, event not found ? + NANOCLR_CHECK_HRESULT( + CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 0, g_CLR_RT_WellKnownTypes.m_UInt8)); + } + } + NANOCLR_NOCLEANUP(); +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest:: + NativeWriteRespond___VOID__U2(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + // debug_printf("NativeWriteRespond\n"); + if (ble_event_data.eventId == stack.Arg1().NumericByRef().u2) + { + ble_event_data.result = 0; + + // Signal BLE callback, event complete + xEventGroupSetBits(ble_event_waitgroup, 1); + } + } + NANOCLR_NOCLEANUP_NOLABEL(); +} + +HRESULT Library_sys_dev_ble_native_nanoFramework_Device_Bluetooth_GenericAttributeProfile_GattWriteRequest:: + NativeWriteRespondWithProtocolError___VOID__U2__U1(CLR_RT_StackFrame &stack) +{ + NANOCLR_HEADER(); + { + // debug_printf("NativeWriteRespondWithProtocolError\n"); + + // Response to correct event, or is it too late + // Otherwise ignore + if (ble_event_data.eventId == stack.Arg1().NumericByRef().u2) + { + // Get protocol error code + ble_event_data.result = stack.Arg2().NumericByRef().u2; + + // Signal BLE callback, event complete + xEventGroupSetBits(ble_event_waitgroup, 1); + } + } + NANOCLR_NOCLEANUP_NOLABEL(); +} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/blehr_sens.h b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/blehr_sens.h deleted file mode 100644 index 32675ab1ef..0000000000 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/blehr_sens.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Apache Software Foundation (ASF). All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#ifndef H_BLEHR_SENSOR_ -#define H_BLEHR_SENSOR_ - -#include "nimble/ble.h" -#include "modlog/modlog.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Heart-rate configuration */ -#define GATT_HRS_UUID 0x180D -#define GATT_HRS_MEASUREMENT_UUID 0x2A37 -#define GATT_HRS_BODY_SENSOR_LOC_UUID 0x2A38 -#define GATT_DEVICE_INFO_UUID 0x180A -#define GATT_MANUFACTURER_NAME_UUID 0x2A29 -#define GATT_MODEL_NUMBER_UUID 0x2A24 - -extern uint16_t hrs_hrm_handle; - -struct ble_hs_cfg; -struct ble_gatt_register_ctxt; - -void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg); -int gatt_svr_init(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/gatt_svr.c b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/gatt_svr.c deleted file mode 100644 index 721d630fb1..0000000000 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/gatt_svr.c +++ /dev/null @@ -1,182 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Apache Software Foundation (ASF). All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#include -#include -#include -#include -#include -#include -#include -#include - -static const char *manuf_name = "Apache Mynewt ESP32 devkitC"; -static const char *model_num = "Mynewt HR Sensor demo"; -uint16_t hrs_hrm_handle; - -static int -gatt_svr_chr_access_heart_rate(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt, void *arg); - -static int -gatt_svr_chr_access_device_info(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt, void *arg); - -static const struct ble_gatt_svc_def gatt_svr_svcs[] = { - { - /* Service: Heart-rate */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = BLE_UUID16_DECLARE(GATT_HRS_UUID), - .characteristics = (struct ble_gatt_chr_def[]) - { { - /* Characteristic: Heart-rate measurement */ - .uuid = BLE_UUID16_DECLARE(GATT_HRS_MEASUREMENT_UUID), - .access_cb = gatt_svr_chr_access_heart_rate, - .val_handle = &hrs_hrm_handle, - .flags = BLE_GATT_CHR_F_NOTIFY, - }, { - /* Characteristic: Body sensor location */ - .uuid = BLE_UUID16_DECLARE(GATT_HRS_BODY_SENSOR_LOC_UUID), - .access_cb = gatt_svr_chr_access_heart_rate, - .flags = BLE_GATT_CHR_F_READ, - }, { - 0, /* No more characteristics in this service */ - }, - } - }, - - { - /* Service: Device Information */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = BLE_UUID16_DECLARE(GATT_DEVICE_INFO_UUID), - .characteristics = (struct ble_gatt_chr_def[]) - { { - /* Characteristic: * Manufacturer name */ - .uuid = BLE_UUID16_DECLARE(GATT_MANUFACTURER_NAME_UUID), - .access_cb = gatt_svr_chr_access_device_info, - .flags = BLE_GATT_CHR_F_READ, - }, { - /* Characteristic: Model number string */ - .uuid = BLE_UUID16_DECLARE(GATT_MODEL_NUMBER_UUID), - .access_cb = gatt_svr_chr_access_device_info, - .flags = BLE_GATT_CHR_F_READ, - }, { - 0, /* No more characteristics in this service */ - }, - } - }, - - { - 0, /* No more services */ - }, -}; - -static int -gatt_svr_chr_access_heart_rate(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt, void *arg) -{ - (void)conn_handle; - (void)attr_handle; - (void)arg; - - /* Sensor location, set to "Chest" */ - static uint8_t body_sens_loc = 0x01; - uint16_t uuid; - int rc; - - uuid = ble_uuid_u16(ctxt->chr->uuid); - - if (uuid == GATT_HRS_BODY_SENSOR_LOC_UUID) { - rc = os_mbuf_append(ctxt->om, &body_sens_loc, sizeof(body_sens_loc)); - - return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } - - assert(0); - return BLE_ATT_ERR_UNLIKELY; -} - -static int -gatt_svr_chr_access_device_info(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt, void *arg) -{ - (void)conn_handle; - (void)attr_handle; - (void)arg; - - uint16_t uuid; - int rc; - - uuid = ble_uuid_u16(ctxt->chr->uuid); - - if (uuid == GATT_MODEL_NUMBER_UUID) { - rc = os_mbuf_append(ctxt->om, model_num, strlen(model_num)); - return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } - - if (uuid == GATT_MANUFACTURER_NAME_UUID) { - rc = os_mbuf_append(ctxt->om, manuf_name, strlen(manuf_name)); - return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } - - assert(0); - return BLE_ATT_ERR_UNLIKELY; -} - -void -gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg) -{ - (void)arg; - - //char buf[BLE_UUID_STR_LEN]; - - switch (ctxt->op) { - case BLE_GATT_REGISTER_OP_SVC: - // MODLOG_DFLT(DEBUG, "registered service %s with handle=%d\n", - // ble_uuid_to_str(ctxt->svc.svc_def->uuid, buf), - // ctxt->svc.handle); - break; - - case BLE_GATT_REGISTER_OP_CHR: - // MODLOG_DFLT(DEBUG, "registering characteristic %s with " - // "def_handle=%d val_handle=%d\n", - // ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf), - // ctxt->chr.def_handle, - // ctxt->chr.val_handle); - break; - - case BLE_GATT_REGISTER_OP_DSC: - // MODLOG_DFLT(DEBUG, "registering descriptor %s with handle=%d\n", - // ble_uuid_to_str(ctxt->dsc.dsc_def->uuid, buf), - // ctxt->dsc.handle); - break; - - default: - assert(0); - break; - } -} - -int -gatt_svr_init(void) -{ - int rc; - - ble_svc_gap_init(); - ble_svc_gatt_init(); - - rc = ble_gatts_count_cfg(gatt_svr_svcs); - if (rc != 0) { - return rc; - } - - rc = ble_gatts_add_svcs(gatt_svr_svcs); - if (rc != 0) { - return rc; - } - - return 0; -} diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble.cpp deleted file mode 100644 index 69abcd594f..0000000000 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble.cpp +++ /dev/null @@ -1,387 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Apache Software Foundation (ASF). All rights reserved. -// See LICENSE file in the project root for full license information. -// - -#include "nanoFramework_hardware_esp32_ble_native.h" - -#include -#include - -#include "esp_log.h" -//#include "nvs_flash.h" -#include "freertos/FreeRTOSConfig.h" -/* BLE */ -#include "esp_nimble_hci.h" -#include "nimble/nimble_port.h" -#include "nimble/nimble_port_freertos.h" -#include "host/ble_hs.h" -#include "host/util/util.h" -#include "console/console.h" -#include "services/gap/ble_svc_gap.h" -#include "blehr_sens.h" - - -static const char *tag = "NimBLE_BLE_HeartRate"; - -static xTimerHandle blehr_tx_timer; - -static bool notify_state; - -static uint16_t conn_handle; - -static const char *device_name = "blehr_sensor_1.0"; - -static int blehr_gap_event(struct ble_gap_event *event, void *arg); - -static uint8_t blehr_addr_type; - -/* Variable to simulate heart beats */ -static uint8_t heartrate = 90; - -/** - * Utility function to log an array of bytes. - */ -void -print_bytes(const uint8_t *bytes, int len) -{ - (void)bytes; - (void)len; - - // int i; - // for (i = 0; i < len; i++) { - // MODLOG_DFLT(INFO, "%s0x%02x", i != 0 ? ":" : "", bytes[i]); - // } -} - -void -print_addr(const void *addr) -{ - (void)addr; - - // const uint8_t *u8p; - - // u8p = addr; - // MODLOG_DFLT(INFO, "%02x:%02x:%02x:%02x:%02x:%02x", - // u8p[5], u8p[4], u8p[3], u8p[2], u8p[1], u8p[0]); -} - -/* - * Enables advertising with parameters: - * o General discoverable mode - * o Undirected connectable mode - */ -static void -blehr_advertise(void) -{ - struct ble_gap_adv_params adv_params; - struct ble_hs_adv_fields fields; - int rc; - - /* - * Set the advertisement data included in our advertisements: - * o Flags (indicates advertisement type and other general info) - * o Advertising tx power - * o Device name - */ - memset(&fields, 0, sizeof(fields)); - - /* - * Advertise two flags: - * o Discoverability in forthcoming advertisement (general) - * o BLE-only (BR/EDR unsupported) - */ - fields.flags = BLE_HS_ADV_F_DISC_GEN | - BLE_HS_ADV_F_BREDR_UNSUP; - - /* - * Indicate that the TX power level field should be included; have the - * stack fill this value automatically. This is done by assigning the - * special value BLE_HS_ADV_TX_PWR_LVL_AUTO. - */ - fields.tx_pwr_lvl_is_present = 1; - fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; - - fields.name = (uint8_t *)device_name; - fields.name_len = hal_strlen_s(device_name); - fields.name_is_complete = 1; - - rc = ble_gap_adv_set_fields(&fields); - if (rc != 0) { -// MODLOG_DFLT(ERROR, "error setting advertisement data; rc=%d\n", rc); - return; - } - - /* Begin advertising */ - memset(&adv_params, 0, sizeof(adv_params)); - adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; - adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; - rc = ble_gap_adv_start(blehr_addr_type, NULL, BLE_HS_FOREVER, - &adv_params, blehr_gap_event, NULL); - if (rc != 0) { -// MODLOG_DFLT(ERROR, "error enabling advertisement; rc=%d\n", rc); - return; - } -} - -static void -blehr_tx_hrate_stop(void) -{ - xTimerStop( blehr_tx_timer, 1000 / portTICK_PERIOD_MS ); -} - -/* Reset heart rate measurement */ -static void -blehr_tx_hrate_reset(void) -{ - int rc; - - if (xTimerReset(blehr_tx_timer, 1000 / portTICK_PERIOD_MS ) == pdPASS) { - rc = 0; - } else { - rc = 1; - } - - assert(rc == 0); - -} - -/* This function simulates heart beat and notifies it to the client */ -static void -blehr_tx_hrate(xTimerHandle ev) -{ - (void)ev; - - static uint8_t hrm[2]; - int rc; - struct os_mbuf *om; - - if (!notify_state) { - blehr_tx_hrate_stop(); - heartrate = 90; - return; - } - - hrm[0] = 0x06; /* contact of a sensor */ - hrm[1] = heartrate; /* storing dummy data */ - - /* Simulation of heart beats */ - heartrate++; - if (heartrate == 160) { - heartrate = 90; - } - - om = ble_hs_mbuf_from_flat(hrm, sizeof(hrm)); - rc = ble_gattc_notify_custom(conn_handle, hrs_hrm_handle, om); - - assert(rc == 0); - - blehr_tx_hrate_reset(); -} - -static int -blehr_gap_event(struct ble_gap_event *event, void *arg) -{ - (void)arg; - - switch (event->type) { - - case BLE_GAP_EVENT_CONNECT: - /* A new connection was established or a connection attempt failed */ - MODLOG_DFLT(INFO, "connection %s; status=%d\n", - event->connect.status == 0 ? "established" : "failed", - event->connect.status); - - if (event->connect.status != 0) { - /* Connection failed; resume advertising */ - blehr_advertise(); - } - conn_handle = event->connect.conn_handle; - break; - - case BLE_GAP_EVENT_DISCONNECT: - MODLOG_DFLT(INFO, "disconnect; reason=%d\n", event->disconnect.reason); - - /* Connection terminated; resume advertising */ - blehr_advertise(); - break; - - case BLE_GAP_EVENT_ADV_COMPLETE: - MODLOG_DFLT(INFO, "adv complete\n"); - blehr_advertise(); - break; - - case BLE_GAP_EVENT_SUBSCRIBE: - MODLOG_DFLT(INFO, "subscribe event; cur_notify=%d\n value handle; " - "val_handle=%d\n", - event->subscribe.cur_notify, hrs_hrm_handle); - if (event->subscribe.attr_handle == hrs_hrm_handle) { - notify_state = event->subscribe.cur_notify; - blehr_tx_hrate_reset(); - } else if (event->subscribe.attr_handle != hrs_hrm_handle) { - notify_state = event->subscribe.cur_notify; - blehr_tx_hrate_stop(); - } - ESP_LOGI("BLE_GAP_SUBSCRIBE_EVENT", "conn_handle from subscribe=%d", conn_handle); - break; - - case BLE_GAP_EVENT_MTU: - MODLOG_DFLT(INFO, "mtu update event; conn_handle=%d mtu=%d\n", - event->mtu.conn_handle, - event->mtu.value); - break; - - } - - return 0; -} - -static void -blehr_on_sync(void) -{ - int rc; - - rc = ble_hs_id_infer_auto(0, &blehr_addr_type); - assert(rc == 0); - - uint8_t addr_val[6] = {0}; - rc = ble_hs_id_copy_addr(blehr_addr_type, addr_val, NULL); - - MODLOG_DFLT(INFO, "Device Address: "); - print_addr(addr_val); - MODLOG_DFLT(INFO, "\n"); - - /* Begin advertising */ - blehr_advertise(); -} - -static void -blehr_on_reset(int reason) -{ - MODLOG_DFLT(ERROR, "Resetting state; reason=%d\n", reason); -} - -void blehr_host_task(void *param) -{ - (void)param; - - ESP_LOGI(tag, "BLE Host Task Started"); - /* This function will return only when nimble_port_stop() is executed */ - nimble_port_run(); - - nimble_port_freertos_deinit(); -} - -void blehr_main_task(void *param) -{ - (void)param; - int rc; - - // Delay start for test otherwise debug from VS has problems - OS_DELAY(1000); - - ESP_ERROR_CHECK(esp_nimble_hci_and_controller_init()); - - nimble_port_init(); - /* Initialize the NimBLE host configuration */ - ble_hs_cfg.sync_cb = blehr_on_sync; - ble_hs_cfg.reset_cb = blehr_on_reset; - - /* name, period/time, auto reload, timer ID, callback */ - blehr_tx_timer = xTimerCreate("blehr_tx_timer", pdMS_TO_TICKS(1000), pdTRUE, (void *)0, blehr_tx_hrate); - - rc = gatt_svr_init(); - assert(rc == 0); - - /* Set the default device name */ - rc = ble_svc_gap_device_name_set(device_name); - assert(rc == 0); - - /* Start the task */ - nimble_port_freertos_init(blehr_host_task); -} - -// Start BLE heart rate monitor device -void blehr_start() -{ - nimble_port_freertos_init(blehr_main_task); -} - -// ======================================================= -// Ibeacon test code -// ================= -static void -ble_app_set_addr(void) -{ - ble_addr_t addr; - int rc; - - rc = ble_hs_id_gen_rnd(1, &addr); - assert(rc == 0); - - rc = ble_hs_id_set_rnd(addr.val); - assert(rc == 0); -} - -static void -ble_app_advertise(void) -{ - struct ble_gap_adv_params adv_params; - uint8_t uuid128[16]; - int rc; - - /* Arbitrarily set the UUID to a string of 0x11 bytes. */ - memset(uuid128, 0x11, sizeof uuid128); - - /* Major version=2; minor version=10. */ - rc = ble_ibeacon_set_adv_data(uuid128, 2, 10, 0); - assert(rc == 0); - - /* Begin advertising. */ - adv_params = (struct ble_gap_adv_params){ 0,0,0,0,0,0,0 }; - rc = ble_gap_adv_start(BLE_OWN_ADDR_RANDOM, NULL, BLE_HS_FOREVER, - &adv_params, NULL, NULL); - assert(rc == 0); -} - -static void -ble_app_on_sync(void) -{ - /* Generate a non-resolvable private address. */ - ble_app_set_addr(); - - /* Advertise indefinitely. */ - ble_app_advertise(); -} - - -void ibeacon_host_task(void *param) -{ - (void)param; - - // Delay start for test otehrwise debug from VS has problems - OS_DELAY(1000); - - ESP_LOGI(tag, "BLE Host Task Started"); - - ESP_ERROR_CHECK(esp_nimble_hci_and_controller_init()); - - nimble_port_init(); - - ble_hs_cfg.sync_cb = ble_app_on_sync; - - /* This function will return only when nimble_port_stop() is executed */ - nimble_port_run(); - - nimble_port_freertos_deinit(); -} - -void ibeacon_start() -{ - /* Start the task */ - nimble_port_freertos_init(ibeacon_host_task); -} - - - diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.cpp b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.cpp deleted file mode 100644 index 9efa965764..0000000000 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include "nanoFramework_hardware_esp32_ble_native.h" - -static const CLR_RT_MethodHandler method_lookup[] = -{ - NULL, - NULL, - NULL -}; - -const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Hardware_Esp32_Ble = -{ - "nanoFramework.Hardware.Esp32.Ble", - 0x1B75B894, - method_lookup, - { 100, 0, 0, 0 } -}; diff --git a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.h b/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.h deleted file mode 100644 index 8ba4ff2739..0000000000 --- a/targets/ESP32/_nanoCLR/nanoFramework.Hardware.Esp32.Ble/nanoFramework_hardware_esp32_ble_native.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef NANOFRAMEWORK_HARDWARE_ESP32_BLE_NATIVE_H -#define NANOFRAMEWORK_HARDWARE_ESP32_BLE_NATIVE_H - -#include -#include -#include -#include - - - -extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Hardware_Esp32_Ble; - -#endif // NANOFRAMEWORK_HARDWARE_ESP32_BLE_NATIVE_H diff --git a/targets/ESP32/_nanoCLR/target_platform.h.in b/targets/ESP32/_nanoCLR/target_platform.h.in index 470ce23ecf..daa73c3ac1 100644 --- a/targets/ESP32/_nanoCLR/target_platform.h.in +++ b/targets/ESP32/_nanoCLR/target_platform.h.in @@ -9,9 +9,9 @@ #define NANOCLR_GRAPHICS @NANOCLR_GRAPHICS@ #define HAL_USE_SPI @HAL_USE_SPI_OPTION@ #define HAL_USE_SDC @HAL_USE_SDC_OPTION@ -#define NANOCLR_ESP32_BLE @HAL_USE_BLE@ +#define HAL_USE_BLE @HAL_USE_BLE_OPTION@ -#if defined(HAL_USE_SDC) +#if (HAL_USE_SDC == TRUE) #define SDC_MAX_OPEN_FILES 5 #endif diff --git a/targets/FreeRTOS/CMakeLists.txt b/targets/FreeRTOS/CMakeLists.txt index 4b9e216433..9a1fa6f3d7 100644 --- a/targets/FreeRTOS/CMakeLists.txt +++ b/targets/FreeRTOS/CMakeLists.txt @@ -63,24 +63,20 @@ if(NO_RTOS_SOURCE_FOLDER) else() # FreeRTOS source was specified - # sanity check is source path exists - if(EXISTS "${RTOS_SOURCE_FOLDER}/") - message(STATUS "RTOS is: FreeRTOS ${RTOS_VERSION} (source from: ${RTOS_SOURCE_FOLDER})") - - FetchContent_Declare( - freertos - GIT_REPOSITORY ${RTOS_SOURCE_FOLDER} - GIT_TAG ${RTOS_VERSION} - ) - - else() - message(FATAL_ERROR "Couldn't find FreeRTOS source at ${RTOS_SOURCE_FOLDER}/") - endif() + message(STATUS "RTOS is: FreeRTOS ${RTOS_VERSION} (source from: ${RTOS_SOURCE_FOLDER})") + + FetchContent_Declare( + freertos + SOURCE_DIR ${RTOS_SOURCE_FOLDER} + ) endif() FetchContent_GetProperties(freertos) -FetchContent_Populate(freertos) +if(NOT freertos_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(freertos) +endif() # check if CMSIS_SOURCE was specified or if it's empty (default is empty) set(NO_CMSIS_SOURCE TRUE) @@ -123,23 +119,21 @@ if(NO_CMSIS_SOURCE) else() # CMSIS source was specified - # sanity check is source path exists - if(EXISTS "${CMSIS_SOURCE}/") - message(STATUS "CMSIS v${CMSIS_GIT_TAG} (source from: ${CMSIS_SOURCE})") - - FetchContent_Declare( - cmsis - GIT_REPOSITORY ${CMSIS_SOURCE} - GIT_TAG ${CMSIS_GIT_TAG} - ) - else() - message(FATAL_ERROR "Couldn't find CMSIS source at ${CMSIS_SOURCE}/") - endif() + message(STATUS "CMSIS v${CMSIS_GIT_TAG} (source from: ${CMSIS_SOURCE})") + + FetchContent_Declare( + cmsis + SOURCE_DIR ${CMSIS_SOURCE} + ) endif() FetchContent_GetProperties(cmsis) FetchContent_Populate(cmsis) +if(NOT cmsis_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(cmsis) +endif() # FreeRTOS common directories add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/_common) @@ -147,7 +141,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/_common) # try to find board in the targets folder # and set target base location and base path for class libs # this has to be set before the class library modules are pulled in -if(EXISTS ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/NXP/${TARGET_BOARD}) +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/NXP/${TARGET_BOARD}) # board found message(STATUS "Support for target board '${TARGET_BOARD}' found") @@ -164,7 +158,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/NXP/${TARGET_BOARD}) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/NXP/${TARGET_BOARD}) # try to find board in the targets folder -elseif(EXISTS ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/ST/${TARGET_BOARD}) +elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/ST/${TARGET_BOARD}) # board found message(STATUS "Support for target board '${TARGET_BOARD}' found") @@ -183,7 +177,7 @@ elseif(EXISTS ${CMAKE_SOURCE_DIR}/targets/FreeRTOS/ST/${TARGET_BOARD}) else() # try to find NXP board in the Community targets folder - if(EXISTS ${CMAKE_SOURCE_DIR}/targets-community/FreeRTOS/NXP/${TARGET_BOARD}) + if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets-community/FreeRTOS/NXP/${TARGET_BOARD}) # board found message(STATUS "Support for target board '${TARGET_BOARD}' found in Community targets") @@ -200,7 +194,7 @@ else() add_subdirectory(${CMAKE_SOURCE_DIR}/targets-community/FreeRTOS/NXP/${TARGET_BOARD}) # try to find STM board in the Community targets folder - elseif(EXISTS ${CMAKE_SOURCE_DIR}/targets-community/FreeRTOS/ST/${TARGET_BOARD}) + elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/targets-community/FreeRTOS/ST/${TARGET_BOARD}) # board found message(STATUS "Support for target board '${TARGET_BOARD}' found in Community targets") diff --git a/targets/FreeRTOS/NXP/CMakeLists.txt b/targets/FreeRTOS/NXP/CMakeLists.txt index 2a1da26903..a5f06b4691 100644 --- a/targets/FreeRTOS/NXP/CMakeLists.txt +++ b/targets/FreeRTOS/NXP/CMakeLists.txt @@ -46,23 +46,20 @@ if(NO_FATFS_SOURCE) else() # FatFS source was specified - # sanity check is source path exists - if(EXISTS "${FATFS_SOURCE}/") - message(STATUS "FatFS ${FATFS_VERSION_TAG} source from: ${FATFS_SOURCE})") - - FetchContent_Declare( - fatfs - GIT_REPOSITORY ${FATFS_SOURCE} - GIT_TAG ${FATFS_VERSION_TAG} - ) - else() - message(FATAL_ERROR "Couldn't find FatFS source at ${FATFS_SOURCE}/") - endif() + message(STATUS "FatFS ${FATFS_VERSION_TAG} source from: ${FATFS_SOURCE})") + + FetchContent_Declare( + fatfs + SOURCE_DIR ${FATFS_SOURCE} + ) endif() FetchContent_GetProperties(fatfs) -FetchContent_Populate(fatfs) +if(NOT fatfs_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(fatfs) +endif() # have to delete the ffconf.h template from the repo execute_process( @@ -109,24 +106,20 @@ if(NO_LWIP_SOURCE) else() # LWIP source was specified - # sanity check is source path exists - if(EXISTS "${LWIP_SOURCE}/") - message(STATUS "lwIP ${LWIP_GIT_TAG} (source from: ${LWIP_SOURCE})") + message(STATUS "lwIP ${LWIP_GIT_TAG} (source from: ${LWIP_SOURCE})") - FetchContent_Declare( - lwip - GIT_REPOSITORY ${LWIP_SOURCE} - GIT_TAG ${LWIP_GIT_TAG} - ) - - else() - message(FATAL_ERROR "Couldn't find LWIP source at ${LWIP_SOURCE}/") - endif() + FetchContent_Declare( + lwip + SOURCE_DIR ${LWIP_SOURCE} + ) endif() FetchContent_GetProperties(lwip) -FetchContent_Populate(lwip) +if(NOT lwip_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(lwip) +endif() # append FatFS files if(USE_FILESYSTEM_OPTION) diff --git a/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/README.md b/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/README.md index 11ada522ca..3e3b3443fc 100644 --- a/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/README.md +++ b/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/README.md @@ -54,7 +54,7 @@ Pre-configured cmake-variants.json for this board "API_Windows.Devices.Adc": "OFF", "API_System.Device.Adc": "OFF", "API_Windows.Devices.Pwm": "OFF", - "API_Windows.Devices.Wifi": "OFF", + "API_System.Device.WiFi": "OFF", "API_System.Net": "OFF", "API_System.Math": "ON", "API_Windows.Storage": "ON" diff --git a/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/cmake-variants.json b/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/cmake-variants.json index 816eabe03d..781927b7bc 100644 --- a/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/cmake-variants.json +++ b/targets/FreeRTOS/NXP/NXP_MIMXRT1060_EVK/cmake-variants.json @@ -51,7 +51,7 @@ "API_Windows.Devices.Adc": "OFF", "API_System.Device.Adc": "OFF", "API_Windows.Devices.Pwm": "OFF", - "API_Windows.Devices.Wifi": "OFF", + "API_System.Device.WiFi": "OFF", "API_Windows.Devices.SerialCommunication": "ON", "API_System.IO.Ports": "ON", "API_nanoFramework.ResourceManager": "ON", diff --git a/targets/FreeRTOS/NXP/_LwIP/nf_sockets.c b/targets/FreeRTOS/NXP/_LwIP/nf_sockets.c index e1935e9b3e..168075fcdd 100644 --- a/targets/FreeRTOS/NXP/_LwIP/nf_sockets.c +++ b/targets/FreeRTOS/NXP/_LwIP/nf_sockets.c @@ -4,6 +4,8 @@ // See LICENSE file in the project root for full license information. // +// clang-format off + // from the original source code file // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: @@ -32,7 +34,6 @@ // Author: Adam Dunkels // Improved by Marc Boucher and David Haas - #include #include "lwip/opt.h" @@ -685,8 +686,7 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) err = netconn_connect(sock->conn, &remote_addr, remote_port); } - if (err == ERR_INPROGRESS) - { + if (err == ERR_INPROGRESS) { LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) operation in progress\n", s)); sock_set_errno(sock, err_to_errno(err)); return -1; @@ -2855,3 +2855,5 @@ uint32_t lwip_socket_get_err(int s) } #endif /* LWIP_SOCKET */ + +// clang-format on diff --git a/targets/FreeRTOS/NXP/_nanoCLR/targetHAL_Network.cpp b/targets/FreeRTOS/NXP/_nanoCLR/targetHAL_Network.cpp index 88191f6f84..bb111f7217 100644 --- a/targets/FreeRTOS/NXP/_nanoCLR/targetHAL_Network.cpp +++ b/targets/FreeRTOS/NXP/_nanoCLR/targetHAL_Network.cpp @@ -8,36 +8,40 @@ #include #include "nf_lwipthread.h" -// this is the declaration for the callback implement in nf_sys_arch.c -extern "C" void set_signal_sock_function( void (*funcPtr)() ); +// this is the declaration for the callback implement in nf_sys_arch.c +extern "C" void set_signal_sock_function(void (*funcPtr)()); + +// buffer with host name +char hostName[18] = "nanodevice_"; // // Callback from lwIP on event // void sys_signal_sock_event() { - Events_Set(SYSTEM_EVENT_FLAG_SOCKET); + Events_Set(SYSTEM_EVENT_FLAG_SOCKET); } void nanoHAL_Network_Initialize() { // Initialise the lwIP CLR signal callback - set_signal_sock_function( &sys_signal_sock_event ); + set_signal_sock_function(&sys_signal_sock_event); // get network configuration, if available - if(g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0) + if (g_TargetConfiguration.NetworkInterfaceConfigs->Count == 0) { // there is no networking configuration block, can't proceed return; } HAL_Configuration_NetworkInterface networkConfig; - - if(ConfigurationManager_GetConfigurationBlock((void *)&networkConfig, DeviceConfigurationOption_Network, 0) == true) + + if (ConfigurationManager_GetConfigurationBlock((void *)&networkConfig, DeviceConfigurationOption_Network, 0) == + true) { - // build lwIP configuration + // build lwIP configuration struct lwipthread_opts lwipOptions; - + // init config memset(&lwipOptions, 0, sizeof(lwipOptions)); @@ -45,14 +49,14 @@ void nanoHAL_Network_Initialize() lwipOptions.macaddress = (uint8_t *)networkConfig.MacAddress; // static or dinamic address - if(networkConfig.StartupAddressMode == AddressMode_Static) + if (networkConfig.StartupAddressMode == AddressMode_Static) { // IPv4 configs lwipOptions.address = networkConfig.IPv4Address; lwipOptions.netmask = networkConfig.IPv4NetMask; lwipOptions.gateway = networkConfig.IPv4GatewayAddress; } - else if(networkConfig.StartupAddressMode == AddressMode_DHCP) + else if (networkConfig.StartupAddressMode == AddressMode_DHCP) { // clear IPv4 configs lwipOptions.address = 0; @@ -64,8 +68,19 @@ void nanoHAL_Network_Initialize() // our enum follows lwIP defines for address mode lwipOptions.addrMode = (net_addr_mode_t)networkConfig.StartupAddressMode; - // we could consider making the device name configurable (or maybe not) - lwipOptions.ourHostName = "nanodevice"; + // compose host name with nanodevice and last 3 bytes of MAC address + // nanodevice_XXXXXX + char *macPosition = hostName + 11; + + // copy over last 3 bytes of MAC address + for (int index = 3; index < 6; index++) + { + sprintf(macPosition, "%02X", (int)networkConfig.MacAddress[index]); + macPosition += 2; + } + + // set host name + lwipOptions.ourHostName = hostName; // Start lwIP thread in ChibiOS bindings using the above options lwipInit(&lwipOptions); diff --git a/targets/TI_SimpleLink/CMakeLists.txt b/targets/TI_SimpleLink/CMakeLists.txt index 2eb5658bf9..36b9f96bd6 100644 --- a/targets/TI_SimpleLink/CMakeLists.txt +++ b/targets/TI_SimpleLink/CMakeLists.txt @@ -46,24 +46,20 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") else() # TI SimpleLink CC32xx SDK source was specified - # sanity check is source path exists - if(EXISTS "${TI_SL_CC32xx_SDK_SOURCE}/") - message(STATUS "TI SimpleLink CC32xx SDK ${TI_SL_CC32xx_SDK_TAG} source from: ${TI_SL_CC32xx_SDK_SOURCE}") - - FetchContent_Declare( - simplelinkcc32xxsdk - GIT_REPOSITORY ${TI_SL_CC32xx_SDK_SOURCE} - GIT_TAG ${TI_SL_CC32xx_SDK_TAG} - ) - - else() - message(FATAL_ERROR "Couldn't find TI SimpleLink CC32xx SDK source at ${TI_SL_CC32xx_SDK_SOURCE}/") - endif() + message(STATUS "TI SimpleLink CC32xx SDK ${TI_SL_CC32xx_SDK_TAG} source from: ${TI_SL_CC32xx_SDK_SOURCE}") + + FetchContent_Declare( + simplelinkcc32xxsdk + SOURCE_DIR ${TI_SL_CC32xx_SDK_SOURCE} + ) endif() FetchContent_GetProperties(simplelinkcc32xxsdk) - FetchContent_Populate(simplelinkcc32xxsdk) + if(NOT simplelinkcc32xxsdk_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(simplelinkcc32xxsdk) + endif() # check if TI_XDCTOOLS_SOURCE was specified or if it's empty (default is empty) set(NO_TI_XDCTOOLS_SOURCE TRUE) @@ -80,7 +76,7 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") if(TI_XDCTOOLS_VERSION_EMPTY) # no TI XDCTools version actualy specified, must be empty which is fine, we'll default to a known good version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(TI_XDCTOOLS_VERSION_TAG "3.62.00.08") + set(TI_XDCTOOLS_VERSION_TAG "3.62.01.15") else() # set SVN tag set(TI_XDCTOOLS_VERSION_TAG "${TI_XDCTOOLS_VERSION}") @@ -100,24 +96,20 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") else() # TI XDCTools source was specified - # sanity check is source path exists - if(EXISTS "${TI_XDCTOOLS_SOURCE}/") - message(STATUS "TI XDCTools ${TI_XDCTOOLS_VERSION} (source from: ${TI_XDCTOOLS_SOURCE})") + message(STATUS "TI XDCTools ${TI_XDCTOOLS_VERSION} (source from: ${TI_XDCTOOLS_SOURCE})") - FetchContent_Declare( - ti_xdctools - GIT_REPOSITORY ${TI_XDCTOOLS_SOURCE} - GIT_TAG ${TI_XDCTOOLS_VERSION_TAG} - ) - - else() - message(FATAL_ERROR "Couldn't find TI XDCTools source at ${TI_XDCTOOLS_SOURCE}/") - endif() + FetchContent_Declare( + ti_xdctools + SOURCE_DIR ${TI_XDCTOOLS_SOURCE} + ) endif() FetchContent_GetProperties(ti_xdctools) - FetchContent_Populate(ti_xdctools) + if(NOT ti_xdctools_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(ti_xdctools) + endif() set(TI_XDCTools_INCLUDE_DIR ${ti_xdctools_SOURCE_DIR}/packages/ PARENT_SCOPE) @@ -126,54 +118,49 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") set(TOOLCHAIN_LIB_DIR ${simplelinkcc32xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) ############################################ -elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) +elseif( "${TARGET_SERIES}" STREQUAL "CC13X2" ) - # CC13x2 and CC26x2 series are using TI SimpleLink CC13x2_26x2 SDK and TI RTOS + # CC13x2 and CC26x2 series are using TI SimpleLink CC13xx_26xx SDK and TI RTOS - # check if TI_SL_CC13x2_26x2_SDK_SOURCE was specified or if it's empty (default is empty) - set(NO_TI_SL_CC13x2_26x2_SDK_SOURCE TRUE) - if(TI_SL_CC13x2_26x2_SDK_SOURCE) - if(NOT "${TI_SL_CC13x2_26x2_SDK_SOURCE}" STREQUAL "") - set(NO_TI_SL_CC13x2_26x2_SDK_SOURCE FALSE) + # check if TI_SL_CC13xx_26xx_SDK_SOURCE was specified or if it's empty (default is empty) + set(NO_TI_SL_CC13xx_26xx_SDK_SOURCE TRUE) + if(TI_SL_CC13xx_26xx_SDK_SOURCE) + if(NOT "${TI_SL_CC13xx_26xx_SDK_SOURCE}" STREQUAL "") + set(NO_TI_SL_CC13xx_26xx_SDK_SOURCE FALSE) endif() endif() # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(TI_SL_CC13x2_26x2_SDK_TAG "5.10.00.48" CACHE INTERNAL "TI CC13x2_26x2 SDK tag") + set(TI_SL_CC13xx_26xx_SDK_TAG "5.30.01.01" CACHE INTERNAL "TI CC13xx_26xx SDK tag") - if(NO_TI_SL_CC13x2_26x2_SDK_SOURCE) - # no TI SimpleLink CC13x2_26x2 SDK source specified, download it from our repo + if(NO_TI_SL_CC13xx_26xx_SDK_SOURCE) + # no TI SimpleLink CC13xx_26xx SDK source specified, download it from our repo - message(STATUS "TI SimpleLink CC13x2_26x2 SDK (latest available code from v${TI_SL_CC13x2_26x2_SDK_TAG})") + message(STATUS "TI SimpleLink CC13xx_26xx SDK (latest available code from v${TI_SL_CC13xx_26xx_SDK_TAG})") FetchContent_Declare( - simplelinkcc13x2_26x2sdk - GIT_REPOSITORY https://github.com/nanoframework/SimpleLink_CC13x2_26x2_SDK - GIT_TAG ${TI_SL_CC13x2_26x2_SDK_TAG} + simplelinkcc13xx_26xxsdk + GIT_REPOSITORY https://github.com/nanoframework/SimpleLink_CC13xx_26xx_SDK + GIT_TAG ${TI_SL_CC13xx_26xx_SDK_TAG} ) else() - # TI SimpleLink CC13x2_26x2 SDK source was specified + # TI SimpleLink CC13xx_26xx SDK source was specified + message(STATUS "TI SimpleLink CC13xx_26xx SDK ${TI_SL_CC13xx_26xx_SDK_TAG} source from: ${TI_SL_CC13xx_26xx_SDK_SOURCE}") - # sanity check is source path exists - if(EXISTS "${TI_SL_CC13x2_26x2_SDK_SOURCE}/") - message(STATUS "TI SimpleLink CC13x2_26x2 SDK ${TI_SL_CC13x2_26x2_SDK_TAG} source from: ${TI_SL_CC13x2_26x2_SDK_SOURCE}") - - FetchContent_Declare( - simplelinkcc13x2_26x2sdk - GIT_REPOSITORY ${TI_SL_CC13x2_26x2_SDK_SOURCE} - GIT_TAG ${TI_SL_CC13x2_26x2_SDK_TAG} - ) - - else() - message(FATAL_ERROR "Couldn't find TI SimpleLink CC13x2_26x2 SDK source at ${TI_SL_CC13x2_26x2_SDK_SOURCE}/") - endif() + FetchContent_Declare( + simplelinkcc13xx_26xxsdk + SOURCE_DIR ${TI_SL_CC13xx_26xx_SDK_SOURCE} + ) endif() - FetchContent_GetProperties(simplelinkcc13x2_26x2sdk) - FetchContent_Populate(simplelinkcc13x2_26x2sdk) + FetchContent_GetProperties(simplelinkcc13xx_26xxsdk) + if(NOT simplelinkcc13xx_26xxsdk_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(simplelinkcc13xx_26xxsdk) + endif() # check if TI_SYSCONFIG_SOURCE was specified or if it's empty (default is empty) set(NO_TI_SYSCONFIG_SOURCE TRUE) @@ -190,7 +177,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) if(TI_SYSCONFIG_VERSION_EMPTY) # no TI SysConfig version actualy specified, must be empty which is fine, we'll default to a known good version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(TI_SYSCONFIG_VERSION_TAG "1.8.1") + set(TI_SYSCONFIG_VERSION_TAG "1.10.0") else() # set Git tag set(TI_SYSCONFIG_VERSION_TAG "${TI_SYSCONFIG_VERSION}") @@ -210,24 +197,20 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) else() # TI SysConfig source was specified - # sanity check is source path exists - if(EXISTS "${TI_SYSCONFIG_SOURCE}/") - message(STATUS "TI SysConfig ${TI_SYSCONFIG_VERSION_TAG} (source from: ${TI_SYSCONFIG_SOURCE})") - - FetchContent_Declare( - ti_sysconfig - GIT_REPOSITORY ${TI_SYSCONFIG_SOURCE} - GIT_TAG ${TI_SYSCONFIG_VERSION_TAG} - ) - - else() - message(FATAL_ERROR "Couldn't find TI SysConfig source at ${TI_SYSCONFIG_SOURCE}/") - endif() + message(STATUS "TI SysConfig ${TI_SYSCONFIG_VERSION_TAG} (source from: ${TI_SYSCONFIG_SOURCE})") + + FetchContent_Declare( + ti_sysconfig + SOURCE_DIR ${TI_SYSCONFIG_SOURCE} + ) endif() FetchContent_GetProperties(ti_sysconfig) - FetchContent_Populate(ti_sysconfig) + if(NOT ti_sysconfig_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(ti_sysconfig) + endif() # check if TI_XDCTOOLS_SOURCE was specified or if it's empty (default is empty) set(NO_TI_XDCTOOLS_SOURCE TRUE) @@ -244,7 +227,7 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) if(TI_XDCTOOLS_VERSION_EMPTY) # no TI XDCTools version actualy specified, must be empty which is fine, we'll default to a known good version # WHEN CHANGING THIS MAKE SURE TO UPDATE THE DEV CONTAINERS - set(TI_XDCTOOLS_VERSION_TAG "3.62.00.08") + set(TI_XDCTOOLS_VERSION_TAG "3.62.01.15") else() # set tag set(TI_XDCTOOLS_VERSION_TAG "${TI_XDCTOOLS_VERSION}") @@ -264,29 +247,25 @@ elseif( "${TARGET_SERIES}" STREQUAL "CC13x2_26x2" ) else() # TI XDCTools source was specified - # sanity check is source path exists - if(EXISTS "${TI_XDCTOOLS_SOURCE}/") - message(STATUS "TI XDCTools ${TI_XDCTOOLS_VERSION_TAG} (source from: ${TI_XDCTOOLS_SOURCE})") - - FetchContent_Declare( - ti_xdctools - SOURCE_DIR ${TI_XDCTOOLS_SOURCE} - # GIT_TAG ${TI_XDCTOOLS_VERSION_TAG} - ) + message(STATUS "TI XDCTools ${TI_XDCTOOLS_VERSION_TAG} (source from: ${TI_XDCTOOLS_SOURCE})") - else() - message(FATAL_ERROR "Couldn't find TI XDCTools source at ${TI_XDCTOOLS_SOURCE}/") - endif() + FetchContent_Declare( + ti_xdctools + SOURCE_DIR ${TI_XDCTOOLS_SOURCE} + ) endif() FetchContent_GetProperties(ti_xdctools) - FetchContent_Populate(ti_xdctools) + if(NOT ti_xdctools_POPULATED) + # Fetch the content using previously declared details + FetchContent_Populate(ti_xdctools) + endif() set(TI_XDCTools_INCLUDE_DIR ${ti_xdctools_SOURCE_DIR}/packages/ PARENT_SCOPE) # need to override the toolchain lib directory - set(TOOLCHAIN_INC_DIR ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) - set(TOOLCHAIN_LIB_DIR ${simplelinkcc13x2_26x2sdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) + set(TOOLCHAIN_INC_DIR ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) + set(TOOLCHAIN_LIB_DIR ${simplelinkcc13xx_26xxsdk_SOURCE_DIR}/kernel/tirtos/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib) endif() diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CC1352R1_LAUNCHXL_fxns.c b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CC1352R1_LAUNCHXL_fxns.c index 5805042e79..49e61fc023 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CC1352R1_LAUNCHXL_fxns.c +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CC1352R1_LAUNCHXL_fxns.c @@ -44,107 +44,3 @@ #include #include - -/* - * ======== CC1352R1_LAUNCHXL_sendExtFlashByte ======== - */ -void CC1352R1_LAUNCHXL_sendExtFlashByte(PIN_Handle pinHandle, uint8_t byte) -{ - uint8_t i; - - /* SPI Flash CS */ - PIN_setOutputValue(pinHandle, IOID_20, 0); - - for (i = 0; i < 8; i++) - { - PIN_setOutputValue(pinHandle, IOID_10, 0); /* SPI Flash CLK */ - - /* SPI Flash MOSI */ - PIN_setOutputValue(pinHandle, IOID_9, (byte >> (7 - i)) & 0x01); - PIN_setOutputValue(pinHandle, IOID_10, 1); /* SPI Flash CLK */ - - /* - * Waste a few cycles to keep the CLK high for at - * least 45% of the period. - * 3 cycles per loop: 8 loops @ 48 Mhz = 0.5 us. - */ - CPUdelay(8); - } - - PIN_setOutputValue(pinHandle, IOID_10, 0); /* CLK */ - PIN_setOutputValue(pinHandle, IOID_20, 1); /* CS */ - - /* - * Keep CS high at least 40 us - * 3 cycles per loop: 700 loops @ 48 Mhz ~= 44 us - */ - CPUdelay(700); -} - -/* - * ======== CC1352R1_LAUNCHXL_wakeUpExtFlash ======== - */ -void CC1352R1_LAUNCHXL_wakeUpExtFlash(void) -{ - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS */ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_INPUT_DIS | PIN_DRVSTR_MED, - PIN_TERMINATE}; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - /* - * To wake up we need to toggle the chip select at - * least 20 ns and ten wait at least 35 us. - */ - - /* Toggle chip select for ~20ns to wake ext. flash */ - PIN_setOutputValue(extFlashPinHandle, IOID_20, 0); - /* 3 cycles per loop: 1 loop @ 48 Mhz ~= 62 ns */ - CPUdelay(1); - PIN_setOutputValue(extFlashPinHandle, IOID_20, 1); - /* 3 cycles per loop: 560 loops @ 48 Mhz ~= 35 us */ - CPUdelay(560); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== CC1352R1_LAUNCHXL_shutDownExtFlash ======== - */ -void CC1352R1_LAUNCHXL_shutDownExtFlash(void) -{ - /* - * To be sure we are putting the flash into sleep and not waking it, - * we first have to make a wake up call - */ - CC1352R1_LAUNCHXL_wakeUpExtFlash(); - - PIN_Config extFlashPinTable[] = { - /* SPI Flash CS*/ - IOID_20 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash CLK */ - IOID_10 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MOSI */ - IOID_9 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_INPUT_DIS | PIN_DRVSTR_MED, - /* SPI Flash MISO */ - IOID_8 | PIN_INPUT_EN | PIN_PULLDOWN, - PIN_TERMINATE}; - PIN_State extFlashPinState; - PIN_Handle extFlashPinHandle = PIN_open(&extFlashPinState, extFlashPinTable); - - uint8_t extFlashShutdown = 0xB9; - - CC1352R1_LAUNCHXL_sendExtFlashByte(extFlashPinHandle, extFlashShutdown); - - PIN_close(extFlashPinHandle); -} - -/* - * ======== Board_initHook ======== - * Called by Board_init() to perform board-specific initialization. - */ -void Board_initHook() -{ - CC1352R1_LAUNCHXL_shutDownExtFlash(); -} diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt index 27011d366b..3d1b702a4a 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/CMakeLists.txt @@ -13,9 +13,6 @@ nf_setup_target_build( CLR_EXTRA_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CC1352R1_LAUNCHXL_fxns.c - BOOTER_LINKER_FILE - CC13x2_26x2_CLR - CLR_EXTRA_COMPILE_DEFINITIONS -DDeviceFamily_CC13X2 diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/README.md b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/README.md index 2c55c76b94..bfa1e3c187 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/README.md +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/README.md @@ -5,7 +5,7 @@ The CC1352R1 LaunchPad board contains a TI CC1352R1 device. ## Documentation - Detailed documentation for this target reference can be found [here](http://docs.nanoframework.net/content/reference-targets/ti-cc1352r1-launchxlhtml). -- Instructions on how to flash the CC1352R1 LaunchPad can be found [here](http://docs.nanoframework.net/content/ti-simplelink/flash-nanoclr-cc13x2_26x2.html) +- Instructions on how to flash the CC1352R1 LaunchPad can be found [here](http://docs.nanoframework.net/content/ti-simplelink/flash-nanoclr-cc13xx_26xx.html) ## Jumper Settings diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_868.syscfg b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_868.syscfg index 9d00f657f1..5d1147cd28 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_868.syscfg +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_868.syscfg @@ -1,8 +1,8 @@ /** * These arguments were used when this file was generated. They will be automatically applied on subsequent loads * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. - * @cliArgs --board "/ti/boards/CC1352R1_LAUNCHXL" --product "simplelink_cc13x2_26x2_sdk@5.10.00.48" - * @versions {"data":"2021040816","timestamp":"2021040816","tool":"1.8.1+1900","templates":null} + * @cliArgs --board "/ti/boards/CC1352R1_LAUNCHXL" --rtos "tirtos" --product "simplelink_cc13xx_cc26xx_sdk@5.30.01.01" + * @versions {"tool":"1.11.0+2225"} */ /** @@ -11,8 +11,11 @@ const CCFG = scripting.addModule("/ti/devices/CCFG"); const ADC = scripting.addModule("/ti/drivers/ADC", {}, false); const ADC1 = ADC.addInstance(); -const DMA = scripting.addModule("/ti/drivers/DMA"); -const RTOS = scripting.addModule("/ti/drivers/RTOS"); +const GPIO = scripting.addModule("/ti/drivers/GPIO", {}, false); +const GPIO2 = GPIO.addInstance(); +const GPIO3 = GPIO.addInstance(); +const GPIO4 = GPIO.addInstance(); +const GPIO5 = GPIO.addInstance(); const UART2 = scripting.addModule("/ti/drivers/UART2", {}, false); const UART21 = UART2.addInstance(); const easylink = scripting.addModule("/ti/easylink/easylink"); @@ -23,23 +26,31 @@ const easylink = scripting.addModule("/ti/easylink/easylink"); CCFG.forceVddr = true; CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0"; -ADC1.$name = "ADC_0"; -ADC1.samplingDuration = "170 us"; -ADC1.adcPinInstance.$name = "CONFIG_PIN_0"; +ADC1.$name = "ADC_0"; +ADC1.samplingDuration = "170 us"; -UART21.$hardware = system.deviceData.board.components.XDS110UART; -UART21.$name = "UART0"; -UART21.txPinInstance.$name = "CONFIG_PIN_1"; -UART21.rxPinInstance.$name = "CONFIG_PIN_2"; +GPIO2.$name = "CONFIG_GPIO_0"; +GPIO2.$hardware = system.deviceData.board.components.LED_RED; + +GPIO3.$name = "CONFIG_GPIO_1"; +GPIO3.$hardware = system.deviceData.board.components.LED_GREEN; + +GPIO4.$name = "CONFIG_GPIO_2"; +GPIO4.$hardware = system.deviceData.board.components["BTN-1"]; + +GPIO5.$name = "CONFIG_GPIO_3"; +GPIO5.$hardware = system.deviceData.board.components["BTN-2"]; + +UART21.$name = "UART0"; +UART21.$hardware = system.deviceData.board.components.XDS110UART; -easylink.EasyLink_Phy_5kbpsSlLr = true; easylink.EasyLink_Phy_50kbps2gfsk = true; +easylink.EasyLink_Phy_5kbpsSlLr = true; easylink.EasyLink_Phy_200kbps2gfsk = true; -easylink.EasyLink_Phy_Custom = false; -easylink.defaultPhy = "EasyLink_Phy_5kbpsSlLr"; easylink.enableAddrFilter = false; -easylink.radioConfigEasylinkPhy5kbpssllr.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; -easylink.radioConfigEasylinkPhy50kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; +easylink.radioConfigEasylinkPhyCustom.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0"; +easylink.radioConfigEasylinkPhy50kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; +easylink.radioConfigEasylinkPhy5kbpssllr.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; easylink.radioConfigEasylinkPhy200kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param3"; /** @@ -49,6 +60,10 @@ easylink.radioConfigEasylinkPhy200kbps2gfsk.codeExportConfig.$name = "ti_devices */ ADC1.adc.$suggestSolution = "ADC0"; ADC1.adc.adcPin.$suggestSolution = "boosterpack.2"; +GPIO2.gpioPin.$suggestSolution = "boosterpack.39"; +GPIO3.gpioPin.$suggestSolution = "boosterpack.40"; +GPIO4.gpioPin.$suggestSolution = "boosterpack.13"; +GPIO5.gpioPin.$suggestSolution = "boosterpack.12"; UART21.uart.$suggestSolution = "UART0"; UART21.uart.txPin.$suggestSolution = "boosterpack.4"; UART21.uart.rxPin.$suggestSolution = "boosterpack.3"; diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_915.syscfg b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_915.syscfg index 54176bef05..cfa102f7c1 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_915.syscfg +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/TI_CC1352R1_LAUNCHXL_915.syscfg @@ -1,8 +1,8 @@ /** * These arguments were used when this file was generated. They will be automatically applied on subsequent loads * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. - * @cliArgs --board "/ti/boards/CC1352R1_LAUNCHXL" --product "simplelink_cc13x2_26x2_sdk@5.10.00.48" - * @versions {"data":"2021040816","timestamp":"2021040816","tool":"1.8.1+1900","templates":null} + * @cliArgs --board "/ti/boards/CC1352R1_LAUNCHXL" --rtos "tirtos" --product "simplelink_cc13xx_cc26xx_sdk@5.30.01.01" + * @versions {"tool":"1.11.0+2225"} */ /** @@ -11,8 +11,11 @@ const CCFG = scripting.addModule("/ti/devices/CCFG"); const ADC = scripting.addModule("/ti/drivers/ADC", {}, false); const ADC1 = ADC.addInstance(); -const DMA = scripting.addModule("/ti/drivers/DMA"); -const RTOS = scripting.addModule("/ti/drivers/RTOS"); +const GPIO = scripting.addModule("/ti/drivers/GPIO", {}, false); +const GPIO2 = GPIO.addInstance(); +const GPIO3 = GPIO.addInstance(); +const GPIO4 = GPIO.addInstance(); +const GPIO5 = GPIO.addInstance(); const UART2 = scripting.addModule("/ti/drivers/UART2", {}, false); const UART21 = UART2.addInstance(); const easylink = scripting.addModule("/ti/easylink/easylink"); @@ -23,22 +26,36 @@ const easylink = scripting.addModule("/ti/easylink/easylink"); CCFG.forceVddr = true; CCFG.ccfgTemplate.$name = "ti_devices_CCFGTemplate0"; -ADC1.$name = "CONFIG_ADC_0"; -ADC1.adcPinInstance.$name = "CONFIG_PIN_2"; +ADC1.$name = "ADC_0"; +ADC1.samplingDuration = "170 us"; -UART21.$hardware = system.deviceData.board.components.XDS110UART; -UART21.$name = "UART0"; -UART21.txPinInstance.$name = "CONFIG_PIN_0"; -UART21.rxPinInstance.$name = "CONFIG_PIN_1"; +GPIO2.$name = "CONFIG_GPIO_0"; +GPIO2.$hardware = system.deviceData.board.components.LED_RED; +GPIO3.$name = "CONFIG_GPIO_1"; +GPIO3.$hardware = system.deviceData.board.components.LED_GREEN; + +GPIO4.$name = "CONFIG_GPIO_2"; +GPIO4.$hardware = system.deviceData.board.components["BTN-1"]; + +GPIO5.$name = "CONFIG_GPIO_3"; +GPIO5.$hardware = system.deviceData.board.components["BTN-2"]; + +UART21.$name = "UART0"; +UART21.$hardware = system.deviceData.board.components.XDS110UART; + +easylink.EasyLink_Phy_50kbps2gfsk = true; easylink.EasyLink_Phy_5kbpsSlLr = true; easylink.EasyLink_Phy_200kbps2gfsk = true; -easylink.EasyLink_Phy_Custom = false; easylink.enableAddrFilter = false; -easylink.EasyLink_Phy_50kbps2gfsk = true; -easylink.radioConfigEasylinkPhy5kbpssllr.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; -easylink.radioConfigEasylinkPhy200kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; -easylink.radioConfigEasylinkPhy50kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0"; +easylink.radioConfigEasylinkPhyCustom.carrierFrequency = 915.0000; +easylink.radioConfigEasylinkPhyCustom.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0"; +easylink.radioConfigEasylinkPhy50kbps2gfsk.carrierFrequency = 915.0000; +easylink.radioConfigEasylinkPhy50kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param1"; +easylink.radioConfigEasylinkPhy5kbpssllr.carrierFrequency = 915.0000; +easylink.radioConfigEasylinkPhy5kbpssllr.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param2"; +easylink.radioConfigEasylinkPhy200kbps2gfsk.carrierFrequency = 915.0000; +easylink.radioConfigEasylinkPhy200kbps2gfsk.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param3"; /** * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future @@ -47,6 +64,10 @@ easylink.radioConfigEasylinkPhy50kbps2gfsk.codeExportConfig.$name = "ti_devices */ ADC1.adc.$suggestSolution = "ADC0"; ADC1.adc.adcPin.$suggestSolution = "boosterpack.2"; +GPIO2.gpioPin.$suggestSolution = "boosterpack.39"; +GPIO3.gpioPin.$suggestSolution = "boosterpack.40"; +GPIO4.gpioPin.$suggestSolution = "boosterpack.13"; +GPIO5.gpioPin.$suggestSolution = "boosterpack.12"; UART21.uart.$suggestSolution = "UART0"; UART21.uart.txPin.$suggestSolution = "boosterpack.4"; UART21.uart.rxPin.$suggestSolution = "boosterpack.3"; diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/cmake-variants.json b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/cmake-variants.json index 612e74492a..5d5a5b030a 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/cmake-variants.json +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/cmake-variants.json @@ -30,10 +30,10 @@ "CMAKE_TOOLCHAIN_FILE": "CMake/toolchain.arm-none-eabi.cmake", "TOOLCHAIN_PREFIX": "", "RTOS": "TI_SimpleLink", - "TARGET_SERIES": "CC13x2_26x2", + "TARGET_SERIES": "CC13X2", "TARGET_BOARD": "TI_CC1352R1_LAUNCHXL", "RADIO_FREQUENCY": "CHANGE_ME_TO_A_VALID_VALUE_868_OR_915", - "TI_SL_CC13x2_26x2_SDK_SOURCE": "", + "TI_SL_CC13xx_26xx_SDK_SOURCE": "", "TI_XDCTOOLS_SOURCE": "", "TI_SYSCONFIG_SOURCE": "", "SUPPORT_ANY_BASE_CONVERSION": "OFF", @@ -42,7 +42,7 @@ "NF_FEATURE_RTC": "ON", "NF_FEATURE_HAS_SDCARD": "OFF", "NF_BUILD_RTM": "OFF", - "API_System.Math": "ON", + "API_System.Math": "OFF", "API_Windows.Devices.Gpio": "ON", "API_System.Device.Gpio": "ON", "API_Windows.Devices.Spi": "OFF", diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/nanoCLR/main.c b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/nanoCLR/main.c index fafaa8211f..b3376154c9 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/nanoCLR/main.c +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/nanoCLR/main.c @@ -23,8 +23,8 @@ // Stack size in bytes #define THREADSTACKSIZE 2048 -Task_Handle receiverHandle; -Task_Handle clrHandle; +Task_Struct receiverTask; +Task_Struct clrTask; CLR_SETTINGS clrSettings; @@ -36,16 +36,35 @@ extern GPIO_PinConfig gpioPinConfigs[GPIO_MAX_PINS]; extern GPIO_CallbackFxn gpioCallbackFunctions[GPIO_MAX_PINS]; // this has to be define in a C file, otherwise the linker can't replace the weak one declared in the SDK driver library -const GPIOCC26XX_Config GPIOCC26XX_config = { - .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, - .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, - .numberOfPinConfigs = GPIO_MAX_PINS, - .numberOfCallbacks = GPIO_MAX_PINS, - .intPriority = (~0)}; +// const GPIOCC26XX_Config GPIOCC26XX_config = { +// .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs, +// .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions, +// .numberOfPinConfigs = GPIO_MAX_PINS, +// .numberOfCallbacks = GPIO_MAX_PINS, +// .intPriority = (~0)}; extern void ReceiverThread(UArg arg0, UArg arg1); extern void CLRStartupThread(UArg arg0, UArg arg1); +///////////////////////////////////////////////// + +Task_Struct testTask; + +void TestTaskExec(UArg arg0, UArg arg1) +{ + (void)arg0; + (void)arg1; + + // loop forever + while (1) + { + // Allow other tasks a chance to run + Task_sleep(100); + } +} + +///////////////////////////////////////////////// + int main(void) { Task_Params taskParams; @@ -61,18 +80,23 @@ int main(void) ADC_init(); ConfigUART(); + // //////////////////////////////////////////////////////////////////// + // *** FOR DEBUG RUNS, PLEASE KEEP THIS CODE *** + // // setup Test task + // Task_Params_init(&taskParams); + // taskParams.stackSize = THREADSTACKSIZE; + // taskParams.priority = 4; + // // create task + // Task_construct(&testTask, TestTaskExec, &taskParams, Error_IGNORE); + // //////////////////////////////////////////////////////////////////// + // setup Task thread Task_Params_init(&taskParams); taskParams.stackSize = THREADSTACKSIZE; taskParams.priority = 4; // create Receiver - receiverHandle = Task_create((Task_FuncPtr)ReceiverThread, &taskParams, Error_IGNORE); - if (receiverHandle == NULL) - { - while (1) - ; - } + Task_construct(&receiverTask, ReceiverThread, &taskParams, Error_IGNORE); // CLR settings to launch CLR thread (void)memset(&clrSettings, 0, sizeof(CLR_SETTINGS)); @@ -83,27 +107,12 @@ int main(void) // setup CLR task taskParams.arg0 = (UArg)&clrSettings; - taskParams.stackSize = THREADSTACKSIZE; + taskParams.stackSize = 2 * THREADSTACKSIZE; taskParams.priority = 4; - clrHandle = Task_create(CLRStartupThread, &taskParams, Error_IGNORE); - if (clrHandle == NULL) - { - while (1) - ; - } + + Task_construct(&clrTask, CLRStartupThread, &taskParams, Error_IGNORE); BIOS_start(); return (0); } - -/////////////////////////////////////////////////////////////////////// -// need this dummy implementation here (started with SDK 4.20.01.04) // -/////////////////////////////////////////////////////////////////////// -void __attribute__((naked)) _exit(int code) -{ - (void)code; - - for (;;) - ; -} diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_BlockStorage.c b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_BlockStorage.c index dd6b9b2742..c93f5fc0c1 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_BlockStorage.c +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_BlockStorage.c @@ -5,11 +5,15 @@ #include -extern struct BlockStorageDevice Device_BlockStorage; -extern struct MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig; -extern IBlockStorageDevice CC13x2_26x2Flash_BlockStorageInterface; +extern struct BlockStorageDevice Device_BlockStorage; +extern struct MEMORY_MAPPED_NOR_BLOCK_CONFIG Device_BlockStorageConfig; +extern IBlockStorageDevice CC13xx_26xxFlash_BlockStorageInterface; void BlockStorage_AddDevices() { - BlockStorageList_AddDevice( (BlockStorageDevice*)&Device_BlockStorage, &CC13x2_26x2Flash_BlockStorageInterface, &Device_BlockStorageConfig, true); + BlockStorageList_AddDevice( + (BlockStorageDevice *)&Device_BlockStorage, + &CC13xx_26xxFlash_BlockStorageInterface, + &Device_BlockStorageConfig, + true); } diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_common.h.in b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_common.h.in index 8ff93485dc..fa96b117b9 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_common.h.in +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/target_common.h.in @@ -11,7 +11,7 @@ #ifndef TARGET_COMMON_H #define TARGET_COMMON_H -#define TARGETINFOSTRING "@CMAKE_BUILD_TYPE@ build with TI CC13x2_26x2 SDK v@TI_SL_CC13x2_26x2_SDK_TAG@" +#define TARGETINFOSTRING "@CMAKE_BUILD_TYPE@ build with TI CC13xx_26xx SDK v@TI_SL_CC13xx_26xx_SDK_TAG@" ///////////////////////////////////////////////////////////////////////////////////////// // The following addresses and sizes should be filled in according to the SoC data-sheet @@ -48,7 +48,7 @@ ///////////////////////////////////// #if defined(DEBUG) - #define MANAGED_HEAP_SIZE (23*1024) + #define MANAGED_HEAP_SIZE (31*1024) #else #define MANAGED_HEAP_SIZE (36*1024) #endif diff --git a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/ti-rtos-debug.cfg b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/ti-rtos-debug.cfg index ff660814d3..345770c05d 100644 --- a/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/ti-rtos-debug.cfg +++ b/targets/TI_SimpleLink/TI_CC1352R1_LAUNCHXL/ti-rtos-debug.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Texas Instruments Incorporated + * Copyright (c) 2015-2021, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,12 +94,9 @@ var Error = xdc.useModule('xdc.runtime.Error'); * Simple alternative that traps on a while(1) loop for minimized target * footprint. * Using Error.policySpin, the Error.raiseHook will NOT called. - * - Error.policyMin - * Lightweight policy function that does minimum processing and returns. */ -Error.policyFxn = Error.policyDefault; -//Error.policyFxn = Error.policySpin; -//Error.policyFxn = Error.policyMin; +//Error.policyFxn = Error.policyDefault; +Error.policyFxn = Error.policySpin; /* * If Error.policyFxn is set to Error.policyDefault, this function is called @@ -115,9 +112,9 @@ Error.policyFxn = Error.policyDefault; * Errors invoke custom user function. See the Error module documentation * for more details. */ -Error.raiseHook = Error.print; +//Error.raiseHook = Error.print; //Error.raiseHook = null; -//Error.raiseHook = "&myErrorFxn"; +Error.raiseHook = "&HARD_Breakpoint_"; /* * If Error.policyFxn is set to Error.policyDefault, this option applies to the @@ -144,8 +141,8 @@ var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); * Disabling the runtime check improves runtime performance and yields a * reduced flash footprint. */ -halHwi.checkStackFlag = true; -//halHwi.checkStackFlag = false; +//halHwi.checkStackFlag = true; +halHwi.checkStackFlag = false; /* * The following options alter the system's behavior when a hardware exception @@ -181,10 +178,47 @@ m3Hwi.enableException = true; * - 1 * Enables hardware exceptions when dividing by zero */ -m3Hwi.nvicCCR.DIV_0_TRP = 0; -//m3Hwi.nvicCCR.DIV_0_TRP = 1; +//m3Hwi.nvicCCR.DIV_0_TRP = 0; +m3Hwi.nvicCCR.DIV_0_TRP = 1; +/* + * Enable hardware exception generation for invalid data alignment. + * + * Pick one: + * - 0 (default) + * Disables hardware exceptions for data alignment + * - 1 + * Enables hardware exceptions for data alignment + */ +m3Hwi.nvicCCR.UNALIGN_TRP = 0; +//m3Hwi.nvicCCR.UNALIGN_TRP = 1; + +/* + * Assign an address for the reset vector. + * + * Default is 0x0, which is the start of Flash. Ordinarily this setting should + * not be changed. + */ +m3Hwi.resetVectorAddress = 0x0; + +/* + * Assign an address for the vector table in RAM. + * + * The default is the start of RAM. This table is placed in RAM so interrupts + * can be added at runtime. + * + * Note: To change, verify address in the device specific datasheets' + * memory map. + */ +m3Hwi.vectorTableAddress = 0x20000000; +/* + * For CC32XX, place the vectors in the user-managed linker .cmd file + * instead of generating these in the RTSC-generated .xdl file. + */ +if (Program.cpu.deviceName.match(/CC32XX/)) { + m3Hwi.placeVectorTables = false; +} /* ================ Idle configuration ================ */ var Idle = xdc.useModule('ti.sysbios.knl.Idle'); @@ -217,8 +251,13 @@ var BIOS = xdc.useModule('ti.sysbios.BIOS'); * When using BIOS in ROM: * This option must be set to false. */ -BIOS.assertsEnabled = true; -//BIOS.assertsEnabled = false; +//BIOS.assertsEnabled = true; +BIOS.assertsEnabled = false; + +/* + * Specify default CPU Frequency. + */ +BIOS.cpuFreq.lo = 48000000; /* * A flag to determine if xdc.runtime sources are to be included in a custom @@ -284,8 +323,8 @@ BIOS.runtimeCreatesEnabled = true; * When using BIOS in ROM: * This option must be set to false. */ -BIOS.logsEnabled = true; -//BIOS.logsEnabled = false; +//BIOS.logsEnabled = true; +BIOS.logsEnabled = false; @@ -299,8 +338,6 @@ var Memory = xdc.useModule('xdc.runtime.Memory'); /* * Use HeapMem primary heap instance to use linker-defined memory region - * Add HeapTrack on top to find over-writes, invalid frees, and - * aid in finding the correct sizing of the heap and memory leaks. */ var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem'); HeapMem.primaryHeapBaseAddr = "&__primary_heap_start__"; @@ -308,12 +345,7 @@ HeapMem.primaryHeapEndAddr = "&__primary_heap_end__"; var heapMemParams = new HeapMem.Params(); heapMemParams.usePrimaryHeap = true; - -var HeapTrack = xdc.useModule('ti.sysbios.heaps.HeapTrack'); -var heapTrackParams = new HeapTrack.Params; -heapTrackParams.heap = HeapMem.create(heapMemParams); -Program.global.heap0 = HeapTrack.create(heapTrackParams); -//Program.global.heap0 = HeapMem.create(heapMemParams); +Program.global.heap0 = HeapMem.create(heapMemParams); Memory.defaultHeapInstance = Program.global.heap0; @@ -337,12 +369,36 @@ Program.stack = 0; if (Program.build.target.$name.match(/gnu/)) { //var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport'); } + + + /* ================ ROM configuration ================ */ /* * To use BIOS in flash, comment out the code block below. */ -//var ROM = xdc.useModule('ti.sysbios.rom.ROM'); -//ROM.romName = ROM.CC13X2V2; +/* + * CC13X1 and CC26X1 devices do not contain ROM; therefore, we do not include + * the ROM module unless needed. + */ +if (!Program.cpu.deviceName.match(/CC13.1|CC26.1/)) { + var ROM = xdc.useModule('ti.sysbios.rom.ROM'); + + if (Program.cpu.deviceName.match(/CC2640R2F/)) { + ROM.romName = ROM.CC2640R2F; + } + else if (Program.cpu.deviceName.match(/CC26.[12]/)) { + ROM.romName = ROM.CC26X2V2; + } + else if (Program.cpu.deviceName.match(/CC13.2/)) { + ROM.romName = ROM.CC13X2V2; + } + else if (Program.cpu.deviceName.match(/CC26/)) { + ROM.romName = ROM.CC2650; + } + else if (Program.cpu.deviceName.match(/CC13/)) { + ROM.romName = ROM.CC1350; + } +} @@ -391,6 +447,7 @@ var Swi = xdc.useModule('ti.sysbios.knl.Swi'); * * This module is included to allow Swi's in a users' application. */ + /* * Reduce the number of swi priorities from the default of 16. * Decreasing the number of swi priorities yields memory savings. @@ -414,8 +471,8 @@ var System = xdc.useModule('xdc.runtime.System'); * A user-defined function. See the System module documentation for * details. */ -System.abortFxn = System.abortStd; -//System.abortFxn = System.abortSpin; +//System.abortFxn = System.abortStd; +System.abortFxn = System.abortSpin; //System.abortFxn = "&myAbortSystem"; /* @@ -431,8 +488,8 @@ System.abortFxn = System.abortStd; * A user-defined function. See the System module documentation for * details. */ -System.exitFxn = System.exitStd; -//System.exitFxn = System.exitSpin; +//System.exitFxn = System.exitStd; +System.exitFxn = System.exitSpin; //System.exitFxn = "&myExitSystem"; /* @@ -442,14 +499,6 @@ System.exitFxn = System.exitStd; */ System.maxAtexitHandlers = 2; -/* - * Enable System_printf() to display floats. Use the longer '%f%$L%$S%$F' - * if your code has SYS/BIOS instrumentation enabled (Asserts/Error/Log), - * as is typical with the 'debug' profile. - */ -System.extendedFormats = '%f%$L%$S%$F'; -//System.extendedFormats = '%f%$S'; - /* * The System.SupportProxy defines a low-level implementation of System * functions such as System_printf(), System_flush(), etc. @@ -467,7 +516,7 @@ System.extendedFormats = '%f%$L%$S%$F'; * SysCallback module's documentation. */ var SysMin = xdc.useModule('xdc.runtime.SysMin'); -SysMin.bufSize = 1024; +SysMin.bufSize = 512; System.SupportProxy = SysMin; //var SysCallback = xdc.useModule('xdc.runtime.SysCallback'); //System.SupportProxy = SysCallback; @@ -494,8 +543,8 @@ var Task = xdc.useModule('ti.sysbios.knl.Task'); * When using BIOS in ROM: * This option must be set to false. */ -Task.checkStackFlag = true; -//Task.checkStackFlag = false; +//Task.checkStackFlag = true; +Task.checkStackFlag = false; /* * Set the default task stack size when creating tasks. @@ -536,7 +585,7 @@ Task.idleTaskStackSize = 512; * The default is 16. * Decreasing the number of task priorities yield memory savings. */ -Task.numPriorities = 6; +Task.numPriorities = 4; @@ -553,8 +602,8 @@ var Text = xdc.useModule('xdc.runtime.Text'); * - false * This option reduces the .const footprint. */ -Text.isLoaded = true; -//Text.isLoaded = false; +//Text.isLoaded = true; +Text.isLoaded = false; @@ -567,54 +616,12 @@ var Types = xdc.useModule('xdc.runtime.Types'); -/* ================ Application Specific Instances ================ */ - -/* ================ Diagnostics configuration ================ */ -var Diags = xdc.useModule('xdc.runtime.Diags'); -/* - * You use the Diags module to set and clear bits in a module's diagnostics - * mask for the purpose of controlling diagnostics within that module. A - * module diagnostics mask controls both Assert and Log statements - * within that module, disabling these statements yields - * code savings. - */ - -/* ================ Logging configuration ================ */ -var Log = xdc.useModule('xdc.runtime.Log'); -/* - * Modules and the application code generate Log_Event events by calling - * the Log module's functions. - * Disabling all Log statements here will allow the optimizer to completely - * remove all Log code from the application. - * - * Note: In order to generate Log events in your application both the Diags - * and the Log mask must be set. See the SYS/BIOS API guide for - * more information. - */ - -/* - * LoggingSetup configures TI-RTOS modules to capture user-specified information - * such as CPU Load, Task Load and Task Execution so that it can be - * displayed by System Analyzer. - */ -var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); -LoggingSetup.loadLoggerSize = 256; -LoggingSetup.mainLoggerSize = 512; -LoggingSetup.sysbiosLoggerSize = 1024; - -/* ================ Main configuration ================ */ -var Main = xdc.useModule('xdc.runtime.Main'); -/* Configuration of this Main module is used for all code not in a module */ - - -/* ================ Event configuration ================ */ -var Event = xdc.useModule('ti.sysbios.knl.Event'); - +/* ================ required for HAL_Time_ConvertFromSystemTime ================ */ +var ti_sysbios_hal_Seconds = xdc.useModule('ti.sysbios.hal.Seconds'); -/* ================ Mailbox configuration ================ */ -var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox'); -/* ================ required for HAL_Time_ConvertFromSystemTime ================ */ -var ti_sysbios_hal_Seconds = xdc.useModule('ti.sysbios.hal.Seconds'); +/* ================ Application Specific Instances ================ */ +/* ================ MPU configuration ================ */ +var MPU = xdc.useModule('ti.sysbios.family.arm.MPU'); diff --git a/targets/TI_SimpleLink/TI_CC3220SF_LAUNCHXL/launch.json b/targets/TI_SimpleLink/TI_CC3220SF_LAUNCHXL/launch.json index 4f8326fa07..dddd144dec 100644 --- a/targets/TI_SimpleLink/TI_CC3220SF_LAUNCHXL/launch.json +++ b/targets/TI_SimpleLink/TI_CC3220SF_LAUNCHXL/launch.json @@ -7,7 +7,6 @@ "request": "launch", "MIMode": "gdb", "miDebuggerPath": "/bin/arm-none-eabi-gdb.exe", - "targetArchitecture": "ARM", "program": "${workspaceRoot}/build/nanoCLR.elf", "setupCommands": [ { diff --git a/targets/TI_SimpleLink/_common/CC13x2_26x2Flash_BlockStorageInterface.c b/targets/TI_SimpleLink/_common/CC13x2_26x2Flash_BlockStorageInterface.c deleted file mode 100644 index e8c9c1fdfe..0000000000 --- a/targets/TI_SimpleLink/_common/CC13x2_26x2Flash_BlockStorageInterface.c +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#include -#include - -// map here the Block Storage Interface to the CC13x2_26x2 driver -IBlockStorageDevice CC13x2_26x2Flash_BlockStorageInterface = -{ - &CC13x2_26x2FlashDriver_InitializeDevice, - &CC13x2_26x2FlashDriver_UninitializeDevice, - &CC13x2_26x2FlashDriver_GetDeviceInfo, - &CC13x2_26x2FlashDriver_Read, - &CC13x2_26x2FlashDriver_Write, - NULL, - &CC13x2_26x2FlashDriver_IsBlockErased, - &CC13x2_26x2FlashDriver_EraseBlock, - NULL, - NULL -}; diff --git a/targets/TI_SimpleLink/_common/CC13xx_26xxFlash_BlockStorageInterface.c b/targets/TI_SimpleLink/_common/CC13xx_26xxFlash_BlockStorageInterface.c new file mode 100644 index 0000000000..b0d3af697c --- /dev/null +++ b/targets/TI_SimpleLink/_common/CC13xx_26xxFlash_BlockStorageInterface.c @@ -0,0 +1,20 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +#include +#include + +// map here the Block Storage Interface to the CC13xx_26xx driver +IBlockStorageDevice CC13xx_26xxFlash_BlockStorageInterface = { + &CC13xx_26xxFlashDriver_InitializeDevice, + &CC13xx_26xxFlashDriver_UninitializeDevice, + &CC13xx_26xxFlashDriver_GetDeviceInfo, + &CC13xx_26xxFlashDriver_Read, + &CC13xx_26xxFlashDriver_Write, + NULL, + &CC13xx_26xxFlashDriver_IsBlockErased, + &CC13xx_26xxFlashDriver_EraseBlock, + NULL, + NULL}; diff --git a/targets/TI_SimpleLink/_common/CMakeLists.txt b/targets/TI_SimpleLink/_common/CMakeLists.txt index 8cf0d0ccd4..aaa83b4a09 100644 --- a/targets/TI_SimpleLink/_common/CMakeLists.txt +++ b/targets/TI_SimpleLink/_common/CMakeLists.txt @@ -32,12 +32,12 @@ if("${TARGET_SERIES}" STREQUAL "CC32xx") list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/sockets_simplelink.cpp") list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ssl_simplelink.cpp") -elseif("${TARGET_SERIES}" STREQUAL "CC13x2_26x2") +elseif("${TARGET_SERIES}" STREQUAL "CC13X2") - list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/CC13x2_26x2Flash_BlockStorageInterface.c") + list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/CC13xx_26xxFlash_BlockStorageInterface.c") - list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Target_BlockStorage_CC13x2_26x2FlashDriver.c") - # list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/targetHAL_ConfigurationManager_CC13x2_26x2.cpp") + list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Target_BlockStorage_CC13xx_26xxFlashDriver.c") + # list(APPEND TARGET_TI_SimpleLink_COMMON_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/targetHAL_ConfigurationManager_CC13xx_26xx.cpp") endif() # make var global diff --git a/targets/TI_SimpleLink/_common/Target_BlockStorage_CC13x2_26x2FlashDriver.c b/targets/TI_SimpleLink/_common/Target_BlockStorage_CC13xx_26xxFlashDriver.c similarity index 53% rename from targets/TI_SimpleLink/_common/Target_BlockStorage_CC13x2_26x2FlashDriver.c rename to targets/TI_SimpleLink/_common/Target_BlockStorage_CC13xx_26xxFlashDriver.c index 5b6495734a..94a84595ef 100644 --- a/targets/TI_SimpleLink/_common/Target_BlockStorage_CC13x2_26x2FlashDriver.c +++ b/targets/TI_SimpleLink/_common/Target_BlockStorage_CC13xx_26xxFlashDriver.c @@ -3,7 +3,7 @@ // See LICENSE file in the project root for full license information. // -#include +#include // includes from SimpleLink #include @@ -12,38 +12,38 @@ #include // local defines -#define FLASH_ERASED_WORD 0x0FFFFFFFFU +#define FLASH_ERASED_WORD 0x0FFFFFFFFU // need these prototypes here static uint8_t DisableCache(); -static void EnableCache( uint8_t state ); +static void EnableCache(uint8_t state); -bool CC13x2_26x2FlashDriver_InitializeDevice(void* context) +bool CC13xx_26xxFlashDriver_InitializeDevice(void *context) { - (void)context; + (void)context; // SimpleLink driver takes care of this, so always true - return true; + return true; } -bool CC13x2_26x2FlashDriver_UninitializeDevice(void* context) +bool CC13xx_26xxFlashDriver_UninitializeDevice(void *context) { - (void)context; + (void)context; // SimpleLink driver takes care of this, so always true - return true; + return true; } -DeviceBlockInfo* CC13x2_26x2FlashDriver_GetDeviceInfo(void* context) +DeviceBlockInfo *CC13xx_26xxFlashDriver_GetDeviceInfo(void *context) { - MEMORY_MAPPED_NOR_BLOCK_CONFIG* config = context; - - return config->BlockConfig.BlockDeviceInformation; + MEMORY_MAPPED_NOR_BLOCK_CONFIG *config = context; + + return config->BlockConfig.BlockDeviceInformation; } -bool CC13x2_26x2FlashDriver_Read(void* context, ByteAddress startAddress, unsigned int numBytes, unsigned char* buffer) +bool CC13xx_26xxFlashDriver_Read(void *context, ByteAddress startAddress, unsigned int numBytes, unsigned char *buffer) { - (void)context; + (void)context; // direct read from memory... memcpy(buffer, (void *)startAddress, (size_t)numBytes); @@ -52,10 +52,15 @@ bool CC13x2_26x2FlashDriver_Read(void* context, ByteAddress startAddress, unsign return true; } -bool CC13x2_26x2FlashDriver_Write(void* context, ByteAddress startAddress, unsigned int numBytes, unsigned char* buffer, bool readModifyWrite) +bool CC13xx_26xxFlashDriver_Write( + void *context, + ByteAddress startAddress, + unsigned int numBytes, + unsigned char *buffer, + bool readModifyWrite) { - (void)context; - (void)readModifyWrite; + (void)context; + (void)readModifyWrite; // uint_least16_t swiState; // uint_least16_t hwiState; @@ -68,45 +73,45 @@ bool CC13x2_26x2FlashDriver_Write(void* context, ByteAddress startAddress, unsig state = DisableCache(); - if(FlashProgram((unsigned long*)buffer, (unsigned long) startAddress, (unsigned long) numBytes) == 0) - { - result = true; - } + if (FlashProgram((unsigned long *)buffer, (unsigned long)startAddress, (unsigned long)numBytes) == 0) + { + result = true; + } EnableCache(state); - + // // exit critical section // Hwi_restore(hwiState); // Swi_restore(swiState); - - return result; + + return result; } -bool CC13x2_26x2FlashDriver_IsBlockErased(void* context, ByteAddress blockAddress, unsigned int length) +bool CC13xx_26xxFlashDriver_IsBlockErased(void *context, ByteAddress blockAddress, unsigned int length) { - (void)context; + (void)context; - unsigned long* cursor = (unsigned long *)blockAddress; - unsigned long* endAddress = (unsigned long *)(blockAddress + length); + unsigned long *cursor = (unsigned long *)blockAddress; + unsigned long *endAddress = (unsigned long *)(blockAddress + length); // an erased flash address has to read FLASH_ERASED_WORD // OK to check by word (32 bits) because the erase is performed by 'block' whose size is word multiple - while(cursor < endAddress) + while (cursor < endAddress) { - if(*cursor++ != FLASH_ERASED_WORD) + if (*cursor++ != FLASH_ERASED_WORD) { // found an address with something other than FLASH_ERASED_WORD!! return false; } } - + // reached here so the block must be erased return true; } -bool CC13x2_26x2FlashDriver_EraseBlock(void* context, ByteAddress address) +bool CC13xx_26xxFlashDriver_EraseBlock(void *context, ByteAddress address) { - (void)context; + (void)context; // uint_least16_t swiState; // uint_least16_t hwiState; @@ -118,11 +123,11 @@ bool CC13x2_26x2FlashDriver_EraseBlock(void* context, ByteAddress address) // hwiState = Hwi_disable(); state = DisableCache(); - - if(FlashSectorErase((unsigned long) address) == 0) - { - result = true; - } + + if (FlashSectorErase((unsigned long)address) == 0) + { + result = true; + } EnableCache(state); @@ -130,34 +135,34 @@ bool CC13x2_26x2FlashDriver_EraseBlock(void* context, ByteAddress address) // Hwi_restore(hwiState); // Swi_restore(swiState); - return result; + return result; } // Disable Flash data caching -static void EnableCache( uint8_t state ) +static void EnableCache(uint8_t state) { - if ( state != VIMS_MODE_DISABLED ) + if (state != VIMS_MODE_DISABLED) { // Enable the Cache. - VIMSModeSet( VIMS_BASE, VIMS_MODE_ENABLED ); + VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED); } } // Restore the Flash data caching and instruction pre-fetching. static uint8_t DisableCache() { - uint8_t state = VIMSModeGet( VIMS_BASE ); - + uint8_t state = VIMSModeGet(VIMS_BASE); + // Check VIMS state - if( state != VIMS_MODE_DISABLED ) + if (state != VIMS_MODE_DISABLED) { // Invalidate cache - VIMSModeSet( VIMS_BASE, VIMS_MODE_DISABLED ); - + VIMSModeSet(VIMS_BASE, VIMS_MODE_DISABLED); + // Wait for disabling to be complete - while( VIMSModeGet( VIMS_BASE ) != VIMS_MODE_DISABLED ); - + while (VIMSModeGet(VIMS_BASE) != VIMS_MODE_DISABLED) + ; } - + return state; } diff --git a/targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13x2_26x2.cpp b/targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13xx_26xx.cpp similarity index 97% rename from targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13x2_26x2.cpp rename to targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13xx_26xx.cpp index 01f7149327..410bf3c694 100644 --- a/targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13x2_26x2.cpp +++ b/targets/TI_SimpleLink/_common/targetHAL_ConfigurationManager_CC13xx_26xx.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include typedef struct @@ -16,12 +16,12 @@ typedef struct char fileName[SL_FS_MAX_FILE_NAME_LENGTH]; } slGetfileList_t; -// This configuration manager implementation is valid for CC13x2_26x2 devices. +// This configuration manager implementation is valid for CC13xx_26xx devices. // Because everything that is meant to be stored in the configure block is handled by the SimpleLink // persistent storage, this code is either empty or acts as a proxy to the SimpleLink API // network configuration blocks are stored as files in file storage -void *ConfigurationManagerCC13x2_26x2_FindNetworkConfigurationBlocks() +void *ConfigurationManagerCC13xx_26xx_FindNetworkConfigurationBlocks() { int32_t ret = 1; int32_t retGetFileList = 1; @@ -81,7 +81,7 @@ void *ConfigurationManagerCC13x2_26x2_FindNetworkConfigurationBlocks() } // wireless profiles are stored as SimpleLink WLAN profile -void *ConfigurationManagerCC13x2_26x2_FindNetworkWireless80211ConfigurationBlocks() +void *ConfigurationManagerCC13xx_26xx_FindNetworkWireless80211ConfigurationBlocks() { int16_t index, status; signed char name[32]; @@ -128,7 +128,7 @@ void ConfigurationManager_EnumerateConfigurationBlocks() { // find network configuration blocks HAL_CONFIGURATION_NETWORK *networkConfigs = - (HAL_CONFIGURATION_NETWORK *)ConfigurationManagerCC13x2_26x2_FindNetworkConfigurationBlocks(); + (HAL_CONFIGURATION_NETWORK *)ConfigurationManagerCC13xx_26xx_FindNetworkConfigurationBlocks(); // check network configs count if (networkConfigs->Count == 0) @@ -149,7 +149,7 @@ void ConfigurationManager_EnumerateConfigurationBlocks() // have to enumerate again to pick it up networkConfigs = - (HAL_CONFIGURATION_NETWORK *)ConfigurationManagerCC13x2_26x2_FindNetworkConfigurationBlocks(); + (HAL_CONFIGURATION_NETWORK *)ConfigurationManagerCC13xx_26xx_FindNetworkConfigurationBlocks(); } platform_free(networkConfig); @@ -157,7 +157,7 @@ void ConfigurationManager_EnumerateConfigurationBlocks() // find wireless 80211 network configuration blocks HAL_CONFIGURATION_NETWORK_WIRELESS80211 *networkWirelessConfigs = (HAL_CONFIGURATION_NETWORK_WIRELESS80211 *) - ConfigurationManagerCC13x2_26x2_FindNetworkWireless80211ConfigurationBlocks(); + ConfigurationManagerCC13xx_26xx_FindNetworkWireless80211ConfigurationBlocks(); // // find X509 certificate blocks // HAL_CONFIGURATION_X509_CERTIFICATE* certificateStore = @@ -532,7 +532,7 @@ bool ConfigurationManager_UpdateConfigurationBlock( DeviceConfigurationOption configuration, uint32_t configurationIndex) { - // CC13x2_26x2 stores the config blocks on the file system so we don't care about sizes + // CC13xx_26xx stores the config blocks on the file system so we don't care about sizes switch (configuration) { diff --git a/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13x2_26x2FlashDriver.h b/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13x2_26x2FlashDriver.h deleted file mode 100644 index 6f9780d4a0..0000000000 --- a/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13x2_26x2FlashDriver.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -#ifndef TARGET_CC13x2_26x2FLASH_DRIVER_H -#define TARGET_CC13x2_26x2FLASH_DRIVER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -bool CC13x2_26x2FlashDriver_InitializeDevice(void*); -bool CC13x2_26x2FlashDriver_UninitializeDevice(void*); -DeviceBlockInfo* CC13x2_26x2FlashDriver_GetDeviceInfo(void*); -bool CC13x2_26x2FlashDriver_Read(void*, ByteAddress startAddress, unsigned int numBytes, unsigned char* buffer); -bool CC13x2_26x2FlashDriver_Write(void*, ByteAddress startAddress, unsigned int numBytes, unsigned char* buffer, bool readModifyWrite); -bool CC13x2_26x2FlashDriver_IsBlockErased(void*, ByteAddress blockAddress, unsigned int length); -bool CC13x2_26x2FlashDriver_EraseBlock(void*, ByteAddress address); -void CC13x2_26x2FlashDriver_SetPowerState(void*, unsigned int state); - -#ifdef __cplusplus -} -#endif - -#endif // TARGET_CC13x2_26x2FLASH_DRIVER_H diff --git a/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13xx_26xxFlashDriver.h b/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13xx_26xxFlashDriver.h new file mode 100644 index 0000000000..b214af98b4 --- /dev/null +++ b/targets/TI_SimpleLink/_include/Target_BlockStorage_CC13xx_26xxFlashDriver.h @@ -0,0 +1,34 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +#ifndef TARGET_CC13xx_26xxFLASH_DRIVER_H +#define TARGET_CC13xx_26xxFLASH_DRIVER_H + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + bool CC13xx_26xxFlashDriver_InitializeDevice(void *); + bool CC13xx_26xxFlashDriver_UninitializeDevice(void *); + DeviceBlockInfo *CC13xx_26xxFlashDriver_GetDeviceInfo(void *); + bool CC13xx_26xxFlashDriver_Read(void *, ByteAddress startAddress, unsigned int numBytes, unsigned char *buffer); + bool CC13xx_26xxFlashDriver_Write( + void *, + ByteAddress startAddress, + unsigned int numBytes, + unsigned char *buffer, + bool readModifyWrite); + bool CC13xx_26xxFlashDriver_IsBlockErased(void *, ByteAddress blockAddress, unsigned int length); + bool CC13xx_26xxFlashDriver_EraseBlock(void *, ByteAddress address); + void CC13xx_26xxFlashDriver_SetPowerState(void *, unsigned int state); + +#ifdef __cplusplus +} +#endif + +#endif // TARGET_CC13xx_26xxFLASH_DRIVER_H diff --git a/targets/TI_SimpleLink/_nanoCLR/Windows.Devices.Gpio/cpu_gpio.cpp b/targets/TI_SimpleLink/_nanoCLR/Windows.Devices.Gpio/cpu_gpio.cpp index f6e068fb32..48909629f6 100644 --- a/targets/TI_SimpleLink/_nanoCLR/Windows.Devices.Gpio/cpu_gpio.cpp +++ b/targets/TI_SimpleLink/_nanoCLR/Windows.Devices.Gpio/cpu_gpio.cpp @@ -11,36 +11,16 @@ #include #include #include - -#define GPIO_MAX_PINS 16 +#include // SimpleLink doesn't follow the port&pin design pattern, there are no ports, just GPIO pins #define TOTAL_GPIO_PORTS 1 -#define EMPTY_PIN 0xFFFF - // Array of Pin configurations -GPIO_PinConfig gpioPinConfigs[] = { - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, - GPIO_DO_NOT_CONFIG | EMPTY_PIN, -}; +extern "C" GPIO_PinConfig gpioPinConfigs[]; // Array of callback function pointers -GPIO_CallbackFxn gpioCallbackFunctions[GPIO_MAX_PINS]; +extern "C" GPIO_CallbackFxn gpioCallbackFunctions[]; // Gpio input state structure struct gpio_input_state : public HAL_DblLinkedNode @@ -121,9 +101,9 @@ gpio_input_state *GetInputStateByConfigIndex(uint8_t pinConfigIndex) // find a free slot in the pin config array int8_t FindFreePinConfig() { - for (uint8_t index = 0; index < GPIO_MAX_PINS; index++) + for (uint8_t index = 0; index < GPIO_pinUpperBound + 1; index++) { - if ((uint16_t)gpioPinConfigs[index] == EMPTY_PIN) + if ((uint16_t)gpioPinConfigs[index] == GPIO_CFG_NO_DIR) { // found a free slot! return index; @@ -136,7 +116,7 @@ int8_t FindFreePinConfig() // find a pin number in the pin config array int8_t FindPinConfig(GPIO_PIN pinNumber) { - for (uint8_t index = 0; index < GPIO_MAX_PINS; index++) + for (uint8_t index = 0; index < GPIO_pinUpperBound + 1; index++) { // need to mask the gpioPinConfigs item to get only the 8 LSbits where the pin number is stored if ((uint8_t)gpioPinConfigs[index] == pinNumber) @@ -279,13 +259,13 @@ bool CPU_GPIO_Initialize() gpioInputList.Initialize(); // clear GPIO pin configs - for (uint8_t index = 0; index < GPIO_MAX_PINS; index++) + for (uint8_t index = 0; index < GPIO_pinUpperBound + 1; index++) { - gpioPinConfigs[index] == GPIO_DO_NOT_CONFIG | EMPTY_PIN; + gpioPinConfigs[index] == GPIO_CFG_NO_DIR; } // clear callbacks - memset(gpioCallbackFunctions, 0, sizeof(gpioCallbackFunctions)); + memset(gpioCallbackFunctions, 0, (GPIO_pinUpperBound + 1) * sizeof(GPIO_CallbackFxn)); return true; } @@ -335,7 +315,7 @@ bool CPU_GPIO_ReservePin(GPIO_PIN pinNumber, bool fReserve) } else { - gpioPinConfigs[index] == GPIO_DO_NOT_CONFIG | EMPTY_PIN; + gpioPinConfigs[index] == GPIO_CFG_NO_DIR; } GLOBAL_UNLOCK(); @@ -352,7 +332,7 @@ bool CPU_GPIO_PinIsBusy(GPIO_PIN pinNumber) // Return maximum number of pins int32_t CPU_GPIO_GetPinCount() { - return GPIO_MAX_PINS; + return GPIO_pinUpperBound + 1; } // Get current state of pin diff --git a/version.json b/version.json index 06dab7f76e..7fd2d16313 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.7.2", + "version": "1.7.3", "assemblyVersion": { "precision": "revision" },