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

Bus Fault while running crytpo sample examples on nRF5340 DK

Hi,

I tried running the crypto sample example as part of the nRF SDK project on my nRF5340 DK.

I successfully completed as few tests and then fails while trying to run the AES ECB MAC test suite.

It throws a BUS FAULT at BFAR Address: 0x50008158. The entire log is attached here.

Is anyone else facing the same problem, Ive used the project as it was in an unmodified state.

384: ChaChaPoly Invalid nonce_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:124]

385: ChaChaPoly message_len=114 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:86]

386: ChaChaPoly message_len=265 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:51]

Test suite AEAD CHACHAPOLY succeeded

Running test suite AEAD CHACHAPOLY simple

387: ChaChaPoly Decrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:218]

388: ChaChaPoly Encrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:199]

389: ChaChaPoly Decrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:180]

390: ChaChaPoly Encrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:161]

391: ChaChaPoly Valid ad_len=0 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:106]

Test suite AEAD CHACHAPOLY simple succeeded

Running test suite AES ECB MAC

392: CMAC 256 message_len=64 -- [00152177] <err> os: Exception occurred in Secure State

[00152338] <err> os: ***** HARD FAULT *****

[00152467] <err> os:   Fault escalation (see below)

[00152619] <err> os: ***** BUS FAULT *****

[00152745] <err> os:   Precise data bus error

[00152880] <err> os:   BFAR Address: 0x50008158

[00153021] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000004  r2/a3:  0x0006f37c

[00153253] <err> os: r3/a4:  0x2000ff10 r12/ip:  0x00000000 r14/lr:  0x00025ca9

[00153485] <err> os:  xpsr:  0x61000000

[00153602] <err> os: Faulting instruction address (r15/pc): 0x00027008

[00153809] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0

[00154012] <err> os: Current thread: 0x2000a438 (unknown)

[00154181] <err> os: Halting system


CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyACM2                                                                                                                                  

Regards,

Bosco Jacinto

Parents
  • Hello, Bosco!

    Based on your earlier cases I assume that your are building for the non-secure partition of the nRF5340(nrf5340dk_nrf5340_cpuappns as target). Correct? This test sample requires the CryptoCell peripheral by default, which is not accessible from the non-secure domain. That may be the origin of the issue you're seeing here.

    Best regards,
    Carl Richard

  • Hi Carl,

    Thanks for your quick response. Sorry I dint mention the target, yes was building for nrf5340dk_nrf5340_cpuappns.

    Ok so I do need to build for nrf5340dk_nrf5340_cpuapp ?

    I did try with target nrf5340dk_nrf5340_cpuapp, I got a null pointer exception this time at the same AES ECB MAC test suite.

    387: state_reset -- PASS -- [../src/main.c:48]
    
    388: ChaChaPoly Invalid mac_len=15 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:142]
    
    389: ChaChaPoly Invalid nonce_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:124]
    
    390: ChaChaPoly message_len=114 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:86]
    
    391: ChaChaPoly message_len=265 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:51]
    
    Test suite AEAD CHACHAPOLY succeeded
    
    Running test suite AEAD CHACHAPOLY simple
    
    392: state_reset -- PASS -- [../src/main.c:48]
    
    393: ChaChaPoly Decrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:218]
    
    394: ChaChaPoly Encrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:199]
    
    395: ChaChaPoly Decrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:180]
    
    396: ChaChaPoly Encrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:161]
    
    397: ChaChaPoly Valid ad_len=0 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:106]
    
    Test suite AEAD CHACHAPOLY simple succeeded
    
    Running test suite AES ECB MAC
    
    398: state_reset -- PASS -- [../src/main.c:48]
    
    399: CMAC 256 message_len=64 -- [00214230] <err> os: ***** Debug monitor exception *****
    
    Null-pointer exception?
    
    [00214466] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000004  r2/a3:  0x00063734
    
    [00214698] <err> os: r3/a4:  0x000000a0 r12/ip:  0x00000000 r14/lr:  0x0000d621
    
    [00214931] <err> os:  xpsr:  0x61000000
    
    [00215048] <err> os: Faulting instruction address (r15/pc): 0x0000eace
    
    [00215255] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    
    [00215459] <err> os: Current thread: 0x200002d8 (unknown)
    
    [00215628] <err> os: Halting system
    

    The following is the call stack, am not sure if the resolution of this picture is ok

    The following is the project config

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # TEST
    CONFIG_ZTEST=y
    CONFIG_ZTEST_FAIL_FAST=y
    CONFIG_ZTEST_STACKSIZE=4096
    CONFIG_MAIN_STACK_SIZE=8192
    CONFIG_ZTEST_TC_UTIL_USER_OVERRIDE=y
    
    # LOG
    CONFIG_TEST_LOGGING_DEFAULTS=n
    CONFIG_LOG=y
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_BACKEND_SHOW_COLOR=n
    CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n
    
    # MISC
    CONFIG_DK_LIBRARY=y
    CONFIG_SPEED_OPTIMIZATIONS=y
    
    # CRYPTO
    CONFIG_NORDIC_SECURITY_BACKEND=y
    CONFIG_NRF_SECURITY_RNG=y
    CONFIG_ENTROPY_GENERATOR=y
    
    CONFIG_MBEDTLS=y
    CONFIG_MBEDTLS_LIBRARY=y
    CONFIG_MBEDTLS_ENABLE_HEAP=y
    CONFIG_MBEDTLS_HEAP_SIZE=65536
    CONFIG_MBEDTLS_INSTALL_PATH="DUMMY"
    
    CONFIG_MBEDTLS_ECJPAKE_C=y
    
    # Quick fix to ensure the crypto tests can execute directly on nRF9160
    CONFIG_SRAM_SIZE=128
    

    Regards,

    Bosco jacinto

