Skip to content

Commit

Permalink
Move print/debug files to quantum (qmk#12069)
Browse files Browse the repository at this point in the history
* move print/debug files to quantum

* Update comments
  • Loading branch information
zvecr authored Aug 3, 2021
1 parent ea327e1 commit 33699b2
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 44 deletions.
2 changes: 1 addition & 1 deletion build_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ endif
$(TEST)_SRC += \
tests/test_common/main.c \
$(LIB_PATH)/printf/printf.c \
$(COMMON_DIR)/printf.c
$(QUANTUM_PATH)/logging/print.c

$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
Expand Down
10 changes: 9 additions & 1 deletion common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ QUANTUM_SRC += \
$(QUANTUM_DIR)/bitwise.c \
$(QUANTUM_DIR)/led.c \
$(QUANTUM_DIR)/keymap_common.c \
$(QUANTUM_DIR)/keycode_config.c
$(QUANTUM_DIR)/keycode_config.c \
$(QUANTUM_DIR)/logging/debug.c \
$(QUANTUM_DIR)/logging/sendchar.c \

VPATH += $(QUANTUM_DIR)/logging
# Fall back to lib/printf if there is no platform provided print
ifeq ("$(wildcard $(TMK_PATH)/common/$(PLATFORM_KEY)/printf.mk)","")
include $(QUANTUM_PATH)/logging/print.mk
endif

ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), yes)
OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tmk_core/common/debug.h → quantum/logging/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extern debug_config_t debug_config;
do { \
if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \
} while (0)
# define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
# define dmsg(s) dprintf("%s at %d: %s\n", __FILE__, __LINE__, s)

/* Deprecated. DO NOT USE these anymore, use dprintf instead. */
# define debug(s) \
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions quantum/logging/print.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
PRINTF_PATH = $(LIB_PATH)/printf

VPATH += $(PRINTF_PATH)
SRC += $(PRINTF_PATH)/printf.c
QUANTUM_SRC +=$(QUANTUM_DIR)/logging/print.c
OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT
OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL
OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG
OPT_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sendchar.h"

/* default noop "null" implementation */
__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; }
File renamed without changes.
13 changes: 4 additions & 9 deletions tmk_core/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
$(COMMON_DIR)/action_macro.c \
$(COMMON_DIR)/action_layer.c \
$(COMMON_DIR)/action_util.c \
$(COMMON_DIR)/debug.c \
$(COMMON_DIR)/sendchar_null.c \
$(COMMON_DIR)/eeconfig.c \
$(COMMON_DIR)/report.c \
$(COMMON_DIR)/sync_timer.c \
$(COMMON_DIR)/usb_util.c \
$(PLATFORM_COMMON_DIR)/suspend.c \
$(PLATFORM_COMMON_DIR)/timer.c \
$(COMMON_DIR)/sync_timer.c \
$(PLATFORM_COMMON_DIR)/bootloader.c \

# Use platform provided print - fall back to lib/printf
ifneq ("$(wildcard $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk)","")
include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
else
include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
endif
# Use platform provided print if it exists
-include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk

SHARED_EP_ENABLE = no
MOUSE_SHARED_EP ?= yes
Expand Down Expand Up @@ -55,6 +49,7 @@ endif
ifeq ($(strip $(CONSOLE_ENABLE)), yes)
TMK_COMMON_DEFS += -DCONSOLE_ENABLE
else
# TODO: decouple this so other print backends can exist
TMK_COMMON_DEFS += -DNO_PRINT
TMK_COMMON_DEFS += -DNO_DEBUG
endif
Expand Down
9 changes: 0 additions & 9 deletions tmk_core/common/lib_printf.mk

This file was deleted.

23 changes: 0 additions & 23 deletions tmk_core/common/sendchar_uart.c

This file was deleted.

0 comments on commit 33699b2

Please sign in to comment.