mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-03 06:22:04 +00:00
unknown state
This commit is contained in:
parent
4d999378d0
commit
40a3a431ef
2
.gitignore
vendored
2
.gitignore
vendored
@ -56,7 +56,7 @@ cmake-build-debug
|
|||||||
*.pdf
|
*.pdf
|
||||||
|
|
||||||
# cmake toolchain downloads
|
# cmake toolchain downloads
|
||||||
toolchains
|
/toolchains
|
||||||
|
|
||||||
# Let these ones be user specific, since we have so many different configurations
|
# Let these ones be user specific, since we have so many different configurations
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
@ -5,8 +5,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|||||||
include(UpdateSubmodule)
|
include(UpdateSubmodule)
|
||||||
|
|
||||||
# early declaration of macro defined in toolchain
|
# early declaration of macro defined in toolchain
|
||||||
macro(add_qmk_executable _)
|
# macro(add_qmk_executable _)
|
||||||
endmacro(add_qmk_executable)
|
# endmacro(add_qmk_executable)
|
||||||
|
|
||||||
if(NOT DEFINED QMK_KEYBOARD)
|
if(NOT DEFINED QMK_KEYBOARD)
|
||||||
|
|
||||||
@ -19,6 +19,8 @@ add_subdirectory(keyboards)
|
|||||||
else()
|
else()
|
||||||
|
|
||||||
# build step
|
# build step
|
||||||
|
include(ResolveKeyboard)
|
||||||
|
resolve_keyboard(${QMK_KEYBOARD_FOLDER} QMK_KEYBOARD_FOLDER_ABS)
|
||||||
|
|
||||||
set(TEMP_PATH ${QMK_KEYBOARD_FOLDER})
|
set(TEMP_PATH ${QMK_KEYBOARD_FOLDER})
|
||||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
||||||
@ -29,9 +31,11 @@ endif()
|
|||||||
|
|
||||||
set(TEMP_PATH ${QMK_KEYMAP_FOLDER})
|
set(TEMP_PATH ${QMK_KEYMAP_FOLDER})
|
||||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYMAP_FOLDER_RELATIVE)
|
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYMAP_FOLDER_RELATIVE)
|
||||||
|
if(${IS_KEYBOARD_FOLDER_RELATIVE} AND NOT EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYMAP_FOLDER})
|
||||||
|
set(IS_KEYBOARD_FOLDER_RELATIVE FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(${IS_KEYBOARD_FOLDER_RELATIVE})
|
if(${IS_KEYBOARD_FOLDER_RELATIVE})
|
||||||
set(QMK_KEYBOARD_FOLDER_ABS ${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER})
|
|
||||||
set(QMK_KEYBOARD_CURRENT_FOLDER ${QMK_KEYBOARD_FOLDER})
|
set(QMK_KEYBOARD_CURRENT_FOLDER ${QMK_KEYBOARD_FOLDER})
|
||||||
set(QMK_KEYBOARD_FOLDERS)
|
set(QMK_KEYBOARD_FOLDERS)
|
||||||
set(QMK_KEYBOARD_FOLDER_PARTS)
|
set(QMK_KEYBOARD_FOLDER_PARTS)
|
||||||
@ -52,6 +56,8 @@ set(QMK_KEYBOARD_FOLDER_ABS ${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER}
|
|||||||
# assuming every keyboard has a default/keymap.c at some level
|
# assuming every keyboard has a default/keymap.c at some level
|
||||||
if(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c)
|
if(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c)
|
||||||
list(APPEND QMK_KEYBOARD_KEYMAPS "${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c")
|
list(APPEND QMK_KEYBOARD_KEYMAPS "${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c")
|
||||||
|
elseif(EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymap.c)
|
||||||
|
list(APPEND QMK_KEYBOARD_KEYMAPS "${CMAKE_SOURCE_DIR}/keyboards/${FOLDER}/keymap.c")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
get_filename_component(LAST_PART ${FOLDER} NAME)
|
get_filename_component(LAST_PART ${FOLDER} NAME)
|
||||||
@ -91,11 +97,15 @@ set(QMK_KEYBOARD_FOLDER_ABS ${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER}
|
|||||||
|
|
||||||
list(GET QMK_KEYBOARD_HEADERS -1 QMK_KEYBOARD_HEADER)
|
list(GET QMK_KEYBOARD_HEADERS -1 QMK_KEYBOARD_HEADER)
|
||||||
else(${IS_KEYBOARD_FOLDER_RELATIVE})
|
else(${IS_KEYBOARD_FOLDER_RELATIVE})
|
||||||
set(QMK_KEYBOARD_FOLDER_ABS ${QMK_KEYBOARD_FOLDER})
|
include_directories(${QMK_KEYBOARD_FOLDER_ABS})
|
||||||
|
if(EXISTS ${QMK_KEYBOARD_FOLDER_ABS}/config.h)
|
||||||
|
list(APPEND QMK_KEYBOARD_CONFIG_HS "${QMK_KEYBOARD_FOLDER_ABS}/config.h")
|
||||||
|
endif()
|
||||||
if(${IS_KEYMAP_FOLDER_RELATIVE})
|
if(${IS_KEYMAP_FOLDER_RELATIVE})
|
||||||
if(EXISTS "${QMK_KEYBOARD_FOLDER}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c")
|
if(EXISTS "${QMK_KEYBOARD_FOLDER_ABS}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c")
|
||||||
set(QMK_KEYBOARD_KEYMAP "${QMK_KEYBOARD_FOLDER}/keymaps/{QMK_KEYMAP_FOLDER}/keymap.c")
|
set(QMK_KEYBOARD_KEYMAP "${QMK_KEYBOARD_FOLDER_ABS}/keymaps/${QMK_KEYMAP_FOLDER}/keymap.c")
|
||||||
|
elseif(EXISTS "${QMK_KEYBOARD_FOLDER_ABS}/keymap.c")
|
||||||
|
set(QMK_KEYBOARD_KEYMAP "${QMK_KEYBOARD_FOLDER_ABS}/keymap.c")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Could not find keymap in keymap folder '${QMK_KEYMAP_FOLDER}'")
|
message(FATAL_ERROR "Could not find keymap in keymap folder '${QMK_KEYMAP_FOLDER}'")
|
||||||
endif()
|
endif()
|
||||||
@ -108,8 +118,12 @@ else(${IS_KEYBOARD_FOLDER_RELATIVE})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED QMK_KEYBOARD_HEADER)
|
if(NOT DEFINED QMK_KEYBOARD_HEADER)
|
||||||
get_filename_component((LAST_PART ${QMK_KEYBOARD_FOLDER}) NAME)
|
get_filename_component(LAST_PART ${QMK_KEYBOARD_FOLDER_ABS} NAME)
|
||||||
|
if(EXISTS "${QMK_KEYBOARD_FOLDER_ABS}/${LAST_PART}.h")
|
||||||
set(QMK_KEYBOARD_HEADER "${LAST_PART}.h")
|
set(QMK_KEYBOARD_HEADER "${LAST_PART}.h")
|
||||||
|
elseif(EXISTS "${QMK_KEYBOARD_FOLDER_ABS}/keyboard.h")
|
||||||
|
set(QMK_KEYBOARD_HEADER "keyboard.h")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -137,11 +151,6 @@ math(EXPR VERSION_C_EVAL "${VERSION_MAJOR} * 10000 + ${VERSION_MINOR} * 100 + ${
|
|||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-include ${QMK_KEYBOARD_CONFIG_HS}
|
-include ${QMK_KEYBOARD_CONFIG_HS}
|
||||||
-mmcu=${QMK_MCU}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_link_options(
|
|
||||||
-mmcu=${QMK_MCU}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
@ -163,10 +172,11 @@ add_subdirectory(tmk_core/protocol)
|
|||||||
include(features/oled)
|
include(features/oled)
|
||||||
include(features/backlight)
|
include(features/backlight)
|
||||||
|
|
||||||
if(EXISTS keyboards/${QMK_KEYBOARD_FOLDER}/CMakeLists.txt)
|
if(EXISTS ${QMK_KEYBOARD_FOLDER_ABS}/CMakeLists.txt)
|
||||||
add_subdirectory(keyboards/${QMK_KEYBOARD_FOLDER})
|
add_subdirectory(${QMK_KEYBOARD_FOLDER_ABS})
|
||||||
else()
|
else()
|
||||||
file(GLOB KEYBOARD_SRC "keyboards/${QMK_KEYBOARD_FOLDER}/*.c")
|
file(GLOB KEYBOARD_SRC "${QMK_KEYBOARD_FOLDER_ABS}/*.c")
|
||||||
|
list(REMOVE_ITEM KEYBOARD_SRC "${QMK_KEYBOARD_KEYMAP}")
|
||||||
add_qmk_executable(${QMK_KEYBOARD} ${KEYBOARD_SRC})
|
add_qmk_executable(${QMK_KEYBOARD} ${KEYBOARD_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,18 +1,27 @@
|
|||||||
|
include(ResolveKeyboard)
|
||||||
|
include(ValidateJSON)
|
||||||
|
|
||||||
macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
||||||
# not entirely sure why this is necessary
|
# not entirely sure why this is necessary
|
||||||
|
# set(TEMP_PATH ${KEYBOARD_FOLDER})
|
||||||
|
# cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
||||||
|
# if(${IS_KEYBOARD_FOLDER_RELATIVE})
|
||||||
|
# set(KEYBOARD_FOLDER_ABS ${CMAKE_SOURCE_DIR}/keyboards/${KEYBOARD_FOLDER})
|
||||||
|
# if(NOT EXISTS ${KEYBOARD_FOLDER_ABS})
|
||||||
|
# # message(FATAL_ERROR "Keyboard does not exist in QMK - try using an absolute path to the keyboard folder")
|
||||||
|
# resolve_keyboard(${KEYBOARD_FOLDER} KEYBOARD_FOLDER_ABS)
|
||||||
|
# endif()
|
||||||
|
# else()
|
||||||
|
# set(KEYBOARD_FOLDER_ABS ${KEYBOARD_FOLDER})
|
||||||
|
# if(NOT EXISTS ${KEYBOARD_FOLDER_ABS})
|
||||||
|
# message(FATAL_ERROR "Absolute path to keyboard does not exist")
|
||||||
|
# endif()
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
resolve_keyboard(${KEYBOARD_FOLDER} KEYBOARD_FOLDER_ABS)
|
||||||
|
|
||||||
set(TEMP_PATH ${KEYBOARD_FOLDER})
|
set(TEMP_PATH ${KEYBOARD_FOLDER})
|
||||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE)
|
||||||
if(${IS_KEYBOARD_FOLDER_RELATIVE})
|
|
||||||
set(KEYBOARD_FOLDER_ABS ${CMAKE_SOURCE_DIR}/keyboards/${KEYBOARD_FOLDER})
|
|
||||||
if(NOT EXISTS ${KEYBOARD_FOLDER_ABS})
|
|
||||||
message(FATAL_ERROR "Keyboard does not exist in QMK - try using an absolute path to the keyboard folder")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(KEYBOARD_FOLDER_ABS ${KEYBOARD_FOLDER})
|
|
||||||
if(NOT EXISTS ${KEYBOARD_FOLDER_ABS})
|
|
||||||
message(FATAL_ERROR "Absolute path to keyboard does not exist")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TEMP_PATH ${KEYMAP_FOLDER})
|
set(TEMP_PATH ${KEYMAP_FOLDER})
|
||||||
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYMAP_FOLDER_RELATIVE)
|
cmake_path(IS_RELATIVE TEMP_PATH IS_KEYMAP_FOLDER_RELATIVE)
|
||||||
@ -29,12 +38,12 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
|||||||
# find the right toolchain
|
# find the right toolchain
|
||||||
|
|
||||||
# not sure we need to validate here
|
# not sure we need to validate here
|
||||||
include(ValidateJSON)
|
|
||||||
validate_json(${KEYBOARD_FOLDER_ABS}/info.json keyboard JSON_STRING)
|
validate_json(${KEYBOARD_FOLDER_ABS}/info.json keyboard JSON_STRING)
|
||||||
|
|
||||||
string(JSON PROCESSOR GET ${JSON_STRING} processor)
|
string(JSON PROCESSOR GET ${JSON_STRING} processor)
|
||||||
if(${PROCESSOR} MATCHES "^at.*")
|
if(${PROCESSOR} MATCHES "^at.*")
|
||||||
set(PLATFORM "avr")
|
set(PLATFORM "avr")
|
||||||
|
set(TOOLCHAIN "avr")
|
||||||
include(FindAVRToolchain)
|
include(FindAVRToolchain)
|
||||||
find_avr_toolchain()
|
find_avr_toolchain()
|
||||||
elseif(
|
elseif(
|
||||||
@ -44,6 +53,7 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
|||||||
${PROCESSOR} MATCHES "RP2040" OR
|
${PROCESSOR} MATCHES "RP2040" OR
|
||||||
${PROCESSOR} MATCHES "^GD32.*")
|
${PROCESSOR} MATCHES "^GD32.*")
|
||||||
set(PLATFORM "chibios")
|
set(PLATFORM "chibios")
|
||||||
|
set(TOOLCHAIN "arm-none-eabi")
|
||||||
include(FindARMToolchain)
|
include(FindARMToolchain)
|
||||||
find_arm_toolchain()
|
find_arm_toolchain()
|
||||||
endif()
|
endif()
|
||||||
@ -71,7 +81,7 @@ macro(add_keyboard KEYBOARD_FOLDER KEYMAP_FOLDER)
|
|||||||
# this seems to work well for all systems so far - not sure if it'd be useful to customize
|
# this seems to work well for all systems so far - not sure if it'd be useful to customize
|
||||||
CMAKE_GENERATOR "Unix Makefiles"
|
CMAKE_GENERATOR "Unix Makefiles"
|
||||||
CMAKE_ARGS
|
CMAKE_ARGS
|
||||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/platforms/${PLATFORM}/toolchain.cmake
|
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchains/${TOOLCHAIN}.cmake
|
||||||
-DTOOLCHAIN_ROOT=${TOOLCHAIN_ROOT}
|
-DTOOLCHAIN_ROOT=${TOOLCHAIN_ROOT}
|
||||||
-DMAKE_ROOT=${MAKE_ROOT}
|
-DMAKE_ROOT=${MAKE_ROOT}
|
||||||
-DQMK_KEYBOARD=${KEYBOARD_NAME}
|
-DQMK_KEYBOARD=${KEYBOARD_NAME}
|
||||||
|
42
cmake/ResolveKeyboard.cmake
Normal file
42
cmake/ResolveKeyboard.cmake
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
function(resolve_keyboard KEYBOARD KEYBOAD_FOLDER_ABS_STR)
|
||||||
|
message(STATUS "Resolving ${KEYBOARD}")
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/keyboards/${KEYBOARD}")
|
||||||
|
message(STATUS "Found in repo: ${KEYBOARD}")
|
||||||
|
set(${KEYBOAD_FOLDER_ABS_STR} "${CMAKE_SOURCE_DIR}/keyboards/${KEYBOARD}" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/build/keyboard_repository/${KEYBOARD}")
|
||||||
|
message(STATUS "Already checked out: ${KEYBOARD}")
|
||||||
|
set(${KEYBOAD_FOLDER_ABS_STR} "${CMAKE_SOURCE_DIR}/build/keyboard_repository/${KEYBOARD}" PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
file(READ ${CMAKE_SOURCE_DIR}/data/keyboards.json KEYBOARDS_JSON)
|
||||||
|
string(JSON KEYBOARD_SLUG ERROR_VARIABLE JSON_ERROR GET ${KEYBOARDS_JSON} ${KEYBOARD})
|
||||||
|
if(${JSON_ERROR} STREQUAL "NOTFOUND")
|
||||||
|
message(STATUS "Found ${KEYBOARD_SLUG}")
|
||||||
|
if(${KEYBOARD_SLUG} MATCHES "^@([0-9a-zA-Z_]+/[0-9a-zA-Z_]+)")
|
||||||
|
# keyboard slug is mapped to a github repo
|
||||||
|
set(GIT_SLUG ${CMAKE_MATCH_1})
|
||||||
|
# string(MAKE_C_IDENTIFIER ${KEYBOARD} KEYBOARD_NAME)
|
||||||
|
message(STATUS "Cloning ${GIT_SLUG}")
|
||||||
|
find_package(Git QUIET)
|
||||||
|
if(GIT_FOUND)
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/keyboard_repository/${KEYBOARD}")
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} clone "https://github.com/${GIT_SLUG}.git" .
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build/keyboard_repository/${KEYBOARD}"
|
||||||
|
RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||||
|
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||||
|
message(FATAL_ERROR "git clone failed with ${GIT_SUBMOD_RESULT}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message("Git not found - skipping submodule update")
|
||||||
|
endif()
|
||||||
|
set(${KEYBOAD_FOLDER_ABS_STR} "${CMAKE_SOURCE_DIR}/build/keyboard_repository/${KEYBOARD}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Didn't match")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Couldn't find")
|
||||||
|
# set(${RESULT_STR} "NOTFOUND" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -17,7 +17,7 @@ if(${BACKLIGHT_ENABLE} AND NOT ${NO_BACKLIGHT_PIN} STREQUAL "backlight-NOTFOUND"
|
|||||||
else()
|
else()
|
||||||
target_sources(backlight PRIVATE quantum/backlight/backlight_driver_common.c)
|
target_sources(backlight PRIVATE quantum/backlight/backlight_driver_common.c)
|
||||||
if(${BACKLIGHT_DRIVER} STREQUAL "pwm")
|
if(${BACKLIGHT_DRIVER} STREQUAL "pwm")
|
||||||
target_sources(backlight PRIVATE quantum/backlight/backlight_${CMAKE_SYSTEM_PROCESSOR}.c)
|
target_sources(backlight PRIVATE quantum/backlight/backlight_${QMK_PLATFORM}.c)
|
||||||
else()
|
else()
|
||||||
target_sources(backlight PRIVATE quantum/backlight/backlight_${BACKLIGHT_DRIVER}.c)
|
target_sources(backlight PRIVATE quantum/backlight/backlight_${BACKLIGHT_DRIVER}.c)
|
||||||
endif()
|
endif()
|
||||||
|
@ -2,12 +2,12 @@ option(OLED_ENABLE "" TRUE)
|
|||||||
if(${OLED_ENABLE})
|
if(${OLED_ENABLE})
|
||||||
add_library(oled
|
add_library(oled
|
||||||
drivers/oled/ssd1306_sh1106.c
|
drivers/oled/ssd1306_sh1106.c
|
||||||
platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers/i2c_master.c)
|
platforms/${QMK_PLATFORM}/drivers/i2c_master.c)
|
||||||
add_compile_definitions(OLED_ENABLE)
|
add_compile_definitions(OLED_ENABLE)
|
||||||
target_include_directories(oled PUBLIC drivers)
|
target_include_directories(oled PUBLIC drivers)
|
||||||
target_include_directories(quantum PUBLIC drivers/oled)
|
target_include_directories(quantum PUBLIC drivers/oled)
|
||||||
target_include_directories(oled PUBLIC drivers/oled)
|
target_include_directories(oled PUBLIC drivers/oled)
|
||||||
target_include_directories(oled PUBLIC platforms/${CMAKE_SYSTEM_PROCESSOR}/drivers)
|
target_include_directories(oled PUBLIC platforms/${QMK_PLATFORM}/drivers)
|
||||||
target_link_libraries(oled PUBLIC quantum)
|
target_link_libraries(oled PUBLIC quantum)
|
||||||
target_link_libraries(oled PUBLIC platform_avr)
|
target_link_libraries(oled PUBLIC platform_avr)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
set(TRIPLE "arm-none-eabi")
|
set(TRIPLE "arm-none-eabi")
|
||||||
|
set(QMK_PLATFORM "chibios")
|
||||||
|
set(QMK_PROTOCOL "chibios")
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(OS_SUFFIX "")
|
set(OS_SUFFIX "")
|
||||||
@ -28,12 +30,14 @@ set(AVR_SIZE "${TOOLCHAIN_ROOT}/${TRIPLE}-size${OS_SUFFIX}" CACHE P
|
|||||||
add_compile_options(
|
add_compile_options(
|
||||||
$<$<COMPILE_LANGUAGE:C>:-std=gnu11>
|
$<$<COMPILE_LANGUAGE:C>:-std=gnu11>
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++14>
|
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++14>
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
||||||
# -flto
|
# -flto
|
||||||
-Os
|
-Os
|
||||||
-Wall
|
-Wall
|
||||||
-Wstrict-prototypes
|
-Wstrict-prototypes
|
||||||
# -fcommon
|
# -fcommon
|
||||||
# -g
|
# -g
|
||||||
|
|
||||||
-fomit-frame-pointer
|
-fomit-frame-pointer
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
@ -53,13 +57,38 @@ add_compile_options(
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
# F_CPU=16000000
|
THUMB_PRESENT
|
||||||
# F_USB=16000000UL
|
THUMB_NO_INTERWORKING
|
||||||
# __AVR_ATmega32U4__
|
PROTOCOL_CHIBIOS
|
||||||
# LTO_ENABLE
|
MCU_${MCU_FAMILY}
|
||||||
|
PLATFORM_SUPPORTS_SYNCHRONIZATION
|
||||||
|
PORT_IGNORE_GCC_VERSION_CHECK=1
|
||||||
)
|
)
|
||||||
|
|
||||||
add_link_options(--specs=nosys.specs)
|
add_link_options(
|
||||||
|
-Wl,--gc-sections
|
||||||
|
-nostartfiles
|
||||||
|
-Wl,--no-wchar-size-warning
|
||||||
|
--specs=nano.specs
|
||||||
|
-mthumb
|
||||||
|
-mno-thumb-interwork
|
||||||
|
-mno-unaligned-access
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${USE_FPU})
|
||||||
|
add_compile_definitions(
|
||||||
|
CORTEX_USE_FPU=TRUE
|
||||||
|
)
|
||||||
|
add_link_options(
|
||||||
|
-mfloat-abi=hard
|
||||||
|
-mfpu=fpv4-sp-d16
|
||||||
|
-fsingle-precision-constant
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(
|
||||||
|
CORTEX_USE_FPU=FALSE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
# include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include")
|
||||||
|
|
||||||
@ -70,7 +99,7 @@ macro(add_qmk_executable target_name)
|
|||||||
set(hex_file ${target_name}-${QMK_MCU}.hex)
|
set(hex_file ${target_name}-${QMK_MCU}.hex)
|
||||||
set(lst_file ${target_name}-${QMK_MCU}.lst)
|
set(lst_file ${target_name}-${QMK_MCU}.lst)
|
||||||
|
|
||||||
add_link_options(-Wl,--gc-sections,-nostartfiles)
|
# add_link_options(-Wl,--gc-sections,-nostartfiles)
|
||||||
|
|
||||||
# create elf file
|
# create elf file
|
||||||
add_executable(${elf_file}
|
add_executable(${elf_file}
|
@ -5,6 +5,8 @@
|
|||||||
# @since Feb 06 2016
|
# @since Feb 06 2016
|
||||||
|
|
||||||
set(TRIPLE "avr")
|
set(TRIPLE "avr")
|
||||||
|
set(QMK_PLATFORM "avr")
|
||||||
|
set(QMK_PROTOCOL "lufa")
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
set(OS_SUFFIX "")
|
set(OS_SUFFIX "")
|
0
cmake/toolchains/riscv32-unknown-elf.cmake
Normal file
0
cmake/toolchains/riscv32-unknown-elf.cmake
Normal file
16
cmake/toolchains/riscv64-unknown-elf.cmake
Normal file
16
cmake/toolchains/riscv64-unknown-elf.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
if(${USE_PICOLIBC})
|
||||||
|
add_compile_options(
|
||||||
|
--specs=picolibc.specs
|
||||||
|
)
|
||||||
|
add_compile_definitions(USE_PICOLIBC)
|
||||||
|
add_link_options(
|
||||||
|
-Wl,--defsym=__heap_start=__heap_base__,--defsym=__heap_end=__heap_end__
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_compile_options(
|
||||||
|
-march=${MCU_ARCH}
|
||||||
|
-mabi=${MCU_ABI}
|
||||||
|
-mcmodel=${MCU_CMODEL}
|
||||||
|
-mstrict-align
|
||||||
|
)
|
4
data/keyboards.json
Normal file
4
data/keyboards.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"olkb/planck/rev3": "@jackhumbert/test_keyboard",
|
||||||
|
"olkb/planck/rev6": "planck/rev6"
|
||||||
|
}
|
@ -2,4 +2,4 @@ add_library(platforms suspend.c synchronization_util.c timer.c)
|
|||||||
target_include_directories(platforms PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(platforms PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(platforms PUBLIC quantum)
|
target_link_libraries(platforms PUBLIC quantum)
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_SYSTEM_PROCESSOR})
|
add_subdirectory(${QMK_PLATFORM})
|
@ -1,10 +1,15 @@
|
|||||||
|
add_compile_options(
|
||||||
|
-mmcu=${QMK_MCU}
|
||||||
|
)
|
||||||
|
add_link_options(
|
||||||
|
-mmcu=${QMK_MCU}
|
||||||
|
)
|
||||||
add_library(platforms_avr
|
add_library(platforms_avr
|
||||||
hardware_id.c
|
hardware_id.c
|
||||||
platform.c
|
platform.c
|
||||||
suspend.c
|
suspend.c
|
||||||
timer.c
|
timer.c
|
||||||
printf.c
|
printf.c
|
||||||
xprintf.S
|
|
||||||
bootloaders/bootloadhid.c
|
bootloaders/bootloadhid.c
|
||||||
)
|
)
|
||||||
target_include_directories(platforms_avr PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(platforms_avr PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
3
platforms/chibios/CMakeLists.txt
Normal file
3
platforms/chibios/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
add_link_options(
|
||||||
|
-mcpu=${QMK_MCU}
|
||||||
|
)
|
@ -12,6 +12,4 @@ add_compile_definitions(
|
|||||||
target_include_directories(tmk_core_protocol PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(tmk_core_protocol PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(tmk_core_protocol PUBLIC quantum)
|
target_link_libraries(tmk_core_protocol PUBLIC quantum)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "avr")
|
add_subdirectory(${QMK_PROTOCOL})
|
||||||
add_subdirectory(lufa)
|
|
||||||
endif()
|
|
21
tmk_core/protocol/chibios/CMakeLists.txt
Normal file
21
tmk_core/protocol/chibios/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
add_compile_definitions(
|
||||||
|
PROTOCOL_CHIBIOS
|
||||||
|
FIXED_CONTROL_ENDPOINT_SIZE=64
|
||||||
|
FIXED_NUM_CONFIGURATIONS=1
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(tmk_core_protocol_chibios
|
||||||
|
usb_main.c
|
||||||
|
chibios.c
|
||||||
|
../usb_descriptor.c
|
||||||
|
usb_driver.c
|
||||||
|
usb_util.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# find_package(lufa REQUIRED)
|
||||||
|
|
||||||
|
target_include_directories(tmk_core_protocol_chibios PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_include_directories(tmk_core_protocol_chibios PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/lufa_utils)
|
||||||
|
|
||||||
|
# target_link_libraries(tmk_core_protocol_chibios PUBLIC lufa)
|
||||||
|
target_link_libraries(tmk_core_protocol_chibios PUBLIC quantum)
|
Loading…
Reference in New Issue
Block a user