Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian-Nordic committed Apr 8, 2022
1 parent 4fc2c13 commit 12abd31
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
35 changes: 23 additions & 12 deletions examples/all-clusters-app/nrfconnect/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,43 @@ LOG_MODULE_REGISTER(app, CONFIG_MATTER_LOG_LEVEL);

using namespace ::chip;

int main()
{
CHIP_ERROR err = CHIP_NO_ERROR;

#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;

err = System::MapErrorZephyr(usb_enable(nullptr));
static int InitUSB()
{
int err = usb_enable(nullptr);

if (err != CHIP_NO_ERROR)
if (err)
{
LOG_ERR("Failed to initialize USB device");
goto exit;
return err;
}

const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;

while (!dtr)
{
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
k_sleep(K_MSEC(100));
}

return 0;
}
#endif

err = AppTask::Instance().StartApp();
int main()
{
CHIP_ERROR err = CHIP_NO_ERROR;

#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
err = System::MapErrorZephyr(InitUSB());
#endif

if (err == CHIP_NO_ERROR)
{
err = AppTask::Instance().StartApp();
}

exit:
LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format());
return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE;
}
43 changes: 27 additions & 16 deletions examples/lighting-app/nrfconnect/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,47 @@ LOG_MODULE_REGISTER(app, CONFIG_MATTER_LOG_LEVEL);

using namespace ::chip;

int main()
{
CHIP_ERROR err = CHIP_NO_ERROR;

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

#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;

err = System::MapErrorZephyr(usb_enable(nullptr));
static int InitUSB()
{
int err = usb_enable(nullptr);

if (err != CHIP_NO_ERROR)
if (err)
{
LOG_ERR("Failed to initialize USB device");
goto exit;
return err;
}

const struct device * dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;

while (!dtr)
{
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
k_sleep(K_MSEC(100));
}

return 0;
}
#endif

err = GetAppTask().StartApp();
int main()
{
CHIP_ERROR err = CHIP_NO_ERROR;

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

#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
err = System::MapErrorZephyr(InitUSB());
#endif

if (err == CHIP_NO_ERROR)
{
err = GetAppTask().StartApp();
}

exit:
LOG_ERR("Exited with code %" CHIP_ERROR_FORMAT, err.Format());
return err == CHIP_NO_ERROR ? EXIT_SUCCESS : EXIT_FAILURE;
}
11 changes: 0 additions & 11 deletions scripts/build/builders/nrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,6 @@ def generate(self):
raise Exception(
"Directory %s not writable. NRFConnect builds require updates to this directory." % nrfconnect_sdk)

# validate the the ZEPHYR_BASE is up to date (generally the case in docker images)
try:
self._Execute(
['python3', 'scripts/setup/nrfconnect/update_ncs.py', '--check'])
except Exception:
logging.exception('Failed to validate ZEPHYR_BASE status')
logging.error(
'To update $ZEPHYR_BASE run: python3 scripts/setup/nrfconnect/update_ncs.py --update --shallow')

raise Exception('ZEPHYR_BASE validation failed')

flags = []
if self.enable_rpcs:
flags.append("-DOVERLAY_CONFIG=rpc.overlay")
Expand Down

0 comments on commit 12abd31

Please sign in to comment.