mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-26 22:41:03 +08:00
Use Pico-SDK RNG
This commit is contained in:
parent
5559d0fa68
commit
094202ff16
@ -12,7 +12,7 @@ add_executable(firmware
|
|||||||
target_include_directories(firmware PUBLIC
|
target_include_directories(firmware PUBLIC
|
||||||
.)
|
.)
|
||||||
|
|
||||||
target_link_libraries(firmware hardware_pio hardware_dma pico_stdlib)
|
target_link_libraries(firmware hardware_pio hardware_dma pico_stdlib pico_rand)
|
||||||
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
||||||
|
|
||||||
pico_enable_stdio_usb(firmware 1) # Route stdio
|
pico_enable_stdio_usb(firmware 1) # Route stdio
|
||||||
|
@ -17,7 +17,7 @@ target_include_directories(firmware PUBLIC
|
|||||||
.
|
.
|
||||||
pico-sdk/lib/tinyusb/lib/networking)
|
pico-sdk/lib/tinyusb/lib/networking)
|
||||||
|
|
||||||
target_link_libraries(firmware pico_stdlib hardware_spi tinyusb_device)
|
target_link_libraries(firmware pico_stdlib pico_rand hardware_spi tinyusb_device)
|
||||||
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
||||||
|
|
||||||
pico_enable_stdio_usb(firmware 0) # Route stdio
|
pico_enable_stdio_usb(firmware 0) # Route stdio
|
||||||
|
@ -15,7 +15,7 @@ target_include_directories(firmware PUBLIC
|
|||||||
.
|
.
|
||||||
pico-sdk/lib/tinyusb/lib/networking)
|
pico-sdk/lib/tinyusb/lib/networking)
|
||||||
|
|
||||||
target_link_libraries(firmware pico_stdlib hardware_spi tinyusb_device)
|
target_link_libraries(firmware pico_stdlib pico_rand hardware_spi tinyusb_device)
|
||||||
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
||||||
|
|
||||||
pico_enable_stdio_usb(firmware 0) # Route stdio
|
pico_enable_stdio_usb(firmware 0) # Route stdio
|
||||||
|
@ -16,7 +16,7 @@ target_include_directories(firmware PUBLIC
|
|||||||
.
|
.
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(firmware hardware_pio hardware_dma pico_stdlib cyw43_driver_picow)
|
target_link_libraries(firmware hardware_pio hardware_dma pico_stdlib pico_rand cyw43_driver_picow)
|
||||||
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
pico_add_extra_outputs(firmware) # create map/bin/hex file etc.
|
||||||
|
|
||||||
pico_enable_stdio_usb(firmware 1) # Route stdio
|
pico_enable_stdio_usb(firmware 1) # Route stdio
|
||||||
|
@ -16775,6 +16775,9 @@ bool mg_random(void *buf, size_t len) {
|
|||||||
#if MG_ARCH == MG_ARCH_ESP32
|
#if MG_ARCH == MG_ARCH_ESP32
|
||||||
while (len--) *p++ = (unsigned char) (esp_random() & 255);
|
while (len--) *p++ = (unsigned char) (esp_random() & 255);
|
||||||
success = true;
|
success = true;
|
||||||
|
#elif MG_ARCH == MG_ARCH_RP2040
|
||||||
|
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||||
|
success = true;
|
||||||
#elif MG_ARCH == MG_ARCH_WIN32
|
#elif MG_ARCH == MG_ARCH_WIN32
|
||||||
static bool initialised = false;
|
static bool initialised = false;
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1700
|
#if defined(_MSC_VER) && _MSC_VER < 1700
|
||||||
|
@ -254,6 +254,7 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <pico/stdlib.h>
|
#include <pico/stdlib.h>
|
||||||
|
#include <pico/rand.h>
|
||||||
int mkdir(const char *, mode_t);
|
int mkdir(const char *, mode_t);
|
||||||
|
|
||||||
#if MG_OTA == MG_OTA_PICOSDK
|
#if MG_OTA == MG_OTA_PICOSDK
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <pico/stdlib.h>
|
#include <pico/stdlib.h>
|
||||||
|
#include <pico/rand.h>
|
||||||
int mkdir(const char *, mode_t);
|
int mkdir(const char *, mode_t);
|
||||||
|
|
||||||
#if MG_OTA == MG_OTA_PICOSDK
|
#if MG_OTA == MG_OTA_PICOSDK
|
||||||
|
@ -17,6 +17,9 @@ bool mg_random(void *buf, size_t len) {
|
|||||||
#if MG_ARCH == MG_ARCH_ESP32
|
#if MG_ARCH == MG_ARCH_ESP32
|
||||||
while (len--) *p++ = (unsigned char) (esp_random() & 255);
|
while (len--) *p++ = (unsigned char) (esp_random() & 255);
|
||||||
success = true;
|
success = true;
|
||||||
|
#elif MG_ARCH == MG_ARCH_RP2040
|
||||||
|
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||||
|
success = true;
|
||||||
#elif MG_ARCH == MG_ARCH_WIN32
|
#elif MG_ARCH == MG_ARCH_WIN32
|
||||||
static bool initialised = false;
|
static bool initialised = false;
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1700
|
#if defined(_MSC_VER) && _MSC_VER < 1700
|
||||||
|
Loading…
x
Reference in New Issue
Block a user