Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: reorganise source files #200

Merged
merged 4 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"limits": "c",
"ready_to_drive.h": "c",
"vcu.h": "c",
"stm32f7xx_hal_def.h": "c"
"stm32f7xx_hal_def.h": "c",
"bps.h": "c"
},
"cortex-debug.variableUseNaturalFormat": false,
"C_Cpp.errorSquiggles": "Enabled",
Expand Down
32 changes: 17 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ src/SUFST/Src/vcu.c \
src/SUFST/Src/init.c \
src/SUFST/Src/config_rules.c \
src/SUFST/Src/ready_to_drive.c \
src/SUFST/Src/apps.c \
src/SUFST/Src/scs.c \
src/SUFST/Src/bps.c \
src/SUFST/Src/shutdown.c \
src/SUFST/Src/ts_control.c \
src/SUFST/Src/driver_control.c \
src/SUFST/Src/CAN/canbc.c \
src/SUFST/Src/CAN/pm100.c \
src/SUFST/Src/Profiles/driver_profiles.c \
src/SUFST/Src/Profiles/driver_profile_data.c \
src/SUFST/Src/Sensors/apps.c \
src/SUFST/Src/Sensors/scs.c \
src/SUFST/Src/Sensors/bps.c \
src/SUFST/Src/Tasks/ts_control.c \
src/SUFST/Src/Tasks/driver_control.c \
src/SUFST/Src/Test/testbench.c \
src/SUFST/Src/Test/apps_testbench_data.c \
src/SUFST/Src/Test/trace.c \
Expand Down Expand Up @@ -331,6 +331,8 @@ C_INCLUDES = \
-Isrc/SUFST/Inc \
-Isrc/SUFST/Inc/CAN \
-Isrc/SUFST/Inc/Profiles \
-Isrc/SUFST/Inc/Sensors \
-Isrc/SUFST/Inc/Tasks \
-Isrc/SUFST/Inc/Test \
-Isrc/SUFST/Inc/Threads \
-Isrc/Drivers/STM32F7xx_HAL_Driver/Inc \
Expand Down Expand Up @@ -398,48 +400,48 @@ all:
# pre build
.PHONY: prebuild
prebuild:
tput setaf 5; tput bold; echo "Compiling..."; tput sgr0
@tput setaf 5; tput bold; echo "Compiling..."; tput sgr0

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

# ASM
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) prebuild
echo "$<"
@echo "$<"
$(AS) -c $(CFLAGS) $< -o $@

# .elf
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
tput setaf 5; tput bold; echo; echo "Linking..."; tput sgr0
@tput setaf 5; tput bold; echo; echo "Linking..."; tput sgr0
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
tput setaf 2; echo "$@"; echo; tput sgr0
@tput setaf 2; echo "$@"; echo; tput sgr0

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

# .bin
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) prebuild
tput setaf 5; tput bold; echo "Creating binary..."; tput sgr0
@tput setaf 5; tput bold; echo "Creating binary..."; tput sgr0
$(BIN) $< $@
tput setaf 2; echo "$@"; echo; tput sgr0
@tput setaf 2; echo "$@"; echo; tput sgr0

# create build directory
$(BUILD_DIR):
mkdir -p $@

# clean
clean:
tput setaf 5; tput bold; echo "Cleaning build directory..."
@tput setaf 5; tput bold; echo "Cleaning build directory..."; tput sgr0
-rm -fR $(BUILD_DIR)
tput sgr0; tput setaf 2; echo "Done"; tput sgr0
@tput setaf 2; echo "Done"; tput sgr0

# flash
flash: $(BUILD_DIR)/$(TARGET).bin
tput setaf 5; tput bold; echo "Flashing..."; tput sgr0
@tput setaf 5; tput bold; echo "Flashing..."; tput sgr0
st-flash write $< 0x08000000

###############################################################################
Expand Down
5 changes: 2 additions & 3 deletions src/SUFST/Inc/apps.h → src/SUFST/Inc/Sensors/apps.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file apps.h
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-06-29
* @brief APPS input function prototypes
* @author Tim Brewis (@t-bre)
* @brief Accelerator pedal position sensor
***************************************************************************/

#ifndef APPS_H
Expand Down
5 changes: 2 additions & 3 deletions src/SUFST/Inc/bps.h → src/SUFST/Inc/Sensors/bps.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file bps.h
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-07-02
* @brief BPS input function prototypes
* @author Tim Brewis (@t-bre)
* @brief Brake pressure sensor
***************************************************************************/

#ifndef BPS_H
Expand Down
5 changes: 2 additions & 3 deletions src/SUFST/Inc/scs.h → src/SUFST/Inc/Sensors/scs.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file scs.h
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-07-02
* @brief Safety critical signal interface typedef and function prototypes
* @brief System critical signals
***************************************************************************/

#ifndef SCS_H
Expand All @@ -14,7 +13,7 @@
#include "adc.h"

/**
* @brief Analogue safety critical signal
* @brief Analogue system critical signal
*/
typedef struct
{
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/SUFST/Src/apps.c → src/SUFST/Src/Sensors/apps.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file apps.c
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-06-29
* @brief APPS input implementation
* @brief Accelerator pedal position sensor
***************************************************************************/

#include "apps.h"
Expand Down
3 changes: 1 addition & 2 deletions src/SUFST/Src/bps.c → src/SUFST/Src/Sensors/bps.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file bps.h
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-07-02
* @brief BPS input implementation
* @brief Brake pressure sensor
***************************************************************************/

#include "bps.h"
Expand Down
5 changes: 2 additions & 3 deletions src/SUFST/Src/scs.c → src/SUFST/Src/Sensors/scs.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/***************************************************************************
* @file scs.c
* @author Tim Brewis (@t-bre, [email protected])
* @date 2022-07-02
* @brief Safety critical signal interface implementation
* @author Tim Brewis (@t-bre)
* @brief System critical signals
***************************************************************************/

#include "scs.h"
Expand Down
File renamed without changes.
File renamed without changes.