Skip to content

Commit

Permalink
Fix chef build
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian-Nordic committed Nov 3, 2023
1 parent 1bde9d4 commit 99ece59
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 24 deletions.
11 changes: 9 additions & 2 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def main() -> int:

shell.run_cmd(f"cd {_CHEF_SCRIPT_PATH}")

if options.build_target in "esp32 nrfconnect ameba telink".split():
if options.build_target in "esp32 ameba telink".split():
with open("project_include.cmake", "w") as f:
f.write(textwrap.dedent(f"""\
set(CONFIG_DEVICE_VENDOR_ID {options.vid})
Expand Down Expand Up @@ -713,8 +713,15 @@ def main() -> int:
nrf_build_cmds = ["west build -b nrf52840dk_nrf52840"]
if options.do_clean:
nrf_build_cmds.append("-p always")
nrf_build_cmds.append("--")
if options.do_rpc:
nrf_build_cmds.append("-- -DOVERLAY_CONFIG=rpc.overlay")
nrf_build_cmds.append("-DOVERLAY_CONFIG=rpc.overlay")
nrf_build_cmds.append(f"-DCONFIG_CHIP_DEVICE_VENDOR_ID={options.vid}")
nrf_build_cmds.append(f"-DCONFIG_CHIP_DEVICE_PRODUCT_ID={options.pid}")
nrf_build_cmds.append(f"-DCONFIG_CHIP_DEVICE_PRODUCT_NAME='\"{options.pname}\"'")
nrf_build_cmds.append(f"-DSAMPLE_NAME={options.sample_device_type_name}")
nrf_build_cmds.append(f"-DCONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING='\"{sw_ver_string}\"'")

shell.run_cmd(" ".join(nrf_build_cmds))

elif options.build_target == "silabs-thread":
Expand Down
25 changes: 6 additions & 19 deletions examples/chef/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,16 @@ get_filename_component(NRFCONNECT_COMMON ${CHIP_ROOT}/examples/platform/nrfconne
get_filename_component(CHEF ${CMAKE_CURRENT_SOURCE_DIR}/../ REALPATH)

include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
include(${CHEF}/project_include.cmake)

get_filename_component(GEN_DIR ${CHEF}/out/${SAMPLE_NAME}/zap-generated REALPATH)

set(CONF_FILE prj.conf)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${CONFIG_DEVICE_VENDOR_ID}")
set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}")
if(NOT ${CONFIG_DEVICE_PRODUCT_NAME} STREQUAL "")
set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"${CONFIG_DEVICE_PRODUCT_NAME}\"")
endif()
if(NOT ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING} STREQUAL "")
set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}\"")
endif()
message(STATUS "Vendor ID " ${CONFIG_DEVICE_VENDOR_ID})
message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID})
message(STATUS "Product Name " ${CONFIG_DEVICE_PRODUCT_NAME})
message(STATUS "SW Version String" ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING})
message(STATUS "Vendor ID " ${CONFIG_CHIP_DEVICE_VENDOR_ID})
message(STATUS "Product ID " ${CONFIG_CHIP_DEVICE_PRODUCT_ID})
message(STATUS "Product Name " ${CONFIG_CHIP_DEVICE_PRODUCT_NAME})
message(STATUS "SW Version String" ${CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING})

# Set Kconfig root files that will be processed as a first Kconfig for used child images.
set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root)
Expand Down Expand Up @@ -107,11 +98,7 @@ chip_configure_data_model(app
include(${CHIP_ROOT}/config/nrfconnect/app/flashing.cmake)


if (CONFIG_ENABLE_PW_RPC)

target_compile_options(app PRIVATE
"-DCONFIG_ENABLE_PW_RPC=1"
)
if (CONFIG_CHIP_PW_RPC)

# Make all targets created below depend on zephyr_interface to inherit MCU-related compilation flags
link_libraries($<BUILD_INTERFACE:zephyr_interface>)
Expand Down Expand Up @@ -231,4 +218,4 @@ target_link_libraries(app PRIVATE
pw_sys_io
)

endif(CONFIG_ENABLE_PW_RPC)
endif(CONFIG_CHIP_PW_RPC)
4 changes: 2 additions & 2 deletions examples/chef/nrfconnect/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <ChipShellCollection.h>
#endif

#ifdef CONFIG_ENABLE_PW_RPC
#ifdef CONFIG_CHIP_PW_RPC
#include "Rpc.h"
#endif

Expand All @@ -57,7 +57,7 @@ int main()
{
CHIP_ERROR err = CHIP_NO_ERROR;

#ifdef CONFIG_ENABLE_PW_RPC
#ifdef CONFIG_CHIP_PW_RPC
rpc::Init();
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "pw_sys_io/sys_io.h"
#include <cassert>
#include <zephyr/console/console.h>
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

#ifdef CONFIG_USB
#include <zephyr/usb/usb_device.h>
Expand Down

0 comments on commit 99ece59

Please sign in to comment.