Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

NRF5 SDK v17.1.0_ddde560: Multiple fixes for SDK compile errors

Fixes nRF5_SDK/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm_internal.h:68:6: error: use of enum 'app_usbd_cdc_acm_user_event_e' without previous declaration

(note: need to move #include acm_internal.h and struct cdc_acm_t below enum user_event_e)

--- nRF5_SDK_17.1.0_ddde560/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm.h    2021-08-21 16:20:04.000000000 +0800
+++ nRF5_SDK_17.1.0_ddde560/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm.h    2021-12-02 17:26:19.088490174 +0800
@@ -55,7 +55,6 @@
 
 #include "app_usbd_cdc_desc.h"
 #include "app_usbd_cdc_types.h"
-#include "app_usbd_cdc_acm_internal.h"
 
 /**
  * @defgroup app_usbd_cdc_acm USB CDC ACM class
@@ -72,24 +71,6 @@
  * @{
  */
 
-#ifdef DOXYGEN
-/**
- * @brief CDC ACM class instance type.
- *
- * @ref APP_USBD_CLASS_TYPEDEF
- */
-typedef struct { } app_usbd_cdc_acm_t;
-#else
-/*lint -save -e10 -e26 -e123 -e505 */
-APP_USBD_CLASS_TYPEDEF(app_usbd_cdc_acm,            \
-            APP_USBD_CDC_ACM_CONFIG(0, 0, 0, 0, 0), \
-            APP_USBD_CDC_ACM_INSTANCE_SPECIFIC_DEC, \
-            APP_USBD_CDC_ACM_DATA_SPECIFIC_DEC      \
-);
-/*lint -restore*/
-#endif
-
-
 /*lint -save -e407 */
 
 /**
@@ -112,6 +93,25 @@
 
 /*lint -restore*/
 
+#include "app_usbd_cdc_acm_internal.h"
+
+#ifdef DOXYGEN
+/**
+ * @brief CDC ACM class instance type.
+ *
+ * @ref APP_USBD_CLASS_TYPEDEF
+ */
+typedef struct { } app_usbd_cdc_acm_t;
+#else
+/*lint -save -e10 -e26 -e123 -e505 */
+APP_USBD_CLASS_TYPEDEF(app_usbd_cdc_acm,            \
+APP_USBD_CDC_ACM_CONFIG(0, 0, 0, 0, 0), \
+APP_USBD_CDC_ACM_INSTANCE_SPECIFIC_DEC, \
+APP_USBD_CDC_ACM_DATA_SPECIFIC_DEC      \
+);
+/*lint -restore*/
+#endif
+
 /**
  * @brief Default CDC ACM descriptors.
  *

Fixes nRF5_SDK/components/libraries/usbd/app_usbd_class_base.h:815:5: error: designator order for field 'app_usbd_cdc_acm_inst_t::comm_interface' does not match declaration order in 'app_usbd_cdc_acm_inst_t'

(note: as error notes, just some field reordering to match the struct definition)

--- nRF5_SDK_17.1.0_ddde560/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm_internal.h    2021-08-21 16:20:04.000000000 +0800
+++ nRF5_SDK_17.1.0_ddde560/components/libraries/usbd/class/cdc/acm/app_usbd_cdc_acm_internal.h    2021-12-02 17:33:17.233994390 +0800
@@ -199,13 +199,13 @@
                                      cdc_protocol,                                               \
                                      ep_list)                                                    \
         .inst = {                                                                                \
-                .user_ev_handler = user_event_handler,                                           \
                 .comm_interface  = comm_ifc,                                                     \
                 .comm_epin       = comm_ifc,                                                     \
                 .data_interface  = data_ifc,                                                     \
-                .data_epin       = data_ein,                                                     \
                 .data_epout      = data_eout,                                                    \
+                .data_epin       = data_ein,                                                     \
                 .protocol        = cdc_protocol,                                                 \
+                .user_ev_handler = user_event_handler,                                           \
                 .p_ep_interval   = ep_list                                                       \
         }

Fix build_all.sh: line 2: $'\r': command not found and build_all.sh: line 25: syntax error: unexpected end of file

Diff doesn't look too helpful, need to change line endings to UNIX (\n) rather than windows (\r\n) format

Parents Reply
  • gcc 11.2.1

    I'm working with others that are using segger, and it's astonishing how many code faults it offers no warnings or errors for - including dire faults like dereferencing uninitialized pointers that can be spotted at compile time, unhandled enum elements in switch case, or ambiguous else statements due to the lack of do { … } while (0) around the NRF_LOG_INTERNAL_MODULE macro - perhaps I should send y'all a patch for that too at some point.

    The fixes are easy, and shouldn't make segger complain any more than it is now ;)

Children
Related