1
0

Partially fixed virtual builds

This commit re-enables virtual builds with the Model01 keyboard.

The commit also prepares the infrastructure to generate virtual builds with all other
keyboards currently supported.

Please note that this commit does not enable virtual builds of the stock firmware
right away. This is because currently the stock firmware uses the
Model01-Testmode which is not compatible with virtual builds.

The stock firmware could be made ready for virtual builds by replacing the
Model01-Testmode with the more general HardwareTestMode.

In general for those features/plugins that do not support virtual builds,
this commit adds the generation of compiler error messages
that inform about what parts of the sketch need to be changed to allow virtual
builds.

To allow the stock firmware to build for the virtual core, just remove the
Model01-TestMode, then run the build on a unixoid system as follows.

cd ..../libraries/Model01-Firmware
ARCH=x86 make

With this change, virtual builds are furtheron triggered via setting ARCH=x86.
The board that firmware is meant to be build for is defined through the
BOARD variable, just like with non-virtual builds.

Please note that it is currently not yet possible to run virtual builds for
other keyboards than the Model01. This as because only for the Model01
specification files Model01_Spec.h/cpp have been generated.

To enable virtual builds for all keyboards, specification files need to be
factored out for all keyboards apart from Model01.

After all keyboards will have been made available to virtual builds
through future changes, it will be possible to build the whole examples set
as

cd ..../libraries/Kaleidoscope
ARCH=x86 BOARD_HARDWARE_PATH=$PWD/../../../.. make smoke-examples

Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
This commit is contained in:
Florian Fleissner 2019-06-02 12:18:04 +02:00 committed by Jesse Vincent
parent 821e2d3cf2
commit f95d9e5084
4 changed files with 134 additions and 14 deletions

View File

@ -37,7 +37,8 @@ model01.build.usb_manufacturer="Keyboardio"
model01.build.board=AVR_MODEL01 model01.build.board=AVR_MODEL01
model01.build.core=arduino:arduino model01.build.core=arduino:arduino
model01.build.variant=model01 model01.build.variant=model01
model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' # TODO - the hardware spec / hardware duplication here makes Jesse unhappy. he would not like to see it live here long-term
model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"' '-DKALEIDOSCOPE_HARDWARE_SPEC_H="kaleidoscope/hardware/keyboardio/Model01_Spec.h"'

View File

