Skip to content

Commit

Permalink
Add ORGPAL3 target (#1654)
Browse files Browse the repository at this point in the history
* Add new boards

- 429 building and running booter and CLR
- MAC disabled

* Fix I2C config

* Fix alternate for RMII pin

* Fix SPI assignments

- SPI1 and SPI2 are the correct ones.

* Add support for STDBY processing and exit on CLR

* Correct pin to remain on booter

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Implement workaround on silicon bug when wakeup from STDBY

- Also decrease timeouts on USB connect disconnect sequence.

* Fix block storage config

- Was missing the config block.
- Add config block to block storage arrays.
- Adjust linker file accordingly.
- Rename linker files and update reference in target CMake.
- Update CLR address in booter check.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Temporary fix to overcome PHY reset signal

* Update ChibiOS build options

- Following #1177.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Upda Block storage to new structure

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix SD Card detect

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix FAT FS definitions and configs

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Final tweaks on USB MSD config

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update storage implementation for target board

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update FatFS config

* Clean up main for file system inits

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add storage working threads and config

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add define for activity heart beat

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update ChibiOS config files for F469

* Update F469 board to ChibiOS 19.1

* Update UART configs

* Update F769 board to ChibiOS 19.1

- Added necessary config files

* Fix clock config

* Linker file adjustments

* Update lwIPand other network configs

* Fix GPIO def

* adjust sntp config

* Add missing define for platform RNG

* Fix board voltage

* Turn OFF SD Card on both boards

* Turn on bkp RAM on both boards

* Fix booter code for F769

- Was checking the wrong GPIO to remain on booter.
- Decrease USB timeout.
- Add missing call to BlockStorage init.
- Replace pal set/clear with toggle for blinking the LED.

* Work on CLR main for F769

- Add threads for SD card and USB MSD.
- Decrease USB sleep time on reboot.

* Update config for ext memory and disable for F7

* Fix GPIO config for UART pins

* Fix ethernet F4

* Disable COM7 in F4

* Improve async continuations

* Enable COM ports on F7

* Add wake up processing for F7

* Enable UART7 on F4 board

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Initial work adding SPIFFS to STM32

- Add code from Cube package.
- Add SPIFFS HAL.
- Update STM32 Windows.Storage implementation to add support for SPIFFS.
- Rework STM32 Windows.Storage implementation to work without FatFS.
- Update CMakes as required.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Initial work adding SPIFFS to STM32

- Add code from Cube package.
- Add SPIFFS HAL.
- Update STM32 Windows.Storage implementation to add support for SPIFFS.
- Rework STM32 Windows.Storage implementation to work without FatFS.
- Update CMakes as required.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update SD Card detect mapping in storage configuration

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix I2C2 DMA assigment

- Close BUG 67.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fixes on GPIO defs for QSPI on F4 and F7 boards

* Add SPIFFS implementation for F4 and F7 boards

* Work on QSPI to use STM HAL calls to init QSPI clocks and pripheral

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work on SPIFFS hal init

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Change spiffs max file name to 256

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Rework STM32 Windows.Storage

- Add support for SPIFFS.
- Separate code to allow compiling for FatFS and SPIFFS as separate options.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Rework StorageFile for spiffs

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Remove magic number from spiffs config

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix HAL SPIFFS after bad merge

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Revert SPIFFS config for object name lenght to 32

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix external memory for F7 board

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix STM Cube package

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Sync mcu config F7 with F4

* Enable UART7 config for F7 board

* Update ADC config for F7 board

* Turn off unnused peripherals

* Add extra cleaning to F7 wakeup sources

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work on F7 and F4 resources

- Enable I2C3 for F7
- Enable ADC3 for F4 and F7

* Remove bad double quotes on include for SPIFFS

- Was failing the CMake config if SPIFFS option was OFF.

* Turn off SPIFFS for F7 board

- Turn off HAL QSPI.
- QSPI STM Cube driver is not working as it is now.

* Adjust CLR region size for MinRelSize build (F4)

* Update CLR region size for RELEASE build (F7)

* Add default GPIOs (both F4 and F7)

Related work items: #72

* Change serial flash to W25Q128

- Update names, size configs, chip IDs and timmings.

* Fix GPIO initial set

- Both boards.
- Requested by Zan.

* Enable SD Card in storage config (both F4 and F7)

* Add target name and platform defines to both F4 and F7

* Update both targets config files

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add target config for DAC

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Enable DAC on PA4 for both boards

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update mbedTLS options on both boards

- Following nf-interpreter develop branch.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update serial baud rate on both boards

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix build with mbedTLS option ON

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add network default config to F4 and F7 boards

- Following #1422.

* Fix GPIO config for SPI flash CS pin

* Fix initial test code for SPIFFS

* Enable SPIFFS storage for F7 board

* Add define for long running operations hook in SPIFFS config

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Rework F7 SPIFFS to work with AT25SF081

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update F7 SPIFFS config to AT25SL641

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Enable SDMMC1 on F7

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix SPI flash PN and IDs

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Fix overalpping DMA with SD card and SPI1

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Remove bad instruction to force cache read

- Causing hard fault.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Replace hack for watchdog reset

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Merged PR 2: Add DMA capable read and write buffers for SPIFFS operation

Add DMA capable read and write buffers for SPIFFS operation

* Replace flash storage from SPI to QSPI chip

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Revert wrong changes in STM32F769 targets

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Revert changes with wrong merge

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Revert merge changes

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Revert from merge

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Remove wrong boards

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work CD-CI

- Add OrgPal board to build targets.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add ORGPAL board to README

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add ORGPAL_PALTHREE board folder

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work CD-CI

- Remove CAN from build options.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Remove 1-Wire from build options and features table

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Merge from upstream/develop

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add dependencies for ORGPAL build

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Enable support for System.Text

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work CD-CI

- Add ForceUpload variable to bintray template to allow publishing images on branches other than develop.
- Set ForceUpload  in ORGPAL target.

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Gererate DFU file for ORGPAL_PALTHREE

* Generate DFU file for OrgPal3 board (#1533)

* Add GetTargetCapabilities for OrgPal3
* Add DFU package to CMakeLists for OrgPal3 board

* Add required header for GetTargetCapabilities

* Remove duplicated line from CMakeLists.txt

* Remove unused dependency from ChibiOS FatFS

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update FatFS config file to R014

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Work CD-CI

- Rename ChibiOS nF HAL overlay defines as they were conflicting with the official community ones.
*** REQUIRES UPDATE ON THE NF OPTIONS ON ALL STM32 TARGETS ***
***NO_CI***

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Update ORGPAL3 HAL options

Signed-off-by: José Simões <jose.simoes@eclo.solutions>

* Add CRC init to boot files

Signed-off-by: josesimoes <jose.simoes@eclo.solutions>

* Update SPI configuration

Signed-off-by: josesimoes <jose.simoes@eclo.solutions>

* Fix SPI index in call to config macro

* Update README from upstream develop

Signed-off-by: josesimoes <jose.simoes@eclo.solutions>

* Fix Azure pipelines entry

Signed-off-by: josesimoes <jose.simoes@eclo.solutions>

* Fix managed helpers for ORGPAL_PALTHREE

Signed-off-by: josesimoes <jose.simoes@eclo.solutions>

Co-authored-by: sjmneves <sergio.neves@eclo.solutions>
Co-authored-by: Antonio Fagundes <antonio.fagundes@eclo.solutions>
Co-authored-by: Robin Jones <networkfusion@users.noreply.github.com>
  • Loading branch information
4 people authored Jun 5, 2020
1 parent 447a3f8 commit 343c3b8
Show file tree
Hide file tree
Showing 60 changed files with 11,782 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The **preview** versions are continuous builds of the reference targets. They in
| ST_STM32F429I_DISCOVERY | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/ST_STM32F429I_DISCOVERY/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/ST_STM32F429I_DISCOVERY/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/ST_STM32F429I_DISCOVERY/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/ST_STM32F429I_DISCOVERY/_latestVersion) |
| ST_NUCLEO64_F091RC | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/ST_NUCLEO64_F091RC/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/ST_NUCLEO64_F091RC/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/ST_NUCLEO64_F091RC/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/ST_NUCLEO64_F091RC/_latestVersion) |
| ST_STM32F769I_DISCOVERY | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/ST_STM32F769I_DISCOVERY/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/ST_STM32F769I_DISCOVERY/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/ST_STM32F769I_DISCOVERY/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/ST_STM32F769I_DISCOVERY/_latestVersion) |
| ORGPAL_PALTHREE | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/ORGPAL_PALTHREE/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/ORGPAL_PALTHREE/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/ORGPAL_PALTHREE/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/ORGPAL_PALTHREE/_latestVersion) |
| MBN_QUAIL | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/MBN_QUAIL/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/MBN_QUAIL/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/MBN_QUAIL/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/MBN_QUAIL/_latestVersion) |
| NETDUINO3_WIFI | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/NETDUINO3_WIFI/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/NETDUINO3_WIFI/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/NETDUINO3_WIFI/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/NETDUINO3_WIFI/_latestVersion) |
| ESP32_WROOM_32 | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images/ESP32_WROOM_32/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images/ESP32_WROOM_32/_latestVersion) | [ ![Download](https://api.bintray.com/packages/nfbot/nanoframework-images-dev/ESP32_WROOM_32/images/download.svg) ](https://bintray.com/nfbot/nanoframework-images-dev/ESP32_WROOM_32/_latestVersion) |
Expand All @@ -46,6 +47,7 @@ The above firmware builds include support for the class libraries and features m
| 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: |
| 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: |
| 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: | | | |
| ESP32_WROOM_32 | :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: | |
Expand All @@ -65,6 +67,7 @@ The above firmware builds include support for the class libraries and features m
* [ChibiOS](targets/CMSIS-OS/ChibiOS)
* Reference target boards
* [Mikrobus QUAIL](targets/CMSIS-OS/ChibiOS/MBN_QUAIL)
* [OrgPal PalThree](targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE)
* [ST NUCLEO64 F091RC](targets/CMSIS-OS/ChibiOS/ST_NUCLEO64_F091RC)
* [ST STM32F429I DISCOVERY](targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY)
* [ST STM32F769I DISCOVERY](targets/CMSIS-OS/ChibiOS/ST_STM32F769I_DISCOVERY)
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ jobs:
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -DNF_FEATURE_RTC=ON -DNF_FEATURE_HAS_SDCARD=ON -DAPI_System.Math=ON -DAPI_Hardware.Stm32=ON -DAPI_Windows.Devices.Gpio=ON -DAPI_Windows.Devices.Spi=ON -DAPI_Windows.Devices.I2c=ON -DAPI_Windows.Devices.Pwm=ON -DAPI_Windows.Devices.SerialCommunication=ON -DAPI_Windows.Devices.Adc=ON -DAPI_System.Devices.Dac=OFF -DAPI_nanoFramework.Devices.OneWire=ON -DAPI_Windows.Storage=ON -DAPI_nanoFramework.ResourceManager=ON -DAPI_nanoFramework.System.Collections=ON -DAPI_nanoFramework.System.Text=ON
GccArm_Version:
NeedsDFU: true
ORGPAL_PALTHREE:
BoardName: ORGPAL_PALTHREE
BuildOptions: -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.Devices.Dac=ON -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
GccArm_Version:
NeedsDFU: true
ST_STM32F429I_DISCOVERY:
BoardName: ST_STM32F429I_DISCOVERY
BuildOptions: -DTARGET_SERIES=STM32F4xx -DRTOS=CHIBIOS -DSUPPORT_ANY_BASE_CONVERSION=ON -DNF_FEATURE_DEBUGGER=ON -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
Expand Down
290 changes: 290 additions & 0 deletions targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
#
# Copyright (c) 2017 The nanoFramework project contributors
# See LICENSE file in the project root for full license information.
#

cmake_minimum_required(VERSION 3.0)
ENABLE_LANGUAGE(ASM)

# add header files with common OS definitions and board definitions specific for each image
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/nanoBooter/target_board.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/nanoBooter/target_board.h" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/nanoCLR/target_board.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/nanoCLR/target_board.h" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/target_common.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/target_common.h" @ONLY)

set(NANOBOOTER_PROJECT_NAME "nanoBooter")
set(NANOCLR_PROJECT_NAME "nanoCLR")

find_package(BuildUtils REQUIRED)
find_package(CHIBIOS REQUIRED)
find_package(ChibiOSnfOverlay REQUIRED)
find_package(WireProtocol REQUIRED)

# packages for nanoFramework libraries
#######################################
# mandatory
find_package(NF_CoreCLR REQUIRED)

#######################################
# optional

# ChibiOS contrib repo
if(CHIBIOS_CONTRIB_REQUIRED)
find_package(ChibiOS-Contrib REQUIRED)
endif()

# nF feature: debugger
if(NF_FEATURE_DEBUGGER)
find_package(NF_Debugger REQUIRED)
find_package(NF_Diagnostics REQUIRED)
endif()

# nF feature: networking
if(USE_NETWORKING_OPTION)
find_package(CHIBIOS_LWIP REQUIRED)
find_package(NF_NETWORKING REQUIRED)
endif()

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

# security provider is mbedTLS
if(USE_SECURITY_MBEDTLS_OPTION)
find_package(mbedTLS REQUIRED)
endif()

# SPIFFS
if(NF_FEATURE_USE_SPIFFS)
find_package(STM32F7_CubePackage REQUIRED)
find_package(SPIFFS REQUIRED)
endif()

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

add_subdirectory("common")
add_subdirectory("nanoBooter")
add_subdirectory("nanoCLR")

#######################
# nanoBooter executable

add_executable(
# executables for project, project sources
${NANOBOOTER_PROJECT_NAME}.elf

"${CMAKE_CURRENT_SOURCE_DIR}/target_common.c"
"${CMAKE_CURRENT_SOURCE_DIR}/target_BlockStorage.c"

# need to add configuration manager to allow get/store configuration blocks
"${PROJECT_SOURCE_DIR}/src/HAL/nanoHAL_ConfigurationManager.c"

${COMMON_PROJECT_SOURCES}
${NANOBOOTER_PROJECT_SOURCES}

${TARGET_CMSIS_COMMON_SOURCES}
${TARGET_CMSIS_NANOBOOTER_SOURCES}

${TARGET_CHIBIOS_COMMON_SOURCES}
${TARGET_CHIBIOS_NANOBOOTER_SOURCES}

${CHIBIOS_SOURCES}
${ChibiOSnfOverlay_SOURCES}

${WireProtocol_SOURCES}
)

#######################
# nanoCLR executable

add_executable(
# executables for project, project sources
${NANOCLR_PROJECT_NAME}.elf

"${CMAKE_CURRENT_SOURCE_DIR}/target_common.c"
# the next one is required is the target implements and it's using external memory
"${CMAKE_CURRENT_SOURCE_DIR}/target_external_memory.c"

${COMMON_PROJECT_SOURCES}
${NANOCLR_PROJECT_SOURCES}

${TARGET_CMSIS_COMMON_SOURCES}
${TARGET_CMSIS_NANOCLR_SOURCES}

${TARGET_CHIBIOS_COMMON_SOURCES}
${TARGET_CHIBIOS_NANOCLR_SOURCES}

${CHIBIOS_SOURCES}
${CHIBIOS_CONTRIB_SOURCES}
${ChibiOSnfOverlay_SOURCES}
${STM32F7_CubePackage_SOURCES}
${WireProtocol_SOURCES}

# sources for nanoFramework libraries
"${NF_CoreCLR_SOURCES}"
"${NF_Debugger_SOURCES}"
"${NF_Diagnostics_SOURCES}"

# sources for ChibiOS FatFS
"${CHIBIOS_FATFS_SOURCES}"

# sources for nanoFramework Network LWIP, Sockets and TLS
"${CHIBIOS_LWIP_SOURCES}"
"${NF_Networking_SOURCES}"
"${mbedTLS_SOURCES}"

# sources for SPIFFS
"${SPIFFS_SOURCES}"

# sources for nanoFramework APIs
"${TARGET_NANO_APIS_SOURCES}"
)

# add dependency from ChibiOS (this is required to make sure the ChibiOS repo is downloaded before the build starts)
add_dependencies(${NANOBOOTER_PROJECT_NAME}.elf ChibiOS)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf ChibiOS)

# add dependencies from CHIBIOS_NETWORK_COMPONENTS (this is required to make sure that ChibiOS network components are unzip at the proper locations before the build starts)
# only required if networking in ON
if(USE_NETWORKING_OPTION)
add_dependencies(${NANOBOOTER_PROJECT_NAME}.elf CHIBIOS_NETWORK_COMPONENTS)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf CHIBIOS_NETWORK_COMPONENTS)

