Merge remote-tracking branch 'upstream/main' into motion_wip
commit
787c73ecff
|
|
@ -5,7 +5,7 @@ repos:
|
||||||
rev: 'v0.6.0'
|
rev: 'v0.6.0'
|
||||||
hooks:
|
hooks:
|
||||||
- id: cmake-format # cmake formatter
|
- id: cmake-format # cmake formatter
|
||||||
files: (CMakeLists.*|.*\.cmake^|.*\.cmake.in)
|
files: ^(CMakeLists.*|.*\.cmake|.*\.cmake.in)$
|
||||||
- repo: https://github.com/pre-commit/mirrors-yapf
|
- repo: https://github.com/pre-commit/mirrors-yapf
|
||||||
rev: 'v0.27.0'
|
rev: 'v0.27.0'
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
||||||
|
|
@ -9,29 +9,14 @@ project(
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
|
||||||
#
|
|
||||||
# If we are not crosscompiling, include `utils` with host tools.
|
|
||||||
#
|
|
||||||
add_subdirectory(utils)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Command Line Options
|
# Command Line Options
|
||||||
#
|
#
|
||||||
# You should specify those options when invoking CMake. Example:
|
# You should specify those options when invoking CMake. Example:
|
||||||
# ~~~
|
# ~~~
|
||||||
# cmake .. <other options> -DPRINTER=MMU
|
# cmake .. <other options> -DCUSTOM_COMPILE_OPTIONS=-DENABLE_FEATURE_X
|
||||||
# ~~~
|
# ~~~
|
||||||
|
|
||||||
set(PRINTER_VALID_OPTS "MMU")
|
|
||||||
|
|
||||||
set(PRINTER
|
|
||||||
"MMU"
|
|
||||||
CACHE
|
|
||||||
STRING
|
|
||||||
"Select the MMU unit for which you want to compile the project (valid values are ${PRINTER_VALID_OPTS})."
|
|
||||||
)
|
|
||||||
set(PROJECT_VERSION_SUFFIX
|
set(PROJECT_VERSION_SUFFIX
|
||||||
"<auto>"
|
"<auto>"
|
||||||
CACHE
|
CACHE
|
||||||
|
|
@ -53,13 +38,6 @@ set(CUSTOM_COMPILE_OPTIONS
|
||||||
CACHE STRING "Allows adding custom C/C++ flags"
|
CACHE STRING "Allows adding custom C/C++ flags"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Validate options
|
|
||||||
foreach(OPTION "PRINTER")
|
|
||||||
if(NOT ${OPTION} IN_LIST ${OPTION}_VALID_OPTS)
|
|
||||||
message(FATAL_ERROR "Invalid ${OPTION} ${${OPTION}}: Valid values are ${${OPTION}_VALID_OPTS}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# Resolve BUILD_NUMBER and PROJECT_VERSION_* variables
|
# Resolve BUILD_NUMBER and PROJECT_VERSION_* variables
|
||||||
resolve_version_variables()
|
resolve_version_variables()
|
||||||
|
|
||||||
|
|
@ -86,7 +64,6 @@ message(
|
||||||
STATUS "Project version with short suffix: ${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX_SHORT}"
|
STATUS "Project version with short suffix: ${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX_SHORT}"
|
||||||
)
|
)
|
||||||
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
|
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
|
||||||
message(STATUS "Printer: ${PRINTER}")
|
|
||||||
|
|
||||||
# eclipse sets those variables, so lets just use them so we don't get a warning about unused
|
# eclipse sets those variables, so lets just use them so we don't get a warning about unused
|
||||||
# variables
|
# variables
|
||||||
|
|
@ -185,56 +162,16 @@ endif()
|
||||||
|
|
||||||
# add_link_dependency(firmware "${LINKER_SCRIPT}")
|
# add_link_dependency(firmware "${LINKER_SCRIPT}")
|
||||||
|
|
||||||
target_include_directories(firmware PRIVATE include src)
|
target_include_directories(firmware PRIVATE src)
|
||||||
|
|
||||||
target_compile_options(firmware PRIVATE -Wdouble-promotion)
|
target_compile_options(firmware PRIVATE -Wdouble-promotion)
|
||||||
target_sources(
|
|
||||||
firmware
|
|
||||||
PRIVATE src/main.cpp
|
|
||||||
src/hal/avr/cpu.cpp
|
|
||||||
src/hal/avr/usart.cpp
|
|
||||||
src/hal/avr/shr16.cpp
|
|
||||||
src/hal/avr/eeprom.cpp
|
|
||||||
src/hal/avr/tmc2130.cpp
|
|
||||||
src/hal/adc.cpp
|
|
||||||
src/modules/protocol.cpp
|
|
||||||
src/modules/buttons.cpp
|
|
||||||
src/modules/debouncer.cpp
|
|
||||||
src/modules/finda.cpp
|
|
||||||
src/modules/fsensor.cpp
|
|
||||||
src/modules/globals.cpp
|
|
||||||
src/modules/idler.cpp
|
|
||||||
src/modules/leds.cpp
|
|
||||||
src/modules/motion.cpp
|
|
||||||
src/modules/pulse_gen.cpp
|
|
||||||
src/modules/permanent_storage.cpp
|
|
||||||
src/modules/selector.cpp
|
|
||||||
src/modules/timebase.cpp
|
|
||||||
src/modules/user_input.cpp
|
|
||||||
src/modules/speed_table.cpp
|
|
||||||
src/logic/command_base.cpp
|
|
||||||
src/logic/cut_filament.cpp
|
|
||||||
src/logic/eject_filament.cpp
|
|
||||||
src/logic/feed_to_bondtech.cpp
|
|
||||||
src/logic/feed_to_finda.cpp
|
|
||||||
src/logic/load_filament.cpp
|
|
||||||
src/logic/no_command.cpp
|
|
||||||
src/logic/tool_change.cpp
|
|
||||||
src/logic/unload_filament.cpp
|
|
||||||
src/logic/unload_to_finda.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set_property(
|
add_subdirectory(src)
|
||||||
SOURCE src/version.c
|
|
||||||
APPEND
|
|
||||||
PROPERTY COMPILE_DEFINITIONS
|
|
||||||
FW_BUILD_NUMBER=${BUILD_NUMBER}
|
|
||||||
FW_VERSION_FULL=${PROJECT_VERSION_FULL}
|
|
||||||
FW_VERSION=${PROJECT_VERSION}
|
|
||||||
FW_VERSION_SUFFIX=${PROJECT_VERSION_SUFFIX}
|
|
||||||
FW_VERSION_SUFFIX_SHORT=${PROJECT_VERSION_SUFFIX_SHORT}
|
|
||||||
)
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
# do not build the firmware by default (tests are the focus if not crosscompiling)
|
||||||
|
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL YES)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
target_sources(
|
||||||
|
firmware
|
||||||
|
PRIVATE main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set_property(
|
||||||
|
SOURCE src/version.c
|
||||||
|
APPEND
|
||||||
|
PROPERTY COMPILE_DEFINITIONS
|
||||||
|
FW_BUILD_NUMBER=${BUILD_NUMBER}
|
||||||
|
FW_VERSION_FULL=${PROJECT_VERSION_FULL}
|
||||||
|
FW_VERSION=${PROJECT_VERSION}
|
||||||
|
FW_VERSION_SUFFIX=${PROJECT_VERSION_SUFFIX}
|
||||||
|
FW_VERSION_SUFFIX_SHORT=${PROJECT_VERSION_SUFFIX_SHORT}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(hal)
|
||||||
|
add_subdirectory(logic)
|
||||||
|
add_subdirectory(modules)
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
target_sources(
|
||||||
|
firmware PRIVATE avr/cpu.cpp avr/usart.cpp avr/shr16.cpp avr/eeprom.cpp avr/tmc2130.cpp adc.cpp
|
||||||
|
)
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#ifndef __AVR__
|
#include "../limits.h"
|
||||||
#include <limits>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// A generic circular index class which can be used to build circular buffers
|
/// A generic circular index class which can be used to build circular buffers
|
||||||
/// Can hold up to size elements
|
/// Can hold up to size elements
|
||||||
|
|
@ -15,10 +11,8 @@
|
||||||
template <typename index_t = uint_fast8_t, index_t size = 16>
|
template <typename index_t = uint_fast8_t, index_t size = 16>
|
||||||
class CircularIndex {
|
class CircularIndex {
|
||||||
public:
|
public:
|
||||||
#ifndef __AVR__
|
|
||||||
static_assert(size <= std::numeric_limits<index_t>::max() / 2,
|
static_assert(size <= std::numeric_limits<index_t>::max() / 2,
|
||||||
"index_t is too small for the requested size");
|
"index_t is too small for the requested size");
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr inline CircularIndex()
|
constexpr inline CircularIndex()
|
||||||
: tail(0)
|
: tail(0)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#pragma once
|
||||||
|
#ifndef __AVR__
|
||||||
|
#include <limits>
|
||||||
|
#else
|
||||||
|
|
||||||
|
// A minimal std::numeric_limits for platforms that lack one
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class numeric_limits;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class numeric_limits<uint8_t> {
|
||||||
|
public:
|
||||||
|
static constexpr size_t max() { return UINT8_MAX; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
target_sources(
|
||||||
|
firmware
|
||||||
|
PRIVATE
|
||||||
|
command_base.cpp
|
||||||
|
cut_filament.cpp
|
||||||
|
eject_filament.cpp
|
||||||
|
feed_to_bondtech.cpp
|
||||||
|
feed_to_finda.cpp
|
||||||
|
load_filament.cpp
|
||||||
|
no_command.cpp
|
||||||
|
tool_change.cpp
|
||||||
|
unload_filament.cpp
|
||||||
|
unload_to_finda.cpp
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
target_sources(
|
||||||
|
firmware
|
||||||
|
PRIVATE protocol.cpp
|
||||||
|
buttons.cpp
|
||||||
|
debouncer.cpp
|
||||||
|
finda.cpp
|
||||||
|
fsensor.cpp
|
||||||
|
globals.cpp
|
||||||
|
idler.cpp
|
||||||
|
leds.cpp
|
||||||
|
motion.cpp
|
||||||
|
permanent_storage.cpp
|
||||||
|
selector.cpp
|
||||||
|
timebase.cpp
|
||||||
|
user_input.cpp
|
||||||
|
pulse_gen.cpp
|
||||||
|
)
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
#
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
# first, let's create a symbolic target for all tests
|
# first, let's create a symbolic target for all tests
|
||||||
add_custom_target(tests)
|
add_custom_target(tests)
|
||||||
|
|
||||||
# this had a reason on the Buddy FW, but on the AVR we cannot get close to having 16bit ints and
|
|
||||||
# pointers so the unit tests may be compiled 64bit afterall set(CMAKE_C_FLAGS -m32)
|
|
||||||
# set(CMAKE_CXX_FLAGS -m32)
|
|
||||||
|
|
||||||
# include catch_discover_tests function from Catch2
|
# include catch_discover_tests function from Catch2
|
||||||
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
|
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
|
||||||
|
|
||||||
|
|
@ -21,6 +17,9 @@ endfunction()
|
||||||
add_executable(system_tests ${CMAKE_CURRENT_SOURCE_DIR}/system_test.cpp)
|
add_executable(system_tests ${CMAKE_CURRENT_SOURCE_DIR}/system_test.cpp)
|
||||||
add_catch_test(system_tests)
|
add_catch_test(system_tests)
|
||||||
|
|
||||||
|
set(MODULES_STUBS_DIR ${CMAKE_SOURCE_DIR}/tests/unit/modules/stubs)
|
||||||
|
set(LOGIC_STUBS_DIR ${CMAKE_SOURCE_DIR}/tests/unit/logic/stubs)
|
||||||
|
|
||||||
# now, include all the unit tests; they should add themselves using the add_catch_test function
|
# now, include all the unit tests; they should add themselves using the add_catch_test function
|
||||||
add_subdirectory(hal)
|
add_subdirectory(hal)
|
||||||
add_subdirectory(logic)
|
add_subdirectory(logic)
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,29 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
cut_filament_tests
|
cut_filament_tests
|
||||||
../../../../src/logic/cut_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/cut_filament.cpp
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/logic/unload_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp
|
||||||
../../../../src/logic/unload_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_cut_filament.cpp
|
test_cut_filament.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,29 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
eject_filament_tests
|
eject_filament_tests
|
||||||
../../../../src/logic/eject_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/eject_filament.cpp
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/logic/unload_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp
|
||||||
../../../../src/logic/unload_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
../stubs/stub_motion.cpp
|
|
||||||
test_eject_filament.cpp
|
test_eject_filament.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
feed_to_bondtech_tests
|
feed_to_bondtech_tests
|
||||||
../../../../src/logic/feed_to_bondtech.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_feed_to_bondtech.cpp
|
test_feed_to_bondtech.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
feed_to_finda_tests
|
feed_to_finda_tests
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_feed_to_finda.cpp
|
test_feed_to_finda.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
load_filament_tests
|
load_filament_tests
|
||||||
../../../../src/logic/feed_to_bondtech.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/logic/load_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/load_filament.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_load_filament.cpp
|
test_load_filament.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
tool_change_tests
|
tool_change_tests
|
||||||
../../../../src/logic/feed_to_bondtech.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/logic/load_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/load_filament.cpp
|
||||||
../../../../src/logic/tool_change.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/tool_change.cpp
|
||||||
../../../../src/logic/unload_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp
|
||||||
../../../../src/logic/unload_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_tool_change.cpp
|
test_tool_change.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
unload_filament_tests
|
unload_filament_tests
|
||||||
../../../../src/logic/feed_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp
|
||||||
../../../../src/logic/unload_filament.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp
|
||||||
../../../../src/logic/unload_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_unload_filament.cpp
|
test_unload_filament.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
unload_to_finda_tests
|
unload_to_finda_tests
|
||||||
../../../../src/logic/unload_to_finda.cpp
|
${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp
|
||||||
../../../../src/modules/buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp
|
||||||
../../../../src/modules/debouncer.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
../../../../src/modules/finda.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/finda.cpp
|
||||||
../../../../src/modules/fsensor.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp
|
||||||
../../../../src/modules/globals.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/globals.cpp
|
||||||
../../../../src/modules/idler.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/idler.cpp
|
||||||
../../../../src/modules/leds.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/leds.cpp
|
||||||
../../../../src/modules/permanent_storage.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp
|
||||||
../../../../src/modules/selector.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/selector.cpp
|
||||||
../../../../src/modules/user_input.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp
|
||||||
../../../../src/modules/pulse_gen.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/pulse_gen.cpp
|
||||||
../../modules/stubs/stub_adc.cpp
|
${MODULES_STUBS_DIR}/stub_adc.cpp
|
||||||
../../modules/stubs/stub_eeprom.cpp
|
${MODULES_STUBS_DIR}/stub_eeprom.cpp
|
||||||
../../modules/stubs/stub_gpio.cpp
|
${MODULES_STUBS_DIR}/stub_gpio.cpp
|
||||||
../../modules/stubs/stub_shr16.cpp
|
${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
../../modules/stubs/stub_timebase.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp
|
||||||
../../modules/stubs/stub_tmc2130.cpp
|
${MODULES_STUBS_DIR}/stub_tmc2130.cpp
|
||||||
../stubs/main_loop_stub.cpp
|
${LOGIC_STUBS_DIR}/main_loop_stub.cpp
|
||||||
../stubs/stub_motion.cpp
|
${LOGIC_STUBS_DIR}/stub_motion.cpp
|
||||||
test_unload_to_finda.cpp
|
test_unload_to_finda.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
buttons_tests ../../../../src/modules/buttons.cpp ../../../../src/modules/debouncer.cpp
|
buttons_tests
|
||||||
../stubs/stub_adc.cpp ../stubs/stub_timebase.cpp test_buttons.cpp
|
${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp
|
||||||
|
${MODULES_STUBS_DIR}/stub_adc.cpp ${MODULES_STUBS_DIR}/stub_timebase.cpp test_buttons.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# define required search paths
|
# define required search paths
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(
|
add_executable(
|
||||||
leds_tests ../../../../src/modules/leds.cpp ../stubs/stub_shr16.cpp ../stubs/stub_timebase.cpp
|
leds_tests ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp ${MODULES_STUBS_DIR}/stub_shr16.cpp
|
||||||
test_leds.cpp
|
${MODULES_STUBS_DIR}/stub_timebase.cpp test_leds.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
# define required search paths
|
# define required search paths
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# define the test executable
|
# define the test executable
|
||||||
add_executable(protocol_tests ../../../../src/modules/protocol.cpp test_protocol.cpp)
|
add_executable(protocol_tests ${CMAKE_SOURCE_DIR}/src/modules/protocol.cpp test_protocol.cpp)
|
||||||
|
|
||||||
# define required search paths
|
# define required search paths
|
||||||
target_include_directories(protocol_tests PUBLIC ${CMAKE_SOURCE_DIR}/src/modules)
|
target_include_directories(protocol_tests PUBLIC ${CMAKE_SOURCE_DIR}/src/modules)
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,13 @@ dependencies = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'gcc-avr': {
|
'gcc-avr': {
|
||||||
'version': '5.4.0',
|
# dummy placeholder (currently downloading cmake just for the sake of a valid url/zip archive)
|
||||||
|
# ... we truly need the binaries! :)
|
||||||
|
'version': '0.0.0',
|
||||||
'url': {
|
'url': {
|
||||||
'Linux': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2',
|
'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.tar.gz',
|
||||||
'Windows': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-win32.zip',
|
'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-win64-x64.zip',
|
||||||
'Darwin': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-mac.tar.bz2',
|
'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Darwin-x86_64.tar.gz',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'clang-format': {
|
'clang-format': {
|
||||||
|
|
@ -61,7 +63,7 @@ dependencies = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
pip_dependencies = ['ecdsa', 'polib']
|
pip_dependencies = []
|
||||||
# yapf: enable
|
# yapf: enable
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,31 +61,6 @@ def get_dependency(name):
|
||||||
return install_dir
|
return install_dir
|
||||||
|
|
||||||
|
|
||||||
class Printer(Enum):
|
|
||||||
"""Represents the -DPRINTER CMake option."""
|
|
||||||
|
|
||||||
MMU = 'MMU'
|
|
||||||
|
|
||||||
|
|
||||||
#class Bootloader(Enum):
|
|
||||||
# """Represents the -DBOOTLOADER CMake option."""
|
|
||||||
#
|
|
||||||
# NO = 'NO'
|
|
||||||
# EMPTY = 'EMPTY'
|
|
||||||
# YES = 'YES'
|
|
||||||
#
|
|
||||||
# @property
|
|
||||||
# def file_component(self):
|
|
||||||
# if self == Bootloader.NO:
|
|
||||||
# return 'NOBOOT'
|
|
||||||
# elif self == Bootloader.EMPTY:
|
|
||||||
# return 'EMPTYBOOT'
|
|
||||||
# elif self == Bootloader.YES:
|
|
||||||
# return 'BOOT'
|
|
||||||
# else:
|
|
||||||
# raise NotImplementedError
|
|
||||||
|
|
||||||
|
|
||||||
class BuildType(Enum):
|
class BuildType(Enum):
|
||||||
"""Represents the -DCONFIG CMake option."""
|
"""Represents the -DCONFIG CMake option."""
|
||||||
|
|
||||||
|
|
@ -93,15 +68,6 @@ class BuildType(Enum):
|
||||||
RELEASE = 'RELEASE'
|
RELEASE = 'RELEASE'
|
||||||
|
|
||||||
|
|
||||||
#class HostTool(Enum):
|
|
||||||
# """Known host tools."""
|
|
||||||
#
|
|
||||||
# png2font = "png2font"
|
|
||||||
# bin2cc = "bin2cc"
|
|
||||||
# hex2dfu = "hex2dfu"
|
|
||||||
# makefsdata = "makefsdata"
|
|
||||||
|
|
||||||
|
|
||||||
class BuildConfiguration(ABC):
|
class BuildConfiguration(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_cmake_cache_entries(self):
|
def get_cmake_cache_entries(self):
|
||||||
|
|
@ -121,14 +87,12 @@ class BuildConfiguration(ABC):
|
||||||
|
|
||||||
class FirmwareBuildConfiguration(BuildConfiguration):
|
class FirmwareBuildConfiguration(BuildConfiguration):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
printer: Printer,
|
|
||||||
build_type: BuildType,
|
build_type: BuildType,
|
||||||
toolchain: Path = None,
|
toolchain: Path = None,
|
||||||
generator: str = None,
|
generator: str = None,
|
||||||
version_suffix: str = None,
|
version_suffix: str = None,
|
||||||
version_suffix_short: str = None,
|
version_suffix_short: str = None,
|
||||||
custom_entries: List[str] = None):
|
custom_entries: List[str] = None):
|
||||||
self.printer = printer
|
|
||||||
self.build_type = build_type
|
self.build_type = build_type
|
||||||
self.toolchain = toolchain or FirmwareBuildConfiguration.default_toolchain(
|
self.toolchain = toolchain or FirmwareBuildConfiguration.default_toolchain(
|
||||||
)
|
)
|
||||||
|
|
@ -139,8 +103,7 @@ class FirmwareBuildConfiguration(BuildConfiguration):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_toolchain() -> Path:
|
def default_toolchain() -> Path:
|
||||||
return Path(
|
return Path(__file__).resolve().parent.parent / 'cmake/AnyAvrGcc.cmake'
|
||||||
__file__).resolve().parent.parent / 'cmake/AnyAvrGcc.cmake'
|
|
||||||
|
|
||||||
def get_cmake_cache_entries(self):
|
def get_cmake_cache_entries(self):
|
||||||
entries = []
|
entries = []
|
||||||
|
|
@ -149,7 +112,6 @@ class FirmwareBuildConfiguration(BuildConfiguration):
|
||||||
str(get_dependency('ninja'))))
|
str(get_dependency('ninja'))))
|
||||||
entries.extend([
|
entries.extend([
|
||||||
('CMAKE_MAKE_PROGRAM', 'FILEPATH', str(get_dependency('ninja'))),
|
('CMAKE_MAKE_PROGRAM', 'FILEPATH', str(get_dependency('ninja'))),
|
||||||
('PRINTER', 'STRING', self.printer.value),
|
|
||||||
('CMAKE_TOOLCHAIN_FILE', 'FILEPATH', str(self.toolchain)),
|
('CMAKE_TOOLCHAIN_FILE', 'FILEPATH', str(self.toolchain)),
|
||||||
('CMAKE_BUILD_TYPE', 'STRING', self.build_type.value.title()),
|
('CMAKE_BUILD_TYPE', 'STRING', self.build_type.value.title()),
|
||||||
('PROJECT_VERSION_SUFFIX', 'STRING', self.version_suffix or ''),
|
('PROJECT_VERSION_SUFFIX', 'STRING', self.version_suffix or ''),
|
||||||
|
|
@ -170,7 +132,6 @@ class FirmwareBuildConfiguration(BuildConfiguration):
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
components = [
|
components = [
|
||||||
self.printer.name,
|
|
||||||
self.build_type.value,
|
self.build_type.value,
|
||||||
]
|
]
|
||||||
return '_'.join(components)
|
return '_'.join(components)
|
||||||
|
|
@ -178,7 +139,6 @@ class FirmwareBuildConfiguration(BuildConfiguration):
|
||||||
|
|
||||||
class BuildResult:
|
class BuildResult:
|
||||||
"""Represents a result of an attempt to build the project."""
|
"""Represents a result of an attempt to build the project."""
|
||||||
|
|
||||||
def __init__(self, config_returncode: int, build_returncode: Optional[int],
|
def __init__(self, config_returncode: int, build_returncode: Optional[int],
|
||||||
stdout: Path, stderr: Path, products: List[Path]):
|
stdout: Path, stderr: Path, products: List[Path]):
|
||||||
self.config_returncode = config_returncode
|
self.config_returncode = config_returncode
|
||||||
|
|
@ -281,7 +241,6 @@ def store_products(products: List[Path], build_config: BuildConfiguration,
|
||||||
|
|
||||||
def list_of(EnumType):
|
def list_of(EnumType):
|
||||||
"""Create an argument-parser for comma-separated list of values of some Enum subclass."""
|
"""Create an argument-parser for comma-separated list of values of some Enum subclass."""
|
||||||
|
|
||||||
def convert(val):
|
def convert(val):
|
||||||
if val == '':
|
if val == '':
|
||||||
return []
|
return []
|
||||||
|
|
@ -305,12 +264,6 @@ def cmake_cache_entry(arg):
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
# yapf: disable
|
# yapf: disable
|
||||||
parser.add_argument(
|
|
||||||
'--printer',
|
|
||||||
type=list_of(Printer),
|
|
||||||
default=list(Printer),
|
|
||||||
help='Printer type (default: {default}).'.format(
|
|
||||||
default=','.join(str(p.value.lower()) for p in Printer)))
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--build-type',
|
'--build-type',
|
||||||
type=list_of(BuildType),
|
type=list_of(BuildType),
|
||||||
|
|
@ -348,12 +301,6 @@ def main():
|
||||||
'--toolchain',
|
'--toolchain',
|
||||||
type=Path,
|
type=Path,
|
||||||
help='Path to a CMake toolchain file to be used.')
|
help='Path to a CMake toolchain file to be used.')
|
||||||
parser.add_argument(
|
|
||||||
'--host-tools',
|
|
||||||
action='store_true',
|
|
||||||
help=('Build host tools (png2font and others). '
|
|
||||||
'Turned on by default with --generate-cproject only.')
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--no-build',
|
'--no-build',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|
@ -388,13 +335,11 @@ def main():
|
||||||
# prepare configurations
|
# prepare configurations
|
||||||
configurations = [
|
configurations = [
|
||||||
FirmwareBuildConfiguration(
|
FirmwareBuildConfiguration(
|
||||||
printer=printer,
|
|
||||||
build_type=build_type,
|
build_type=build_type,
|
||||||
version_suffix=args.version_suffix,
|
version_suffix=args.version_suffix,
|
||||||
version_suffix_short=args.version_suffix_short,
|
version_suffix_short=args.version_suffix_short,
|
||||||
generator=args.generator,
|
generator=args.generator,
|
||||||
custom_entries=args.cmake_def) for printer in args.printer
|
custom_entries=args.cmake_def) for build_type in args.build_type
|
||||||
for build_type in args.build_type
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# build everything
|
# build everything
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
FROM gcc:11.1
|
||||||
|
RUN apt-get clean && \
|
||||||
|
apt-get update -qq -y && \
|
||||||
|
apt-get install curl python3 python3-pip libncurses5 -y
|
||||||
|
RUN pip3 install pre-commit ecdsa
|
||||||
|
WORKDIR /work
|
||||||
|
ADD utils/bootstrap.py bootstrap.py
|
||||||
|
RUN gcc --version
|
||||||
|
RUN python3 bootstrap.py
|
||||||
|
|
@ -0,0 +1,117 @@
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
dockerfile {
|
||||||
|
label 'docker'
|
||||||
|
filename 'utils/holly/Dockerfile'
|
||||||
|
additionalBuildArgs '-t prusa-firmware-mmu'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
string(name: 'VERSION_SUFFIX', defaultValue: '<default>', description: 'Specify custom version suffix for the build (e.g. "-RC1+1010"). Set to "<default>" to use the default one. Leave empty to make a final-version build without any suffix.')
|
||||||
|
string(name: 'VERSION_SUFFIX_SHORT', defaultValue: '<default>', description: 'Specify custom version suffix for the build (e.g. "-RC1"). Set to "<default>" to use the default one. Leave empty to make a final-version build without any suffix.')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Prepare Build Stages') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// required configurations
|
||||||
|
def configurations = [
|
||||||
|
[build_type: "release"],
|
||||||
|
]
|
||||||
|
|
||||||
|
// prepare version suffix
|
||||||
|
def commit_nr = sh(script: 'git rev-list HEAD --count', returnStdout: true).trim()
|
||||||
|
def short_suffix
|
||||||
|
def full_suffix
|
||||||
|
if (env.CHANGE_ID) {
|
||||||
|
// This is a PR build
|
||||||
|
short_suffix = "-BETA+${commit_nr}"
|
||||||
|
full_suffix = "${short_suffix}.PR${env.CHANGE_ID}.B${env.BUILD_NUMBER}"
|
||||||
|
} else if (env.BRANCH_NAME.startsWith("RELEASE-")) {
|
||||||
|
// This is an RC build
|
||||||
|
short_suffix = "-RC+${commit_nr}"
|
||||||
|
full_suffix = "${short_suffix}.B${env.BUILD_NUMBER}"
|
||||||
|
} else {
|
||||||
|
// This is build of an ordinary branch (not a release branch)
|
||||||
|
short_suffix = "-BETA+${commit_nr}"
|
||||||
|
def branch_spec = env.BRANCH_NAME.replaceAll("_", "-")
|
||||||
|
full_suffix = "${short_suffix}.BRANCH-${branch_spec}.B${env.BUILD_NUMBER}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.VERSION_SUFFIX != '<default>') {
|
||||||
|
full_suffix = params.VERSION_SUFFIX
|
||||||
|
}
|
||||||
|
if (params.VERSION_SUFFIX_SHORT != '<default>') {
|
||||||
|
short_suffix = params.VERSION_SUFFIX_SHORT
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the build stages
|
||||||
|
configurations.each { config ->
|
||||||
|
stage("Build - ${config.build_type}") {
|
||||||
|
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||||
|
sh """
|
||||||
|
exit 0 # temporarily disable building (as we don't have avr-gcc in dependencies)
|
||||||
|
ln -fs /.dependencies
|
||||||
|
python3 utils/build.py \
|
||||||
|
--build-type ${config.build_type} \
|
||||||
|
--generate-bbf \
|
||||||
|
--generate-dfu \
|
||||||
|
--no-store-output \
|
||||||
|
--version-suffix=${full_suffix} \
|
||||||
|
--version-suffix-short=${short_suffix} \
|
||||||
|
-DCUSTOM_COMPILE_OPTIONS:STRING=-Werror
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Check Formatting') {
|
||||||
|
when {
|
||||||
|
expression { env.CHANGE_TARGET }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh """
|
||||||
|
export XDG_CACHE_HOME=\$PWD/.precommit
|
||||||
|
pre-commit install
|
||||||
|
pre-commit run \
|
||||||
|
--source remotes/origin/${env.CHANGE_TARGET} \
|
||||||
|
--origin HEAD \
|
||||||
|
--show-diff-on-failure \
|
||||||
|
--hook-stage manual
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
sh """
|
||||||
|
python3 utils/bootstrap.py
|
||||||
|
export PATH=\$PWD/.dependencies/cmake-3.15.5/bin:\$PWD/.dependencies/ninja-1.9.0:\$PATH
|
||||||
|
mkdir -p build-test
|
||||||
|
LD_LIBRARY_PATH=/usr/local/lib32 \$PWD/.dependencies/cmake-3.15.5/bin/ctest --build-and-test . build-test \
|
||||||
|
-DCMAKE_MAKE_PROGRAM=\$PWD/.dependencies/ninja-1.9.0/ninja \
|
||||||
|
--build-generator Ninja \
|
||||||
|
--build-target tests \
|
||||||
|
--test-command ctest
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
// archive build products
|
||||||
|
//archiveArtifacts artifacts: 'build/products/*', fingerprint: true
|
||||||
|
// archive test products
|
||||||
|
archiveArtifacts artifacts: 'build-test/Testing/Temporary/LastTest.log'
|
||||||
|
}
|
||||||
|
cleanup {
|
||||||
|
deleteDir()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue