From 7bc1e8049dbbf572a773d01547eb9b587b112061 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 10 Dec 2024 00:41:14 -0700 Subject: Analyze host stacks too --- cmd/sbc_harness/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'cmd/sbc_harness') diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index 96c2a2c..b3aa610 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -38,10 +38,6 @@ add_stack_analysis(sbc_harness_stack.c sbc_harness_objs) # Link ######################################################################### add_executable(sbc_harness) -set_source_files_properties("$" PROPERTIES - EXTERNAL_OBJECT true - GENERATED true -) target_sources(sbc_harness PRIVATE sbc_harness_stack.c "$" -- cgit v1.2.3-2-g168b From 22d27936b3d771a36b170b1f4b4ba58badbf3971 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 10 Dec 2024 02:12:39 -0700 Subject: Get lib9p building on rp2040 --- cmd/sbc_harness/CMakeLists.txt | 1 + cmd/sbc_harness/main.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'cmd/sbc_harness') diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index b3aa610..f1b1be2 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(sbc_harness_objs libusb libdhcp libhw + lib9p ) pico_minimize_runtime(sbc_harness_objs INCLUDE PRINTF PRINTF_MINIMAL PRINTF_LONG_LONG PRINTF_PTRDIFF_T diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index fb4b696..bbefe92 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -13,17 +13,21 @@ #include #include #include +#include #include #include +#include #define LOG_NAME MAIN #include #include "usb_keyboard.h" +#include "config.h" + #define ARRAY_LEN(arr) (sizeof(arr)/sizeof((arr)[0])) -COROUTINE hello_world_cr(void *_chan) { +static COROUTINE hello_world_cr(void *_chan) { const char *msg = "Hello world!\n"; usb_keyboard_rpc_t *chan = _chan; cr_begin(); @@ -39,7 +43,7 @@ COROUTINE hello_world_cr(void *_chan) { cr_end(); } -COROUTINE dhcp_cr(void *_chip) { +static COROUTINE dhcp_cr(void *_chip) { struct w5500 *chip = _chip; cr_begin(); @@ -53,9 +57,20 @@ struct { struct w5500 dev_w5500; usb_keyboard_rpc_t keyboard_chan; uint16_t usb_serial[sizeof(uint64_t)*2]; /* UTF-16 */ + struct lib9p_srv srv; } globals; +static COROUTINE read9p_cr(void *) { + cr_begin(); + + lib9p_srv_read_cr(&globals.srv, + VCALL(&globals.dev_w5500, tcp_listen, CONFIG_9P_PORT)); + + cr_end(); +} + const char *hexdig = "0123456789ABCDEF"; +static_assert(CONFIG_9P_MAX_REQS*_CONFIG_9P_NUM_SOCKS <= 16); COROUTINE init_cr(void *) { cr_begin(); @@ -103,8 +118,16 @@ COROUTINE init_cr(void *) { /* set up coroutines **************************************************/ coroutine_add("usb_common", usb_common_cr, NULL); coroutine_add("usb_keyboard", usb_keyboard_cr, &globals.keyboard_chan); - //coroutine_add("hello_world", hello_world_cr, &keyboard_chan); + coroutine_add("hello_world", hello_world_cr, &globals.keyboard_chan); coroutine_add_with_stack_size(4*1024, "dhcp", dhcp_cr, &globals.dev_w5500); + for (int i = 0; i < _CONFIG_9P_NUM_SOCKS; i++) { + char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'}; + coroutine_add(name, read9p_cr, NULL); + } + for (int i = 0; i < CONFIG_9P_MAX_REQS*_CONFIG_9P_NUM_SOCKS; i++) { + char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'}; + coroutine_add(name, lib9p_srv_write_cr, &globals.srv); + } cr_exit(); } -- cgit v1.2.3-2-g168b From c755f88f8c6862ef1497375df2d09454c99a0632 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 13 Dec 2024 17:36:53 -0500 Subject: Gather macros into libmisc/macro.h --- cmd/sbc_harness/main.c | 6 ++---- cmd/sbc_harness/usb_keyboard.c | 9 ++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'cmd/sbc_harness') diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index bbefe92..00f1c4a 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -25,8 +25,6 @@ #include "config.h" -#define ARRAY_LEN(arr) (sizeof(arr)/sizeof((arr)[0])) - static COROUTINE hello_world_cr(void *_chan) { const char *msg = "Hello world!\n"; usb_keyboard_rpc_t *chan = _chan; @@ -106,8 +104,8 @@ COROUTINE init_cr(void *) { flash_id24[0], flash_id24[1], flash_id24[2], }})); - static_assert(sizeof(flash_id64)*2 == ARRAY_LEN(globals.usb_serial)); - for (size_t i = 0; i < ARRAY_LEN(globals.usb_serial); i++) + static_assert(sizeof(flash_id64)*2 == LM_ARRAY_LEN(globals.usb_serial)); + for (size_t i = 0; i < LM_ARRAY_LEN(globals.usb_serial); i++) globals.usb_serial[i] = hexdig[(flash_id64 >> ((sizeof(flash_id64)*8)-((i+1)*4))) & 0xF]; usb_common_earlyinit(globals.usb_serial, sizeof(globals.usb_serial)); usb_keyboard_init(); diff --git a/cmd/sbc_harness/usb_keyboard.c b/cmd/sbc_harness/usb_keyboard.c index f4816c1..b781d4d 100644 --- a/cmd/sbc_harness/usb_keyboard.c +++ b/cmd/sbc_harness/usb_keyboard.c @@ -8,11 +8,10 @@ #include /* for TUD_ENDPOINT_IN */ #include +#include #include "usb_keyboard.h" -#define UNUSED(name) - /** * A USB-HID "Report Descriptor" (see USB-HID 1.11 ยง6.2.2 "Report * Descriptor") describing a keyboard. @@ -108,7 +107,11 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t // Invoked when received SET_REPORT control request or // received data on OUT endpoint ( Report ID = 0, Type = 0 ) -void tud_hid_set_report_cb(uint8_t UNUSED(instance), uint8_t UNUSED(report_id), hid_report_type_t UNUSED(report_type), uint8_t const *UNUSED(buffer), uint16_t UNUSED(bufsize)) +void tud_hid_set_report_cb(uint8_t LM_UNUSED(instance), + uint8_t LM_UNUSED(report_id), + hid_report_type_t LM_UNUSED(report_type), + uint8_t const *LM_UNUSED(buffer), + uint16_t LM_UNUSED(bufsize)) { // TODO not implemented } -- cgit v1.2.3-2-g168b