Closed danielkucera closed 5 years ago
Beat me to it. This looks good.
There are a few things to consider:
Don't merge it yet, I broke original build_binaries.sh
script
But for the other images you just need to edit original build.sh
to build all needed variants and copy them to /output
From my side it's ready
I think the opendps output files should be renamed to the model that they were built for. Something like opendps_dps5005.bin
I agree with @Xenoamor regarding the naming. Could you please change this @danielkucera?
I was trying to be nice and change the output file name in Makefile but following doesn't work for some reason:
BINARY = opendps_$(MODEL)
It ends with:
make: Leaving directory '/home/opendps/code/opendps'
make: Entering directory '/home/opendps/code/opendps'
make: *** No rule to make target 'opendps_DPS5005.elf', needed by 'elf'. Stop.
make: Leaving directory '/home/opendps/code/opendps'
Can you guys help?
Looks like the build system expected BINARY
to match the directory name. Perhaps changing the build script to this? I haven't tested this mind
#!/bin/bash
set -eEuo pipefail
umask 022
sudo mkdir -p /home/opendps/code
sudo cp -R /parent/{*,.git*} /home/opendps/code
sudo chown -R opendps:opendps /home/opendps
cd /home/opendps/code
git submodule init
git submodule update
make -j -C libopencm3
make -C opendps fonts "$@"
make -C dpsboot elf bin "$@"
cp -f /home/opendps/code/dpsboot/dpsboot.elf /output/
cp -f /home/opendps/code/dpsboot/dpsboot.bin /output/
make -C opendps elf bin "$@" MODEL=DPS5015
cp -f /home/opendps/code/opendps/opendps.elf /output/opendps_DPS5015.elf
cp -f /home/opendps/code/opendps/opendps.bin /output/opendps_DPS5015.bin
make -C opendps elf bin "$@" MODEL=DPS5005
cp -f /home/opendps/code/opendps/opendps.elf /output/opendps_DPS5005.elf
cp -f /home/opendps/code/opendps/opendps.bin /output/opendps_DPS5005.bin
make -C opendps elf bin "$@" MODEL=DPS3005
cp -f /home/opendps/code/opendps/opendps.elf /output/opendps_DPS3005.elf
cp -f /home/opendps/code/opendps/opendps.bin /output/opendps_DPS3005.bin
I was aiming more towards:
make -C opendps elf bin "$@" MODEL=DPS5015
make -C opendps elf bin "$@" MODEL=DPS5005
make -C opendps elf bin "$@" MODEL=DPS3005
cp -f /home/opendps/code/opendps/*.elf /output/
cp -f /home/opendps/code/opendps/*.bin /output/
Do you have an idea how to adjust the build system?
Change line 52 of libopencm3.rules.mk to: OBJS += opendps.o
EDIT: Nope that breaks dpsboot. It is definitely this line causing issues though
The following patch resolves it:
diff --git a/dpsboot/Makefile b/dpsboot/Makefile
index e355c81..af31f1f 100644
--- a/dpsboot/Makefile
+++ b/dpsboot/Makefile
@@ -9,6 +9,7 @@ CFLAGS = -I. -I../opendps -DGIT_VERSION=\"$(GIT_VERSION)\" -DCONFIG_PAST_NO_GC -
#CFLAGS += -flto
OBJS = \
+ dpsboot.o \
common.o \
hw.o
diff --git a/libopencm3.rules.mk b/libopencm3.rules.mk
index 60d6ce8..47e3860 100644
--- a/libopencm3.rules.mk
+++ b/libopencm3.rules.mk
@@ -46,12 +46,6 @@ OPT := -Os
CSTD ?= -std=c99
-###############################################################################
-# Source files
-
-OBJS += $(BINARY).o
-
-
ifeq ($(strip $(OPENCM3_DIR)),)
# user has not specified the library path, so we try to detect it
diff --git a/opendps/Makefile b/opendps/Makefile
index 02af4da..1a8ba5a 100644
--- a/opendps/Makefile
+++ b/opendps/Makefile
@@ -1,5 +1,3 @@
-BINARY = opendps
-
# Build with commandline interface rather than serial interface
COMMANDLINE := 0
@@ -24,6 +22,9 @@ WIFI := 1
# Print debug information on the serial output
DEBUG ?= 0
+# Set the output binary filenames
+BINARY := opendps_$(MODEL)
+
# Font file
METER_FONT_FILE ?= gfx/Ubuntu-C.ttf
METER_FONT_SMALL_SIZE ?= 18
@@ -71,6 +72,7 @@ CFLAGS += \
LDSCRIPT = stm32f100_app.ld
OBJS = \
+ opendps.o \
flashlock.o \
bootcom.o \
crc16.o \
@Xenoamor I didn't want to touch libopencm3.rules.mk
so I did it in a different way. Anyway it was a good school of make. Now there is still one problem outstanding - it doesn't rebuild after changing model parameter.
I'm almost certain that the libopencm3.rules.mk
is incorrect as it stands. It should only be used to describe how to build a project and not what sourcefiles are in it.
You'll need to touch the dps-model.h
file to trigger a rebuild I believe
@Xenoamor yes, touch works. Let's leave the decision to @kanflo whether to edit libopencm3.rules.mk
or my workaround.
Btw different solution for model config could be using dps-model-$MODEL.c with const
parameter definitions and then link only the correct file.
As libopencm3.rules.mk
is a part of this git, please feel free to modify it as needed @danielkucera.
done
Sods law that this has just came out: https://github.com/features/actions
You can use travis to build binaries. The result will look like this: https://github.com/danielkucera/opendps/releases All you need to do is add project to travis and set
GITHUB_OAUTH_TOKEN
variable by this guide: https://docs.travis-ci.com/user/deployment/pages/#setting-the-github-token Release is built with each tag