targets for cantact HSE16/8 and canape HSI

This commit is contained in:
John Whittington 2020-12-11 09:39:04 +01:00
parent 77b23903b2
commit 1e266c035b
3 changed files with 27 additions and 19 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/build
/build*

View File

@ -9,23 +9,14 @@
######################################
# target
######################################
TARGET = pcan_cantact_hw
######################################
# building variables
######################################
# debug build?
DEBUG = 0
# optimization
OPT = -Os
TARGET = pcan_$(BOARD)_hw
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
BUILD_DIR = build-$(BOARD)
######################################
# source
@ -120,7 +111,7 @@ C_INCLUDES = \
# compile gcc flags
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fno-common -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -Wpedantic -Wextra -fno-common -fdata-sections -ffunction-sections
CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -Wpedantic -Wextra -fno-common -fdata-sections -ffunction-sections $(BOARD_FLAGS)
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
@ -142,9 +133,19 @@ 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
.PHONY : all
# default action: build all
all: cantact-16 cantact-8 canape
cantact-16:
$(MAKE) BOARD=cantact-16 DEBUG=0 OPT=-Os BOARD_FLAGS=-DEXTERNAL_CLOCK=16 elf hex bin
cantact-8:
$(MAKE) BOARD=cantact-8 DEBUG=0 OPT=-Os BOARD_FLAGS=-DEXTERNAL_CLOCK=8 elf hex bin
canape:
$(MAKE) BOARD=canape DEBUG=0 OPT=-Os elf hex bin
#######################################
# build the application
@ -156,6 +157,10 @@ vpath %.c $(sort $(dir $(C_SOURCES)))
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
ELF_TARGET = $(BUILD_DIR)/$(TARGET).elf
BIN_TARGET = $(BUILD_DIR)/$(TARGET).bin
HEX_TARGET = $(BUILD_DIR)/$(TARGET).hex
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
@ -175,11 +180,17 @@ $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BUILD_DIR):
mkdir $@
bin: $(BIN_TARGET)
elf: $(ELF_TARGET)
hex: $(HEX_TARGET)
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
-rm -fR $(BUILD_DIR)*
#######################################
# dependencies

View File

@ -4,9 +4,6 @@
#include "pcan_protocol.h"
#include "pcan_usb.h"
// remove to use 48 MHz internal clock
/* #define EXTERNAL_CLOCK 16 */
void HAL_MspInit( void )
{
__HAL_RCC_SYSCFG_CLK_ENABLE();