From cd159faa3d88be45adf67cde4fbca58b509e7441 Mon Sep 17 00:00:00 2001 From: Michael DM Dryden Date: Wed, 14 Dec 2016 18:42:35 -0500 Subject: [PATCH] Backwards compatibility with <1.2.3 by overriding BOARD_VER_MICRO when making. --- .gitlab-ci.yml | 15 +++++++++++++-- config.mk | 12 ++++++++++-- src/config/conf_board.h | 4 ---- src/main.c | 15 +++++++++++---- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d9f53d..4774e40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,21 @@ image: kalledk/docker-avr-toolchain -build: +1.2.3: script: - cd DSTAT - make artifacts: name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}" paths: - - DSTAT/*.hex + - DSTAT/dstat-firmware.hex + - DSTAT/dstat-firmware.elf + +pre-1.2.3: + script: + - cd DSTAT + - make BOARD_VER_MICRO=0 + artifacts: + name: "${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}" + paths: + - DSTAT/dstat-firmware.hex + - DSTAT/dstat-firmware.elf diff --git a/config.mk b/config.mk index 62f7e4a..d18ee5d 100644 --- a/config.mk +++ b/config.mk @@ -48,6 +48,11 @@ AVRDUDE_DEV = x256a3u AVRDUDE_PROG = avrispmkII AVRDUDE_PORT = usb +# Board Settings +BOARD_VER_MAJOR = 1 +BOARD_VER_MINOR = 2 +BOARD_VER_MICRO = 3 + # Application target name. Given with suffix .a for library and .elf for a # standalone application. TARGET = dstat-firmware.elf @@ -104,11 +109,14 @@ CFLAGS = CPPFLAGS = \ -D BOARD=USER_BOARD \ -D IOPORT_XMEGA_COMPAT \ - -D F_CPU=$(F_CPU)UL + -D F_CPU=$(F_CPU)UL \ + -D BOARD_VER_MAJOR=$(BOARD_VER_MAJOR) \ + -D BOARD_VER_MINOR=$(BOARD_VER_MINOR) \ + -D BOARD_VER_MICRO=$(BOARD_VER_MICRO) # Extra flags to use when linking LDFLAGS = -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt # Pre- and post-build commands PREBUILD_CMD = -POSTBUILD_CMD = \ No newline at end of file +POSTBUILD_CMD = diff --git a/src/config/conf_board.h b/src/config/conf_board.h index 1bcdf8c..13aaecc 100644 --- a/src/config/conf_board.h +++ b/src/config/conf_board.h @@ -10,10 +10,6 @@ #include -#define BOARD_VER_MAJOR 1 -#define BOARD_VER_MINOR 2 -#define BOARD_VER_MICRO 3 - #if BOARD_VER_MAJOR >= 1 && BOARD_VER_MINOR >= 2 && BOARD_VER_MICRO >=3 #define BOARD_XOSC_HZ 12000000 #define BOARD_XOSC_TYPE XOSC_TYPE_XTAL diff --git a/src/main.c b/src/main.c index 16f1017..a75cf10 100644 --- a/src/main.c +++ b/src/main.c @@ -13,6 +13,7 @@ #include #include #include +#include "conf_board.h" //Internal function declarations int8_t command_handler(char command); @@ -69,8 +70,10 @@ int main(void){ cpu_irq_enable(); board_init(); - ioport_set_pin_dir(LED1, IOPORT_DIR_OUTPUT); - ioport_set_pin_dir(LED2, IOPORT_DIR_OUTPUT); + #if BOARD_VER_MAJOR >= 1 && BOARD_VER_MINOR >= 2 && BOARD_VER_MICRO >=3 + ioport_set_pin_dir(LED1, IOPORT_DIR_OUTPUT); + ioport_set_pin_dir(LED2, IOPORT_DIR_OUTPUT); + #endif pot_init(); pmic_init(); @@ -117,10 +120,14 @@ int main(void){ stdio_usb_enable(); program_loop: - ioport_set_pin_level(LED1, 1); + #if BOARD_VER_MAJOR >= 1 && BOARD_VER_MINOR >= 2 && BOARD_VER_MICRO >=3 + ioport_set_pin_level(LED1, 1); + #endif while(getchar() != '!'); printf ("C\r\n"); - ioport_set_pin_level(LED1, 0); + #if BOARD_VER_MAJOR >= 1 && BOARD_VER_MINOR >= 2 && BOARD_VER_MICRO >=3 + ioport_set_pin_level(LED1, 1); + #endif command_handler(getchar()); goto program_loop; } -- GitLab