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

When compiling NFC for nRF52840 with SDK 15.0.0, there are compiler errors.

When building a project that compiles the hal_nfc_t2t.c, it errors for nRF52840, but works for nRF52832.

For the nRF52840, I get these errors:

Compiling file: hal_nfc_t2t.c
'/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc' -std=c99 -MP -MD -c -o _debug/myproject/hal_nfc_t2t.c.o ../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c -O3 -g3 (...private-defines...) -DDEBUG_NRF -DUSE_APP_CONFIG -DBLE_STACK_SUPPORT_REQD -DBOARD_CUSTOM -DBOARD_MTN00003 -DBSP_DEFINES_ONLY -DBUTTONLESS_DFU -DCONFIG_GPIO_AS_PINRESET -DNRF52 -DNRF52_SERIES -DNRF_SD_BLE_API_VERSION=6 -DNRF52840_XXAA -DS140 -DBLE_ROM_SIZE=0x026000 -D__HEAP_SIZE=0 -D__STACK_SIZE=6000 -DSOFTDEVICE_PRESENT -DSWI_DISABLE0 -mcpu=cortex-m4 -mthumb -mabi=aapcs -Wno-missing-braces -Wall -Werror -mfloat-abi=hard -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin -fshort-enums  (...per-build-config-defines...) -I. -I../nRF5_SDK_15.0.0_a53641a/components/ble/ble_db_discovery -I../nRF5_SDK_15.0.0_a53641a/components/ble/common -I../nRF5_SDK_15.0.0_a53641a/components/ble/nrf_ble_gatt -I../nRF5_SDK_15.0.0_a53641a/components/ble/peer_manager -I../nRF5_SDK_15.0.0_a53641a/components/boards -I../nRF5_SDK_15.0.0_a53641a/components/libraries/atomic -I../nRF5_SDK_15.0.0_a53641a/components/libraries/atomic_fifo -I../nRF5_SDK_15.0.0_a53641a/components/libraries/atomic_flags -I../nRF5_SDK_15.0.0_a53641a/components/libraries/balloc -I../nRF5_SDK_15.0.0_a53641a/components/libraries/cli -I../nRF5_SDK_15.0.0_a53641a/components/libraries/cli/rtt -I../nRF5_SDK_15.0.0_a53641a/components/libraries/cli/uart -I../nRF5_SDK_15.0.0_a53641a/components/libraries/crc16 -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log/src -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_memobj -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_ringbuf -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_section_vars -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_task_manager -I../nRF5_SDK_15.0.0_a53641a/components/libraries/fds -I../nRF5_SDK_15.0.0_a53641a/components/libraries/fstorage -I../nRF5_SDK_15.0.0_a53641a/components/libraries/gpiote -I../nRF5_SDK_15.0.0_a53641a/components/libraries/pwr_mgmt -I../nRF5_SDK_15.0.0_a53641a/components/libraries/queue -I../nRF5_SDK_15.0.0_a53641a/components/libraries/scheduler -I../nRF5_SDK_15.0.0_a53641a/components/libraries/strerror -I../nRF5_SDK_15.0.0_a53641a/components/libraries/timer -I../nRF5_SDK_15.0.0_a53641a/components/libraries/util -I../nRF5_SDK_15.0.0_a53641a/components/nfc/ndef/generic/message -I../nRF5_SDK_15.0.0_a53641a/components/nfc/ndef/generic/record -I../nRF5_SDK_15.0.0_a53641a/components/nfc/ndef/uri -I../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t -I../nRF5_SDK_15.0.0_a53641a/components/softdevice/common -I../nRF5_SDK_15.0.0_a53641a/external/fnmatch -I../nRF5_SDK_15.0.0_a53641a/external/fprintf -I../nRF5_SDK_15.0.0_a53641a/external/segger_rtt -I../nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx/hal -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk (...private-includes...) -I../nRF5_SDK_15.0.0_a53641a/components/toolchain/cmsis/include -I../nRF5_SDK_15.0.0_a53641a/components -I../nRF5_SDK_15.0.0_a53641a/components/ble/ble_advertising -I../nRF5_SDK_15.0.0_a53641a/external/mbedtls/include -I../nRF5_SDK_15.0.0_a53641a/external/nrf_oberon -I../nRF5_SDK_15.0.0_a53641a/external/nrf_oberon/include -I../nRF5_SDK_15.0.0_a53641a/components/libraries/stack_info -I../nRF5_SDK_15.0.0_a53641a/components/boards -I../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib -I../nRF5_SDK_15.0.0_a53641a/components/softdevice/s140/headers -I../nRF5_SDK_15.0.0_a53641a/components/softdevice/s140/headers/nrf52 -I../nRF5_SDK_15.0.0_a53641a/components/libraries/delay -I../nRF5_SDK_15.0.0_a53641a/components/libraries/experimental_log -I../nRF5_SDK_15.0.0_a53641a/integration/nrfx -I../nRF5_SDK_15.0.0_a53641a/integration/nrfx/legacy -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx/hal -I../nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/include
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c: In function 'hal_nfc_start':
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: error: 'NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk' undeclared (first use in this function)
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: note: in definition of macro 'NRF_NFCT_ERRORSTATUS_ALL'
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: note: each undeclared identifier is reported only once for each function it appears in
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: note: in definition of macro 'NRF_NFCT_ERRORSTATUS_ALL'
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:132:41: error: 'NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk' undeclared (first use in this function)
                                         NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk  | \
                                         ^
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:132:41: note: in definition of macro 'NRF_NFCT_ERRORSTATUS_ALL'
                                         NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk  | \
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c: In function 'NFCT_IRQHandler':
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: error: 'NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk' undeclared (first use in this function)
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:42: note: in definition of macro 'NRF_NFCT_ERRORSTATUS_ALL'
     #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:132:41: error: 'NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk' undeclared (first use in this function)
                                         NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk  | \
                                         ^
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:132:41: note: in definition of macro 'NRF_NFCT_ERRORSTATUS_ALL'
                                         NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk  | \
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [../nRF5_SDK_15.0.0_a53641a/components/toolchain/gcc/Makefile.common:272: _debug/myproject/hal_nfc_t2t.c.o] Error 1