# add dependency for security provider mbedTLS
if(USE_SECURITY_MBEDTLS_OPTION)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf mbedTLS)
endif()
endif()

# add dependencies from STM32F7_CubePackage and SPIFFS (this is required to make sure that components are unzip at the proper locations before the build starts)
if(NF_FEATURE_USE_SPIFFS)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf STM32F7_CubePackage)
add_dependencies(${NANOCLR_PROJECT_NAME}.elf SPIFFS)
endif()

# include common directories
include_directories(
"${CMAKE_CURRENT_BINARY_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/common
${PROJECT_SOURCE_DIR}/src/CLR/Core
${PROJECT_SOURCE_DIR}/src/CLR/Include
${PROJECT_SOURCE_DIR}/src/HAL/Include
${PROJECT_SOURCE_DIR}/src/PAL/Include

${WireProtocol_INCLUDE_DIRS}
${CHIBIOS_INCLUDE_DIRS}
${ChibiOSnfOverlay_INCLUDE_DIRS}
${CHIBIOS_CONTRIB_INCLUDE_DIRS}
${STM32F7_CubePackage_INCLUDE_DIRS}

${TARGET_CMSIS_COMMON_INCLUDE_DIRS}
${TARGET_CHIBIOS_COMMON_INCLUDE_DIRS}

# includes for SPIFFS
${SPIFFS_INCLUDE_DIRS}
)

