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

'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function)

I am trying to Compiling ‘ble_advertising.c’ and get 'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function).

This declaretion is already in the nrf_soc.h and i have set system include directories with path of the nrf_soc.h but still getting this error. Thank you.

Parents
  • Hi

    I see, you probably don't have to move to another SDK version, but if you had no reason to stay on the older version, I would suggest moving to a more recent one. 

    But is the sd_evt_get() anywhere else in your application? It should only be called from the interrupt. Please also include a snippet showing how you enable the SoftDevice.

    Can you provide the full log of when you try building the application? Also, what IDE are you using to compile and build this solution?

    Best regards,

    Simon

  • I am not sure what do you mean with enabling the softdevice.

    I copied the main.c of ble_app_butonnless_dfu into an other c file in my main project but changed the main function as ble_dfu_init function. I have added the libraries one by one according to that main.c file.

    Rebuilding ‘DWM1001_Tag’ from solution ‘DWM_1001_Tag’ in configuration ‘nrf52832_xxaa’
    1> Assembling ‘thumb_crt0.s’
    2> Compiling ‘system_nrf52.c’
    3> Assembling ‘ses_nrf52_startup.s’
    4> Compiling ‘main.c’
    5> Compiling ‘boards.c’
    6> Compiling ‘dwm_comm.c’
    7> Compiling ‘bsp.c’
    8> Compiling ‘bsp_nfc.c’
    1> Compiling ‘nrf_drv_gpiote.c’
    3> Compiling ‘nrf_drv_common.c’
    2> Compiling ‘nrf_drv_spi.c’
    5> Compiling ‘nrf_drv_uart.c’
    7> Compiling ‘nrf_drv_clock.c’
    8> Compiling ‘nrf_nvmc.c’
    4> Compiling ‘nrf_drv_timer.c’
    6> Compiling ‘nrf_drv_wdt.c’
    3> Compiling ‘nrf_drv_saadc.c’
    1> Compiling ‘nrf_drv_ppi.c’
    8> Compiling ‘nrf_drv_power.c’
    2> Compiling ‘nrf_section_iter.c’
    4> Compiling ‘app_button.c’
    6> Compiling ‘nrf_pwr_mgmt.c’
    7> Compiling ‘app_error.c’
    5> Compiling ‘app_error_weak.c’
    3> Compiling ‘app_scheduler.c’
    1> Compiling ‘app_util_platform.c’
    2> Compiling ‘nrf_assert.c’
    8> Compiling ‘nrf_balloc.c’
    4> Compiling ‘nrf_fprintf.c’
    7> Compiling ‘nrf_fprintf_format.c’
    3> Compiling ‘nrf_strerror.c’
    5> Compiling ‘nrf_memobj.c’
    1> Compiling ‘sdk_mapped_flags.c’
    2> Compiling ‘nrf_atfifo.c’
    6> Compiling ‘nrf_saadc.c’
    8> Compiling ‘fds.c’
    4> Compiling ‘nrf_fstorage_sd.c’
    7> Compiling ‘nrf_log_backend_rtt.c’
    3> Compiling ‘nrf_log_backend_serial.c’
    5> Compiling ‘nrf_log_backend_uart.c’
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:208:12: warning: implicit declaration of function 'sd_flash_write' [-Wimplicit-function-declaration]
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:215:12: warning: implicit declaration of function 'sd_flash_page_erase' [-Wimplicit-function-declaration]
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:275:46: error: 'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function)
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:275:46: note: each undeclared identifier is reported only once for each function it appears in
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:523:22: error: 'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function)
    6> Compiling ‘nrf_log_default_backends.c’
    1> Compiling ‘nrf_log_str_formatter.c’
    2> Compiling ‘nrf_log_frontend.c’
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:527:22: error: 'NRF_EVT_FLASH_OPERATION_ERROR' undeclared (first use in this function)
    Build failed

