Skip to content

Commit

Permalink
Trying to use STM Workbench generated makefile for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
stancecoke committed Apr 26, 2022
1 parent 334c29b commit 076508c
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<listOptionValue builtIn="false" value="STM32F103x6"/>
</option>
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other.1266006567" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-fmessage-length=0" valueType="string"/>
<option id="gnu.c.compiler.option.optimization.flags.550188118" name="Other optimization flags" superClass="gnu.c.compiler.option.optimization.flags" useByScannerDiscovery="false" value="" valueType="string"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.1824825171" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.1009274133" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
Expand Down Expand Up @@ -113,7 +114,7 @@
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Inc"/>
<entry excluding="system_stm32f1xx_Bootloader.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry excluding="display_ebics.c|system_stm32f1xx_Bootloader.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
</sourceEntries>
</configuration>
Expand Down Expand Up @@ -219,7 +220,7 @@
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Inc"/>
<entry excluding="system_stm32f1xx_Bootloader.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry excluding="display_ebics.c|system_stm32f1xx_Bootloader.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
</sourceEntries>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-485437579104132158" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-518341571170989868" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand All @@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-485437579104132158" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-518341571170989868" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//Src/display_kingmeter.c=UTF-8
73 changes: 73 additions & 0 deletions Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c

OBJS += \
build/stm32f1xx_hal.o \
build/stm32f1xx_hal_adc.o \
build/stm32f1xx_hal_adc_ex.o \
build/stm32f1xx_hal_cortex.o \
build/stm32f1xx_hal_dma.o \
build/stm32f1xx_hal_flash.o \
build/stm32f1xx_hal_flash_ex.o \
build/stm32f1xx_hal_gpio.o \
build/stm32f1xx_hal_gpio_ex.o \
build/stm32f1xx_hal_pwr.o \
build/stm32f1xx_hal_rcc.o \
build/stm32f1xx_hal_rcc_ex.o \
build/stm32f1xx_hal_tim.o \
build/stm32f1xx_hal_tim_ex.o \
build/stm32f1xx_hal_uart.o

C_DEPS += \
build/stm32f1xx_hal.d \
build/stm32f1xx_hal_adc.d \
build/stm32f1xx_hal_adc_ex.d \
build/stm32f1xx_hal_cortex.d \
build/stm32f1xx_hal_dma.d \
build/stm32f1xx_hal_flash.d \
build/stm32f1xx_hal_flash_ex.d \
build/stm32f1xx_hal_gpio.d \
build/stm32f1xx_hal_gpio_ex.d \
build/stm32f1xx_hal_pwr.d \
build/stm32f1xx_hal_rcc.d \
build/stm32f1xx_hal_rcc_ex.d \
build/stm32f1xx_hal_tim.d \
build/stm32f1xx_hal_tim_ex.d \
build/stm32f1xx_hal_uart.d

INC_PATH = INC
DRIVERS_PATH = Drivers/STM32F1xx_HAL_Driver/Inc
LEGACY_PATH = Drivers/STM32F1xx_HAL_Driver/Inc/Legacy
DEVICE_PATH = Drivers/CMSIS/Device/ST/STM32F1xx/Include
CMSIS_PATH = Drivers/CMSIS/Include


# Each subdirectory must supply rules for building sources it contributes
build/%.o: Drivers/STM32F1xx_HAL_Driver/Src/%.c
@echo 'Building file: $<'
@echo 'Invoking: MCU GCC Compiler'
@echo $(PWD)
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft '-D__weak=__attribute__((weak))' -DARM_MATH_CM3 '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F103x6 -I $(INC_PATH) -I $(DRIVERS_PATH) -I $(LEGACY_PATH) -I $(DEVICE_PATH) -I $(CMSIS_PATH) -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '


5 changes: 2 additions & 3 deletions Makefile → Makefile_cas
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Src/stm32f1xx_it.c \
Src/print.c \
Src/stm32f1xx_hal_msp.c \
Src/display_bafang.c \
Src/display_ebics.c \
Src/display_kingmeter.c \
Src/display_kunteng.c \
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
Expand Down Expand Up @@ -127,9 +126,9 @@ C_INCLUDES = \


# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections

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

ifeq ($(DEBUG), 1)
CFLAGS += -g3
Expand Down
3 changes: 1 addition & 2 deletions STM32F103C6Tx_FLASH.ld
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 10K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 30K
EMULATED_EEPROM (rwx) : ORIGIN = 0x08007800, LENGTH = 2K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
}

/* Define output sections */
Expand Down
58 changes: 58 additions & 0 deletions Src/subdir.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
Src/FOC.c \
Src/display_bafang.c \
Src/display_kingmeter.c \
Src/display_kunteng.c \
Src/eeprom.c \
Src/main.c \
Src/print.c \
Src/stm32f1xx_hal_msp.c \
Src/stm32f1xx_it.c \
Src/system_stm32f1xx_Bootloader.c

OBJS += \
build/FOC.o \
build/display_bafang.o \
build/display_kingmeter.o \
build/display_kunteng.o \
build/eeprom.o \
build/main.o \
build/print.o \
build/stm32f1xx_hal_msp.o \
build/stm32f1xx_it.o \
build/system_stm32f1xx_Bootloader.o

