I can compile Chibios code for STM32F103 successfully on my main desktop (x86).
I want to compile code for STM32F103 based board on Raspberry Pi. I have installed GCC on raspberry pi, so I should be able to compile for STM32F103 since gcc on raspberry pi supports these architectures (I believe Cortex-M3 belongs to armv7-m):
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options
Code: Select all
‘armv2’, ‘armv2a’, ‘armv3’, ‘armv3m’, ‘armv4’, ‘armv4t’, ‘armv5’, ‘armv5e’, ‘armv5t’, ‘armv5te’, ‘armv6’, ‘armv6-m’, ‘armv6j’, ‘armv6k’, ‘armv6kz’, ‘armv6s-m’, ‘armv6t2’, ‘armv6z’, ‘armv6zk’, ‘armv7’, ‘armv7-a’, ‘armv7-m’, ‘armv7-r’, ‘armv7e-m’, ‘armv7ve’, ‘armv8-a’, ‘armv8-a+crc’, ‘armv8.1-a’, ‘armv8.1-a+crc’, ‘armv8-m.base’, ‘armv8-m.main’, ‘armv8-m.main+dsp’, ‘iwmmxt’, ‘iwmmxt2’.
But issuing the 'make' commands says
arm-none-eabi-gcc: Command not found
So I changed TRGT variable in Makefile as:
Code: Select all
# Compiler settings
#
MCU = cortex-m3
#TRGT = arm-elf-
##TRGT = arm-none-eabi-
TRGT = #### Changed TRGT
CC = $(TRGT)gcc -march=armv7-m
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
With this change I can get past the arm-none-eabi-gcc not found error. But then this error appears:
../../../os/common/ext/CMSIS/include/core_cm3.h:142:6: error: #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
^~~~~
make: *** [../../../os/common/startup/ARMCMx/compilers/GCC/rules.mk:223: build/obj/crt1.o] Error 1
I tried adding '-mfloat-abi=soft' to gcc, yet it causes another error:
from ../../../os/common/startup/ARMCMx/compilers/GCC/crt1.c:27:
/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
# include <gnu/stubs-soft.h>
^
compilation terminated.
make: *** [../../../os/common/startup/ARMCMx/compilers/GCC/rules.mk:223: build/obj/crt1.o] Error 1
I also noticed that the Makefile already contains:
Code: Select all
# Enables the use of FPU (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif
I have used all my computer-fu skills and can't solve the issue. Any help would be appreciated.