Browse Source

suppress error with net example

hathach 3 years ago
parent
commit
9c56f70111

+ 2 - 0
examples/device/net_lwip_webserver/CMakeLists.txt

@@ -76,6 +76,8 @@ if (EXISTS ${TOP}/lib/lwip/src)
     target_compile_options(${PROJECT} PUBLIC
         -Wno-error=null-dereference
         -Wno-error=conversion
+        -Wno-error=sign-conversion
+        -Wno-error=sign-compare
         )
 
     # Configure compilation flags and libraries for the example... see the corresponding function

+ 2 - 1
examples/make.mk

@@ -113,7 +113,8 @@ CFLAGS += \
   -Wunused \
   -Wredundant-decls
 
-#  -Wconversion \
+# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
+#  -Wconversion
   
 # Debugging/Optimization
 ifeq ($(DEBUG), 1)

+ 3 - 3
src/class/net/ecm_rndis_device.c

@@ -318,11 +318,11 @@ bool netd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t
             rndis_generic_msg_t *rndis_msg = (rndis_generic_msg_t *) ((void*) notify.rndis_buf);
             uint32_t msglen = tu_le32toh(rndis_msg->MessageLength);
             TU_ASSERT(msglen <= sizeof(notify.rndis_buf));
-            tud_control_xfer(rhport, request, notify.rndis_buf, msglen);
+            tud_control_xfer(rhport, request, notify.rndis_buf, (uint16_t) msglen);
           }
           else
           {
-            tud_control_xfer(rhport, request, notify.rndis_buf, sizeof(notify.rndis_buf));
+            tud_control_xfer(rhport, request, notify.rndis_buf, (uint16_t) sizeof(notify.rndis_buf));
           }
         }
       break;
@@ -369,7 +369,7 @@ static void handle_incoming_packet(uint32_t len)
         }
   }
 
-  if (!tud_network_recv_cb(pnt, size))
+  if (!tud_network_recv_cb(pnt, (uint16_t) size))
   {
     /* if a buffer was never handled by user code, we must renew on the user's behalf */
     tud_network_recv_renew();