Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target STM32F767 Nucleo #2762

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
077c08c
Add target structure
networkfusion Sep 8, 2023
206eb3b
Fix names
networkfusion Sep 8, 2023
257d91a
Further fix for build
networkfusion Sep 8, 2023
7a6b45f
Align chconf and halconf
networkfusion Sep 8, 2023
5be0ddd
Fix board definition
networkfusion Sep 8, 2023
0c94e54
Turn off periperals until we map them properly.
networkfusion Sep 8, 2023
f456bbd
Adjust main with (probably incorrect) values
networkfusion Sep 8, 2023
36253f0
Comment out watchdog (for the moment)
networkfusion Sep 8, 2023
13f4c90
Turn on LSI for watchdog.
networkfusion Sep 8, 2023
8ebb87d
Try turning off watchdog.
networkfusion Sep 8, 2023
e3e900e
Fix missing include for mcuconf
networkfusion Sep 8, 2023
864e205
Enable watchdog and uart ports
networkfusion Sep 8, 2023
f3fc001
Test nanobooter button
networkfusion Sep 8, 2023
7096672
Turn ports back off.
networkfusion Sep 8, 2023
f33b9dd
Turn off no cache as test
networkfusion Sep 8, 2023
ef9203d
Fix issue with last commit
networkfusion Sep 8, 2023
b157f0f
Fix port mappings
networkfusion Sep 8, 2023
a30e3d5
Turn off ports and can. Turn on net
networkfusion Sep 8, 2023
091a530
Work on sensor channels
networkfusion Sep 10, 2023
b39de3c
Enable SPI and I2C
networkfusion Sep 10, 2023
4a5469d
Rename board for alignment.
networkfusion Sep 10, 2023
82225bb
Try building verbose.
networkfusion Sep 10, 2023
9606fa9
Try again.
networkfusion Sep 10, 2023
dc9064d
And again.
networkfusion Sep 10, 2023
8749af9
Turn off SPI and I2C
networkfusion Sep 10, 2023
6766dbf
Fix define.
networkfusion Sep 10, 2023
54f1af4
Test SPI on
networkfusion Sep 10, 2023
2aa1909
SPI off again.
networkfusion Sep 10, 2023
0a1d5ef
Minor fixes
networkfusion Sep 10, 2023
ba5da42
mcuconf adjustments
networkfusion Sep 12, 2023
503c757
Fix I2C2
networkfusion Sep 12, 2023
3997b64
Turn off ports
networkfusion Sep 12, 2023
0350649
Turn on ADC
networkfusion Sep 12, 2023
57c52f6
Tuen on ports again
networkfusion Sep 12, 2023
401835d
Fix port definition
networkfusion Sep 12, 2023
0d78287
Enable PWM
networkfusion Sep 12, 2023
b4a1302
Turn off TIM2 in mcuconf
networkfusion Sep 12, 2023
a01c497
Add STM32_PWM_USE_ADVANCED
networkfusion Sep 12, 2023
3420ea8
Update readme [skip ci]
networkfusion Sep 12, 2023
03e050c
Merge branch 'main' into port-f767
networkfusion Sep 12, 2023
af92a7d
Code style fixes
networkfusion Sep 16, 2023
f1c6c3a
Further fix
networkfusion Sep 16, 2023
a4edc8a
Merge branch 'main' into port-f767
networkfusion Sep 16, 2023
0d26eb4
Merge branch 'main' into port-f767
networkfusion Sep 27, 2023
d6a35f4
Merge remote-tracking branch 'upstream/main' into port-f767
networkfusion Sep 27, 2023
95ec52c
Merge remote-tracking branch 'upstream/main' into port-f767
networkfusion Sep 27, 2023
eabd4be
Update linker files
networkfusion Sep 27, 2023
edd2b9d
Test fix external RAM
networkfusion Sep 27, 2023
b853eb1
No external SRAM
networkfusion Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .github/workflows/build-chibios-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Devcontainer build for ChibiOS targets
# run-name: ${{ github.actor }}-test

on:
push:
pull_request:
release:
types:
- created
workflow_dispatch:

jobs:
build-target:
strategy:
fail-fast: false # Continues to build other targets in the matrix, even if one fails.