@ -1,7 +1,87 @@
virtual.name="Kaleidoscope Virtual Keyboard" # See: http://code.google.com/p/arduino/wiki/Platforms
virtual.build.usb_product="Kaleidoscope Virtual Keyboard"
virtual.build.usb_manufacturer="Kaleidoscope" #menu.cpu=Processor
virtual.build.board=VIRTUAL #menu.bootloader=Bootloader
virtual.build.core=virtual #menu.pinout=Pinout
virtual.build.variant=virtual
virtual.build.extra_flags=-DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Virtual.h" ##############################################################
model01.name=Keyboardio Model 01
model01.build.usb_product="Model 01"
model01.build.usb_manufacturer="Keyboardio"
model01.build.board=AVR_MODEL01
model01.build.core=virtual
model01.build.variant=model01
model01.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="kaleidoscope/hardware/keyboardio/Model01_Spec.h"' '-DKALEIDOSCOPE_MCU_H="mcu/atmega32u4.h"'
keyboardio_imago.name=Keyboardio Imago
keyboardio_imago.build.usb_product="Imago"
keyboardio_imago.build.usb_manufacturer="Keyboardio"
keyboardio_imago.build.board=AVR_KEYBOARDIO_IMAGO
keyboardio_imago.build.core=arduino:arduino
keyboardio_imago.build.variant=keyboardio-imago
keyboardio_imago.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-Keyboardio-Imago.h"'
####################
planck.name=OLKB Planck
planck.build.usb_product="Planck"
planck.build.usb_manufacturer="OLKB"
planck.build.board=AVR_PLANCK
planck.build.core=arduino:arduino
planck.build.variant=olkb-planck
planck.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-OLKB-Planck.h"'
##############################################################
ergodox.name=ErgoDox
ergodox.build.usb_product="ErgoDox EZ"
ergodox.build.usb_manufacturer="ErgoDox EZ"
ergodox.build.board=AVR_ERGODOX
ergodox.build.core=arduino:arduino
ergodox.build.variant=ergodox
ergodox.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-EZ-ErgoDox.h"' '-DKALEIDOSCOPE_ENABLE_V1_PLUGIN_API=0'
##############################################################
atreus2.name=Atreus 2 Prototype
## defaults
atreus2.build.usb_product="Atreus2"
atreus2.build.usb_manufacturer="Technomancy"
atreus2.build.board=AVR_ATREUS2
atreus2.build.core=arduino:arduino
atreus2.build.variant=atreus2
atreus2.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-Technomancy-Atreus2.h"'
atreus.name=Atreus
## defaults
atreus.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-Technomancy-Atreus.h"' -DKALEIDOSCOPE_HARDWARE_ATREUS_PINOUT_ASTAR=1
atreus.build.usb_product="Atreus"
atreus.build.usb_manufacturer="Technomancy"
atreus.build.board=AVR_ATREUS
atreus.build.core=arduino:arduino
atreus.build.variant=atreus
##############################################################
splitography.name=Splitography
splitography.build.usb_product="Splitography"
splitography.build.usb_manufacturer="SOFT/HRUF"
splitography.build.board=AVR_SPLITOGRAPHY
splitography.build.core=arduino:arduino
splitography.build.variant=softhruf-splitography
splitography.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-SOFTHRUF-Splitography.h"'
##############################################################
kbd4x.name=KBDFans KBD4x
kbd4x.build.usb_product="KBDFans"
kbd4x.build.usb_manufacturer="KBD4x"
kbd4x.build.board=AVR_KBD4X
kbd4x.build.core=arduino:arduino
kbd4x.build.variant=kbdfans-kbd4x
kbd4x.build.extra_flags={build.usb_flags} '-DKALEIDOSCOPE_HARDWARE_SPEC_H="Kaleidoscope-Hardware-KBDFans-KBD4x.h"'
##############################################################

View File

