Skip to content

Commit

Permalink
refactor: system-wide refactoring
Browse files Browse the repository at this point in the history
* update to latest libraries
* rework hwa implementations for hw and tests: implementations are no longer in main.cpp but in module directories instead
* use common/deps headers for most modules
* use consistent init order
* lowercase all the filenames
* use consistent variable naming
* remove cdc passthrough mode
* update licence text
* update linting rules
* update code formatting
  • Loading branch information
paradajz committed Dec 9, 2024
1 parent af61a0d commit 0ebf907
Show file tree
Hide file tree
Showing 303 changed files with 11,405 additions and 10,494 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ Most of the code is available under Apache Licence v2.0, with the following exce

* `modules`:
* `avr-libstdcpp`: GNU GPL v3 or later with GCC Runtime Library Exception 3.1
* `core`: MIT
* `dbms`: MIT
* `EmuEEPROM`: MIT
* `lufa`: Modified MIT, see `modules/core/modules/lufa/LUFA/Licence.txt` for details
* `midi`: MIT
* `sysex`: MIT
* `libcore`: MIT
* `liblessdb`: MIT
* `libemueeprom`: MIT
* `lufa`: Modified MIT, see `modules/libcore/modules/lufa/LUFA/Licence.txt` for details
* `libmidi`: MIT
* `libsysexconf`: MIT
* `u8g2`: Two-clause BSD
* `unity`: MIT
* `tinyusb`: MIT, but many modules it uses are individually licenced, check for more details
2 changes: 1 addition & 1 deletion scripts/gen/gen_hw_test_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ yaml_file=$2
gen_dir=$3
yaml_parser="dasel -n -p yaml --plain -f"
target_name=$(basename "$yaml_file" .yml)
out_header="$gen_dir"/HWTestDefines.h
out_header="$gen_dir"/hw_test_defines.h

mkdir -p "$gen_dir"
echo "" > "$out_header"
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen/gen_mcu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ done

script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
yaml_parser="dasel -n -p yaml --plain -f"
core_yaml_file=$(make --no-print-directory -C "$WORKSPACE_DIR"/modules/core MCU="$mcu" print-MCU_YML_FILE)
core_yaml_file=$(make --no-print-directory -C "$WORKSPACE_DIR"/modules/libcore MCU="$mcu" print-MCU_YML_FILE)
out_header="$gen_dir"/MCU.h
out_cmakelists="$gen_dir"/CMakeLists.txt
project_yaml_file=${script_dir}/../../config/mcu/$mcu.yml
Expand All @@ -31,7 +31,7 @@ cmake_usb_defines_var=PROJECT_USB_DEFINES

if [[ ! -d $gen_dir ]]
then
if ! make --no-print-directory -C "$WORKSPACE_DIR"/modules/core MCU="$mcu" MCU_GEN_DIR="$gen_dir" MCU_GEN_USB=1 MCU_EXT_CLOCK_MHZ="$extClockMhz"
if ! make --no-print-directory -C "$WORKSPACE_DIR"/modules/libcore MCU="$mcu" MCU_GEN_DIR="$gen_dir" MCU_GEN_USB=1 MCU_EXT_CLOCK_MHZ="$extClockMhz"
then
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen/gen_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ done

script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
yaml_parser="dasel -n -p yaml --plain -f"
out_header="$gen_dir"/Target.h
out_header="$gen_dir"/target.h
mcu=$($yaml_parser "$yaml_file" mcu)
target_name=$(basename "$yaml_file" .yml)
mcu_gen_dir=$base_mcu_gen_dir/$mcu
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen/gen_touchscreen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ for arg in "$@"; do
done

json_parser="dasel -n -p json --plain -f"
out_src=$gen_dir/Touchscreen.cpp
out_src=$gen_dir/touchscreen.cpp

echo "Generating touchscreen coordinate file..."

Expand All @@ -26,7 +26,7 @@ then
total_components=$($json_parser "$config" components --length)

{
printf "%s\n\n" "#include \"application/database/Database.h\""
printf "%s\n\n" "#include \"application/database/database.h\""
printf "%s\n" "void database::Admin::customInitTouchscreen()"
printf "%s\n" "{"
} > "$out_src"
Expand Down
8 changes: 4 additions & 4 deletions scripts/gen/target/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

{
printf "%s\n\n" "#pragma once"
printf "%s\n" "#include \"core/MCU.h\""
printf "%s\n" "#include \"core/arch/common/UART.h\""
printf "%s\n" "#include \"core/arch/common/I2C.h\""
printf "%s\n" "#include \"core/mcu.h\""
printf "%s\n" "#include \"core/arch/common/uart.h\""
printf "%s\n" "#include \"core/arch/common/i2c.h\""
} >> "$out_header"

target_name_string=$($yaml_parser "$yaml_file" targetNameOverride)
Expand All @@ -30,4 +30,4 @@ do
fi
done

printf "\n%s" "#include \"common/Map.h.include\"" >> "$out_header"
printf "\n%s" "#include \"common/map.h.include\"" >> "$out_header"
2 changes: 1 addition & 1 deletion scripts/gen/target/unused_io.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ then

{
printf "%s\n" "namespace gen {"
printf "%s\n" "constexpr inline board::detail::io::unused::unusedIO_t UNUSED_PIN[PROJECT_TARGET_NR_OF_UNUSED_IO] = {"
printf "%s\n" "constexpr inline board::detail::io::unused::UnusedIo UNUSED_PIN[PROJECT_TARGET_NR_OF_UNUSED_IO] = {"
} >> "$out_header"

for ((i=0; i<unused_pins; i++))
Expand Down
56 changes: 27 additions & 29 deletions src/firmware/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,34 @@ if(NOT "PROJECT_TARGET_USB_OVER_SERIAL_HOST" IN_LIST PROJECT_TARGET_DEFINES)
${PROJECT_ROOT}/src/generated/application/${TARGET}/*.cpp
)

add_module(LESSDB)
add_mcu_library(lessdb-lib)
add_module(liblessdb)
add_mcu_library(liblessdb)

add_module(SysExConf)
add_mcu_library(sysexconf-lib)
add_module(libsysexconf)
add_mcu_library(libsysexconf)

add_module(MIDI)
add_mcu_library(midi-lib)
add_module(libmidi)
add_mcu_library(libmidi)

target_sources(application
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/io/buttons/Buttons.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/model/viewtech/Viewtech.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/model/Builder.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/model/nextion/Nextion.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/Touchscreen.cpp
${CMAKE_CURRENT_LIST_DIR}/io/leds/LEDs.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/I2C.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/peripherals/display/Display.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/peripherals/display/Elements.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/peripherals/Builder.cpp
${CMAKE_CURRENT_LIST_DIR}/io/encoders/Encoders.cpp
${CMAKE_CURRENT_LIST_DIR}/io/analog/Analog.cpp
${CMAKE_CURRENT_LIST_DIR}/protocol/midi/MIDI.cpp
${CMAKE_CURRENT_LIST_DIR}/database/CustomInit.cpp
${CMAKE_CURRENT_LIST_DIR}/database/Database.cpp
${CMAKE_CURRENT_LIST_DIR}/system/System.cpp
${CMAKE_CURRENT_LIST_DIR}/util/scheduler/Scheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/util/cinfo/CInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/util/configurable/Configurable.cpp
${CMAKE_CURRENT_LIST_DIR}/io/buttons/buttons.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/models/viewtech/viewtech.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/models/nextion/nextion.cpp
${CMAKE_CURRENT_LIST_DIR}/io/touchscreen/touchscreen.cpp
${CMAKE_CURRENT_LIST_DIR}/io/leds/leds.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/i2c.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/peripherals/display/display.cpp
${CMAKE_CURRENT_LIST_DIR}/io/i2c/peripherals/display/elements.cpp
${CMAKE_CURRENT_LIST_DIR}/io/encoders/encoders.cpp
${CMAKE_CURRENT_LIST_DIR}/io/analog/analog.cpp
${CMAKE_CURRENT_LIST_DIR}/protocol/midi/midi.cpp
${CMAKE_CURRENT_LIST_DIR}/database/custom_init.cpp
${CMAKE_CURRENT_LIST_DIR}/database/database.cpp
${CMAKE_CURRENT_LIST_DIR}/system/system.cpp
${CMAKE_CURRENT_LIST_DIR}/util/scheduler/scheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/util/cinfo/cinfo.cpp
${CMAKE_CURRENT_LIST_DIR}/util/configurable/configurable.cpp
${CMAKE_CURRENT_LIST_DIR}/main.cpp
${WORKSPACE_ROOT}/modules/u8g2/csrc/u8x8_string.c
${WORKSPACE_ROOT}/modules/u8g2/csrc/u8x8_setup.c
Expand All @@ -88,9 +86,9 @@ if(NOT "PROJECT_TARGET_USB_OVER_SERIAL_HOST" IN_LIST PROJECT_TARGET_DEFINES)
target_link_libraries(application
PRIVATE
${BOARD_APPLICATION_LIBRARIES}
lessdb-lib
sysexconf-lib
midi-lib
liblessdb
libsysexconf
libmidi
)

add_custom_command(
Expand All @@ -110,7 +108,7 @@ if(NOT "PROJECT_TARGET_USB_OVER_SERIAL_HOST" IN_LIST PROJECT_TARGET_DEFINES)
$<TARGET_FILE:application>.hex
)

if (TARGET emueeprom-lib)
if (TARGET libemueeprom)
set(FLASHGEN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/flashgen)
set(FLASHGEN_BINARY ${FLASHGEN_BINARY_DIR}/flashgen)
set(FLASHGEN_OUTPUT ${FLASHGEN_BINARY_DIR}/generated_config.hex)
Expand Down
64 changes: 0 additions & 64 deletions src/firmware/application/database/CustomInit.cpp

This file was deleted.

Loading

0 comments on commit 0ebf907

Please sign in to comment.