matrix: # Add the target and build type you wish to generate firmware for:
include: [
{ target: ST_NUCLEO144_F767ZI, build-type: MinSizeRel },
{ target: ST_NUCLEO144_F767ZI, build-type: Debug },

# { target: ST_STM32F769I_DISCOVERY, build-type: MinSizeRel },
# { target: ST_STM32F769I_DISCOVERY, build-type: Debug },

# { target: ORGPAL_PALTHREE, build-type: MinSizeRel },
# { target: ORGPAL_PALTHREE, build-type: Debug },

# { target: ST_STM32F429I_DISCOVERY, build-type: MinSizeRel },
# { target: ST_STM32F429I_DISCOVERY, build-type: Debug },

# { target: ST_NUCLEO64_F091RC, build-type: MinSizeRel },
# Note: The F091RC debug build is currently broken, so is expected to fail.
# { target: ST_NUCLEO64_F091RC, build-type: Debug },


# Community targets:

# { target: ST_NUCLEO64_F411RE_NF, build-type: MinSizeRel },
# { target: ST_NUCLEO64_F411RE_NF, build-type: Debug },

# { target: ST_STM32F411_DISCOVERY, build-type: MinSizeRel },
# { target: ST_STM32F411_DISCOVERY, build-type: Debug },

# { target: BrainPad2, build-type: MinSizeRel },
# { target: BrainPad2, build-type: Debug },

# { target: GHI_FEZ_CERB40_NF, build-type: MinSizeRel },
# { target: GHI_FEZ_CERB40_NF, build-type: Debug },

# { target: I2M_ELECTRON_NF, build-type: MinSizeRel },
# { target: I2M_ELECTRON_NF, build-type: Debug },

# { target: I2M_OXYGEN_NF, build-type: MinSizeRel },
# { target: I2M_OXYGEN_NF, build-type: Debug },

# { target: MBN_QUAIL, build-type: MinSizeRel },
# { target: MBN_QUAIL, build-type: Debug },

# { target: NESHTEC_NESHNODE_V1, build-type: MinSizeRel },
# { target: NESHTEC_NESHNODE_V1, build-type: Debug },

# { target: NETDUINO3_WIFI, build-type: MinSizeRel },
# { target: NETDUINO3_WIFI, build-type: Debug },

# { target: PybStick2x, build-type: MinSizeRel },
# { target: PybStick2x, build-type: Debug },

# { target: ST_NUCLEO144_F412ZG_NF, build-type: MinSizeRel },
# { target: ST_NUCLEO144_F412ZG_NF, build-type: Debug },

# { target: ST_NUCLEO144_F439ZI, build-type: MinSizeRel },
# { target: ST_NUCLEO144_F439ZI, build-type: Debug },

# { target: ST_NUCLEO144_F746ZG, build-type: MinSizeRel },
# { target: ST_NUCLEO144_F746ZG, build-type: Debug },

# { target: ST_NUCLEO64_F401RE_NF, build-type: MinSizeRel },
# { target: ST_NUCLEO64_F401RE_NF, build-type: Debug },

# { target: ST_STM32F4_DISCOVERY, build-type: MinSizeRel },
# { target: ST_STM32F4_DISCOVERY, build-type: Debug },

# { target: WEACT_F411CE, build-type: MinSizeRel },
# { target: WEACT_F411CE, build-type: Debug },
]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Adjust config templates for devcontainer
run: |
# Move into the config directory
pushd config
# Rename the templates
mv user-prefs.TEMPLATE.json user-prefs.json
mv user-tools-repos.TEMPLATE.json user-tools-repos.json
# Adjust the file content for a devcontainer
sed -i -- 's|"name": "user-tools-repos-container"|"name": "user-tools-repos"|g' user-tools-repos.json
# Move out of the config directory
popd

