OTA - Not working in Zephyr but works in SoftDevice

Hello,

I am using Celium device's BE33 (nRF52833 based) Click here for datasheet. there are crystal pins exposed in this controller but I dont want to use external crystal so I have added below to prj.conf

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

I am trying to implement https://getwavecake.com/blog/adding-ota-dfu-to-a-nordic-zephyr-project/ This example which is a reference of Nordic/Zephyr/samples/bluetooth/peripheral_hr example.

Here I am facing a boot problem. Once I set CONFIG_BOOTLOADER_MCUBOOT=y this problem begins. I need to touch to the crystal pins once to get started otherwise it won't start on its own. But when I am using softdevice DFU example it works well without the need to touch the crystal pins. why so ? Am I doing anything wrong?

Thanks in advance.

Regards,

Neeraj Dhekale

Parents
  • Hi, 

    Try to create child_image/mcuboot.conf and add those configs to the mcuboot.conf.

    Regards,
    Amanda H.

  • Hello Amanda,

    Thanks for your reply.

    Could you please help me to guide me on how to create a child image? I tried creating a folder in root directory and mcuboot.conf inside it with configuration. but I am not able to link it. While making the build it is not considering the mcuboot.

    Also tried to copy subsys example of smp_svr into root and tried to map it with below code in CMakeLists.txt

    # SPDX-License-Identifier: Apache-2.0
    
    cmake_minimum_required(VERSION 3.20.0)
    set(mcuboot_CONFIG_BOOT_SIGNATURE_KEY_FILE \"${CMAKE_CURRENT_SOURCE_DIR}/priv.pem\")
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(peripheral_hr)
    
    FILE(GLOB app_sources src/*.c)
    target_sources(app PRIVATE
      ${app_sources}
      )
      add_child_image(
        NAME smp_svr
        SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/smp_svr
    )
    zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth)

    But it shows error to add_child_image function in CMakeLists.txt file.

    Thanks and regards,

    Neeraj Dhekale

  • Hi Amanda,

    I need to touch to the crystal pins once to get started otherwise it won't start on its own. But when I am using softdevice DFU example it works well without the need to touch the crystal pins

    I have followed all the steps the same way you have suggested  in the above link... I am able to build and flash successful.. but the above problem persist as I have mentioned in my 1st main thread.

    Why do I need to toch to crystal pins to make it start. once it is is started I don't need to touch and DFU works very well.

    Now I can see mcuboot under build. This means child_image has been considered to it. I hope so.

    Am I doing anything wrong?

    Thanks and regards,

    Neeraj Dhekale

  • Hi, 

    Try to add CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y and CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y in the child_image/mcuboot/prj.conf.

    -Amanda H.

  • Hi Amanda,

    I tried to add the above 2 lines.

    After adding the above 2 lines in mcubot/prj.conf It starts displaying an error below during build.

    [232/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/banner.c.obj
    [233/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/main_weak.c.obj
    [234/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
    [235/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
    [236/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mem_slab.c.obj
    [237/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
    [238/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/device.c.obj
    [239/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
    [240/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/version.c.obj
    [241/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
    [242/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
    [243/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/thread.c.obj
    [244/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timer.c.obj
    [245/256] Linking C static library modules/segger/libmodules__segger.a
    [246/256] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mempool.c.obj
    [247/256] Linking C static library modules/mbedtls/libmodules__mbedtls.a
    [248/256] Linking C static library zephyr/kernel/libkernel.a
    [249/256] Linking C executable zephyr/zephyr_prebuilt.elf
    FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/zephyr_prebuilt.map
    : && ccache /home/neeraj/gnuarmemb/bin/arm-none-eabi-gcc   zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_prebuilt.cmd  -Wl,-Map=/home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/zephyr_prebuilt.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/mbedtls/libmodules__mbedtls.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/thumb/v7e-m/nofp"  -L/home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -no-pie  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn && cd /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr && /usr/bin/cmake -E echo
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_give':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:953: undefined reference to `z_impl_k_sem_give'
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_lock':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:820: undefined reference to `z_impl_k_mutex_lock'
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_take':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:936: undefined reference to `z_impl_k_sem_take'
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_unlock':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:836: undefined reference to `z_impl_k_mutex_unlock'
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_init':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:918: undefined reference to `z_impl_k_sem_init'
    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_init':
    /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:802: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/zephyr.hex /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot/zephyr/zephyr.elf
    cd /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build/mcuboot && /usr/bin/cmake --build . --
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/neeraj/Applications/Nordic/IOTiansRockFall_IMU_OTA/build

     *  The terminal process terminated with exit code: 1.
     *  Terminal will be reused by tasks, press any key to close it.

    What can be the issue?

    Thanks and regards,

    Neeraj Dhekale

  • The driver requires the use of multithreading, which enables certain kernel APIs. Try adding CONFIG_MULTITHREADING=y as well to the prj.conf of mcuboot. 

    -Amanda H.

Reply Children
Related