Reply
  • Hi Carl,

    Thanks for your quick response. Sorry I dint mention the target, yes was building for nrf5340dk_nrf5340_cpuappns.

    Ok so I do need to build for nrf5340dk_nrf5340_cpuapp ?

    I did try with target nrf5340dk_nrf5340_cpuapp, I got a null pointer exception this time at the same AES ECB MAC test suite.

    387: state_reset -- PASS -- [../src/main.c:48]
    
    388: ChaChaPoly Invalid mac_len=15 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:142]
    
    389: ChaChaPoly Invalid nonce_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:124]
    
    390: ChaChaPoly message_len=114 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:86]
    
    391: ChaChaPoly message_len=265 ad_len=12 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:51]
    
    Test suite AEAD CHACHAPOLY succeeded
    
    Running test suite AEAD CHACHAPOLY simple
    
    392: state_reset -- PASS -- [../src/main.c:48]
    
    393: ChaChaPoly Decrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:218]
    
    394: ChaChaPoly Encrypt Invalid mac -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:199]
    
    395: ChaChaPoly Decrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:180]
    
    396: ChaChaPoly Encrypt Invalid key -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:161]
    
    397: ChaChaPoly Valid ad_len=0 -- PASS -- [../test_cases/test_vectors_aead_chachapoly.c:106]
    
    Test suite AEAD CHACHAPOLY simple succeeded
    
    Running test suite AES ECB MAC
    
    398: state_reset -- PASS -- [../src/main.c:48]
    
    399: CMAC 256 message_len=64 -- [00214230] <err> os: ***** Debug monitor exception *****
    
    Null-pointer exception?
    
    [00214466] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000004  r2/a3:  0x00063734
    
    [00214698] <err> os: r3/a4:  0x000000a0 r12/ip:  0x00000000 r14/lr:  0x0000d621
    
    [00214931] <err> os:  xpsr:  0x61000000
    
    [00215048] <err> os: Faulting instruction address (r15/pc): 0x0000eace
    
    [00215255] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    
    [00215459] <err> os: Current thread: 0x200002d8 (unknown)
    
    [00215628] <err> os: Halting system
    

    The following is the call stack, am not sure if the resolution of this picture is ok

    The following is the project config

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # TEST
    CONFIG_ZTEST=y
    CONFIG_ZTEST_FAIL_FAST=y
    CONFIG_ZTEST_STACKSIZE=4096
    CONFIG_MAIN_STACK_SIZE=8192
    CONFIG_ZTEST_TC_UTIL_USER_OVERRIDE=y
    
    # LOG
    CONFIG_TEST_LOGGING_DEFAULTS=n
    CONFIG_LOG=y
    CONFIG_LOG_PRINTK=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_BACKEND_SHOW_COLOR=n
    CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n
    
    # MISC
    CONFIG_DK_LIBRARY=y
    CONFIG_SPEED_OPTIMIZATIONS=y
    
    # CRYPTO
    CONFIG_NORDIC_SECURITY_BACKEND=y
    CONFIG_NRF_SECURITY_RNG=y
    CONFIG_ENTROPY_GENERATOR=y
    
    CONFIG_MBEDTLS=y
    CONFIG_MBEDTLS_LIBRARY=y
    CONFIG_MBEDTLS_ENABLE_HEAP=y
    CONFIG_MBEDTLS_HEAP_SIZE=65536
    CONFIG_MBEDTLS_INSTALL_PATH="DUMMY"
    
    CONFIG_MBEDTLS_ECJPAKE_C=y
    
    # Quick fix to ensure the crypto tests can execute directly on nRF9160
    CONFIG_SRAM_SIZE=128
    

    Regards,

    Bosco jacinto

Children
Related