mirror of https://github.com/rusefi/wideband.git
board: common make script (#73)
* board: common make script
(cherry picked from commit cb087c60e9
)
* common_make -> build_f1_board
* f1_rev2: use build_f1_board.sh helper
* Add encedo hex2dfu tools (bin for linux and win)
See https://github.com/encedo/hex2dfu
* Makefile: priduce srec too
* f1_rev2: OpenBLT: build bin and hex files
* f1_rev2: OpenBLT: optimize for size to fit into 8K flash
Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
parent
2fa9549d83
commit
0430e4a7ba
|
@ -176,6 +176,17 @@ CPPWARN = -Wall -Wextra -Wundef
|
|||
# Project, target, sources and paths
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Compiler settings
|
||||
#
|
||||
|
||||
# OpenBLT flasher expects srec files
|
||||
SREC = $(CP) -O srec
|
||||
|
||||
#
|
||||
# Compiler settings
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of user section
|
||||
#
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! "$USE_OPENBLT" ]; then
|
||||
USE_OPENBLT=no
|
||||
fi
|
||||
|
||||
if [ $USE_OPENBLT = "yes" ]; then
|
||||
cd openblt
|
||||
|
||||
echo ""
|
||||
echo "Building bootloader"
|
||||
make clean
|
||||
make -j12 BOARD=${BOARD} || exit 1
|
||||
|
||||
# back to board dir
|
||||
cd ..
|
||||
fi
|
||||
|
||||
cd ../..
|
||||
|
||||
echo ""
|
||||
echo "Build application"
|
||||
export EXTRA_PARAMS="-DECHO_UART=TRUE"
|
||||
# make clean
|
||||
make -j12 BOARD=${BOARD} || exit 1
|
||||
|
||||
DELIVER_DIR=deliver/${BOARD}
|
||||
mkdir -p ${DELIVER_DIR}
|
||||
rm -f ${DELIVER_DIR}/*
|
||||
|
||||
if uname | grep "NT"; then
|
||||
HEX2DFU=./ext/encedo_hex2dfu/hex2dfu.exe
|
||||
else
|
||||
HEX2DFU=./ext/encedo_hex2dfu/hex2dfu.bin
|
||||
fi
|
||||
chmod u+x $HEX2DFU
|
||||
|
||||
echo ""
|
||||
echo "Creating deliveries:"
|
||||
|
||||
if [ $USE_OPENBLT = "yes" ]; then
|
||||
echo "Srec for CAN update"
|
||||
cp -v build/wideband.srec ${DELIVER_DIR}/wideband_update.srec
|
||||
|
||||
echo ""
|
||||
echo "Invoking hex2dfu for incremental Wideband image (for DFU util)"
|
||||
$HEX2DFU -i build/wideband.hex -C 0x1C -o ${DELIVER_DIR}/wideband_update.dfu
|
||||
|
||||
echo ""
|
||||
echo "Invoking hex2dfu for OpenBLT (for DFU util)"
|
||||
$HEX2DFU -i boards/${BOARD}/openblt/bin/openblt_${BOARD}.hex -o ${DELIVER_DIR}/openblt.dfu
|
||||
|
||||
echo ""
|
||||
echo "OpenBLT bin (for DFU another util)"
|
||||
cp -v boards/${BOARD}/openblt/bin/openblt_${BOARD}.bin ${DELIVER_DIR}/openblt.bin
|
||||
|
||||
echo ""
|
||||
echo "Invoking hex2dfu for composite OpenBLT+Wideband image (for DFU util)"
|
||||
$HEX2DFU -i boards/${BOARD}/openblt/bin/openblt_${BOARD}.hex -i build/wideband.hex -C 0x1C -o ${DELIVER_DIR}/wideband.dfu -b ${DELIVER_DIR}/wideband.bin
|
||||
else
|
||||
echo "Bin for raw flashing"
|
||||
cp build/wideband.bin ${DELIVER_DIR}/wideband.bin
|
||||
|
||||
echo "Invoking hex2dfu for DFU file"
|
||||
$HEX2DFU -i build/wideband.hex -o ${DELIVER_DIR}/wideband.dfu
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "${DELIVER_DIR} folder content:"
|
||||
ls -l ${DELIVER_DIR}
|
|
@ -1,17 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd openblt
|
||||
|
||||
# build bootloader
|
||||
make -j12 BOARD=f1_rev2
|
||||
|
||||
# back out to the root
|
||||
cd ../../..
|
||||
|
||||
export EXTRA_PARAMS="-DECHO_UART=TRUE"
|
||||
|
||||
# build app firmware!
|
||||
# set optimization level to 0 until ADC issue is fixed for GD32
|
||||
make -j12 BOARD=f1_rev2 USE_OPT="-O0 -ggdb -fomit-frame-pointer -falign-functions=16 -fsingle-precision-constant"
|
||||
BOARD=f1_rev2 \
|
||||
USE_OPENBLT=yes \
|
||||
USE_OPT="-O0 -ggdb -fomit-frame-pointer -falign-functions=16 -fsingle-precision-constant" \
|
||||
../build_f1_board.sh
|
||||
|
|
|
@ -102,7 +102,7 @@ LIB_PATH =
|
|||
#|--------------------------------------------------------------------------------------|
|
||||
STDFLAGS = -mcpu=cortex-m3 -mthumb -std=gnu11 -fstack-usage -Wall -specs=nano.specs
|
||||
STDFLAGS += -fdata-sections -ffunction-sections -Wall -g -Wno-strict-aliasing
|
||||
OPTFLAGS = -Og
|
||||
OPTFLAGS = -Os
|
||||
CFLAGS = $(STDFLAGS) $(OPTFLAGS)
|
||||
CFLAGS += -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -DSTM32F103xB
|
||||
CFLAGS += -D__weak="__attribute__((weak))" -D__packed="__attribute__((__packed__))"
|
||||
|
@ -134,7 +134,7 @@ COBJS = $(patsubst %.c,%.o,$(PROJ_CSRCS))
|
|||
#| Make ALL |
|
||||
#|--------------------------------------------------------------------------------------|
|
||||
.PHONY: all
|
||||
all: $(BIN_PATH)/$(PROJ_NAME).srec
|
||||
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
|
||||
|
@ -144,6 +144,14 @@ $(BIN_PATH)/$(PROJ_NAME).srec : $(BIN_PATH)/$(PROJ_NAME).elf
|
|||
@$(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)
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue