diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-25 21:55:07 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-25 21:55:07 -0600 |
commit | 7c03983529f6502206cd40692c794b7c6605d9bf (patch) | |
tree | ecac9afa4928b6a1c040c97662371c01fde046c3 | |
parent | 9f4494685a29714c57cc11d62dead71f7004e061 (diff) |
Enable pico-sdk for host binaries
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | cmd/sbc_harness/CMakeLists.txt | 6 | ||||
-rw-r--r-- | cmd/sbc_harness/hw/w5500.c | 2 | ||||
-rw-r--r-- | cmd/srv9p/CMakeLists.txt | 4 |
5 files changed, 28 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e55ec51..9b5c0e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,21 @@ -# CMakeLists.txt - Main per-output build script for sbc-harness project +# CMakeLists.txt - Main per-platform build script for sbc-harness project # # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-Licence-Identifier: AGPL-3.0-or-later cmake_minimum_required(VERSION 3.30) -if (_UBUILD_USE_PICO_SDK) - set(PICO_SDK_PATH "${CMAKE_SOURCE_DIR}/3rd-party/pico-sdk") - include(pico_sdk_import.cmake) +if (NOT PICO_PLATFORM) + message(FATAL_ERROR "PICO_PLATFORM must be specified") endif() +set(PICO_SDK_PATH "${CMAKE_SOURCE_DIR}/3rd-party/pico-sdk") +include(pico_sdk_import.cmake) + project(sbc_harness) +pico_sdk_init() + add_compile_options(-Wall -Wextra -Werror) add_subdirectory(libcr) @@ -21,4 +25,5 @@ add_subdirectory(libusb) add_subdirectory(libmisc) add_subdirectory(lib9p) -add_subdirectory(cmd/${_UBUILD_CMD}) +add_subdirectory(cmd/sbc_harness) +add_subdirectory(cmd/srv9p) @@ -33,15 +33,17 @@ libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt ################################################################################ -commands := $(patsubst cmd/%/CMakeLists.txt,%,$(wildcard cmd/*/CMakeLists.txt)) -build: $(foreach c,$(commands),cmd/$c/build) +platforms := $(shell sed -nE 's/if *\(PICO_PLATFORM STREQUAL "(.*)"\)/\1/p' cmd/*/CMakeLists.txt) + +build: $(foreach p,$(platforms),build/$p/build) .PHONY: build -cmd/%/build: build/%/Makefile $(generate/files) +$(foreach p,$(platforms),build/$p/Makefile): build/%/Makefile: + mkdir -p $(@D) && cd $(@D) && cmake -DCMAKE_BUILD_TYPE=Debug -DPICO_PLATFORM=$* ../.. + +$(foreach p,$(platforms),build/$p/build): build/%/build: build/%/Makefile $(MAKE) -C $(<D) -.PHONY: cmd/%/build -build/%/Makefile: cmd/%/CMakeLists.txt - mkdir -p $(@D) && cd $(@D) && cmake -DCMAKE_BUILD_TYPE=Debug -D_UBUILD_CMD=$* $(shell if grep -q pico_sdk_init $<; then echo ' -D_UBUILD_USE_PICO_SDK=1 '; fi) ../.. +.PHONY: $(foreach p,$(platforms),build/$p/build) generate: $(generate/files) .PHONY: generate diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index 54553f0..d6261cb 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -3,7 +3,7 @@ # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-Licence-Identifier: AGPL-3.0-or-later -pico_sdk_init() +if (PICO_PLATFORM STREQUAL "rp2040") add_executable(sbc_harness main.c @@ -21,7 +21,7 @@ target_link_libraries(sbc_harness libmisc libusb - libdhcp + #libdhcp ) pico_enable_stdio_usb(sbc_harness 0) @@ -31,3 +31,5 @@ pico_enable_stdio_rtt(sbc_harness 0) pico_add_extra_outputs(sbc_harness) # create .map/.bin/.hex/.uf2 files in addition to .elf pico_set_program_url(sbc_harness "https://git.lukeshu.com/sbc-harness") + +endif() diff --git a/cmd/sbc_harness/hw/w5500.c b/cmd/sbc_harness/hw/w5500.c index 3bcc0a4..6b90b99 100644 --- a/cmd/sbc_harness/hw/w5500.c +++ b/cmd/sbc_harness/hw/w5500.c @@ -296,6 +296,7 @@ implements_net_stream_listener *w5500_tcp_listen(struct w5500 *chip, uint8_t soc return &chip->listeners[socknum]; } +/* implements_net_packet_conn *w5500_udp_conn(struct w5500 *chip, uint8_t socknum, uint16_t port) { assert(chip); @@ -307,6 +308,7 @@ implements_net_packet_conn *w5500_udp_conn(struct w5500 *chip, uint8_t socknum, return &chip->listeners[socknum]; } +*/ /* tcp_listener methods *******************************************************/ diff --git a/cmd/srv9p/CMakeLists.txt b/cmd/srv9p/CMakeLists.txt index 52e5171..ccad845 100644 --- a/cmd/srv9p/CMakeLists.txt +++ b/cmd/srv9p/CMakeLists.txt @@ -3,6 +3,8 @@ # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-Licence-Identifier: AGPL-3.0-or-later +if (PICO_PLATFORM STREQUAL "host") + set(static_srcs static/README.md static/Documentation/x @@ -50,3 +52,5 @@ add_custom_command( ) target_sources(srv9p PRIVATE ${static_objs} static.h) + +endif() |