Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
# GitHub Actions does not allow the secrets context inside if expression
# So, let's copy the secret into env
env:
CUBEMX_ARCHIVE_REPO: ${{ github.repository }}
LIBCPNODE_DEPLOY_KEY: ${{ secrets.LIBCPNODE_DEPLOY_KEY }}

steps:
Expand Down Expand Up @@ -163,6 +164,6 @@ jobs:
with:
bot_token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
chat_id: ${{ secrets.TELEGRAM_CHAT_ID }}
files: build/release/*.bin
files: release/*.bin
message: "Node"
add_git_info: "true"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
build/
build_dsdl/
/release/*
.vscode/
.venv/
__pycache__/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "Libs/mini-v3-ioc"]
path = Libs/mini-v3-ioc
url = https://github.com/RaccoonLabHardware/mini-v3-ioc.git
[submodule "Libs/Canopen"]
path = Libs/Canopen
url = git@github.com:Ilyhadev/Canopen.git
34 changes: 29 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(CMAKE_DIR ${ROOT_DIR}/cmake)
set(LIBPARAMS_PATH ${ROOT_DIR}/Libs/libparams)
set(LIBPARAMS_CMAKE libparams.cmake)
set(NC_LIBDCNODE_PATH "${ROOT_DIR}/Libs/Dronecan" CACHE PATH "Path to libdcnode/DroneCAN source tree")
set(NC_LIBCANOPEN_PATH "${ROOT_DIR}/Libs/Canopen" CACHE PATH "Path to libcanopen source tree")
set(BUILD_ROOT_DIR ${ROOT_DIR}/build)

include(${CMAKE_DIR}/module.cmake)
Expand Down Expand Up @@ -174,8 +175,14 @@ elseif(BOARD_PLATFORM STREQUAL "stm32f103")
if(DEFINED STM32_CUBEMX_PROJECT_PATH)
set(stm32cubeMxProjectPath ${STM32_CUBEMX_PROJECT_PATH})
else()
set(stm32cubeMxProjectPath ${ROOT_DIR}/Libs/stm32-cube-project)
message(FATAL_ERROR "STM32_CUBEMX_PROJECT_PATH is required for '${NC_BOARD}' (${BOARD_PLATFORM}).")
endif()
if(NOT EXISTS "${stm32cubeMxProjectPath}")
message(FATAL_ERROR
"STM32_CUBEMX_PROJECT_PATH '${stm32cubeMxProjectPath}' does not exist. "
"Provide an STM32H753xx CubeMX project with -DSTM32_CUBEMX_PROJECT_PATH=<path>.")
endif()

if(DEFINED STM32_LINKER_SCRIPT_PATH)
set(ldFile ${STM32_LINKER_SCRIPT_PATH})
elseif(DEFINED STM32_LINKER_SCRIPT_TEMPLATE_PATH)
Expand Down Expand Up @@ -213,8 +220,15 @@ elseif(BOARD_PLATFORM STREQUAL "stm32g0b1")
if(DEFINED STM32_CUBEMX_PROJECT_PATH)
set(stm32cubeMxProjectPath ${STM32_CUBEMX_PROJECT_PATH})
else()
set(stm32cubeMxProjectPath ${ROOT_DIR}/Libs/mini-v3-ioc)
message(FATAL_ERROR "STM32_CUBEMX_PROJECT_PATH is required for '${NC_BOARD}' (${BOARD_PLATFORM}).")
endif()

if(NOT EXISTS "${stm32cubeMxProjectPath}")
message(FATAL_ERROR
"STM32_CUBEMX_PROJECT_PATH '${stm32cubeMxProjectPath}' does not exist. "
"Provide an STM32H753xx CubeMX project with -DSTM32_CUBEMX_PROJECT_PATH=<path>.")
endif()

if(DEFINED STM32_LINKER_SCRIPT_PATH)
set(ldFile ${STM32_LINKER_SCRIPT_PATH})
elseif(DEFINED STM32_LINKER_SCRIPT_TEMPLATE_PATH)
Expand All @@ -230,6 +244,19 @@ elseif(BOARD_PLATFORM STREQUAL "stm32g0b1")
FILE(GLOB coreSources ${stm32cubeMxProjectPath}/Core/Src/*)
FILE(GLOB driversSources ${stm32cubeMxProjectPath}/Drivers/*/*/*.c
${stm32cubeMxProjectPath}/Drivers/*/*/*/*.c)
set(cmsisDspPath ${stm32cubeMxProjectPath}/Middlewares/Third_Party/ARM_CMSIS/CMSIS/DSP)
set(cmsisDspSources
${cmsisDspPath}/Source/BasicMathFunctions/arm_mult_q15.c
${cmsisDspPath}/Source/BasicMathFunctions/arm_shift_q15.c
${cmsisDspPath}/Source/CommonTables/arm_common_tables.c
${cmsisDspPath}/Source/CommonTables/arm_const_structs.c
${cmsisDspPath}/Source/SupportFunctions/arm_float_to_q15.c
${cmsisDspPath}/Source/SupportFunctions/arm_q15_to_float.c
${cmsisDspPath}/Source/TransformFunctions/arm_bitreversal2.c
${cmsisDspPath}/Source/TransformFunctions/arm_cfft_q15.c
${cmsisDspPath}/Source/TransformFunctions/arm_cfft_radix4_q15.c
${cmsisDspPath}/Source/TransformFunctions/arm_rfft_init_q15.c
${cmsisDspPath}/Source/TransformFunctions/arm_rfft_q15.c)
FILE(GLOB_RECURSE middlewareSources
${stm32cubeMxProjectPath}/Middlewares/ST/STM32_USB_Device_Library/*.c)
FILE(GLOB_RECURSE usbDeviceSources
Expand All @@ -240,7 +267,6 @@ elseif(BOARD_PLATFORM STREQUAL "stm32g0b1")

set(CMAKE_EXE_LINKER_FLAGS "-T${ldFile} -Wl,-Map=${PROJECT_NAME}.map,--cref")
include(${CMAKE_DIR}/toolchain-stm32g0b1.cmake)
add_compile_definitions(NUM_OF_CAN_BUSES=2)
add_compile_definitions(CYPHAL_NUM_OF_CAN_BUSES=2)
elseif(BOARD_PLATFORM STREQUAL "stm32h753xx")
if(LIBPARAMS_STORAGE_BACKEND STREQUAL "")
Expand Down Expand Up @@ -303,9 +329,7 @@ elseif(BOARD_PLATFORM STREQUAL "stm32h753xx")

set(CMAKE_EXE_LINKER_FLAGS "-T${ldFile} -Wl,-Map=${PROJECT_NAME}.map,--cref")
include(${CMAKE_DIR}/toolchain-stm32h753xx.cmake)
add_compile_definitions(NUM_OF_CAN_BUSES=1)
add_compile_definitions(CYPHAL_NUM_OF_CAN_BUSES=1)
add_compile_definitions(DRONECAN_FDCAN_PRIMARY=1)
add_compile_definitions(USE_PWR_LDO_SUPPLY)
else()
message(FATAL_ERROR "Unknown BOARD_PLATFORM '${BOARD_PLATFORM}'. Expected: ubuntu, stm32f103, stm32g0b1, stm32h753xx.")
Expand Down
1 change: 1 addition & 0 deletions Libs/Canopen
Submodule Canopen added at 47bffa
2 changes: 1 addition & 1 deletion Libs/Dronecan
1 change: 0 additions & 1 deletion Libs/mini-v3-ioc
Submodule mini-v3-ioc deleted from 818360
1 change: 0 additions & 1 deletion Libs/stm32-cube-project
Submodule stm32-cube-project deleted from 2e5cd9
47 changes: 45 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NC_BUILD_DIR?=$(ROOT_DIR)/build

MINI_V2_CUBEMX_MANIFEST:=$(ROOT_DIR)/Src/boards/rl/mini_v2/cubemx.json
MINI_V2_HAL:=$(NC_BUILD_DIR)/stm32cubemx/rl/mini_v2

MINI_V3_CUBEMX_MANIFEST:=$(ROOT_DIR)/Src/boards/rl/mini_v3/cubemx.json
MINI_V3_HAL:=$(NC_BUILD_DIR)/stm32cubemx/rl/mini_v3

NODE_V4_CUBEMX_MANIFEST:=$(ROOT_DIR)/Src/boards/rl/node_v4/cubemx.json
NODE_V4_HAL:=$(NC_BUILD_DIR)/stm32cubemx/rl/node_v4

Expand Down Expand Up @@ -76,6 +82,17 @@ endif
--cmake-build-type "${CMAKE_BUILD_TYPE}" \
-- ${EXTRA_CMAKE_ARGS}

ensure_mini_v2_cubemx:
@python3 "$(ROOT_DIR)/scripts/cubemx.py" ensure \
--manifest "$(MINI_V2_CUBEMX_MANIFEST)" \
--out "$(MINI_V2_HAL)"

ensure_mini_v3_cubemx:
@python3 "$(ROOT_DIR)/scripts/cubemx.py" ensure \
--manifest "$(MINI_V3_CUBEMX_MANIFEST)" \
--out "$(MINI_V3_HAL)" \
--release-only

ensure_node_v4_cubemx:
@python3 "$(ROOT_DIR)/scripts/cubemx.py" ensure \
--manifest "$(NODE_V4_CUBEMX_MANIFEST)" \
Expand All @@ -86,6 +103,14 @@ cubemx_archives:
--manifest "$(NODE_V4_CUBEMX_MANIFEST)" \
--out "$(NODE_V4_HAL)" \
--archive-dir "$(ROOT_DIR)/release/cubemx"
@python3 "$(ROOT_DIR)/scripts/cubemx.py" package \
--manifest "$(MINI_V3_CUBEMX_MANIFEST)" \
--out "$(MINI_V3_HAL)" \
--archive-dir "$(ROOT_DIR)/release/cubemx"
@python3 "$(ROOT_DIR)/scripts/cubemx.py" package \
--manifest "$(MINI_V2_CUBEMX_MANIFEST)" \
--out "$(MINI_V2_HAL)" \
--archive-dir "$(ROOT_DIR)/release/cubemx"

#
# Alias naming rules:
Expand All @@ -96,44 +121,62 @@ cubemx_archives:
# rl/mini_v2 aliases
#
rl_mini_v2_dronecan: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=dronecan IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_dronecan_application
rl_mini_v2_dronecan_application: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=dronecan IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_dronecan_application
rl_mini_v2_dronecan_standalone: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=dronecan IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v2_dronecan_standalone
rl_mini_v2_cyphal: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=cyphal IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_cyphal_application
rl_mini_v2_cyphal_application: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=cyphal IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_cyphal_application
rl_mini_v2_cyphal_standalone: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=cyphal IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v2_cyphal_standalone
rl_mini_v2_both: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=both IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_both_application
rl_mini_v2_both_application: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=both IMAGE_KIND=application BUILD_VARIANT=rl_mini_v2_both_application
rl_mini_v2_both_standalone: checks
$(MAKE) ensure_mini_v2_cubemx
$(MAKE) build BOARD=rl/mini_v2 TARGET=both IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v2_both_standalone

#
# rl/mini_v3 aliases
#
rl_mini_v3_dronecan: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=dronecan IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_dronecan_application
rl_mini_v3_dronecan_application: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=dronecan IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_dronecan_application
rl_mini_v3_dronecan_standalone: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=dronecan IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v3_dronecan_standalone
rl_mini_v3_cyphal: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=cyphal IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_cyphal_application
rl_mini_v3_cyphal_application: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=cyphal IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_cyphal_application
rl_mini_v3_cyphal_standalone: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=cyphal IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v3_cyphal_standalone
rl_mini_v3_both: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=both IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_both_application
rl_mini_v3_both_application: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=both IMAGE_KIND=application BUILD_VARIANT=rl_mini_v3_both_application
rl_mini_v3_both_standalone: checks
$(MAKE) ensure_mini_v3_cubemx
$(MAKE) build BOARD=rl/mini_v3 TARGET=both IMAGE_KIND=standalone BUILD_VARIANT=rl_mini_v3_both_standalone

#
Expand Down Expand Up @@ -202,7 +245,7 @@ tests:
${ROOT_DIR}/scripts/tests.sh

upload:
LATEST_TARGET=$$(ls -td ${NC_BUILD_DIR}/release/*.bin | head -1) && ./scripts/flash.sh $$LATEST_TARGET
LATEST_TARGET=$$(ls -td ${ROOT_DIR}/release/*.bin | head -1) && ./scripts/flash.sh $$LATEST_TARGET

SOCKETCAN_URL:=https://gist.githubusercontent.com/PonomarevDA/6ecc8fc340e4c50619c1e5dfcedc37b2/raw/2db6d1626a9ada543602ff0a52b48fecb94e6e07/socketcan.sh
SOCKETCAN_EXECUTABLE:=build/tools/socketcan-v1.0.2.sh
Expand All @@ -220,7 +263,7 @@ remove_slcan0: download_socketcan
run: create_slcan0
LATEST_TARGET=$$(ls -td build/*/obj/node | head -1 | head -1) && $$LATEST_TARGET
clean_releases:
-rm -fR ${NC_BUILD_DIR}/release
-rm -f ${ROOT_DIR}/release/*.bin
clean:
-rm -fR ${NC_BUILD_DIR}/*/obj
distclean:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ make rl_mini_v2_cyphal
make rl_mini_v3_cyphal

