From ae374073699a1b506304efcfb4aad9b1e56e3cbd Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 18 Jul 2023 17:10:05 -0300 Subject: [PATCH 1/2] static clue --- examples/rp2040/pico-w5500/main.c | 8 +++++--- .../stm32/nucleo-f429zi-cube-baremetal/Core/Src/main.c | 6 ++++-- examples/stm32/nucleo-f429zi-freertos/main.c | 6 ++++-- .../stm32/nucleo-f429zi-make-baremetal-builtin/main.c | 6 ++++-- .../stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-freertos/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-keil-baremetal/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-keil-freertos/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-keil-freertos_cmsis2/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-keil-rtx/main.c | 6 ++++-- examples/stm32/nucleo-f746zg-keil-rtx5/main.c | 6 ++++-- .../stm32/nucleo-f746zg-make-baremetal-builtin/main.c | 6 ++++-- .../stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c | 2 -- examples/ti/ek-tm4c1294xl-baremetal/main.c | 6 ++++-- examples/ti/ek-tm4c1294xl-freertos/main.c | 6 ++++-- 15 files changed, 57 insertions(+), 31 deletions(-) diff --git a/examples/rp2040/pico-w5500/main.c b/examples/rp2040/pico-w5500/main.c index 16e900a0..3c79e67f 100644 --- a/examples/rp2040/pico-w5500/main.c +++ b/examples/rp2040/pico-w5500/main.c @@ -74,11 +74,13 @@ int main(void) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_spi spi = {NULL, spi_begin, spi_end, spi_txn}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(id), - .driver = &mg_tcpip_driver_w5500, + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), + .driver = &mg_tcpip_driver_w5500, .driver_data = &spi}; mg_tcpip_init(&mgr, &mif); mg_timer_add(&mgr, BLINK_PERIOD_MS, MG_TIMER_REPEAT, timer_fn, &mif); diff --git a/examples/stm32/nucleo-f429zi-cube-baremetal/Core/Src/main.c b/examples/stm32/nucleo-f429zi-cube-baremetal/Core/Src/main.c index a1ee8512..1b4ae477 100644 --- a/examples/stm32/nucleo-f429zi-cube-baremetal/Core/Src/main.c +++ b/examples/stm32/nucleo-f429zi-cube-baremetal/Core/Src/main.c @@ -136,10 +136,12 @@ int main(void) mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f429zi-freertos/main.c b/examples/stm32/nucleo-f429zi-freertos/main.c index 49dddf07..75117899 100644 --- a/examples/stm32/nucleo-f429zi-freertos/main.c +++ b/examples/stm32/nucleo-f429zi-freertos/main.c @@ -49,11 +49,13 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used ethernet_init(); struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f429zi-make-baremetal-builtin/main.c b/examples/stm32/nucleo-f429zi-make-baremetal-builtin/main.c index 1ee4ac27..1dc8a3af 100644 --- a/examples/stm32/nucleo-f429zi-make-baremetal-builtin/main.c +++ b/examples/stm32/nucleo-f429zi-make-baremetal-builtin/main.c @@ -43,10 +43,12 @@ int main(void) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c index e569ce74..4f9513d4 100644 --- a/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c +++ b/examples/stm32/nucleo-f746zg-cube-baremetal/Core/Src/main.c @@ -150,10 +150,12 @@ int main(void) mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-freertos/main.c b/examples/stm32/nucleo-f746zg-freertos/main.c index 49dddf07..75117899 100644 --- a/examples/stm32/nucleo-f746zg-freertos/main.c +++ b/examples/stm32/nucleo-f746zg-freertos/main.c @@ -49,11 +49,13 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used ethernet_init(); struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-keil-baremetal/main.c b/examples/stm32/nucleo-f746zg-keil-baremetal/main.c index 1511c8cd..2104fbc3 100644 --- a/examples/stm32/nucleo-f746zg-keil-baremetal/main.c +++ b/examples/stm32/nucleo-f746zg-keil-baremetal/main.c @@ -44,10 +44,12 @@ int main(void) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-keil-freertos/main.c b/examples/stm32/nucleo-f746zg-keil-freertos/main.c index f56f1011..efd63c8f 100644 --- a/examples/stm32/nucleo-f746zg-keil-freertos/main.c +++ b/examples/stm32/nucleo-f746zg-keil-freertos/main.c @@ -40,10 +40,12 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-keil-freertos_cmsis2/main.c b/examples/stm32/nucleo-f746zg-keil-freertos_cmsis2/main.c index 0920a0f4..1abab578 100644 --- a/examples/stm32/nucleo-f746zg-keil-freertos_cmsis2/main.c +++ b/examples/stm32/nucleo-f746zg-keil-freertos_cmsis2/main.c @@ -32,10 +32,12 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-keil-rtx/main.c b/examples/stm32/nucleo-f746zg-keil-rtx/main.c index 4729792f..95a82ca7 100644 --- a/examples/stm32/nucleo-f746zg-keil-rtx/main.c +++ b/examples/stm32/nucleo-f746zg-keil-rtx/main.c @@ -32,10 +32,12 @@ static void server(const void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-keil-rtx5/main.c b/examples/stm32/nucleo-f746zg-keil-rtx5/main.c index b4400200..ae2b4238 100644 --- a/examples/stm32/nucleo-f746zg-keil-rtx5/main.c +++ b/examples/stm32/nucleo-f746zg-keil-rtx5/main.c @@ -32,10 +32,12 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-f746zg-make-baremetal-builtin/main.c b/examples/stm32/nucleo-f746zg-make-baremetal-builtin/main.c index 1ee4ac27..1dc8a3af 100644 --- a/examples/stm32/nucleo-f746zg-make-baremetal-builtin/main.c +++ b/examples/stm32/nucleo-f746zg-make-baremetal-builtin/main.c @@ -43,10 +43,12 @@ int main(void) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c b/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c index f59011d1..62505d2e 100644 --- a/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c +++ b/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c @@ -152,8 +152,6 @@ int main(void) mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32h_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), .driver = &mg_tcpip_driver_stm32h, diff --git a/examples/ti/ek-tm4c1294xl-baremetal/main.c b/examples/ti/ek-tm4c1294xl-baremetal/main.c index e10ed89a..c42a0f29 100644 --- a/examples/ti/ek-tm4c1294xl-baremetal/main.c +++ b/examples/ti/ek-tm4c1294xl-baremetal/main.c @@ -68,12 +68,14 @@ int main(void) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_tm4c_data driver_data = {.mdc_cr = 1}; // See driver_tm4c.h struct mg_tcpip_if mif = { .mac = READ_PREFLASHED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_tm4c, .driver_data = &driver_data, }; diff --git a/examples/ti/ek-tm4c1294xl-freertos/main.c b/examples/ti/ek-tm4c1294xl-freertos/main.c index e0a06506..38690bdf 100644 --- a/examples/ti/ek-tm4c1294xl-freertos/main.c +++ b/examples/ti/ek-tm4c1294xl-freertos/main.c @@ -53,12 +53,14 @@ static void server(void *args) { mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used ethernet_init(); struct mg_tcpip_driver_tm4c_data driver_data = {.mdc_cr = 1}; struct mg_tcpip_if mif = { .mac = READ_PREFLASHED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_tm4c, .driver_data = &driver_data, }; From ef0ff43975fd3047231110bf40d6f650ed46bc0a Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 18 Jul 2023 17:23:50 -0300 Subject: [PATCH 2/2] static clue --- examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c | 4 ++++ examples/stm32/nucleo-h743zi-cube-freertos/Core/Src/main.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c b/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c index 62505d2e..67a5b2b4 100644 --- a/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c +++ b/examples/stm32/nucleo-h743zi-cube-baremetal/Core/Src/main.c @@ -154,6 +154,10 @@ int main(void) // Initialise Mongoose network stack struct mg_tcpip_driver_stm32h_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32h, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif); diff --git a/examples/stm32/nucleo-h743zi-cube-freertos/Core/Src/main.c b/examples/stm32/nucleo-h743zi-cube-freertos/Core/Src/main.c index bab97870..e88811f7 100644 --- a/examples/stm32/nucleo-h743zi-cube-freertos/Core/Src/main.c +++ b/examples/stm32/nucleo-h743zi-cube-freertos/Core/Src/main.c @@ -510,10 +510,12 @@ void server(void *argument) mg_log_set(MG_LL_DEBUG); // Set log level // Initialise Mongoose network stack - // Specify MAC address, and IP/mask/GW in network byte order for static - // IP configuration. If IP/mask/GW are unset, DHCP is going to be used struct mg_tcpip_driver_stm32h_data driver_data = {.mdc_cr = 4}; struct mg_tcpip_if mif = {.mac = GENERATE_LOCALLY_ADMINISTERED_MAC(), + // Uncomment below for static configuration: + // .ip = mg_htonl(MG_U32(192, 168, 0, 223)), + // .mask = mg_htonl(MG_U32(255, 255, 255, 0)), + // .gw = mg_htonl(MG_U32(192, 168, 0, 1)), .driver = &mg_tcpip_driver_stm32h, .driver_data = &driver_data}; mg_tcpip_init(&mgr, &mif);