Skip to content

Commit

Permalink
feat(errors): implemenet new error library
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonidotpy committed Mar 26, 2024
1 parent eeb1540 commit 960111e
Show file tree
Hide file tree
Showing 48 changed files with 5,961 additions and 4,956 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

**/.vscode/*
!**/.vscode/extensions.json

compile_commands.json
**/.cache

2 changes: 1 addition & 1 deletion cellboard/Core/Lib/micro-libs
Submodule micro-libs updated 50 files
+13 −0 blinky/CHANGELOG.md
+64 −18 blinky/README.md
+10 −5 blinky/inc/blinky.h
+11 −7 blinky/src/blinky.c
+79 −40 blinky/test/test-blinky.c
+1 −1 bms-monitor/inc/ltc6811.h
+1 −1 bms-monitor/src/ltc6811.c
+3 −3 can-manager/inc/can_manager.h
+2 −0 can-manager/inc/can_manager_can_types.h
+1 −0 can-manager/inc/default_can_manager_config.h
+15 −26 can-manager/src/can_manager.c
+4 −0 docs/.pages
+2 −0 docs/blinky/.pages
+18 −0 docs/blinky/blinky-handler.md
+1 −1 docs/blinky/blinky.md
+31 −0 docs/blinky/operations.md
+3 −0 docs/mcp23017/.pages
+ docs/mcp23017/assets/mcp23017_datasheet.pdf
+4 −0 docs/mcp23017/mcp23017.md
+5 −0 docs/min-heap/.pages
+ docs/min-heap/assets/min-heap.png
+51 −0 docs/min-heap/heap-handler.md
+12 −0 docs/min-heap/min-heap.md
+79 −0 docs/min-heap/operations.md
+6 −0 docs/ring-buffer/.pages
+ docs/ring-buffer/assets/ring-buffer-animation.gif
+46 −0 docs/ring-buffer/buffer-handler.md
+14 −0 docs/ring-buffer/critical-section.md
+73 −0 docs/ring-buffer/operations.md
+10 −0 docs/ring-buffer/ring-buffer.md
+194 −0 mcp23017/README.md
+123 −0 mcp23017/inc/mcp23017.h
+66 −0 mcp23017/src/mcp23017.c
+73 −0 mcp23017/test/Makefile
+172 −0 mcp23017/test/test-mcp23017.c
+0 −88 mcp23017_driver/README.md
+0 −408 mcp23017_driver/mcp23017.c
+0 −246 mcp23017_driver/mcp23017.h
+12 −0 min-heap/CHANGELOG.md
+117 −0 min-heap/README.md
+215 −0 min-heap/inc/min-heap.h
+180 −0 min-heap/src/min-heap.c
+73 −0 min-heap/test/Makefile
+349 −0 min-heap/test/test-min-heap.c
+16 −0 ring-buffer/CHANGELOG.md
+120 −0 ring-buffer/README.md
+235 −0 ring-buffer/inc/ring-buffer.h
+247 −0 ring-buffer/src/ring-buffer.c
+73 −0 ring-buffer/test/Makefile
+537 −0 ring-buffer/test/test-ring-buffer.c
5 changes: 3 additions & 2 deletions cellboard/Core/Src/blink.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ void blink_init(void) {
&blinker,
pattern,
pattern_size,
true
true,
BLINKY_HIGH
);

if (cellboard_index == 0)
blinky_enable(&blink_init, false);
blinky_enable(&blinker, false);
}

