diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000000..521cdcbf5a5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,137 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Load Keyboard & Refresh Outline", + "dependsOrder": "sequence", + "dependsOn":[ + "Load Keyboard", + "Configure CMake" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Load Keyboard", + "type": "shell", + "command": "cmake -Bbuild -DQMK_KEYBOARD_FOLDER=${input:keyboard}", + "problemMatcher": [] + }, + { + "label": "Configure CMake", + "type": "cmake", + "command": "configure" + // "command": "${command:cmake.configure}", + // "problemMatcher": [], + }, + { + "label": "Build", + "problemMatcher": [ + { + "base": "$gcc", + "fileLocation": ["relative", "${workspaceRoot}/build"] + }, + ], + "options": { + "environment": { + "CLICOLOR_FORCE": "1" + } + }, + "type": "cmake", + "command": "build", + "targets":[ + "${input:keyboard_safe}" + ], + "group": { + "kind": "build", + "isDefault": true + }, + // "type": "shell", + // "command": "cmake --build build --target ${input:keyboard_safe}", + // "problemMatcher": [], + // "group": { + // "kind": "build", + // "isDefault": true + // } + // "type": "cmake", + // "command": "build", + // "targets":[ + // "${input:keyboard_safe}" + // ] + }, + { + "label": "Rebuild", + // "type": "process", + // "command": "cmake", + // "args": [ + // "--build", + // "build", + // "--target", + // "${input:keyboard_safe}", + // "--clean-first" + // ], + "problemMatcher": [ + { + "base": "$gcc", + "fileLocation": ["relative", "${workspaceRoot}/build"] + }, + ], + "options": { + "environment": { + "CLICOLOR_FORCE": "1" + } + }, + "type": "cmake", + "command": "cleanRebuild", + "targets":[ + "${input:keyboard_safe}" + ], + "group": { + "kind": "build", + "isDefault": true + }, + } + ], + "inputs": [ + { + "id": "keyboard", + "description": "Keyboard:", + "type": "pickString", + "options":[ + "planck/rev5", + "olkb/planck/rev3" + ] + }, + { + "id": "keyboard_safe", + "description": "Keyboard:", + "type": "pickString", + "options":[ + "planck_rev5_default", + "olkb_planck_rev3_default" + ] + }, + // { + // "type": "command", + // "id": "keyboard", + // "command": "extension.commandvariable.pickStringRemember", + // "args": { + // "description": "select an option :", + // "options": [ + // ["always 1", "5000"], + // ["always 2", "5100"] + // ], + // "default": "", + // "fileName": "${workspaceFolder}/data/keyboards.json", + // "pattern": { + // "regexp": "^\\s*(?!#)([^=]+?)\\s*=\\s*(?:(\\{.+\\})|(.+))$", + // "label": "$1", + // "json": "$2", + // "value": "$3" + // } + // } + // } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index bcb198d008b..da41715bfd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,9 @@ resolve_keyboard(${QMK_KEYBOARD_FOLDER} QMK_KEYBOARD_FOLDER_ABS) set(TEMP_PATH ${QMK_KEYBOARD_FOLDER}) cmake_path(IS_RELATIVE TEMP_PATH IS_KEYBOARD_FOLDER_RELATIVE) +if(${IS_KEYBOARD_FOLDER_RELATIVE} AND NOT EXISTS ${CMAKE_SOURCE_DIR}/keyboards/${QMK_KEYBOARD_FOLDER}) + set(IS_KEYBOARD_FOLDER_RELATIVE FALSE) +endif() if(NOT DEFINED QMK_KEYMAP_FOLDER) set(QMK_KEYMAP_FOLDER "default") @@ -31,9 +34,6 @@ endif() set(TEMP_PATH ${QMK_KEYMAP_FOLDER}) 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}) set(QMK_KEYBOARD_CURRENT_FOLDER ${QMK_KEYBOARD_FOLDER}) @@ -113,7 +113,7 @@ else(${IS_KEYBOARD_FOLDER_RELATIVE}) if(EXISTS "${QMK_KEYMAP_FOLDER}/keymap.c") set(QMK_KEYBOARD_KEYMAP "{QMK_KEYMAP_FOLDER}/keymap.c") else() - message(FATAL_ERROR "Could not find keymap in keymap folder '${QMK_KEYMAP_FOLDER}'") + message(FATAL_ERROR "Could not find keymap in keymap path '${QMK_KEYMAP_FOLDER}'") endif() endif() diff --git a/cmake/toolchains/avr.cmake b/cmake/toolchains/avr.cmake index 5d099eecaf5..c429b835a36 100644 --- a/cmake/toolchains/avr.cmake +++ b/cmake/toolchains/avr.cmake @@ -53,7 +53,8 @@ find_program(AVR_UPLOAD add_compile_options( $<$:-std=gnu11> $<$:-std=gnu++14> - # -flto + -flto + # -mrelax -Os -Wall -Wstrict-prototypes @@ -77,7 +78,11 @@ add_compile_definitions( F_CPU=16000000 F_USB=16000000UL __AVR_ATmega32U4__ - # LTO_ENABLE + LTO_ENABLE +) + +add_link_options( + -Wl,--gc-sections ) # include_directories("C:/Users/Jack/Downloads/avr-gcc-12.1.0-x64-windows/avr/include") @@ -92,7 +97,7 @@ macro(add_qmk_executable target_name) set(hex_file ${target_name}-${QMK_MCU}.hex) set(lst_file ${target_name}-${QMK_MCU}.lst) - add_link_options(-Wl,--gc-sections,-Map=${map_file}) + add_link_options(-Wl,-Map=${map_file}) # create elf file add_executable(${elf_file}