Looking for some of the missing masks, I get that they are defined in nrf52_bitfields.h:

$ grep -nrEe 'NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk' ../nRF5_SDK_15.0.0_a53641a/components/
../nRF5_SDK_15.0.0_a53641a/components/nfc/t4t_lib/hal_t4t/hal_nfc_t4t.c:153:    #define NRF_NFCT_ERRORSTATUS_ALL (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \
../nRF5_SDK_15.0.0_a53641a/components/nfc/t2t_lib/hal_t2t/hal_nfc_t2t.c:131:    #define NRF_NFCT_ERRORSTATUS_ALL    (NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk   | \

$ grep -nrEe 'NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk' ../nRF5_SDK_15.0.0_a53641a/modules/
../nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk/nrf52_bitfields.h:4480:#define NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Msk (0x1UL << NFCT_ERRORSTATUS_NFCFIELDTOOWEAK_Pos) /*!< Bit mask of NFCFIELDTOOWEAK field. */

But that is not included for nRF52840 by ../nRF5_SDK_15.0.0_a53641a/modules/nrfx/mdk/nrf.h:

...
     78     #elif defined (NRF52840_XXAA)
     79         #include "nrf52840.h"
     80         #include "nrf52840_bitfields.h"
     81         #include "nrf51_to_nrf52840.h"
     82         #include "nrf52_to_nrf52840.h"
     83     #elif defined (NRF52832_XXAA) || defined (NRF52832_XXAB)
     84         #include "nrf52.h"
     85         #include "nrf52_bitfields.h"
     86         #include "nrf51_to_nrf52.h"
     87         #include "nrf52_name_change.h"
 ...

Is this a bug in the mdk for nRF52840, or am I missing something?

Parents
  • I agree that it is a bit confusing, but it looks like the defines that are not included is only intended for the nrf52832 (and hence in the nrf52_bitfields.h), and they are not intended for the nrf52840. When you use the nRF52840 you should have the HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND defined.

    I could agree that this should not be defined if and only if BOARD_PCA10056 is defined.

    It should rather have been dependent on the define NRF52840_XXAA:

    #ifdef NRF52840_XXAA
        #define HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND
    #endif

    Best regards,

    Edvin

Reply
  • I agree that it is a bit confusing, but it looks like the defines that are not included is only intended for the nrf52832 (and hence in the nrf52_bitfields.h), and they are not intended for the nrf52840. When you use the nRF52840 you should have the HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND defined.

    I could agree that this should not be defined if and only if BOARD_PCA10056 is defined.

    It should rather have been dependent on the define NRF52840_XXAA:

    #ifdef NRF52840_XXAA
        #define HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND
    #endif

    Best regards,

    Edvin

Children
Related