aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-08-03 18:49:33 +0100
committerGitHub <noreply@github.com>2021-08-03 18:49:33 +0100
commit34de7ca224d613e1ae19a45860e27c15d40254dd (patch)
tree3176aa05dd5175ae1a7a56b5b881fc89c1aa18ef
parent3f419dc872d3ab61d129c644e114f62fd738e9d6 (diff)
downloadqmk_firmware-34de7ca224d613e1ae19a45860e27c15d40254dd.tar.gz
qmk_firmware-34de7ca224d613e1ae19a45860e27c15d40254dd.zip
Move print/debug files to quantum (#12069)
* move print/debug files to quantum * Update comments
-rw-r--r--build_test.mk2
-rw-r--r--common_features.mk10
-rw-r--r--quantum/logging/debug.c (renamed from tmk_core/common/debug.c)0
-rw-r--r--quantum/logging/debug.h (renamed from tmk_core/common/debug.h)2
-rw-r--r--quantum/logging/nodebug.h (renamed from tmk_core/common/nodebug.h)0
-rw-r--r--quantum/logging/print.c (renamed from tmk_core/common/printf.c)0
-rw-r--r--quantum/logging/print.h (renamed from tmk_core/common/print.h)0
-rw-r--r--quantum/logging/print.mk9
-rw-r--r--quantum/logging/sendchar.c (renamed from tmk_core/common/sendchar_null.c)1
-rw-r--r--quantum/logging/sendchar.h (renamed from tmk_core/common/sendchar.h)0
-rw-r--r--tmk_core/common.mk13
-rw-r--r--tmk_core/common/lib_printf.mk9
-rw-r--r--tmk_core/common/sendchar_uart.c23
13 files changed, 25 insertions, 44 deletions
diff --git a/build_test.mk b/build_test.mk
index 4c09bf027..b6b878217 100644
--- a/build_test.mk
+++ b/build_test.mk
@@ -63,7 +63,7 @@ endif
63$(TEST)_SRC += \ 63$(TEST)_SRC += \
64 tests/test_common/main.c \ 64 tests/test_common/main.c \
65 $(LIB_PATH)/printf/printf.c \ 65 $(LIB_PATH)/printf/printf.c \
66 $(COMMON_DIR)/printf.c 66 $(QUANTUM_PATH)/logging/print.c
67 67
68$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC) 68$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
69$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC) 69$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
diff --git a/common_features.mk b/common_features.mk
index 75a9e1f2e..15b7b464f 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -21,7 +21,15 @@ QUANTUM_SRC += \
21 $(QUANTUM_DIR)/bitwise.c \ 21 $(QUANTUM_DIR)/bitwise.c \
22 $(QUANTUM_DIR)/led.c \ 22 $(QUANTUM_DIR)/led.c \
23 $(QUANTUM_DIR)/keymap_common.c \ 23 $(QUANTUM_DIR)/keymap_common.c \
24 $(QUANTUM_DIR)/keycode_config.c 24 $(QUANTUM_DIR)/keycode_config.c \
25 $(QUANTUM_DIR)/logging/debug.c \
26 $(QUANTUM_DIR)/logging/sendchar.c \
27
28VPATH += $(QUANTUM_DIR)/logging
29# Fall back to lib/printf if there is no platform provided print
30ifeq ("$(wildcard $(TMK_PATH)/common/$(PLATFORM_KEY)/printf.mk)","")
31 include $(QUANTUM_PATH)/logging/print.mk
32endif
25 33
26ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes) 34ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)
27 OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE 35 OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
diff --git a/tmk_core/common/debug.c b/quantum/logging/debug.c
index ea62deaa8..ea62deaa8 100644
--- a/tmk_core/common/debug.c
+++ b/quantum/logging/debug.c
diff --git a/tmk_core/common/debug.h b/quantum/logging/debug.h
index 3d2e2315e..841531035 100644
--- a/tmk_core/common/debug.h
+++ b/quantum/logging/debug.h
@@ -67,7 +67,7 @@ extern debug_config_t debug_config;
67 do { \ 67 do { \
68 if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \ 68 if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \
69 } while (0) 69 } while (0)
70# define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s)) 70# define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)
71 71
72/* Deprecated. DO NOT USE these anymore, use dprintf instead. */ 72/* Deprecated. DO NOT USE these anymore, use dprintf instead. */
73# define debug(s) \ 73# define debug(s) \
diff --git a/tmk_core/common/nodebug.h b/quantum/logging/nodebug.h
index 0b176684b..0b176684b 100644
--- a/tmk_core/common/nodebug.h
+++ b/quantum/logging/nodebug.h
diff --git a/tmk_core/common/printf.c b/quantum/logging/print.c
index e8440e55e..e8440e55e 100644
--- a/tmk_core/common/printf.c
+++ b/quantum/logging/print.c
diff --git a/tmk_core/common/print.h b/quantum/logging/print.h
index 8c055f549..8c055f549 100644
--- a/tmk_core/common/print.h
+++ b/quantum/logging/print.h
diff --git a/quantum/logging/print.mk b/quantum/logging/print.mk
new file mode 100644
index 000000000..67c004192
--- /dev/null
+++ b/quantum/logging/print.mk
@@ -0,0 +1,9 @@
1PRINTF_PATH = $(LIB_PATH)/printf
2
3VPATH += $(PRINTF_PATH)
4SRC += $(PRINTF_PATH)/printf.c
5QUANTUM_SRC +=$(QUANTUM_DIR)/logging/print.c
6OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT
7OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL
8OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG
9OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T
diff --git a/tmk_core/common/sendchar_null.c b/quantum/logging/sendchar.c
index fb67f7086..9422382f6 100644
--- a/tmk_core/common/sendchar_null.c
+++ b/quantum/logging/sendchar.c
@@ -16,4 +16,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17#include "sendchar.h" 17#include "sendchar.h"
18 18
19/* default noop "null" implementation */
19__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; } 20__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; }
diff --git a/tmk_core/common/sendchar.h b/quantum/logging/sendchar.h
index edcddaa6b..edcddaa6b 100644
--- a/tmk_core/common/sendchar.h
+++ b/quantum/logging/sendchar.h
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 2f8f81126..bd4142364 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -8,22 +8,16 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
8 $(COMMON_DIR)/action_macro.c \ 8 $(COMMON_DIR)/action_macro.c \
9 $(COMMON_DIR)/action_layer.c \ 9 $(COMMON_DIR)/action_layer.c \
10 $(COMMON_DIR)/action_util.c \ 10 $(COMMON_DIR)/action_util.c \
11 $(COMMON_DIR)/debug.c \
12 $(COMMON_DIR)/sendchar_null.c \
13 $(COMMON_DIR)/eeconfig.c \ 11 $(COMMON_DIR)/eeconfig.c \
14 $(COMMON_DIR)/report.c \ 12 $(COMMON_DIR)/report.c \
13 $(COMMON_DIR)/sync_timer.c \
15 $(COMMON_DIR)/usb_util.c \ 14 $(COMMON_DIR)/usb_util.c \
16 $(PLATFORM_COMMON_DIR)/suspend.c \ 15 $(PLATFORM_COMMON_DIR)/suspend.c \
17 $(PLATFORM_COMMON_DIR)/timer.c \ 16 $(PLATFORM_COMMON_DIR)/timer.c \
18 $(COMMON_DIR)/sync_timer.c \
19 $(PLATFORM_COMMON_DIR)/bootloader.c \ 17 $(PLATFORM_COMMON_DIR)/bootloader.c \
20 18
21# Use platform provided print - fall back to lib/printf 19# Use platform provided print if it exists
22ifneq ("$(wildcard $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk)","") 20-include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
23 include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
24else
25 include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
26endif
27 21
28SHARED_EP_ENABLE = no 22SHARED_EP_ENABLE = no
29MOUSE_SHARED_EP ?= yes 23MOUSE_SHARED_EP ?= yes
@@ -55,6 +49,7 @@ endif
55ifeq ($(strip $(CONSOLE_ENABLE)), yes) 49ifeq ($(strip $(CONSOLE_ENABLE)), yes)
56 TMK_COMMON_DEFS += -DCONSOLE_ENABLE 50 TMK_COMMON_DEFS += -DCONSOLE_ENABLE
57else 51else
52 # TODO: decouple this so other print backends can exist
58 TMK_COMMON_DEFS += -DNO_PRINT 53 TMK_COMMON_DEFS += -DNO_PRINT
59 TMK_COMMON_DEFS += -DNO_DEBUG 54 TMK_COMMON_DEFS += -DNO_DEBUG
60endif 55endif
diff --git a/tmk_core/common/lib_printf.mk b/tmk_core/common/lib_printf.mk
deleted file mode 100644
index 10d2d8468..000000000
--- a/tmk_core/common/lib_printf.mk
+++ /dev/null
@@ -1,9 +0,0 @@
1PRINTF_PATH = $(LIB_PATH)/printf
2
3TMK_COMMON_SRC += $(PRINTF_PATH)/printf.c
4TMK_COMMON_SRC += $(COMMON_DIR)/printf.c
5TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT
6TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL
7TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG
8TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T
9VPATH += $(PRINTF_PATH)
diff --git a/tmk_core/common/sendchar_uart.c b/tmk_core/common/sendchar_uart.c
deleted file mode 100644
index 2fc48baff..000000000
--- a/tmk_core/common/sendchar_uart.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2Copyright 2011 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include "uart.h"
18#include "sendchar.h"
19
20int8_t sendchar(uint8_t c) {
21 uart_putchar(c);
22 return 0;
23}