diff --git a/.github/workflows/arduino_esp32.yaml b/.github/workflows/arduino_esp32.yaml index ce4125da5..1bc0f27e4 100644 --- a/.github/workflows/arduino_esp32.yaml +++ b/.github/workflows/arduino_esp32.yaml @@ -51,7 +51,7 @@ jobs: mkdir -p $ARDUINO_BASE cd $ARDUINO_BASE - platformio init -b esp32thing_plus --project-option="build_flags=-DZ_FEATURE_LINK_BLUETOOTH=1 -DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC" + platformio init -b esp32thing_plus -O "build_flags=-DZ_FEATURE_LINK_BLUETOOTH=1 -DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC" -O "lib_ldf_mode=deep+" cd $ARDUINO_BASE/lib ln -s $ZENOH_PICO_BASE diff --git a/README.md b/README.md index 033521869..6eb1a2ee8 100644 --- a/README.md +++ b/README.md @@ -336,15 +336,15 @@ The simplest way to run some of the example is to get a Docker image of the **ze ### 3.1. Starting the Zenoh Router Assuming you've pulled the Docker image of the **zenoh** router on a Linux host (to leverage UDP multicast scouting as explained [here](https://zenoh.io/docs/getting-started/quick-test/#run-zenoh-router-in-a-docker-container), then simply do: ```bash -$ docker run --init --net host eclipse/zenoh:master +$ docker run --init --net host eclipse/zenoh:main ``` To see the zenoh manual page, simply do: ```bash -$ docker run --init --net host eclipse/zenoh:master --help +$ docker run --init --net host eclipse/zenoh:main --help ``` -:warning: **Please notice that the `--net host` option in Docker is restricted to Linux only.** +:warning: **Please notice that the `--net host` option in Docker is restricted to Linux only.** The cause is that Docker doesn't support UDP multicast between a container and its host (see cases [moby/moby#23659](https://github.com/moby/moby/issues/23659), [moby/libnetwork#2397](https://github.com/moby/libnetwork/issues/2397) or [moby/libnetwork#552](https://github.com/moby/libnetwork/issues/552)). The only known way to make it work is to use the `--net host` option that is [only supported on Linux hosts](https://docs.docker.com/network/host/). ### 3.2. Basic Pub/Sub Example @@ -385,7 +385,7 @@ where `lo0` is the network interface you want to use for multicast communication ### 3.4. Basic Pub/Sub Example - Mixing Client and P2P communication To allow Zenoh-Pico unicast clients to talk to Zenoh-Pico multicast peers, as well as with any other Zenoh client/peer, you need to start a Zenoh Router that listens on both multicast and unicast: ```bash -$ docker run --init --net host eclipse/zenoh:master -l udp/224.0.0.123:7447#iface=lo0 -l tcp/127.0.0.1:7447 +$ docker run --init --net host eclipse/zenoh:main -l udp/224.0.0.123:7447#iface=lo0 -l tcp/127.0.0.1:7447 ``` Assuming that (1) you are running the **zenoh** router as indicated above, and (2) you are under the build directory, do: diff --git a/include/zenoh-pico/collections/refcount.h b/include/zenoh-pico/collections/refcount.h index 7660fdb31..76e186f74 100644 --- a/include/zenoh-pico/collections/refcount.h +++ b/include/zenoh-pico/collections/refcount.h @@ -45,7 +45,8 @@ #define _ZP_RC_CNT_TYPE _z_atomic(unsigned int) #define _ZP_RC_OP_INIT_CNT _z_atomic_store_explicit(&p.in->_cnt, (unsigned int)1, _z_memory_order_relaxed); #define _ZP_RC_OP_INCR_CNT _z_atomic_fetch_add_explicit(&p->in->_cnt, (unsigned int)1, _z_memory_order_relaxed); -#define _ZP_RC_OP_DECR_AND_CMP _z_atomic_fetch_sub_explicit(&p->in->_cnt, (unsigned int)1, _z_memory_order_release) > 1 +#define _ZP_RC_OP_DECR_AND_CMP \ + _z_atomic_fetch_sub_explicit(&p->in->_cnt, (unsigned int)1, _z_memory_order_release) > (unsigned int)1 #define _ZP_RC_OP_SYNC atomic_thread_fence(_z_memory_order_acquire); #else // ZENOH_C_STANDARD == 99 @@ -53,11 +54,11 @@ // c99 gcc sync builtin variant #define _ZP_RC_CNT_TYPE unsigned int -#define _ZP_RC_OP_INIT_CNT \ - __sync_fetch_and_and(&p.in->_cnt, 0); \ - __sync_fetch_and_add(&p.in->_cnt, 1); -#define _ZP_RC_OP_INCR_CNT __sync_fetch_and_add(&p->in->_cnt, 1); -#define _ZP_RC_OP_DECR_AND_CMP __sync_fetch_and_sub(&p->in->_cnt, 1) > 1 +#define _ZP_RC_OP_INIT_CNT \ + __sync_fetch_and_and(&p.in->_cnt, (unsigned int)0); \ + __sync_fetch_and_add(&p.in->_cnt, (unsigned int)1); +#define _ZP_RC_OP_INCR_CNT __sync_fetch_and_add(&p->in->_cnt, (unsigned int)1); +#define _ZP_RC_OP_DECR_AND_CMP __sync_fetch_and_sub(&p->in->_cnt, (unsigned int)1) > (unsigned int)1 #define _ZP_RC_OP_SYNC __sync_synchronize(); #else // !ZENOH_COMPILER_GCC @@ -76,9 +77,9 @@ // Single thread variant #define _ZP_RC_CNT_TYPE unsigned int -#define _ZP_RC_OP_INIT_CNT p.in->_cnt = 1; -#define _ZP_RC_OP_INCR_CNT p->in->_cnt += 1; -#define _ZP_RC_OP_DECR_AND_CMP p->in->_cnt-- > 1 +#define _ZP_RC_OP_INIT_CNT p.in->_cnt = (unsigned int)1; +#define _ZP_RC_OP_INCR_CNT p->in->_cnt += (unsigned int)1; +#define _ZP_RC_OP_DECR_AND_CMP p->in->_cnt-- > (unsigned int)1 #define _ZP_RC_OP_SYNC #endif // Z_FEATURE_MULTI_THREAD == 1 diff --git a/include/zenoh-pico/link/config/bt.h b/include/zenoh-pico/link/config/bt.h index 40827e76c..0a68898b0 100644 --- a/include/zenoh-pico/link/config/bt.h +++ b/include/zenoh-pico/link/config/bt.h @@ -32,14 +32,14 @@ #define BT_CONFIG_TOUT_KEY 0x03 #define BT_CONFIG_TOUT_STR "tout" -#define BT_CONFIG_MAPPING_BUILD \ - _z_str_intmapping_t args[BT_CONFIG_ARGC]; \ - args[0]._key = BT_CONFIG_MODE_KEY; \ - args[0]._str = BT_CONFIG_MODE_STR; \ - args[1]._key = BT_CONFIG_PROFILE_KEY; \ - args[1]._str = BT_CONFIG_PROFILE_STR; \ - args[2]._key = BT_CONFIG_TOUT_KEY; \ - args[2]._str = BT_CONFIG_TOUT_STR; +#define BT_CONFIG_MAPPING_BUILD \ + _z_str_intmapping_t args[BT_CONFIG_ARGC]; \ + args[0]._key = BT_CONFIG_MODE_KEY; \ + args[0]._str = (char *)BT_CONFIG_MODE_STR; \ + args[1]._key = BT_CONFIG_PROFILE_KEY; \ + args[1]._str = (char *)BT_CONFIG_PROFILE_STR; \ + args[2]._key = BT_CONFIG_TOUT_KEY; \ + args[2]._str = (char *)BT_CONFIG_TOUT_STR; size_t _z_bt_config_strlen(const _z_str_intmap_t *s); diff --git a/include/zenoh-pico/link/config/serial.h b/include/zenoh-pico/link/config/serial.h index 85270be62..7eb4408ba 100644 --- a/include/zenoh-pico/link/config/serial.h +++ b/include/zenoh-pico/link/config/serial.h @@ -45,7 +45,7 @@ #define SERIAL_CONFIG_MAPPING_BUILD \ _z_str_intmapping_t args[SERIAL_CONFIG_ARGC]; \ args[0]._key = SERIAL_CONFIG_BAUDRATE_KEY; \ - args[0]._str = SERIAL_CONFIG_BAUDRATE_STR; + args[0]._str = (char *)SERIAL_CONFIG_BAUDRATE_STR; // args[1]._key = SERIAL_CONFIG_DATABITS_KEY; // args[1]._str = SERIAL_CONFIG_DATABITS_STR; // args[2]._key = SERIAL_CONFIG_FLOWCONTROL_KEY; diff --git a/include/zenoh-pico/link/config/tcp.h b/include/zenoh-pico/link/config/tcp.h index ed57e7700..9e3e0f5a8 100644 --- a/include/zenoh-pico/link/config/tcp.h +++ b/include/zenoh-pico/link/config/tcp.h @@ -29,7 +29,7 @@ #define TCP_CONFIG_MAPPING_BUILD \ _z_str_intmapping_t args[TCP_CONFIG_ARGC]; \ args[0]._key = TCP_CONFIG_TOUT_KEY; \ - args[0]._str = TCP_CONFIG_TOUT_STR; + args[0]._str = (char *)TCP_CONFIG_TOUT_STR; size_t _z_tcp_config_strlen(const _z_str_intmap_t *s); diff --git a/include/zenoh-pico/link/config/udp.h b/include/zenoh-pico/link/config/udp.h index dd374b5b6..fb6ee2c64 100644 --- a/include/zenoh-pico/link/config/udp.h +++ b/include/zenoh-pico/link/config/udp.h @@ -30,14 +30,14 @@ #define UDP_CONFIG_JOIN_STR "join" #if Z_FEATURE_LINK_UDP_UNICAST == 1 || Z_FEATURE_LINK_UDP_MULTICAST == 1 -#define UDP_CONFIG_MAPPING_BUILD \ - _z_str_intmapping_t args[UDP_CONFIG_ARGC]; \ - args[0]._key = UDP_CONFIG_IFACE_KEY; \ - args[0]._str = UDP_CONFIG_IFACE_STR; \ - args[1]._key = UDP_CONFIG_TOUT_KEY; \ - args[1]._str = UDP_CONFIG_TOUT_STR; \ - args[2]._key = UDP_CONFIG_JOIN_KEY; \ - args[2]._str = UDP_CONFIG_JOIN_STR; +#define UDP_CONFIG_MAPPING_BUILD \ + _z_str_intmapping_t args[UDP_CONFIG_ARGC]; \ + args[0]._key = UDP_CONFIG_IFACE_KEY; \ + args[0]._str = (char *)UDP_CONFIG_IFACE_STR; \ + args[1]._key = UDP_CONFIG_TOUT_KEY; \ + args[1]._str = (char *)UDP_CONFIG_TOUT_STR; \ + args[2]._key = UDP_CONFIG_JOIN_KEY; \ + args[2]._str = (char *)UDP_CONFIG_JOIN_STR; size_t _z_udp_config_strlen(const _z_str_intmap_t *s); diff --git a/src/api/api.c b/src/api/api.c index c95ec26ab..95ba8fbea 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -502,19 +502,19 @@ int8_t z_scout(z_owned_scouting_config_t *config, z_owned_closure_hello_t *callb char *opt_as_str = _z_config_get(config->_value, Z_CONFIG_SCOUTING_WHAT_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_SCOUTING_WHAT_DEFAULT; + opt_as_str = (char *)Z_CONFIG_SCOUTING_WHAT_DEFAULT; } z_what_t what = strtol(opt_as_str, NULL, 10); opt_as_str = _z_config_get(config->_value, Z_CONFIG_MULTICAST_LOCATOR_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_MULTICAST_LOCATOR_DEFAULT; + opt_as_str = (char *)Z_CONFIG_MULTICAST_LOCATOR_DEFAULT; } char *mcast_locator = opt_as_str; opt_as_str = _z_config_get(config->_value, Z_CONFIG_SCOUTING_TIMEOUT_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_SCOUTING_TIMEOUT_DEFAULT; + opt_as_str = (char *)Z_CONFIG_SCOUTING_TIMEOUT_DEFAULT; } uint32_t timeout = strtoul(opt_as_str, NULL, 10); diff --git a/src/net/session.c b/src/net/session.c index 8925c962e..fd3d5997d 100644 --- a/src/net/session.c +++ b/src/net/session.c @@ -71,19 +71,19 @@ int8_t _z_open(_z_session_t *zn, _z_config_t *config) { if (connect == NULL && listen == NULL) { // Scout if peer is not configured opt_as_str = _z_config_get(config, Z_CONFIG_SCOUTING_WHAT_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_SCOUTING_WHAT_DEFAULT; + opt_as_str = (char *)Z_CONFIG_SCOUTING_WHAT_DEFAULT; } z_what_t what = strtol(opt_as_str, NULL, 10); opt_as_str = _z_config_get(config, Z_CONFIG_MULTICAST_LOCATOR_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_MULTICAST_LOCATOR_DEFAULT; + opt_as_str = (char *)Z_CONFIG_MULTICAST_LOCATOR_DEFAULT; } char *mcast_locator = opt_as_str; opt_as_str = _z_config_get(config, Z_CONFIG_SCOUTING_TIMEOUT_KEY); if (opt_as_str == NULL) { - opt_as_str = Z_CONFIG_SCOUTING_TIMEOUT_DEFAULT; + opt_as_str = (char *)Z_CONFIG_SCOUTING_TIMEOUT_DEFAULT; } uint32_t timeout = strtoul(opt_as_str, NULL, 10);