diff --git a/firmware/boards/f1_common/openblt/Makefile b/firmware/boards/f1_common/openblt/Makefile new file mode 100644 index 0000000..76a1556 --- /dev/null +++ b/firmware/boards/f1_common/openblt/Makefile @@ -0,0 +1,195 @@ +#**************************************************************************************** +#| Description: Makefile for GNU ARM Embedded toolchain. +#| File Name: makefile +#| +#|--------------------------------------------------------------------------------------- +#| C O P Y R I G H T +#|--------------------------------------------------------------------------------------- +#| Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +#| +#|--------------------------------------------------------------------------------------- +#| L I C E N S E +#|--------------------------------------------------------------------------------------- +#| This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +#| modify it under the terms of the GNU General Public License as published by the Free +#| Software Foundation, either version 3 of the License, or (at your option) any later +#| version. +#| +#| OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +#| without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +#| PURPOSE. See the GNU General Public License for more details. +#| +#| You have received a copy of the GNU General Public License along with OpenBLT. It +#| should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +#| +#**************************************************************************************** +SHELL = sh + +#|--------------------------------------------------------------------------------------| +#| Configure project name | +#|--------------------------------------------------------------------------------------| +PROJ_NAME=openblt_$(BOARD) + +#|--------------------------------------------------------------------------------------| +#| Configure OpenBLT path | +#|--------------------------------------------------------------------------------------| +OPENBLT_PATH=../../../ext/openblt/Target +OPENBLT_COMMON_PATH=../../f1_common/openblt + +#|--------------------------------------------------------------------------------------| +#| Configure tool path | +#|--------------------------------------------------------------------------------------| +# Compiler should be in PATH + +#|--------------------------------------------------------------------------------------| +#| Collect project files | +#|--------------------------------------------------------------------------------------| +# Recursive wildcard function implementation. Example usages: +# $(call rwildcard, , *.c *.h) +# --> Returns all *.c and *.h files in the current directory and below +# $(call rwildcard, /lib/, *.c) +# --> Returns all *.c files in the /lib directory and below +rwildcard = $(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))) + +# Collect all application files in the current directory and its subdirectories, but +# exclude flash-layout.c as this one is directly included in a source file, when used. +PROJ_FILES = $(filter-out flash_layout.c, $(call rwildcard, , *.c *.h *.s)) +# Collect common files +PROJ_FILES += $(wildcard $(OPENBLT_COMMON_PATH)/*.c) +PROJ_FILES += $(wildcard $(OPENBLT_COMMON_PATH)/*.h) +PROJ_FILES += $(wildcard $(OPENBLT_COMMON_PATH)/lib/*.c) +PROJ_FILES += $(wildcard $(OPENBLT_COMMON_PATH)/lib/*.h) +# Collect bootloader core files +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.c) +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.h) +# Collect bootloader port files +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.c) +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.h) +# Collect bootloader port compiler specific files +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.c) +PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.h) +# reuse ST32F1xx HAL and CMSIS from one of OpenBLT exaples to avoid having copy in this git +PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/CMSIS, *.c *.h *.s)) +PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/STM32F1xx_HAL_Driver/, *.c *.h *.s)) + + +#|--------------------------------------------------------------------------------------| +#| Toolchain binaries | +#|--------------------------------------------------------------------------------------| +RM = rm +CC = $(TOOL_PATH)arm-none-eabi-gcc +LN = $(TOOL_PATH)arm-none-eabi-gcc +OC = $(TOOL_PATH)arm-none-eabi-objcopy +OD = $(TOOL_PATH)arm-none-eabi-objdump +AS = $(TOOL_PATH)arm-none-eabi-gcc +SZ = $(TOOL_PATH)arm-none-eabi-size + + +#|--------------------------------------------------------------------------------------| +#| Filter project files +#|--------------------------------------------------------------------------------------| +PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) +PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) +PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) + + +#|--------------------------------------------------------------------------------------| +#| Set important path variables | +#|--------------------------------------------------------------------------------------| +VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :) +OBJ_PATH = obj +BIN_PATH = bin +INC_PATH += -I../io +INC_PATH += $(patsubst %/,%,$(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file)))))) +LIB_PATH = + + +#|--------------------------------------------------------------------------------------| +#| Options for toolchain binaries | +#|--------------------------------------------------------------------------------------| +STDFLAGS = -mcpu=cortex-m3 -mthumb -std=gnu11 -fstack-usage -Wall -specs=nano.specs +STDFLAGS += -fdata-sections -ffunction-sections -Wall -g -Wno-strict-aliasing +OPTFLAGS = -Os +CFLAGS = $(STDFLAGS) $(OPTFLAGS) +CFLAGS += -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DSTM32F103xB +CFLAGS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" +CFLAGS += $(INC_PATH) +AFLAGS = $(CFLAGS) +LFLAGS = $(STDFLAGS) $(OPTFLAGS) +LFLAGS += -Wl,-script="$(OPENBLT_COMMON_PATH)/STM32F103RB_FLASH.ld" -Wl,-Map=$(BIN_PATH)/$(PROJ_NAME).map +LFLAGS += -Wl,--gc-sections $(LIB_PATH) +OFLAGS = -O srec +ODFLAGS = -x +SZFLAGS = -B -d +RMFLAGS = -f + + +#|--------------------------------------------------------------------------------------| +#| Specify library files | +#|--------------------------------------------------------------------------------------| +LIBS = + + +#|--------------------------------------------------------------------------------------| +#| Define targets | +#|--------------------------------------------------------------------------------------| +AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS)) +COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS)) + + +#|--------------------------------------------------------------------------------------| +#| Make ALL | +#|--------------------------------------------------------------------------------------| +.PHONY: all +all: $(BIN_PATH)/$(PROJ_NAME).srec $(BIN_PATH)/$(PROJ_NAME).hex $(BIN_PATH)/$(PROJ_NAME).bin + + +$(BIN_PATH)/$(PROJ_NAME).srec : $(BIN_PATH)/$(PROJ_NAME).elf + @$(OC) $< $(OFLAGS) $@ + @$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map + @echo +++ Summary of memory consumption: + @$(SZ) $(SZFLAGS) $< + @echo +++ Build complete [$(notdir $@)] + +$(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf + @mkdir -p $(@D) + @$(OC) -O ihex $< $@ + +$(BIN_PATH)/$(PROJ_NAME).bin : $(BIN_PATH)/$(PROJ_NAME).elf + @mkdir -p $(@D) + @$(OC) -O binary $< $@ + +$(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS) + @echo +++ Linking [$(notdir $@)] + @mkdir -p $(BIN_PATH) + @$(LN) $(LFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F)) $(LIBS) + + +#|--------------------------------------------------------------------------------------| +#| Compile and assemble | +#|--------------------------------------------------------------------------------------| +$(AOBJS): %.o: %.s $(PROJ_CHDRS) + @mkdir -p $(OBJ_PATH) + @echo +++ Assembling [$(notdir $<)] + @$(AS) $(AFLAGS) -c $< -o $(OBJ_PATH)/$(@F) + +$(COBJS): %.o: %.c $(PROJ_CHDRS) + @mkdir -p $(OBJ_PATH) + @echo +++ Compiling [$(notdir $<)] + @$(CC) $(CFLAGS) -c $< -o $(OBJ_PATH)/$(@F) + + +#|--------------------------------------------------------------------------------------| +#| Make CLEAN | +#|--------------------------------------------------------------------------------------| +.PHONY: clean +clean: + @echo +++ Cleaning build environment + @$(RM) $(RMFLAGS) $(foreach file,$(AOBJS),$(OBJ_PATH)/$(file)) + @$(RM) $(RMFLAGS) $(foreach file,$(COBJS),$(OBJ_PATH)/$(file)) + @$(RM) $(RMFLAGS) $(patsubst %.o,%.lst,$(foreach file,$(COBJS),$(OBJ_PATH)/$(file))) + @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).elf $(BIN_PATH)/$(PROJ_NAME).map + @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).srec + @$(RM) $(RMFLAGS) -r $(OBJ_PATH) + @$(RM) $(RMFLAGS) -r $(BIN_PATH) + @echo +++ Clean complete diff --git a/firmware/boards/f1_rev2/openblt/STM32F103RB_FLASH.ld b/firmware/boards/f1_common/openblt/STM32F103RB_FLASH.ld similarity index 100% rename from firmware/boards/f1_rev2/openblt/STM32F103RB_FLASH.ld rename to firmware/boards/f1_common/openblt/STM32F103RB_FLASH.ld diff --git a/firmware/boards/f1_rev2/openblt/hooks.c b/firmware/boards/f1_common/openblt/hooks.c similarity index 100% rename from firmware/boards/f1_rev2/openblt/hooks.c rename to firmware/boards/f1_common/openblt/hooks.c diff --git a/firmware/boards/f1_rev2/openblt/led.c b/firmware/boards/f1_common/openblt/led.c similarity index 96% rename from firmware/boards/f1_rev2/openblt/led.c rename to firmware/boards/f1_common/openblt/led.c index fd5b719..a4316a4 100644 --- a/firmware/boards/f1_rev2/openblt/led.c +++ b/firmware/boards/f1_common/openblt/led.c @@ -6,7 +6,7 @@ #include "stm32f1xx.h" /* STM32 registers and drivers */ #include "stm32f1xx_ll_gpio.h" /* STM32 LL GPIO header */ -#include "../io/io_pins.h" +#include "io_pins.h" /**************************************************************************************** * Local data declarations diff --git a/firmware/boards/f1_rev2/openblt/led.h b/firmware/boards/f1_common/openblt/led.h similarity index 100% rename from firmware/boards/f1_rev2/openblt/led.h rename to firmware/boards/f1_common/openblt/led.h diff --git a/firmware/boards/f1_rev2/openblt/lib/stm32f1xx_hal_conf.h b/firmware/boards/f1_common/openblt/lib/stm32f1xx_hal_conf.h similarity index 100% rename from firmware/boards/f1_rev2/openblt/lib/stm32f1xx_hal_conf.h rename to firmware/boards/f1_common/openblt/lib/stm32f1xx_hal_conf.h diff --git a/firmware/boards/f1_rev2/openblt/lib/system_stm32f1xx.c b/firmware/boards/f1_common/openblt/lib/system_stm32f1xx.c similarity index 100% rename from firmware/boards/f1_rev2/openblt/lib/system_stm32f1xx.c rename to firmware/boards/f1_common/openblt/lib/system_stm32f1xx.c diff --git a/firmware/boards/f1_rev2/openblt/startup_stm32f103xb.s b/firmware/boards/f1_common/openblt/startup_stm32f103xb.s similarity index 100% rename from firmware/boards/f1_rev2/openblt/startup_stm32f103xb.s rename to firmware/boards/f1_common/openblt/startup_stm32f103xb.s diff --git a/firmware/boards/f1_rev2/openblt/Makefile b/firmware/boards/f1_rev2/openblt/Makefile index 8fe70a6..b51a2ed 100644 --- a/firmware/boards/f1_rev2/openblt/Makefile +++ b/firmware/boards/f1_rev2/openblt/Makefile @@ -1,189 +1,3 @@ -#**************************************************************************************** -#| Description: Makefile for GNU ARM Embedded toolchain. -#| File Name: makefile -#| -#|--------------------------------------------------------------------------------------- -#| C O P Y R I G H T -#|--------------------------------------------------------------------------------------- -#| Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved -#| -#|--------------------------------------------------------------------------------------- -#| L I C E N S E -#|--------------------------------------------------------------------------------------- -#| This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or -#| modify it under the terms of the GNU General Public License as published by the Free -#| Software Foundation, either version 3 of the License, or (at your option) any later -#| version. -#| -#| OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -#| without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -#| PURPOSE. See the GNU General Public License for more details. -#| -#| You have received a copy of the GNU General Public License along with OpenBLT. It -#| should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. -#| -#**************************************************************************************** -SHELL = sh - -#|--------------------------------------------------------------------------------------| -#| Configure project name | -#|--------------------------------------------------------------------------------------| BOARD?=f1_rev2 -PROJ_NAME=openblt_$(BOARD) -#|--------------------------------------------------------------------------------------| -#| Configure OpenBLT path | -#|--------------------------------------------------------------------------------------| -OPENBLT_PATH=../../../ext/openblt/Target - -#|--------------------------------------------------------------------------------------| -#| Configure tool path | -#|--------------------------------------------------------------------------------------| -# Compiler should be in PATH - -#|--------------------------------------------------------------------------------------| -#| Collect project files | -#|--------------------------------------------------------------------------------------| -# Recursive wildcard function implementation. Example usages: -# $(call rwildcard, , *.c *.h) -# --> Returns all *.c and *.h files in the current directory and below -# $(call rwildcard, /lib/, *.c) -# --> Returns all *.c files in the /lib directory and below -rwildcard = $(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))) - -# Collect all application files in the current directory and its subdirectories, but -# exclude flash-layout.c as this one is directly included in a source file, when used. -PROJ_FILES = $(filter-out flash_layout.c, $(call rwildcard, , *.c *.h *.s)) -# Collect bootloader core files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.h) -# Collect bootloader port files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.h) -# Collect bootloader port compiler specific files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.h) -# reuse ST32F1xx HAL and CMSIS from one of OpenBLT exaples to avoid having copy in this git -PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/CMSIS, *.c *.h *.s)) -PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/STM32F1xx_HAL_Driver/, *.c *.h *.s)) - - -#|--------------------------------------------------------------------------------------| -#| Toolchain binaries | -#|--------------------------------------------------------------------------------------| -RM = rm -CC = $(TOOL_PATH)arm-none-eabi-gcc -LN = $(TOOL_PATH)arm-none-eabi-gcc -OC = $(TOOL_PATH)arm-none-eabi-objcopy -OD = $(TOOL_PATH)arm-none-eabi-objdump -AS = $(TOOL_PATH)arm-none-eabi-gcc -SZ = $(TOOL_PATH)arm-none-eabi-size - - -#|--------------------------------------------------------------------------------------| -#| Filter project files -#|--------------------------------------------------------------------------------------| -PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) -PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) -PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) - - -#|--------------------------------------------------------------------------------------| -#| Set important path variables | -#|--------------------------------------------------------------------------------------| -VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :) -OBJ_PATH = obj -BIN_PATH = bin -INC_PATH += $(patsubst %/,%,$(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file)))))) -LIB_PATH = - - -#|--------------------------------------------------------------------------------------| -#| Options for toolchain binaries | -#|--------------------------------------------------------------------------------------| -STDFLAGS = -mcpu=cortex-m3 -mthumb -std=gnu11 -fstack-usage -Wall -specs=nano.specs -STDFLAGS += -fdata-sections -ffunction-sections -Wall -g -Wno-strict-aliasing -OPTFLAGS = -Os -CFLAGS = $(STDFLAGS) $(OPTFLAGS) -CFLAGS += -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DSTM32F103xB -CFLAGS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -CFLAGS += $(INC_PATH) -AFLAGS = $(CFLAGS) -LFLAGS = $(STDFLAGS) $(OPTFLAGS) -LFLAGS += -Wl,-script="STM32F103RB_FLASH.ld" -Wl,-Map=$(BIN_PATH)/$(PROJ_NAME).map -LFLAGS += -Wl,--gc-sections $(LIB_PATH) -OFLAGS = -O srec -ODFLAGS = -x -SZFLAGS = -B -d -RMFLAGS = -f - - -#|--------------------------------------------------------------------------------------| -#| Specify library files | -#|--------------------------------------------------------------------------------------| -LIBS = - - -#|--------------------------------------------------------------------------------------| -#| Define targets | -#|--------------------------------------------------------------------------------------| -AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS)) -COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS)) - - -#|--------------------------------------------------------------------------------------| -#| Make ALL | -#|--------------------------------------------------------------------------------------| -.PHONY: all -all: $(BIN_PATH)/$(PROJ_NAME).srec $(BIN_PATH)/$(PROJ_NAME).hex $(BIN_PATH)/$(PROJ_NAME).bin - - -$(BIN_PATH)/$(PROJ_NAME).srec : $(BIN_PATH)/$(PROJ_NAME).elf - @$(OC) $< $(OFLAGS) $@ - @$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map - @echo +++ Summary of memory consumption: - @$(SZ) $(SZFLAGS) $< - @echo +++ Build complete [$(notdir $@)] - -$(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf - @mkdir -p $(@D) - @$(OC) -O ihex $< $@ - -$(BIN_PATH)/$(PROJ_NAME).bin : $(BIN_PATH)/$(PROJ_NAME).elf - @mkdir -p $(@D) - @$(OC) -O binary $< $@ - -$(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS) - @echo +++ Linking [$(notdir $@)] - @mkdir -p $(BIN_PATH) - @$(LN) $(LFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F)) $(LIBS) - - -#|--------------------------------------------------------------------------------------| -#| Compile and assemble | -#|--------------------------------------------------------------------------------------| -$(AOBJS): %.o: %.s $(PROJ_CHDRS) - @mkdir -p $(OBJ_PATH) - @echo +++ Assembling [$(notdir $<)] - @$(AS) $(AFLAGS) -c $< -o $(OBJ_PATH)/$(@F) - -$(COBJS): %.o: %.c $(PROJ_CHDRS) - @mkdir -p $(OBJ_PATH) - @echo +++ Compiling [$(notdir $<)] - @$(CC) $(CFLAGS) -c $< -o $(OBJ_PATH)/$(@F) - - -#|--------------------------------------------------------------------------------------| -#| Make CLEAN | -#|--------------------------------------------------------------------------------------| -.PHONY: clean -clean: - @echo +++ Cleaning build environment - @$(RM) $(RMFLAGS) $(foreach file,$(AOBJS),$(OBJ_PATH)/$(file)) - @$(RM) $(RMFLAGS) $(foreach file,$(COBJS),$(OBJ_PATH)/$(file)) - @$(RM) $(RMFLAGS) $(patsubst %.o,%.lst,$(foreach file,$(COBJS),$(OBJ_PATH)/$(file))) - @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).elf $(BIN_PATH)/$(PROJ_NAME).map - @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).srec - @$(RM) $(RMFLAGS) -r $(OBJ_PATH) - @$(RM) $(RMFLAGS) -r $(BIN_PATH) - @echo +++ Clean complete +include ../../f1_common/openblt/Makefile diff --git a/firmware/boards/f1_rev2/openblt/main.c b/firmware/boards/f1_rev2/openblt/main.c index 149a0f8..852e736 100644 --- a/firmware/boards/f1_rev2/openblt/main.c +++ b/firmware/boards/f1_rev2/openblt/main.c @@ -10,7 +10,7 @@ #include "stm32f1xx_ll_usart.h" /* STM32 LL USART header */ #include "stm32f1xx_ll_gpio.h" /* STM32 LL GPIO header */ -#include "../io/io_pins.h" +#include "io_pins.h" /**************************************************************************************** * Function prototypes diff --git a/firmware/boards/f1_rev3/openblt/Makefile b/firmware/boards/f1_rev3/openblt/Makefile index 756ac4a..e09d50d 100644 --- a/firmware/boards/f1_rev3/openblt/Makefile +++ b/firmware/boards/f1_rev3/openblt/Makefile @@ -1,189 +1,3 @@ -#**************************************************************************************** -#| Description: Makefile for GNU ARM Embedded toolchain. -#| File Name: makefile -#| -#|--------------------------------------------------------------------------------------- -#| C O P Y R I G H T -#|--------------------------------------------------------------------------------------- -#| Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved -#| -#|--------------------------------------------------------------------------------------- -#| L I C E N S E -#|--------------------------------------------------------------------------------------- -#| This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or -#| modify it under the terms of the GNU General Public License as published by the Free -#| Software Foundation, either version 3 of the License, or (at your option) any later -#| version. -#| -#| OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -#| without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -#| PURPOSE. See the GNU General Public License for more details. -#| -#| You have received a copy of the GNU General Public License along with OpenBLT. It -#| should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. -#| -#**************************************************************************************** -SHELL = sh - -#|--------------------------------------------------------------------------------------| -#| Configure project name | -#|--------------------------------------------------------------------------------------| BOARD?=f1_rev3 -PROJ_NAME=openblt_$(BOARD) -#|--------------------------------------------------------------------------------------| -#| Configure OpenBLT path | -#|--------------------------------------------------------------------------------------| -OPENBLT_PATH=../../../ext/openblt/Target - -#|--------------------------------------------------------------------------------------| -#| Configure tool path | -#|--------------------------------------------------------------------------------------| -# Compiler should be in PATH - -#|--------------------------------------------------------------------------------------| -#| Collect project files | -#|--------------------------------------------------------------------------------------| -# Recursive wildcard function implementation. Example usages: -# $(call rwildcard, , *.c *.h) -# --> Returns all *.c and *.h files in the current directory and below -# $(call rwildcard, /lib/, *.c) -# --> Returns all *.c files in the /lib directory and below -rwildcard = $(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))) - -# Collect all application files in the current directory and its subdirectories, but -# exclude flash-layout.c as this one is directly included in a source file, when used. -PROJ_FILES = $(filter-out flash_layout.c, $(call rwildcard, , *.c *.h *.s)) -# Collect bootloader core files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/*.h) -# Collect bootloader port files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/*.h) -# Collect bootloader port compiler specific files -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.c) -PROJ_FILES += $(wildcard $(OPENBLT_PATH)/Source/ARMCM3_STM32F1/GCC/*.h) -# reuse ST32F1xx HAL and CMSIS from one of OpenBLT exaples to avoid having copy in this git -PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/CMSIS, *.c *.h *.s)) -PROJ_FILES += $(filter-out uip, $(call rwildcard, $(OPENBLT_PATH)/Demo/ARMCM3_STM32F1_Nucleo_F103RB_GCC/Boot/lib/STM32F1xx_HAL_Driver/, *.c *.h *.s)) - - -#|--------------------------------------------------------------------------------------| -#| Toolchain binaries | -#|--------------------------------------------------------------------------------------| -RM = rm -CC = $(TOOL_PATH)arm-none-eabi-gcc -LN = $(TOOL_PATH)arm-none-eabi-gcc -OC = $(TOOL_PATH)arm-none-eabi-objcopy -OD = $(TOOL_PATH)arm-none-eabi-objdump -AS = $(TOOL_PATH)arm-none-eabi-gcc -SZ = $(TOOL_PATH)arm-none-eabi-size - - -#|--------------------------------------------------------------------------------------| -#| Filter project files -#|--------------------------------------------------------------------------------------| -PROJ_ASRCS = $(filter %.s,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) -PROJ_CSRCS = $(filter %.c,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) -PROJ_CHDRS = $(filter %.h,$(foreach file,$(PROJ_FILES),$(notdir $(file)))) - - -#|--------------------------------------------------------------------------------------| -#| Set important path variables | -#|--------------------------------------------------------------------------------------| -VPATH = $(foreach path,$(sort $(foreach file,$(PROJ_FILES),$(dir $(file)))) $(subst \,/,$(OBJ_PATH)),$(path) :) -OBJ_PATH = obj -BIN_PATH = bin -INC_PATH += $(patsubst %/,%,$(patsubst %,-I%,$(sort $(foreach file,$(filter %.h,$(PROJ_FILES)),$(dir $(file)))))) -LIB_PATH = - - -#|--------------------------------------------------------------------------------------| -#| Options for toolchain binaries | -#|--------------------------------------------------------------------------------------| -STDFLAGS = -mcpu=cortex-m3 -mthumb -std=gnu11 -fstack-usage -Wall -specs=nano.specs -STDFLAGS += -fdata-sections -ffunction-sections -Wall -g -Wno-strict-aliasing -OPTFLAGS = -Os -CFLAGS = $(STDFLAGS) $(OPTFLAGS) -CFLAGS += -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DSTM32F103xB -CFLAGS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))" -CFLAGS += $(INC_PATH) -AFLAGS = $(CFLAGS) -LFLAGS = $(STDFLAGS) $(OPTFLAGS) -LFLAGS += -Wl,-script="STM32F103RB_FLASH.ld" -Wl,-Map=$(BIN_PATH)/$(PROJ_NAME).map -LFLAGS += -Wl,--gc-sections $(LIB_PATH) -OFLAGS = -O srec -ODFLAGS = -x -SZFLAGS = -B -d -RMFLAGS = -f - - -#|--------------------------------------------------------------------------------------| -#| Specify library files | -#|--------------------------------------------------------------------------------------| -LIBS = - - -#|--------------------------------------------------------------------------------------| -#| Define targets | -#|--------------------------------------------------------------------------------------| -AOBJS = $(patsubst %.s,%.o,$(PROJ_ASRCS)) -COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS)) - - -#|--------------------------------------------------------------------------------------| -#| Make ALL | -#|--------------------------------------------------------------------------------------| -.PHONY: all -all: $(BIN_PATH)/$(PROJ_NAME).srec $(BIN_PATH)/$(PROJ_NAME).hex $(BIN_PATH)/$(PROJ_NAME).bin - - -$(BIN_PATH)/$(PROJ_NAME).srec : $(BIN_PATH)/$(PROJ_NAME).elf - @$(OC) $< $(OFLAGS) $@ - @$(OD) $(ODFLAGS) $< > $(BIN_PATH)/$(PROJ_NAME).map - @echo +++ Summary of memory consumption: - @$(SZ) $(SZFLAGS) $< - @echo +++ Build complete [$(notdir $@)] - -$(BIN_PATH)/$(PROJ_NAME).hex : $(BIN_PATH)/$(PROJ_NAME).elf - @mkdir -p $(@D) - @$(OC) -O ihex $< $@ - -$(BIN_PATH)/$(PROJ_NAME).bin : $(BIN_PATH)/$(PROJ_NAME).elf - @mkdir -p $(@D) - @$(OC) -O binary $< $@ - -$(BIN_PATH)/$(PROJ_NAME).elf : $(AOBJS) $(COBJS) - @echo +++ Linking [$(notdir $@)] - @mkdir -p $(BIN_PATH) - @$(LN) $(LFLAGS) -o $@ $(patsubst %.o,$(OBJ_PATH)/%.o,$(^F)) $(LIBS) - - -#|--------------------------------------------------------------------------------------| -#| Compile and assemble | -#|--------------------------------------------------------------------------------------| -$(AOBJS): %.o: %.s $(PROJ_CHDRS) - @mkdir -p $(OBJ_PATH) - @echo +++ Assembling [$(notdir $<)] - @$(AS) $(AFLAGS) -c $< -o $(OBJ_PATH)/$(@F) - -$(COBJS): %.o: %.c $(PROJ_CHDRS) - @mkdir -p $(OBJ_PATH) - @echo +++ Compiling [$(notdir $<)] - @$(CC) $(CFLAGS) -c $< -o $(OBJ_PATH)/$(@F) - - -#|--------------------------------------------------------------------------------------| -#| Make CLEAN | -#|--------------------------------------------------------------------------------------| -.PHONY: clean -clean: - @echo +++ Cleaning build environment - @$(RM) $(RMFLAGS) $(foreach file,$(AOBJS),$(OBJ_PATH)/$(file)) - @$(RM) $(RMFLAGS) $(foreach file,$(COBJS),$(OBJ_PATH)/$(file)) - @$(RM) $(RMFLAGS) $(patsubst %.o,%.lst,$(foreach file,$(COBJS),$(OBJ_PATH)/$(file))) - @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).elf $(BIN_PATH)/$(PROJ_NAME).map - @$(RM) $(RMFLAGS) $(BIN_PATH)/$(PROJ_NAME).srec - @$(RM) $(RMFLAGS) -r $(OBJ_PATH) - @$(RM) $(RMFLAGS) -r $(BIN_PATH) - @echo +++ Clean complete +include ../../f1_common/openblt/Makefile diff --git a/firmware/boards/f1_rev3/openblt/STM32F103RB_FLASH.ld b/firmware/boards/f1_rev3/openblt/STM32F103RB_FLASH.ld deleted file mode 100644 index fe1a093..0000000 --- a/firmware/boards/f1_rev3/openblt/STM32F103RB_FLASH.ld +++ /dev/null @@ -1,168 +0,0 @@ -/* -***************************************************************************** -** - -** File : stm32_flash.ld -** -** Abstract : Linker script for STM32F103RB Device with -** 128KByte FLASH, 20KByte RAM -** -** Set heap size, stack size and stack location according -** to application requirements. -** -** Set memory bank area and size if external memory is used. -** -** Target : STMicroelectronics STM32 -** -** Environment : Atollic TrueSTUDIO(R) -** -** Distribution: The file is distributed as is, without any warranty -** of any kind. -** -** (c)Copyright Atollic AB. -** You may use this file as-is or modify it according to the needs of your -** project. This file may only be built (assembled or compiled and linked) -** using the Atollic TrueSTUDIO(R) product. The use of this file together -** with other tools than Atollic TrueSTUDIO(R) is not permitted. -** -***************************************************************************** -*/ - -/* Entry Point */ -ENTRY(Reset_Handler) - -/* Highest address of the user mode stack */ -_estack = 0x20005000; /* end of RAM */ -/* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ -_Min_Stack_Size = 0x400; /* required amount of stack */ - -/* Specify the memory areas */ -MEMORY -{ -RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K -FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 8K -} - -/* Define output sections */ -SECTIONS -{ - /* The startup code goes first into FLASH */ - .isr_vector : - { - . = ALIGN(4); - KEEP(*(.isr_vector)) /* Startup code */ - . = ALIGN(4); - } >FLASH - - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - *(.eh_frame) - - KEEP (*(.init)) - KEEP (*(.fini)) - - . = ALIGN(4); - _etext = .; /* define a global symbols at end of code */ - } >FLASH - - /* Constant data goes into FLASH */ - .rodata : - { - . = ALIGN(4); - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(4); - } >FLASH - - .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH - .ARM : { - __exidx_start = .; - *(.ARM.exidx*) - __exidx_end = .; - } >FLASH - - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array*)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } >FLASH - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } >FLASH - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array*)) - PROVIDE_HIDDEN (__fini_array_end = .); - } >FLASH - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections goes into RAM, load LMA copy after code */ - .data : - { - . = ALIGN(4); - _sdata = .; /* create a global symbol at data start */ - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - - . = ALIGN(4); - _edata = .; /* define a global symbol at data end */ - } >RAM AT> FLASH - - - /* Uninitialized data section */ - . = ALIGN(4); - .bss : - { - /* This is used by the startup in order to initialize the .bss secion */ - _sbss = .; /* define a global symbol at bss start */ - __bss_start__ = _sbss; - *(.bss) - *(.bss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; /* define a global symbol at bss end */ - __bss_end__ = _ebss; - } >RAM - - /* User_heap_stack section, used to check that there is enough RAM left */ - ._user_heap_stack : - { - . = ALIGN(4); - PROVIDE ( end = . ); - PROVIDE ( _end = . ); - . = . + _Min_Heap_Size; - . = . + _Min_Stack_Size; - . = ALIGN(4); - } >RAM - - - - /* Remove information from the standard libraries */ - /DISCARD/ : - { - libc.a ( * ) - libm.a ( * ) - libgcc.a ( * ) - } - - .ARM.attributes 0 : { *(.ARM.attributes) } -} - - diff --git a/firmware/boards/f1_rev3/openblt/hooks.c b/firmware/boards/f1_rev3/openblt/hooks.c deleted file mode 100644 index f4ca383..0000000 --- a/firmware/boards/f1_rev3/openblt/hooks.c +++ /dev/null @@ -1,280 +0,0 @@ -/**************************************************************************************** -* Include files -****************************************************************************************/ -#include "boot.h" /* bootloader generic header */ -#include "led.h" /* LED driver header */ -#include "stm32f1xx.h" /* STM32 registers and drivers */ -#include "stm32f1xx_ll_gpio.h" /* STM32 LL GPIO header */ - - -/**************************************************************************************** -* B A C K D O O R E N T R Y H O O K F U N C T I O N S -****************************************************************************************/ - -#if (BOOT_BACKDOOR_HOOKS_ENABLE > 0) -/************************************************************************************//** -** \brief Initializes the backdoor entry option. -** \return none. -** -****************************************************************************************/ -void BackDoorInitHook(void) -{ -} /*** end of BackDoorInitHook ***/ - - -/************************************************************************************//** -** \brief Checks if a backdoor entry is requested. -** \return BLT_TRUE if the backdoor entry is requested, BLT_FALSE otherwise. -** -****************************************************************************************/ -blt_bool BackDoorEntryHook(void) -{ - /* default implementation always activates the bootloader after a reset */ - return BLT_TRUE; -} /*** end of BackDoorEntryHook ***/ -#endif /* BOOT_BACKDOOR_HOOKS_ENABLE > 0 */ - - -/**************************************************************************************** -* C P U D R I V E R H O O K F U N C T I O N S -****************************************************************************************/ - -#if (BOOT_CPU_USER_PROGRAM_START_HOOK > 0) -/************************************************************************************//** -** \brief Callback that gets called when the bootloader is about to exit and -** hand over control to the user program. This is the last moment that -** some final checking can be performed and if necessary prevent the -** bootloader from activiting the user program. -** \return BLT_TRUE if it is okay to start the user program, BLT_FALSE to keep -** keep the bootloader active. -** -****************************************************************************************/ -blt_bool CpuUserProgramStartHook(void) -{ - /* additional and optional backdoor entry through the pushbutton on the board. to - * force the bootloader to stay active after reset, keep it pressed during reset. - */ - if (LL_GPIO_IsInputPinSet(GPIOC, LL_GPIO_PIN_13) == 0) - { - /* pushbutton pressed, so do not start the user program and keep the - * bootloader active instead. - */ - return BLT_FALSE; - } - - /* clean up the LED driver */ - LedBlinkExit(); - - /* okay to start the user program */ - return BLT_TRUE; -} /*** end of CpuUserProgramStartHook ***/ -#endif /* BOOT_CPU_USER_PROGRAM_START_HOOK > 0 */ - - -/**************************************************************************************** -* W A T C H D O G D R I V E R H O O K F U N C T I O N S -****************************************************************************************/ - -#if (BOOT_COP_HOOKS_ENABLE > 0) -/************************************************************************************//** -** \brief Callback that gets called at the end of the internal COP driver -** initialization routine. It can be used to configure and enable the -** watchdog. -** \return none. -** -****************************************************************************************/ -void CopInitHook(void) -{ - /* this function is called upon initialization. might as well use it to initialize - * the LED driver. It is kind of a visual watchdog anyways. - */ - LedBlinkInit(100); -} /*** end of CopInitHook ***/ - - -/************************************************************************************//** -** \brief Callback that gets called at the end of the internal COP driver -** service routine. This gets called upon initialization and during -** potential long lasting loops and routine. It can be used to service -** the watchdog to prevent a watchdog reset. -** \return none. -** -****************************************************************************************/ -void CopServiceHook(void) -{ - /* run the LED blink task. this is a better place to do it than in the main() program - * loop. certain operations such as flash erase can take a long time, which would cause - * a blink interval to be skipped. this function is also called during such operations, - * so no blink intervals will be skipped when calling the LED blink task here. - */ - LedBlinkTask(); -} /*** end of CopServiceHook ***/ -#endif /* BOOT_COP_HOOKS_ENABLE > 0 */ - - -/**************************************************************************************** -* N O N - V O L A T I L E M E M O R Y D R I V E R H O O K F U N C T I O N S -****************************************************************************************/ - -#if (BOOT_NVM_HOOKS_ENABLE > 0) -/************************************************************************************//** -** \brief Callback that gets called at the start of the internal NVM driver -** initialization routine. -** \return none. -** -****************************************************************************************/ -void NvmInitHook(void) -{ -} /*** end of NvmInitHook ***/ - - -/************************************************************************************//** -** \brief Callback that gets called at the start of a firmware update to reinitialize -** the NVM driver. -** \return none. -** -****************************************************************************************/ -void NvmReinitHook(void) -{ -} /*** end of NvmReinitHook ***/ - - -/************************************************************************************//** -** \brief Callback that gets called at the start of the NVM driver write -** routine. It allows additional memory to be operated on. If the address -** is not within the range of the additional memory, then -** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the data hasn't -** been written yet. -** \param addr Start address. -** \param len Length in bytes. -** \param data Pointer to the data buffer. -** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is -** not within the supported memory range, or BLT_NVM_ERROR is the write -** operation failed. -** -****************************************************************************************/ -blt_int8u NvmWriteHook(blt_addr addr, blt_int32u len, blt_int8u *data) -{ - return BLT_NVM_NOT_IN_RANGE; -} /*** end of NvmWriteHook ***/ - - -/************************************************************************************//** -** \brief Callback that gets called at the start of the NVM driver erase -** routine. It allows additional memory to be operated on. If the address -** is not within the range of the additional memory, then -** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the memory -** hasn't been erased yet. -** \param addr Start address. -** \param len Length in bytes. -** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is -** not within the supported memory range, or BLT_NVM_ERROR is the erase -** operation failed. -** -****************************************************************************************/ -blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len) -{ - return BLT_NVM_NOT_IN_RANGE; -} /*** end of NvmEraseHook ***/ - - -/************************************************************************************//** -** \brief Callback that gets called at the end of the NVM programming session. -** \return BLT_TRUE is successful, BLT_FALSE otherwise. -** -****************************************************************************************/ -blt_bool NvmDoneHook(void) -{ - return BLT_TRUE; -} /*** end of NvmDoneHook ***/ -#endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ - - -#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) -/************************************************************************************//** -** \brief Verifies the checksum, which indicates that a valid user program is -** present and can be started. -** \return BLT_TRUE if successful, BLT_FALSE otherwise. -** -****************************************************************************************/ -blt_bool NvmVerifyChecksumHook(void) -{ - return BLT_TRUE; -} /*** end of NvmVerifyChecksum ***/ - - -/************************************************************************************//** -** \brief Writes a checksum of the user program to non-volatile memory. This is -** performed once the entire user program has been programmed. Through -** the checksum, the bootloader can check if a valid user programming is -** present and can be started. -** \return BLT_TRUE if successful, BLT_FALSE otherwise. -** -****************************************************************************************/ -blt_bool NvmWriteChecksumHook(void) -{ - return BLT_TRUE; -} -#endif /* BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0 */ - - -/**************************************************************************************** -* S E E D / K E Y S E C U R I T Y H O O K F U N C T I O N S -****************************************************************************************/ - -#if (BOOT_XCP_SEED_KEY_ENABLE > 0) -/************************************************************************************//** -** \brief Provides a seed to the XCP master that will be used for the key -** generation when the master attempts to unlock the specified resource. -** Called by the GET_SEED command. -** \param resource Resource that the seed if requested for (XCP_RES_XXX). -** \param seed Pointer to byte buffer wher the seed will be stored. -** \return Length of the seed in bytes. -** -****************************************************************************************/ -blt_int8u XcpGetSeedHook(blt_int8u resource, blt_int8u *seed) -{ - /* request seed for unlocking ProGraMming resource */ - if ((resource & XCP_RES_PGM) != 0) - { - seed[0] = 0x55; - } - - /* return seed length */ - return 1; -} /*** end of XcpGetSeedHook ***/ - - -/************************************************************************************//** -** \brief Called by the UNLOCK command and checks if the key to unlock the -** specified resource was correct. If so, then the resource protection -** will be removed. -** \param resource resource to unlock (XCP_RES_XXX). -** \param key pointer to the byte buffer holding the key. -** \param len length of the key in bytes. -** \return 1 if the key was correct, 0 otherwise. -** -****************************************************************************************/ -blt_int8u XcpVerifyKeyHook(blt_int8u resource, blt_int8u *key, blt_int8u len) -{ - /* suppress compiler warning for unused parameter */ - len = len; - - /* the example key algorithm in "libseednkey.dll" works as follows: - * - PGM will be unlocked if key = seed - 1 - */ - - /* check key for unlocking ProGraMming resource */ - if ((resource == XCP_RES_PGM) && (key[0] == (0x55-1))) - { - /* correct key received for unlocking PGM resource */ - return 1; - } - - /* still here so key incorrect */ - return 0; -} /*** end of XcpVerifyKeyHook ***/ -#endif /* BOOT_XCP_SEED_KEY_ENABLE > 0 */ - - -/*********************************** end of hooks.c ************************************/ diff --git a/firmware/boards/f1_rev3/openblt/led.c b/firmware/boards/f1_rev3/openblt/led.c deleted file mode 100644 index fd5b719..0000000 --- a/firmware/boards/f1_rev3/openblt/led.c +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************************** -* Include files -****************************************************************************************/ -#include "boot.h" /* bootloader generic header */ -#include "led.h" /* module header */ -#include "stm32f1xx.h" /* STM32 registers and drivers */ -#include "stm32f1xx_ll_gpio.h" /* STM32 LL GPIO header */ - -#include "../io/io_pins.h" - -/**************************************************************************************** -* Local data declarations -****************************************************************************************/ -/** \brief Holds the desired LED blink interval time. */ -static blt_int16u ledBlinkIntervalMs; - - -/************************************************************************************//** -** \brief Initializes the LED blink driver. -** \param interval_ms Specifies the desired LED blink interval time in milliseconds. -** \return none. -** -****************************************************************************************/ -void LedBlinkInit(blt_int16u interval_ms) -{ - LL_GPIO_InitTypeDef GPIO_InitStruct; - - /* Configure GPIO pin for the LED. */ - GPIO_InitStruct.Pin = LL_LED_BLUE_PIN; - GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; - GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; - GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; - LL_GPIO_Init(LED_BLUE_PORT, &GPIO_InitStruct); - LL_GPIO_ResetOutputPin(LED_BLUE_PORT, LL_LED_BLUE_PIN); - - /* store the interval time between LED toggles */ - ledBlinkIntervalMs = interval_ms; -} /*** end of LedBlinkInit ***/ - - -/************************************************************************************//** -** \brief Task function for blinking the LED as a fixed timer interval. -** \return none. -** -****************************************************************************************/ -void LedBlinkTask(void) -{ - static blt_bool ledOn = BLT_FALSE; - static blt_int32u nextBlinkEvent = 0; - - /* check for blink event */ - if (TimerGet() >= nextBlinkEvent) - { - /* toggle the LED state */ - if (ledOn == BLT_FALSE) - { - ledOn = BLT_TRUE; - LL_GPIO_SetOutputPin(LED_BLUE_PORT,LL_LED_BLUE_PIN); - } - else - { - ledOn = BLT_FALSE; - LL_GPIO_ResetOutputPin(LED_BLUE_PORT, LL_LED_BLUE_PIN); - } - /* schedule the next blink event */ - nextBlinkEvent = TimerGet() + ledBlinkIntervalMs; - } -} /*** end of LedBlinkTask ***/ - - -/************************************************************************************//** -** \brief Cleans up the LED blink driver. This is intended to be used upon program -** exit. -** \return none. -** -****************************************************************************************/ -void LedBlinkExit(void) -{ - /* turn the LED off */ - LL_GPIO_ResetOutputPin(LED_BLUE_PORT, LL_LED_BLUE_PIN); -} /*** end of LedBlinkExit ***/ - - -/*********************************** end of led.c **************************************/ diff --git a/firmware/boards/f1_rev3/openblt/led.h b/firmware/boards/f1_rev3/openblt/led.h deleted file mode 100644 index 38357af..0000000 --- a/firmware/boards/f1_rev3/openblt/led.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LED_H -#define LED_H - -/**************************************************************************************** -* Function prototypes -****************************************************************************************/ -void LedBlinkInit(blt_int16u interval_ms); -void LedBlinkTask(void); -void LedBlinkExit(void); - - -#endif /* LED_H */ -/*********************************** end of led.h **************************************/ diff --git a/firmware/boards/f1_rev3/openblt/main.c b/firmware/boards/f1_rev3/openblt/main.c index 149a0f8..852e736 100644 --- a/firmware/boards/f1_rev3/openblt/main.c +++ b/firmware/boards/f1_rev3/openblt/main.c @@ -10,7 +10,7 @@ #include "stm32f1xx_ll_usart.h" /* STM32 LL USART header */ #include "stm32f1xx_ll_gpio.h" /* STM32 LL GPIO header */ -#include "../io/io_pins.h" +#include "io_pins.h" /**************************************************************************************** * Function prototypes