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 Reply Children
  • Edvin said:
    what example are you trying to compile?

     By "This is just my project, but the compilation for the SDK file fails", I believe that you are creating a custom file, is that right?

    As the compiler says, you are missing a bunch of declarations. Are they included in your project? It is typically a missing file, or a define that is not set correctly, so that the declarations are skipped. E.g.:

    #ifdef NRF52840
    #define A_BUNCH_OF_VARIABLES
    #endif

    Can you try to add the define BOARD_PCA10056 to your preprocessor defines?

    I see that the NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk (and the other defines that are not present) are only used if HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND is not defined. HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND is defined is BOARD_PCA10056 is defined. If you are not using the nRF52840DK, and hence don't have the define BOARD_PCA10056, you must then define HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND in your preprocessor defines.

    BR,

    Edvin

  • Hi Edvin,

     By "This is just my project, but the compilation for the SDK file fails", I believe that you are creating a custom file, is that right?

    Yes, I am compiling a custom project, not an example. Although, given the command line, it should not matter, as it should be the same for any project that uses NFC in the nRF52840... unless I am missing something.

    The command line should tell you what I am using and should allow you to identify what is missing.

    I did my little investigation about what is missing after the first block, so that you can tell me why this happens.

    As the compiler says, you are missing a bunch of declarations. Are they included in your project?

    If you look at what I put after the compiler errors, you can see why those are missing. They are defined for nRF52832, but they appear not to be defined for nRF52840.

    I see that the NFCT_ERRORSTATUS_NFCFIELDTOOSTRONG_Msk (and the other defines that are not present) are only used if HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND is not defined. HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND is defined is BOARD_PCA10056 is defined. If you are not using the nRF52840DK, and hence don't have the define BOARD_PCA10056, you must then define HAL_NFC_NRF52840_ENGINEERING_ABC_WORKAROUND in your preprocessor defines.

    OK, that seems to be the define that I am missing.

    If you are saying that that define is just done inside the #ifdef BOARD_PCA10056 clause for the boards.h, then it seems clear why I am missing it, as I was assuming that that define should not be in that file at all, but either in the Makefile instead.

    I thought that boards.h and custom_board.h only have GPIO define aliases to have the same firmware working across different pcb hardware versions.

    Anyway... I'll check all that now and retry.

    I wonder, why the grep did not find those in any other file though...

Related