From a9a35f9d3b19724640fcb0b0cec057f95c8c6328 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 19 Sep 2024 20:06:25 -0600 Subject: fixes --- coroutine.c | 2 +- main.c | 2 +- tusb_config.h | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/coroutine.c b/coroutine.c index 50e4135..01418bd 100644 --- a/coroutine.c +++ b/coroutine.c @@ -170,7 +170,7 @@ static void call_with_stack(void *stack, cr_fn_t fn, void *args) { asm volatile ("mov r0, sp\n\t" /* [saved_sp = sp */ "str r0, %0\n\t" /* ] */ "mov sp, %1\n\t" /* [sp = stack] */ - "mov r0, %1\n\t" /* [arg0 = args] */ + "mov r0, %3\n\t" /* [arg0 = args] */ "blx %2\n\t" /* [fn()] */ "ldr r0, %0\n\t" /* [sp = staved_sp */ "mov sp, r0" /* ] */ diff --git a/main.c b/main.c index 1b1558e..30a6dfc 100644 --- a/main.c +++ b/main.c @@ -39,7 +39,7 @@ int main() { /* set up coroutines */ coroutine_add(usb_common_cr, NULL); - usb_keyboard_chan_t keyboard_chan; + usb_keyboard_chan_t keyboard_chan = {0}; coroutine_add(usb_keyboard_cr, &keyboard_chan); coroutine_add(hello_world_cr, &keyboard_chan); diff --git a/tusb_config.h b/tusb_config.h index bc8243d..cb1ca3b 100644 --- a/tusb_config.h +++ b/tusb_config.h @@ -53,7 +53,11 @@ extern "C" { #error CFG_TUSB_MCU must be defined #endif +// Conditional because it might be defined with `-D` on the command +// line if `cmake -DCMAKE_BUILD_TYPE=Debug`. +#ifndef CFG_TUSB_DEBUG #define CFG_TUSB_DEBUG 0 +#endif // USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. // Tinyusb use follows macros to declare transferring memory so that they can be put -- cgit v1.2.3-2-g168b