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

feat: Use the CubeMX Java runtime environment #144

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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
16 changes: 10 additions & 6 deletions firmware/cmake/generate_cubemx.mk
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
ifeq ($(OS),Windows_NT)
CUBEMX_PATH := $(shell where STM32CubeMX)
# Convert path to Windows-style and add .exe extension
CUBEMX_PATH := $(subst \,\\,$(CUBEMX_PATH))
else
# Convert windows backslash to regular slash
CUBEMX_PATH := $(subst \,/,$(shell where STM32CubeMX))
# Compute the CubeMX's java path. Spaces in path are escaped.
space := $(subst ,, )
JAVA := $(dir $(subst $(space),\$(space),$(CUBEMX_PATH)))jre/bin/java
# Known bug: Expanding JAVA twice does not work.
else # Linux / MacOS
CUBEMX_PATH := $(shell which STM32CubeMX)
JAVA := $(shell which java)
# See https://github.com/macformula/racecar/issues/142
endif

IOC_FILE = board_config.ioc
AUTOGEN_CUBEMX = ON

CUBEMX_GEN_SCRIPT = cubemx_script.txt

Expand All @@ -32,4 +36,4 @@ Makefile: $(IOC_FILE)
@printf 'exit\n' >> $(CUBEMX_GEN_SCRIPT)

# Run the cubemx program to generate code.
java -jar "$(CUBEMX_PATH)" -q "$(CUBEMX_GEN_SCRIPT)"
$(JAVA) -jar "$(CUBEMX_PATH)" -q "$(CUBEMX_GEN_SCRIPT)"
Loading