# include directories for nanoBooter
target_include_directories(${NANOBOOTER_PROJECT_NAME}.elf PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}/nanoBooter"
${CMAKE_CURRENT_SOURCE_DIR}/nanoBooter

${TARGET_CMSIS_NANOBOOTER_INCLUDE_DIRS}
${TARGET_CHIBIOS_NANOBOOTER_INCLUDE_DIRS}

# includes for ChibiOS LwIP
"${CHIBIOS_LWIP_INCLUDE_DIRS}"
)

# include directories for nanoCLR
target_include_directories(${NANOCLR_PROJECT_NAME}.elf PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}/nanoCLR"
${CMAKE_CURRENT_SOURCE_DIR}/nanoCLR

${TARGET_CMSIS_NANOCLR_INCLUDE_DIRS}
${TARGET_CHIBIOS_NANOCLR_INCLUDE_DIRS}

# directories for nanoFramework libraries
"${NF_CoreCLR_INCLUDE_DIRS}"
"${NF_Debugger_INCLUDE_DIRS}"
"${NF_Diagnostics_INCLUDE_DIRS}"

# includes for nanoFramework APIs
"${TARGET_NANO_APIS_INCLUDES}"

# includes for ChibiOS FatFS
"${CHIBIOS_FATFS_INCLUDE_DIRS}"