C_DEPS += \
build/FOC.d \
build/display_bafang.d \
build/display_kingmeter.d \
build/display_kunteng.d \
build/eeprom.d \
build/main.d \
build/print.d \
build/stm32f1xx_hal_msp.d \
build/stm32f1xx_it.d \
build/system_stm32f1xx_Bootloader.d

INC_PATH = INC
DRIVERS_PATH = Drivers/STM32F1xx_HAL_Driver/Inc
LEGACY_PATH = Drivers/STM32F1xx_HAL_Driver/Inc/Legacy
DEVICE_PATH = Drivers/CMSIS/Device/ST/STM32F1xx/Include
CMSIS_PATH = Drivers/CMSIS/Include


# Each subdirectory must supply rules for building sources it contributes
build/%.o: Src/%.c
@echo 'Building file: $<'
@echo 'Invoking: MCU GCC Compiler'
@echo $(PWD)
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft '-D__weak=__attribute__((weak))' -DARM_MATH_CM3 '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F103x6 -I $(INC_PATH) -I $(DRIVERS_PATH) -I $(LEGACY_PATH) -I $(DEVICE_PATH) -I $(CMSIS_PATH) -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '


3 changes: 1 addition & 2 deletions Start_Compiling.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ copy subdir_startup.mk startup\subdir.mk

copy STLINK_FLASH.ld ..\STM32F103C6Tx_FLASH.ld
copy STLINK_system_stm32f1xx.c ..\Src\system_stm32f1xx.c

pause
make all

ST-LINK_CLI.exe -c SWD -P LishuiFOC_01.hex -V

pause

exit
File renamed without changes.
22 changes: 22 additions & 0 deletions Startup/subdir.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
S_SRCS += \
Startup/startup_stm32f103x6.s

OBJS += \
build/startup_stm32f103x6.o


# Each subdirectory must supply rules for building sources it contributes
build/%.o: Startup/%.s
@echo 'Building file: $<'
@echo 'Invoking: MCU GCC Assembler'
@echo $(PWD)
arm-none-eabi-as -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -g -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '


61 changes: 61 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include startup/subdir.mk
-include Src/subdir.mk
-include Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include makefile.defs

SRC_PATH = Drivers/CMSIS

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: LishuiFOC_01.elf

# Tool invocations
LishuiFOC_01.elf: $(OBJS) $(USER_OBJS) STM32F103C6Tx_FLASH_Bootloader.ld
@echo 'Building target: $@'
@echo 'Invoking: MCU GCC Linker'
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -L $(SRC_PATH) -specs=nosys.specs -specs=nano.specs -T"STM32F103C6Tx_FLASH_Bootloader.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "build/EBiCS_Firmware.elf" @"objects.list" $(USER_OBJS) $(LIBS) -lm
@echo 'Finished building target: $@'
@echo ' '
$(MAKE) --no-print-directory post-build

# Other Targets
clean:
-$(RM) *
-@echo ' '

post-build:
-@echo 'Generating hex and Printing size information:'
arm-none-eabi-objcopy -O ihex "build/EBiCS_Firmware.elf" "build/EBiCS_Firmware.hex"
arm-none-eabi-objcopy -O binary "build/EBiCS_Firmware.elf" "build/EBiCS_Firmware.bin"
arm-none-eabi-size "build/EBiCS_Firmware.elf"
stat "build/EBiCS_Firmware.bin"
-@echo ' '


.PHONY: all clean dependents
.SECONDARY: post-build

-include makefile.targets
26 changes: 26 additions & 0 deletions objects.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"build/stm32f1xx_hal.o"
"build/stm32f1xx_hal_adc.o"
"build/stm32f1xx_hal_adc_ex.o"
"build/stm32f1xx_hal_cortex.o"
"build/stm32f1xx_hal_dma.o"
"build/stm32f1xx_hal_flash.o"
"build/stm32f1xx_hal_flash_ex.o"
"build/stm32f1xx_hal_gpio.o"
"build/stm32f1xx_hal_gpio_ex.o"
"build/stm32f1xx_hal_pwr.o"
"build/stm32f1xx_hal_rcc.o"
"build/stm32f1xx_hal_rcc_ex.o"
"build/stm32f1xx_hal_tim.o"
"build/stm32f1xx_hal_tim_ex.o"
"build/stm32f1xx_hal_uart.o"
"build/FOC.o"
"build/display_bafang.o"
"build/display_kingmeter.o"
"build/display_kunteng.o"
"build/eeprom.o"
"build/main.o"
"build/print.o"
"build/stm32f1xx_hal_msp.o"
"build/stm32f1xx_it.o"
"build/system_stm32f1xx_Bootloader.o"
"build/startup_stm32f103x6.o"
8 changes: 8 additions & 0 deletions objects.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS :=

LIBS := -larm_cortexM3l_math

21 changes: 21 additions & 0 deletions sources.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################

OBJ_SRCS :=
S_SRCS :=
ASM_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
O_SRCS :=
EXECUTABLES :=
OBJS :=
S_UPPER_DEPS :=
C_DEPS :=

# Every subdirectory with source files must be described here
SUBDIRS := \
Drivers/STM32F1xx_HAL_Driver/Src \
Src \
startup \

0 comments on commit 076508c

Please sign in to comment.