add initial stm32 project
This commit is contained in:
parent
60cf251dcb
commit
8247927af7
7 changed files with 100 additions and 3 deletions
1
firmware/.gitignore
vendored
1
firmware/.gitignore
vendored
|
@ -144,3 +144,4 @@ dkms.conf
|
|||
firmware/
|
||||
build/
|
||||
compile_commands.json
|
||||
.cache/
|
||||
|
|
|
@ -26,3 +26,11 @@ systest:
|
|||
true
|
||||
|
||||
.NOTPARALLEL: html all
|
||||
|
||||
#$(BUILDDIR)/tetrad: $(BUILDDIR)/src/backend/tetrad.o $(BACKEND_OBJECTS) $(BUILDDIR)/libtetra.a
|
||||
# $(V)mkdir -p $(dir $@)
|
||||
# $(V)$(eval VERSION_OBJECT = $(shell mktemp /tmp/tetra_version_object.XXXXXX.o))
|
||||
# $(V)./build_version_object.sh $(notdir $@) $(VERSION_OBJECT) $(CXX) $(CPPFLAGS) $(CXXFLAGS)
|
||||
# @echo link $@
|
||||
# $(V)$(CXX) $(CXXFLAGS) $(BUILDDIR)/src/backend/tetrad.o $(BACKEND_OBJECTS) $(VERSION_OBJECT) -o $@ $(LDFLAGS) -lstdc++fs
|
||||
# $(V)rm $(VERSION_OBJECT)
|
||||
|
|
18
firmware/build_version.c
Normal file
18
firmware/build_version.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "build_version.h"
|
||||
|
||||
const version_info current_version = {
|
||||
.major=FIATLUX_VERSION_MAJOR,
|
||||
.minor=FIATLUX_VERSION_MINOR,
|
||||
.build=FIATLUX_BUILD_NUM /*,
|
||||
.filename=FIATLUX_FILENAME,
|
||||
.branch=FIATLUX_GIT_BRANCH,
|
||||
.commit=FIATLUX_GIT_COMMIT,
|
||||
.author=FIATLUX_GIT_AUTHOR,
|
||||
.build_date=FIATLUX_BUILD_DATE,
|
||||
.build_machine=FIATLUX_BUILD_MACHINE*/
|
||||
};
|
||||
|
||||
|
||||
const version_info build_version() {
|
||||
return current_version;
|
||||
}
|
9
firmware/build_version.h
Normal file
9
firmware/build_version.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
typedef struct {
|
||||
int major;
|
||||
int minor;
|
||||
int build;
|
||||
} version_info;
|
||||
|
||||
const version_info build_version();
|
51
firmware/build_version_object.sh
Executable file
51
firmware/build_version_object.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
TARGET=$1
|
||||
shift
|
||||
OUTPUT=$1
|
||||
shift
|
||||
CMD="$*"
|
||||
|
||||
VERSION_DIR=../version/${TARGET}
|
||||
mkdir -p "${VERSION_DIR}"
|
||||
|
||||
BUILD_VERSION=$(( $(cat "${VERSION_DIR}"/build || echo 0) + 1 ))
|
||||
echo ${BUILD_VERSION} > "${VERSION_DIR}"/build
|
||||
|
||||
VERSION_MAJOR=0
|
||||
VERSION_MINOR=1
|
||||
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
AUTHOR=$(git show --format="%aE" "${COMMIT}" | head -n1 | awk '{print $1}')
|
||||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
||||
#COMMIT_MESSAGE=$(git log --format=%B -n 1 ${COMMIT})
|
||||
|
||||
#version := $(subst -, ,$(shell git describe --long --dirty --tags))
|
||||
#COMMIT := $(strip $(word 3, $(version)))
|
||||
#COMMITS_PAST := $(strip $(word 2, $(version)))
|
||||
#DIRTY := $(strip $(word 4, $(version)))
|
||||
#ifneq ($(COMMITS_PAST), 0)
|
||||
# BUILD_INFO_COMMITS := "."$(COMMITS_PAST)
|
||||
#endif
|
||||
#ifneq ($(DIRTY),)
|
||||
# BUILD_INFO_DIRTY :="+"
|
||||
#endif
|
||||
|
||||
#export BUILD_TAG :=$(strip $(word 1, $(version)))
|
||||
#export BUILD_INFO := $(COMMIT)$(BUILD_INFO_COMMITS)$(BUILD_INFO_DIRTY)
|
||||
|
||||
#GIT_COMMIT=$(git describe --long --dirty --tags)
|
||||
BUILD_MACHINE=$(whoami)@$(hostname)
|
||||
BUILD_DATE=$(date +'%Y-%m-%d_%H:%M:%S')
|
||||
|
||||
echo "${TARGET}" ${VERSION_MAJOR}.${VERSION_MINOR}.${BUILD_VERSION}
|
||||
${CMD} -c ${DIR}/build_version.c -o "${OUTPUT}" -DFIATLUX_FILENAME=\""${TARGET}"\"\
|
||||
-DFIATLUX_VERSION_MAJOR=0 -DFIATLUX_VERSION_MINOR=1 -DFIATLUX_BUILD_NUM=${BUILD_VERSION} \
|
||||
-DFIATLUX_GIT_COMMIT=\""${COMMIT}"\" -DFIATLUX_GIT_BRANCH=\""${BRANCH_NAME}"\" -DFIATLUX_GIT_AUTHOR=\""${AUTHOR}"\" \
|
||||
-DFIATLUX_BUILD_DATE=\""${BUILD_DATE}"\" -DFIATLUX_BUILD_MACHINE=\""${BUILD_MACHINE}"\" \
|
||||
-DFIATLUX_BUILD_CMD=\""${CMD}"\"
|
||||
|
3
peripherals/cc48x6/firmware/.gitignore
vendored
Normal file
3
peripherals/cc48x6/firmware/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
build/
|
||||
compile_commands.json
|
||||
.idea/
|
|
@ -96,6 +96,8 @@ SZ = $(PREFIX)size
|
|||
endif
|
||||
HEX = $(CP) -O ihex
|
||||
BIN = $(CP) -O binary -S
|
||||
|
||||
VERSIONCMD = ../../../firmware/build_version_object.sh
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
|
@ -179,8 +181,13 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
|||
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
||||
$(AS) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(VERSIONCMD)
|
||||
$(V)mkdir -p $(dir $@)
|
||||
$(V)$(eval VERSION_OBJECT = $(shell mktemp /tmp/fiatlux_version_object.XXXXXX.o))
|
||||
$(V)$(VERSIONCMD) $(notdir $@) $(VERSION_OBJECT) $(CC) $(CPPFLAGS) $(CXXFLAGS)
|
||||
@echo link $@
|
||||
$(V)$(CC) $(OBJECTS) $(VERSION_OBJECT) $(LDFLAGS) -o $@
|
||||
$(V)rm $(VERSION_OBJECT)
|
||||
$(SZ) $@
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
||||
|
@ -203,4 +210,4 @@ clean:
|
|||
#######################################
|
||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||
|
||||
# *** EOF ***
|
||||
# *** EOF ***
|
Loading…
Reference in a new issue