From 89a3fdb3b99d852db4196950707d5c0e6e056f05 Mon Sep 17 00:00:00 2001 From: Kenn Sebesta Date: Mon, 15 Nov 2021 00:35:27 -0500 Subject: [PATCH] [ChibiOS][Windows] Modify `cat` and `grep` sections to work on Windows --- .../os/common/ports/ARMCMx/compilers/GCC/rules.mk | 12 ++++++++++++ ChibiOS_3.0.5/os/hal/hal.mk | 8 +++++++- .../os/hal/ports/STM32/STM32F4xx/platform.mk | 7 ++++++- ChibiOS_3.0.5/os/rt/rt.mk | 9 ++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/rules.mk b/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/rules.mk index 7ed2feb9..c73571f7 100644 --- a/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/rules.mk +++ b/ChibiOS_3.0.5/os/common/ports/ARMCMx/compilers/GCC/rules.mk @@ -168,13 +168,25 @@ ifneq ($(USE_VERBOSE_COMPILE),yes) @echo $(CC) -c $(CFLAGS) -I. $(IINCDIR) main.c -o main.o @echo endif +ifeq ($(OS),Windows_NT) + @mkdir "$(BUILDDIR)" +else @mkdir -p $(BUILDDIR) +endif $(OBJDIR): +ifeq ($(OS),Windows_NT) + @mkdir "$(OBJDIR)" +else @mkdir -p $(OBJDIR) +endif $(LSTDIR): +ifeq ($(OS),Windows_NT) + @mkdir "$(LSTDIR)" +else @mkdir -p $(LSTDIR) +endif $(ACPPOBJS) : $(OBJDIR)/%.o : %.cpp Makefile ifeq ($(USE_VERBOSE_COMPILE),yes) diff --git a/ChibiOS_3.0.5/os/hal/hal.mk b/ChibiOS_3.0.5/os/hal/hal.mk index 074970dc..3d4a6277 100644 --- a/ChibiOS_3.0.5/os/hal/hal.mk +++ b/ChibiOS_3.0.5/os/hal/hal.mk @@ -1,7 +1,13 @@ # List of all the ChibiOS/HAL files, there is no need to remove the files # from this list, you can disable parts of the HAL by editing halconf.h. ifeq ($(USE_SMART_BUILD),yes) -HALCONF := $(strip $(shell cat halconf.h | egrep -e "define")) + +ifeq ($(OS),Windows_NT) + HALCONF := $(strip $(shell pwsh -noprofile -command cat halconf.h | findstr -i define)) +else + HALCONF := $(strip $(shell cat halconf.h | egrep -e "define")) +endif + HALSRC := $(CHIBIOS)/os/hal/src/hal.c \ $(CHIBIOS)/os/hal/src/st.c \ diff --git a/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/platform.mk b/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/platform.mk index 3b6566ef..5f58ea62 100644 --- a/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/platform.mk +++ b/ChibiOS_3.0.5/os/hal/ports/STM32/STM32F4xx/platform.mk @@ -1,6 +1,11 @@ # List of all the STM32F2xx/STM32F4xx platform files. ifeq ($(USE_SMART_BUILD),yes) -HALCONF := $(strip $(shell cat halconf.h | egrep -e "define")) + +ifeq ($(OS),Windows_NT) + HALCONF := $(strip $(shell pwsh -noprofile -command cat halconf.h | findstr -i define)) +else + HALCONF := $(strip $(shell cat halconf.h | egrep -e "define")) +endif PLATFORMSRC := $(CHIBIOS)/os/hal/ports/common/ARMCMx/nvic.c \ $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/stm32_dma.c \ diff --git a/ChibiOS_3.0.5/os/rt/rt.mk b/ChibiOS_3.0.5/os/rt/rt.mk index 715440c2..f9e09f3e 100644 --- a/ChibiOS_3.0.5/os/rt/rt.mk +++ b/ChibiOS_3.0.5/os/rt/rt.mk @@ -1,7 +1,14 @@ # List of all the ChibiOS/RT kernel files, there is no need to remove the files # from this list, you can disable parts of the kernel by editing chconf.h. ifeq ($(USE_SMART_BUILD),yes) -CHCONF := $(strip $(shell cat chconf.h | egrep -e "define")) + +ifeq ($(OS),Windows_NT) + CHCONF := $(strip $(shell pwsh -noprofile -command cat chconf.h | findstr -i define)) +else + CHCONF := $(strip $(shell cat chconf.h | egrep -e "define")), +endif + +#$(info $(CHCONF)) KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \ $(CHIBIOS)/os/rt/src/chdebug.c \