From fa7957f5e2683a144eebbbbd1d04ad44593d4a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 21 Jun 2022 18:53:02 +0200 Subject: [PATCH] [beken-72xx] Fix linking with SDK framework --- builder/arduino-common.py | 1 + platform/beken-72xx/fixups/arch_main.c | 6 +++--- platform/beken-72xx/fixups/inc/uart_pub.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/builder/arduino-common.py b/builder/arduino-common.py index c969f4a..e4b1215 100644 --- a/builder/arduino-common.py +++ b/builder/arduino-common.py @@ -15,6 +15,7 @@ assert isdir(LT_ARDUINO_DIR) # Flags env.Append( CPPDEFINES=[ + ("LIBRETUYA_ARDUINO", "1"), ("ARDUINO", 10812), "ARDUINO_SDK", ], diff --git a/platform/beken-72xx/fixups/arch_main.c b/platform/beken-72xx/fixups/arch_main.c index 3dd3f7d..d544652 100644 --- a/platform/beken-72xx/fixups/arch_main.c +++ b/platform/beken-72xx/fixups/arch_main.c @@ -26,7 +26,7 @@ void entry_set_world_flag(void) { extern void main(void); -#ifdef LIBRETUYA +#ifdef LIBRETUYA_ARDUINO // beken-72xx has printf_port.h extern void __wrap_bk_printf_disable(); extern void __wrap_bk_printf_enable(); @@ -38,7 +38,7 @@ void entry_main(void) { entry_set_world_flag(); #endif // suppress all output during initialization -#if LIBRETUYA +#if LIBRETUYA_ARDUINO __wrap_bk_printf_disable(); #endif // read reboot cause into bk_misc_get_start_type() @@ -57,7 +57,7 @@ void entry_main(void) { bk_wdg_reload(); #endif // enable bk_printf output again -#if LIBRETUYA +#if LIBRETUYA_ARDUINO __wrap_bk_printf_enable(); #endif // run the app diff --git a/platform/beken-72xx/fixups/inc/uart_pub.h b/platform/beken-72xx/fixups/inc/uart_pub.h index 8102b77..ca8521e 100644 --- a/platform/beken-72xx/fixups/inc/uart_pub.h +++ b/platform/beken-72xx/fixups/inc/uart_pub.h @@ -4,7 +4,7 @@ #include_next "uart_pub.h" -#ifdef LIBRETUYA +#ifdef LIBRETUYA_ARDUINO // make uart.c call __wrap_bk_printf() instead of bk_printf() // standard wrapping does not work in this case, as bk_printf() // is implemented in the same translation unit