diff --git a/CMakeLists.txt b/CMakeLists.txt index 993cd4a..a6f9adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,4 +31,4 @@ pico_enable_stdio_uart(picomap 0) pico_add_extra_outputs(picomap) -target_link_libraries(picomap pico_stdlib tinyusb_device tinyusb_board hardware_pio hardware_spi hardware_dma hardware_clocks) +target_link_libraries(picomap pico_stdlib pico_rand tinyusb_device tinyusb_board hardware_pio hardware_spi hardware_dma hardware_clocks) diff --git a/cmd/load/main.go b/cmd/load/main.go index 541deaf..9a095e5 100644 --- a/cmd/load/main.go +++ b/cmd/load/main.go @@ -26,6 +26,14 @@ func main() { } func run(buildDir string) error { + fmt.Println("Configuring...") + cmake := exec.Command("cmake", "-B", buildDir) + cmake.Stdout = os.Stdout + cmake.Stderr = os.Stderr + if err := cmake.Run(); err != nil { + return fmt.Errorf("cmake failed: %w", err) + } + fmt.Println("Building...") cmd := exec.Command("make", "-C", buildDir) cmd.Stdout = os.Stdout diff --git a/dhcp.cpp b/dhcp.cpp index 45e9c94..d323ec7 100644 --- a/dhcp.cpp +++ b/dhcp.cpp @@ -1,5 +1,6 @@ #include "dhcp.h" #include +#include "pico/rand.h" #include "w6300.h" namespace dhcp_opt { @@ -15,7 +16,7 @@ struct __attribute__((packed)) dhcp_discover { uint8_t htype = 1; uint8_t hlen = 6; uint8_t hops = 0; - uint32_t xid = __builtin_bswap32(0x12345678); + uint32_t xid = __builtin_bswap32(static_cast(get_rand_64())); uint16_t secs = 0; uint16_t flags = __builtin_bswap16(0x8000); std::array ciaddr = {};