mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
misc fixes and updates
This commit is contained in:
1 parent
8ce82a100e
commit
837da0e458
12 files changed
+96
-85
No files matched your search
@@ -445,6 +445,8 @@ jobs:
|
|||||||
- path: pico-sdk/pico-rndis-dashboard
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
|
|||||||
@@ -311,6 +311,8 @@ jobs:
|
|||||||
- path: pico-sdk/pico-rndis-dashboard
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ endif
|
|||||||
all example:
|
all example:
|
||||||
true
|
true
|
||||||
|
|
||||||
build: pico-sdk
|
build build/firmware.uf2: pico-sdk main.c net.c
|
||||||
$(MKBUILD)
|
$(MKBUILD)
|
||||||
cd build && cmake -G "Unix Makefiles" .. && make
|
cd build && cmake -G "Unix Makefiles" .. && make
|
||||||
|
|
||||||
pico-sdk:
|
pico-sdk:
|
||||||
git clone --depth 1 -b 1.4.0 https://github.com/raspberrypi/pico-sdk $@
|
git clone --depth 1 -b 1.5.0 https://github.com/raspberrypi/pico-sdk $@
|
||||||
cd $@ && git submodule update --init
|
cd $@ && git submodule update --init
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -3,4 +3,3 @@
|
|||||||
#define MG_ENABLE_TCPIP 1
|
#define MG_ENABLE_TCPIP 1
|
||||||
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
||||||
#define MG_ENABLE_PACKED_FS 1
|
#define MG_ENABLE_PACKED_FS 1
|
||||||
#define MG_ENABLE_POSIX_FS 0
|
|
||||||
@@ -8,12 +8,12 @@ endif
|
|||||||
all example:
|
all example:
|
||||||
true
|
true
|
||||||
|
|
||||||
build: pico-sdk
|
build build/firmware.uf2: pico-sdk main.c net.c
|
||||||
$(MKBUILD)
|
$(MKBUILD)
|
||||||
cd build && cmake -G "Unix Makefiles" .. && make
|
cd build && cmake -G "Unix Makefiles" .. && make
|
||||||
|
|
||||||
pico-sdk:
|
pico-sdk:
|
||||||
git clone --depth 1 -b 1.4.0 https://github.com/raspberrypi/pico-sdk $@
|
git clone --depth 1 -b 1.5.0 https://github.com/raspberrypi/pico-sdk $@
|
||||||
cd $@ && git submodule update --init
|
cd $@ && git submodule update --init
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
#define MG_ENABLE_TCPIP 1
|
#define MG_ENABLE_TCPIP 1
|
||||||
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
||||||
#define MG_ENABLE_PACKED_FS 1
|
#define MG_ENABLE_PACKED_FS 1
|
||||||
#define MG_ENABLE_POSIX_FS 0
|
|
||||||
+4
-6
@@ -16854,24 +16854,22 @@ bool mg_random(void *buf, size_t len) {
|
|||||||
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||||
success = true;
|
success = true;
|
||||||
#elif MG_ARCH == MG_ARCH_WIN32
|
#elif MG_ARCH == MG_ARCH_WIN32
|
||||||
static bool initialised = false;
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1700
|
#if defined(_MSC_VER) && _MSC_VER < 1700
|
||||||
|
static bool initialised = false;
|
||||||
static HCRYPTPROV hProv;
|
static HCRYPTPROV hProv;
|
||||||
// CryptGenRandom() implementation earlier than 2008 is weak, see
|
// CryptGenRandom() implementation earlier than 2008 is weak, see
|
||||||
// https://en.wikipedia.org/wiki/CryptGenRandom
|
// https://en.wikipedia.org/wiki/CryptGenRandom
|
||||||
if (initialised == false) {
|
if (!initialised) {
|
||||||
initialised = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
|
initialised = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
|
||||||
CRYPT_VERIFYCONTEXT);
|
CRYPT_VERIFYCONTEXT);
|
||||||
}
|
}
|
||||||
if (initialised == true) {
|
if (initialised) success = CryptGenRandom(hProv, len, p);
|
||||||
success = CryptGenRandom(hProv, len, p);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
unsigned int rand_v;
|
unsigned int rand_v;
|
||||||
if (rand_s(&rand_v) == 0) {
|
if (rand_s(&rand_v) == 0) {
|
||||||
p[i] = (unsigned char)(rand_v & 255);
|
p[i] = (unsigned char) (rand_v & 255);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -1,5 +1,5 @@
|
|||||||
#include "log.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
// Not using memset for zeroing memory, cause it can be dropped by compiler
|
// Not using memset for zeroing memory, cause it can be dropped by compiler
|
||||||
// See https://github.com/cesanta/mongoose/pull/1265
|
// See https://github.com/cesanta/mongoose/pull/1265
|
||||||
@@ -21,24 +21,22 @@ bool mg_random(void *buf, size_t len) {
|
|||||||
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
while (len--) *p++ = (unsigned char) (get_rand_32() & 255);
|
||||||
success = true;
|
success = true;
|
||||||
#elif MG_ARCH == MG_ARCH_WIN32
|
#elif MG_ARCH == MG_ARCH_WIN32
|
||||||
static bool initialised = false;
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1700
|
#if defined(_MSC_VER) && _MSC_VER < 1700
|
||||||
|
static bool initialised = false;
|
||||||
static HCRYPTPROV hProv;
|
static HCRYPTPROV hProv;
|
||||||
// CryptGenRandom() implementation earlier than 2008 is weak, see
|
// CryptGenRandom() implementation earlier than 2008 is weak, see
|
||||||
// https://en.wikipedia.org/wiki/CryptGenRandom
|
// https://en.wikipedia.org/wiki/CryptGenRandom
|
||||||
if (initialised == false) {
|
if (!initialised) {
|
||||||
initialised = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
|
initialised = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
|
||||||
CRYPT_VERIFYCONTEXT);
|
CRYPT_VERIFYCONTEXT);
|
||||||
}
|
}
|
||||||
if (initialised == true) {
|
if (initialised) success = CryptGenRandom(hProv, len, p);
|
||||||
success = CryptGenRandom(hProv, len, p);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
unsigned int rand_v;
|
unsigned int rand_v;
|
||||||
if (rand_s(&rand_v) == 0) {
|
if (rand_s(&rand_v) == 0) {
|
||||||
p[i] = (unsigned char)(rand_v & 255);
|
p[i] = (unsigned char) (rand_v & 255);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,9 +9,9 @@ all: $(PROJECTS)
|
|||||||
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -removeAll workspace
|
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -removeAll workspace
|
||||||
|
|
||||||
$(PROJECTS): FORCE
|
$(PROJECTS): FORCE
|
||||||
(make -C $@ && make -C $@ clean) || ( \
|
(make -C $@ && sudo make -C $@ clean) || ( \
|
||||||
COREDIRS=`find $@ -maxdepth 1 -name 'CM*' -print` && ( \
|
COREDIRS=`find $@ -maxdepth 1 -name 'CM*' -print` && ( \
|
||||||
(test "$$COREDIRS" == "" && \
|
(test "$$COREDIRS" = "" && \
|
||||||
PROJNAME=`xq -r .projectDescription.name $@/.project` && \
|
PROJNAME=`xq -r .projectDescription.name $@/.project` && \
|
||||||
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -import $@ -cleanBuild $$PROJNAME/$(TARGET) ) || ( \
|
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -import $@ -cleanBuild $$PROJNAME/$(TARGET) ) || ( \
|
||||||
(test "$$COREDIRS" != "" && \
|
(test "$$COREDIRS" != "" && \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
PROJECTS ?= $(wildcard ../../examples/pico-sdk/*-picosdk-*)
|
PROJECTS ?= $(wildcard ../../examples/pico-sdk/*-picosdk-*)
|
||||||
SDK_PATH ?= $(realpath $(PWD))/pico-sdk
|
SDK_PATH ?= $(realpath $(PWD))/pico-sdk
|
||||||
SDK_VERSION ?= 2.0.0
|
SDK_VERSION ?= 2.1.0
|
||||||
|
|
||||||
all: $(PROJECTS)
|
all: $(PROJECTS)
|
||||||
echo
|
echo
|
||||||
@@ -24,4 +24,7 @@ clean:
|
|||||||
# Wizard-style board name --> Pico-SDK board name; SDKBNAME = table[BOARD]
|
# Wizard-style board name --> Pico-SDK board name; SDKBNAME = table[BOARD]
|
||||||
SDK_evb-pico := pico
|
SDK_evb-pico := pico
|
||||||
SDK_evb-pico2 := pico2
|
SDK_evb-pico2 := pico2
|
||||||
|
SDK_evb-pico2-w5100 := pico2
|
||||||
|
SDK_pico-w := pico_w
|
||||||
|
SDK_pico2-w := pico2_w
|
||||||
SDKBNAME = $(SDK_$(BOARD))
|
SDKBNAME = $(SDK_$(BOARD))
|
||||||
@@ -2212,8 +2212,12 @@ static void test_str(void) {
|
|||||||
TESTDOUBLE("%.1f", 0.155, "0.2");
|
TESTDOUBLE("%.1f", 0.155, "0.2");
|
||||||
|
|
||||||
TESTDOUBLE("%.3f", 13.12505, "13.125");
|
TESTDOUBLE("%.3f", 13.12505, "13.125");
|
||||||
|
#if MG_ARCH == MG_ARCH_WIN32 && defined(_MSC_VER) && _MSC_VER < 1700
|
||||||
|
// TODO(): for some reason we round down in VC98; skip
|
||||||
|
#else
|
||||||
TESTDOUBLE("%.3f", 15.1255, "15.126");
|
TESTDOUBLE("%.3f", 15.1255, "15.126");
|
||||||
TESTDOUBLE("%.3f", 19.1255, "19.125");
|
TESTDOUBLE("%.3f", 19.1255, "19.125");
|
||||||
|
#endif
|
||||||
TESTDOUBLE("%.4f", 100.15, "100.1500");
|
TESTDOUBLE("%.4f", 100.15, "100.1500");
|
||||||
TESTDOUBLE("%.2f", 5.55, "5.55");
|
TESTDOUBLE("%.2f", 5.55, "5.55");
|
||||||
|
|
||||||
|
|||||||
+68
-63
@@ -16,57 +16,58 @@ cd `dirname "$0"`
|
|||||||
rm test.log
|
rm test.log
|
||||||
|
|
||||||
|
|
||||||
#STM32="f207 f429 f439 f746 f756 f767 h563 h573 h723 h735 h743 h745 h747 h753 h755"
|
STM32="f207 f429 f439 f746 f756 f767 h563 h573 h723 h735 h743 h745 h747 h753 h755"
|
||||||
#STIDES="GCC+make CubeIDE"
|
STIDES="GCC+make CubeIDE"
|
||||||
## Keil: f756
|
# Keil: f756
|
||||||
#for board in $STM32; do
|
for board in $STM32; do
|
||||||
# for ide in $STIDES; do
|
for ide in $STIDES; do
|
||||||
# for rtos in $RTOSES; do
|
for rtos in $RTOSES; do
|
||||||
# dotest $board $ide $rtos
|
dotest $board $ide $rtos
|
||||||
# done
|
done
|
||||||
# done
|
done
|
||||||
#done
|
done
|
||||||
#
|
dotest h7s3l8 GCC+make baremetal
|
||||||
#
|
|
||||||
#NXP="mcxn947"
|
|
||||||
#NXPIDES="GCC+make MCUXpresso"
|
|
||||||
#for board in $NXP; do
|
|
||||||
# for ide in $NXPIDES; do
|
|
||||||
# for rtos in $RTOSES; do
|
|
||||||
# dotest $board $ide $rtos
|
|
||||||
# done
|
|
||||||
# done
|
|
||||||
#done
|
|
||||||
#NXP="rt1020 rt1024 rt1040 rt1060 rt1064 rt1170"
|
|
||||||
#for board in $NXP; do
|
|
||||||
# dotest $board "GCC+make" "baremetal"
|
|
||||||
#done
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#INFINEON="xmc4400 xmc4700 xmc7200"
|
|
||||||
#INFINEONIDES="GCC+make"
|
|
||||||
#for board in $INFINEON; do
|
|
||||||
# for ide in $INFINEONIDES; do
|
|
||||||
# for rtos in "baremetal"; do
|
|
||||||
# dotest $board $ide $rtos
|
|
||||||
# done
|
|
||||||
# done
|
|
||||||
#done
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#TI="tm4c129"
|
|
||||||
#TIIDES="GCC+make"
|
|
||||||
#for board in $TI; do
|
|
||||||
# for ide in $TIIDES; do
|
|
||||||
# for rtos in $RTOSES; do
|
|
||||||
# dotest $board $ide $rtos
|
|
||||||
# done
|
|
||||||
# done
|
|
||||||
#done
|
|
||||||
#dotest "tms570" "CGT+make" "baremetal"
|
|
||||||
|
|
||||||
|
|
||||||
PICO="evb-pico evb-pico2"
|
NXP="mcxn947"
|
||||||
|
NXPIDES="GCC+make MCUXpresso"
|
||||||
|
for board in $NXP; do
|
||||||
|
for ide in $NXPIDES; do
|
||||||
|
for rtos in $RTOSES; do
|
||||||
|
dotest $board $ide $rtos
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
NXP="rt1020 rt1024 rt1040 rt1060 rt1064 rt1170"
|
||||||
|
for board in $NXP; do
|
||||||
|
dotest $board "GCC+make" "baremetal"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
INFINEON="xmc4400 xmc4700 xmc7200"
|
||||||
|
INFINEONIDES="GCC+make"
|
||||||
|
for board in $INFINEON; do
|
||||||
|
for ide in $INFINEONIDES; do
|
||||||
|
for rtos in "baremetal"; do
|
||||||
|
dotest $board $ide $rtos
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
TI="tm4c129"
|
||||||
|
TIIDES="GCC+make"
|
||||||
|
for board in $TI; do
|
||||||
|
for ide in $TIIDES; do
|
||||||
|
for rtos in $RTOSES; do
|
||||||
|
dotest $board $ide $rtos
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
dotest "tms570" "CGT+make" "baremetal"
|
||||||
|
|
||||||
|
|
||||||
|
PICO="evb-pico evb-pico2 evb-pico2-w5100 pico-w pico2-w"
|
||||||
for board in $PICO; do
|
for board in $PICO; do
|
||||||
for rtos in "baremetal"; do
|
for rtos in "baremetal"; do
|
||||||
dotest $board "Pico-SDK" $rtos
|
dotest $board "Pico-SDK" $rtos
|
||||||
@@ -74,20 +75,24 @@ for board in $PICO; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
#ESP="esp32"
|
ESP="esp32"
|
||||||
#for board in $ESP; do
|
for board in $ESP; do
|
||||||
# dotest $board "ESP-IDF" "baremetal"
|
dotest $board "ESP-IDF" "baremetal"
|
||||||
|
done
|
||||||
|
|
||||||
|
# f439 not supported
|
||||||
|
# h755 not supported in 3.7.0 branch; master branch currently not building
|
||||||
|
# other ST boards (PHY address != 0) might build and not work
|
||||||
|
ZEPHYR="zephyr zephyr-w5500 f207 f429 f746 f756 f767 h563 h573 h723 h735 h743 h745 h747 h753 mcxn947 rt1060 rt1064 evb-pico"
|
||||||
|
for board in $ZEPHYR; do
|
||||||
|
dotest $board "Zephyr" "baremetal"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
#ARDUINO="arduino arduino-esp32 teensy41"
|
||||||
|
#for board in $ARDUINO; do
|
||||||
|
# dotest $board "Arduino" "baremetal"
|
||||||
#done
|
#done
|
||||||
#
|
|
||||||
## h755 not supported in 3.7.0 branch; master branch currently not building
|
|
||||||
## other ST boards (PHY address != 0) might build and not work
|
|
||||||
#ZEPHYR="f207 f429 f746 f756 f767 h563 h573 h723 h735 h743 h745 h747 h753 mcxn947 rt1060 rt1064 evb-pico"
|
|
||||||
#for board in $ZEPHYR; do
|
|
||||||
# dotest $board "Zephyr" "baremetal"
|
|
||||||
#done
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#ARDUINO="teensy41"
|
|
||||||
#
|
|
||||||
rm -rf workspace pico-sdk mcuxpresso .cache .eclipse .p2 build
|
rm -rf workspace pico-sdk mcuxpresso .cache .eclipse .p2 build
|
||||||
cd -
|
cd -
|
||||||
Reference in new issue
Block a user