# includes for ChibiOS LwIP
"${CHIBIOS_LWIP_INCLUDE_DIRS}"

# incudes for Networking and TLS
"${NF_Networking_INCLUDE_DIRS}"
"${mbedTLS_INCLUDE_DIRS}"
)

# set compiler options
nf_set_compiler_options(${NANOBOOTER_PROJECT_NAME}.elf)
nf_set_compiler_options(${NANOCLR_PROJECT_NAME}.elf)

# mbed TLS requires a config file
if(USE_SECURITY_MBEDTLS_OPTION)
# this seems to be only option to properly set a compiler define through the command line that needs to be a string literal
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMBEDTLS_CONFIG_FILE=\"<${PROJECT_SOURCE_DIR}/src/PAL/COM/sockets/ssl/mbedTLS/nf_mbedtls_config.h>\"")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMBEDTLS_CONFIG_FILE=\"<${PROJECT_SOURCE_DIR}/src/PAL/COM/sockets/ssl/mbedTLS/nf_mbedtls_config.h>\"")
endif()

# set compiler definitions
nf_set_compiler_definitions(${NANOBOOTER_PROJECT_NAME}.elf)
nf_set_compiler_definitions(${NANOCLR_PROJECT_NAME}.elf)

# set linker files
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
nf_set_linker_file(${NANOBOOTER_PROJECT_NAME}.elf ${CMAKE_CURRENT_SOURCE_DIR}/nanoBooter/STM32F76xx_booter-DEBUG.ld)
nf_set_linker_file(${NANOCLR_PROJECT_NAME}.elf ${CMAKE_CURRENT_SOURCE_DIR}/nanoCLR/STM32F76xx_CLR-DEBUG.ld)
else()
nf_set_linker_file(${NANOBOOTER_PROJECT_NAME}.elf ${CMAKE_CURRENT_SOURCE_DIR}/nanoBooter/STM32F76xx_booter.ld)
nf_set_linker_file(${NANOCLR_PROJECT_NAME}.elf ${CMAKE_CURRENT_SOURCE_DIR}/nanoCLR/STM32F76xx_CLR.ld)
endif()