Reply
  • I am not sure what do you mean with enabling the softdevice.

    I copied the main.c of ble_app_butonnless_dfu into an other c file in my main project but changed the main function as ble_dfu_init function. I have added the libraries one by one according to that main.c file.

    Rebuilding ‘DWM1001_Tag’ from solution ‘DWM_1001_Tag’ in configuration ‘nrf52832_xxaa’
    1> Assembling ‘thumb_crt0.s’
    2> Compiling ‘system_nrf52.c’
    3> Assembling ‘ses_nrf52_startup.s’
    4> Compiling ‘main.c’
    5> Compiling ‘boards.c’
    6> Compiling ‘dwm_comm.c’
    7> Compiling ‘bsp.c’
    8> Compiling ‘bsp_nfc.c’
    1> Compiling ‘nrf_drv_gpiote.c’
    3> Compiling ‘nrf_drv_common.c’
    2> Compiling ‘nrf_drv_spi.c’
    5> Compiling ‘nrf_drv_uart.c’
    7> Compiling ‘nrf_drv_clock.c’
    8> Compiling ‘nrf_nvmc.c’
    4> Compiling ‘nrf_drv_timer.c’
    6> Compiling ‘nrf_drv_wdt.c’
    3> Compiling ‘nrf_drv_saadc.c’
    1> Compiling ‘nrf_drv_ppi.c’
    8> Compiling ‘nrf_drv_power.c’
    2> Compiling ‘nrf_section_iter.c’
    4> Compiling ‘app_button.c’
    6> Compiling ‘nrf_pwr_mgmt.c’
    7> Compiling ‘app_error.c’
    5> Compiling ‘app_error_weak.c’
    3> Compiling ‘app_scheduler.c’
    1> Compiling ‘app_util_platform.c’
    2> Compiling ‘nrf_assert.c’
    8> Compiling ‘nrf_balloc.c’
    4> Compiling ‘nrf_fprintf.c’
    7> Compiling ‘nrf_fprintf_format.c’
    3> Compiling ‘nrf_strerror.c’
    5> Compiling ‘nrf_memobj.c’
    1> Compiling ‘sdk_mapped_flags.c’
    2> Compiling ‘nrf_atfifo.c’
    6> Compiling ‘nrf_saadc.c’
    8> Compiling ‘fds.c’
    4> Compiling ‘nrf_fstorage_sd.c’
    7> Compiling ‘nrf_log_backend_rtt.c’
    3> Compiling ‘nrf_log_backend_serial.c’
    5> Compiling ‘nrf_log_backend_uart.c’
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:208:12: warning: implicit declaration of function 'sd_flash_write' [-Wimplicit-function-declaration]
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:215:12: warning: implicit declaration of function 'sd_flash_page_erase' [-Wimplicit-function-declaration]
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:275:46: error: 'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function)
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:275:46: note: each undeclared identifier is reported only once for each function it appears in
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:523:22: error: 'NRF_EVT_FLASH_OPERATION_SUCCESS' undeclared (first use in this function)
    6> Compiling ‘nrf_log_default_backends.c’
    1> Compiling ‘nrf_log_str_formatter.c’
    2> Compiling ‘nrf_log_frontend.c’
    4> C:/nRF5_SDK_14.2.0_17b948a/components/libraries/fstorage/nrf_fstorage_sd.c:527:22: error: 'NRF_EVT_FLASH_OPERATION_ERROR' undeclared (first use in this function)
    Build failed

Children
  • Hi

    It seems like the ser_app_hal_nrf5x.c containing the declaration of the sd_flash_write() and sd_flash_page_erase() functions is not included in your project. can you please add this file t and its dependencies to the project as well? Should be found in the following path: \SDK_folder\components\serialization\application\hal

    Best regards,

    Simon

  • I could not compile that file either. SD_EVT_IRQn is also declared in nrf_soc.h

    I also added my sdk_config.h file

    2806.sdk_config.h

    Building ‘ser_app_hal_nrf5x.c’ from project ‘DWM1001_Tag’ from solution ‘DWM_1001_Tag’ in configuration ‘nrf52832_xxaa’
    1> Compiling ‘ser_app_hal_nrf5x.c’
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:52:33: error: 'SD_EVT_IRQn' undeclared (first use in this function); did you mean 'QDEC_IRQn'?
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:93:22: note: in expansion of macro 'SOFTDEVICE_EVT_IRQ'
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:52:33: note: each undeclared identifier is reported only once for each function it appears in
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:93:22: note: in expansion of macro 'SOFTDEVICE_EVT_IRQ'
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:52:33: error: 'SD_EVT_IRQn' undeclared (first use in this function); did you mean 'QDEC_IRQn'?
    1> C:/nRF5_SDK_14.2.0_17b948a/components/serialization/application/hal/ser_app_hal_nrf5x.c:98:24: note: in expansion of macro 'SOFTDEVICE_EVT_IRQ'
    Build failed

  • And the project still fails to build? Have you added the C:\nRF5_SDK_14.2.0_17b948a\components\softdevice\s132\headers path to the user include directories in your  project options? Please note that you need to set the project options in the Common configuration to edit the User Include Directories, etc. See picture for reference:

    Best regards,

    Simon

Related