I need to integrate a precompiled hex library psp.hex that has been compiled for M33 core. I am working on a nrf5340dk_nrf5340_cpuapp on nRF Connect SDK v1.9.1 The library has to be in address 0xe7000. I did the following steps:
1. Created a pm_static.yml with the following partation:
psp:
address: 0xe7000
end_address: 0xff6a0
region: flash_primary
size: 0x186a0
2. Added the following into the CmakeList.txt
add_child_image(
NAME psp
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src/psp
)
# Add psp child image conf
set(PSP_CONF_FILE ${CMAKE_CURRENT_LIST_DIR}/psp.conf)
set_property(
GLOBAL PROPERTY
PSP_HEX_FILE # Must match "*_PM_HEX_FILE"
${CMAKE_CURRENT_LIST_DIR}/src/psp/psp.hex
)
set_property(
GLOBAL PROPERTY
PSP_PM_TARGET # Must match "*_PM_TARGET"
PSP
)
3. Created ${CMAKE_CURRENT_LIST_DIR}/src/psp/ and copied the psp.hex file into it
4. In the ${CMAKE_CURRENT_LIST_DIR} directory, I added the following psp.conf file:
PSP_ENABLE=y
PSP_BUILD_STRATEGY_USE_HEX_FILE=y
PSP_HEX_FILE=${CMAKE_CURRENT_LIST_DIR}/src/psp/psp.hex
PSP_BUILD_STRATEGY_SKIP_BUILD=y
PSP_BUILD_STRATEGY_FROM_SOURCE=n
5. Added the Konfig file in ${CMAKE_CURRENT_LIST_DIR}/src/psp/
module=PSP
source "${ZEPHYR_BASE}/../nrf/subsys/partition_manager/Kconfig.template.build_strategy"
5. Added a ${CMAKE_CURRENT_LIST_DIR}/src/psp/CmakeList.txt with the following lines:
if(PSP_ENABLE)
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(PSP)
add_library(psp)
endif()
This is as per the instructions in the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_multi_image.html#ug-multi-image-defining
I am running the west build from the command line in the following way:
west build -b nrf5340dk_nrf5340_cpuapp -p -- -Dpsp_CONF_FILE=psp.conf |tee junk
I get the error as follows:
============================
....
...
=== child image psp - begin ===
loading initial cache file C:/Git/psp_lib_new/kb-firmware/kb_firmware/build/psp/child_image_preload.cmake
-- Configuring done
CMake Error:
The detected version of Ninja () is less than the version of Ninja required
by CMake (1.3).
CMake Warning:
Manually-specified variables were not used by the project:
CONFIG_NCS_MCUBOOT_IN_BUILD
IMAGE_NAME
CMake Generate step failed. Build files cannot be regenerated correctly.
CMake Error at C:/ncs/v1.9.1/nrf/cmake/multi_image.cmake:409 (message):
CMake generation for psp failed, aborting. Command: 1
Call Stack (most recent call first):
C:/ncs/v1.9.1/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
CMakeLists.txt:43 (add_child_image)
-- Configuring incomplete, errors occurred!
See also "C:/Git/psp_lib_new/kb-firmware/kb_firmware/build/CMakeFiles/CMakeOutput.log".
See also "C:/Git/psp_lib_new/kb-firmware/kb_firmware/build/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: 'C:\ncs\v1.9.1\toolchain\opt\bin\cmake.EXE' '-DWEST_PYTHON=C:\ncs\v1.9.1\toolchain\opt\bin\python.exe' '-BC:\Git\psp_lib_new\kb-firmware\kb_firmware\build' '-SC:\Git\psp_lib_new\kb-firmware\kb_firmware' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -Dpsp_CONF_FILE=psp.conf -DCMAKE_VERBOSE_MAKEFILE=ON
==================================================
I am not sure what is the issue, but it does not build the image I need.
Also, another observation is that in
${CMAKE_CURRENT_LIST_DIR}/build/psp/child_image_preload.cmake, I get the following line:
set(PM_DOMAINS "CPUNET" CACHE INTERNAL "NCS child image controlled")
Does this imply the image is being built for the CPUNET? If so, this is not what I expect since I have not given any DOMAIN in the cmake file and
I am assuming it will be built for the CPUAPP domain.
I could not find an example that uses an externally build hex file, it will be useful if you could point me to one.