- name: Adjust devcontainer.json (ChibiOS source)
run: |
# required fixes for current devcontainer
# Move into the .devcontainer directory
pushd .devcontainer
# We could target the chibios container for a quicker build
sed -i -- 's|"dockerFile": "Dockerfile.All"|"dockerFile": "Dockerfile.ChibiOS"|g' devcontainer.json
# But we actually require a change to the available devcontainer image, so we target the source instead (which takes a little longer to build).
# sed -i -- 's|"dockerFile": "Dockerfile.All"|"dockerFile": "sources/Dockerfile.ChibiOS"|g' devcontainer.json
# For the CI, we need to remove the unsupported (azure cli) mount directive.
sed -i -- 's|"source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind"|//"source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind",|g' devcontainer.json
# Move out of the .devcontainer directory
popd

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build ${{ matrix.target }} ${{ matrix.build-type }} Firmware
uses: devcontainers/[email protected]
with:
# The ChibiOS container
cacheFrom: ghcr.io/nanoframework/dev-container-chibios
push: never
runCmd: |
# Build target:
cmake --preset=${{ matrix.target }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build build

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Firmware ${{ matrix.target }}-${{ matrix.build-type }}
path: |
./build/*.map
./build/*.elf
./build/*.hex
./build/*.bin
./build/*.dfu
8 changes: 8 additions & 0 deletions azure-pipelines-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ jobs:
NeedsSRECORD: true
CMakePreset: ST_NUCLEO64_F091RC

ST_NUCLEO144_F767ZI:
TargetBoard: ST_NUCLEO144_F767ZI
TargetSeries: 'stm32f7xx'
BuildOptions:
NeedsDFU: false
NeedsSRECORD: true
CMakePreset: ST_NUCLEO144_F767ZI

variables:
DOTNET_NOLOGO: true
# creates a counter and assigns it to the revision variable
Expand Down
3 changes: 2 additions & 1 deletion targets/ChibiOS/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ORGPAL_PALTHREE/CMakePresets.json",
"ST_NUCLEO64_F091RC/CMakePresets.json",
"ST_STM32F429I_DISCOVERY/CMakePresets.json",
"ST_STM32F769I_DISCOVERY/CMakePresets.json"
"ST_STM32F769I_DISCOVERY/CMakePresets.json",
"ST_NUCLEO144_F767ZI/CMakePresets.json"
]
}
51 changes: 51 additions & 0 deletions targets/ChibiOS/ST_NUCLEO144_F767ZI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# 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
STM32F76xx_booter

CLR_LINKER_FILE
STM32F76xx_CLR

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

BOOTER_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__=0x2000"

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__=0x3B000"
)

# generate bin file for deployment
if(SRECORD_TOOL_AVAILABLE)

############################################################################################################
## when changing the linker file make sure to update the addresses below with the offset of the CLR image ##
## 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_bin_package(
${CMAKE_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin
${CMAKE_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin
10000
${CMAKE_SOURCE_DIR}/build/nanobooter-nanoclr.bin)
else()
nf_generate_bin_package(
${CMAKE_SOURCE_DIR}/build/${NANOBOOTER_PROJECT_NAME}.bin
${CMAKE_SOURCE_DIR}/build/${NANOCLR_PROJECT_NAME}.bin
10000
${CMAKE_SOURCE_DIR}/build/nanobooter-nanoclr.bin)
endif()

endif()
58 changes: 58 additions & 0 deletions targets/ChibiOS/ST_NUCLEO144_F767ZI/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"version": 4,
"include": [
"../../../CMake/arm-gcc.json",
"../../../config/user-tools-repos.json",
"../../../config/user-prefs.json"
],
"configurePresets": [
{
"name": "ST_NUCLEO144_F767ZI",
"inherits": [
"arm-gcc-cortex-preset",
"user-tools-repos",
"user-prefs"
],
"hidden": false,
"cacheVariables": {
"TARGET_BOARD": "${presetName}",
"RTOS": "ChibiOS",
"TARGET_SERIES": "STM32F7xx",
"CHIBIOS_CONTRIB_REQUIRED": "OFF",
"STM32_CUBE_PACKAGE_REQUIRED": "OFF",
"SUPPORT_ANY_BASE_CONVERSION": "ON",
"NF_FEATURE_DEBUGGER": "ON",
"NF_FEATURE_RTC": "ON",
"NF_FEATURE_HAS_SDCARD": "OFF",
"NF_FEATURE_HAS_CONFIG_BLOCK": "ON",
"SWO_OUTPUT": "OFF",
"NF_BUILD_RTM": "OFF",
"API_System.Math": "ON",
"API_Hardware.Stm32": "ON",
"API_System.Device.Gpio": "ON",
"API_System.Device.Spi": "ON",
"API_System.Device.I2c": "ON",
"API_System.Device.Pwm": "ON",
"API_System.IO.Ports": "ON",
"API_System.Device.Adc": "ON",
"API_System.Device.Dac": "OFF",
"API_System.Net": "ON",
"API_nanoFramework.Device.OneWire": "OFF",
"API_nanoFramework.Device.Can": "ON",
"API_nanoFramework.ResourceManager": "ON",
"API_nanoFramework.System.Collections": "ON",
"API_nanoFramework.System.Text": "ON",
"API_Windows.Storage": "OFF",
"API_nanoFramework.Graphics": "OFF"
}
}
],
"buildPresets": [
{
"inherits": "base-user",
"name": "ST_NUCLEO144_F767ZI",
"displayName": "ST_NUCLEO144_F767ZI",
"configurePreset": "ST_NUCLEO144_F767ZI"
}
]
}
11 changes: 11 additions & 0 deletions targets/ChibiOS/ST_NUCLEO144_F767ZI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 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

For port maps:
https://www.st.com/resource/en/user_manual/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf

NOTE: this configuration was successfully tested in an ST_NUCLEO144_F767ZI board using the Serial port through the onboard ST Link USB connection.

Loading