Skip to content

Commit 0674885

Browse files
committed
added workflow again..
1 parent 1505068 commit 0674885

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build STM32 Project
2+
3+
on:
4+
push:
5+
branches: ["master", "workflows"]
6+
pull_request:
7+
branches: ["master", "workflows"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
17+
- name: Install ARM GCC toolchain
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y gcc-arm-none-eabi
21+
22+
- name: Build project
23+
run: make

makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
PROJECT := Team2_DART_Firmware
2+
BUILD_DIR := build
3+
SRC_DIR := Core/Src
4+
INC_DIR := Core/Inc
5+
6+
HAL_INC_DIR := Drivers/STM32H7xx_HAL_Driver/Inc
7+
CMSIS_DEVICE_INC_DIR := Drivers/CMSIS/Device/ST/STM32H7xx/Include
8+
CMSIS_CORE_INC_DIR := Drivers/CMSIS/Include
9+
10+
CC := arm-none-eabi-gcc
11+
CP := arm-none-eabi-objcopy
12+
SZ := arm-none-eabi-size
13+
14+
CPU := -mcpu=cortex-m7
15+
FPU := -mfpu=fpv5-d16
16+
FLOAT_ABI := -mfloat-abi=hard
17+
MCU_FLAGS := $(CPU) -mthumb $(FPU) $(FLOAT_ABI)
18+
19+
CFLAGS := $(MCU_FLAGS) -g -O2 -Wall -ffunction-sections -fdata-sections --specs=nano.specs -static -fno-common
20+
CDEFS := -DSTM32H743xx -DUSE_HAL_DRIVER
21+
CINCLUDES := -I$(INC_DIR) -I$(HAL_INC_DIR) -I$(CMSIS_DEVICE_INC_DIR) -I$(CMSIS_CORE_INC_DIR)
22+
23+
LDSCRIPT := STM32H743VITX_FLASH.ld
24+
LDFLAGS := $(MCU_FLAGS) -T$(LDSCRIPT) -Wl,-Map=$(BUILD_DIR)/$(PROJECT).map,--gc-sections
25+
26+
C_SOURCES := $(wildcard $(SRC_DIR)/*.c)
27+
OBJ_FILES := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(C_SOURCES))
28+
29+
all: $(BUILD_DIR) $(BUILD_DIR)/$(PROJECT).elf
30+
31+
$(BUILD_DIR):
32+
mkdir -p $(BUILD_DIR)
33+
34+
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
35+
@echo "[CC] $<"
36+
mkdir -p $(dir $@)
37+
$(CC) $(CFLAGS) $(CDEFS) $(CINCLUDES) -c $< -o $@
38+
39+
$(BUILD_DIR)/$(PROJECT).elf: $(OBJ_FILES) | $(BUILD_DIR)
40+
@echo "[LD] $@"
41+
$(CC) $^ $(LDFLAGS) -o $@
42+
$(SZ) $@
43+
44+
clean:
45+
rm -rf $(BUILD_DIR)
46+
47+
.PHONY: all clean

0 commit comments

Comments
 (0)