2025-10-14 20:01:56 -05:00
2025-10-14 19:38:23 -05:00
2025-10-14 20:01:56 -05:00
2025-10-14 19:38:23 -05:00
2025-10-14 20:01:56 -05:00
2025-10-14 20:01:56 -05:00
2025-10-14 20:01:56 -05:00
2025-10-19 05:33:04 -05:00
2025-10-14 19:38:23 -05:00
2025-10-14 19:38:23 -05:00
2025-10-14 19:38:23 -05:00

this is so jank

STM32 seems so very not designed to work with C++, but you can absolutely make it work.

This project should compile from C++ as long as your arm-none-eabi-g++ is new enough... works on my machine anyways

Try this

Change this part of Makefile below line 79 if you're not me:

#ifdef GCC_PATH
GCC_PATH = $(HOME)/.arm-gcc/bin
CC = $(GCC_PATH)/$(PREFIX)gcc
CXX = $(GCC_PATH)/$(PREFIX)g++
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
#else
#CC = $(PREFIX)gcc
#AS = $(PREFIX)gcc -x assembler-with-cpp
#CP = $(PREFIX)objcopy
#SZ = $(PREFIX)size
#endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

to this:

ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
CXX = $(GCC_PATH)/$(PREFIX)g++
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

Not for release. See:

./Drivers/CMSIS/Documentation/General/html/LICENSE.txt
./Drivers/CMSIS/Device/ST/STM32F4xx/LICENSE.txt
./Drivers/CMSIS/DSP/ComputeLibrary/LICENSE.txt
./Drivers/CMSIS/LICENSE.txt
./Drivers/STM32F4xx_HAL_Driver/LICENSE.txt
Description
proof it works: C++ in Makefile project for STM32
Readme 5.2 MiB
Languages
C 95.3%
Assembly 4.5%
CMake 0.2%