Trying to build nrf52-ble-image-transfer-demo project in Keil but getting build errors

Hello,

I am trying to the build the following demo from github on Keil:

https://github.com/NordicPlayground/nrf52-ble-image-transfer-demo

I am using Keil uVision V5 MDK-Lite with default compiler V6 along with nRF5SDK160098a08e2 and s132nrf52701 softdevice

I managed to get the softdevice, Nordic Packages, etc. setup properly (I think!)

I flashed (loaded) the s132_nrf52_7.0.1_softdevice.hex to the nRF52 DK nRF52832 eval boards

I get the following build errors:

Build started: Project: image_transfer_demo_pca10040_s132
*** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
*** Warning: You are compiling one or more files of source type C++ and have selected 'use MicroLIB'. MicroLIB does not support C++!

Build target 'nrf52832_xxaa'
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp.c'
ArmClang: error: no input files
compiling bsp.c...
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp_btn_ble.c'
ArmClang: error: no input files
compiling bsp_btn_ble.c...
RTE/Device/nRF52832_xxAA/system_nrf52.c(30): error: 'nrf52_erratas.h' file not found
#include "nrf52_erratas.h"
^~~~~~~~~~~~~~~~~
1 error generated.
compiling system_nrf52.c...
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(45): error: expected '(' after 'asm'
__ASM void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
^
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(45): error: expected ';' after top-level asm block
__ASM void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
^
;
C:/Nordic/sdk/nRF5SDK160098a08e2/components/libraries/util/app_error_handler_keil.c(47): error: use of undeclared identifier 'PRESERVE8'
PRESERVE8 {TRUE}
^
3 errors generated.
compiling app_error_handler_keil.c...
".\_build\nrf52832_xxaa.axf" - 8 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:01

For the 

ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp.c'
ArmClang: error: no input files
compiling bsp.c...
ArmClang: error: no such file or directory: '../../../../../../components/libraries/bsp/bsp_btn_ble.c'
ArmClang: error: no input files

errors: I did make sure the both C/C++ and ASM Include Paths point to the SDK I downloaded but I still get these errors.

Please advise. 

Thanks,

Adnan

Parents Reply Children
  • Hello Torbjorn,

    Thank you for the follow up. I took your advise and switched to Segger Embedded Studio over the weekend. I managed to get the project setup and had to modify the common include paths and paths in the .emProject file but now the project compiles and am able to download it onto the nRF52 DK eval board. So thank you for your guidance on this issue.

    The issue I am now having is that I get the following error on the J-Link RTT Viewer:

    00> <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at C:\Nordic\sdk\nRF5SDK160098a08e2\examples\nrf52-ble-image-transfer-demo-master_segger\main.c:463
    00> PC at: 0x0002786D
    00> <error> app: End of error report

    The line number points to the following function:

    /**@brief Function for the SoftDevice initialization.
    *
    * @details This function initializes the SoftDevice and the BLE event interrupt.
    */
    static void ble_stack_init(void)
    {
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&ram_start);
    APP_ERROR_CHECK(err_code);

    // Register a handler for BLE events.
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);
    }

    I am wondering if the SoftDevice needs to be configured as I have not done anything with respect to that? Or maybe I need to configure anything else?

    Please advise and thanks!

    Adnan

  • Hi Adnan

    Do you get the same error if you press the reset button on the DK?

    What if you start a debug session in Segger Embedded Studio (SES), does this work?

    If either of those fix the issue then this is a known inconsistency in SES. When you flash the application to the board the debugger will not perform a full reset, instead it will simply start program execution at the application start address. The problem with this is that it bypasses the reset handler of the SoftDevice, which means the SoftDevice will not be reset but will remain running in the background. When the application then runs it will try to enable the SoftDevice for the second time, which causes it to return the invalid state error. 

    There is no good workaround to this other than to press the reset button on the DK after programming the board. 

    Best regards
    Torbjørn

  • Hello Torbjorn,

    Please note that I am able to compile and download to the board. Also it does enter into the Main loop function.

    Pressing the RESET button on the DK board does not solve the issue. I have verified all the SoftDevice settings and configurations and look up to spec.

    I was wondering if the following can be an issue:

    I have used VS Code to compile and flash this same board. Is it possible that that is the issue?

    Is there a way to clean out the Zephyr stuff and load the older Segger code + firmware? Also vice-versa, remove Segger code base and install Zephyr code base?

    Please advise.

    Thanks,

    Adnan

  • Hello Torbjorn,

    Just an update: When I am in debug mode, the issue of nrf_sdh_enable_request failing seems to go away and the RESET button still doesn't help in normal run mode.

    Also now the ArduCAM SPI bus check keeps failing:

    while(1){
    //Check if the ArduCAM SPI bus is OK
    arducam_write_reg(ARDUCHIP_TEST1, 0x55);
    temp = arducam_read_reg(ARDUCHIP_TEST1);
    if (temp != 0x55){
    //Serial.println(F("ACK CMD SPI interface Error! END"));
    nrf_delay_ms(1000);
    continue;
    }else{
    //Serial.println(F("ACK CMD SPI interface OK. END"));break;
    }
    }

    It never returns 0x55. Can it be that both these issues are linked? Maybe something is going on with the SoftDevice. I am using S132 V7.0.1 as recommended by you.

    Please advise.

    Thanks,

    Adnan

  • Hi Adnan

    What does the read_reg function return then? 
    Could you check the value of the temp variable in the debugger?

    Are you sure that the Arducam is properly connected to the DK?
    Maybe you could share a picture of your setup?

    Best regards
    Torbjørn

Related