# set linker options
nf_set_linker_options(${NANOBOOTER_PROJECT_NAME}.elf)
nf_set_linker_options(${NANOCLR_PROJECT_NAME}.elf)

# add other linker flags
###########################################################
# the sizes of CRT heap and ChibiOS stacks are defined here
set_property(TARGET ${NANOBOOTER_PROJECT_NAME}.elf APPEND_STRING PROPERTY LINK_FLAGS ",--defsym=__main_stack_size__=0x400,--defsym=__process_stack_size__=0x800,--defsym=__crt_heap_size__=0x2000")
set_property(TARGET ${NANOCLR_PROJECT_NAME}.elf APPEND_STRING PROPERTY LINK_FLAGS ",--defsym=__main_stack_size__=0x400,--defsym=__process_stack_size__=0x800,--defsym=__crt_heap_size__=0x3B000")

# generate output files
nf_generate_build_output_files(${NANOBOOTER_PROJECT_NAME}.elf)
nf_generate_build_output_files(${NANOCLR_PROJECT_NAME}.elf)

# 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(
${PROJECT_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000
${PROJECT_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08010000
${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu
)
else()
NF_GENERATE_DFU_PACKAGE(
${PROJECT_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin 08000000
${PROJECT_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin 08010000
${PROJECT_SOURCE_DIR}/build/nanobooter-nanoclr.dfu
)
endif()

endif()
34 changes: 34 additions & 0 deletions targets/CMSIS-OS/ChibiOS/ORGPAL_PALTHREE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Configuration of ChibiOS, HAL and MCU

For a successful build the following changes are required:

For memory maps, uuid etc. the reference document used was: http://www.st.com/content/ccc/resource/technical/document/reference_manual/group0/96/8b/0d/ec/16/22/43/71/DM00224583/files/DM00224583.pdf/jcr:content/translations/en.DM00224583.pdf

In _halconf.g_ (in both nanoBooter and nanoCLR folders), when compared with a default file available from (https://github.com/ChibiOS/ChibiOS/tree/master/demos/STM32/RT-STM32F769I-DISCOVERY):
- HAL_USE_SERIAL_USB to TRUE
- HAL_USE_USB to TRUE
- SERIAL_DEFAULT_BITRATE to 921600

In _mcuconf.h_ (in both nanoBooter and nanoCLR folders), when compared with a default file available from (https://github.com/ChibiOS/ChibiOS/tree/master/demos/STM32/RT-STM32F769I-DISCOVERY):
- STM32_SERIAL_USE_USART2 to TRUE
- STM32_USB_USE_OTG1 to TRUE

NOTE: this configuration was successfully tested in an ST_STM32F769I_DISCOVERY 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:
- PA6, ADC1 IN6
- PA4 ADC1 IN4
- PC2 ADC1 IN12
- PF10 ADC1 IN8
- PF8 ADC3 IN6
- PB8 ADC3 IN7
- Temp Sensor ADC1
- VrefInt ADC1
- Vbatt ADC1

## 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`.
Loading

0 comments on commit 343c3b8

Please sign in to comment.