@ -269,9 +269,6 @@ long map(long, long, long, long, long);
// We just discard the PROGMEM qualifier // We just discard the PROGMEM qualifier
#define PROGMEM #define PROGMEM
#ifdef __cplusplus
extern "C" {
#endif
#ifndef PGM_P #ifndef PGM_P
#define PGM_P const char* #define PGM_P const char*
@ -283,12 +280,25 @@ extern "C" {
// We don't do anything special with PSTR // We don't do anything special with PSTR
#define PSTR(s) ((const char*)(s)) #define PSTR(s) ((const char*)(s))
#ifdef __cplusplus
// Not sure if these are acceptable substitute definitions in our context or not // Not sure if these are acceptable substitute definitions in our context or not
inline uint8_t pgm_read_byte_near(const uint8_t *addr) { return *addr; }
inline int8_t pgm_read_byte_near(const int8_t *addr) { return *addr; }
inline char pgm_read_byte_near(const char *addr) { return *addr; }
inline uint16_t pgm_read_word_near(const uint16_t *addr) { return *addr; }
inline int16_t pgm_read_word_near(const int16_t *addr) { return *addr; }
inline uint32_t pgm_read_dword_near(const uint32_t *addr) { return *addr; }
inline int32_t pgm_read_dword_near(const int32_t *addr) { return *addr; }
inline float pgm_read_float_near(const float *addr) { return *addr; }
inline const void *pgm_read_ptr_near(const void **addr) { return *addr; }
#else
#define pgm_read_byte_near(addr) (*(const byte*)(addr)) #define pgm_read_byte_near(addr) (*(const byte*)(addr))
#define pgm_read_word_near(addr) (*(const word*)(addr)) #define pgm_read_word_near(addr) (*(const word*)(addr))
#define pgm_read_dword_near(addr) (*(const dword*)(addr)) #define pgm_read_dword_near(addr) (*(const dword*)(addr))
#define pgm_read_float_near(addr) (*(const float*)(addr)) #define pgm_read_float_near(addr) (*(const float*)(addr))
#define pgm_read_ptr_near(addr) (*(const void**)(addr)) #define pgm_read_ptr_near(addr) (*(const void**)(addr))
#endif
#define pgm_read_byte_far(addr) pgm_read_byte_near(addr) #define pgm_read_byte_far(addr) pgm_read_byte_near(addr)
#define pgm_read_word_far(addr) pgm_read_word_near(addr) #define pgm_read_word_far(addr) pgm_read_word_near(addr)
#define pgm_read_dword_far(addr) pgm_read_dword_near(addr) #define pgm_read_dword_far(addr) pgm_read_dword_near(addr)
@ -301,6 +311,10 @@ extern "C" {
#define pgm_read_ptr(addr) pgm_read_ptr_near(addr) #define pgm_read_ptr(addr) pgm_read_ptr_near(addr)
#define pgm_get_far_address(var) (&(var)) #define pgm_get_far_address(var) (&(var))
#ifdef __cplusplus
extern "C" {
#endif
// _P or _PF string functions just call their standard library equivalents // _P or _PF string functions just call their standard library equivalents
#include <string.h> #include <string.h>
#define memchr_P memchr #define memchr_P memchr

View File

@ -18,10 +18,11 @@ compiler.path=
compiler.c.cmd=gcc compiler.c.cmd=gcc
compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.flags_join_archives=rcT
compiler.c.elf.cmd=g++ compiler.c.elf.cmd=g++
compiler.S.flags=-c -g -x assembler-with-cpp compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=g++ compiler.cpp.cmd=g++
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -DARDUINO_VIRTUAL=1 -DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Virtual.h"
compiler.ar.cmd=ar compiler.ar.cmd=ar
compiler.ar.flags=rcs compiler.ar.flags=rcs
compiler.objcopy.cmd=objcopy compiler.objcopy.cmd=objcopy
@ -60,8 +61,29 @@ recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -DARDUIN
archive_file_path={build.path}/{archive_file} archive_file_path={build.path}/{archive_file}
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects ################################################################################
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm ## PLEASE NOTE: The way we link our elf binary significantly differs from the
## way that Arduino handles things by default.
## The original linker command has been split up into three
## steps (recipe.c.combine.pattern, recipe.hooks.linking.postlink.1.pattern
## and recipe.hooks.linking.postlink.2.pattern).
## This is necessary to prevent link errors reporting unresolved symbols
## due to order dependencies of libraries and objects appearing
## in the linker command line.
##
## CHANGED WRT DEFAULT: Generate a large .a archive to prevent link order issues with garbage collection
recipe.c.combine.pattern="{compiler.path}/{compiler.ar.cmd}" {compiler.c.elf.flags_join_archives} "{build.path}/{build.project_name}_joined.a" {object_files} "{build.path}/{archive_file}"
##
## NEWLY INTRODUCED: Link with global garbage collection (considering all
## objects and libraries together).
recipe.hooks.linking.postlink.1.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}_joined.a" "-L{build.path}" -lm
##
## NEWLY INTRODUCED: Removing the joined library is required to avoid malformed archives that
## would otherwise result when updating a pre-existing
## joined archive file during a subsequent firmware build.
##
recipe.hooks.linking.postlink.2.pattern={tools.rm.cmd} "{build.path}/{build.project_name}_joined.a"
################################################################################
## Create output files (.eep and .hex) ## Create output files (.eep and .hex)
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
@ -111,6 +133,9 @@ tools.avrdude.bootloader.pattern=
tools.avrdude_remote.upload.pattern= tools.avrdude_remote.upload.pattern=
tools.rm.cmd=rm -f
tools.rm.cmd.windows=powershell.exe Remove-Item -LiteralPath
# USB Default Flags # USB Default Flags
# Default blank usb manufacturer will be filled in at compile time # Default blank usb manufacturer will be filled in at compile time
# - from numeric vendor ID, set to Unknown otherwise # - from numeric vendor ID, set to Unknown otherwise