This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_drv_saadc.c doesn't compile with gcc, SDK 13.0.0. EVT_TO_STR() compares nrf_saadc_limit_t to enum.

Hi. I don't understand how to build nrf_drv_saadc.c with gcc. I'm getting this error in the EVT_TO_STR() macro:

Compiling file: nrf_drv_saadc.c
In file included from /Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/nrf_log.h:97:0,
                 from /Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c:65:
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c: In function 'SAADC_IRQHandler':
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c:53:36: error: comparison between 'nrf_saadc_limit_t' and 'enum <anonymous>' [-Werror=enum-compare]
 #define EVT_TO_STR(event)   (event == NRF_SAADC_EVENT_STARTED ? "NRF_SAADC_EVENT_STARTED" :                         \
                                    ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/src/nrf_log_internal.h:106:52: note: in definition of macro 'LOG_INTERNAL_2'
     nrf_log_frontend_std_2(type, prefix str, arg0, arg1)
                                                    ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/src/nrf_log_internal.h:117:41: note: in expansion of macro 'LOG_INTERNAL_X'
 #define LOG_INTERNAL(type, prefix, ...) LOG_INTERNAL_X(NUM_VA_ARGS_LESS_1( \
                                         ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/src/nrf_log_internal.h:185:9: note: in expansion of macro 'LOG_INTERNAL'
         LOG_INTERNAL(NRF_LOG_LEVEL_DEBUG, LOG_DEBUG_PREFIX, __VA_ARGS__); \
         ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/libraries/log/nrf_log.h:130:48: note: in expansion of macro 'NRF_LOG_INTERNAL_DEBUG'
 #define NRF_LOG_DEBUG(...)                     NRF_LOG_INTERNAL_DEBUG( __VA_ARGS__)
                                                ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c:214:17: note: in expansion of macro 'NRF_LOG_DEBUG'
                 NRF_LOG_DEBUG("Event limit, channel: %d, limit type: %s.\r\n", evt.data.limit.channel, (uint32_t)EVT_TO_STR(evt.data.limit.limit_type));
                 ^
/Users/eliot/dev/nRF5_SDK_13.0.0_04a0bfd/components/drivers_nrf/saadc/nrf_drv_saadc.c:214:114: note: in expansion of macro 'EVT_TO_STR'
                 NRF_LOG_DEBUG("Event limit, channel: %d, limit type: %s.\r\n", evt.data.limit.channel, (uint32_t)EVT_TO_STR(evt.data.limit.limit_type));

I guess it could be my CFLAGS to blame, but I can't easily compare to what the SDK does, because there's no gcc Makefile for the saadc example project.

[edit]

Here's my project's Makefile:

Makefile

Parents Reply Children
No Data
Related