DFU Bootloader compile error

I am using 52840 and SDK V14.2.0. When compiling nrf_ble_dfu.c I see the following error in nrf_dfu_types.h: line 258

 "two or more data types in declaration specifiers."

The offending lines:

/**@brief DFU progress.
*
* Be aware of the difference between objects and firmware images. A firmware image consists of multiple objects, each of a maximum size @ref DATA_OBJECT_MAX_SIZE.
*
* @note The union inside this struct is cleared when CREATE_OBJECT of command type is executed, and when there is a valid post-validation.
* In DFU activation (after reset) the @ref sd_start_address will be used in case of a SD/SD+BL update.
*/
ANON_UNIONS_ENABLE
typedef struct

The SEGGER IDE displays a red X in front of "typedef struct" above.

I have a feeling it has something to do with ANON_UNIONS_ENABLE define which in my case is found in app_util_platform.h:

/**@brief Macro to enable anonymous unions from a certain point in the code.
*/
#if defined(__CC_ARM)
#define ANON_UNIONS_ENABLE _Pragma("push") \
_Pragma("anon_unions") \
struct semicolon_swallower
#elif defined(__ICCARM__)
#define ANON_UNIONS_ENABLE _Pragma("language=extended") \
struct semicolon_swallower
#else
#define ANON_UNIONS_ENABLE struct semicolon_swallower    <<<< This is what gets defined.
// No action will be taken.
// For GCC anonymous unions are enabled by default.
#endif

I have not been able to find out why this error happens.

  • Hi,

    I have not been able to reproduce this. Which version of Segger Embedded Studio are you using? (nRF5 SDK 14.2 was release tested with version 3.30). Are you able to build the unmodified example bootloader projects?

    PS: The first SDK version with full support for the nRF52840 was 15.0.0 (before that the support was experimental), so I would not recommend using SDK 14.2 for production if you are using a nRF52840 device.

Related