-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Tritol-travis/master
Rewritten CW1 firmware
- Loading branch information
Showing
128 changed files
with
5,771 additions
and
9,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_size = 4 | ||
indent_style = tab | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
max_line_length = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
build-env | ||
build | ||
doc | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
dist: trusty | ||
before_install: | ||
- sudo apt-get install -y ninja-build | ||
os: linux | ||
dist: xenial | ||
language: cpp | ||
script: | ||
- git fetch --unshallow || if [ $? -eq 128 ]; then true; else false; fi | ||
- git rev-list --count HEAD | ||
- bash -x build.sh | ||
deploy: | ||
provider: releases | ||
api_key: $ACCESS_TOKEN | ||
token: $ACCESS_TOKEN | ||
file_glob: true | ||
file: | ||
- ../Prusa-CW-Firmware-build/Prusa-CW-Firmware.hex | ||
- build/Prusa-CW1-Firmware-*.hex | ||
skip_cleanup: true | ||
draft: true | ||
prerelease: true | ||
on: | ||
tags: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
PROJECT = Prusa-CW1-Firmware | ||
DIRS = lib src | ||
I18N = i18n | ||
LANG = en | ||
BUILD_DIR = build | ||
|
||
CC = avr-gcc | ||
CPP = avr-g++ | ||
OBJCOPY = avr-objcopy | ||
|
||
CSTANDARD = -std=gnu11 | ||
CPPSTANDARD = -std=gnu++17 | ||
|
||
WARN = -Wall -Wextra | ||
CPPTUNING = -fno-exceptions -fno-threadsafe-statics | ||
OPT = -g -Os -ffunction-sections -fdata-sections -flto -fno-fat-lto-objects -funsigned-char -funsigned-bitfields -fshort-enums -fno-inline-small-functions -mcall-prologues -fno-split-wide-types | ||
MCU = -mmcu=atmega32u4 | ||
|
||
DEFS = -DF_CPU=16000000 -DARDUINO=10805 -DUSB_VID=0x2c99 -DUSB_PID=0x0008 -DUSB_MANUFACTURER='"Prusa Research prusa3d.com"' -DUSB_PRODUCT='"Original Prusa CW1"' | ||
INCLUDE = $(foreach dir, ${DIRS}, -I${dir}) -I${BUILD_DIR} | ||
|
||
CFLAGS = ${OPT} ${WARN} ${CSTANDARD} ${MCU} ${INCLUDE} ${DEFS} | ||
CPPFLAGS = ${OPT} ${WARN} ${CPPSTANDARD} ${CPPTUNING} ${MCU} ${INCLUDE} ${DEFS} | ||
LINKFLAGS = -fuse-linker-plugin -Wl,--relax,--gc-sections,--defsym=__TEXT_REGION_LENGTH__=28k | ||
|
||
CSRCS = $(foreach dir, ${DIRS}, $(wildcard ${dir}/*.c)) | ||
CPPSRCS = $(foreach dir, ${DIRS}, $(wildcard ${dir}/*.cpp)) | ||
OBJS = $(addprefix $(BUILD_DIR)/, $(patsubst %.c, %.o, $(CSRCS))) $(addprefix $(BUILD_DIR)/, $(patsubst %.cpp, %.o, $(CPPSRCS))) | ||
DEPS = $(addprefix $(BUILD_DIR)/, $(patsubst %.c, %.d, $(CSRCS))) $(addprefix $(BUILD_DIR)/, $(patsubst %.cpp, %.dd, $(CPPSRCS))) | ||
VERSION = $(shell git describe --abbrev=0 --tags) | ||
VERSION_FILE = ${BUILD_DIR}/version.h | ||
LANG_TEMPLATE = ${I18N}/${PROJECT}-${VERSION}.pot | ||
|
||
default: DEFS += -DSERIAL_COM_DEBUG | ||
default: $(addprefix $(BUILD_DIR)/, ${PROJECT}-${LANG}-devel.hex) | ||
|
||
dist: $(addprefix $(BUILD_DIR)/, ${PROJECT}-${LANG}-${VERSION}.hex) | ||
|
||
.PHONY: clean distclean lang_extract default dist ${VERSION_FILE}.tmp doc | ||
|
||
.SECONDARY: | ||
|
||
.SECONDEXPANSION: | ||
|
||
$(BUILD_DIR)/.: | ||
@mkdir -p $@ | ||
|
||
$(BUILD_DIR)%/.: | ||
@mkdir -p $@ | ||
|
||
$(BUILD_DIR)/%.hex: ${BUILD_DIR}/%.elf | ||
${OBJCOPY} -O ihex -R .eeprom $< $@.tmp | ||
@echo "; device = cw1" > $@ | ||
@echo >> $@ | ||
cat $@.tmp >> $@ | ||
rm $@.tmp | ||
|
||
$(BUILD_DIR)/%.elf: ${OBJS} | ||
@echo "LINK $@" | ||
@${CPP} ${CPPFLAGS} ${LINKFLAGS},-Map=${@:%.elf=%.map} $^ -o $@ | ||
|
||
$(BUILD_DIR)/%.o: %.c | $${@D}/. | ||
@echo "CC $<" | ||
@${CC} ${CFLAGS} -c $< -o $@ | ||
|
||
$(BUILD_DIR)/%.o: %.cpp | $${@D}/. | ||
@echo "CPP $<" | ||
@${CPP} ${CPPFLAGS} -c $< -o $@ | ||
|
||
$(VERSION_FILE): ${VERSION_FILE}.tmp | ||
@if ! cmp -s $< $@; then cp $< $@; fi | ||
|
||
$(VERSION_FILE).tmp: ${BUILD_DIR}/${LANG}.h | $${@D}/. | ||
@echo "#pragma once" > $@ | ||
@echo -n "#define FW_LOCAL_CHANGES " >> $@ | ||
@git diff-index --quiet HEAD -- && echo 0 >> $@ || echo 1 >> $@ | ||
@echo -n "#define FW_BUILDNR " >> $@ | ||
@echo "\"`git rev-list --count HEAD`\"" >> $@ | ||
@echo -n "#define FW_HASH " >> $@ | ||
@echo "\"`git rev-parse --short=18 HEAD`\"" >> $@ | ||
@echo -n "#define FW_VERSION " >> $@ | ||
@echo "\"${VERSION}\"" >> $@ | ||
@echo -n "#include " >> $@ | ||
@echo "\"${LANG}.h\"" >> $@ | ||
|
||
clean: | ||
rm -f $(foreach dir, ${DIRS}, $(wildcard ${BUILD_DIR}/${dir}/*.o)) $(foreach dir, ${DIRS}, $(wildcard ${BUILD_DIR}/${dir}/*.d*)) ${BUILD_DIR}/*.h $(VERSION_FILE).tmp ${BUILD_DIR}/*.sed | ||
|
||
distclean: clean | ||
rm -rf ${BUILD_DIR}/*.hex ${BUILD_DIR}/*.elf ${BUILD_DIR}/*.map ${I18N}/*.pot tags doc | ||
|
||
lang_extract: ${LANG_TEMPLATE} | ||
|
||
$(LANG_TEMPLATE): ${I18N}/en.h | ||
touch $@ | ||
xgettext --join-existing --sort-output --keyword=_ --output=$@ $? | ||
|
||
$(BUILD_DIR)/%.sed: ${I18N}/%.po | ||
msgconv --stringtable-output $< |grep -E '".+" ='|sed 's/"\(.*\)" = "\(.*\)";/s~"\1"~"\2"~/'|sed 's~\[~\\\[~g;s~\]~\\\]~g' > $@ | ||
|
||
$(BUILD_DIR)/en.h: ${I18N}/en.h | ||
cp $< $@ | ||
|
||
$(BUILD_DIR)/%.h: ${BUILD_DIR}/%.sed | ||
sed -f $< ${I18N}/en.h > $@ | ||
|
||
tags: ${CSRCS} ${CPPSRCS} $(wildcard ${I18N}/*.h) | ||
arduino-ctags $^ | ||
|
||
doc: | ||
doxygen | ||
|
||
|
||
$(BUILD_DIR)/%.d: %.c ${VERSION_FILE} Makefile | $${@D}/. | ||
@echo "deps $<" | ||
@${CC} ${CFLAGS} $< -MM -MT ${@:.d=.o} >$@ | ||
|
||
$(BUILD_DIR)/%.dd: %.cpp ${VERSION_FILE} Makefile | $${@D}/. | ||
@echo "deps $<" | ||
@${CPP} ${CPPFLAGS} $< -MM -MT ${@:.dd=.o} >$@ | ||
|
||
-include ${DEPS} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.