BlinkyState blink_routine(uint32_t t) {
Expand Down
26 changes: 12 additions & 14 deletions cellboard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ BUILD_DIR = build
######################################
# C sources
C_SOURCES = \
Core/Src/main.c \
Core/Src/stm32l4xx_it.c \
Core/Src/stm32l4xx_hal_msp.c \
$(shell find Core/Src -type f -name "*.c") \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
Expand All @@ -56,18 +54,15 @@ Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
Core/Src/system_stm32l4xx.c \
Core/Src/gpio.c \
Core/Src/can.c \
Core/Src/i2c.c \
Core/Src/spi.c \
Core/Src/tim.c \
Core/Src/usart.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_can.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \
Core/Lib/can/lib/bms/bms_network.c \
Core/Lib/can/lib/bms/bms_watchdog.c \
$(shell find Core/Lib/micro-libs/timer-utils -type f -name "*.c") \
$(shell find Core/Lib/micro-libs/blinky/src -type f -name "*.c")

# ASM sources
ASM_SOURCES = \
Expand Down Expand Up @@ -124,11 +119,14 @@ AS_INCLUDES =

# C includes
C_INCLUDES = \
-ICore/Inc \
$(addprefix -I,$(shell find Core/Inc -type d)) \
-IDrivers/STM32L4xx_HAL_Driver/Inc \
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
-IDrivers/CMSIS/Include
-IDrivers/CMSIS/Include \
-ICore/Lib/micro-libs/blinky/inc \
-ICore/Lib/micro-libs/timer-utils \
$(addprefix -I,$(shell find Core/Lib/can/lib/bms -type d))


# compile gcc flags
Expand All @@ -149,7 +147,7 @@ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
# LDFLAGS
#######################################
# link script
LDSCRIPT = STM32L432KBUx_FLASH.ld
LDSCRIPT = STM32L432KBUx_FLASH_shifted.ld

# libraries
LIBS = -lc -lm -lnosys
Expand Down
10 changes: 9 additions & 1 deletion cellboard/STM32Make.make
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,24 @@ AS_INCLUDES = \

# C includes
C_INCLUDES = \
-I$(addprefix \
-I,$(shell \
-I-type \
-ICore/Inc \
-ICore/Inc/peripherals \
-ICore/Lib/can/lib/bms \
-ICore/Lib/can/lib/bms/ \
-ICore/Lib/micro-libs/blinky/inc \
-ICore/Lib/micro-libs/blinky/inc/ \
-ICore/Lib/micro-libs/m95256/ \
-ICore/Lib/micro-libs/timer-utils \
-ICore/Lib/micro-libs/timer-utils/ \
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
-IDrivers/CMSIS/Include \
-IDrivers/STM32L4xx_HAL_Driver/Inc \
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
-Id)) \
-Ifind



Expand Down
201 changes: 201 additions & 0 deletions cellboard/custom-makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
##########################################################################################################################
# File automatically-generated by tool: [projectgenerator] version: [3.19.2] date: [Wed Jul 26 10:12:05 CEST 2023]
##########################################################################################################################

# ------------------------------------------------
# Generic Makefile (based on gcc)
#
# ChangeLog :
# 2017-02-10 - Several enhancements + project update mode
# 2015-07-22 - first version
# ------------------------------------------------

######################################
# target
######################################
TARGET = cellboard


######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Og


#######################################
# paths
#######################################
# Build path
BUILD_DIR = build

######################################
# source
######################################
# C sources
C_SOURCES = \
$(shell find Core/Src -type f -name "*.c") \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_can.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \
Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \
Core/Lib/can/lib/bms/bms_network.c \
Core/Lib/can/lib/bms/bms_watchdog.c \
$(shell find Core/Lib/micro-libs/timer-utils -type f -name "*.c") \
$(shell find Core/Lib/micro-libs/blinky/src -type f -name "*.c")

# ASM sources
ASM_SOURCES = \
startup_stm32l432xx.s


#######################################
# binaries
#######################################
PREFIX = arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

#######################################
# CFLAGS
#######################################
# cpu
CPU = -mcpu=cortex-m4

# fpu
FPU = -mfpu=fpv4-sp-d16

# float-abi
FLOAT-ABI = -mfloat-abi=hard

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

# macros for gcc
# AS defines
AS_DEFS =

# C defines
C_DEFS = \
-DUSE_HAL_DRIVER \
-DSTM32L432xx


# AS includes
AS_INCLUDES =

# C includes
C_INCLUDES = \
$(addprefix -I,$(shell find Core/Inc -type d)) \
-IDrivers/STM32L4xx_HAL_Driver/Inc \
-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \
-IDrivers/CMSIS/Device/ST/STM32L4xx/Include \
-IDrivers/CMSIS/Include \
-ICore/Lib/micro-libs/blinky/inc \
-ICore/Lib/micro-libs/timer-utils \
$(addprefix -I,$(shell find Core/Lib/can/lib/bms -type d))


# 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
endif


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


#######################################
# LDFLAGS
#######################################
# link script
LDSCRIPT = STM32L432KBUx_FLASH_shifted.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 ***
8 changes: 5 additions & 3 deletions mainboard/Inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

#ifndef _CONFIG_H_
#define _CONFIG_H_
#include "m95256.h"

#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>

#include "m95256.h"

#define CONFIG_VERSION_TYPE uint32_t
#define CONFIG_VERSION_SIZE sizeof(CONFIG_VERSION_TYPE)
Expand Down Expand Up @@ -75,4 +77,4 @@ void *config_get(config_t *config);
*/
void config_set(config_t *config, void *data);

#endif
#endif

0 comments on commit 960111e

Please sign in to comment.