-
-
Save Schievel1/aea72afc087c895ecb84ac15cd195d87 to your computer and use it in GitHub Desktop.
Makefile for building keil projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile for building Keil projects out of WSL | |
# Pascal Jaeger <pascal.jaeger@schaltbau-bode.com> 2023.01.02 | |
KEIL ?= "/mnt/c/Keil_v5/UV4/UV4.exe" | |
BCONSOLE ?= "/mnt/c/Program\ Files\ \(x86\)/Cortex\ Bootloader/BConsole/BConsole.exe" | |
TMP=keil.out | |
NULL=/dev/null | |
.PHONY: build all clean flash help | |
# Keils exit code will be 1 when there were warnungs, which would trigger make to exit | |
# -@ to prevent that | |
build: # incermental build | |
-@$(KEIL) -j0 -b -o $(TMP) *.uvproj 2> $(NULL); | |
@cat $(TMP) | |
all: # full rebuild | |
-@$(KEIL) -j0 -cr -o $(TMP) *.uvproj 2> $(NULL); | |
@cat $(TMP) | |
clean: # delete output files | |
-@$(KEIL) -j0 -c -o $(TMP) *.uvproj 2> $(NULL); | |
@cat $(TMP) | |
flash: # flash latest .hex file STM32 using bconsole | |
pwd | |
@HEX="$$(ls -r ./Debug | grep ".hex" | head -n 1)"; echo $$HEX; \ | |
"$(BCONSOLE) -SB; "$(BCONSOLE)" -D ./Debug/$$HEX; | |
help: | |
@echo | |
@echo "Makefile for building Keil MTB3 projects out of WSL" | |
@echo "Usage: $(MAKE) [ <parameter>=<value> ... ] [ <action> ]" | |
@echo "Example: $(MAKE) KEIL="path to Keils UV4.exe" build" | |
@echo | |
@echo " actions: build - incremental build" | |
@echo " all - full rebuild" | |
@echo " clean - delete output files" | |
@echo " flash - flash latest .hex file in ./Debug onto STM32" | |
@echo " help - print this message" | |
@echo | |
@echo " parameter | type | description | defaults" | |
@echo " ----------+------+--------------------------------+----------------------------" | |
@echo " KEIL | path | path to Keils UV4.exe | /mnt/c/Keil_v5/UV4/UV4.exe" | |
@echo " PREFIX | path | system tree prefix | /mnt/c/Program\ Files\ \(x86\)" | |
@echo " | /Cortex\ Bootloader/BConsole/BConsole.exe" | |
@echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment