STM32F103C8T6 GCC problems in portmacro.h

Good afternoon and thank you for response!

I try use:

  1. change -std=gnu99 to -std=gnu11

  2. change portmacro.h:
    it was:
    #define portINLINE __inline

    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE __forceinline
    // __forceinline
    #endif
    it became:
    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE inline attribute(( always_inline))
    #endif

  3. change portmacro.h:
    it was:
    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE inline attribute(( always_inline))
    #endif
    it became:
    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE __inline attribute((always_inline))
    // __forceinline
    #endif

  4. change -std=gnu99 to -std=gnu11 and:
    it was:
    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE inline attribute(( always_inline))
    #endif
    it became:
    #ifndef portFORCE_INLINE
    #define portFORCE_INLINE __inline attribute((always_inline))
    // __forceinline
    #endif

But I not found compilation problem.

I’m applying makefile:

GCCPath

GCC_PATH = /usr/bin

#Target name
TARGET = STM32F103C8T6

#output folder
BUILD_DIR = .

CThe library used by the source is written here.

C_SOURCES =
main.c
led.h
STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_gpio.c
STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_rcc.c
STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport/core_cm3.c
STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/system_stm32f10x.c
STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Template/stm32f10x_conf.h
FreeRTOS/Source/croutine.c
FreeRTOS/Source/tasks.c
FreeRTOS/Source/list.c
FreeRTOS/Source/queue.c
FreeRTOS/Source/timers.c
FreeRTOS/Source/portable/GCC/ARM_CM3/port.c
FreeRTOS/Source/portable/MemMang/heap_4.c
#Libraries/src/stm32f10x_usart.c
##User/bsp_usart.c
#Libraries/src/misc.c
##User/stm32f10x_it.c
##FreeRTOS/Source/portable/IAR/ARM_CM3/portasm.s \

######################################

######################################
vpath %.h STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport
vpath %.c STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport

vpath %.h STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/
vpath %.c STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/

vpath %.h STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Template/
vpath %.c STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Template/

ASM sources

ASM_SOURCES =
Startup/startup_stm32f10x_md.s

######################################

building variables

######################################

debug build?

DEBUG = 1

optimization

OPT = -Og

#######################################

binaries

#######################################
PREFIX = arm-none-eabi-
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

#######################################

CFLAGS

#######################################

cpu

CPU = -mcpu=cortex-m3

fpu

NONE for Cortex-M0/M0+/M3

float-abi

mcu

MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)

macros for gcc

AS defines

AS_DEFS =

C defines

C_DEFS =
-DUSE_STDPERIPH_DRIVER
-DSTM32F10X_MD

AS includes

AS_INCLUDES =
-IFreeRTOS\Source

C includes

C_INCLUDES =
-ISTM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/CoreSupport
-ISTM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x
-ISTM32F10x_StdPeriph_Lib_V3.5.0/Libraries/inc
-ISTM32F10x_StdPeriph_Lib_V3.5.0/Libraries/src
-IStartup
-IUser
-IFreeRTOS/Source/include
-IFreeRTOS/Source/portable/GCC/ARM_CM3
-IFreeRTOS/Source

compile gcc flags

ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections

ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2 -std=gnu99
endif

Generate dependency information

CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"

#######################################

LDFLAGS

#######################################

link script

LDSCRIPT = STM32F103C8Tx_FLASH.ld

libraries

LIBS = -lc -lm -lnosys
LIBDIR =
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,–cref -Wl,–gc-sections

default action: build all

all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin

#######################################

build the application

#######################################

list of objects

OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))

list of ASM program objects

OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))

$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@

$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@

$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@

$(BUILD_DIR):
mkdir $@

#######################################

clean up

#######################################
clean:
-rm -fR $(BUILD_DIR)

#######################################

dependencies

#######################################
-include $(wildcard $(BUILD_DIR)/*.d)

*** EOF ***

It is old version, that i found in the Internet. URL: https
://programmersought.com/article/ 37191392504/

My experience is not enough for solve this problem. I try use differents makefile. If you have makefile for {stm32f103c8t6 + gcc + SPL}, please, share it.