```

> **Mini v3 IMU/DSP:** The IMU vibration analysis uses CMSIS-DSP, which is declared in the Mini v3 `.ioc`. Mini v3 builds intentionally restore the matching generated HAL from a GitHub release archive instead of regenerating it locally, ensuring that the complete DSP sources are available. After editing the Mini v3 `.ioc`, generate and publish its new HAL archive before building. See [docs/cubemx.md](docs/cubemx.md).

Note: Cyphal builds require access to the private `libcpnode` repository. Fork CI skips Cyphal (and combined v3) builds.

See [docs/build_system.md](docs/build_system.md) for how the Make targets and the underlying CMake build relate.
Expand Down
2 changes: 1 addition & 1 deletion Src/boards/rl/mini_v2/board/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Distributed under the terms of the GPL v3 license, available in the file LICENSE.

set(BOARD_PLATFORM stm32f103)
set(STM32_CUBEMX_PROJECT_PATH ${ROOT_DIR}/Libs/stm32-cube-project)
set(STM32_CUBEMX_PROJECT_PATH ${ROOT_DIR}/build/stm32cubemx/rl/mini_v2)

if(NOT DEFINED IMAGE_KIND OR IMAGE_KIND STREQUAL "")
set(IMAGE_KIND standalone)
Expand Down
Loading