From 4bae1009e8d1ba9caf441dc1262a96152bc2502f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 05:34:57 -0700 Subject: [PATCH 01/47] west.yml: upmerge zephyr and other OSS repositories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original sdk-zephyr PR was automatically created by the upmerge bot via Github Action; amendments etc have gone in as we've found additional fixes. Signed-off-by: Martí Bolívar --- west.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/west.yml b/west.yml index 15bb2aa6e2c1..f1c10ef79e71 100644 --- a/west.yml +++ b/west.yml @@ -59,7 +59,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 74c7bca86e6a7d590333681eef90e159d79bcfe8 + revision: b54c8baeeafb3d6e9eef6092c5d88a6771548460 import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above @@ -110,7 +110,7 @@ manifest: - name: hostap repo-path: sdk-hostap path: modules/lib/hostap - revision: ff98ecf541f1e43a9e89e4d47f24e7c59c65f5fe + revision: ec4a32a3a7037603aa87dd5b31622141ceddf32b userdata: ncs: upstream-url: https://w1.fi/cgit/hostap/ @@ -118,7 +118,7 @@ manifest: compare-by-default: false - name: mcuboot repo-path: sdk-mcuboot - revision: c78d59dbe8ec48cfbdff9a0bfc12f25b90c73d2f + revision: 3b7c7fb9ac786bf4d06aac5a19b5e6153a802584 path: bootloader/mcuboot - name: qcbor url: https://github.com/laurencelundblade/QCBOR.git @@ -131,7 +131,7 @@ manifest: - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib - revision: 9cb73143fb543d3eefeeb356ae335a7e4c756512 + revision: 2fa09cf5566a3ec04de696b9e967aaa8bd370f86 - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m @@ -139,7 +139,7 @@ manifest: - name: matter repo-path: sdk-connectedhomeip path: modules/lib/matter - revision: 032a0a95c5b6c761b35cd73e98e41f56f59fa5f0 + revision: 0809166d47b61feb205acecb100cf5be7558b9e1 submodules: - name: nlio path: third_party/nlio/repo @@ -179,7 +179,7 @@ manifest: compare-by-default: false - name: homekit repo-path: sdk-homekit - revision: 7d3f3a3e098d64fbf804fc1edfd033ded56d161d + revision: 286b97f3a7514bc4924818611475ae5be0496ed1 groups: - homekit - name: find-my @@ -223,7 +223,7 @@ manifest: remote: throwtheswitch - name: memfault-firmware-sdk path: modules/lib/memfault-firmware-sdk - revision: 0.42.1 + revision: 0.43.1 remote: memfault - name: ant repo-path: sdk-ant From bae3e9cdd521551e3e4c1848f94be535bf61c2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Mon, 17 Apr 2023 13:34:57 -0700 Subject: [PATCH 02/47] treewide: update SYS_INIT argument signatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initialization passed to Zephyr's SYS_INIT() macro now takes no arguments instead of a device pointer that was ignored. See zephyr commit 4355b7f179f77442a74a82ec03237539eddef4c8 ("scripts: utils: add sys_init migration script") for details on the script that was used to perform the initial conversion. Following running the script, I reviewed the results manually and removed additional lines like "(void)dev" that did not match the "ARG_UNUSED(dev)" pattern expected by the script. Signed-off-by: Martí Bolívar --- .../cloud/lwm2m_integration/configuration_object.c | 2 +- .../src/cloud/nrf_cloud_integration.c | 3 +-- .../asset_tracker_v2/src/modules/ui_module.c | 3 +-- .../asset_tracker_v2/src/modules/util_module.c | 3 +-- .../tests/ui_module/src/ui_module_test.h | 2 +- .../nrf5340_audio/src/modules/audio_sync_timer.c | 3 +-- .../nrf5340_audio/src/modules/power_meas.c | 3 +-- boards/arm/nrf52820dongle_nrf52820/board.c | 3 +-- boards/arm/nrf52833dongle_nrf52833/board.c | 3 +-- .../arm/nrf7002dk_nrf5340/nrf5340_cpunet_reset.c | 3 +-- boards/arm/thingy91_nrf9160/adp5360_init.c | 2 +- drivers/hw_cc310/hw_cc310.c | 7 +++---- drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_util.c | 3 +-- drivers/wifi/nrf700x/zephyr/src/zephyr_work.c | 4 +--- include/net/lwm2m_client_utils.h | 2 +- lib/at_custom_cmd/at_custom_cmd.c | 4 +--- lib/at_host/at_host.c | 3 +-- lib/at_monitor/at_monitor.c | 2 +- lib/date_time/date_time.c | 2 +- lib/flash_patch/flash_patch.c | 4 +--- lib/fprotect/sys_init_fprotect.c | 3 +-- lib/gcf_sms/gcf_sms.c | 4 +--- lib/lte_link_control/lte_lc.c | 6 ++---- lib/nrf_modem_lib/diag.c | 2 +- lib/nrf_modem_lib/nrf_modem_lib.c | 4 ++-- lib/nrf_modem_lib/nrf_modem_os.c | 4 +--- lib/pdn/pdn.c | 2 +- lib/ram_pwrdn/ram_pwrdn.c | 3 +-- .../memfault-firmware-sdk/memfault_integration.c | 5 ++--- .../direct_test_mode/src/fem/generic_fem.c | 2 +- .../bluetooth/direct_test_mode/src/fem/nrf21540.c | 2 +- samples/bootloader/src/main.c | 4 +--- samples/nrf5340/empty_app_core/src/main.c | 3 +-- .../lwm2m_client/src/ipso/ipso_colour_sensor.c | 2 +- .../nrf9160/modem_shell/src/cloud/cloud_lwm2m.c | 2 +- .../nrf_rpc/entropy_nrf53/cpuapp/src/entropy_ser.c | 3 +-- .../nrf_rpc/entropy_nrf53/cpunet/src/entropy_ser.c | 3 +-- samples/peripheral/802154_phy_test/src/main.c | 6 ++---- samples/peripheral/radio_test/src/radio_cmd.c | 3 +-- .../radio_test/src/nrf_wifi_radio_ficr_shell.c | 3 +-- .../radio_test/src/nrf_wifi_radio_test_shell.c | 3 +-- subsys/bluetooth/controller/hci_driver.c | 3 +-- subsys/bluetooth/rpc/common/bt_rpc_common.c | 3 +-- subsys/bluetooth/services/fast_pair/fp_keys.c | 3 +-- .../services/fast_pair/fp_registration_data.c | 3 +-- subsys/caf/modules/settings_loader.c | 3 +-- subsys/dm/rpc/client/dm_rpc_client.c | 3 +-- subsys/dm/rpc/common/dm_rpc_common.c | 3 +-- subsys/dm/rpc/host/dm_rpc_host.c | 3 +-- subsys/fw_info/fw_info.c | 4 +--- subsys/ieee802154/nrf_802154_configurator.c | 3 +-- subsys/mpsl/cx/bluetooth/mpsl_cx_1w_bluetooth.c | 3 +-- subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c | 4 ++-- subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x_rpc.c | 3 +-- subsys/mpsl/cx/thread/mpsl_cx_thread.c | 5 ++--- subsys/mpsl/fem/api_init/mpsl_fem_api_init.c | 3 +-- .../fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c | 6 ++---- .../models/mpsl_fem_nrf21540_power_model_builtin.c | 2 +- .../nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c | 3 +-- subsys/mpsl/fem/simple_gpio/mpsl_fem_simple_gpio.c | 6 ++---- subsys/mpsl/init/mpsl_init.c | 6 ++---- subsys/net/lib/download_client/src/shell.c | 2 +- .../location/location_wifi_ap_scanner.c | 2 +- .../lwm2m/ecid_signal_meas_info.c | 2 +- .../lwm2m_client_utils/lwm2m/gnss_assistance_obj.c | 2 +- .../lib/lwm2m_client_utils/lwm2m/ground_fix_obj.c | 2 +- .../lwm2m_client_utils/lwm2m/lwm2m_adv_firmware.c | 2 +- .../lwm2m_client_utils/lwm2m/lwm2m_cellconn_obj.c | 2 +- .../lib/lwm2m_client_utils/lwm2m/lwm2m_connmon.c | 2 +- .../lib/lwm2m_client_utils/lwm2m/visible_wifi_ap.c | 2 +- subsys/net/lib/wifi_credentials/wifi_credentials.c | 3 +-- subsys/shell/shell_ipc.c | 3 +-- tests/lib/location/src/location_test.c | 2 +- tests/lib/lte_lc_api/src/lte_lc_api_test.c | 2 +- tests/lib/sms/src/sms_test.c | 2 +- .../account_key_storage/src/settings_mock.c | 3 +-- .../net/lib/lwm2m_client_utils/src/connmon.c | 14 +++++++------- .../lwm2m_client_utils/src/location_assistance.c | 2 +- 78 files changed, 95 insertions(+), 156 deletions(-) diff --git a/applications/asset_tracker_v2/src/cloud/lwm2m_integration/configuration_object.c b/applications/asset_tracker_v2/src/cloud/lwm2m_integration/configuration_object.c index c5478561abd3..ea7a9753cef0 100644 --- a/applications/asset_tracker_v2/src/cloud/lwm2m_integration/configuration_object.c +++ b/applications/asset_tracker_v2/src/cloud/lwm2m_integration/configuration_object.c @@ -103,7 +103,7 @@ static struct lwm2m_engine_obj_inst *object_create(uint16_t obj_inst_id) return &inst; } -static int object_init(const struct device *dev) +static int object_init(void) { struct lwm2m_engine_obj_inst *obj_inst = NULL; int ret = 0; diff --git a/applications/asset_tracker_v2/src/cloud/nrf_cloud_integration.c b/applications/asset_tracker_v2/src/cloud/nrf_cloud_integration.c index 3c92147b51c7..064a1ae1cfdf 100644 --- a/applications/asset_tracker_v2/src/cloud/nrf_cloud_integration.c +++ b/applications/asset_tracker_v2/src/cloud/nrf_cloud_integration.c @@ -57,12 +57,11 @@ static struct dfu_target_fmfu_fdev ext_flash_dev = { .dev = DEVICE_DT_GET_ONE(jedec_spi_nor) }; -static int fmfu_and_modem_init(const struct device *dev) +static int fmfu_and_modem_init(void) { enum nrf_cloud_fota_type fota_type = NRF_CLOUD_FOTA_TYPE__INVALID; int ret; - ARG_UNUSED(dev); /* Check if a full modem FOTA job is pending */ ret = nrf_cloud_fota_pending_job_type_get(&fota_type); diff --git a/applications/asset_tracker_v2/src/modules/ui_module.c b/applications/asset_tracker_v2/src/modules/ui_module.c index 6f610fee16ab..c5537d0aa434 100644 --- a/applications/asset_tracker_v2/src/modules/ui_module.c +++ b/applications/asset_tracker_v2/src/modules/ui_module.c @@ -330,9 +330,8 @@ static void led_pattern_update_work_fn(struct k_work *work) } } -static int setup(const struct device *dev) +static int setup(void) { - ARG_UNUSED(dev); int err; diff --git a/applications/asset_tracker_v2/src/modules/util_module.c b/applications/asset_tracker_v2/src/modules/util_module.c index 3ff1e48840de..07022003c3d6 100644 --- a/applications/asset_tracker_v2/src/modules/util_module.c +++ b/applications/asset_tracker_v2/src/modules/util_module.c @@ -222,9 +222,8 @@ static void reboot_ack_check(uint32_t module_id) } } -static int setup(const struct device *dev) +static int setup(void) { - ARG_UNUSED(dev); #if defined(CONFIG_WATCHDOG_APPLICATION) int err = watchdog_init_and_start(); diff --git a/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.h b/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.h index 4392563605e4..51ade5743edf 100644 --- a/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.h +++ b/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.h @@ -16,6 +16,6 @@ /* Suppress linker that warns that setup() is not used. This is because the function is run * at SYS_INIT, which is now redefined. */ -static int setup(const struct device *dev) __attribute__((unused)); +static int setup(void) __attribute__((unused)); #endif /* UI_MODULE_TEST */ diff --git a/applications/nrf5340_audio/src/modules/audio_sync_timer.c b/applications/nrf5340_audio/src/modules/audio_sync_timer.c index cb30f25dd84e..8784f7759eaf 100644 --- a/applications/nrf5340_audio/src/modules/audio_sync_timer.c +++ b/applications/nrf5340_audio/src/modules/audio_sync_timer.c @@ -51,11 +51,10 @@ static void event_handler(nrf_timer_event_t event_type, void *ctx) * * @return 0 if successful, error otherwise */ -static int audio_sync_timer_init(const struct device *unused) +static int audio_sync_timer_init(void) { nrfx_err_t ret; - ARG_UNUSED(unused); ret = nrfx_timer_init(&audio_sync_timer_instance, &cfg, event_handler); if (ret - NRFX_ERROR_BASE_NUM) { diff --git a/applications/nrf5340_audio/src/modules/power_meas.c b/applications/nrf5340_audio/src/modules/power_meas.c index ddff6400e329..e7ab2a8d97d7 100644 --- a/applications/nrf5340_audio/src/modules/power_meas.c +++ b/applications/nrf5340_audio/src/modules/power_meas.c @@ -102,9 +102,8 @@ static void meas_thread_fn(void *dummy1, void *dummy2, void *dummy3) } } -static int power_meas_init(const struct device *dev) +static int power_meas_init(void) { - ARG_UNUSED(dev); /* check if all sensors are ready */ for (size_t i = 0U; i < POWER_RAIL_NUM; i++) { diff --git a/boards/arm/nrf52820dongle_nrf52820/board.c b/boards/arm/nrf52820dongle_nrf52820/board.c index 550631189bbc..9c5f1be696e9 100644 --- a/boards/arm/nrf52820dongle_nrf52820/board.c +++ b/boards/arm/nrf52820dongle_nrf52820/board.c @@ -8,9 +8,8 @@ #include #include -static int board_nrf52820dongle_init(const struct device *dev) +static int board_nrf52820dongle_init(void) { - ARG_UNUSED(dev); /* If the nrf52820dongle board is powered from USB * (high voltage mode), GPIO output voltage is set to 1.8 volts by diff --git a/boards/arm/nrf52833dongle_nrf52833/board.c b/boards/arm/nrf52833dongle_nrf52833/board.c index 1d7f287b8f2a..3d5ed0b13fca 100644 --- a/boards/arm/nrf52833dongle_nrf52833/board.c +++ b/boards/arm/nrf52833dongle_nrf52833/board.c @@ -8,9 +8,8 @@ #include #include -static int board_nrf52833dongle_nrf52833_init(const struct device *dev) +static int board_nrf52833dongle_nrf52833_init(void) { - ARG_UNUSED(dev); /* If the nrf52833dongle_nrf52833 board is powered from USB * (high voltage mode), GPIO output voltage is set to 1.8 volts by diff --git a/boards/arm/nrf7002dk_nrf5340/nrf5340_cpunet_reset.c b/boards/arm/nrf7002dk_nrf5340/nrf5340_cpunet_reset.c index 3f25f6f788bb..c655d4a3be6f 100644 --- a/boards/arm/nrf7002dk_nrf5340/nrf5340_cpunet_reset.c +++ b/boards/arm/nrf7002dk_nrf5340/nrf5340_cpunet_reset.c @@ -32,9 +32,8 @@ static void remoteproc_mgr_config(void) #endif /* !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) */ } -static int remoteproc_mgr_boot(const struct device *dev) +static int remoteproc_mgr_boot(void) { - ARG_UNUSED(dev); /* Secure domain may configure permissions for the Network MCU. */ remoteproc_mgr_config(); diff --git a/boards/arm/thingy91_nrf9160/adp5360_init.c b/boards/arm/thingy91_nrf9160/adp5360_init.c index 2b260a534ed8..4f217d9a6d9a 100644 --- a/boards/arm/thingy91_nrf9160/adp5360_init.c +++ b/boards/arm/thingy91_nrf9160/adp5360_init.c @@ -94,7 +94,7 @@ static int power_mgmt_init(void) return 0; } -static int thingy91_board_init(const struct device *dev) +static int thingy91_board_init(void) { int err; diff --git a/drivers/hw_cc310/hw_cc310.c b/drivers/hw_cc310/hw_cc310.c index 320f971ffbb6..5c5ca0f441af 100644 --- a/drivers/hw_cc310/hw_cc310.c +++ b/drivers/hw_cc310/hw_cc310.c @@ -17,9 +17,8 @@ #if CONFIG_HW_CC3XX -static int hw_cc3xx_init_internal(const struct device *dev) +static int hw_cc3xx_init_internal(void) { - ARG_UNUSED(dev); int res; @@ -33,7 +32,7 @@ static int hw_cc3xx_init_internal(const struct device *dev) return res; } -static int hw_cc3xx_init(const struct device *dev) +static int hw_cc3xx_init(void) { int res; @@ -44,7 +43,7 @@ static int hw_cc3xx_init(const struct device *dev) nrf_cc3xx_platform_mutex_init(); /* Enable the hardware */ - res = hw_cc3xx_init_internal(dev); + res = hw_cc3xx_init_internal(); return res; } diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_util.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_util.c index 3cd731183338..837214adca30 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_util.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_util.c @@ -662,9 +662,8 @@ SHELL_CMD_REGISTER(wifi_util, NULL); -static int nrf_wifi_util_init(const struct device *unused) +static int nrf_wifi_util_init(void) { - ARG_UNUSED(unused); if (nrf_wifi_util_conf_init(&ctx->conf_params) < 0) return -1; diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_work.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_work.c index 5a64355d113e..d7a0bc5606f8 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_work.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_work.c @@ -60,10 +60,8 @@ struct zep_work_item *work_alloc(void) return &zep_work_item[free_work_index]; } -static int workqueue_init(const struct device *unused) +static int workqueue_init(void) { - (void)unused; - k_work_queue_init(&zep_wifi_bh_q); k_work_queue_start(&zep_wifi_bh_q, diff --git a/include/net/lwm2m_client_utils.h b/include/net/lwm2m_client_utils.h index c5ed72ce7b6c..97f0a9d9ec54 100644 --- a/include/net/lwm2m_client_utils.h +++ b/include/net/lwm2m_client_utils.h @@ -265,7 +265,7 @@ int lwm2m_init_image(void); * * @return Zero if success, negative error code otherwise. */ -int lwm2m_init_connmon(const struct device *dev); +int lwm2m_init_connmon(void); #endif #if defined(CONFIG_LWM2M_CLIENT_UTILS_CELL_CONN_OBJ_SUPPORT) diff --git a/lib/at_custom_cmd/at_custom_cmd.c b/lib/at_custom_cmd/at_custom_cmd.c index 221bfcfb20f0..6247ea840529 100644 --- a/lib/at_custom_cmd/at_custom_cmd.c +++ b/lib/at_custom_cmd/at_custom_cmd.c @@ -17,10 +17,8 @@ LOG_MODULE_REGISTER(at_custom_cmd, CONFIG_AT_CUSTOM_CMD_LOG_LEVEL); -static int at_custom_cmd_sys_init(const struct device *unused) +static int at_custom_cmd_sys_init(void) { - (void)unused; - int err; extern struct nrf_modem_at_cmd_filter _nrf_modem_at_cmd_filter_list_start[]; int num_items = 0; diff --git a/lib/at_host/at_host.c b/lib/at_host/at_host.c index cd25f1f91d04..7d0fe7c5a378 100644 --- a/lib/at_host/at_host.c +++ b/lib/at_host/at_host.c @@ -222,12 +222,11 @@ static int at_uart_init(const struct device *uart_dev) return err; } -static int at_host_init(const struct device *arg) +static int at_host_init(void) { int err; enum term_modes mode = CONFIG_AT_HOST_TERMINATION; - ARG_UNUSED(arg); /* Choosing the termination mode */ if (mode < MODE_COUNT) { diff --git a/lib/at_monitor/at_monitor.c b/lib/at_monitor/at_monitor.c index 30dc735eb040..50356a3e502e 100644 --- a/lib/at_monitor/at_monitor.c +++ b/lib/at_monitor/at_monitor.c @@ -103,7 +103,7 @@ static void at_monitor_task(struct k_work *work) } } -static int at_monitor_sys_init(const struct device *unused) +static int at_monitor_sys_init(void) { int err; diff --git a/lib/date_time/date_time.c b/lib/date_time/date_time.c index 9c1302774a53..581d30e8ef3e 100644 --- a/lib/date_time/date_time.c +++ b/lib/date_time/date_time.c @@ -158,7 +158,7 @@ int date_time_timestamp_clear(int64_t *unix_timestamp) return 0; } -static int date_time_init(const struct device *unused) +static int date_time_init(void) { date_time_core_init(); diff --git a/lib/flash_patch/flash_patch.c b/lib/flash_patch/flash_patch.c index e03fb4f1eb3d..c6b97a402f9f 100644 --- a/lib/flash_patch/flash_patch.c +++ b/lib/flash_patch/flash_patch.c @@ -9,10 +9,8 @@ #include #ifdef CONFIG_DISABLE_FLASH_PATCH -static int disable_flash_patch(const struct device *dev) +static int disable_flash_patch(void) { - (void)dev; - /* Check if register has been written. */ if ((NRF_UICR->DEBUGCTRL & UICR_DEBUGCTRL_CPUFPBEN_Msk) != 0x0) { /* Enable flash write. */ diff --git a/lib/fprotect/sys_init_fprotect.c b/lib/fprotect/sys_init_fprotect.c index bff6bda50b97..997020f3051d 100644 --- a/lib/fprotect/sys_init_fprotect.c +++ b/lib/fprotect/sys_init_fprotect.c @@ -19,9 +19,8 @@ BUILD_ASSERT(PM_SIZE % CONFIG_FPROTECT_BLOCK_SIZE == 0, "Unable to protect app image since its size does not align with " "the locking granularity of fprotect."); -static int fprotect_self(const struct device *dev) +static int fprotect_self(void) { - ARG_UNUSED(dev); int err; diff --git a/lib/gcf_sms/gcf_sms.c b/lib/gcf_sms/gcf_sms.c index ae4e3ece1d7f..552a74618fed 100644 --- a/lib/gcf_sms/gcf_sms.c +++ b/lib/gcf_sms/gcf_sms.c @@ -464,10 +464,8 @@ static int at_cmd_callback_cmgf(char *buf, size_t len, char *at_cmd) } /* Initialize the library. */ -int gcf_sms_init(const struct device *unused) +int gcf_sms_init(void) { - (void)unused; - for (int i = 0; i < SMS_BUFFER_ARRAY_SIZE; i++) { sms_buffers_clear_index(i); } diff --git a/lib/lte_link_control/lte_lc.c b/lib/lte_link_control/lte_lc.c index 28f9c21d10d4..30996c1d79b1 100644 --- a/lib/lte_link_control/lte_lc.c +++ b/lib/lte_link_control/lte_lc.c @@ -719,7 +719,7 @@ static int connect_lte(bool blocking) return err; } -static int init_and_connect(const struct device *unused) +static int init_and_connect(void) { int err; @@ -772,9 +772,7 @@ int lte_lc_connect(void) int lte_lc_init_and_connect(void) { - const struct device *x = 0; - - return init_and_connect(x); + return init_and_connect(); } int lte_lc_connect_async(lte_lc_evt_handler_t handler) diff --git a/lib/nrf_modem_lib/diag.c b/lib/nrf_modem_lib/diag.c index 3c771b71a2a6..0137c750a8a4 100644 --- a/lib/nrf_modem_lib/diag.c +++ b/lib/nrf_modem_lib/diag.c @@ -85,7 +85,7 @@ static void diag_task(struct k_work *item) } #endif -static int nrf_modem_lib_diag_sys_init(const struct device *unused) +static int nrf_modem_lib_diag_sys_init(void) { #if CONFIG_NRF_MODEM_LIB_MEM_DIAG_ALLOC static HEAP_LISTENER_ALLOC_DEFINE( diff --git a/lib/nrf_modem_lib/nrf_modem_lib.c b/lib/nrf_modem_lib/nrf_modem_lib.c index fc674c29220d..00de89692fea 100644 --- a/lib/nrf_modem_lib/nrf_modem_lib.c +++ b/lib/nrf_modem_lib/nrf_modem_lib.c @@ -105,7 +105,7 @@ static void log_fw_version_uuid(void) } } -static int _nrf_modem_lib_init(const struct device *unused) +static int _nrf_modem_lib_init(void) { int rc; @@ -141,7 +141,7 @@ static int _nrf_modem_lib_init(const struct device *unused) int nrf_modem_lib_init(void) { - return _nrf_modem_lib_init(NULL); + return _nrf_modem_lib_init(); } int nrf_modem_lib_bootloader_init(void) diff --git a/lib/nrf_modem_lib/nrf_modem_os.c b/lib/nrf_modem_lib/nrf_modem_os.c index 7243b4067a1c..583fa5bbb936 100644 --- a/lib/nrf_modem_lib/nrf_modem_os.c +++ b/lib/nrf_modem_lib/nrf_modem_os.c @@ -404,10 +404,8 @@ void nrf_modem_os_logdump(int level, const char *str, const void *data, size_t l } /* On application initialization */ -static int on_init(const struct device *dev) +static int on_init(void) { - (void) dev; - /* The list of sleeping threads should only be initialized once at the application * initialization. This is because we want to keep the list intact regardless of modem * reinitialization to wake sleeping threads on modem initialization. diff --git a/lib/pdn/pdn.c b/lib/pdn/pdn.c index 064e5af9c951..d87fea8a9e06 100644 --- a/lib/pdn/pdn.c +++ b/lib/pdn/pdn.c @@ -539,7 +539,7 @@ static void on_cfun(enum lte_lc_func_mode mode, void *ctx) } #endif /* CONFIG_LTE_LINK_CONTROL */ -static int pdn_sys_init(const struct device *unused) +static int pdn_sys_init(void) { pdn_act_notif.cid = CID_UNASSIGNED; diff --git a/lib/ram_pwrdn/ram_pwrdn.c b/lib/ram_pwrdn/ram_pwrdn.c index 86d467095ee0..4e7875b21b83 100644 --- a/lib/ram_pwrdn/ram_pwrdn.c +++ b/lib/ram_pwrdn/ram_pwrdn.c @@ -217,9 +217,8 @@ static void libc_heap_resize_cb(uintptr_t heap_id, void *old_heap_end, void *new static HEAP_LISTENER_RESIZE_DEFINE(heap_listener, HEAP_ID_LIBC, libc_heap_resize_cb); -static int ram_power_init(const struct device *unused) +static int ram_power_init(void) { - ARG_UNUSED(unused); power_down_unused_ram(); heap_listener_register(&heap_listener); diff --git a/modules/memfault-firmware-sdk/memfault_integration.c b/modules/memfault-firmware-sdk/memfault_integration.c index 7b0b31ec70e3..67dbe2c5ea30 100644 --- a/modules/memfault-firmware-sdk/memfault_integration.c +++ b/modules/memfault-firmware-sdk/memfault_integration.c @@ -132,11 +132,10 @@ static int device_info_init(void) } #endif /* CONFIG_MEMFAULT_NCS_DEVICE_ID_IMEI */ -static int init(const struct device *unused) +static int init(void) { int err = 0; - ARG_UNUSED(unused); if (IS_ENABLED(CONFIG_MEMFAULT_NCS_PROVISION_CERTIFICATES)) { err = memfault_zephyr_port_install_root_certs(); @@ -196,7 +195,7 @@ static void on_modem_lib_init(int ret, void *ctx) return; } - init(NULL); + init(); } #else diff --git a/samples/bluetooth/direct_test_mode/src/fem/generic_fem.c b/samples/bluetooth/direct_test_mode/src/fem/generic_fem.c index 8d71040d468c..75fda12ebe01 100644 --- a/samples/bluetooth/direct_test_mode/src/fem/generic_fem.c +++ b/samples/bluetooth/direct_test_mode/src/fem/generic_fem.c @@ -191,7 +191,7 @@ static const struct fem_interface_api generic_fem_api = { .tx_default_gain_get = tx_default_gain_get, }; -static int generic_fem_setup(const struct device *dev) +static int generic_fem_setup(void) { int err; diff --git a/samples/bluetooth/direct_test_mode/src/fem/nrf21540.c b/samples/bluetooth/direct_test_mode/src/fem/nrf21540.c index 450b2e0d5130..a1efacb00423 100644 --- a/samples/bluetooth/direct_test_mode/src/fem/nrf21540.c +++ b/samples/bluetooth/direct_test_mode/src/fem/nrf21540.c @@ -113,7 +113,7 @@ static const struct fem_interface_api nrf21540_api = { .antenna_select = nrf21540_antenna_select }; -static int nrf21540_setup(const struct device *dev) +static int nrf21540_setup(void) { int err; diff --git a/samples/bootloader/src/main.c b/samples/bootloader/src/main.c index b107a0bdf7c2..901826f35d23 100644 --- a/samples/bootloader/src/main.c +++ b/samples/bootloader/src/main.c @@ -21,10 +21,8 @@ #define HUK_FLAG_OFFSET 0xFFC /* When this word is set, expect HUK to be written. */ -int load_huk(const struct device *unused) +int load_huk(void) { - (void)unused; - if (!hw_unique_key_is_written(HUK_KEYSLOT_KDR)) { uint32_t huk_flag_addr = PM_HW_UNIQUE_KEY_PARTITION_ADDRESS + HUK_FLAG_OFFSET; diff --git a/samples/nrf5340/empty_app_core/src/main.c b/samples/nrf5340/empty_app_core/src/main.c index 5a0aff0dca41..0bdb92e3fb3e 100644 --- a/samples/nrf5340/empty_app_core/src/main.c +++ b/samples/nrf5340/empty_app_core/src/main.c @@ -49,9 +49,8 @@ void main(void) * that the network core is not started yet. More pins can be added if the * network core needs them. */ -static int network_gpio_allow(const struct device *dev) +static int network_gpio_allow(void) { - ARG_UNUSED(dev); /* When the use of the low frequency crystal oscillator (LFXO) is * enabled, do not modify the configuration of the pins P0.00 (XL1) diff --git a/samples/nrf9160/lwm2m_client/src/ipso/ipso_colour_sensor.c b/samples/nrf9160/lwm2m_client/src/ipso/ipso_colour_sensor.c index c0b261184049..13f41caf0685 100644 --- a/samples/nrf9160/lwm2m_client/src/ipso/ipso_colour_sensor.c +++ b/samples/nrf9160/lwm2m_client/src/ipso/ipso_colour_sensor.c @@ -112,7 +112,7 @@ static struct lwm2m_engine_obj_inst *colour_sensor_create(uint16_t obj_inst_id) return &inst[index]; } -static int ipso_colour_sensor_init(const struct device *dev) +static int ipso_colour_sensor_init(void) { sensor.obj_id = IPSO_OBJECT_COLOUR_ID; sensor.version_major = COLOUR_VERSION_MAJOR; diff --git a/samples/nrf9160/modem_shell/src/cloud/cloud_lwm2m.c b/samples/nrf9160/modem_shell/src/cloud/cloud_lwm2m.c index 26f90e1419c1..8d50099c0f20 100644 --- a/samples/nrf9160/modem_shell/src/cloud/cloud_lwm2m.c +++ b/samples/nrf9160/modem_shell/src/cloud/cloud_lwm2m.c @@ -154,7 +154,7 @@ static void cloud_lwm2m_lte_lc_evt_handler(const struct lte_lc_evt *const evt) } } -static int cloud_lwm2m_init(const struct device *unused) +static int cloud_lwm2m_init(void) { int ret; diff --git a/samples/nrf_rpc/entropy_nrf53/cpuapp/src/entropy_ser.c b/samples/nrf_rpc/entropy_nrf53/cpuapp/src/entropy_ser.c index 0b657a1386eb..3011a438d0f8 100644 --- a/samples/nrf_rpc/entropy_nrf53/cpuapp/src/entropy_ser.c +++ b/samples/nrf_rpc/entropy_nrf53/cpuapp/src/entropy_ser.c @@ -273,9 +273,8 @@ static void err_handler(const struct nrf_rpc_err_report *report) } -static int serialization_init(const struct device *dev) +static int serialization_init(void) { - ARG_UNUSED(dev); int err; diff --git a/samples/nrf_rpc/entropy_nrf53/cpunet/src/entropy_ser.c b/samples/nrf_rpc/entropy_nrf53/cpunet/src/entropy_ser.c index d345aa450572..b6ee9e7e06c5 100644 --- a/samples/nrf_rpc/entropy_nrf53/cpunet/src/entropy_ser.c +++ b/samples/nrf_rpc/entropy_nrf53/cpunet/src/entropy_ser.c @@ -173,9 +173,8 @@ static void err_handler(const struct nrf_rpc_err_report *report) } -static int serialization_init(const struct device *dev) +static int serialization_init(void) { - ARG_UNUSED(dev); int err; diff --git a/samples/peripheral/802154_phy_test/src/main.c b/samples/peripheral/802154_phy_test/src/main.c index d1c2eac470df..292e0a1253ca 100644 --- a/samples/peripheral/802154_phy_test/src/main.c +++ b/samples/peripheral/802154_phy_test/src/main.c @@ -27,22 +27,20 @@ void ptt_do_reset_ext(void) NVIC_SystemReset(); } -static int rf_setup(const struct device *dev) +static int rf_setup(void) { LOG_INF("RF setup started"); - ARG_UNUSED(dev); rf_init(); return 0; } -static int setup(const struct device *dev) +static int setup(void) { LOG_INF("Setup started"); - ARG_UNUSED(dev); periph_init(); diff --git a/samples/peripheral/radio_test/src/radio_cmd.c b/samples/peripheral/radio_test/src/radio_cmd.c index cfa67a7b189b..fe9dc78d3647 100644 --- a/samples/peripheral/radio_test/src/radio_cmd.c +++ b/samples/peripheral/radio_test/src/radio_cmd.c @@ -1364,9 +1364,8 @@ SHELL_CMD_REGISTER(fem, cmd_fem); #endif /* CONFIG_FEM */ -static int radio_cmd_init(const struct device *dev) +static int radio_cmd_init(void) { - ARG_UNUSED(dev); #if CONFIG_RADIO_TEST_POWER_CONTROL_AUTOMATIC /* When front-end module is used, set output power to the front-end module diff --git a/samples/wifi/radio_test/src/nrf_wifi_radio_ficr_shell.c b/samples/wifi/radio_test/src/nrf_wifi_radio_ficr_shell.c index 355d2410d6e5..449f4e6d1d64 100644 --- a/samples/wifi/radio_test/src/nrf_wifi_radio_ficr_shell.c +++ b/samples/wifi/radio_test/src/nrf_wifi_radio_ficr_shell.c @@ -271,9 +271,8 @@ SHELL_CMD_REGISTER(wifi_radio_ficr_prog, NULL); -static int nrf_wifi_radio_otp_shell_init(const struct device *unused) +static int nrf_wifi_radio_otp_shell_init(void) { - ARG_UNUSED(unused); return 0; } diff --git a/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c b/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c index fdf4fe12d935..edbce0367c8f 100644 --- a/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c +++ b/samples/wifi/radio_test/src/nrf_wifi_radio_test_shell.c @@ -2375,10 +2375,9 @@ SHELL_CMD_REGISTER(wifi_radio_test, NULL); -static int nrf_wifi_radio_test_shell_init(const struct device *unused) +static int nrf_wifi_radio_test_shell_init(void) { enum wifi_nrf_status status = WIFI_NRF_STATUS_FAIL; - ARG_UNUSED(unused); status = nrf_wifi_radio_test_conf_init(&ctx->conf_params); diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index e00183bc6d08..cd1d68bd9439 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -1033,9 +1033,8 @@ void bt_ctlr_set_public_addr(const uint8_t *addr) (void)sdc_hci_cmd_vs_zephyr_write_bd_addr(bd_addr); } -static int hci_driver_init(const struct device *unused) +static int hci_driver_init(void) { - ARG_UNUSED(unused); int err = 0; bt_hci_driver_register(&drv); diff --git a/subsys/bluetooth/rpc/common/bt_rpc_common.c b/subsys/bluetooth/rpc/common/bt_rpc_common.c index def3af09562f..ee089195aaaa 100644 --- a/subsys/bluetooth/rpc/common/bt_rpc_common.c +++ b/subsys/bluetooth/rpc/common/bt_rpc_common.c @@ -30,9 +30,8 @@ static void err_handler(const struct nrf_rpc_err_report *report) k_oops(); } -static int serialization_init(const struct device *dev) +static int serialization_init(void) { - ARG_UNUSED(dev); int err; diff --git a/subsys/bluetooth/services/fast_pair/fp_keys.c b/subsys/bluetooth/services/fast_pair/fp_keys.c index 7ddc50264dff..5725fbf1b4f1 100644 --- a/subsys/bluetooth/services/fast_pair/fp_keys.c +++ b/subsys/bluetooth/services/fast_pair/fp_keys.c @@ -442,9 +442,8 @@ static void timeout_fn(struct k_work *w) key_timeout(proc); } -static int fp_keys_init(const struct device *unused) +static int fp_keys_init(void) { - ARG_UNUSED(unused); for (size_t i = 0; i < ARRAY_SIZE(fp_procedures); i++) { struct fp_procedure *proc = &fp_procedures[i]; diff --git a/subsys/bluetooth/services/fast_pair/fp_registration_data.c b/subsys/bluetooth/services/fast_pair/fp_registration_data.c index 36416af14ac6..a926be36800c 100644 --- a/subsys/bluetooth/services/fast_pair/fp_registration_data.c +++ b/subsys/bluetooth/services/fast_pair/fp_registration_data.c @@ -111,9 +111,8 @@ static int validate_fp_hash(const uint8_t *prov_data, const uint8_t *hash) return err; } -static int fp_registration_data_validate(const struct device *unused) +static int fp_registration_data_validate(void) { - ARG_UNUSED(unused); int err; uint8_t data[FP_DATA_SIZE]; diff --git a/subsys/caf/modules/settings_loader.c b/subsys/caf/modules/settings_loader.c index 8894d1b13842..e6347c7a9c83 100644 --- a/subsys/caf/modules/settings_loader.c +++ b/subsys/caf/modules/settings_loader.c @@ -116,9 +116,8 @@ static bool app_event_handler(const struct app_event_header *aeh) APP_EVENT_LISTENER(MODULE, app_event_handler); APP_EVENT_SUBSCRIBE(MODULE, module_state_event); -static int caf_settings_init(const struct device *unused) +static int caf_settings_init(void) { - ARG_UNUSED(unused); /* Initialize settings subsystem on system start to ensure that the subsystem is initialized * before the application starts using it (e.g. before registering runtime handlers). diff --git a/subsys/dm/rpc/client/dm_rpc_client.c b/subsys/dm/rpc/client/dm_rpc_client.c index 2f3e35f133ef..7690245b18f7 100644 --- a/subsys/dm/rpc/client/dm_rpc_client.c +++ b/subsys/dm/rpc/client/dm_rpc_client.c @@ -164,9 +164,8 @@ static void data_handler(struct k_work *work) ipc_service_send(&ep, &cmd, sizeof(cmd)); } -static int ipc_init(const struct device *dev) +static int ipc_init(void) { - ARG_UNUSED(dev); int err; const struct device *ipc_instance; diff --git a/subsys/dm/rpc/common/dm_rpc_common.c b/subsys/dm/rpc/common/dm_rpc_common.c index 7ecbe564a1d5..f63d5d6c149a 100644 --- a/subsys/dm/rpc/common/dm_rpc_common.c +++ b/subsys/dm/rpc/common/dm_rpc_common.c @@ -27,9 +27,8 @@ static void err_handler(const struct nrf_rpc_err_report *report) k_oops(); } -static int serialization_init(const struct device *dev) +static int serialization_init(void) { - ARG_UNUSED(dev); int err; diff --git a/subsys/dm/rpc/host/dm_rpc_host.c b/subsys/dm/rpc/host/dm_rpc_host.c index f12094323b9b..9971d06ae0d2 100644 --- a/subsys/dm/rpc/host/dm_rpc_host.c +++ b/subsys/dm/rpc/host/dm_rpc_host.c @@ -123,9 +123,8 @@ static struct ipc_ept_cfg ep_cfg = { }, }; -static int ipc_init(const struct device *dev) +static int ipc_init(void) { - ARG_UNUSED(dev); int err; const struct device *ipc_instance; diff --git a/subsys/fw_info/fw_info.c b/subsys/fw_info/fw_info.c index d2c5032ba58d..a0292a2962f2 100644 --- a/subsys/fw_info/fw_info.c +++ b/subsys/fw_info/fw_info.c @@ -168,10 +168,8 @@ EXT_API(EXT_API_PROVIDE, struct ext_api_provide_ext_api, }; #endif -static int check_ext_api_requests(const struct device *dev) +static int check_ext_api_requests(void) { - (void)dev; - const struct fw_info_ext_api_request *ext_api_req = skip_ext_apis(&m_firmware_info); diff --git a/subsys/ieee802154/nrf_802154_configurator.c b/subsys/ieee802154/nrf_802154_configurator.c index 394d6aae2e81..d974c840fea7 100644 --- a/subsys/ieee802154/nrf_802154_configurator.c +++ b/subsys/ieee802154/nrf_802154_configurator.c @@ -40,9 +40,8 @@ static void ccaed_threshold_configure(void) nrf_802154_cca_cfg_set(&cca_cfg); } -static int nrf_802154_configure(const struct device *dev) +static int nrf_802154_configure(void) { - ARG_UNUSED(dev); ccaed_threshold_configure(); diff --git a/subsys/mpsl/cx/bluetooth/mpsl_cx_1w_bluetooth.c b/subsys/mpsl/cx/bluetooth/mpsl_cx_1w_bluetooth.c index 9b9713337db2..86b586365ca7 100644 --- a/subsys/mpsl/cx/bluetooth/mpsl_cx_1w_bluetooth.c +++ b/subsys/mpsl/cx/bluetooth/mpsl_cx_1w_bluetooth.c @@ -88,9 +88,8 @@ static int mpsl_cx_bt_interface_1wire_config_set(void) return err; } -static int mpsl_cx_init(const struct device *dev) +static int mpsl_cx_init(void) { - ARG_UNUSED(dev); return mpsl_cx_bt_interface_1wire_config_set(); } diff --git a/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c b/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c index 21910d22706a..8b7217c45249 100644 --- a/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c +++ b/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x.c @@ -232,7 +232,7 @@ static const mpsl_cx_interface_t m_mpsl_cx_methods = { .p_register_callback = register_callback, }; -static int mpsl_cx_init(const struct device *dev) +static int mpsl_cx_init(void) { int32_t ret; @@ -288,7 +288,7 @@ void mpsl_cx_nrf700x_set_enabled(bool enable) } #else // !defined(CONFIG_MPSL_CX_PIN_FORWARDER) -static int mpsl_cx_init(const struct device *dev) +static int mpsl_cx_init(void) { #if DT_NODE_HAS_PROP(CX_NODE, req_gpios) uint8_t req_pin = NRF_DT_GPIOS_TO_PSEL(CX_NODE, req_gpios); diff --git a/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x_rpc.c b/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x_rpc.c index 8d3753d682e1..6210a5d5d67f 100644 --- a/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x_rpc.c +++ b/subsys/mpsl/cx/nrf700x/mpsl_cx_nrf700x_rpc.c @@ -87,9 +87,8 @@ static void err_handler(const struct nrf_rpc_err_report *report) k_oops(); } -static int serialization_init(const struct device *dev) +static int serialization_init(void) { - ARG_UNUSED(dev); return nrf_rpc_init(err_handler); } diff --git a/subsys/mpsl/cx/thread/mpsl_cx_thread.c b/subsys/mpsl/cx/thread/mpsl_cx_thread.c index 7e4731e36ddf..b6463bfe5ac0 100644 --- a/subsys/mpsl/cx/thread/mpsl_cx_thread.c +++ b/subsys/mpsl/cx/thread/mpsl_cx_thread.c @@ -176,9 +176,8 @@ static const mpsl_cx_interface_t m_mpsl_cx_methods = { .p_register_callback = register_callback, }; -static int mpsl_cx_init(const struct device *dev) +static int mpsl_cx_init(void) { - ARG_UNUSED(dev); int32_t ret; @@ -219,7 +218,7 @@ static int mpsl_cx_init(const struct device *dev) SYS_INIT(mpsl_cx_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #else // !defined(CONFIG_MPSL_CX_PIN_FORWARDER) -static int mpsl_cx_init(const struct device *dev) +static int mpsl_cx_init(void) { #if DT_NODE_HAS_PROP(CX_NODE, req_gpios) uint8_t req_pin = NRF_DT_GPIOS_TO_PSEL(CX_NODE, req_gpios); diff --git a/subsys/mpsl/fem/api_init/mpsl_fem_api_init.c b/subsys/mpsl/fem/api_init/mpsl_fem_api_init.c index c1f3e456a3ac..8f858eaf262a 100644 --- a/subsys/mpsl/fem/api_init/mpsl_fem_api_init.c +++ b/subsys/mpsl/fem/api_init/mpsl_fem_api_init.c @@ -7,9 +7,8 @@ #include #include -static int mpsl_fem_api_init(const struct device *dev) +static int mpsl_fem_api_init(void) { - ARG_UNUSED(dev); mpsl_fem_init(); diff --git a/subsys/mpsl/fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c b/subsys/mpsl/fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c index abd4ea52f156..89a23cb897c8 100644 --- a/subsys/mpsl/fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c +++ b/subsys/mpsl/fem/nrf21540_gpio/mpsl_fem_nrf21540_gpio.c @@ -198,9 +198,8 @@ static int fem_nrf21540_gpio_configure(void) return mpsl_fem_nrf21540_gpio_interface_config_set(&cfg); } -static int mpsl_fem_init(const struct device *dev) +static int mpsl_fem_init(void) { - ARG_UNUSED(dev); #if IS_ENABLED(CONFIG_MPSL_FEM_POWER_MODEL) int err; @@ -222,9 +221,8 @@ SYS_INIT(mpsl_fem_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #else /* !defined(CONFIG_MPSL_FEM_PIN_FORWARDER) */ -static int mpsl_fem_host_init(const struct device *dev) +static int mpsl_fem_host_init(void) { - ARG_UNUSED(dev); #if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), tx_en_gpios) uint8_t tx_en_pin = NRF_DT_GPIOS_TO_PSEL(DT_NODELABEL(nrf_radio_fem), tx_en_gpios); diff --git a/subsys/mpsl/fem/nrf21540_gpio_spi/models/mpsl_fem_nrf21540_power_model_builtin.c b/subsys/mpsl/fem/nrf21540_gpio_spi/models/mpsl_fem_nrf21540_power_model_builtin.c index df0b8c6e5f57..552896da1fde 100644 --- a/subsys/mpsl/fem/nrf21540_gpio_spi/models/mpsl_fem_nrf21540_power_model_builtin.c +++ b/subsys/mpsl/fem/nrf21540_gpio_spi/models/mpsl_fem_nrf21540_power_model_builtin.c @@ -43,7 +43,7 @@ static void model_update_timeout(struct k_timer *dummy) K_TIMER_DEFINE(model_update_timer, model_update_timeout, NULL); -static int model_periodic_update_start(const struct device *unused) +static int model_periodic_update_start(void) { /* Perform initial model update */ k_work_submit(&model_update_work); diff --git a/subsys/mpsl/fem/nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c b/subsys/mpsl/fem/nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c index d77dd94c73e7..936bc9edacd9 100644 --- a/subsys/mpsl/fem/nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c +++ b/subsys/mpsl/fem/nrf21540_gpio_spi/mpsl_fem_nrf21540_gpio_spi.c @@ -306,9 +306,8 @@ static int fem_nrf21540_gpio_spi_configure(void) return err; } -static int mpsl_fem_init(const struct device *dev) +static int mpsl_fem_init(void) { - ARG_UNUSED(dev); mpsl_fem_device_config_254_apply_set(IS_ENABLED(CONFIG_MPSL_FEM_DEVICE_CONFIG_254)); diff --git a/subsys/mpsl/fem/simple_gpio/mpsl_fem_simple_gpio.c b/subsys/mpsl/fem/simple_gpio/mpsl_fem_simple_gpio.c index 8344aff17b71..184497e8f727 100644 --- a/subsys/mpsl/fem/simple_gpio/mpsl_fem_simple_gpio.c +++ b/subsys/mpsl/fem/simple_gpio/mpsl_fem_simple_gpio.c @@ -116,9 +116,8 @@ static int fem_simple_gpio_configure(void) return mpsl_fem_simple_gpio_interface_config_set(&cfg); } -static int mpsl_fem_init(const struct device *dev) +static int mpsl_fem_init(void) { - ARG_UNUSED(dev); #if IS_ENABLED(CONFIG_MPSL_FEM_POWER_MODEL) int err; @@ -140,9 +139,8 @@ SYS_INIT(mpsl_fem_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #else /* !defined(CONFIG_MPSL_FEM_PIN_FORWARDER) */ -static int mpsl_fem_host_init(const struct device *dev) +static int mpsl_fem_host_init(void) { - ARG_UNUSED(dev); #if DT_NODE_HAS_PROP(DT_NODELABEL(nrf_radio_fem), ctx_gpios) uint8_t ctx_pin = NRF_DT_GPIOS_TO_PSEL(DT_NODELABEL(nrf_radio_fem), ctx_gpios); diff --git a/subsys/mpsl/init/mpsl_init.c b/subsys/mpsl/init/mpsl_init.c index 7562958fc40e..8f958d825964 100644 --- a/subsys/mpsl/init/mpsl_init.c +++ b/subsys/mpsl/init/mpsl_init.c @@ -235,9 +235,8 @@ static int32_t mpsl_lib_init_internal(void) return 0; } -static int mpsl_lib_init_sys(const struct device *dev) +static int mpsl_lib_init_sys(void) { - ARG_UNUSED(dev); int err = 0; err = mpsl_lib_init_internal(); @@ -275,9 +274,8 @@ static int mpsl_lib_init_sys(const struct device *dev) return 0; } -static int mpsl_low_prio_init(const struct device *dev) +static int mpsl_low_prio_init(void) { - ARG_UNUSED(dev); k_work_queue_start(&mpsl_work_q, mpsl_work_stack, K_THREAD_STACK_SIZEOF(mpsl_work_stack), diff --git a/subsys/net/lib/download_client/src/shell.c b/subsys/net/lib/download_client/src/shell.c index 55e096f2a8db..645812e86a2c 100644 --- a/subsys/net/lib/download_client/src/shell.c +++ b/subsys/net/lib/download_client/src/shell.c @@ -57,7 +57,7 @@ static int callback(const struct download_client_evt *event) return 0; } -static int download_shell_init(const struct device *d) +static int download_shell_init(void) { return download_client_init(&downloader, callback); } diff --git a/subsys/net/lib/lwm2m_client_utils/location/location_wifi_ap_scanner.c b/subsys/net/lib/lwm2m_client_utils/location/location_wifi_ap_scanner.c index 402a2a08ebdb..c750701d3a71 100644 --- a/subsys/net/lib/lwm2m_client_utils/location/location_wifi_ap_scanner.c +++ b/subsys/net/lib/lwm2m_client_utils/location/location_wifi_ap_scanner.c @@ -111,7 +111,7 @@ int lwm2m_wifi_request_scan(void) return ret; } -static int lwm2m_wifi_scan_init(const struct device *dev) +static int lwm2m_wifi_scan_init(void) { const struct device *wifi_dev; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/ecid_signal_meas_info.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/ecid_signal_meas_info.c index 30aafec0069e..0fc3034ba84e 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/ecid_signal_meas_info.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/ecid_signal_meas_info.c @@ -204,7 +204,7 @@ static struct lwm2m_engine_obj_inst *signal_meas_info_create(uint16_t obj_inst_i return &inst[index]; } -static int lwm2m_signal_meas_info_init(const struct device *dev) +static int lwm2m_signal_meas_info_init(void) { int ret = 0; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/gnss_assistance_obj.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/gnss_assistance_obj.c index 961032fe4585..f6072ad50973 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/gnss_assistance_obj.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/gnss_assistance_obj.c @@ -363,7 +363,7 @@ static struct lwm2m_engine_obj_inst *gnss_assist_create(uint16_t obj_inst_id) return &inst; } -static int lwm2m_gnss_assist_init(const struct device *dev) +static int lwm2m_gnss_assist_init(void) { struct lwm2m_engine_obj_inst *obj_inst = NULL; int ret = 0; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/ground_fix_obj.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/ground_fix_obj.c index 5d374d3ce915..1fc4b7da6502 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/ground_fix_obj.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/ground_fix_obj.c @@ -102,7 +102,7 @@ static struct lwm2m_engine_obj_inst *ground_fix_create(uint16_t obj_inst_id) return &inst; } -static int lwm2m_ground_fix_init(const struct device *dev) +static int lwm2m_ground_fix_init(void) { struct lwm2m_engine_obj_inst *obj_inst = NULL; int ret = 0; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_adv_firmware.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_adv_firmware.c index 6f0d0bc65ce9..5dab85cce7de 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_adv_firmware.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_adv_firmware.c @@ -559,7 +559,7 @@ int lwm2m_adv_firmware_create_inst(const char *component, lwm2m_engine_set_data_ return ret; } -static int lwm2m_adv_firmware_init(const struct device *dev) +static int lwm2m_adv_firmware_init(void) { /* Set default values */ firmware.obj_id = LWM2M_OBJECT_ADV_FIRMWARE_ID; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_cellconn_obj.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_cellconn_obj.c index 70e40cc37b3c..8563012138d7 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_cellconn_obj.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_cellconn_obj.c @@ -150,7 +150,7 @@ static struct lwm2m_engine_obj_inst *cellconn_create(uint16_t obj_inst_id) return &inst; } -static int lwm2m_cellconn_init(const struct device *dev) +static int lwm2m_cellconn_init(void) { cellconn.obj_id = LWM2M_OBJECT_CELLULAR_CONNECTIVITY_ID; cellconn.version_major = CELLCONN_VERSION_MAJOR; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_connmon.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_connmon.c index f63f2dd2caf7..2b8433589bb9 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_connmon.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_connmon.c @@ -194,7 +194,7 @@ static void connmon_lte_notify_handler(const struct lte_lc_evt *const evt) } } -int lwm2m_init_connmon(const struct device *dev) +int lwm2m_init_connmon(void) { int ret; diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/visible_wifi_ap.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/visible_wifi_ap.c index bf6ba093234c..5b676e133e07 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/visible_wifi_ap.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/visible_wifi_ap.c @@ -106,7 +106,7 @@ static struct lwm2m_engine_obj_inst *visible_wifi_ap_create(uint16_t obj_inst_id return &inst[index]; } -static int lwm2m_visible_wifi_ap_init(const struct device *dev) +static int lwm2m_visible_wifi_ap_init(void) { int ret = 0; diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials.c b/subsys/net/lib/wifi_credentials/wifi_credentials.c index cfdf48ccb50b..2d97621f6911 100644 --- a/subsys/net/lib/wifi_credentials/wifi_credentials.c +++ b/subsys/net/lib/wifi_credentials/wifi_credentials.c @@ -67,9 +67,8 @@ static inline ssize_t lookup_unused_idx(void) return -1; } -static int init(const struct device *dev) +static int init(void) { - ARG_UNUSED(dev); int ret; diff --git a/subsys/shell/shell_ipc.c b/subsys/shell/shell_ipc.c index e9ab5cc05182..f991f3059cde 100644 --- a/subsys/shell/shell_ipc.c +++ b/subsys/shell/shell_ipc.c @@ -170,9 +170,8 @@ static const struct shell_transport_api shell_ipc_transport_api = { .read = read, }; -static int enable_shell_ipc(const struct device *arg) +static int enable_shell_ipc(void) { - ARG_UNUSED(arg); const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_ipc)); bool log_backend = CONFIG_SHELL_IPC_INIT_LOG_LEVEL > 0; diff --git a/tests/lib/location/src/location_test.c b/tests/lib/location/src/location_test.c index d952ab148281..12f6d6eb2f88 100644 --- a/tests/lib/location/src/location_test.c +++ b/tests/lib/location/src/location_test.c @@ -943,7 +943,7 @@ void test_location_cellular_periodic(void) } /* This is needed because AT Monitor library is initialized in SYS_INIT. */ -static int location_test_sys_init(const struct device *unused) +static int location_test_sys_init(void) { __cmock_nrf_modem_at_notif_handler_set_ExpectAnyArgsAndReturn(0); diff --git a/tests/lib/lte_lc_api/src/lte_lc_api_test.c b/tests/lib/lte_lc_api/src/lte_lc_api_test.c index 168a7de32e60..099ea0745096 100644 --- a/tests/lib/lte_lc_api/src/lte_lc_api_test.c +++ b/tests/lib/lte_lc_api/src/lte_lc_api_test.c @@ -50,7 +50,7 @@ void tearDown(void) } /* This is needed because AT Monitor library is initialized in SYS_INIT. */ -static int sys_init_helper(const struct device *unused) +static int sys_init_helper(void) { __cmock_nrf_modem_at_notif_handler_set_ExpectAnyArgsAndReturn(0); diff --git a/tests/lib/sms/src/sms_test.c b/tests/lib/sms/src/sms_test.c index 51a533b0468f..cae5beca95c6 100644 --- a/tests/lib/sms/src/sms_test.c +++ b/tests/lib/sms/src/sms_test.c @@ -1774,7 +1774,7 @@ void test_recv_loop(void) } /* This is needed because AT Monitor library is initialized in SYS_INIT. */ -static int sms_test_sys_init(const struct device *unused) +static int sms_test_sys_init(void) { __cmock_nrf_modem_at_notif_handler_set_ExpectAnyArgsAndReturn(0); diff --git a/tests/subsys/bluetooth/fast_pair/storage/account_key_storage/src/settings_mock.c b/tests/subsys/bluetooth/fast_pair/storage/account_key_storage/src/settings_mock.c index 972fa787a143..f0d49f069331 100644 --- a/tests/subsys/bluetooth/fast_pair/storage/account_key_storage/src/settings_mock.c +++ b/tests/subsys/bluetooth/fast_pair/storage/account_key_storage/src/settings_mock.c @@ -143,9 +143,8 @@ static struct settings_store settings_mock_store = { .cs_itf = &settings_mock_itf }; -int settings_mock_init(const struct device *unused) +int settings_mock_init(void) { - ARG_UNUSED(unused); sys_slist_init(&settings_list); settings_dst_register(&settings_mock_store); diff --git a/tests/subsys/net/lib/lwm2m_client_utils/src/connmon.c b/tests/subsys/net/lib/lwm2m_client_utils/src/connmon.c index e881fb43a7ee..a8777fbe9cba 100644 --- a/tests/subsys/net/lib/lwm2m_client_utils/src/connmon.c +++ b/tests/subsys/net/lib/lwm2m_client_utils/src/connmon.c @@ -128,7 +128,7 @@ ZTEST(lwm2m_client_utils_connmon, test_modem_info_init_fail) setup(); modem_info_init_fake.return_val = -1; - rc = lwm2m_init_connmon(NULL); + rc = lwm2m_init_connmon(); zassert_equal(modem_info_init_fake.call_count, 1, "Modem info init not called"); zassert_equal(rc, modem_info_init_fake.return_val, "wrong return value"); } @@ -140,7 +140,7 @@ ZTEST(lwm2m_client_utils_connmon, test_modem_info_params_init_fail) setup(); modem_info_params_init_fake.return_val = -2; - rc = lwm2m_init_connmon(NULL); + rc = lwm2m_init_connmon(); zassert_equal(modem_info_params_init_fake.call_count, 1, "Info params init not called"); zassert_equal(rc, modem_info_params_init_fake.return_val, "wrong return value"); } @@ -149,7 +149,7 @@ ZTEST(lwm2m_client_utils_connmon, test_init) { setup(); - lwm2m_init_connmon(NULL); + lwm2m_init_connmon(); zassert_equal(lte_lc_register_handler_fake.call_count, 1); } @@ -165,7 +165,7 @@ ZTEST(lwm2m_client_utils_connmon, test_connected) lwm2m_set_s8_fake.custom_fake = set_s8_custom_fake; modem_info_params_get_fake.custom_fake = copy_modem_info; modem_info_rsrp_register_fake.custom_fake = copy_rsrp_handler; - lwm2m_init_connmon(NULL); + lwm2m_init_connmon(); evt.type = LTE_LC_EVT_NW_REG_STATUS; evt.nw_reg_status = LTE_LC_NW_REG_REGISTERED_HOME; handler(&evt); @@ -191,7 +191,7 @@ ZTEST(lwm2m_client_utils_connmon, test_update_disconnected) lte_lc_register_handler_fake.custom_fake = copy_event_handler; lwm2m_set_string_fake.custom_fake = set_string_custom_fake; modem_info_params_get_fake.custom_fake = copy_modem_info; - lwm2m_init_connmon(NULL); + lwm2m_init_connmon(); evt.type = LTE_LC_EVT_CELL_UPDATE; handler(&evt); k_sleep(K_MSEC(100)); @@ -208,7 +208,7 @@ ZTEST(lwm2m_client_utils_connmon, test_update) lte_lc_register_handler_fake.custom_fake = copy_event_handler; lwm2m_set_string_fake.custom_fake = set_string_custom_fake; modem_info_params_get_fake.custom_fake = copy_modem_info; - lwm2m_init_connmon(NULL); + lwm2m_init_connmon(); evt.type = LTE_LC_EVT_NW_REG_STATUS; evt.nw_reg_status = LTE_LC_NW_REG_REGISTERED_HOME; handler(&evt); @@ -237,7 +237,7 @@ ZTEST(lwm2m_client_utils_connmon, test_lte_mode_update) lte_lc_register_handler_fake.custom_fake = copy_event_handler; lwm2m_set_u8_fake.custom_fake = set_u8_custom_fake; - lwm2m_init_connmon(NULL); + lwm2m_init_connmon(); evt.type = LTE_LC_EVT_LTE_MODE_UPDATE; evt.lte_mode = lte_mode; handler(&evt); diff --git a/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c b/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c index ac9cefb9522c..4ab00f797207 100644 --- a/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c +++ b/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c @@ -47,7 +47,7 @@ static struct nrf_modem_gnss_agps_data_frame agps_req = { static struct lwm2m_ctx client_ctx; -static int suite_setup(const struct device *dev) +static int suite_setup(void) { lwm2m_register_obj_fake.custom_fake = fake_lwm2m_register_obj; From 3fc220dfc135097ffeea9d1b997593c94ab538fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Mon, 17 Apr 2023 14:38:45 -0700 Subject: [PATCH 03/47] treewide: it's int main(void) now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zephyr commit fc076f5a1deef390f4c988985a0036c2fdda40f5 ("kernel: Switch main return type from void to int") was part of a larger effort towards switching the return type of main from void to int in order to comply with the C standard. This churn in turn is forward progress towards making picolibc, which also expects this, the default C library for Zephyr. Update main() functions in NCS accordingly. Signed-off-by: Martí Bolívar --- applications/asset_tracker_v2/src/main.c | 3 ++- .../debug_module/src/debug_module_test.c | 8 ++++--- .../src/location_module_test.c | 8 ++++--- .../src/lwm2m_codec_helpers_test.c | 7 +++++- .../src/lwm2m_integration_test.c | 7 +++++- .../src/nrf_cloud_codec_test.c | 9 ++++---- .../src/nrf_cloud_codec_mocked_test.c | 9 ++++---- .../tests/ui_module/src/ui_module_test.c | 8 ++++--- applications/connectivity_bridge/src/main.c | 3 ++- applications/machine_learning/src/main.c | 3 ++- applications/nrf5340_audio/src/main.c | 2 +- applications/nrf_desktop/src/main.c | 3 ++- .../zigbee_weather_station/src/main.c | 4 +++- doc/nrf/libraries/modem/lte_lc.rst | 23 ++++++++++--------- samples/app_event_manager/src/main.c | 3 ++- .../src/main.c | 3 ++- .../central_and_peripheral_hr/src/main.c | 16 ++++++------- samples/bluetooth/central_bas/src/main.c | 13 ++++++----- samples/bluetooth/central_hids/src/main.c | 13 ++++++----- samples/bluetooth/central_hr_coded/src/main.c | 9 ++++---- .../bluetooth/central_nfc_pairing/src/main.c | 12 +++++----- .../bluetooth/central_smp_client/src/main.c | 9 ++++---- samples/bluetooth/central_uart/src/main.c | 16 ++++++------- samples/bluetooth/direct_test_mode/src/main.c | 2 +- .../direction_finding_central/src/main.c | 5 ++-- .../src/main.c | 8 +++---- .../src/main.c | 18 ++++++++------- .../direction_finding_peripheral/src/main.c | 6 +++-- samples/bluetooth/enocean/src/main.c | 10 ++++---- samples/bluetooth/llpm/src/main.c | 14 +++++------ .../mesh/ble_peripheral_lbs_coex/src/main.c | 4 +++- samples/bluetooth/mesh/chat/src/main.c | 4 +++- samples/bluetooth/mesh/light/src/main.c | 4 +++- samples/bluetooth/mesh/light_ctrl/src/main.c | 4 +++- .../bluetooth/mesh/light_switch/src/main.c | 4 +++- .../bluetooth/mesh/sensor_client/src/main.c | 4 +++- .../bluetooth/mesh/sensor_server/src/main.c | 4 +++- .../bluetooth/mesh/silvair_enocean/src/main.c | 4 +++- .../bluetooth/multiple_adv_sets/src/main.c | 10 ++++---- samples/bluetooth/nrf_dm/src/main.c | 14 +++++------ .../peripheral_ams_client/src/main.c | 16 ++++++------- .../peripheral_ancs_client/src/main.c | 18 +++++++-------- samples/bluetooth/peripheral_bms/src/main.c | 14 +++++------ samples/bluetooth/peripheral_cgms/src/main.c | 8 +++---- .../peripheral_cts_client/src/main.c | 16 ++++++------- .../bluetooth/peripheral_fast_pair/src/main.c | 22 +++++++++--------- .../bluetooth/peripheral_gatt_dm/src/main.c | 12 ++++++---- .../peripheral_hids_keyboard/src/main.c | 8 +++---- .../peripheral_hids_mouse/src/main.c | 8 +++---- .../bluetooth/peripheral_hr_coded/src/main.c | 8 +++---- samples/bluetooth/peripheral_lbs/src/main.c | 16 ++++++------- samples/bluetooth/peripheral_mds/src/main.c | 18 +++++++-------- .../peripheral_nfc_pairing/src/main.c | 12 +++++----- .../peripheral_power_profiling/src/main.c | 22 +++++++++--------- samples/bluetooth/peripheral_rscs/src/main.c | 14 +++++------ .../bluetooth/peripheral_status/src/main.c | 14 +++++------ samples/bluetooth/peripheral_uart/src/main.c | 10 ++++---- samples/bluetooth/radio_coex_1wire/src/main.c | 6 ++--- samples/bluetooth/rpc_host/src/main.c | 4 +++- samples/bluetooth/shell_bt_nus/src/main.c | 13 ++++++----- samples/bluetooth/throughput/src/main.c | 8 ++++--- samples/bootloader/src/main.c | 6 ++--- samples/caf/src/main.c | 4 +++- samples/caf_sensor_manager/remote/src/main.c | 8 ++++--- samples/caf_sensor_manager/src/main.c | 8 ++++--- samples/debug/ppi_trace/src/main.c | 4 +++- .../edge_impulse/data_forwarder/src/main.c | 6 +++-- samples/edge_impulse/wrapper/src/main.c | 14 ++++++----- samples/esb/prx/src/main.c | 14 +++++------ samples/esb/ptx/src/main.c | 8 +++---- samples/event_manager_proxy/remote/src/main.c | 12 ++++++---- samples/event_manager_proxy/src/main.c | 15 ++++++------ .../gazell/gzll_ack_payload_device/src/main.c | 16 ++++++------- .../gazell/gzll_ack_payload_host/src/main.c | 16 ++++++------- .../gzp_dynamic_pairing_device/src/main.c | 12 +++++----- .../gzp_dynamic_pairing_host/src/main.c | 14 +++++------ samples/hw_id/src/main.c | 6 +++-- samples/keys/hw_unique_key/src/main.c | 16 +++++++------ .../keys/identity_key_generation/src/main.c | 8 ++++--- samples/keys/identity_key_usage/src/main.c | 18 ++++++++------- samples/keys/random_hw_unique_key/src/main.c | 4 +++- samples/mpsl/timeslot/src/main.c | 2 +- samples/nfc/system_off/src/main.c | 7 +++--- samples/nfc/tag_reader/src/main.c | 10 ++++---- samples/nfc/tnep_poller/src/main.c | 12 +++++----- samples/nfc/tnep_tag/src/main.c | 14 +++++------ samples/nrf5340/empty_app_core/src/main.c | 4 +++- samples/nrf5340/empty_net_core/src/main.c | 4 ++-- .../nrf5340/multiprotocol_rpmsg/src/main.c | 2 +- samples/nrf5340/netboot/src/main.c | 7 +++--- samples/nrf5340/remote_shell/src/main.c | 8 +++---- samples/nrf9160/at_client/src/main.c | 6 +++-- samples/nrf9160/at_monitor/src/main.c | 17 +++++++------- samples/nrf9160/aws_iot/src/main.c | 10 ++++---- samples/nrf9160/azure_fota/src/main.c | 12 ++++++---- samples/nrf9160/azure_iot_hub/src/main.c | 13 ++++++----- samples/nrf9160/ciphersuites/src/main.c | 12 ++++++---- samples/nrf9160/coap_client/src/main.c | 10 ++++---- samples/nrf9160/download/src/main.c | 16 +++++++------ samples/nrf9160/fmfu_smp_svr/src/main.c | 4 +++- .../http_update/application_update/src/main.c | 10 ++++---- .../http_update/full_modem_update/src/main.c | 16 +++++++------ .../http_update/modem_delta_update/src/main.c | 10 ++++---- samples/nrf9160/https_client/src/main.c | 14 ++++++----- samples/nrf9160/lte_ble_gateway/src/main.c | 4 +++- samples/nrf9160/lwm2m_carrier/src/main.c | 3 ++- samples/nrf9160/lwm2m_client/src/main.c | 18 ++++++++------- samples/nrf9160/memfault/src/main.c | 2 +- samples/nrf9160/modem_callbacks/src/main.c | 8 ++++--- samples/nrf9160/modem_shell/src/main.c | 14 ++++++----- .../nrf9160/modem_trace_backend/src/main.c | 10 ++++---- samples/nrf9160/modem_trace_flash/src/main.c | 8 ++++--- samples/nrf9160/nidd/src/main.c | 4 +++- .../nrf_cloud_mqtt_multi_service/src/main.c | 3 ++- .../nrf_cloud_rest_cell_location/src/main.c | 4 ++-- .../nrf_cloud_rest_device_message/src/main.c | 6 ++--- .../nrf9160/nrf_cloud_rest_fota/src/main.c | 6 ++--- samples/nrf9160/pdn/src/main.c | 18 ++++++++------- samples/nrf9160/slm_shell/src/main.c | 3 ++- samples/nrf9160/sms/src/main.c | 9 ++++---- samples/nrf9160/udp/src/main.c | 8 ++++--- samples/nrf_profiler/src/main.c | 4 ++-- .../nrf_rpc/entropy_nrf53/cpuapp/src/main.c | 4 ++-- .../nrf_rpc/entropy_nrf53/cpunet/src/main.c | 3 ++- samples/openthread/cli/src/main.c | 8 ++++--- .../openthread/coap_client/src/coap_client.c | 10 ++++---- .../openthread/coap_server/src/coap_server.c | 4 ++-- samples/openthread/coprocessor/src/main.c | 3 ++- samples/peripheral/lpuart/src/main.c | 4 +++- samples/peripheral/radio_test/src/main.c | 4 +++- samples/sensor/bh1749/src/main.c | 6 +++-- samples/tfm/provisioning_image/src/main.c | 18 ++++++++------- .../provisioning_image_net_core/src/main.c | 6 +++-- samples/tfm/tfm_hello_world/src/main.c | 4 +++- samples/tfm/tfm_psa_template/src/main.c | 2 +- samples/tfm/tfm_secure_peripheral/src/main.c | 4 +++- samples/wifi/provisioning/src/main.c | 10 ++++---- .../radio_test/src/nrf_wifi_radio_test_main.c | 3 ++- samples/wifi/scan/src/main.c | 4 +++- samples/wifi/shell/src/wifi_main.c | 4 +++- samples/wifi/sta/src/main.c | 8 ++++--- samples/zigbee/light_bulb/src/main.c | 2 +- samples/zigbee/light_switch/src/main.c | 2 +- samples/zigbee/network_coordinator/src/main.c | 2 +- samples/zigbee/shell/src/main.c | 4 +++- samples/zigbee/template/src/main.c | 4 +++- tests/bluetooth/tester/src/main.c | 4 +++- tests/lib/hw_id/src/main.c | 8 ++++++- tests/lib/location/src/location_test.c | 10 ++++---- tests/lib/lte_lc_api/src/lte_lc_api_test.c | 10 ++++---- tests/lib/modem_info/src/main.c | 8 ++++++- tests/lib/modem_jwt/src/jwt_test.c | 8 ++++++- .../nrf91_sockets/src/nrf91_sockets_test.c | 10 ++++---- .../nrf_modem_lib_trace/src/main.c | 8 ++++++- .../trace_backends/rtt/src/main.c | 8 ++++++- .../trace_backends/uart/src/main.c | 8 ++++++- tests/lib/qos/src/qos_test.c | 8 ++++++- tests/lib/sms/src/sms_test.c | 10 ++++---- tests/subsys/bluetooth/mesh/models/src/main.c | 4 +++- .../subsys/bootloader/boot_chains/src/main.c | 4 +++- .../subsys/event_manager_proxy/remote/main.c | 10 ++++---- .../dps/src/azure_iot_hub_dps_test.c | 8 ++++++- .../iot_hub/src/azure_iot_hub_test.c | 8 ++++++- .../lib/mqtt_helper/src/mqtt_helper_test.c | 8 ++++++- .../net/lib/wifi_credentials/src/main.c | 8 ++++++- .../wifi_credentials_backend_psa/src/main.c | 8 ++++++- .../src/main.c | 8 ++++++- tests/tfm/tfm_psa_test/src/main.c | 4 +++- tests/tfm/tfm_regression_test/src/main.c | 4 +++- tests/unity/example_test/src/example_test.c | 10 ++++---- tests/unity/wrap_test/src/wrap_test.c | 10 ++++---- 171 files changed, 863 insertions(+), 592 deletions(-) diff --git a/applications/asset_tracker_v2/src/main.c b/applications/asset_tracker_v2/src/main.c index a0151b08f607..3c5638d3d0cc 100644 --- a/applications/asset_tracker_v2/src/main.c +++ b/applications/asset_tracker_v2/src/main.c @@ -500,7 +500,7 @@ static void on_all_events(struct app_msg_data *msg) } } -void main(void) +int main(void) { int err; struct app_msg_data msg = { 0 }; @@ -566,6 +566,7 @@ void main(void) on_all_events(&msg); } + return 0; } APP_EVENT_LISTENER(MODULE, app_event_handler); diff --git a/applications/asset_tracker_v2/tests/debug_module/src/debug_module_test.c b/applications/asset_tracker_v2/tests/debug_module/src/debug_module_test.c index fb2ff72bc599..def78d8c58c3 100644 --- a/applications/asset_tracker_v2/tests/debug_module/src/debug_module_test.c +++ b/applications/asset_tracker_v2/tests/debug_module/src/debug_module_test.c @@ -48,8 +48,9 @@ struct event_type __event_type_sensor_module_event; struct event_type __event_type_ui_module_event; struct event_type __event_type_util_module_event; -/* The following is required because unity is using a different main signature - * (returns int) and zephyr expects main to not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); @@ -267,7 +268,8 @@ void test_memfault_software_watchdog_trigger_on_callback(void) evt.type = WATCHDOG_EVT_FEED; } -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/location_module/src/location_module_test.c b/applications/asset_tracker_v2/tests/location_module/src/location_module_test.c index 0327f02fc6fd..89f69cc2a97f 100644 --- a/applications/asset_tracker_v2/tests/location_module/src/location_module_test.c +++ b/applications/asset_tracker_v2/tests/location_module/src/location_module_test.c @@ -71,8 +71,9 @@ struct event_type __event_type_modem_module_event; /* Dummy functions and objects - End. */ -/* The following is required because unity is using a different main signature - * (returns int) and zephyr expects main to not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); @@ -522,7 +523,8 @@ void test_location_fail_init(void) TEST_ASSERT_EQUAL(0, ret); } -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/lwm2m_codec_helpers/src/lwm2m_codec_helpers_test.c b/applications/asset_tracker_v2/tests/lwm2m_codec_helpers/src/lwm2m_codec_helpers_test.c index 5327ccb1252a..c15465de581a 100644 --- a/applications/asset_tracker_v2/tests/lwm2m_codec_helpers/src/lwm2m_codec_helpers_test.c +++ b/applications/asset_tracker_v2/tests/lwm2m_codec_helpers/src/lwm2m_codec_helpers_test.c @@ -33,6 +33,10 @@ /* Mon Dec 05 2022 09:38:04 */ #define UNIX_TIMESTAMP_DUMMY 1670233084418 +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); /* Used to verify that the uut properly sets the value that is returned by date_time_now() to @@ -853,7 +857,8 @@ void test_codec_helpers_object_path_list_generate_too_many_paths(void) ARRAY_SIZE(path_list))); } -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c b/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c index ab6ca834a253..59ddd5ebfa04 100644 --- a/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c +++ b/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c @@ -48,6 +48,10 @@ static int init_security_callback_stub(struct lwm2m_ctx *ctx, static int init_firmware_cb_stub(lwm2m_firmware_event_cb_t cb, int no_of_calls); +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); /* Setup and teardown functions. */ @@ -381,7 +385,8 @@ void test_lwm2m_integration_fota_update_image_req(void) TEST_ASSERT_EQUAL(UINT8_MAX, last_cb_type); } -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/nrf_cloud_codec/src/nrf_cloud_codec_test.c b/applications/asset_tracker_v2/tests/nrf_cloud_codec/src/nrf_cloud_codec_test.c index 87ba4a92c5a7..fa15d83bc03c 100644 --- a/applications/asset_tracker_v2/tests/nrf_cloud_codec/src/nrf_cloud_codec_test.c +++ b/applications/asset_tracker_v2/tests/nrf_cloud_codec/src/nrf_cloud_codec_test.c @@ -627,13 +627,14 @@ void test_enc_batch_data_ui_toobig(void) } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/nrf_cloud_codec_mocked_cjson/src/nrf_cloud_codec_mocked_test.c b/applications/asset_tracker_v2/tests/nrf_cloud_codec_mocked_cjson/src/nrf_cloud_codec_mocked_test.c index 2972085f7770..19aba0aa1fd9 100644 --- a/applications/asset_tracker_v2/tests/nrf_cloud_codec_mocked_cjson/src/nrf_cloud_codec_mocked_test.c +++ b/applications/asset_tracker_v2/tests/nrf_cloud_codec_mocked_cjson/src/nrf_cloud_codec_mocked_test.c @@ -553,13 +553,14 @@ void test_enc_config_nomem1(void) TEST_ASSERT_EQUAL(-ENOMEM, ret); } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.c b/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.c index c423cf2fda48..7903cd5d9fe9 100644 --- a/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.c +++ b/applications/asset_tracker_v2/tests/ui_module/src/ui_module_test.c @@ -62,8 +62,9 @@ struct event_type __event_type_sensor_module_event; struct event_type __event_type_ui_module_event; struct event_type __event_type_util_module_event; -/* The following is required because unity is using a different main signature - * (returns int) and zephyr expects main to not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); @@ -403,7 +404,8 @@ void test_mode_transition(void) verify_publication(true); } -void main(void) +int main(void) { (void)unity_main(); + return 0; } diff --git a/applications/connectivity_bridge/src/main.c b/applications/connectivity_bridge/src/main.c index ce7101bdc2ed..81d57d67d5bb 100644 --- a/applications/connectivity_bridge/src/main.c +++ b/applications/connectivity_bridge/src/main.c @@ -28,11 +28,12 @@ uint8_t *usb_update_sn_string_descriptor(void) return usb_serial_str; } -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager not initialized"); } else { module_set_state(MODULE_STATE_READY); } + return 0; } diff --git a/applications/machine_learning/src/main.c b/applications/machine_learning/src/main.c index b42d58b40c35..fc099ce6aa6b 100644 --- a/applications/machine_learning/src/main.c +++ b/applications/machine_learning/src/main.c @@ -13,11 +13,12 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager initialization failed"); } else { module_set_state(MODULE_STATE_READY); } + return 0; } diff --git a/applications/nrf5340_audio/src/main.c b/applications/nrf5340_audio/src/main.c index 928919621bb0..864ac4750f48 100644 --- a/applications/nrf5340_audio/src/main.c +++ b/applications/nrf5340_audio/src/main.c @@ -164,7 +164,7 @@ void on_ble_core_ready(void) } } -void main(void) +int main(void) { int ret; diff --git a/applications/nrf_desktop/src/main.c b/applications/nrf_desktop/src/main.c index 4de63c2adfc8..f97cca59e91c 100644 --- a/applications/nrf_desktop/src/main.c +++ b/applications/nrf_desktop/src/main.c @@ -13,11 +13,12 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager not initialized"); } else { module_set_state(MODULE_STATE_READY); } + return 0; } diff --git a/applications/zigbee_weather_station/src/main.c b/applications/zigbee_weather_station/src/main.c index 6f67c1df686e..3001e53757aa 100644 --- a/applications/zigbee_weather_station/src/main.c +++ b/applications/zigbee_weather_station/src/main.c @@ -359,7 +359,7 @@ void zboss_signal_handler(zb_bufid_t bufid) } } -void main(void) +int main(void) { #ifdef CONFIG_USB_DEVICE_STACK wait_for_console(); @@ -389,4 +389,6 @@ void main(void) /* Start Zigbee stack */ zigbee_enable(); + + return 0; } diff --git a/doc/nrf/libraries/modem/lte_lc.rst b/doc/nrf/libraries/modem/lte_lc.rst index ed372d964884..e8be188e68d7 100644 --- a/doc/nrf/libraries/modem/lte_lc.rst +++ b/doc/nrf/libraries/modem/lte_lc.rst @@ -64,7 +64,7 @@ The following block of code shows how the link controller API can be used to est } } - void main(void) + int main(void) { int err; @@ -73,7 +73,7 @@ The following block of code shows how the link controller API can be used to est err = lte_lc_init_and_connect_async(lte_handler); if (err) { printk("lte_lc_init_and_connect_async, error: %d\n", err); - return; + return 0; } k_sem_take(<e_connected, K_FOREVER); @@ -108,32 +108,32 @@ For an example implementation, see the following code: /* ... */ - void main(void) + int main(void) { int err; err = lte_lc_init(); if (err) { printk("lte_lc_init, error: %d\n", err); - return; + return 0; } err = lte_lc_psm_req(true); if (err) { printk("lte_lc_psm_req, error: %d\n", err); - return; + return 0; } err = lte_lc_edrx_req(true); if (err) { printk("lte_lc_edrx_req, error: %d\n", err); - return; + return 0; } err = lte_lc_connect_async(lte_handler); if (err) { printk("Connecting to LTE network failed, error: %d\n", err); - return; + return 0; } /* ... */ @@ -173,7 +173,7 @@ The following code block shows a basic implementation of :c:func:`lte_lc_conn_ev ... - void main(void) + int main(void) { int err; @@ -182,7 +182,7 @@ The following code block shows a basic implementation of :c:func:`lte_lc_conn_ev err = lte_lc_init_and_connect_async(lte_handler); if (err) { printk("lte_lc_init_and_connect_async, error: %d\n", err); - return; + return 0; } k_sem_take(<e_connected, K_FOREVER); @@ -192,7 +192,7 @@ The following code block shows a basic implementation of :c:func:`lte_lc_conn_ev err = lte_lc_conn_eval_params_get(¶ms); if (err) { printk("lte_lc_conn_eval_params_get, error: %d\n", err); - return; + return 0; } /* Handle connection evaluation parameters... */ @@ -247,10 +247,11 @@ The following code snippet shows how to use :c:macro:`LTE_LC_ON_CFUN` macro: printk("Functional mode changed to %d\n", mode); } - void main(void) + int main(void) { /* change functional mode using the Link Controller API */ lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL); + return 0; } API documentation diff --git a/samples/app_event_manager/src/main.c b/samples/app_event_manager/src/main.c index da99fb95e61f..19c68475bcad 100644 --- a/samples/app_event_manager/src/main.c +++ b/samples/app_event_manager/src/main.c @@ -14,7 +14,7 @@ LOG_MODULE_REGISTER(MODULE); #define INIT_VALUE1 3 -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager not initialized"); @@ -24,4 +24,5 @@ void main(void) event->init_value1 = INIT_VALUE1; APP_EVENT_SUBMIT(event); } + return 0; } diff --git a/samples/app_event_manager_profiler_tracer/src/main.c b/samples/app_event_manager_profiler_tracer/src/main.c index 88996046b706..c3c1e49861b3 100644 --- a/samples/app_event_manager_profiler_tracer/src/main.c +++ b/samples/app_event_manager_profiler_tracer/src/main.c @@ -12,7 +12,7 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager not initialized"); @@ -21,4 +21,5 @@ void main(void) APP_EVENT_SUBMIT(event); } + return 0; } diff --git a/samples/bluetooth/central_and_peripheral_hr/src/main.c b/samples/bluetooth/central_and_peripheral_hr/src/main.c index 3475f5a619ac..3b436c0862a5 100644 --- a/samples/bluetooth/central_and_peripheral_hr/src/main.c +++ b/samples/bluetooth/central_and_peripheral_hr/src/main.c @@ -371,7 +371,7 @@ static void hrs_notify_thread(void) } } -void main(void) +int main(void) { int err; int blink_status = 0; @@ -381,24 +381,24 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = bt_conn_auth_cb_register(&auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_enable(NULL); if (err) { - return; + return 0; } if (IS_ENABLED(CONFIG_SETTINGS)) { @@ -408,14 +408,14 @@ void main(void) err = bt_hrs_client_init(&hrs_c); if (err) { printk("Heart Rate Service client failed to init (err %d)\n", err); - return; + return 0; } scan_init(); err = scan_start(); if (err) { - return; + return 0; } printk("Scanning started\n"); @@ -424,7 +424,7 @@ void main(void) sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising started\n"); diff --git a/samples/bluetooth/central_bas/src/main.c b/samples/bluetooth/central_bas/src/main.c index b270de7ee8aa..86cf026640a1 100644 --- a/samples/bluetooth/central_bas/src/main.c +++ b/samples/bluetooth/central_bas/src/main.c @@ -361,7 +361,7 @@ static struct bt_conn_auth_info_cb conn_auth_info_callbacks = { }; -void main(void) +int main(void) { int err; @@ -372,7 +372,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -386,26 +386,27 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = dk_buttons_init(button_handler); if (err) { printk("Failed to initialize buttons (err %d)\n", err); - return; + return 0; } err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE); if (err) { printk("Scanning failed to start (err %d)\n", err); - return; + return 0; } printk("Scanning successfully started\n"); + return 0; } diff --git a/samples/bluetooth/central_hids/src/main.c b/samples/bluetooth/central_hids/src/main.c index 18eeecbb3bee..123c61dabfe0 100644 --- a/samples/bluetooth/central_hids/src/main.c +++ b/samples/bluetooth/central_hids/src/main.c @@ -635,7 +635,7 @@ static struct bt_conn_auth_info_cb conn_auth_info_callbacks = { }; -void main(void) +int main(void) { int err; @@ -646,19 +646,19 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -672,14 +672,15 @@ void main(void) err = dk_buttons_init(button_handler); if (err) { printk("Failed to initialize buttons (err %d)\n", err); - return; + return 0; } err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE); if (err) { printk("Scanning failed to start (err %d)\n", err); - return; + return 0; } printk("Scanning successfully started\n"); + return 0; } diff --git a/samples/bluetooth/central_hr_coded/src/main.c b/samples/bluetooth/central_hr_coded/src/main.c index 8b1ebd2ae2b7..55614e2f3317 100644 --- a/samples/bluetooth/central_hr_coded/src/main.c +++ b/samples/bluetooth/central_hr_coded/src/main.c @@ -248,7 +248,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { .disconnected = disconnected, }; -void main(void) +int main(void) { int err; @@ -257,7 +257,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -265,7 +265,7 @@ void main(void) err = bt_hrs_client_init(&hrs_c); if (err) { printk("Heart Rate Service client failed to init (err %d)\n", err); - return; + return 0; } scan_init(); @@ -273,8 +273,9 @@ void main(void) err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE); if (err) { printk("Scanning failed to start (err %d)\n", err); - return; + return 0; } printk("Scanning successfully started\n"); + return 0; } diff --git a/samples/bluetooth/central_nfc_pairing/src/main.c b/samples/bluetooth/central_nfc_pairing/src/main.c index b7f80c2bd093..9a3a93b1499f 100644 --- a/samples/bluetooth/central_nfc_pairing/src/main.c +++ b/samples/bluetooth/central_nfc_pairing/src/main.c @@ -582,7 +582,7 @@ void button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int err; @@ -597,7 +597,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -611,18 +611,18 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = paring_key_generate(); if (err) { - return; + return 0; } err = nfc_tnep_ch_service_init(&ch_cb); @@ -642,7 +642,7 @@ void main(void) k_poll(events, ARRAY_SIZE(events), K_FOREVER); err = nfc_poller_process(); if (err) { - return; + return 0; } paring_key_process(); } diff --git a/samples/bluetooth/central_smp_client/src/main.c b/samples/bluetooth/central_smp_client/src/main.c index 028a893cca57..1b44eb48f76a 100644 --- a/samples/bluetooth/central_smp_client/src/main.c +++ b/samples/bluetooth/central_smp_client/src/main.c @@ -425,7 +425,7 @@ static void button_handler(uint32_t button_state, uint32_t has_changed) } -void main(void) +int main(void) { int err; @@ -436,7 +436,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -446,14 +446,15 @@ void main(void) err = dk_buttons_init(button_handler); if (err) { printk("Failed to initialize buttons (err %d)\n", err); - return; + return 0; } err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE); if (err) { printk("Scanning failed to start (err %d)\n", err); - return; + return 0; } printk("Scanning successfully started\n"); + return 0; } diff --git a/samples/bluetooth/central_uart/src/main.c b/samples/bluetooth/central_uart/src/main.c index 0ade7ea3332d..be4c1f0ae7d0 100644 --- a/samples/bluetooth/central_uart/src/main.c +++ b/samples/bluetooth/central_uart/src/main.c @@ -554,26 +554,26 @@ static struct bt_conn_auth_info_cb conn_auth_info_callbacks = { .pairing_failed = pairing_failed }; -void main(void) +int main(void) { int err; err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { LOG_ERR("Failed to register authorization callbacks."); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_enable(NULL); if (err) { LOG_ERR("Bluetooth init failed (err %d)", err); - return; + return 0; } LOG_INF("Bluetooth initialized"); @@ -584,19 +584,19 @@ void main(void) err = uart_init(); if (err != 0) { LOG_ERR("uart_init failed (err %d)", err); - return; + return 0; } err = scan_init(); if (err != 0) { LOG_ERR("scan_init failed (err %d)", err); - return; + return 0; } err = nus_client_init(); if (err != 0) { LOG_ERR("nus_client_init failed (err %d)", err); - return; + return 0; } printk("Starting Bluetooth Central UART example\n"); @@ -604,7 +604,7 @@ void main(void) err = bt_scan_start(BT_SCAN_TYPE_SCAN_ACTIVE); if (err) { LOG_ERR("Scanning failed to start (err %d)", err); - return; + return 0; } LOG_INF("Scanning successfully started"); diff --git a/samples/bluetooth/direct_test_mode/src/main.c b/samples/bluetooth/direct_test_mode/src/main.c index abbd489fad9e..6237878a9aab 100644 --- a/samples/bluetooth/direct_test_mode/src/main.c +++ b/samples/bluetooth/direct_test_mode/src/main.c @@ -10,7 +10,7 @@ #include "dtm.h" -void main(void) +int main(void) { int err; const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(ncs_dtm_uart)); diff --git a/samples/bluetooth/direction_finding_central/src/main.c b/samples/bluetooth/direction_finding_central/src/main.c index 642e31178e03..e7825ff187cf 100644 --- a/samples/bluetooth/direction_finding_central/src/main.c +++ b/samples/bluetooth/direction_finding_central/src/main.c @@ -254,17 +254,18 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { .cte_report_cb = cte_recv_cb, }; -void main(void) +int main(void) { int err; err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); start_scan(); + return 0; } diff --git a/samples/bluetooth/direction_finding_connectionless_rx/src/main.c b/samples/bluetooth/direction_finding_connectionless_rx/src/main.c index 3546124f5908..556e2960299c 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/src/main.c +++ b/samples/bluetooth/direction_finding_connectionless_rx/src/main.c @@ -308,7 +308,7 @@ static void scan_disable(void) scan_enabled = false; } -void main(void) +int main(void) { int err; @@ -333,7 +333,7 @@ void main(void) err = k_sem_take(&sem_per_adv, K_FOREVER); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success. Found periodic advertising.\n"); @@ -345,7 +345,7 @@ void main(void) printk("failed (err %d)\n", err); err = delete_sync(); if (err) { - return; + return 0; } continue; } @@ -360,7 +360,7 @@ void main(void) err = k_sem_take(&sem_per_sync_lost, K_FOREVER); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("Periodic sync lost.\n"); } diff --git a/samples/bluetooth/direction_finding_connectionless_tx/src/main.c b/samples/bluetooth/direction_finding_connectionless_tx/src/main.c index ecec25528b4a..1c146555b1c0 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/src/main.c +++ b/samples/bluetooth/direction_finding_connectionless_tx/src/main.c @@ -75,7 +75,7 @@ static void adv_sent_cb(struct bt_le_ext_adv *adv, adv, info->num_sent); } -void main(void) +int main(void) { char addr_s[BT_ADDR_LE_STR_LEN]; struct bt_le_oob oob_local; @@ -88,7 +88,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -96,7 +96,7 @@ void main(void) err = bt_le_ext_adv_create(¶m, &adv_callbacks, &adv_set); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -104,7 +104,7 @@ void main(void) err = bt_df_set_adv_cte_tx_param(adv_set, &cte_params); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -112,7 +112,7 @@ void main(void) err = bt_le_per_adv_set_param(adv_set, &per_adv_param); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -120,7 +120,7 @@ void main(void) err = bt_df_adv_cte_tx_enable(adv_set); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -128,7 +128,7 @@ void main(void) err = bt_le_per_adv_start(adv_set); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -136,7 +136,7 @@ void main(void) err = bt_le_ext_adv_start(adv_set, &ext_adv_start_param); if (err) { printk("failed (err %d)\n", err); - return; + return 0; } printk("success\n"); @@ -144,4 +144,6 @@ void main(void) bt_addr_le_to_str(&oob_local.addr, addr_s, sizeof(addr_s)); printk("Started extended advertising as %s\n", addr_s); + + return 0; } diff --git a/samples/bluetooth/direction_finding_peripheral/src/main.c b/samples/bluetooth/direction_finding_peripheral/src/main.c index 9a5bee7048a1..15c555f40ce4 100644 --- a/samples/bluetooth/direction_finding_peripheral/src/main.c +++ b/samples/bluetooth/direction_finding_peripheral/src/main.c @@ -106,15 +106,17 @@ static void bt_ready(void) printk("Advertising successfully started\n"); } -void main(void) +int main(void) { int err; err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } bt_ready(); + + return 0; } diff --git a/samples/bluetooth/enocean/src/main.c b/samples/bluetooth/enocean/src/main.c index 0ffe1fc6ad19..5415885c18a5 100644 --- a/samples/bluetooth/enocean/src/main.c +++ b/samples/bluetooth/enocean/src/main.c @@ -110,20 +110,20 @@ static void enocean_loaded(struct bt_enocean_device *device) printk("EnOcean Device loaded: %s\n", addr); } -void main(void) +int main(void) { int err; err = dk_leds_init(); if (err) { printk("Initializing dk_leds failed (err: %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } static const struct bt_enocean_callbacks enocean_callbacks = { @@ -143,10 +143,12 @@ void main(void) err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, NULL); if (err) { printk("Bluetooth scan start failed (err %d)\n", err); - return; + return 0; } bt_enocean_commissioning_enable(); printk("EnOcean sample is ready!\n"); + + return 0; } diff --git a/samples/bluetooth/llpm/src/main.c b/samples/bluetooth/llpm/src/main.c index 2c30dc634bed..abda26f4039f 100644 --- a/samples/bluetooth/llpm/src/main.c +++ b/samples/bluetooth/llpm/src/main.c @@ -420,7 +420,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { .le_param_updated = le_param_updated, }; -void main(void) +int main(void) { int err; @@ -429,7 +429,7 @@ void main(void) uint32_t dtr = 0; if (usb_enable(NULL)) { - return; + return 0; } /* Poll if the DTR flag was set, optional */ @@ -446,7 +446,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -454,18 +454,18 @@ void main(void) err = bt_latency_init(&latency, NULL); if (err) { printk("Latency service initialization failed (err %d)\n", err); - return; + return 0; } err = bt_latency_client_init(&latency_client, &latency_client_cb); if (err) { printk("Latency client initialization failed (err %d)\n", err); - return; + return 0; } if (enable_llpm_mode()) { printk("Enable LLPM mode failed.\n"); - return; + return 0; } while (true) { @@ -491,7 +491,7 @@ void main(void) if (enable_qos_conn_evt_report()) { printk("Enable LLPM QoS failed.\n"); - return; + return 0; } for (;;) { diff --git a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/main.c b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/main.c index 6fefc9a0dc2b..63d7be67ef34 100644 --- a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/main.c +++ b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/main.c @@ -46,7 +46,7 @@ static void bt_ready(int err) } -void main(void) +int main(void) { int err; @@ -56,4 +56,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/chat/src/main.c b/samples/bluetooth/mesh/chat/src/main.c index 6317f43474b5..deb79d81e44b 100644 --- a/samples/bluetooth/mesh/chat/src/main.c +++ b/samples/bluetooth/mesh/chat/src/main.c @@ -44,7 +44,7 @@ static void bt_ready(int err) printk("Mesh initialized\n"); } -void main(void) +int main(void) { int err; @@ -54,4 +54,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/light/src/main.c b/samples/bluetooth/mesh/light/src/main.c index 1879f06cece1..e84146c6dafd 100644 --- a/samples/bluetooth/mesh/light/src/main.c +++ b/samples/bluetooth/mesh/light/src/main.c @@ -49,7 +49,7 @@ static void bt_ready(int err) } } -void main(void) +int main(void) { int err; @@ -59,4 +59,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/light_ctrl/src/main.c b/samples/bluetooth/mesh/light_ctrl/src/main.c index e6f7a4105365..c8c052a92d89 100644 --- a/samples/bluetooth/mesh/light_ctrl/src/main.c +++ b/samples/bluetooth/mesh/light_ctrl/src/main.c @@ -119,7 +119,7 @@ static void bt_ready(int err) model_handler_start(); } -void main(void) +int main(void) { int err; @@ -129,4 +129,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/light_switch/src/main.c b/samples/bluetooth/mesh/light_switch/src/main.c index f62b118dad08..f395526a0d22 100644 --- a/samples/bluetooth/mesh/light_switch/src/main.c +++ b/samples/bluetooth/mesh/light_switch/src/main.c @@ -45,7 +45,7 @@ static void bt_ready(int err) printk("Mesh initialized\n"); } -void main(void) +int main(void) { int err; @@ -55,4 +55,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/sensor_client/src/main.c b/samples/bluetooth/mesh/sensor_client/src/main.c index f86cc47aff3e..189a293f3ae3 100644 --- a/samples/bluetooth/mesh/sensor_client/src/main.c +++ b/samples/bluetooth/mesh/sensor_client/src/main.c @@ -41,7 +41,7 @@ static void bt_ready(int err) printk("Mesh initialized\n"); } -void main(void) +int main(void) { int err; @@ -51,4 +51,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/sensor_server/src/main.c b/samples/bluetooth/mesh/sensor_server/src/main.c index 41e80d2d7890..21900ad9f62f 100644 --- a/samples/bluetooth/mesh/sensor_server/src/main.c +++ b/samples/bluetooth/mesh/sensor_server/src/main.c @@ -41,7 +41,7 @@ static void bt_ready(int err) printk("Mesh initialized\n"); } -void main(void) +int main(void) { int err; @@ -51,4 +51,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/mesh/silvair_enocean/src/main.c b/samples/bluetooth/mesh/silvair_enocean/src/main.c index bab09c634351..0c5873e142e1 100644 --- a/samples/bluetooth/mesh/silvair_enocean/src/main.c +++ b/samples/bluetooth/mesh/silvair_enocean/src/main.c @@ -41,7 +41,7 @@ static void bt_ready(int err) printk("Mesh initialized\n"); } -void main(void) +int main(void) { int err; @@ -51,4 +51,6 @@ void main(void) if (err) { printk("Bluetooth init failed (err %d)\n", err); } + + return 0; } diff --git a/samples/bluetooth/multiple_adv_sets/src/main.c b/samples/bluetooth/multiple_adv_sets/src/main.c index ef93fa0bfd2c..df4ab3dd4225 100644 --- a/samples/bluetooth/multiple_adv_sets/src/main.c +++ b/samples/bluetooth/multiple_adv_sets/src/main.c @@ -184,7 +184,7 @@ static int connectable_adv_create(void) return err; } -void main(void) +int main(void) { int err; int blink_status = 0; @@ -194,27 +194,27 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); err = non_connectable_adv_create(); if (err) { - return; + return 0; } printk("Non-connectable advertising started\n"); err = connectable_adv_create(); if (err) { - return; + return 0; } printk("Connectable advertising started\n"); diff --git a/samples/bluetooth/nrf_dm/src/main.c b/samples/bluetooth/nrf_dm/src/main.c index 1ac7b3627771..fd1af7a2cc50 100644 --- a/samples/bluetooth/nrf_dm/src/main.c +++ b/samples/bluetooth/nrf_dm/src/main.c @@ -297,7 +297,7 @@ static struct dm_cb dm_cb = { .data_ready = data_ready, }; -void main(void) +int main(void) { int err; uint32_t blink_status = 0; @@ -308,13 +308,13 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = peer_init(); if (err) { printk("Peer init failed (err %d)\n", err); - return; + return 0; } init_param.cb = &dm_cb; @@ -322,25 +322,25 @@ void main(void) err = dm_init(&init_param); if (err) { printk("Distance measurement init failed (err %d)\n", err); - return; + return 0; } err = service_ddfs_init(); if (err) { printk("DDF Service init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } err = bt_sync_init(); if (err) { printk("Synchronisation init failed (err %d)\n", err); - return; + return 0; } for (;;) { diff --git a/samples/bluetooth/peripheral_ams_client/src/main.c b/samples/bluetooth/peripheral_ams_client/src/main.c index 1c9bcb7b9820..4f1d17dcf874 100644 --- a/samples/bluetooth/peripheral_ams_client/src/main.c +++ b/samples/bluetooth/peripheral_ams_client/src/main.c @@ -430,7 +430,7 @@ static void button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -440,25 +440,25 @@ void main(void) err = bt_ams_client_init(&ams_c); if (err) { printk("AMS client init failed (err %d)\n", err); - return; + return 0; } err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = dk_buttons_init(button_changed); if (err) { printk("Button init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("BLE init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_SETTINGS)) { @@ -468,19 +468,19 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_ancs_client/src/main.c b/samples/bluetooth/peripheral_ancs_client/src/main.c index 21dab21dc390..b0a4f2d22b5f 100644 --- a/samples/bluetooth/peripheral_ancs_client/src/main.c +++ b/samples/bluetooth/peripheral_ancs_client/src/main.c @@ -675,7 +675,7 @@ static void button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -685,31 +685,31 @@ void main(void) err = ancs_c_init(); if (err) { printk("ANCS client init failed (err %d)\n", err); - return; + return 0; } err = gattp_init(); if (err) { printk("GATT Service client init failed (err %d)\n", err); - return; + return 0; } err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = dk_buttons_init(button_changed); if (err) { printk("Button init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("BLE init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_SETTINGS)) { @@ -719,19 +719,19 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_bms/src/main.c b/samples/bluetooth/peripheral_bms/src/main.c index a633d06f2abe..bb501b271be6 100644 --- a/samples/bluetooth/peripheral_bms/src/main.c +++ b/samples/bluetooth/peripheral_bms/src/main.c @@ -173,7 +173,7 @@ static int bms_init(void) return bt_bms_init(&init_params); } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -183,25 +183,25 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -213,14 +213,14 @@ void main(void) err = bms_init(); if (err) { printk("Failed to init BMS (err:%d)\n", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_cgms/src/main.c b/samples/bluetooth/peripheral_cgms/src/main.c index 47f26faab296..a7e75835992a 100644 --- a/samples/bluetooth/peripheral_cgms/src/main.c +++ b/samples/bluetooth/peripheral_cgms/src/main.c @@ -103,7 +103,7 @@ static void cgms_session_state_changed(const bool state) } } -void main(void) +int main(void) { int err; const uint8_t measurement_interval = 1; /* time in minutes. */ @@ -123,7 +123,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -145,13 +145,13 @@ void main(void) err = bt_cgms_init(¶ms); if (err) { printk("Error occurred when initializing cgm service (err %d)\n", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_cts_client/src/main.c b/samples/bluetooth/peripheral_cts_client/src/main.c index 42ec18b74908..9f9e40896465 100644 --- a/samples/bluetooth/peripheral_cts_client/src/main.c +++ b/samples/bluetooth/peripheral_cts_client/src/main.c @@ -297,7 +297,7 @@ static int init_button(void) return err; } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -307,25 +307,25 @@ void main(void) err = bt_cts_client_init(&cts_c); if (err) { printk("CTS client init failed (err %d)\n", err); - return; + return 0; } err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = init_button(); if (err) { printk("Button init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("BLE init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_SETTINGS)) { @@ -335,19 +335,19 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_fast_pair/src/main.c b/samples/bluetooth/peripheral_fast_pair/src/main.c index 7474715c17e2..c0faf5bb8398 100644 --- a/samples/bluetooth/peripheral_fast_pair/src/main.c +++ b/samples/bluetooth/peripheral_fast_pair/src/main.c @@ -357,7 +357,7 @@ static void fp_account_key_written(struct bt_conn *conn) LOG_INF("Fast Pair Account Key has been written"); } -void main(void) +int main(void) { bool run_led_on = true; int err; @@ -376,31 +376,31 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { LOG_ERR("Registering authentication callbacks failed (err %d)", err); - return; + return 0; } err = bt_conn_auth_info_cb_register(&auth_info_cb); if (err) { LOG_ERR("Registering authentication info callbacks failed (err %d)", err); - return; + return 0; } err = bt_fast_pair_info_cb_register(&fp_info_callbacks); if (err) { LOG_ERR("Registering Fast Pair info callbacks failed (err %d)", err); - return; + return 0; } err = hids_helper_init(); if (err) { LOG_ERR("HIDS init failed (err %d)", err); - return; + return 0; } err = bt_enable(NULL); if (err) { LOG_ERR("Bluetooth init failed (err %d)", err); - return; + return 0; } LOG_INF("Bluetooth initialized"); @@ -408,7 +408,7 @@ void main(void) err = settings_load(); if (err) { LOG_ERR("Settings load failed (err: %d)", err); - return; + return 0; } LOG_INF("Settings loaded"); @@ -416,19 +416,19 @@ void main(void) err = dk_leds_init(); if (err) { LOG_ERR("LEDs init failed (err %d)", err); - return; + return 0; } err = battery_module_init(); if (err) { LOG_ERR("Battery module init failed (err %d)", err); - return; + return 0; } err = bt_le_adv_prov_fast_pair_set_battery_mode(BT_FAST_PAIR_ADV_BATTERY_MODE_SHOW_UI_IND); if (err) { LOG_ERR("Setting advertising battery mode failed (err %d)", err); - return; + return 0; } k_work_init(&bt_adv_restart, bt_adv_restart_fn); @@ -445,7 +445,7 @@ void main(void) err = dk_buttons_init(button_changed); if (err) { LOG_ERR("Buttons init failed (err %d)", err); - return; + return 0; } for (;;) { diff --git a/samples/bluetooth/peripheral_gatt_dm/src/main.c b/samples/bluetooth/peripheral_gatt_dm/src/main.c index 765c9d512fa1..e83e7c58c32a 100644 --- a/samples/bluetooth/peripheral_gatt_dm/src/main.c +++ b/samples/bluetooth/peripheral_gatt_dm/src/main.c @@ -216,7 +216,7 @@ static void button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int err; @@ -230,27 +230,29 @@ void main(void) err = bt_enable(NULL); if (err) { printk("BLE init failed with error code %d\n", err); - return; + return 0; } err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); + + return 0; } diff --git a/samples/bluetooth/peripheral_hids_keyboard/src/main.c b/samples/bluetooth/peripheral_hids_keyboard/src/main.c index 88a5b0d91b50..1921643ffe8e 100644 --- a/samples/bluetooth/peripheral_hids_keyboard/src/main.c +++ b/samples/bluetooth/peripheral_hids_keyboard/src/main.c @@ -931,7 +931,7 @@ static void bas_notify(void) } -void main(void) +int main(void) { int err; int blink_status = 0; @@ -943,13 +943,13 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } hid_init(); @@ -957,7 +957,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); diff --git a/samples/bluetooth/peripheral_hids_mouse/src/main.c b/samples/bluetooth/peripheral_hids_mouse/src/main.c index 5e5f99762f06..96140747178f 100644 --- a/samples/bluetooth/peripheral_hids_mouse/src/main.c +++ b/samples/bluetooth/peripheral_hids_mouse/src/main.c @@ -755,7 +755,7 @@ static void bas_notify(void) } -void main(void) +int main(void) { int err; @@ -765,13 +765,13 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } @@ -781,7 +781,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); diff --git a/samples/bluetooth/peripheral_hr_coded/src/main.c b/samples/bluetooth/peripheral_hr_coded/src/main.c index 944657a5ea68..932b0e941c1b 100644 --- a/samples/bluetooth/peripheral_hr_coded/src/main.c +++ b/samples/bluetooth/peripheral_hr_coded/src/main.c @@ -166,7 +166,7 @@ static void notify_work_handler(struct k_work *work) k_work_reschedule(k_work_delayable_from_work(work), K_MSEC(NOTIFY_INTERVAL)); } -void main(void) +int main(void) { uint32_t led_status = 0; int err; @@ -176,13 +176,13 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -190,7 +190,7 @@ void main(void) err = create_advertising_coded(); if (err) { printk("Advertising failed to create (err %d)\n", err); - return; + return 0; } k_work_submit(&start_advertising_worker); diff --git a/samples/bluetooth/peripheral_lbs/src/main.c b/samples/bluetooth/peripheral_lbs/src/main.c index 7483c69e4c97..7d8ecdffa06c 100644 --- a/samples/bluetooth/peripheral_lbs/src/main.c +++ b/samples/bluetooth/peripheral_lbs/src/main.c @@ -181,7 +181,7 @@ static int init_button(void) return err; } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -191,33 +191,33 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = init_button(); if (err) { printk("Button init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_BT_LBS_SECURITY_ENABLED)) { err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -229,14 +229,14 @@ void main(void) err = bt_lbs_init(&lbs_callbacs); if (err) { printk("Failed to init LBS (err:%d)\n", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_mds/src/main.c b/samples/bluetooth/peripheral_mds/src/main.c index 59982cc54df3..7ab316aaaa5d 100644 --- a/samples/bluetooth/peripheral_mds/src/main.c +++ b/samples/bluetooth/peripheral_mds/src/main.c @@ -274,7 +274,7 @@ static void bas_work_handler(struct k_work *work) k_work_reschedule((struct k_work_delayable *)work, K_SECONDS(1)); } -void main(void) +int main(void) { uint32_t blink_status = 0; int err; @@ -284,37 +284,37 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = dk_buttons_init(button_handler); if (err) { printk("Failed to initialize buttons (err %d)\n", err); - return; + return 0; } err = bt_mds_cb_register(&mds_cb); if (err) { printk("Memfault Diagnostic service callback registration failed (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks (err %d)\n", err); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -323,7 +323,7 @@ void main(void) err = settings_load(); if (err) { printk("Failed to load settings (err %d)\n", err); - return; + return 0; } } @@ -331,7 +331,7 @@ void main(void) sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_nfc_pairing/src/main.c b/samples/bluetooth/peripheral_nfc_pairing/src/main.c index 1814ba508678..246568f0f198 100644 --- a/samples/bluetooth/peripheral_nfc_pairing/src/main.c +++ b/samples/bluetooth/peripheral_nfc_pairing/src/main.c @@ -707,7 +707,7 @@ void button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int err; @@ -717,7 +717,7 @@ void main(void) err = dk_leds_init(); if (err) { printk("Cannot init LEDs!\n"); - return; + return 0; } /* Configure buttons */ @@ -729,19 +729,19 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -752,7 +752,7 @@ void main(void) err = paring_key_generate(); if (err) { - return; + return 0; } k_work_init(&adv_work, adv_handler); diff --git a/samples/bluetooth/peripheral_power_profiling/src/main.c b/samples/bluetooth/peripheral_power_profiling/src/main.c index 9d301fe9c394..d3d83ced03d7 100644 --- a/samples/bluetooth/peripheral_power_profiling/src/main.c +++ b/samples/bluetooth/peripheral_power_profiling/src/main.c @@ -652,7 +652,7 @@ static const struct bt_le_ext_adv_cb adv_callbacks = { .sent = advertising_terminated }; -void main(void) +int main(void) { int err; uint32_t blink_status = 0; @@ -664,7 +664,7 @@ void main(void) err = dk_buttons_init(button_handler); if (err) { printk("Failed to initialize buttons (err %d)\n", err); - return; + return 0; } /* Read the button state after booting to check if advertising start is needed. */ @@ -673,7 +673,7 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } reset_reason_print(); @@ -681,51 +681,51 @@ void main(void) err = pwr_service_cb_register(&pwr_service_callback, NULL); if (err) { printk("Failed to register PWR service callback (err %d)\n", err); - return; + return 0; } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_SETTINGS)) { err = settings_load(); if (err) { printk("Failed to load settings (err %d)\n", err); - return; + return 0; } } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks (err %d)\n", err); - return; + return 0; } err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks (err %d)\n", err); - return; + return 0; } err = bt_le_ext_adv_create(connectable_ad_params, &adv_callbacks, &adv_set); if (err) { printk("Failed to create advertising set (err %d)\n", err); - return; + return 0; } err = pairing_key_generate(); if (err) { printk("Failed to generate pairing keys (err %d)\n", err); - return; + return 0; } err = nfc_init(); if (err) { printk("Failed to initialize NFC (err %d)\n", err); - return; + return 0; } button_handler(button_state, has_changed); diff --git a/samples/bluetooth/peripheral_rscs/src/main.c b/samples/bluetooth/peripheral_rscs/src/main.c index eb159318ac10..bb0cbb55d2bf 100644 --- a/samples/bluetooth/peripheral_rscs/src/main.c +++ b/samples/bluetooth/peripheral_rscs/src/main.c @@ -222,7 +222,7 @@ static const struct bt_data ad[] = { BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_RSCS_VAL)) }; -void main(void) +int main(void) { int err; uint32_t blink_status = 0; @@ -232,27 +232,27 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_BT_RSCS_SECURITY_ENABLED)) { err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -282,13 +282,13 @@ void main(void) err = bt_rscs_init(&rscs_init); if (err) { printk("Failed to init RSCS (err %d)\n", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_status/src/main.c b/samples/bluetooth/peripheral_status/src/main.c index caa1e736d140..8c588f4c4d1f 100644 --- a/samples/bluetooth/peripheral_status/src/main.c +++ b/samples/bluetooth/peripheral_status/src/main.c @@ -172,7 +172,7 @@ static int init_button(void) return err; } -void main(void) +int main(void) { int blink_status = 0; int err; @@ -182,33 +182,33 @@ void main(void) err = dk_leds_init(); if (err) { printk("LEDs init failed (err %d)\n", err); - return; + return 0; } err = init_button(); if (err) { printk("Button init failed (err %d)\n", err); - return; + return 0; } if (IS_ENABLED(CONFIG_BT_STATUS_SECURITY_ENABLED)) { err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -220,7 +220,7 @@ void main(void) err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); - return; + return 0; } printk("Advertising successfully started\n"); diff --git a/samples/bluetooth/peripheral_uart/src/main.c b/samples/bluetooth/peripheral_uart/src/main.c index 66ff5df000b2..d42e89071bdc 100644 --- a/samples/bluetooth/peripheral_uart/src/main.c +++ b/samples/bluetooth/peripheral_uart/src/main.c @@ -570,7 +570,7 @@ static void configure_gpio(void) } } -void main(void) +int main(void) { int blink_status = 0; int err = 0; @@ -586,13 +586,13 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } @@ -612,14 +612,14 @@ void main(void) err = bt_nus_init(&nus_cb); if (err) { LOG_ERR("Failed to initialize UART service (err: %d)", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); - return; + return 0; } for (;;) { diff --git a/samples/bluetooth/radio_coex_1wire/src/main.c b/samples/bluetooth/radio_coex_1wire/src/main.c index fb3bb97fbd66..000369f022fa 100644 --- a/samples/bluetooth/radio_coex_1wire/src/main.c +++ b/samples/bluetooth/radio_coex_1wire/src/main.c @@ -136,13 +136,13 @@ static void setup_grant_pin(void) } } -void main(void) +int main(void) { printk("Starting Radio Coex Demo 1wire on board %s\n", CONFIG_BOARD); if (bt_enable(NULL)) { printk("Bluetooth init failed"); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -151,7 +151,7 @@ void main(void) if (bt_le_adv_start(BT_LE_ADV_NCONN, ad, ARRAY_SIZE(ad), NULL, 0)) { printk("Advertising failed to start"); - return; + return 0; } printk("Advertising started\n"); diff --git a/samples/bluetooth/rpc_host/src/main.c b/samples/bluetooth/rpc_host/src/main.c index 12c373d3e802..ec41c6e35061 100644 --- a/samples/bluetooth/rpc_host/src/main.c +++ b/samples/bluetooth/rpc_host/src/main.c @@ -6,7 +6,9 @@ #include -void main(void) +int main(void) { printk("Starting nRF RPC bluetooth host\n"); + + return 0; } diff --git a/samples/bluetooth/shell_bt_nus/src/main.c b/samples/bluetooth/shell_bt_nus/src/main.c index 42adc12b3448..eb985009cee6 100644 --- a/samples/bluetooth/shell_bt_nus/src/main.c +++ b/samples/bluetooth/shell_bt_nus/src/main.c @@ -118,7 +118,7 @@ static struct bt_conn_auth_info_cb conn_auth_info_callbacks = { .pairing_failed = pairing_failed }; -void main(void) +int main(void) { int err; @@ -128,35 +128,36 @@ void main(void) err = bt_conn_auth_cb_register(&conn_auth_callbacks); if (err) { printk("Failed to register authorization callbacks.\n"); - return; + return 0; } err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks); if (err) { printk("Failed to register authorization info callbacks.\n"); - return; + return 0; } } err = bt_enable(NULL); if (err) { LOG_ERR("BLE enable failed (err: %d)", err); - return; + return 0; } err = shell_bt_nus_init(); if (err) { LOG_ERR("Failed to initialize BT NUS shell (err: %d)", err); - return; + return 0; } err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); - return; + return 0; } LOG_INF("Bluetooth ready. Advertising started."); + return 0; } diff --git a/samples/bluetooth/throughput/src/main.c b/samples/bluetooth/throughput/src/main.c index e634443737ec..9abce988a897 100644 --- a/samples/bluetooth/throughput/src/main.c +++ b/samples/bluetooth/throughput/src/main.c @@ -630,7 +630,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { .le_data_len_updated = le_data_length_updated }; -void main(void) +int main(void) { int err; @@ -639,7 +639,7 @@ void main(void) err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); - return; + return 0; } printk("Bluetooth initialized\n"); @@ -649,7 +649,7 @@ void main(void) err = bt_throughput_init(&throughput, &throughput_cb); if (err) { printk("Throughput service initialization failed.\n"); - return; + return 0; } printk("\n"); @@ -657,4 +657,6 @@ void main(void) printk("Press button 2 or type \"peripheral\" on the peripheral board.\n"); buttons_init(); + + return 0; } diff --git a/samples/bootloader/src/main.c b/samples/bootloader/src/main.c index 901826f35d23..02bd4d22dd90 100644 --- a/samples/bootloader/src/main.c +++ b/samples/bootloader/src/main.c @@ -107,13 +107,13 @@ static void validate_and_boot(const struct fw_info *fw_info, uint16_t slot) #define BOOT_SLOT_0 0 #define BOOT_SLOT_1 1 -void main(void) +int main(void) { int err = fprotect_area(PM_B0_ADDRESS, PM_B0_SIZE); if (err) { printk("Failed to protect B0 flash, cancel startup.\n\r"); - return; + return 0; } uint32_t s0_addr = s0_address_read(); @@ -130,5 +130,5 @@ void main(void) } printk("No bootable image found. Aborting boot.\n\r"); - return; + return 0; } diff --git a/samples/caf/src/main.c b/samples/caf/src/main.c index 5f5cca51eb2a..6b022abfe627 100644 --- a/samples/caf/src/main.c +++ b/samples/caf/src/main.c @@ -12,11 +12,13 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { if (app_event_manager_init()) { LOG_ERR("Application Event Manager not initialized"); } else { module_set_state(MODULE_STATE_READY); } + + return 0; } diff --git a/samples/caf_sensor_manager/remote/src/main.c b/samples/caf_sensor_manager/remote/src/main.c index 93c01c8a3097..fb7f7553d09a 100644 --- a/samples/caf_sensor_manager/remote/src/main.c +++ b/samples/caf_sensor_manager/remote/src/main.c @@ -15,7 +15,7 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { int ret; @@ -25,7 +25,7 @@ void main(void) if (ret) { LOG_ERR("Event Manager not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager initialized"); @@ -33,8 +33,10 @@ void main(void) if (ret) { LOG_ERR("Event Manager Proxy not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } module_set_state(MODULE_STATE_READY); + + return 0; } diff --git a/samples/caf_sensor_manager/src/main.c b/samples/caf_sensor_manager/src/main.c index 0dfc4764a264..341015c87066 100644 --- a/samples/caf_sensor_manager/src/main.c +++ b/samples/caf_sensor_manager/src/main.c @@ -16,7 +16,7 @@ LOG_MODULE_REGISTER(MODULE); #include "event_proxy_init.h" -void main(void) +int main(void) { int ret; @@ -24,7 +24,7 @@ void main(void) if (ret) { LOG_ERR("Event Manager not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager initialized"); @@ -32,8 +32,10 @@ void main(void) if (ret) { LOG_ERR("Event Manager Proxy not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } module_set_state(MODULE_STATE_READY); + + return 0; } diff --git a/samples/debug/ppi_trace/src/main.c b/samples/debug/ppi_trace/src/main.c index 4d717179e48b..370095eda2da 100644 --- a/samples/debug/ppi_trace/src/main.c +++ b/samples/debug/ppi_trace/src/main.c @@ -92,7 +92,7 @@ static void counter_setup(void) __ASSERT_NO_MSG(err == 0); } -void main(void) +int main(void) { ppi_trace_setup(); counter_setup(); @@ -100,4 +100,6 @@ void main(void) if (IS_ENABLED(CONFIG_BT)) { bluetooth_enable(); } + + return 0; } diff --git a/samples/edge_impulse/data_forwarder/src/main.c b/samples/edge_impulse/data_forwarder/src/main.c index 7070e1a5de6e..61053d6e0571 100644 --- a/samples/edge_impulse/data_forwarder/src/main.c +++ b/samples/edge_impulse/data_forwarder/src/main.c @@ -106,10 +106,10 @@ static int provide_sensor_data(void) return err; } -void main(void) +int main(void) { if (init()) { - return; + return 0; } printk("Initialized\n"); @@ -131,4 +131,6 @@ void main(void) k_sleep(K_MSEC(next_timeout - uptime)); next_timeout += SAMPLE_PERIOD_MS; } + + return 0; } diff --git a/samples/edge_impulse/wrapper/src/main.c b/samples/edge_impulse/wrapper/src/main.c index f4782aeb87ad..9f624e310c33 100644 --- a/samples/edge_impulse/wrapper/src/main.c +++ b/samples/edge_impulse/wrapper/src/main.c @@ -66,24 +66,24 @@ static void result_ready_cb(int err) } } -void main(void) +int main(void) { int err = ei_wrapper_init(result_ready_cb); if (err) { printk("Edge Impulse wrapper failed to initialize (err: %d)\n", err); - return; + return 0; }; if (ARRAY_SIZE(input_data) < ei_wrapper_get_window_size()) { printk("Not enough input data\n"); - return; + return 0; } if (ARRAY_SIZE(input_data) % ei_wrapper_get_frame_size() != 0) { printk("Improper number of input samples\n"); - return; + return 0; } printk("Machine learning model sampling frequency: %zu\n", @@ -102,7 +102,7 @@ void main(void) if (err) { printk("Cannot provide input data (err: %d)\n", err); printk("Increase CONFIG_EI_WRAPPER_DATA_BUF_SIZE\n"); - return; + return 0; } cnt += ei_wrapper_get_window_size(); @@ -127,10 +127,12 @@ void main(void) if (err) { printk("Cannot provide input data (err: %d)\n", err); printk("Increase CONFIG_EI_WRAPPER_DATA_BUF_SIZE\n"); - return; + return 0; } cnt += ei_wrapper_get_frame_size(); k_sleep(K_MSEC(FRAME_ADD_INTERVAL_MS)); } + + return 0; } diff --git a/samples/esb/prx/src/main.c b/samples/esb/prx/src/main.c index 69442dee8e0f..b5478307ddac 100644 --- a/samples/esb/prx/src/main.c +++ b/samples/esb/prx/src/main.c @@ -175,7 +175,7 @@ int esb_initialize(void) return 0; } -void main(void) +int main(void) { int err; @@ -183,18 +183,18 @@ void main(void) err = clocks_start(); if (err) { - return; + return 0; } err = leds_init(); if (err) { - return; + return 0; } err = esb_initialize(); if (err) { LOG_ERR("ESB initialization failed, err %d", err); - return; + return 0; } LOG_INF("Initialization complete"); @@ -202,7 +202,7 @@ void main(void) err = esb_write_payload(&tx_payload); if (err) { LOG_ERR("Write payload, err %d", err); - return; + return 0; } LOG_INF("Setting up for packet receiption"); @@ -210,9 +210,9 @@ void main(void) err = esb_start_rx(); if (err) { LOG_ERR("RX setup failed, err %d", err); - return; + return 0; } /* return to idle thread */ - return; + return 0; } diff --git a/samples/esb/ptx/src/main.c b/samples/esb/ptx/src/main.c index df9716aeff1e..b64950ab7409 100644 --- a/samples/esb/ptx/src/main.c +++ b/samples/esb/ptx/src/main.c @@ -181,7 +181,7 @@ static void leds_update(uint8_t value) (void)gpio_port_set_masked_raw(leds[0].port, mask, val); } -void main(void) +int main(void) { int err; @@ -189,18 +189,18 @@ void main(void) err = clocks_start(); if (err) { - return; + return 0; } err = leds_init(); if (err) { - return; + return 0; } err = esb_initialize(); if (err) { LOG_ERR("ESB initialization failed, err %d", err); - return; + return 0; } LOG_INF("Initialization complete"); diff --git a/samples/event_manager_proxy/remote/src/main.c b/samples/event_manager_proxy/remote/src/main.c index d98ebc68fe3e..146b6469a4ad 100644 --- a/samples/event_manager_proxy/remote/src/main.c +++ b/samples/event_manager_proxy/remote/src/main.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(MODULE); -void main(void) +int main(void) { int ret; const struct device *ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); @@ -29,7 +29,7 @@ void main(void) if (ret) { LOG_ERR("Event Manager not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager initialized"); @@ -37,7 +37,7 @@ void main(void) if (ret && ret != -EALREADY) { LOG_ERR("Cannot add remote: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy remote added"); @@ -46,7 +46,7 @@ void main(void) if (ret) { LOG_ERR("Cannot register to remote config_event: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy config_event registered"); @@ -54,11 +54,13 @@ void main(void) if (ret) { LOG_ERR("Cannot start event manager proxy: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } /* We do not have to wait for remotes here as we do not send any event that * would be fatal when missed. */ LOG_INF("Initialization finished successfully"); + + return 0; } diff --git a/samples/event_manager_proxy/src/main.c b/samples/event_manager_proxy/src/main.c index 6999d6c2128b..13514bb3d72b 100644 --- a/samples/event_manager_proxy/src/main.c +++ b/samples/event_manager_proxy/src/main.c @@ -22,7 +22,7 @@ LOG_MODULE_REGISTER(MODULE); #define INIT_VALUE1 3 -void main(void) +int main(void) { int ret; const struct device *ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); @@ -34,7 +34,7 @@ void main(void) if (ret) { LOG_ERR("Event Manager not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager initialized"); @@ -42,7 +42,7 @@ void main(void) if (ret && ret != -EALREADY) { LOG_ERR("Cannot add remote: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy remote added"); @@ -51,14 +51,14 @@ void main(void) if (ret) { LOG_ERR("Cannot register to remote control_event: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy control_event registered"); ret = EVENT_MANAGER_PROXY_SUBSCRIBE(ipc_instance, measurement_event); if (ret) { LOG_ERR("Cannot register to remote measurement_event: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy measurement_event registered"); @@ -66,7 +66,7 @@ void main(void) if (ret) { LOG_ERR("Cannot start event manager proxy: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager proxy started"); @@ -75,7 +75,7 @@ void main(void) if (ret) { LOG_ERR("Error when waiting for remote: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("All remotes ready"); @@ -88,4 +88,5 @@ void main(void) LOG_INF("Initialization finished successfully"); /* Main is not needed anymore - rest would be processed in events in stats module */ + return 0; } diff --git a/samples/gazell/gzll_ack_payload_device/src/main.c b/samples/gazell/gzll_ack_payload_device/src/main.c index 0d657c9d728a..58bb7fc938bc 100644 --- a/samples/gazell/gzll_ack_payload_device/src/main.c +++ b/samples/gazell/gzll_ack_payload_device/src/main.c @@ -55,7 +55,7 @@ static struct k_work gzll_work; static void gzll_tx_result_handler(struct gzll_tx_result *tx_result); static void gzll_work_handler(struct k_work *work); -void main(void) +int main(void) { int err; bool result_value; @@ -65,27 +65,27 @@ void main(void) err = dk_leds_init(); if (err) { LOG_ERR("Cannot initialize LEDs (err: %d)", err); - return; + return 0; } err = dk_buttons_init(NULL); if (err) { LOG_ERR("Cannot initialize buttons (err: %d)", err); - return; + return 0; } /* Initialize Gazell Link Layer glue */ result_value = gzll_glue_init(); if (!result_value) { LOG_ERR("Cannot initialize GZLL glue code"); - return; + return 0; } /* Initialize the Gazell Link Layer */ result_value = nrf_gzll_init(NRF_GZLL_MODE_DEVICE); if (!result_value) { LOG_ERR("Cannot initialize GZLL"); - return; + return 0; } nrf_gzll_set_max_tx_attempts(MAX_TX_ATTEMPTS); @@ -95,7 +95,7 @@ void main(void) result_value = nrf_gzll_tx_statistics_enable(&statistics); if (!result_value) { LOG_ERR("Cannot enable GZLL TX statistics"); - return; + return 0; } #endif @@ -104,13 +104,13 @@ void main(void) result_value = nrf_gzll_add_packet_to_tx_fifo(PIPE_NUMBER, data_payload, TX_PAYLOAD_LENGTH); if (!result_value) { LOG_ERR("Cannot add packet to GZLL TX FIFO"); - return; + return 0; } result_value = nrf_gzll_enable(); if (!result_value) { LOG_ERR("Cannot enable GZLL"); - return; + return 0; } LOG_INF("Gzll ack payload device example started."); diff --git a/samples/gazell/gzll_ack_payload_host/src/main.c b/samples/gazell/gzll_ack_payload_host/src/main.c index 4904f888748d..d06180e8331d 100644 --- a/samples/gazell/gzll_ack_payload_host/src/main.c +++ b/samples/gazell/gzll_ack_payload_host/src/main.c @@ -51,7 +51,7 @@ static struct k_work gzll_work; static void gzll_rx_result_handler(struct gzll_rx_result *rx_result); static void gzll_work_handler(struct k_work *work); -void main(void) +int main(void) { int err; bool result_value; @@ -61,27 +61,27 @@ void main(void) err = dk_leds_init(); if (err) { LOG_ERR("Cannot initialize LEDs (err: %d)", err); - return; + return 0; } err = dk_buttons_init(NULL); if (err) { LOG_ERR("Cannot initialize buttons (err: %d)", err); - return; + return 0; } /* Initialize Gazell Link Layer glue */ result_value = gzll_glue_init(); if (!result_value) { LOG_ERR("Cannot initialize GZLL glue code"); - return; + return 0; } /* Initialize the Gazell Link Layer */ result_value = nrf_gzll_init(NRF_GZLL_MODE_HOST); if (!result_value) { LOG_ERR("Cannot initialize GZLL"); - return; + return 0; } #ifdef CONFIG_GZLL_TX_STATISTICS @@ -89,7 +89,7 @@ void main(void) result_value = nrf_gzll_tx_statistics_enable(&statistics); if (!result_value) { LOG_ERR("Cannot enable GZLL TX statistics"); - return; + return 0; } #endif @@ -97,13 +97,13 @@ void main(void) result_value = nrf_gzll_add_packet_to_tx_fifo(PIPE_NUMBER, ack_payload, TX_PAYLOAD_LENGTH); if (!result_value) { LOG_ERR("Cannot add packet to GZLL TX FIFO"); - return; + return 0; } result_value = nrf_gzll_enable(); if (!result_value) { LOG_ERR("Cannot enable GZLL"); - return; + return 0; } LOG_INF("Gzll ack payload host example started."); diff --git a/samples/gazell/gzp_dynamic_pairing_device/src/main.c b/samples/gazell/gzp_dynamic_pairing_device/src/main.c index fae9c8907b3b..144b095186af 100644 --- a/samples/gazell/gzp_dynamic_pairing_device/src/main.c +++ b/samples/gazell/gzp_dynamic_pairing_device/src/main.c @@ -39,7 +39,7 @@ static void gzp_tx_result_checker(bool success, } } -void main(void) +int main(void) { int err; bool result_value; @@ -53,7 +53,7 @@ void main(void) err = dk_buttons_init(NULL); if (err) { LOG_ERR("Cannot initialize buttons (err: %d)", err); - return; + return 0; } settings_subsys_init(); @@ -62,14 +62,14 @@ void main(void) result_value = gzll_glue_init(); if (!result_value) { LOG_ERR("Cannot initialize GZLL glue code"); - return; + return 0; } /* Initialize the Gazell Link Layer */ result_value = nrf_gzll_init(NRF_GZLL_MODE_DEVICE); if (!result_value) { LOG_ERR("Cannot initialize GZLL"); - return; + return 0; } nrf_gzll_set_max_tx_attempts(MAX_TX_ATTEMPTS); @@ -77,7 +77,7 @@ void main(void) result_value = nrf_gzll_set_timeslot_period(NRF_GZLLDE_RXPERIOD_DIV_2); if (!result_value) { LOG_ERR("Cannot set GZLL timeslot period"); - return; + return 0; } /* Erase pairing data. This sample is intended to demonstrate pairing after every reset. */ @@ -91,7 +91,7 @@ void main(void) result_value = nrf_gzll_enable(); if (!result_value) { LOG_ERR("Cannot enable GZLL"); - return; + return 0; } LOG_INF("Gazell dynamic pairing example started. Device mode."); diff --git a/samples/gazell/gzp_dynamic_pairing_host/src/main.c b/samples/gazell/gzp_dynamic_pairing_host/src/main.c index 2f37def4dc4d..253529436611 100644 --- a/samples/gazell/gzp_dynamic_pairing_host/src/main.c +++ b/samples/gazell/gzp_dynamic_pairing_host/src/main.c @@ -31,7 +31,7 @@ static void led_output(uint8_t value) } } -void main(void) +int main(void) { /* Debug helper variables */ uint32_t length; @@ -47,27 +47,27 @@ void main(void) err = dk_leds_init(); if (err) { LOG_ERR("Cannot initialize LEDs (err: %d)", err); - return; + return 0; } /* Initialize Gazell Link Layer glue */ result_value = gzll_glue_init(); if (!result_value) { LOG_ERR("Cannot initialize GZLL glue code"); - return; + return 0; } /* Initialize the Gazell Link Layer */ result_value = nrf_gzll_init(NRF_GZLL_MODE_HOST); if (!result_value) { LOG_ERR("Cannot initialize GZLL"); - return; + return 0; } result_value = nrf_gzll_set_timeslot_period(NRF_GZLLDE_RXPERIOD_DIV_2); if (!result_value) { LOG_ERR("Cannot set GZLL timeslot period"); - return; + return 0; } /* Initialize the Gazell Pairing Library */ @@ -77,7 +77,7 @@ void main(void) (1 << UNENCRYPTED_DATA_PIPE)); if (!result_value) { LOG_ERR("Cannot set GZLL RX pipes"); - return; + return 0; } gzp_pairing_enable(true); @@ -85,7 +85,7 @@ void main(void) result_value = nrf_gzll_enable(); if (!result_value) { LOG_ERR("Cannot enable GZLL"); - return; + return 0; } LOG_INF("Gazell dynamic pairing example started. Host mode."); diff --git a/samples/hw_id/src/main.c b/samples/hw_id/src/main.c index 49766f64a4ab..79af94605ba4 100644 --- a/samples/hw_id/src/main.c +++ b/samples/hw_id/src/main.c @@ -11,7 +11,7 @@ #include #endif /* defined(CONFIG_BT) */ -void main(void) +int main(void) { int err; @@ -27,8 +27,10 @@ void main(void) err = hw_id_get(buf, ARRAY_SIZE(buf)); if (err) { printk("hw_id_get failed (err %d)\n", err); - return; + return 0; } printk("hw_id: %s\n", buf); + + return 0; } diff --git a/samples/keys/hw_unique_key/src/main.c b/samples/keys/hw_unique_key/src/main.c index e3ef74e4e536..2c9abcc70bfd 100644 --- a/samples/keys/hw_unique_key/src/main.c +++ b/samples/keys/hw_unique_key/src/main.c @@ -40,7 +40,7 @@ void hex_dump(uint8_t *buff, uint32_t len) printk("\n"); } -void main(void) +int main(void) { psa_status_t status; psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; @@ -59,7 +59,7 @@ void main(void) if (result != NRF_CC3XX_PLATFORM_SUCCESS) { printk("nrf_cc3xx_platform_init returned error: %d\n", result); - return; + return 0; } if (!hw_unique_key_are_any_written()) { @@ -77,14 +77,14 @@ void main(void) status = psa_crypto_init(); if (status != PSA_SUCCESS) { printk("psa_crypto_init returned error: %d\n", status); - return; + return 0; } printk("Generating random IV\n"); status = psa_generate_random(iv, IV_LEN); if (status != PSA_SUCCESS) { printk("psa_generate_random returned error: %d\n", status); - return; + return 0; } printk("IV:\n"); hex_dump(iv, IV_LEN); @@ -100,7 +100,7 @@ void main(void) key_id_out = derive_key(&attributes, key_label, sizeof(key_label) - 1); if (key_id_out == 0) { - return; + return 0; } printk("Key ID: 0x%x\n\n", key_id_out); @@ -114,13 +114,15 @@ void main(void) ciphertext, sizeof(ciphertext), &ciphertext_out_len); if (status != PSA_SUCCESS) { printk("psa_aead_encrypt returned error: %d\n", status); - return; + return 0; } if (ciphertext_out_len != (sizeof(plaintext) - 1 + MAC_LEN)) { printk("ciphertext has wrong length: %d\n", ciphertext_out_len); - return; + return 0; } printk("Ciphertext (with authentication tag):\n"); hex_dump(ciphertext, ciphertext_out_len); + + return 0; } diff --git a/samples/keys/identity_key_generation/src/main.c b/samples/keys/identity_key_generation/src/main.c index ba470e373267..1afd9aacb8c6 100644 --- a/samples/keys/identity_key_generation/src/main.c +++ b/samples/keys/identity_key_generation/src/main.c @@ -14,14 +14,14 @@ LOG_MODULE_REGISTER(identity_key_generation, LOG_LEVEL_DBG); -void main(void) +int main(void) { LOG_INF("Generating random HUK keys (including MKEK)"); hw_unique_key_write_random(); if (identity_key_is_written()) { LOG_INF("Failure: Identity key slot already written. Exiting!"); - return; + return 0; } LOG_INF("Writing the identity key to KMU"); @@ -34,8 +34,10 @@ void main(void) if (!identity_key_is_written()) { LOG_INF("Failure: Identity key is not written! Exiting!"); - return; + return 0; } LOG_INF("Success!"); + + return 0; } diff --git a/samples/keys/identity_key_usage/src/main.c b/samples/keys/identity_key_usage/src/main.c index 71cf30750623..6dce9654b59c 100644 --- a/samples/keys/identity_key_usage/src/main.c +++ b/samples/keys/identity_key_usage/src/main.c @@ -20,7 +20,7 @@ uint8_t m_pub_key[IDENTITY_KEY_PUBLIC_KEY_SIZE]; LOG_MODULE_REGISTER(identity_key_usage, LOG_LEVEL_DBG); -void main(void) +int main(void) { int err; psa_status_t status; @@ -32,7 +32,7 @@ void main(void) err = nrf_cc3xx_platform_init(); if (err != NRF_CC3XX_PLATFORM_SUCCESS) { LOG_INF("nrf_cc3xx_platform_init returned error: %d", err); - return; + return 0; } LOG_INF("Initializing PSA crypto."); @@ -40,7 +40,7 @@ void main(void) status = psa_crypto_init(); if (status != PSA_SUCCESS) { LOG_INF("psa_crypto_init returned error: %d", status); - return; + return 0; } /* Configure the key attributes for Curve type secp256r1*/ @@ -53,21 +53,21 @@ void main(void) if (!identity_key_is_written()) { LOG_INF("No identity key found in KMU (required). Exiting!"); - return; + return 0; } LOG_INF("Reading the identity key."); err = identity_key_read(key); if (err != 0) { LOG_INF("Identity key read failed! (Error: %d). Exiting!", err); - return; + return 0; } LOG_INF("Importing the identity key into PSA crypto."); status = psa_import_key(&key_attributes, key, IDENTITY_KEY_SIZE_BYTES, &key_id_out); if (status != PSA_SUCCESS) { LOG_INF("psa_import_key failed! (Error: %d). Exiting!", status); - return; + return 0; } /* Clear out the local copy of the key to prevent leakage */ @@ -78,16 +78,18 @@ void main(void) if (status != PSA_SUCCESS) { LOG_INF("psa_export_public_key failed! (Error: %d). Exiting!", status); - return; + return 0; } if (olen != IDENTITY_KEY_PUBLIC_KEY_SIZE) { LOG_INF("Output length is invalid! (Expected %d, got %d). Exiting!", IDENTITY_KEY_PUBLIC_KEY_SIZE, olen); - return; + return 0; } LOG_HEXDUMP_INF(m_pub_key, IDENTITY_KEY_PUBLIC_KEY_SIZE, "Public key:"); LOG_INF("Success!"); + + return 0; } diff --git a/samples/keys/random_hw_unique_key/src/main.c b/samples/keys/random_hw_unique_key/src/main.c index b6e6fa84ed0d..572703a3ac4b 100644 --- a/samples/keys/random_hw_unique_key/src/main.c +++ b/samples/keys/random_hw_unique_key/src/main.c @@ -10,9 +10,11 @@ #include #include -void main(void) +int main(void) { printk("Writing random keys to KMU.\n\r"); hw_unique_key_write_random(); printk("Success!\n\r"); + + return 0; } diff --git a/samples/mpsl/timeslot/src/main.c b/samples/mpsl/timeslot/src/main.c index 3a875e1c26d2..8be64d6f2ad2 100644 --- a/samples/mpsl/timeslot/src/main.c +++ b/samples/mpsl/timeslot/src/main.c @@ -280,7 +280,7 @@ static void mpsl_nonpreemptible_thread(void) } } -void main(void) +int main(void) { int err = console_init(); diff --git a/samples/nfc/system_off/src/main.c b/samples/nfc/system_off/src/main.c index 304575d3b2d3..a4971194b07f 100644 --- a/samples/nfc/system_off/src/main.c +++ b/samples/nfc/system_off/src/main.c @@ -202,12 +202,12 @@ static void print_reset_reason(void) } -void main(void) +int main(void) { /* Configure LED-pins */ if (dk_leds_init() < 0) { printk("Cannot init LEDs!\n"); - return; + return 0; } dk_set_led_on(SYSTEM_ON_LED); @@ -221,11 +221,12 @@ void main(void) /* Start NFC */ if (start_nfc() < 0) { printk("ERROR: NFC configuration failed\n"); - return; + return 0; } /* Prevent deep sleep (system off) from being entered */ pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES); /* Exit main function - the rest will be done by the callbacks */ + return 0; } diff --git a/samples/nfc/tag_reader/src/main.c b/samples/nfc/tag_reader/src/main.c index 0e53fc4066e8..5ad5d7606378 100644 --- a/samples/nfc/tag_reader/src/main.c +++ b/samples/nfc/tag_reader/src/main.c @@ -682,7 +682,7 @@ static const struct nfc_t4t_hl_procedure_cb t4t_hl_procedure_cb = { .ndef_read = t4t_hl_ndef_read }; -void main(void) +int main(void) { int err; @@ -697,19 +697,19 @@ void main(void) if (err) { printk("NFC T4T ISO-DEP Protocol initialization failed err: %d.\n", err); - return; + return 0; } err = st25r3911b_nfca_init(events, ARRAY_SIZE(events), &cb); if (err) { printk("NFCA initialization failed err: %d.\n", err); - return; + return 0; } err = st25r3911b_nfca_field_on(); if (err) { printk("Field on error %d.", err); - return; + return 0; } while (true) { @@ -717,7 +717,7 @@ void main(void) err = st25r3911b_nfca_process(); if (err) { printk("NFC-A process failed, err: %d.\n", err); - return; + return 0; } } } diff --git a/samples/nfc/tnep_poller/src/main.c b/samples/nfc/tnep_poller/src/main.c index c3d36f6de652..e2ce16a22fc8 100644 --- a/samples/nfc/tnep_poller/src/main.c +++ b/samples/nfc/tnep_poller/src/main.c @@ -652,7 +652,7 @@ static struct nfc_tnep_poller_cb tnep_cb = { .error = tnep_error }; -void main(void) +int main(void) { int err; @@ -666,7 +666,7 @@ void main(void) err = nfc_tnep_poller_init(&tnep_tx_buf); if (err) { printk("NFC TNEP Protocol initialization err: %d\n", err); - return; + return 0; } err = nfc_t4t_isodep_init(tx_data, sizeof(tx_data), @@ -675,19 +675,19 @@ void main(void) if (err) { printk("NFC T4T ISO-DEP Protocol initialization failed err: %d.\n", err); - return; + return 0; } err = st25r3911b_nfca_init(events, ARRAY_SIZE(events), &cb); if (err) { printk("NFCA initialization failed err: %d.\n", err); - return; + return 0; } err = st25r3911b_nfca_field_on(); if (err) { printk("Field on error %d.", err); - return; + return 0; } while (true) { @@ -695,7 +695,7 @@ void main(void) err = st25r3911b_nfca_process(); if (err) { printk("NFC-A process failed, err: %d.\n", err); - return; + return 0; } } } diff --git a/samples/nfc/tnep_tag/src/main.c b/samples/nfc/tnep_tag/src/main.c index d2f20fd81409..b175255c7294 100644 --- a/samples/nfc/tnep_tag/src/main.c +++ b/samples/nfc/tnep_tag/src/main.c @@ -183,7 +183,7 @@ static void button_pressed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int err; @@ -192,13 +192,13 @@ void main(void) err = dk_leds_init(); if (err) { printk("led init error %d", err); - return; + return 0; } err = dk_buttons_init(button_pressed); if (err) { printk("buttons init error %d", err); - return; + return 0; } /* TNEP init */ @@ -206,21 +206,21 @@ void main(void) sizeof(tag_buffer)); if (err) { printk("Cannot register tnep buffer, err: %d\n", err); - return; + return 0; } err = nfc_tnep_tag_init(events, ARRAY_SIZE(events), nfc_t4t_ndef_rwpayload_set); if (err) { printk("Cannot initialize TNEP protocol, err: %d\n", err); - return; + return 0; } /* Type 4 Tag setup */ err = nfc_t4t_setup(nfc_callback, NULL); if (err) { printk("NFC T4T setup err: %d\n", err); - return; + return 0; } /** .. include_startingpoint_initial_msg_rst */ @@ -234,7 +234,7 @@ void main(void) err = nfc_t4t_emulation_start(); if (err) { printk("NFC T4T emulation start err: %d\n", err); - return; + return 0; } dk_set_led_on(LED_INIT); diff --git a/samples/nrf5340/empty_app_core/src/main.c b/samples/nrf5340/empty_app_core/src/main.c index 0bdb92e3fb3e..df490a7a8e35 100644 --- a/samples/nrf5340/empty_app_core/src/main.c +++ b/samples/nrf5340/empty_app_core/src/main.c @@ -36,11 +36,13 @@ void disable_ram_and_wfi(register volatile uint32_t *reg_begin, } while (1); } -void main(void) +int main(void) { /* Power off RAM and suspend CPU */ disable_ram_and_wfi(&NRF_VMC->RAM[0].POWER, &NRF_VMC->RAM[ARRAY_SIZE(NRF_VMC->RAM) - 1].POWER); + + return 0; } /** @brief Allow access to specific GPIOs for the network core. diff --git a/samples/nrf5340/empty_net_core/src/main.c b/samples/nrf5340/empty_net_core/src/main.c index 545f08bfbc4a..569945d796b1 100644 --- a/samples/nrf5340/empty_net_core/src/main.c +++ b/samples/nrf5340/empty_net_core/src/main.c @@ -6,7 +6,7 @@ #include -void main(void) +int main(void) { - ; /* Dummy application. Unused main */ + return 0; /* Dummy application. Unused main */ } diff --git a/samples/nrf5340/multiprotocol_rpmsg/src/main.c b/samples/nrf5340/multiprotocol_rpmsg/src/main.c index 3e47b12826bd..291d7fde2562 100644 --- a/samples/nrf5340/multiprotocol_rpmsg/src/main.c +++ b/samples/nrf5340/multiprotocol_rpmsg/src/main.c @@ -216,7 +216,7 @@ static struct ipc_ept_cfg hci_ept_cfg = { }, }; -void main(void) +int main(void) { int err; const struct device *hci_ipc_instance = DEVICE_DT_GET(DT_NODELABEL(ipc0)); diff --git a/samples/nrf5340/netboot/src/main.c b/samples/nrf5340/netboot/src/main.c index 10b2471aed74..b6b3326e3910 100644 --- a/samples/nrf5340/netboot/src/main.c +++ b/samples/nrf5340/netboot/src/main.c @@ -16,14 +16,14 @@ #include #include -void main(void) +int main(void) { int err; const struct device *fdev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)); if (!device_is_ready(fdev)) { printk("Flash device not ready\n"); - return; + return 0; } /* The flash is locked at flash page granularity */ @@ -86,8 +86,9 @@ void main(void) } bl_boot(fw_info_find(s0_addr)); - return; + return 0; failure: pcd_fw_copy_invalidate(); + return 0; } diff --git a/samples/nrf5340/remote_shell/src/main.c b/samples/nrf5340/remote_shell/src/main.c index 0ebe49e0a5ed..b7ad0b73cc74 100644 --- a/samples/nrf5340/remote_shell/src/main.c +++ b/samples/nrf5340/remote_shell/src/main.c @@ -128,7 +128,7 @@ static void uart_irq_handler(const struct device *dev, void *user_data) } } -void main(void) +int main(void) { int err; const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(ncs_remote_shell_uart)); @@ -136,14 +136,14 @@ void main(void) if (!device_is_ready(dev)) { LOG_ERR("Device not ready"); - return; + return 0; } if (IS_ENABLED(CONFIG_USB_DEVICE_STACK)) { err = usb_enable(NULL); if (err != 0) { LOG_ERR("Failed to enable USB, err %d", err); - return; + return 0; } } @@ -184,7 +184,7 @@ void main(void) err = shell_ipc_host_init(ipc_host_receive, (void *)dev); if (err) { LOG_ERR("Shell IPC host initialization failed, err %d", err); - return; + return 0; } for (;;) { diff --git a/samples/nrf9160/at_client/src/main.c b/samples/nrf9160/at_client/src/main.c index 33a50129fa58..f4b567e67013 100644 --- a/samples/nrf9160/at_client/src/main.c +++ b/samples/nrf9160/at_client/src/main.c @@ -23,7 +23,7 @@ void enable_xtal(void) (void)onoff_request(clk_mgr, &cli); } -void main(void) +int main(void) { int err; @@ -32,8 +32,10 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } enable_xtal(); printk("Ready\n"); + + return 0; } diff --git a/samples/nrf9160/at_monitor/src/main.c b/samples/nrf9160/at_monitor/src/main.c index 177e9664ef51..1d3fe9a2f7ac 100644 --- a/samples/nrf9160/at_monitor/src/main.c +++ b/samples/nrf9160/at_monitor/src/main.c @@ -131,7 +131,7 @@ static void psm_read(void) } } -void main(void) +int main(void) { int err; @@ -140,27 +140,27 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } printk("Subscribing to notifications\n"); err = nrf_modem_at_printf("AT+CEREG=1"); if (err) { printk("AT+CEREG failed\n"); - return; + return 0; } err = nrf_modem_at_printf("AT%%CESQ=1"); if (err) { printk("AT+CESQ failed\n"); - return; + return 0; } printk("Connecting to network\n"); err = nrf_modem_at_printf("AT+CFUN=1"); if (err) { printk("AT+CFUN failed\n"); - return; + return 0; } /* Let's monitor link quality while attempting to register to network */ @@ -189,7 +189,7 @@ void main(void) err = psm_control(ENABLE); if (err) { printk("Could not enable power saving mode\n"); - return; + return 0; } psm_read(); @@ -197,7 +197,7 @@ void main(void) err = nrf_modem_at_cmd(response, sizeof(response), "AT+CEREG?"); if (err) { printk("Failed to read CEREG, err %d\n", err); - return; + return 0; } printk("Modem response:\n%s", response); @@ -206,8 +206,9 @@ void main(void) err = nrf_modem_at_printf("AT+CFUN=0"); if (err) { printk("AT+CFUN failed\n"); - return; + return 0; } nrf_modem_lib_shutdown(); printk("Bye\n"); + return 0; } diff --git a/samples/nrf9160/aws_iot/src/main.c b/samples/nrf9160/aws_iot/src/main.c index b86eea006993..7b80e8a56dfa 100644 --- a/samples/nrf9160/aws_iot/src/main.c +++ b/samples/nrf9160/aws_iot/src/main.c @@ -466,7 +466,7 @@ static void date_time_event_handler(const struct date_time_evt *evt) } } -void main(void) +int main(void) { int err; @@ -478,7 +478,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { LOG_ERR("Modem library initialization failed, error: %d", err); - return; + return 0; } nrf_modem_lib_dfu_handler(err); @@ -490,7 +490,7 @@ void main(void) err = hw_id_get(device_id, ARRAY_SIZE(device_id)); if (err) { LOG_ERR("Failed to retrieve device ID, error: %d", err); - return; + return 0; } struct aws_iot_config config = { @@ -521,7 +521,7 @@ void main(void) err = lte_lc_init_and_connect_async(lte_handler); if (err) { LOG_ERR("Modem could not be configured, error: %d", err); - return; + return 0; } err = modem_info_init(); @@ -540,4 +540,6 @@ void main(void) /* Postpone connecting to AWS IoT until date time has been obtained. */ k_sem_take(&date_time_obtained, K_FOREVER); k_work_schedule(&connect_work, K_NO_WAIT); + + return 0; } diff --git a/samples/nrf9160/azure_fota/src/main.c b/samples/nrf9160/azure_fota/src/main.c index 1ef9a3a58e52..e4eaaf3d6aff 100644 --- a/samples/nrf9160/azure_fota/src/main.c +++ b/samples/nrf9160/azure_fota/src/main.c @@ -190,7 +190,7 @@ static void modem_configure(void) } } -void main(void) +int main(void) { int err; @@ -222,7 +222,7 @@ void main(void) case -1: LOG_INF("Could not initialize modem library"); LOG_INF("Fatal error."); - return; + return 0; default: break; } @@ -233,7 +233,7 @@ void main(void) if (err) { LOG_ERR("Azure IoT Hub could not be initialized, error: %d", err); - return; + return 0; } LOG_INF("Connecting to LTE network"); @@ -246,7 +246,7 @@ void main(void) err = hw_id_get(device_id, ARRAY_SIZE(device_id)); if (err) { LOG_ERR("Failed to retrieve device ID"); - return; + return 0; } #endif @@ -264,7 +264,7 @@ void main(void) err = azure_iot_hub_connect(&config); if (err < 0) { LOG_ERR("azure_iot_hub_connect failed: %d", err); - return; + return 0; } k_sem_take(&cloud_connected_sem, K_FOREVER); @@ -273,4 +273,6 @@ void main(void) * image as working so that we will not revert upon reboot. */ boot_write_img_confirmed(); + + return 0; } diff --git a/samples/nrf9160/azure_iot_hub/src/main.c b/samples/nrf9160/azure_iot_hub/src/main.c index f29db57d0047..6a90f33b5cee 100644 --- a/samples/nrf9160/azure_iot_hub/src/main.c +++ b/samples/nrf9160/azure_iot_hub/src/main.c @@ -528,7 +528,7 @@ static int dps_run(struct azure_iot_hub_buf *hostname, struct azure_iot_hub_buf } #endif /* CONFIG_AZURE_IOT_HUB_DPS */ -void main(void) +int main(void) { int err; @@ -538,7 +538,7 @@ void main(void) err = hw_id_get(device_id, ARRAY_SIZE(device_id)); if (err) { LOG_ERR("Failed to retrieve device ID"); - return; + return 0; } #else char device_id[128] = CONFIG_AZURE_IOT_HUB_DEVICE_ID; @@ -564,7 +564,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { LOG_ERR("Modem library initialization failed, error: %d", err); - return; + return 0; } #endif @@ -587,14 +587,14 @@ void main(void) err = dps_run(&cfg.hostname, &cfg.device_id); if (err) { LOG_ERR("Failed to run DPS, error: %d, terminating connection attempt", err); - return; + return 0; } #endif err = azure_iot_hub_init(azure_event_handler); if (err) { LOG_ERR("Azure IoT Hub could not be initialized, error: %d", err); - return; + return 0; } LOG_INF("Azure IoT Hub library initialized"); @@ -602,7 +602,7 @@ void main(void) err = azure_iot_hub_connect(&cfg); if (err < 0) { LOG_ERR("azure_iot_hub_connect failed: %d", err); - return; + return 0; } LOG_INF("Connection request sent to IoT Hub"); @@ -612,4 +612,5 @@ void main(void) * See azure_event_handler() for which actions will be taken on the * various events. */ + return 0; } diff --git a/samples/nrf9160/ciphersuites/src/main.c b/samples/nrf9160/ciphersuites/src/main.c index 58819be62017..26f405883450 100644 --- a/samples/nrf9160/ciphersuites/src/main.c +++ b/samples/nrf9160/ciphersuites/src/main.c @@ -136,7 +136,7 @@ int tls_setup(int fd) return 0; } -void main(void) +int main(void) { int err; int fd; @@ -152,27 +152,27 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } /* Provision certificates before connecting to the LTE network */ err = cert_provision(); if (err) { - return; + return 0; } printk("Waiting for network.. "); err = lte_lc_init_and_connect(); if (err) { printk("Failed to connect to the LTE network, err %d\n", err); - return; + return 0; } printk("OK\n"); err = getaddrinfo(HTTPS_HOSTNAME, NULL, &hints, &res); if (err) { printk("getaddrinfo() failed, err %d, %s\n", errno, strerror(errno)); - return; + return 0; } ((struct sockaddr_in *)res->ai_addr)->sin_port = htons(HTTPS_PORT); @@ -233,4 +233,6 @@ void main(void) (void)close(fd); lte_lc_power_off(); + + return 0; } diff --git a/samples/nrf9160/coap_client/src/main.c b/samples/nrf9160/coap_client/src/main.c index 8c4441c6f5d6..ff63f6601a55 100644 --- a/samples/nrf9160/coap_client/src/main.c +++ b/samples/nrf9160/coap_client/src/main.c @@ -220,7 +220,7 @@ static int wait(int timeout) return 0; } -void main(void) +int main(void) { int64_t next_msg_time = APP_COAP_SEND_INTERVAL_MS; int err, received; @@ -230,19 +230,19 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } modem_configure(); if (server_resolve() != 0) { printk("Failed to resolve server name\n"); - return; + return 0; } if (client_init() != 0) { printk("Failed to initialize CoAP client\n"); - return; + return 0; } next_msg_time = k_uptime_get(); @@ -297,4 +297,6 @@ void main(void) } (void)close(sock); + + return 0; } diff --git a/samples/nrf9160/download/src/main.c b/samples/nrf9160/download/src/main.c index ae32d6cfa533..560bf2443cd5 100644 --- a/samples/nrf9160/download/src/main.c +++ b/samples/nrf9160/download/src/main.c @@ -169,7 +169,7 @@ static int callback(const struct download_client_evt *event) return 0; } -void main(void) +int main(void) { int err; @@ -178,14 +178,14 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } #if CONFIG_SAMPLE_SECURE_SOCKET /* Provision certificates before connecting to the network */ err = cert_provision(); if (err) { - return; + return 0; } #endif @@ -193,7 +193,7 @@ void main(void) err = lte_lc_init_and_connect(); if (err) { printk("Failed to connect to the LTE network, err %d\n", err); - return; + return 0; } printk("OK\n"); @@ -201,7 +201,7 @@ void main(void) err = download_client_init(&downloader, callback); if (err) { printk("Failed to initialize the client, err %d", err); - return; + return 0; } #if CONFIG_SAMPLE_COMPUTE_HASH @@ -212,7 +212,7 @@ void main(void) err = download_client_connect(&downloader, URL, &config); if (err) { printk("Failed to connect, err %d", err); - return; + return 0; } ref_time = k_uptime_get(); @@ -220,8 +220,10 @@ void main(void) err = download_client_start(&downloader, URL, STARTING_OFFSET); if (err) { printk("Failed to start the downloader, err %d", err); - return; + return 0; } printk("Downloading %s\n", URL); + + return 0; } diff --git a/samples/nrf9160/fmfu_smp_svr/src/main.c b/samples/nrf9160/fmfu_smp_svr/src/main.c index 6a3d80d6175d..e383dc1fb6ed 100644 --- a/samples/nrf9160/fmfu_smp_svr/src/main.c +++ b/samples/nrf9160/fmfu_smp_svr/src/main.c @@ -11,7 +11,7 @@ #include #include -void main(void) +int main(void) { int err = nrf_modem_lib_init(); @@ -46,4 +46,6 @@ void main(void) } else { printk("Current image not confirmed yet\n\r"); } + + return 0; } diff --git a/samples/nrf9160/http_update/application_update/src/main.c b/samples/nrf9160/http_update/application_update/src/main.c index 5b1729ea082a..dedb4127856d 100644 --- a/samples/nrf9160/http_update/application_update/src/main.c +++ b/samples/nrf9160/http_update/application_update/src/main.c @@ -171,7 +171,7 @@ int lwm2m_carrier_event_handler(const lwm2m_carrier_event_t *event) } #endif /* CONFIG_LWM2M_CARRIER */ -void main(void) +int main(void) { int err; @@ -182,7 +182,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Failed to initialize modem library!"); - return; + return 0; } #endif /* This is needed so that MCUBoot won't revert the update */ @@ -191,7 +191,7 @@ void main(void) err = fota_download_init(fota_dl_handler); if (err != 0) { printk("fota_download_init() failed, err %d\n", err); - return; + return 0; } err = update_sample_init(&(struct update_sample_init_params){ @@ -201,8 +201,10 @@ void main(void) }); if (err != 0) { printk("update_sample_init() failed, err %d\n", err); - return; + return 0; } printk("Press Button 1 or enter 'download' to download firmware update\n"); + + return 0; } diff --git a/samples/nrf9160/http_update/full_modem_update/src/main.c b/samples/nrf9160/http_update/full_modem_update/src/main.c index 5b6623a346eb..21955094ce60 100644 --- a/samples/nrf9160/http_update/full_modem_update/src/main.c +++ b/samples/nrf9160/http_update/full_modem_update/src/main.c @@ -193,7 +193,7 @@ static int shell_flash(const struct shell *shell, size_t argc, char **argv) SHELL_CMD_REGISTER(flash, NULL, "For rebooting device", shell_flash); -void main(void) +int main(void) { int err; @@ -201,7 +201,7 @@ void main(void) if (!device_is_ready(flash_dev)) { printk("Flash device %s not ready\n", flash_dev->name); - return; + return 0; } err = nrf_modem_lib_init(); @@ -217,13 +217,13 @@ void main(void) err = button_init(); if (err != 0) { printk("button_init() failed: %d\n", err); - return; + return 0; } err = fota_download_init(fota_dl_handler); if (err != 0) { printk("fota_download_init() failed, err %d\n", err); - return; + return 0; } const struct dfu_target_full_modem_params params = { @@ -237,13 +237,13 @@ void main(void) err = dfu_target_full_modem_cfg(¶ms); if (err != 0) { printk("dfu_target_full_modem_cfg failed: %d\n", err); - return; + return 0; } err = modem_info_init(); if (err != 0) { printk("modem_info_init failed: %d\n", err); - return; + return 0; } modem_info_string_get(MODEM_INFO_FW_VERSION, modem_version, @@ -257,9 +257,11 @@ void main(void) }); if (err != 0) { printk("update_sample_init() failed, err %d\n", err); - return; + return 0; } printk("Press Button 1 or enter 'download' to download firmware update\n"); printk("Press Button 2 or enter 'flash' to apply modem firmware update from flash\n"); + + return 0; } diff --git a/samples/nrf9160/http_update/modem_delta_update/src/main.c b/samples/nrf9160/http_update/modem_delta_update/src/main.c index 0a26d3332320..6f24467a9e0e 100644 --- a/samples/nrf9160/http_update/modem_delta_update/src/main.c +++ b/samples/nrf9160/http_update/modem_delta_update/src/main.c @@ -77,7 +77,7 @@ static int num_leds(void) } } -void main(void) +int main(void) { int err; @@ -111,7 +111,7 @@ void main(void) case -1: printk("Could not initialize momdem library.\n"); printk("Fatal error.\n"); - return; + return 0; default: break; } @@ -120,7 +120,7 @@ void main(void) err = fota_download_init(fota_dl_handler); if (err != 0) { printk("fota_download_init() failed, err %d\n", err); - return; + return 0; } err = update_sample_init(&(struct update_sample_init_params){ @@ -130,10 +130,12 @@ void main(void) }); if (err != 0) { printk("update_sample_init() failed, err %d\n", err); - return; + return 0; } printk("Current modem firmware version: %s\n", version); printk("Press Button 1 for enter 'download' to download modem delta update\n"); + + return 0; } diff --git a/samples/nrf9160/https_client/src/main.c b/samples/nrf9160/https_client/src/main.c index 534c87feac6d..4fed628cbe34 100644 --- a/samples/nrf9160/https_client/src/main.c +++ b/samples/nrf9160/https_client/src/main.c @@ -165,7 +165,7 @@ int tls_setup(int fd) return 0; } -void main(void) +int main(void) { int err; int fd; @@ -184,7 +184,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } /* Setup a callback for the default PDP context (zero). @@ -194,14 +194,14 @@ void main(void) err = pdn_default_ctx_cb_reg(pdn_event_handler); if (err) { printk("pdn_default_ctx_cb_reg() failed, err %d\n", err); - return; + return 0; } #if !defined(CONFIG_SAMPLE_TFM_MBEDTLS) /* Provision certificates before connecting to the LTE network */ err = cert_provision(); if (err) { - return; + return 0; } #endif @@ -209,7 +209,7 @@ void main(void) err = lte_lc_init_and_connect(); if (err) { printk("Failed to connect to the LTE network, err %d\n", err); - return; + return 0; } printk("OK\n"); @@ -226,7 +226,7 @@ void main(void) err = getaddrinfo(HTTPS_HOSTNAME, HTTPS_PORT, &hints, &res); if (err) { printk("getaddrinfo() failed, err %d\n", errno); - return; + return 0; } inet_ntop(res->ai_family, &((struct sockaddr_in *)(res->ai_addr))->sin_addr, peer_addr, @@ -303,4 +303,6 @@ void main(void) (void)close(fd); lte_lc_power_off(); + + return 0; } diff --git a/samples/nrf9160/lte_ble_gateway/src/main.c b/samples/nrf9160/lte_ble_gateway/src/main.c index 9cb26d337299..e6b6a1303087 100644 --- a/samples/nrf9160/lte_ble_gateway/src/main.c +++ b/samples/nrf9160/lte_ble_gateway/src/main.c @@ -573,7 +573,7 @@ static void buttons_leds_init(void) } } -void main(void) +int main(void) { LOG_INF("LTE Sensor Gateway sample started"); @@ -584,4 +584,6 @@ void main(void) modem_configure(); cloud_init(); cloud_connect(NULL); + + return 0; } diff --git a/samples/nrf9160/lwm2m_carrier/src/main.c b/samples/nrf9160/lwm2m_carrier/src/main.c index 472fc8101a57..2c7b18504938 100644 --- a/samples/nrf9160/lwm2m_carrier/src/main.c +++ b/samples/nrf9160/lwm2m_carrier/src/main.c @@ -159,7 +159,8 @@ int lwm2m_carrier_event_handler(const lwm2m_carrier_event_t *event) } #endif /* CONFIG_LWM2M_CARRIER */ -void main(void) +int main(void) { printk("LWM2M Carrier library sample.\n"); + return 0; } diff --git a/samples/nrf9160/lwm2m_client/src/main.c b/samples/nrf9160/lwm2m_client/src/main.c index e7cd7ee4184b..b89f18821924 100644 --- a/samples/nrf9160/lwm2m_client/src/main.c +++ b/samples/nrf9160/lwm2m_client/src/main.c @@ -580,7 +580,7 @@ static void suspend_lwm2m_engine(void) } } -void main(void) +int main(void) { int ret; uint32_t bootstrap_flags = 0; @@ -590,20 +590,20 @@ void main(void) ret = nrf_modem_lib_init(); if (ret < 0) { LOG_ERR("Unable to init modem library (%d)", ret); - return; + return 0; } ret = app_event_manager_init(); if (ret) { LOG_ERR("Unable to init Application Event Manager (%d)", ret); - return; + return 0; } LOG_INF("Initializing modem."); ret = lte_lc_init(); if (ret < 0) { LOG_ERR("Unable to init modem (%d)", ret); - return; + return 0; } lte_lc_register_handler(lte_notify_handler); @@ -611,14 +611,14 @@ void main(void) ret = modem_info_init(); if (ret < 0) { LOG_ERR("Unable to init modem_info (%d)", ret); - return; + return 0; } /* query IMEI */ ret = modem_info_string_get(MODEM_INFO_IMEI, imei_buf, sizeof(imei_buf)); if (ret < 0) { LOG_ERR("Unable to get IMEI"); - return; + return 0; } /* use IMEI as unique endpoint name */ @@ -630,14 +630,14 @@ void main(void) ret = lwm2m_setup(); if (ret < 0) { LOG_ERR("Failed to setup LWM2M fields (%d)", ret); - return; + return 0; } #if defined(CONFIG_LWM2M_CLIENT_UTILS_FIRMWARE_UPDATE_OBJ_SUPPORT) ret = lwm2m_init_image(); if (ret < 0) { LOG_ERR("Failed to setup image properties (%d)", ret); - return; + return 0; } #endif @@ -771,4 +771,6 @@ void main(void) /* Wait for statmachine update event */ k_sem_take(&state_mutex, K_FOREVER); } + + return 0; } diff --git a/samples/nrf9160/memfault/src/main.c b/samples/nrf9160/memfault/src/main.c index f34fdc2f11f3..f959da7b79b4 100644 --- a/samples/nrf9160/memfault/src/main.c +++ b/samples/nrf9160/memfault/src/main.c @@ -181,7 +181,7 @@ static void handle_lte_connection_started(void) memfault_zephyr_port_post_data(); } -void main(void) +int main(void) { int err; diff --git a/samples/nrf9160/modem_callbacks/src/main.c b/samples/nrf9160/modem_callbacks/src/main.c index 7ed5fef35c8a..50ccad30ee8a 100644 --- a/samples/nrf9160/modem_callbacks/src/main.c +++ b/samples/nrf9160/modem_callbacks/src/main.c @@ -30,7 +30,7 @@ static void on_cfun(enum lte_lc_func_mode mode, void *ctx) printk("> Functional mode has changed to %d\n", mode); } -void main(void) +int main(void) { int err; @@ -40,7 +40,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem initialization failed, err %d\n", err); - return; + return 0; } printk("Changing functional mode\n"); @@ -53,8 +53,10 @@ void main(void) err = nrf_modem_lib_shutdown(); if (err) { printk("Shutting down modem failed, err %d\n", err); - return; + return 0; } printk("Bye\n"); + + return 0; } diff --git a/samples/nrf9160/modem_shell/src/main.c b/samples/nrf9160/modem_shell/src/main.c index 6de05369878f..f2fee72d6ce2 100644 --- a/samples/nrf9160/modem_shell/src/main.c +++ b/samples/nrf9160/modem_shell/src/main.c @@ -198,7 +198,7 @@ static void button_handler(uint32_t button_states, uint32_t has_changed) } #endif -void main(void) +int main(void) { int err; struct k_work_queue_config cfg = { @@ -255,19 +255,19 @@ void main(void) printk("Modem firmware update successful!\n"); printk("Modem will run the new firmware after reboot\n"); sys_reboot(SYS_REBOOT_WARM); - return; + return 0; case NRF_MODEM_DFU_RESULT_UUID_ERROR: case NRF_MODEM_DFU_RESULT_AUTH_ERROR: printk("Modem firmware update failed!\n"); printk("Modem will run non-updated firmware on reboot.\n"); sys_reboot(SYS_REBOOT_WARM); - return; + return 0; case NRF_MODEM_DFU_RESULT_HARDWARE_ERROR: case NRF_MODEM_DFU_RESULT_INTERNAL_ERROR: printk("Modem firmware update failed!\n"); printk("Fatal error.\n"); sys_reboot(SYS_REBOOT_WARM); - return; + return 0; case NRF_MODEM_DFU_RESULT_VOLTAGE_LOW: printk("Modem firmware update cancelled due to low power.\n"); printk("Please reboot once you have sufficient power for the DFU\n"); @@ -276,7 +276,7 @@ void main(void) /* Modem library initialization failed. */ printk("Could not initialize nrf_modem_lib, err %d.\n", err); printk("Fatal error.\n"); - return; + return 0; } #else /* Wait until the LwM2M carrier library has initialized the modem library. */ @@ -308,7 +308,7 @@ void main(void) err = modem_info_init(); if (err) { printk("Modem info could not be established: %d\n", err); - return; + return 0; } #endif @@ -346,4 +346,6 @@ void main(void) at_cmd_mode_start(mosh_shell); } #endif + + return 0; } diff --git a/samples/nrf9160/modem_trace_backend/src/main.c b/samples/nrf9160/modem_trace_backend/src/main.c index cf57b8bc0c77..7fde3abe6714 100644 --- a/samples/nrf9160/modem_trace_backend/src/main.c +++ b/samples/nrf9160/modem_trace_backend/src/main.c @@ -18,7 +18,7 @@ static void on_cfun(enum lte_lc_func_mode mode, void *context) printk("LTE mode changed to %d\n", mode); } -void main(void) +int main(void) { int err; @@ -28,14 +28,14 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } printk("Connecting to network\n"); err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL); if (err) { printk("Failed to change LTE mode, err %d\n", err); - return; + return 0; } k_sleep(K_SECONDS(5)); @@ -43,10 +43,12 @@ void main(void) err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_POWER_OFF); if (err) { printk("Failed to change LTE mode, err %d\n", err); - return; + return 0; } nrf_modem_lib_shutdown(); printk("Bye\n"); + + return 0; } diff --git a/samples/nrf9160/modem_trace_flash/src/main.c b/samples/nrf9160/modem_trace_flash/src/main.c index d90e3d3cb131..a17e58915d9a 100644 --- a/samples/nrf9160/modem_trace_flash/src/main.c +++ b/samples/nrf9160/modem_trace_flash/src/main.c @@ -99,7 +99,7 @@ void nrf_modem_lib_trace_callback(enum nrf_modem_lib_trace_event evt) } } -void main(void) +int main(void) { int err; @@ -126,7 +126,7 @@ void main(void) err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL); if (err) { LOG_ERR("Failed to change LTE mode, err %d\n", err); - return; + return 0; } /* Leave the modem on for 10 seconds */ @@ -135,7 +135,7 @@ void main(void) err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_POWER_OFF); if (err) { LOG_ERR("Failed to change LTE mode, err %d\n", err); - return; + return 0; } /* Give the modem some time to turn off and receive traces */ @@ -155,4 +155,6 @@ void main(void) LOG_INF("Press button 1 to print traces to UART"); LOG_INF("Press button 2 to restart application (warm boot)"); + + return 0; } diff --git a/samples/nrf9160/nidd/src/main.c b/samples/nrf9160/nidd/src/main.c index 22d1a2d1b873..d017a8150740 100644 --- a/samples/nrf9160/nidd/src/main.c +++ b/samples/nrf9160/nidd/src/main.c @@ -211,7 +211,7 @@ static void nidd_send_and_recv(int fd) } } -void main(void) +int main(void) { int cid, pdn_id, fd; @@ -242,4 +242,6 @@ void main(void) power_off: modem_power_off(); printk("NIDD sample done\n"); + + return 0; } diff --git a/samples/nrf9160/nrf_cloud_mqtt_multi_service/src/main.c b/samples/nrf9160/nrf_cloud_mqtt_multi_service/src/main.c index f801295e7094..074280e0cc61 100644 --- a/samples/nrf9160/nrf_cloud_mqtt_multi_service/src/main.c +++ b/samples/nrf9160/nrf_cloud_mqtt_multi_service/src/main.c @@ -43,7 +43,8 @@ K_THREAD_DEFINE(con_thread, CONFIG_CONNECTION_THREAD_STACK_SIZE, connection_mana * but for illustrative purposes we don't use it. main_application() could be called directly * from this function, rather than given its own dedicated thread. */ -void main(void) +int main(void) { LOG_INF("nRF Cloud MQTT multi-service sample has started."); + return 0; } diff --git a/samples/nrf9160/nrf_cloud_rest_cell_location/src/main.c b/samples/nrf9160/nrf_cloud_rest_cell_location/src/main.c index 2f0269269fdf..d8458889b6b1 100644 --- a/samples/nrf9160/nrf_cloud_rest_cell_location/src/main.c +++ b/samples/nrf9160/nrf_cloud_rest_cell_location/src/main.c @@ -586,7 +586,7 @@ static void connect_to_network(void) modem_time_wait(); } -void main(void) +int main(void) { int err; @@ -595,7 +595,7 @@ void main(void) err = init(); if (err) { LOG_ERR("Initialization failed"); - return; + return 0; } connect_to_network(); diff --git a/samples/nrf9160/nrf_cloud_rest_device_message/src/main.c b/samples/nrf9160/nrf_cloud_rest_device_message/src/main.c index 834bdaab7082..933827c9be38 100644 --- a/samples/nrf9160/nrf_cloud_rest_device_message/src/main.c +++ b/samples/nrf9160/nrf_cloud_rest_device_message/src/main.c @@ -369,7 +369,7 @@ int send_hello_world_msg(void) return err; } -void main(void) +int main(void) { int err; @@ -379,7 +379,7 @@ void main(void) err = setup(); if (err) { LOG_ERR("Setup failed, stopping."); - return; + return 0; } rest_ctx.keep_alive = true; @@ -390,7 +390,7 @@ void main(void) err = send_hello_world_msg(); if (err) { LOG_ERR("Hello World failed, stopping."); - return; + return 0; } while (1) { diff --git a/samples/nrf9160/nrf_cloud_rest_fota/src/main.c b/samples/nrf9160/nrf_cloud_rest_fota/src/main.c index 706edbffb3cc..ecd428a35282 100644 --- a/samples/nrf9160/nrf_cloud_rest_fota/src/main.c +++ b/samples/nrf9160/nrf_cloud_rest_fota/src/main.c @@ -727,7 +727,7 @@ static void error_reboot(void) sys_reboot(SYS_REBOOT_COLD); } -void main(void) +int main(void) { int err; @@ -737,12 +737,12 @@ void main(void) err = init(); if (err) { LOG_ERR("Initialization failed"); - return; + return 0; } err = connect_to_network(); if (err) { - return; + return 0; } /* Now that the device is connected to the network, get the modem info */ diff --git a/samples/nrf9160/pdn/src/main.c b/samples/nrf9160/pdn/src/main.c index f54fac21b16b..0b4de396a060 100644 --- a/samples/nrf9160/pdn/src/main.c +++ b/samples/nrf9160/pdn/src/main.c @@ -92,7 +92,7 @@ void pdn_event_handler(uint8_t cid, enum pdn_event event, int reason) } } -void main(void) +int main(void) { int err; int esm; @@ -104,7 +104,7 @@ void main(void) err = nrf_modem_lib_init(); if (err) { printk("Modem library initialization failed, error: %d\n", err); - return; + return 0; } /* Setup a callback for the default PDP context (zero). @@ -114,18 +114,18 @@ void main(void) err = pdn_default_ctx_cb_reg(pdn_event_handler); if (err) { printk("pdn_default_ctx_cb_reg() failed, err %d\n", err); - return; + return 0; } err = lte_lc_init_and_connect(); if (err) { - return; + return 0; } err = pdn_default_apn_get(apn, sizeof(apn)); if (err) { printk("pdn_default_apn_get() failed, err %d\n", err); - return; + return 0; } printk("Default APN is %s\n", apn); @@ -134,7 +134,7 @@ void main(void) err = pdn_ctx_create(&cid, pdn_event_handler); if (err) { printk("pdn_ctx_create() failed, err %d\n", err); - return; + return 0; } printk("Created new PDP context %d\n", cid); @@ -143,7 +143,7 @@ void main(void) err = pdn_ctx_configure(cid, apn, PDN_FAM_IPV4V6, NULL); if (err) { printk("pdn_ctx_configure() failed, err %d\n", err); - return; + return 0; } printk("PDP context %d configured: APN %s, Family %s\n", @@ -154,7 +154,7 @@ void main(void) if (err) { printk("pdn_activate() failed, err %d esm %d %s\n", err, esm, pdn_esm_strerror(err)); - return; + return 0; } printk("PDP Context %d, PDN ID %d\n", 0, pdn_id_get(0)); @@ -164,4 +164,6 @@ void main(void) lte_lc_power_off(); printk("Bye\n"); + + return 0; } diff --git a/samples/nrf9160/slm_shell/src/main.c b/samples/nrf9160/slm_shell/src/main.c index ddbfb6580b59..ddeb6684dbe8 100644 --- a/samples/nrf9160/slm_shell/src/main.c +++ b/samples/nrf9160/slm_shell/src/main.c @@ -21,9 +21,10 @@ static void cereg_mon(const char *notif) } } -void main(void) +int main(void) { LOG_INF("SLM Shell starts on %s", CONFIG_BOARD); (void)modem_slm_init(NULL); + return 0; } diff --git a/samples/nrf9160/sms/src/main.c b/samples/nrf9160/sms/src/main.c index f96c3104f481..89054b6a157b 100644 --- a/samples/nrf9160/sms/src/main.c +++ b/samples/nrf9160/sms/src/main.c @@ -53,7 +53,7 @@ static void sms_callback(struct sms_data *const data, void *context) } } -void main(void) +int main(void) { int handle = 0; int ret = 0; @@ -63,19 +63,19 @@ void main(void) ret = nrf_modem_lib_init(); if (ret) { printk("Modem library initialization failed, error: %d\n", ret); - return; + return 0; } ret = lte_lc_init_and_connect(); if (ret) { printk("Lte_lc failed to initialize and connect, err %d", ret); - return; + return 0; } handle = sms_register_listener(sms_callback, NULL); if (handle) { printk("sms_register_listener returned err: %d\n", handle); - return; + return 0; } printk("SMS sample is ready for receiving messages\n"); @@ -100,4 +100,5 @@ void main(void) * However, this sample will continue to be registered for * received SMS messages and they can be seen in serial port log. */ + return 0; } diff --git a/samples/nrf9160/udp/src/main.c b/samples/nrf9160/udp/src/main.c index eb1986b5d7f2..464c55f8fe89 100644 --- a/samples/nrf9160/udp/src/main.c +++ b/samples/nrf9160/udp/src/main.c @@ -208,7 +208,7 @@ static int server_connect(void) return err; } -void main(void) +int main(void) { int err; @@ -238,14 +238,16 @@ void main(void) err = server_init(); if (err) { printk("Not able to initialize UDP server connection\n"); - return; + return 0; } err = server_connect(); if (err) { printk("Not able to connect to UDP server\n"); - return; + return 0; } k_work_schedule(&server_transmission_work, K_NO_WAIT); + + return 0; } diff --git a/samples/nrf_profiler/src/main.c b/samples/nrf_profiler/src/main.c index ff441061e9cb..d3e3e26755e3 100644 --- a/samples/nrf_profiler/src/main.c +++ b/samples/nrf_profiler/src/main.c @@ -55,7 +55,7 @@ static void register_nrf_profiler_events(void) data_types, 5); } -void main(void) +int main(void) { if (nrf_profiler_init()) { printk("Profiler failed to initialize\n"); @@ -89,7 +89,7 @@ void main(void) if ((err < 0) || (err >= sizeof(string))) { printk("snprintf error: %d\n", err); - return; + return 0; } profile_no_data_event(); diff --git a/samples/nrf_rpc/entropy_nrf53/cpuapp/src/main.c b/samples/nrf_rpc/entropy_nrf53/cpuapp/src/main.c index 71aaa1d8f8e8..d464d7c69906 100644 --- a/samples/nrf_rpc/entropy_nrf53/cpuapp/src/main.c +++ b/samples/nrf_rpc/entropy_nrf53/cpuapp/src/main.c @@ -30,7 +30,7 @@ static void result_callback(int result, uint8_t *buffer, size_t length) printk("\n"); } -void main(void) +int main(void) { int err; @@ -39,7 +39,7 @@ void main(void) err = entropy_remote_init(); if (err) { printk("Remote entropy driver initialization failed\n"); - return; + return 0; } printk("Remote init send\n"); diff --git a/samples/nrf_rpc/entropy_nrf53/cpunet/src/main.c b/samples/nrf_rpc/entropy_nrf53/cpunet/src/main.c index b7399229e25e..0df4dc664327 100644 --- a/samples/nrf_rpc/entropy_nrf53/cpunet/src/main.c +++ b/samples/nrf_rpc/entropy_nrf53/cpunet/src/main.c @@ -6,7 +6,7 @@ #include -void main(void) +int main(void) { /* The only activity of this application is interaction with the APP * core using serialized communication through the nRF RPC library. @@ -14,4 +14,5 @@ void main(void) * and start at system boot. */ printk("Entropy sample started[NET Core].\n"); + return 0; } diff --git a/samples/openthread/cli/src/main.c b/samples/openthread/cli/src/main.c index 899b731f0e06..c74cc9179ae8 100644 --- a/samples/openthread/cli/src/main.c +++ b/samples/openthread/cli/src/main.c @@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(cli_sample, CONFIG_OT_COMMAND_LINE_INTERFACE_LOG_LEVEL); "documentation at:\n\r" \ "https://github.com/openthread/openthread/blob/master/src/cli/README.md\n\r" -void main(void) +int main(void) { #if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart) int ret; @@ -40,13 +40,13 @@ void main(void) ret = usb_enable(NULL); if (ret != 0) { LOG_ERR("Failed to enable USB"); - return; + return 0; } dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart)); if (dev == NULL) { LOG_ERR("Failed to find specific UART device"); - return; + return 0; } LOG_INF("Waiting for host to be ready to communicate"); @@ -77,4 +77,6 @@ void main(void) #if defined(CONFIG_CLI_SAMPLE_LOW_POWER) low_power_enable(); #endif + + return 0; } diff --git a/samples/openthread/coap_client/src/coap_client.c b/samples/openthread/coap_client/src/coap_client.c index 6e4ac89485e2..3eea8ec6a0e1 100644 --- a/samples/openthread/coap_client/src/coap_client.c +++ b/samples/openthread/coap_client/src/coap_client.c @@ -120,7 +120,7 @@ static void on_button_changed(uint32_t button_state, uint32_t has_changed) } } -void main(void) +int main(void) { int ret; @@ -133,13 +133,13 @@ void main(void) ret = dk_buttons_init(on_button_changed); if (ret) { LOG_ERR("Cannot init buttons (error: %d)", ret); - return; + return 0; } ret = dk_leds_init(); if (ret) { LOG_ERR("Cannot init leds, (error: %d)", ret); - return; + return 0; } #if CONFIG_BT_NUS @@ -151,10 +151,12 @@ void main(void) ret = ble_utils_init(&nus_clbs, on_ble_connect, on_ble_disconnect); if (ret) { LOG_ERR("Cannot init BLE utilities"); - return; + return 0; } #endif /* CONFIG_BT_NUS */ coap_client_utils_init(on_ot_connect, on_ot_disconnect, on_mtd_mode_toggle); + + return 0; } diff --git a/samples/openthread/coap_server/src/coap_server.c b/samples/openthread/coap_server/src/coap_server.c index 9c6ce63605af..6327a3ab77fa 100644 --- a/samples/openthread/coap_server/src/coap_server.c +++ b/samples/openthread/coap_server/src/coap_server.c @@ -127,7 +127,7 @@ static void on_thread_state_changed(otChangedFlags flags, struct openthread_cont static struct openthread_state_changed_cb ot_state_chaged_cb = { .state_changed_cb = on_thread_state_changed }; -void main(void) +int main(void) { int ret; @@ -160,5 +160,5 @@ void main(void) openthread_start(openthread_get_default_context()); end: - return; + return 0; } diff --git a/samples/openthread/coprocessor/src/main.c b/samples/openthread/coprocessor/src/main.c index a9436f1bcfca..6cab1a247df6 100644 --- a/samples/openthread/coprocessor/src/main.c +++ b/samples/openthread/coprocessor/src/main.c @@ -15,7 +15,8 @@ LOG_MODULE_REGISTER(coprocessor_sample, CONFIG_OT_COPROCESSOR_LOG_LEVEL); "OpenThread Coprocessor application is now running on NCS.\n\r" \ "=========================================================\n\r" -void main(void) +int main(void) { LOG_INF(WELCOME_TEXT); + return 0; } diff --git a/samples/peripheral/lpuart/src/main.c b/samples/peripheral/lpuart/src/main.c index aa10c3a14af7..0a0a9a9571de 100644 --- a/samples/peripheral/lpuart/src/main.c +++ b/samples/peripheral/lpuart/src/main.c @@ -119,7 +119,7 @@ static void async(const struct device *lpuart) } } -void main(void) +int main(void) { const struct device *lpuart = DEVICE_DT_GET(DT_NODELABEL(lpuart)); @@ -130,4 +130,6 @@ void main(void) } else { async(lpuart); } + + return 0; } diff --git a/samples/peripheral/radio_test/src/main.c b/samples/peripheral/radio_test/src/main.c index ed81fe8710d9..3bc26f7cc7b8 100644 --- a/samples/peripheral/radio_test/src/main.c +++ b/samples/peripheral/radio_test/src/main.c @@ -40,9 +40,11 @@ static void clock_init(void) printk("Clock has started\n"); } -void main(void) +int main(void) { printk("Starting Radio Test example\n"); clock_init(); + + return 0; } diff --git a/samples/sensor/bh1749/src/main.c b/samples/sensor/bh1749/src/main.c index e1c09cb65489..48cad8721764 100644 --- a/samples/sensor/bh1749/src/main.c +++ b/samples/sensor/bh1749/src/main.c @@ -130,7 +130,7 @@ static void process(const struct device *dev) } } -void main(void) +int main(void) { const struct device *dev = DEVICE_DT_GET_ONE(rohm_bh1749); @@ -141,9 +141,11 @@ void main(void) if (!device_is_ready(dev)) { printk("Sensor device not ready\n"); - return; + return 0; } printk("device is %p, name is %s\n", dev, dev->name); process(dev); + + return 0; } diff --git a/samples/tfm/provisioning_image/src/main.c b/samples/tfm/provisioning_image/src/main.c index adc8330f0b26..4d99a90b54e2 100644 --- a/samples/tfm/provisioning_image/src/main.c +++ b/samples/tfm/provisioning_image/src/main.c @@ -25,7 +25,7 @@ void provision_implementation_id(void) num_words_to_write); } -void main(void) +int main(void) { enum lcs lcs; int err; @@ -33,12 +33,12 @@ void main(void) err = read_life_cycle_state(&lcs); if (err != 0) { LOG_INF("Failure: Cannot read PSA lifecycle state. Exiting!"); - return; + return 0; } if (lcs != BL_STORAGE_LCS_ASSEMBLY) { LOG_INF("Failure: Lifecycle state is not ASSEMBLY as expected. Exiting!"); - return; + return 0; } LOG_INF("Successfully verified PSA lifecycle state ASSEMBLY!"); @@ -46,19 +46,19 @@ void main(void) err = update_life_cycle_state(BL_STORAGE_LCS_PROVISIONING); if (err != 0) { LOG_INF("Failure: Cannot set PSA lifecycle state PROVISIONING. Exiting!"); - return; + return 0; } err = read_life_cycle_state(&lcs); if (err != 0) { LOG_INF("Failure: Cannot read PSA lifecycle state. Exiting!"); - return; + return 0; } if (lcs != BL_STORAGE_LCS_PROVISIONING) { LOG_INF("Lifecycle state was %d", lcs); LOG_INF("Failure: Lifecycle state is not PROVISION as expected. Exiting!"); - return; + return 0; } LOG_INF("Successfully switched to PSA lifecycle state PROVISIONING!"); @@ -68,7 +68,7 @@ void main(void) if (identity_key_is_written()) { LOG_INF("Failure: Identity key slot already written. Exiting!"); - return; + return 0; } LOG_INF("Writing the identity key to KMU"); @@ -81,10 +81,12 @@ void main(void) if (!identity_key_is_written()) { LOG_INF("Failure: Identity key is not written! Exiting!"); - return; + return 0; } provision_implementation_id(); LOG_INF("Success!"); + + return 0; } diff --git a/samples/tfm/provisioning_image_net_core/src/main.c b/samples/tfm/provisioning_image_net_core/src/main.c index cd7bd88b2adf..a03092cc2a6c 100644 --- a/samples/tfm/provisioning_image_net_core/src/main.c +++ b/samples/tfm/provisioning_image_net_core/src/main.c @@ -8,18 +8,20 @@ #include #include -void main(void) +int main(void) { bool is_writable = nrfx_nvmc_word_writable_check((uint32_t)&NRF_UICR->APPROTECT, UICR_APPROTECT_PALL_Protected); if (!is_writable) { printk("Cannot write to the UICR->APPROTECT register, exiting...!\n"); - return; + return 0; } nrfx_nvmc_word_write((uint32_t)&NRF_UICR->APPROTECT, UICR_APPROTECT_PALL_Protected); printk("The UICR->APPROTECT register is now configured to deny debugging access for the " "network core!\n"); printk("Success!\n"); + + return 0; } diff --git a/samples/tfm/tfm_hello_world/src/main.c b/samples/tfm/tfm_hello_world/src/main.c index d0c05adcedc6..69463dfb88fd 100644 --- a/samples/tfm/tfm_hello_world/src/main.c +++ b/samples/tfm/tfm_hello_world/src/main.c @@ -63,7 +63,7 @@ static void print_hex_number(uint8_t *num, size_t len) printk("\n"); } -void main(void) +int main(void) { char hello_string[sizeof(HELLO_PATTERN) + sizeof(CONFIG_BOARD)]; size_t len; @@ -149,4 +149,6 @@ void main(void) #endif /* defined(CONFIG_TFM_PARTITION_PLATFORM) */ printk("Finished\n"); + + return 0; } diff --git a/samples/tfm/tfm_psa_template/src/main.c b/samples/tfm/tfm_psa_template/src/main.c index 4ebb986bf9b2..e2d60c794ad6 100644 --- a/samples/tfm/tfm_psa_template/src/main.c +++ b/samples/tfm/tfm_psa_template/src/main.c @@ -149,7 +149,7 @@ static void get_attestation_token(void) } } -void main(void) +int main(void) { int err; diff --git a/samples/tfm/tfm_secure_peripheral/src/main.c b/samples/tfm/tfm_secure_peripheral/src/main.c index 6c105e7b7c24..85885edcc637 100644 --- a/samples/tfm/tfm_secure_peripheral/src/main.c +++ b/samples/tfm/tfm_secure_peripheral/src/main.c @@ -52,7 +52,7 @@ static void send(struct k_work *work) k_work_schedule(&send_work, K_SECONDS(20)); } -void main(void) +int main(void) { IRQ_CONNECT(EGU0_IRQn, EGU_INT_PRIO, egu0_handler, NULL, 0); nrf_egu_int_enable(NRF_EGU0, NRF_EGU_INT_TRIGGERED0); @@ -62,4 +62,6 @@ void main(void) k_work_init_delayable(&send_work, send); k_work_schedule(&send_work, K_NO_WAIT); + + return 0; } diff --git a/samples/wifi/provisioning/src/main.c b/samples/wifi/provisioning/src/main.c index 40ff94450215..6f695013efc0 100644 --- a/samples/wifi/provisioning/src/main.c +++ b/samples/wifi/provisioning/src/main.c @@ -242,7 +242,7 @@ static void update_dev_name(struct net_linkaddr *mac_addr) byte_to_hex(&device_name[6], mac_addr->addr[5], 'A'); } -void main(void) +int main(void) { int rc; struct net_if *iface = net_if_get_default(); @@ -257,7 +257,7 @@ void main(void) rc = bt_enable(NULL); if (rc) { printk("Bluetooth init failed (err %d).\n", rc); - return; + return 0; } printk("Bluetooth initialized.\n"); @@ -267,7 +267,7 @@ void main(void) printk("Wi-Fi provisioning service starts successfully.\n"); } else { printk("Error occurs when initializing Wi-Fi provisioning service.\n"); - return; + return 0; } /* Prepare advertisement data */ @@ -283,7 +283,7 @@ void main(void) ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (rc) { printk("BT Advertising failed to start (err %d)\n", rc); - return; + return 0; } printk("BT Advertising successfully started.\n"); @@ -303,4 +303,6 @@ void main(void) /* Apply stored wifi credential */ net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); + + return 0; } diff --git a/samples/wifi/radio_test/src/nrf_wifi_radio_test_main.c b/samples/wifi/radio_test/src/nrf_wifi_radio_test_main.c index 98a67f0a4892..cf20c6febdb3 100644 --- a/samples/wifi/radio_test/src/nrf_wifi_radio_test_main.c +++ b/samples/wifi/radio_test/src/nrf_wifi_radio_test_main.c @@ -6,6 +6,7 @@ #include -void main(void) +int main(void) { + return 0; } diff --git a/samples/wifi/scan/src/main.c b/samples/wifi/scan/src/main.c index 5abb5d94196c..7f5b4540b271 100644 --- a/samples/wifi/scan/src/main.c +++ b/samples/wifi/scan/src/main.c @@ -100,7 +100,7 @@ static int wifi_scan(void) return 0; } -void main(void) +int main(void) { scan_result = 0U; @@ -119,4 +119,6 @@ void main(void) LOG_INF("Starting %s with CPU frequency: %d MHz", CONFIG_BOARD, SystemCoreClock / MHZ(1)); wifi_scan(); + + return 0; } diff --git a/samples/wifi/shell/src/wifi_main.c b/samples/wifi/shell/src/wifi_main.c index f2aceddca982..6da10cb27df4 100644 --- a/samples/wifi/shell/src/wifi_main.c +++ b/samples/wifi/shell/src/wifi_main.c @@ -13,7 +13,7 @@ #include #include -void main(void) +int main(void) { #ifdef CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT /* For now hardcode to 128MHz */ @@ -33,4 +33,6 @@ void main(void) net_config_init_app(dev, "Initializing network"); #endif + + return 0; } diff --git a/samples/wifi/sta/src/main.c b/samples/wifi/sta/src/main.c index e9953749434c..81de12e08b32 100644 --- a/samples/wifi/sta/src/main.c +++ b/samples/wifi/sta/src/main.c @@ -280,7 +280,7 @@ int bytes_from_str(const char *str, uint8_t *bytes, size_t bytes_len) return 0; } -void main(void) +int main(void) { int i; memset(&context, 0, sizeof(context)); @@ -309,7 +309,7 @@ void main(void) ret = bytes_from_str(CONFIG_NRF700X_QSPI_ENCRYPTION_KEY, key, sizeof(key)); if (ret) { LOG_ERR("Failed to parse encryption key: %d\n", ret); - return; + return 0; } LOG_DBG("QSPI Encryption key: "); @@ -321,7 +321,7 @@ void main(void) ret = qspi_enable_encryption(key); if (ret) { LOG_ERR("Failed to enable encryption: %d\n", ret); - return; + return 0; } LOG_INF("QSPI Encryption enabled"); } else { @@ -350,4 +350,6 @@ void main(void) LOG_ERR("Connection Timed Out"); } } + + return 0; } diff --git a/samples/zigbee/light_bulb/src/main.c b/samples/zigbee/light_bulb/src/main.c index 3224de2ffc33..9ebe2c8262fa 100644 --- a/samples/zigbee/light_bulb/src/main.c +++ b/samples/zigbee/light_bulb/src/main.c @@ -519,7 +519,7 @@ void zboss_signal_handler(zb_bufid_t bufid) } } -void main(void) +int main(void) { int blink_status = 0; int err; diff --git a/samples/zigbee/light_switch/src/main.c b/samples/zigbee/light_switch/src/main.c index e8c7078ab8f5..d370b432c0a0 100644 --- a/samples/zigbee/light_switch/src/main.c +++ b/samples/zigbee/light_switch/src/main.c @@ -722,7 +722,7 @@ static struct nus_entry commands[] = { #endif /* CONFIG_BT_NUS */ -void main(void) +int main(void) { LOG_INF("Starting ZBOSS Light Switch example"); diff --git a/samples/zigbee/network_coordinator/src/main.c b/samples/zigbee/network_coordinator/src/main.c index db70731ac04f..a96017cfd0a9 100644 --- a/samples/zigbee/network_coordinator/src/main.c +++ b/samples/zigbee/network_coordinator/src/main.c @@ -336,7 +336,7 @@ void zboss_signal_handler(zb_bufid_t bufid) } } -void main(void) +int main(void) { int blink_status = 0; diff --git a/samples/zigbee/shell/src/main.c b/samples/zigbee/shell/src/main.c index 61e340fb6726..b058bc2ca435 100644 --- a/samples/zigbee/shell/src/main.c +++ b/samples/zigbee/shell/src/main.c @@ -233,7 +233,7 @@ void zboss_signal_handler(zb_bufid_t bufid) } } -void main(void) +int main(void) { LOG_INF("Starting Zigbee shell application"); @@ -249,4 +249,6 @@ void main(void) ZB_AF_SET_IDENTIFY_NOTIFICATION_HANDLER(APP_ZIGBEE_ENDPOINT, identify_cb); LOG_INF("Zigbee shell application started"); + + return 0; } diff --git a/samples/zigbee/template/src/main.c b/samples/zigbee/template/src/main.c index 466983293ebd..27b88f4113bc 100644 --- a/samples/zigbee/template/src/main.c +++ b/samples/zigbee/template/src/main.c @@ -222,7 +222,7 @@ void zboss_signal_handler(zb_bufid_t bufid) } } -void main(void) +int main(void) { LOG_INF("Starting Zigbee application template example"); @@ -242,4 +242,6 @@ void main(void) zigbee_enable(); LOG_INF("Zigbee application template started"); + + return 0; } diff --git a/tests/bluetooth/tester/src/main.c b/tests/bluetooth/tester/src/main.c index 2bd20e946bc0..ae4ed1cb87df 100644 --- a/tests/bluetooth/tester/src/main.c +++ b/tests/bluetooth/tester/src/main.c @@ -16,7 +16,9 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME); #include "bttester.h" -void main(void) +int main(void) { tester_init(); + + return 0; } diff --git a/tests/lib/hw_id/src/main.c b/tests/lib/hw_id/src/main.c index 9dc77801498d..b07a0a9775d7 100644 --- a/tests/lib/hw_id/src/main.c +++ b/tests/lib/hw_id/src/main.c @@ -125,10 +125,16 @@ void test_too_small(void) TEST_ASSERT_EQUAL(0, strcmp("", buf)); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { /* use the runner from test_runner_generate() */ (void)unity_main(); + + return 0; } diff --git a/tests/lib/location/src/location_test.c b/tests/lib/location/src/location_test.c index 12f6d6eb2f88..0156cceb7b9d 100644 --- a/tests/lib/location/src/location_test.c +++ b/tests/lib/location/src/location_test.c @@ -950,15 +950,17 @@ static int location_test_sys_init(void) return 0; } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } SYS_INIT(location_test_sys_init, POST_KERNEL, 0); diff --git a/tests/lib/lte_lc_api/src/lte_lc_api_test.c b/tests/lib/lte_lc_api/src/lte_lc_api_test.c index 099ea0745096..3e577f5778de 100644 --- a/tests/lib/lte_lc_api/src/lte_lc_api_test.c +++ b/tests/lib/lte_lc_api/src/lte_lc_api_test.c @@ -1046,15 +1046,17 @@ void test_lte_lc_periodic_search_get_success(void) TEST_ASSERT_EQUAL(EXIT_SUCCESS, ret); } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } SYS_INIT(sys_init_helper, POST_KERNEL, 0); diff --git a/tests/lib/modem_info/src/main.c b/tests/lib/modem_info/src/main.c index 8b60bd95baae..801290529892 100644 --- a/tests/lib/modem_info/src/main.c +++ b/tests/lib/modem_info/src/main.c @@ -406,9 +406,15 @@ void test_modem_info_get_rsrp_success(void) TEST_ASSERT_EQUAL(1, nrf_modem_at_scanf_fake.call_count); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/modem_jwt/src/jwt_test.c b/tests/lib/modem_jwt/src/jwt_test.c index b763bb091835..f7890106fa44 100644 --- a/tests/lib/modem_jwt/src/jwt_test.c +++ b/tests/lib/modem_jwt/src/jwt_test.c @@ -107,9 +107,15 @@ void test_modem_jwt_get_uuids(void) TEST_ASSERT_EQUAL_STRING("f72d9789-2e73-4780-9248-b3952f89b872", mfw.str); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/nrf_modem_lib/nrf91_sockets/src/nrf91_sockets_test.c b/tests/lib/nrf_modem_lib/nrf91_sockets/src/nrf91_sockets_test.c index 5d1edcf83dd3..392cfbbe8ceb 100644 --- a/tests/lib/nrf_modem_lib/nrf91_sockets/src/nrf91_sockets_test.c +++ b/tests/lib/nrf_modem_lib/nrf91_sockets/src/nrf91_sockets_test.c @@ -1788,13 +1788,15 @@ void test_nrf91_socket_offload_poll(void) TEST_ASSERT_EQUAL(ret, 0); } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/nrf_modem_lib/nrf_modem_lib_trace/src/main.c b/tests/lib/nrf_modem_lib/nrf_modem_lib_trace/src/main.c index 81cf04cff41c..99394c6586ee 100644 --- a/tests/lib/nrf_modem_lib/nrf_modem_lib_trace/src/main.c +++ b/tests/lib/nrf_modem_lib/nrf_modem_lib_trace/src/main.c @@ -21,6 +21,10 @@ LOG_MODULE_REGISTER(trace_test, CONFIG_NRF_MODEM_LIB_TRACE_TEST_LOG_LEVEL); +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); extern struct nrf_modem_lib_trace_backend trace_backend; @@ -467,7 +471,9 @@ void test_nrf_modem_lib_trace_enotsup(void) trace_backend = trace_backend_orig; } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/nrf_modem_lib/trace_backends/rtt/src/main.c b/tests/lib/nrf_modem_lib/trace_backends/rtt/src/main.c index 38ff1e28cf4c..4a32e78a7ad2 100644 --- a/tests/lib/nrf_modem_lib/trace_backends/rtt/src/main.c +++ b/tests/lib/nrf_modem_lib/trace_backends/rtt/src/main.c @@ -21,6 +21,10 @@ static int callback(size_t len) return 0; } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); static int trace_rtt_channel; @@ -94,7 +98,9 @@ void test_trace_backend_write_rtt(void) trace_backend.write(sample_trace_data, sizeof(sample_trace_data)); } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/nrf_modem_lib/trace_backends/uart/src/main.c b/tests/lib/nrf_modem_lib/trace_backends/uart/src/main.c index 78ba5380d963..6a89b9c311c4 100644 --- a/tests/lib/nrf_modem_lib/trace_backends/uart/src/main.c +++ b/tests/lib/nrf_modem_lib/trace_backends/uart/src/main.c @@ -14,6 +14,10 @@ #include "cmock_nrfx_uarte.h" #include "cmock_pinctrl.h" +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); extern struct nrf_modem_lib_trace_backend trace_backend; @@ -290,7 +294,9 @@ void test_trace_backend_write_uart_nrfx_uarte_evt_error(void) TEST_ASSERT_EQUAL(true, is_waiting_on_traces); } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/qos/src/qos_test.c b/tests/lib/qos/src/qos_test.c index f283d9eb0a06..9d051f30459b 100644 --- a/tests/lib/qos/src/qos_test.c +++ b/tests/lib/qos/src/qos_test.c @@ -338,9 +338,15 @@ void test_message_timeout_work(void) TEST_ASSERT_EQUAL(0, callback_count); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/lib/sms/src/sms_test.c b/tests/lib/sms/src/sms_test.c index cae5beca95c6..09acb985484f 100644 --- a/tests/lib/sms/src/sms_test.c +++ b/tests/lib/sms/src/sms_test.c @@ -1781,15 +1781,17 @@ static int sms_test_sys_init(void) return 0; } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } SYS_INIT(sms_test_sys_init, POST_KERNEL, 0); diff --git a/tests/subsys/bluetooth/mesh/models/src/main.c b/tests/subsys/bluetooth/mesh/models/src/main.c index 47b1b56e8fbf..5b20b68cc479 100644 --- a/tests/subsys/bluetooth/mesh/models/src/main.c +++ b/tests/subsys/bluetooth/mesh/models/src/main.c @@ -113,7 +113,9 @@ static const struct bt_mesh_comp comp = { .elem_count = ARRAY_SIZE(elems), }; -void main(void) +int main(void) { bt_mesh_init(NULL, &comp); + + return 0; } diff --git a/tests/subsys/bootloader/boot_chains/src/main.c b/tests/subsys/bootloader/boot_chains/src/main.c index 88a3139ec5d3..69aff5ad2f08 100644 --- a/tests/subsys/bootloader/boot_chains/src/main.c +++ b/tests/subsys/bootloader/boot_chains/src/main.c @@ -6,7 +6,9 @@ #include -void main(void) +int main(void) { printk("Hello World! %s\n", CONFIG_BOARD); + + return 0; } diff --git a/tests/subsys/event_manager_proxy/remote/main.c b/tests/subsys/event_manager_proxy/remote/main.c index 2136ec41826d..770dc40a908d 100644 --- a/tests/subsys/event_manager_proxy/remote/main.c +++ b/tests/subsys/event_manager_proxy/remote/main.c @@ -23,7 +23,7 @@ static enum test_id cur_test_id; static unsigned int cur_test_pos; -void main(void) +int main(void) { printk("Event Manager Proxy test remote_core started\n"); @@ -34,7 +34,7 @@ void main(void) if (ret) { LOG_ERR("Event Manager not initialized, err: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event manager initialized"); @@ -42,7 +42,7 @@ void main(void) if (ret) { LOG_ERR("Cannot add remote: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } LOG_INF("Event proxy remote added"); @@ -58,13 +58,15 @@ void main(void) if (ret) { LOG_ERR("Cannot start event manager proxy: %d", ret); __ASSERT_NO_MSG(false); - return; + return 0; } /* We do not have to wait for remotes here as we do not send any event that * would be fatal when missed. */ LOG_INF("Initialization finished successfully"); + + return 0; } static void proxy_direct_submit_pong_event(void) diff --git a/tests/subsys/net/lib/azure_iot_hub/dps/src/azure_iot_hub_dps_test.c b/tests/subsys/net/lib/azure_iot_hub/dps/src/azure_iot_hub_dps_test.c index 85e783c34269..89299209ecd8 100644 --- a/tests/subsys/net/lib/azure_iot_hub/dps/src/azure_iot_hub_dps_test.c +++ b/tests/subsys/net/lib/azure_iot_hub/dps/src/azure_iot_hub_dps_test.c @@ -46,6 +46,10 @@ "/api-version=2019-03-31" #define TEST_EXPECTED_USER_NAME_DEFAULT_LEN (sizeof(TEST_EXPECTED_USER_NAME_DEFAULT) - 1) +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); /* Pull in variables and functions from the DPS library. */ @@ -468,7 +472,9 @@ void test_on_publish_invalid_payload(void) TEST_ASSERT_EQUAL(0, k_sem_take(®_failed_sem, K_SECONDS(2))); } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/subsys/net/lib/azure_iot_hub/iot_hub/src/azure_iot_hub_test.c b/tests/subsys/net/lib/azure_iot_hub/iot_hub/src/azure_iot_hub_test.c index 4b5642d51906..3c6fbf3a009e 100644 --- a/tests/subsys/net/lib/azure_iot_hub/iot_hub/src/azure_iot_hub_test.c +++ b/tests/subsys/net/lib/azure_iot_hub/iot_hub/src/azure_iot_hub_test.c @@ -79,6 +79,10 @@ enum iot_hub_state { }; /* Pull in variables and functions from the Azure IoT Hub library. */ +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); extern void iot_hub_state_set(enum iot_hub_state state); extern enum iot_hub_state iot_hub_state; @@ -640,7 +644,9 @@ void test_azure_iot_hub_method_respond_mqtt_fail(void) TEST_ASSERT_EQUAL(-ENXIO, azure_iot_hub_method_respond(&result)); } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c b/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c index 171f80b0221f..f245e42fafc6 100644 --- a/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c +++ b/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c @@ -38,6 +38,10 @@ extern struct mqtt_client mqtt_client; extern enum mqtt_state mqtt_state; extern struct k_sem connection_poll_sem; extern k_tid_t mqtt_helper_thread; +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); extern enum mqtt_state mqtt_state_get(void); extern void mqtt_state_set(enum mqtt_state state); @@ -595,7 +599,9 @@ void test_mqtt_helper_poll_loop_pollerr(void) mqtt_helper_poll_loop(); } -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/subsys/net/lib/wifi_credentials/src/main.c b/tests/subsys/net/lib/wifi_credentials/src/main.c index 0de70ee3ddb9..066a7cd43aa9 100644 --- a/tests/subsys/net/lib/wifi_credentials/src/main.c +++ b/tests/subsys/net/lib/wifi_credentials/src/main.c @@ -308,10 +308,16 @@ void test_storage_limit(void) wifi_credentials_for_each_ssid(verify_ssid_cache_cb, NULL); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { /* use the runner from test_runner_generate() */ (void)unity_main(); + + return 0; } diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c b/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c index 85dd34c4395f..c7ba62cc8ed6 100644 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c +++ b/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c @@ -164,10 +164,16 @@ void test_delete(void) TEST_ASSERT_EQUAL(2, psa_ps_remove_fake.call_count); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { /* use the runner from test_runner_generate() */ (void)unity_main(); + + return 0; } diff --git a/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c b/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c index 9722a0b7c1a6..0ee60c5ebec8 100644 --- a/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c +++ b/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c @@ -228,10 +228,16 @@ void test_delete(void) TEST_ASSERT_EQUAL(1, settings_delete_fake.call_count); } +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). + */ extern int unity_main(void); -void main(void) +int main(void) { /* use the runner from test_runner_generate() */ (void)unity_main(); + + return 0; } diff --git a/tests/tfm/tfm_psa_test/src/main.c b/tests/tfm/tfm_psa_test/src/main.c index 81abfc890eb6..7c385cb37a3d 100644 --- a/tests/tfm/tfm_psa_test/src/main.c +++ b/tests/tfm/tfm_psa_test/src/main.c @@ -11,7 +11,9 @@ /* Run the PSA test suite */ void psa_test(void); -void main(void) +int main(void) { psa_test(); + + return 0; } diff --git a/tests/tfm/tfm_regression_test/src/main.c b/tests/tfm/tfm_regression_test/src/main.c index ffc820d3416f..41c58c537722 100644 --- a/tests/tfm/tfm_regression_test/src/main.c +++ b/tests/tfm/tfm_regression_test/src/main.c @@ -6,8 +6,10 @@ #include -void main(void) +int main(void) { printk("Should not be printed, expected TF-M's NS application to be run instead.\n"); k_panic(); + + return 0; /* unreachable */ } diff --git a/tests/unity/example_test/src/example_test.c b/tests/unity/example_test/src/example_test.c index b5645fa68702..ec3e92567c01 100644 --- a/tests/unity/example_test/src/example_test.c +++ b/tests/unity/example_test/src/example_test.c @@ -39,13 +39,15 @@ void test_uut_init_with_param_check(void) TEST_ASSERT_EQUAL(-1, err); } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } diff --git a/tests/unity/wrap_test/src/wrap_test.c b/tests/unity/wrap_test/src/wrap_test.c index 3b93bcbd8277..7d7de7c9ca40 100644 --- a/tests/unity/wrap_test/src/wrap_test.c +++ b/tests/unity/wrap_test/src/wrap_test.c @@ -86,13 +86,15 @@ void test_word_exclude(void) call_exclude_word_fn(); } -/* It is required to be added to each test. That is because unity is using - * different main signature (returns int) and zephyr expects main which does - * not return value. +/* It is required to be added to each test. That is because unity's + * main may return nonzero, while zephyr's main currently must + * return 0 in all cases (other values are reserved). */ extern int unity_main(void); -void main(void) +int main(void) { (void)unity_main(); + + return 0; } From 77bfbf3d42ad1de57c1439b8430da004b145ac46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Mon, 17 Apr 2023 14:58:44 -0700 Subject: [PATCH 04/47] treewide: update licenses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A linter is now complaining that Apache 2.0 is not valid for some of our C files, so move the license lines to currently acceptable licenses. The tester main.c file is copy/pasted with an Intel copyright, so we can't change the license and have to add it to the allowlist. (It's small enough that maybe it should be rewritten with our own copyright and license at some point, though.) Signed-off-by: Martí Bolívar --- samples/bluetooth/direction_finding_central/src/main.c | 2 +- samples/nrf5340/multiprotocol_rpmsg/src/main.c | 2 +- scripts/ci/license_allow_list.yaml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/direction_finding_central/src/main.c b/samples/bluetooth/direction_finding_central/src/main.c index e7825ff187cf..e17e88d1be79 100644 --- a/samples/bluetooth/direction_finding_central/src/main.c +++ b/samples/bluetooth/direction_finding_central/src/main.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2022 Nordic Semiconductor ASA * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ #include diff --git a/samples/nrf5340/multiprotocol_rpmsg/src/main.c b/samples/nrf5340/multiprotocol_rpmsg/src/main.c index 291d7fde2562..279d15812201 100644 --- a/samples/nrf5340/multiprotocol_rpmsg/src/main.c +++ b/samples/nrf5340/multiprotocol_rpmsg/src/main.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2019-2021 Nordic Semiconductor ASA * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ #include diff --git a/scripts/ci/license_allow_list.yaml b/scripts/ci/license_allow_list.yaml index edfe4aa81734..1986521abf34 100644 --- a/scripts/ci/license_allow_list.yaml +++ b/scripts/ci/license_allow_list.yaml @@ -42,6 +42,7 @@ LicenseRef-west-ncs-sbom-iperf-BSD-3-Clause: "^nrf/ext/" Apache-2.0: | ^nrf/ext/ /src/zap-generated/ + ^nrf/tests/bluetooth/tester/src/main.c$ curl: "^nrf/ext/" MIT: "^nrf/ext/" BSD-3-CLAUSE: "^nrf/ext/" From 7fb6aa4a93e539794fad68be1bf9c124276af594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 07:03:40 -0700 Subject: [PATCH 05/47] treewide: remove references to CONFIG_BT_LL_SW_LLCP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is following the pattern in zephyr commit 421585495631ce956e56d886e16dfb25da49ec3d ("Bluetooth: controller: remove refs to LLCP_LEGACY after rebase"). The legacy LLCP code has been removed upstream in zephyr commit 2ada005d7c74f89dfbabaacb4bc4f5059761b618 ("Bluetooth: controller: removing legacy LLCP code"); this option disappeared with that removal. Signed-off-by: Martí Bolívar --- .../direction_finding_central/boards/nrf52833dk_nrf52820.conf | 3 --- .../direction_finding_central/boards/nrf52833dk_nrf52833.conf | 3 --- .../direction_finding_central/child_image/hci_rpmsg.conf | 3 --- .../boards/nrf52833dk_nrf52820.conf | 3 --- .../boards/nrf52833dk_nrf52833.conf | 3 --- .../direction_finding_peripheral/child_image/hci_rpmsg.conf | 3 --- 6 files changed, 18 deletions(-) diff --git a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf index a4c80d0cd159..18a076bcfcc3 100644 --- a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf +++ b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf index a4c80d0cd159..18a076bcfcc3 100644 --- a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf +++ b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_central/child_image/hci_rpmsg.conf b/samples/bluetooth/direction_finding_central/child_image/hci_rpmsg.conf index 42babc01a363..25c5ed07f204 100644 --- a/samples/bluetooth/direction_finding_central/child_image/hci_rpmsg.conf +++ b/samples/bluetooth/direction_finding_central/child_image/hci_rpmsg.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52820.conf b/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52820.conf index 31c8ee5aa266..d5c5c57f3ffb 100644 --- a/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52820.conf +++ b/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52820.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.conf index 31c8ee5aa266..d5c5c57f3ffb 100644 --- a/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.conf +++ b/samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_peripheral/child_image/hci_rpmsg.conf b/samples/bluetooth/direction_finding_peripheral/child_image/hci_rpmsg.conf index 31c8ee5aa266..d5c5c57f3ffb 100644 --- a/samples/bluetooth/direction_finding_peripheral/child_image/hci_rpmsg.conf +++ b/samples/bluetooth/direction_finding_peripheral/child_image/hci_rpmsg.conf @@ -7,9 +7,6 @@ CONFIG_BT_CTLR=y CONFIG_BT_LL_SW_SPLIT=y -# Enable new implementation of LLCPs -CONFIG_BT_LL_SW_LLCP=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y From 4933184d83e36008b7f8fd6e269c25a89334c677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 07:20:20 -0700 Subject: [PATCH 06/47] treewide: s/ceiling_fraction/DIV_ROUND_UP/g MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zephyr commit 53da110dbfe5f73efa842c4b8560dba26f5a84a9 ("sys: util: s/ceiling_fraction/DIV_ROUND_UP") added DIV_ROUND_UP as a successor to ceiling_fraction. The ceiling_fraction macro is now deprecated. Update NCS to match. Signed-off-by: Martí Bolívar --- applications/nrf_desktop/src/modules/hids.c | 8 ++++---- lib/fprotect/fprotect_bprot.c | 2 +- lib/st25r3911b/st25r3911b_common.h | 4 ++-- samples/bluetooth/peripheral_hids_mouse/src/main.c | 2 +- subsys/bluetooth/mesh/lightness_internal.h | 2 +- subsys/bluetooth/mesh/scheduler_srv.c | 8 ++++---- subsys/bluetooth/mesh/sensor_srv.c | 2 +- subsys/bluetooth/rpc/host/bt_rpc_gatt_host.c | 2 +- subsys/caf/modules/sensor_data_aggregator.c | 2 +- subsys/caf/modules/sensor_manager.c | 2 +- subsys/event_manager_proxy/event_manager_proxy.c | 4 ++-- subsys/nfc/t4t/isodep.c | 2 +- subsys/nfc/tnep/poller.c | 2 +- subsys/zigbee/osif/zb_nrf_pwr_mgmt.c | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/applications/nrf_desktop/src/modules/hids.c b/applications/nrf_desktop/src/modules/hids.c index 6e36364b0554..4359cb4085a0 100644 --- a/applications/nrf_desktop/src/modules/hids.c +++ b/applications/nrf_desktop/src/modules/hids.c @@ -286,7 +286,7 @@ static int module_init(void) if (IS_ENABLED(CONFIG_DESKTOP_HID_REPORT_MOUSE_SUPPORT)) { static const uint8_t mask[] = REPORT_MASK_MOUSE; BUILD_ASSERT((sizeof(mask) == 0) || - (sizeof(mask) == ceiling_fraction(REPORT_SIZE_MOUSE, 8))); + (sizeof(mask) == DIV_ROUND_UP(REPORT_SIZE_MOUSE, 8))); BUILD_ASSERT(REPORT_ID_MOUSE < ARRAY_SIZE(report_index)); input_report[ir_pos].id = REPORT_ID_MOUSE; @@ -301,7 +301,7 @@ static int module_init(void) if (IS_ENABLED(CONFIG_DESKTOP_HID_REPORT_KEYBOARD_SUPPORT)) { static const uint8_t mask[] = REPORT_MASK_KEYBOARD_KEYS; BUILD_ASSERT((sizeof(mask) == 0) || - (sizeof(mask) == ceiling_fraction(REPORT_SIZE_KEYBOARD_KEYS, 8))); + (sizeof(mask) == DIV_ROUND_UP(REPORT_SIZE_KEYBOARD_KEYS, 8))); BUILD_ASSERT(REPORT_ID_KEYBOARD_KEYS < ARRAY_SIZE(report_index)); input_report[ir_pos].id = REPORT_ID_KEYBOARD_KEYS; @@ -316,7 +316,7 @@ static int module_init(void) if (IS_ENABLED(CONFIG_DESKTOP_HID_REPORT_SYSTEM_CTRL_SUPPORT)) { static const uint8_t mask[] = REPORT_MASK_SYSTEM_CTRL; BUILD_ASSERT((sizeof(mask) == 0) || - (sizeof(mask) == ceiling_fraction(REPORT_SIZE_SYSTEM_CTRL, 8))); + (sizeof(mask) == DIV_ROUND_UP(REPORT_SIZE_SYSTEM_CTRL, 8))); BUILD_ASSERT(REPORT_ID_SYSTEM_CTRL < ARRAY_SIZE(report_index)); input_report[ir_pos].id = REPORT_ID_SYSTEM_CTRL; @@ -331,7 +331,7 @@ static int module_init(void) if (IS_ENABLED(CONFIG_DESKTOP_HID_REPORT_CONSUMER_CTRL_SUPPORT)) { static const uint8_t mask[] = REPORT_MASK_CONSUMER_CTRL; BUILD_ASSERT((sizeof(mask) == 0) || - (sizeof(mask) == ceiling_fraction(REPORT_SIZE_CONSUMER_CTRL, 8))); + (sizeof(mask) == DIV_ROUND_UP(REPORT_SIZE_CONSUMER_CTRL, 8))); BUILD_ASSERT(REPORT_ID_CONSUMER_CTRL < ARRAY_SIZE(report_index)); input_report[ir_pos].id = REPORT_ID_CONSUMER_CTRL; diff --git a/lib/fprotect/fprotect_bprot.c b/lib/fprotect/fprotect_bprot.c index c48346a0b41e..cf20be2c2b1b 100644 --- a/lib/fprotect/fprotect_bprot.c +++ b/lib/fprotect/fprotect_bprot.c @@ -22,7 +22,7 @@ #include /* The number of CONFIG registers present in the chip. */ -#define BPROT_CONFIGS_NUM ceiling_fraction(BPROT_REGIONS_NUM, BITS_PER_LONG) +#define BPROT_CONFIGS_NUM DIV_ROUND_UP(BPROT_REGIONS_NUM, BITS_PER_LONG) #if defined(CONFIG_SB_BPROT_IN_DEBUG) #define ENABLE_IN_DEBUG true #else diff --git a/lib/st25r3911b/st25r3911b_common.h b/lib/st25r3911b/st25r3911b_common.h index 788a6055147f..3070294ac1c0 100644 --- a/lib/st25r3911b/st25r3911b_common.h +++ b/lib/st25r3911b/st25r3911b_common.h @@ -65,13 +65,13 @@ enum st25r3911b_leds { * using the following formula: register value * 64fc */ #define ST25R3911B_FC_TO_64FC(_fc) \ - ceiling_fraction((_fc), NFC_1FC_IN_64FC) + DIV_ROUND_UP((_fc), NFC_1FC_IN_64FC) /** Conversion fc to 4096/fc. The timer register can be set * using the following formula: register value * 4096fc */ #define ST25R3911B_FC_TO_4096FC(_fc) \ - ceiling_fraction((_fc), NFC_1FC_IN_4096FC) + DIV_ROUND_UP((_fc), NFC_1FC_IN_4096FC) /** @brief Initialize the NFC reader. * diff --git a/samples/bluetooth/peripheral_hids_mouse/src/main.c b/samples/bluetooth/peripheral_hids_mouse/src/main.c index 96140747178f..980197bef33f 100644 --- a/samples/bluetooth/peripheral_hids_mouse/src/main.c +++ b/samples/bluetooth/peripheral_hids_mouse/src/main.c @@ -381,7 +381,7 @@ static void hid_init(void) int err; struct bt_hids_init_param hids_init_param = { 0 }; struct bt_hids_inp_rep *hids_inp_rep; - static const uint8_t mouse_movement_mask[ceiling_fraction(INPUT_REP_MOVEMENT_LEN, 8)] = {0}; + static const uint8_t mouse_movement_mask[DIV_ROUND_UP(INPUT_REP_MOVEMENT_LEN, 8)] = {0}; static const uint8_t report_map[] = { 0x05, 0x01, /* Usage Page (Generic Desktop) */ diff --git a/subsys/bluetooth/mesh/lightness_internal.h b/subsys/bluetooth/mesh/lightness_internal.h index 621d6f5b098e..498864a4c464 100644 --- a/subsys/bluetooth/mesh/lightness_internal.h +++ b/subsys/bluetooth/mesh/lightness_internal.h @@ -93,7 +93,7 @@ static inline uint16_t actual_to_linear(uint16_t actual) /* Conversion: * linear = CEIL(65535 * (actual * actual) / (65535 * 65535))) */ - return ceiling_fraction((uint32_t)actual * (uint32_t)actual, 65535UL); + return DIV_ROUND_UP((uint32_t)actual * (uint32_t)actual, 65535UL); } /** @brief Convert light from the specified representation to the configured. diff --git a/subsys/bluetooth/mesh/scheduler_srv.c b/subsys/bluetooth/mesh/scheduler_srv.c index d4d7aa340426..07f7debdc270 100644 --- a/subsys/bluetooth/mesh/scheduler_srv.c +++ b/subsys/bluetooth/mesh/scheduler_srv.c @@ -237,11 +237,11 @@ static int minute_handler(struct tm *sched_time, struct tm *current_local, bool minute_ovflw = false; if (entry->minute == BT_MESH_SCHEDULER_EVERY_15_MINUTES) { - info->start_minute = 15 * ceiling_fraction(current_local->tm_min + 1, 15); + info->start_minute = 15 * DIV_ROUND_UP(current_local->tm_min + 1, 15); minute_ovflw = info->start_minute == 60; sched_time->tm_min = minute_ovflw ? 0 : info->start_minute; } else if (entry->minute == BT_MESH_SCHEDULER_EVERY_20_MINUTES) { - info->start_minute = 20 * ceiling_fraction(current_local->tm_min + 1, 20); + info->start_minute = 20 * DIV_ROUND_UP(current_local->tm_min + 1, 20); minute_ovflw = info->start_minute == 60; sched_time->tm_min = minute_ovflw ? 0 : info->start_minute; } else if (entry->minute == BT_MESH_SCHEDULER_ONCE_AN_HOUR) { @@ -273,11 +273,11 @@ static int second_handler(struct tm *sched_time, struct tm *current_local, bool second_ovflw = false; if (entry->second == BT_MESH_SCHEDULER_EVERY_15_SECONDS) { - info->start_second = 15 * ceiling_fraction(current_local->tm_sec + 1, 15); + info->start_second = 15 * DIV_ROUND_UP(current_local->tm_sec + 1, 15); second_ovflw = info->start_second == 60; sched_time->tm_sec = second_ovflw ? 0 : info->start_second; } else if (entry->second == BT_MESH_SCHEDULER_EVERY_20_SECONDS) { - info->start_second = 20 * ceiling_fraction(current_local->tm_sec + 1, 20); + info->start_second = 20 * DIV_ROUND_UP(current_local->tm_sec + 1, 20); second_ovflw = info->start_second == 60; sched_time->tm_sec = second_ovflw ? 0 : info->start_second; } else if (entry->second == BT_MESH_SCHEDULER_ONCE_A_MINUTE) { diff --git a/subsys/bluetooth/mesh/sensor_srv.c b/subsys/bluetooth/mesh/sensor_srv.c index 2ab88390b283..214203ea61ae 100644 --- a/subsys/bluetooth/mesh/sensor_srv.c +++ b/subsys/bluetooth/mesh/sensor_srv.c @@ -861,7 +861,7 @@ static uint16_t min_int_get(const struct bt_mesh_sensor *sensor, uint32_t pub_int = (base_period >> period_div); uint32_t min_int = (1 << sensor->state.min_int); - return ceiling_fraction(min_int, pub_int); + return DIV_ROUND_UP(min_int, pub_int); } /** @brief Conditionally add a sensor value to a publication. diff --git a/subsys/bluetooth/rpc/host/bt_rpc_gatt_host.c b/subsys/bluetooth/rpc/host/bt_rpc_gatt_host.c index 716995d98396..43c8ff11f620 100644 --- a/subsys/bluetooth/rpc/host/bt_rpc_gatt_host.c +++ b/subsys/bluetooth/rpc/host/bt_rpc_gatt_host.c @@ -79,7 +79,7 @@ static struct bt_uuid const * const uuid_cep = BT_UUID_GATT_CEP; static struct bt_uuid const * const uuid_cud = BT_UUID_GATT_CUD; static struct bt_uuid const * const uuid_cpf = BT_UUID_GATT_CPF; -static uint32_t gatt_buffer_data[ceiling_fraction(CONFIG_BT_RPC_GATT_BUFFER_SIZE, +static uint32_t gatt_buffer_data[DIV_ROUND_UP(CONFIG_BT_RPC_GATT_BUFFER_SIZE, sizeof(uint32_t))]; static struct net_buf_simple gatt_buffer = { .data = (uint8_t *)gatt_buffer_data, diff --git a/subsys/caf/modules/sensor_data_aggregator.c b/subsys/caf/modules/sensor_data_aggregator.c index 058dda533b05..9717c3b46616 100644 --- a/subsys/caf/modules/sensor_data_aggregator.c +++ b/subsys/caf/modules/sensor_data_aggregator.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(MODULE, CONFIG_CAF_SENSOR_DATA_AGGREGATOR_LOG_LEVEL); #define __DATA_BUFF_NAME(agg_node, n) DT_CAT5(agg_, agg_node, _buff_, n, _data) #define __DEFINE_DATA(n, agg_node, size) \ static struct sensor_value __DATA_BUFF_NAME(agg_node, n) \ - [ceiling_fraction(size, sizeof(struct sensor_value))] + [DIV_ROUND_UP(size, sizeof(struct sensor_value))] /* End of BSS version only macros. */ #define __INITIALIZE_BUFF(n, agg_node) \ diff --git a/subsys/caf/modules/sensor_manager.c b/subsys/caf/modules/sensor_manager.c index 27cf1ec07e95..309cd169ab68 100644 --- a/subsys/caf/modules/sensor_manager.c +++ b/subsys/caf/modules/sensor_manager.c @@ -111,7 +111,7 @@ static void reset_sensor_sleep_cnt(const struct sm_sensor_config *sc, unsigned int timeout = sc->trigger->activation.timeout_ms; unsigned int period = sc->sampling_period_ms; - sd->sleep_cntd = ceiling_fraction(timeout, period); + sd->sleep_cntd = DIV_ROUND_UP(timeout, period); } static bool process_sensor_trigger_values(const struct sm_sensor_config *sc, struct sensor_data *sd, diff --git a/subsys/event_manager_proxy/event_manager_proxy.c b/subsys/event_manager_proxy/event_manager_proxy.c index 5eeb885af13c..2c151727ba16 100644 --- a/subsys/event_manager_proxy/event_manager_proxy.c +++ b/subsys/event_manager_proxy/event_manager_proxy.c @@ -284,7 +284,7 @@ static int send_event_to_remote(struct emp_ipc_data *ipc, const struct app_event } size_t size = app_event_manager_event_size(eh); - uint32_t buffer[ceiling_fraction(size, sizeof(uint32_t))]; + uint32_t buffer[DIV_ROUND_UP(size, sizeof(uint32_t))]; struct app_event_header *remote_eh = (struct app_event_header *)buffer; memcpy(buffer, eh, sizeof(buffer)); @@ -400,7 +400,7 @@ static int send_subscribe_command_to_remote(struct emp_ipc_data *ipc, /* Preparing and sending the command */ struct emp_cmd_subscribe *cmd; size_t size = sizeof(*cmd) + strlen(remote_event_name) + 1; - uint32_t buffer[ceiling_fraction(size, sizeof(uint32_t))]; + uint32_t buffer[DIV_ROUND_UP(size, sizeof(uint32_t))]; cmd = (struct emp_cmd_subscribe *)buffer; cmd->code = EMP_CMD_SUBSCRIBE; diff --git a/subsys/nfc/t4t/isodep.c b/subsys/nfc/t4t/isodep.c index 9fed3c776080..fd616ed04ff0 100644 --- a/subsys/nfc/t4t/isodep.c +++ b/subsys/nfc/t4t/isodep.c @@ -52,7 +52,7 @@ LOG_MODULE_REGISTER(nfc_t4t_isodep, CONFIG_NFC_T4T_ISODEP_LOG_LEVEL); #define T4T_FC_IN_MS 13560UL #define T4T_FWT_TO_MS(_fwt) \ - ceiling_fraction((_fwt), T4T_FC_IN_MS) + DIV_ROUND_UP((_fwt), T4T_FC_IN_MS) #define T4T_RATS_FDT (T4T_FWT_ACTIVATION + \ T4T_FWT_DELTA + NFCA_T4T_FWT_T_FC) diff --git a/subsys/nfc/tnep/poller.c b/subsys/nfc/tnep/poller.c index a48b7ae18fbb..73566bf1d517 100644 --- a/subsys/nfc/tnep/poller.c +++ b/subsys/nfc/tnep/poller.c @@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(nfc_tnep_poller, CONFIG_NFC_TNEP_POLLER_LOG_LEVEL); * Exchange Protocol 1.0 4.1.6 */ #define NFC_TNEP_MIN_WAIT_TIME(_time) \ - (1 << (((ceiling_fraction((_time), 4)) - 1))) + (1 << (((DIV_ROUND_UP((_time), 4)) - 1))) enum tnep_poller_state { TNEP_POLLER_STATE_IDLE, diff --git a/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c b/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c index a8a6dee6123f..f1a24082b059 100644 --- a/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c +++ b/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c @@ -74,7 +74,7 @@ __weak zb_uint32_t zb_osif_sleep(zb_uint32_t sleep_tmo) * in the time unit conversion. */ time_slept_ms = ZB_TIME_BEACON_INTERVAL_TO_MSEC( - ceiling_fraction(time_slept_us, ZB_BEACON_INTERVAL_USEC)); + DIV_ROUND_UP(time_slept_us, ZB_BEACON_INTERVAL_USEC)); /* Unlock timer value updates. */ ZVUNUSED(atomic_set((atomic_t *)&is_sleeping, 0)); From a71f995c974b83f56ad9dedf1a3733dbf1849abc Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Tue, 18 Apr 2023 17:08:54 +0200 Subject: [PATCH 07/47] bluetooth/enocean: remove BT_ENOCEAN_DEBUG kconfig Bluetooth logging system was replaced by usage of the zephyr common logging. The common log system has per-module configuration built-in so no need to use sybmodule own configuration. Therefore BT_ENOCEAN_DEBUG can be removed. The module logging should be configured used "BT_ENOCEAN_LOG_LEVEL_CHOICE" Signed-off-by: Andrzej Puzdrowski --- subsys/bluetooth/Kconfig.enocean | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/subsys/bluetooth/Kconfig.enocean b/subsys/bluetooth/Kconfig.enocean index 2ad7843f599f..3a3da67bda65 100644 --- a/subsys/bluetooth/Kconfig.enocean +++ b/subsys/bluetooth/Kconfig.enocean @@ -59,19 +59,8 @@ endif endif -config BT_ENOCEAN_DEBUG - bool "Enable debug logs" - depends on BT_DEBUG - help - Use this option to enable debug logs for the Bluetooth - Enocean functionality. - -if BT_ENOCEAN_DEBUG - module = BT_ENOCEAN module-str = EnOcean library source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config" endif - -endif From 3a351ce8d846ff72f428655d50fe62f3370fdbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 09:44:50 -0700 Subject: [PATCH 08/47] tfm_platform_system.c: don't include zephyr header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is breaking the build since zephyr commit fbf851cdc4d8f0afe60131aea6154945f126d778 ("util.h: Add dependency on time_units.h"), which pulled in an additional Zephyr header that contains inline function definitions that use various Zephyr-specific Kconfig symbols that are not available when we're building this file. The include doesn't seem to be needed since removing it entirely restores the build, so I'm assuming it's just cruft that's safe to delete. Signed-off-by: Martí Bolívar --- modules/tfm/tfm/boards/src/tfm_platform_system.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/tfm/tfm/boards/src/tfm_platform_system.c b/modules/tfm/tfm/boards/src/tfm_platform_system.c index 05d0f9f60cf6..471edc745012 100644 --- a/modules/tfm/tfm/boards/src/tfm_platform_system.c +++ b/modules/tfm/tfm/boards/src/tfm_platform_system.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -#include - #include #include #include From 5c30310c3ad3ddea3b96f2343db5c20dc6a95fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 10:38:04 -0700 Subject: [PATCH 09/47] samples: empty_net_core: add prj.conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zephyr is now failing the build if we don't have one. Signed-off-by: Martí Bolívar --- samples/nrf5340/empty_net_core/prj.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/nrf5340/empty_net_core/prj.conf diff --git a/samples/nrf5340/empty_net_core/prj.conf b/samples/nrf5340/empty_net_core/prj.conf new file mode 100644 index 000000000000..bb7b160deb37 --- /dev/null +++ b/samples/nrf5340/empty_net_core/prj.conf @@ -0,0 +1 @@ +# Intentionally empty From 94014cfb6a2432db0482ed4e23bea208b6ee6228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 10:57:57 -0700 Subject: [PATCH 10/47] nrf5340_audio: BT_AUDIO_LC3_PRESET -> BT_BAP_LC3_PRESET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow along with upstream zephyr commit 0ebc7c2b6901ca82ff34f09c7fb99dcd2e44980e ("Bluetooth: Audio: Rename BT_AUDIO_LC3_PRESET to BT_BAP...") which did this rename. Signed-off-by: Martí Bolívar --- .../nrf5340_audio/src/bluetooth/le_audio.h | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio.h b/applications/nrf5340_audio/src/bluetooth/le_audio.h index f76b5df5d876..b6b755430173 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio.h +++ b/applications/nrf5340_audio/src/bluetooth/le_audio.h @@ -50,8 +50,8 @@ #define BT_AUDIO_CODEC_CAPABILIY_FREQ BT_CODEC_LC3_FREQ_16KHZ #endif /* (CONFIG_AUDIO_SAMPLE_RATE_48000_HZ) */ -#define BT_AUDIO_LC3_PRESET_CONFIGURABLE(_loc, _stream_context, _bitrate) \ - BT_AUDIO_LC3_PRESET( \ +#define BT_BAP_LC3_PRESET_CONFIGURABLE(_loc, _stream_context, _bitrate) \ + BT_BAP_LC3_PRESET( \ BT_CODEC_LC3_CONFIG(BT_AUDIO_CODEC_CONFIG_FREQ, BT_CODEC_CONFIG_LC3_DURATION_10, \ _loc, LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), 1, _stream_context), \ BT_CODEC_LC3_QOS_10_UNFRAMED(LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), \ @@ -62,14 +62,14 @@ #if CONFIG_TRANSPORT_CIS #if CONFIG_BT_BAP_UNICAST_CONFIGURABLE #define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \ - BT_AUDIO_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ - BT_AUDIO_CONTEXT_TYPE_MEDIA, \ - CONFIG_BT_AUDIO_BITRATE_UNICAST_SINK) + BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ + BT_AUDIO_CONTEXT_TYPE_MEDIA, \ + CONFIG_BT_AUDIO_BITRATE_UNICAST_SINK) #define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SOURCE \ - BT_AUDIO_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ - BT_AUDIO_CONTEXT_TYPE_MEDIA, \ - CONFIG_BT_AUDIO_BITRATE_UNICAST_SRC) + BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ + BT_AUDIO_CONTEXT_TYPE_MEDIA, \ + CONFIG_BT_AUDIO_BITRATE_UNICAST_SRC) #elif CONFIG_BT_BAP_UNICAST_16_2_1 #define BT_BAP_LC3_UNICAST_PRESET_NRF5340_AUDIO_SINK \ @@ -97,9 +97,9 @@ #if CONFIG_TRANSPORT_BIS #if CONFIG_BT_AUDIO_BROADCAST_CONFIGURABLE #define BT_BAP_LC3_BROADCAST_PRESET_NRF5340_AUDIO \ - BT_AUDIO_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ - BT_AUDIO_CONTEXT_TYPE_MEDIA, \ - CONFIG_BT_AUDIO_BITRATE_BROADCAST_SRC) + BT_BAP_LC3_PRESET_CONFIGURABLE(BT_AUDIO_LOCATION_FRONT_LEFT, \ + BT_AUDIO_CONTEXT_TYPE_MEDIA, \ + CONFIG_BT_AUDIO_BITRATE_BROADCAST_SRC) #elif CONFIG_BT_BAP_BROADCAST_16_2_1 #define BT_BAP_LC3_BROADCAST_PRESET_NRF5340_AUDIO \ From dae51ef53f4ab6dac27f53745e98d205a21bb6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 12:52:37 -0700 Subject: [PATCH 11/47] dm: move to devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In upstream zephyr commit 656b0e642698be47b44931ea1b81ccf60f4b34cb ("drivers: counter: Adapt to use device tree"), the upstream zephyr drivers were moved away from relying on HAS_HW_NRF_TIMERx in favor of using devicetree. Do the same thing in the distance measurement module also by moving to devicetree. Signed-off-by: Martí Bolívar --- doc/nrf/libraries/others/dm.rst | 13 ++++++++++++- samples/bluetooth/nrf_dm/app.overlay | 5 +++++ subsys/dm/Kconfig | 26 -------------------------- subsys/dm/dm.c | 17 ++++------------- 4 files changed, 21 insertions(+), 40 deletions(-) diff --git a/doc/nrf/libraries/others/dm.rst b/doc/nrf/libraries/others/dm.rst index 4588dcfb759f..37619cba8fde 100644 --- a/doc/nrf/libraries/others/dm.rst +++ b/doc/nrf/libraries/others/dm.rst @@ -36,11 +36,22 @@ Configuration To use the Distance Measurement module, complete the following steps: -1. Enable the :kconfig:option:`CONFIG_NRF_DM` Kconfig option. +1. Enable the :kconfig:option:`CONFIG_DM_MODULE` Kconfig option. +#. Set the ``ncs,dm-timer`` :ref:`chosen node ` to the TIMER peripheral you wish this module to use. #. Include :file:`dm.h` in your :file:`main.c` file. #. Call :c:func:`dm_init()` to initialize the module. #. Call :c:func:`dm_request_add()` to perform the measurement. +For example, to use the ``TIMER2`` peripheral, set ``ncs,dm-timer`` as follows in a devicetree overlay: + +.. code-block:: DTS + + / { + chosen { + ncs,dm-timer = &timer2; + }; + }; + After synchronizing, the nodes that perform the measurement with each other will issue the measurement request. The callback function :c:func:`data_ready` is called when the measurement data is available. diff --git a/samples/bluetooth/nrf_dm/app.overlay b/samples/bluetooth/nrf_dm/app.overlay index e555a1173e14..e783a7eff011 100644 --- a/samples/bluetooth/nrf_dm/app.overlay +++ b/samples/bluetooth/nrf_dm/app.overlay @@ -5,6 +5,11 @@ */ / { + /* The timer instance to use. */ + chosen { + ncs,dm-timer = &timer2; + }; + /* The selected pins will be used by Distance Measurement module for debug purposes. */ dm_gpio { compatible = "gpio-leds"; diff --git a/subsys/dm/Kconfig b/subsys/dm/Kconfig index 4ead55b10d02..299390c50b8d 100644 --- a/subsys/dm/Kconfig +++ b/subsys/dm/Kconfig @@ -15,32 +15,6 @@ if DM_MODULE menu "nRF DM (Distance Measurement)" -choice DM_TIMER - default DM_TIMER2 - prompt "Timer to use for the nrf_dm library." - -config DM_TIMER0 - depends on HAS_HW_NRF_TIMER0 - bool "TIMER0" - -config DM_TIMER1 - depends on HAS_HW_NRF_TIMER1 - bool "TIMER1" - -config DM_TIMER2 - depends on HAS_HW_NRF_TIMER2 - bool "TIMER2" - -config DM_TIMER3 - depends on HAS_HW_NRF_TIMER3 - bool "TIMER3" - -config DM_TIMER4 - depends on HAS_HW_NRF_TIMER4 - bool "TIMER4" - -endchoice - config DM_HIGH_PRECISION_CALC # Due to memory limitations, functionality is not provided for nrf52832. depends on !SOC_NRF52832 diff --git a/subsys/dm/dm.c b/subsys/dm/dm.c index dab96255895e..1d2567a07a98 100644 --- a/subsys/dm/dm.c +++ b/subsys/dm/dm.c @@ -37,21 +37,12 @@ LOG_MODULE_REGISTER(nrf_dm, CONFIG_DM_MODULE_LOG_LEVEL); -#ifdef CONFIG_DM_TIMER0 -#define DM_TIMER NRF_TIMER0 -#endif -#ifdef CONFIG_DM_TIMER1 -#define DM_TIMER NRF_TIMER1 -#endif -#ifdef CONFIG_DM_TIMER2 +#if DT_HAS_CHOSEN(ncs_dm_timer) +#define DM_TIMER ((NRF_TIMER_Type *)DT_REG_ADDR(DT_CHOSEN(ncs_dm_timer))) +#else +#warning "The ncs,dm-timer chosen node is not set; defaulting to TIMER2" #define DM_TIMER NRF_TIMER2 #endif -#ifdef CONFIG_DM_TIMER3 -#define DM_TIMER NRF_TIMER3 -#endif -#ifdef CONFIG_DM_TIMER4 -#define DM_TIMER NRF_TIMER4 -#endif #define PPI_CH_COUNT 2 From 2d92428d5e416a10e804cc083e8cf3a961700f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Tue, 18 Apr 2023 13:15:43 -0700 Subject: [PATCH 12/47] samples: ppi_trace: move RTC configuration to devicetree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In upstream zephyr commit 656b0e642698be47b44931ea1b81ccf60f4b34cb ("drivers: counter: Adapt to use device tree"), the upstream zephyr drivers moved to devicetree and removed the COUNTER_RTCx options. Handle this by converting the sample to use devicetree's /zephyr,user node to allow the board overlay to specify the correct RTC peripheral to use. Signed-off-by: Martí Bolívar --- .../boards/nrf21540dk_nrf52840.overlay | 9 +++++++++ .../boards/nrf52840dk_nrf52840.overlay | 7 +++++++ .../ppi_trace/boards/nrf52dk_nrf52832.overlay | 9 +++++++++ .../ppi_trace/boards/nrf9160dk_nrf9160.overlay | 9 +++++++++ samples/debug/ppi_trace/src/main.c | 18 +++++++++++++----- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 samples/debug/ppi_trace/boards/nrf21540dk_nrf52840.overlay create mode 100644 samples/debug/ppi_trace/boards/nrf52dk_nrf52832.overlay create mode 100644 samples/debug/ppi_trace/boards/nrf9160dk_nrf9160.overlay diff --git a/samples/debug/ppi_trace/boards/nrf21540dk_nrf52840.overlay b/samples/debug/ppi_trace/boards/nrf21540dk_nrf52840.overlay new file mode 100644 index 000000000000..f72dfc782f60 --- /dev/null +++ b/samples/debug/ppi_trace/boards/nrf21540dk_nrf52840.overlay @@ -0,0 +1,9 @@ +&rtc2 { + status = "okay"; +}; + +/ { + zephyr,user { + ppi-trace-rtc = <&rtc2>; + }; +}; diff --git a/samples/debug/ppi_trace/boards/nrf52840dk_nrf52840.overlay b/samples/debug/ppi_trace/boards/nrf52840dk_nrf52840.overlay index b4558783fc01..62df0e23e637 100644 --- a/samples/debug/ppi_trace/boards/nrf52840dk_nrf52840.overlay +++ b/samples/debug/ppi_trace/boards/nrf52840dk_nrf52840.overlay @@ -1,5 +1,12 @@ +&rtc2 { + status = "okay"; +}; + / { chosen { zephyr,entropy = &rng; }; + zephyr,user { + ppi-trace-rtc = <&rtc2>; + }; }; diff --git a/samples/debug/ppi_trace/boards/nrf52dk_nrf52832.overlay b/samples/debug/ppi_trace/boards/nrf52dk_nrf52832.overlay new file mode 100644 index 000000000000..f72dfc782f60 --- /dev/null +++ b/samples/debug/ppi_trace/boards/nrf52dk_nrf52832.overlay @@ -0,0 +1,9 @@ +&rtc2 { + status = "okay"; +}; + +/ { + zephyr,user { + ppi-trace-rtc = <&rtc2>; + }; +}; diff --git a/samples/debug/ppi_trace/boards/nrf9160dk_nrf9160.overlay b/samples/debug/ppi_trace/boards/nrf9160dk_nrf9160.overlay new file mode 100644 index 000000000000..fc652bf1b706 --- /dev/null +++ b/samples/debug/ppi_trace/boards/nrf9160dk_nrf9160.overlay @@ -0,0 +1,9 @@ +&rtc0 { + status = "okay"; +}; + +/ { + zephyr,user { + ppi-trace-rtc = <&rtc0>; + }; +}; diff --git a/samples/debug/ppi_trace/src/main.c b/samples/debug/ppi_trace/src/main.c index 370095eda2da..5ab41a89ba0a 100644 --- a/samples/debug/ppi_trace/src/main.c +++ b/samples/debug/ppi_trace/src/main.c @@ -17,12 +17,20 @@ LOG_MODULE_REGISTER(app); #define ALARM_PERIOD_US 50000 -#if IS_ENABLED(CONFIG_USE_RTC2) -#define RTC NRF_RTC2 -#define RTC_NODE DT_NODELABEL(rtc2) +#define ZEPHYR_USER_NODE DT_PATH(zephyr_user) +#if DT_NODE_HAS_PROP(ZEPHYR_USER_NODE, ppi_trace_rtc) +#define RTC_NODE DT_PROP(ZEPHYR_USER_NODE, ppi_trace_rtc) +#define RTC ((NRF_RTC_Type*)DT_REG_ADDR(RTC_NODE)) #else -#define RTC NRF_RTC0 -#define RTC_NODE DT_NODELABEL(rtc0) +/* + * This sample now relies on the /zephyr,user node having a + * ppi-trace-rtc property that is a phandle to the RTC node you wish + * to use on your board. See the overlay files in the boards/ + * subdirectory of this sample for examples. + */ +#error "Missing ppi-trace-rtc property in /zephyr,user; see source comments for details" +#define RTC_NODE DT_INVALID_NODE +#define RTC ((NRF_RTC_Type*)0) #endif static void alarm_callback(const struct device *dev, uint8_t chan_id, uint32_t ticks, From a66c49e16a5f2de4c2a86459b9d8869fbf3381c7 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 19 Apr 2023 12:00:22 +0200 Subject: [PATCH 13/47] bluetooth/gatt_dm: made BT_GATT_DM_DATA_PRINT independent from BT_DEBUG There is no reason for having this feature dependent on a Logging subsystem as it is using printk. Signed-off-by: Andrzej Puzdrowski --- subsys/bluetooth/Kconfig.discovery | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/Kconfig.discovery b/subsys/bluetooth/Kconfig.discovery index 7229a0ab3054..ec6b8d541bd3 100644 --- a/subsys/bluetooth/Kconfig.discovery +++ b/subsys/bluetooth/Kconfig.discovery @@ -19,7 +19,6 @@ config BT_GATT_DM_MAX_ATTRS config BT_GATT_DM_DATA_PRINT bool "Enable functions for printing discovery related data" - depends on BT_DEBUG help Enable functions for printing discovery related data From b2dce85f37a109db61c0a9f321a751003498b8d2 Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 19 Apr 2023 11:14:32 +0300 Subject: [PATCH 14/47] net: lwm2m: Refactor lwm2m_send to lwm2m_send_cb lwm2m_send() is now deprecated in Zephyr so use the lwm2m_send_cb instead. Signed-off-by: Seppo Takalo --- .../cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.h | 2 +- .../cloud/lwm2m_integration/lwm2m_integration.c | 10 ++++++---- .../lwm2m_integration/src/lwm2m_integration_test.c | 4 ++-- samples/nrf9160/lwm2m_client/src/main.c | 2 +- .../location/location_assistance.c | 6 +++--- .../lwm2m_client_utils/src/location_assistance.c | 14 +++++++------- .../subsys/net/lib/lwm2m_client_utils/src/stubs.c | 4 ++-- .../subsys/net/lib/lwm2m_client_utils/src/stubs.h | 6 +++--- 8 files changed, 25 insertions(+), 23 deletions(-) diff --git a/applications/asset_tracker_v2/src/cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.h b/applications/asset_tracker_v2/src/cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.h index 50ed91bcb4e9..fb7bfe174a23 100644 --- a/applications/asset_tracker_v2/src/cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.h +++ b/applications/asset_tracker_v2/src/cloud/cloud_codec/lwm2m/lwm2m_codec_helpers.h @@ -148,7 +148,7 @@ int lwm2m_codec_helpers_set_neighbor_cell_data(struct cloud_data_neighbor_cells /** @brief Generate path lists with reference to objects. * This function outputs a list of paths that can be used to reference objects that should - * be updated (sent to server) when calling the lwm2m_send() function. + * be updated (sent to server) when calling the lwm2m_send_cb() function. * * @param[out] output Pointer to structure into which the input path list will be added. * @param[in] path List that contains LwM2M paths that will be diff --git a/applications/asset_tracker_v2/src/cloud/lwm2m_integration/lwm2m_integration.c b/applications/asset_tracker_v2/src/cloud/lwm2m_integration/lwm2m_integration.c index dac4983068b0..1e81f69bdc57 100644 --- a/applications/asset_tracker_v2/src/cloud/lwm2m_integration/lwm2m_integration.c +++ b/applications/asset_tracker_v2/src/cloud/lwm2m_integration/lwm2m_integration.c @@ -464,13 +464,14 @@ int cloud_wrap_data_send(char *buf, size_t len, bool ack, uint32_t id, { ARG_UNUSED(buf); ARG_UNUSED(len); + ARG_UNUSED(ack); ARG_UNUSED(id); int err; - err = lwm2m_send(&client, path_list, len, ack); + err = lwm2m_send_cb(&client, path_list, len, NULL); if (err) { - LOG_ERR("lwm2m_send, error: %d", err); + LOG_ERR("lwm2m_send_cb, error: %d", err); return err; } @@ -487,13 +488,14 @@ int cloud_wrap_ui_send(char *buf, size_t len, bool ack, uint32_t id, { ARG_UNUSED(buf); ARG_UNUSED(len); + ARG_UNUSED(ack); ARG_UNUSED(id); int err; - err = lwm2m_send(&client, path_list, len, ack); + err = lwm2m_send_cb(&client, path_list, len, NULL); if (err) { - LOG_ERR("lwm2m_send, error: %d", err); + LOG_ERR("lwm2m_send_cb, error: %d", err); return err; } diff --git a/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c b/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c index 59ddd5ebfa04..a8f7c2c4b469 100644 --- a/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c +++ b/applications/asset_tracker_v2/tests/lwm2m_integration/src/lwm2m_integration_test.c @@ -182,7 +182,7 @@ void test_lwm2m_integration_data_send(void) LWM2M_OBJ(4, 0, 7), }; - __cmock_lwm2m_send_ExpectAndReturn(&client, paths, PATH_LEN, true, 0); + __cmock_lwm2m_send_cb_ExpectAndReturn(&client, paths, PATH_LEN, NULL, 0); TEST_ASSERT_EQUAL(0, cloud_wrap_data_send(NULL, PATH_LEN, true, 0, paths)); } @@ -198,7 +198,7 @@ void test_lwm2m_integration_ui_send(void) LWM2M_OBJ(4, 0, 7), }; - __cmock_lwm2m_send_ExpectAndReturn(&client, paths, PATH_LEN, true, 0); + __cmock_lwm2m_send_cb_ExpectAndReturn(&client, paths, PATH_LEN, NULL, 0); TEST_ASSERT_EQUAL(0, cloud_wrap_ui_send(NULL, PATH_LEN, true, 0, paths)); } diff --git a/samples/nrf9160/lwm2m_client/src/main.c b/samples/nrf9160/lwm2m_client/src/main.c index b89f18821924..4d0928dc52e1 100644 --- a/samples/nrf9160/lwm2m_client/src/main.c +++ b/samples/nrf9160/lwm2m_client/src/main.c @@ -184,7 +184,7 @@ void send_periodically_work_handler(struct k_work *work) }; /* lwm2m send post to server */ - ret = lwm2m_send(&client, send_path, 4, true); + ret = lwm2m_send_cb(&client, send_path, 4, NULL); if (ret) { if (ret == EPERM) { LOG_INF("Server Mute send block send operation"); diff --git a/subsys/net/lib/lwm2m_client_utils/location/location_assistance.c b/subsys/net/lib/lwm2m_client_utils/location/location_assistance.c index b8db66164908..ce806f85b86c 100644 --- a/subsys/net/lib/lwm2m_client_utils/location/location_assistance.c +++ b/subsys/net/lib/lwm2m_client_utils/location/location_assistance.c @@ -222,7 +222,7 @@ static int do_agps_request_send(struct lwm2m_ctx *ctx, bool confirmable) }; /* Send Request to server */ - return lwm2m_send(ctx, send_path, path_count, confirmable); + return lwm2m_send_cb(ctx, send_path, path_count, NULL); } #if defined(CONFIG_LWM2M_CLIENT_UTILS_LOCATION_ASSIST_AGPS) @@ -273,7 +273,7 @@ static int do_ground_fix_request_send(struct lwm2m_ctx *ctx, bool confirmable) }; /* Send Request to server */ - return lwm2m_send(ctx, send_path, path_count, confirmable); + return lwm2m_send_cb(ctx, send_path, path_count, NULL); } #if defined(CONFIG_LWM2M_CLIENT_UTILS_GROUND_FIX_OBJ_SUPPORT) @@ -312,7 +312,7 @@ static int do_pgps_request_send(struct lwm2m_ctx *ctx, bool confirmable) }; /* Send Request to server */ - return lwm2m_send(ctx, send_path, path_count, confirmable); + return lwm2m_send_cb(ctx, send_path, path_count, NULL); } #if defined(CONFIG_LWM2M_CLIENT_UTILS_LOCATION_ASSIST_PGPS) diff --git a/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c b/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c index 4ab00f797207..08d9b1d94c69 100644 --- a/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c +++ b/tests/subsys/net/lib/lwm2m_client_utils/src/location_assistance.c @@ -71,7 +71,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_agps_send) rc = location_assistance_agps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); gnss_obj->resources[GNSS_ASSIST_ASSIST_DATA].post_write_cb(0, GNSS_ASSIST_ASSIST_DATA, 0, buf, 8, true, 8); @@ -91,7 +91,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_pgps_send) rc = location_assistance_pgps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); gnss_obj->resources[GNSS_ASSIST_ASSIST_DATA].post_write_cb(0, GNSS_ASSIST_ASSIST_DATA, 0, buf, 8, true, 8); @@ -114,7 +114,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_simultaneous_send) rc = location_assistance_agps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); rc = location_assistance_pgps_request_send(&client_ctx, true); zassert_equal(rc, -EAGAIN, "Error %d", rc); @@ -126,7 +126,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_simultaneous_send) rc = location_assistance_pgps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 2, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 2, "Request not sent"); gnss_obj->resources[GNSS_ASSIST_ASSIST_DATA].post_write_cb(0, GNSS_ASSIST_ASSIST_DATA, 0, buf, 8, true, 8); @@ -143,7 +143,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_ground_fix_send) rc = location_assistance_ground_fix_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); } ZTEST(lwm2m_client_utils_location_assistance, test_temporary_failure) @@ -164,7 +164,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_temporary_failure) rc = location_assistance_agps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); gnss_obj->resources[GNSS_ASSIST_RESULT_CODE].post_write_cb(0, GNSS_ASSIST_RESULT_CODE, 0, resbuf, 4, true, 4); @@ -197,7 +197,7 @@ ZTEST(lwm2m_client_utils_location_assistance, test_zzzpermanent_failure) rc = location_assistance_agps_request_send(&client_ctx, true); zassert_equal(rc, 0, "Error %d", rc); - zassert_equal(lwm2m_send_fake.call_count, 1, "Request not sent"); + zassert_equal(lwm2m_send_cb_fake.call_count, 1, "Request not sent"); gnss_obj->resources[GNSS_ASSIST_RESULT_CODE].post_write_cb(0, GNSS_ASSIST_RESULT_CODE, 0, resbuf, 4, true, 4); diff --git a/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.c b/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.c index 41946caee737..312a5bf654fd 100644 --- a/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.c +++ b/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.c @@ -32,8 +32,8 @@ DEFINE_FAKE_VALUE_FUNC(int, lwm2m_get_bool, const struct lwm2m_obj_path *, bool DEFINE_FAKE_VALUE_FUNC(int, lwm2m_set_opaque, const struct lwm2m_obj_path *, const char *, uint16_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_set_string, const struct lwm2m_obj_path *, const char*); -DEFINE_FAKE_VALUE_FUNC(int, lwm2m_send, struct lwm2m_ctx *, - const struct lwm2m_obj_path *, uint8_t, bool); +DEFINE_FAKE_VALUE_FUNC(int, lwm2m_send_cb, struct lwm2m_ctx *, + const struct lwm2m_obj_path *, uint8_t, lwm2m_send_cb_t); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_delete_object_inst, const struct lwm2m_obj_path *); DEFINE_FAKE_VALUE_FUNC(int, lwm2m_register_delete_callback, uint16_t, lwm2m_engine_user_cb_t); diff --git a/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.h b/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.h index 3072820d5b34..2def1abbea21 100644 --- a/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.h +++ b/tests/subsys/net/lib/lwm2m_client_utils/src/stubs.h @@ -27,8 +27,8 @@ DECLARE_FAKE_VALUE_FUNC(int, lwm2m_get_bool, const struct lwm2m_obj_path *, bool DECLARE_FAKE_VALUE_FUNC(int, lwm2m_set_opaque, const struct lwm2m_obj_path *, const char *, uint16_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_set_string, const struct lwm2m_obj_path *, const char *) -DECLARE_FAKE_VALUE_FUNC(int, lwm2m_send, struct lwm2m_ctx *, - const struct lwm2m_obj_path *, uint8_t, bool); +DECLARE_FAKE_VALUE_FUNC(int, lwm2m_send_cb, struct lwm2m_ctx *, + const struct lwm2m_obj_path *, uint8_t, lwm2m_send_cb_t); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_delete_object_inst, const struct lwm2m_obj_path *); DECLARE_FAKE_VALUE_FUNC(int, lwm2m_register_delete_callback, uint16_t, lwm2m_engine_user_cb_t); @@ -116,7 +116,7 @@ DECLARE_FAKE_VALUE_FUNC(int, at_params_list_init, struct at_param_list *, size_t FUNC(lwm2m_set_s32) \ FUNC(lwm2m_set_opaque) \ FUNC(lwm2m_set_string) \ - FUNC(lwm2m_send) \ + FUNC(lwm2m_send_cb) \ FUNC(lwm2m_delete_object_inst) \ FUNC(lwm2m_register_delete_callback) \ FUNC(lwm2m_register_create_callback) \ From 7310cb22af2003c14950efd55a0d0bc5b4a69371 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Wed, 19 Apr 2023 15:36:39 +0200 Subject: [PATCH 15/47] applications: nrf_desktop: Fix MCUboot FLASH overflow on nRF52820 SoC Change disables ARM MPU to fix MCUboot FLASH overflow on nRF52820 SoC. Jira: NCSDK-21150 Signed-off-by: Marek Pieta --- .../nrf52820dongle_nrf52820/child_image/mcuboot/prj_release.conf | 1 + .../nrf52833dk_nrf52820/child_image/mcuboot/prj_release.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/child_image/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/child_image/mcuboot/prj_release.conf index 943c80666a78..e861ab8425ad 100644 --- a/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/child_image/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52820dongle_nrf52820/child_image/mcuboot/prj_release.conf @@ -61,3 +61,4 @@ CONFIG_TIMESLICING=n CONFIG_PRINTK=n CONFIG_BOOT_BANNER=n CONFIG_ERRNO=n +CONFIG_ARM_MPU=n diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/child_image/mcuboot/prj_release.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/child_image/mcuboot/prj_release.conf index f7d106237f90..7516a15d9ad7 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/child_image/mcuboot/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52820/child_image/mcuboot/prj_release.conf @@ -65,3 +65,4 @@ CONFIG_CONSOLE=n CONFIG_UART_CONSOLE=n CONFIG_BOOT_BANNER=n CONFIG_ERRNO=n +CONFIG_ARM_MPU=n From c13c8258dbd816569463e19e40a718bfa5d16c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 19 Apr 2023 11:32:14 -0700 Subject: [PATCH 16/47] tests: mesh: fix net_buf references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream zephyr commit 5862c8263b8dcd0a029e21ac9472cded14d8bad4 ("net: buf: Factor out net_buf_simple to separate source file") removed the net_buf_simple functions from buf.c. Rather than hard-code their locations, let's enable the Kconfig option that tells the build system we would like network buffer support in our application. This fixes the build and should be more future-proof. Signed-off-by: Martí Bolívar --- tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt | 1 - tests/subsys/bluetooth/mesh/light_ctrl/prj.conf | 2 ++ .../mesh/scheduler_model/action_planning/CMakeLists.txt | 1 - .../bluetooth/mesh/scheduler_model/action_planning/prj.conf | 2 ++ .../mesh/scheduler_model/message_validity/CMakeLists.txt | 1 - .../bluetooth/mesh/scheduler_model/message_validity/prj.conf | 2 ++ .../subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt | 1 - tests/subsys/bluetooth/mesh/scheduler_model/timing/prj.conf | 2 ++ tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt | 1 - tests/subsys/bluetooth/mesh/sensor_subsys/prj.conf | 1 + .../subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt | 1 - tests/subsys/bluetooth/mesh/silvair_enocean_model/prj.conf | 2 ++ 12 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt b/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt index 85d0b960791f..0a0cede0db9d 100644 --- a/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt @@ -18,7 +18,6 @@ target_sources(app ${NRF_DIR}/subsys/bluetooth/mesh/light_ctrl_reg_spec.c ${NRF_DIR}/subsys/bluetooth/mesh/sensor_types.c ${NRF_DIR}/subsys/bluetooth/mesh/sensor.c - ${ZEPHYR_BASE}/subsys/net/buf.c ) target_include_directories(app diff --git a/tests/subsys/bluetooth/mesh/light_ctrl/prj.conf b/tests/subsys/bluetooth/mesh/light_ctrl/prj.conf index 026cb41ca467..cb7e4bce6fd8 100644 --- a/tests/subsys/bluetooth/mesh/light_ctrl/prj.conf +++ b/tests/subsys/bluetooth/mesh/light_ctrl/prj.conf @@ -9,3 +9,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_MOCKING=y CONFIG_ZTEST_PARAMETER_COUNT=30 + +CONFIG_NET_BUF=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt index ab2012d3ec71..0f1fa620ab03 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt @@ -21,7 +21,6 @@ target_sources(app PRIVATE ${NRF_DIR}/subsys/bluetooth/mesh/scheduler_srv.c ${NRF_DIR}/subsys/bluetooth/mesh/time_util.c ${NRF_DIR}/subsys/bluetooth/mesh/model_utils.c - ${ZEPHYR_BASE}/subsys/net/buf.c ../common/sched_test.c ) diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/prj.conf b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/prj.conf index 6f59d9ff0d1d..f43b47f76dbc 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/prj.conf +++ b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/prj.conf @@ -8,3 +8,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_TEST_RANDOM_GENERATOR=y + +CONFIG_NET_BUF=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt index 747f3300ce62..6894559b2e93 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt @@ -22,7 +22,6 @@ target_sources(app PRIVATE ${NRF_DIR}/subsys/bluetooth/mesh/scheduler_cli.c ${NRF_DIR}/subsys/bluetooth/mesh/time_util.c ${NRF_DIR}/subsys/bluetooth/mesh/model_utils.c - ${ZEPHYR_BASE}/subsys/net/buf.c ../common/sched_test.c ) diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/prj.conf b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/prj.conf index 480635a19b9d..09cc225d1395 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/prj.conf +++ b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/prj.conf @@ -9,3 +9,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_ZTEST_MOCKING=y + +CONFIG_NET_BUF=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt index 98f7fed3a511..9dcc16aef871 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt @@ -20,7 +20,6 @@ target_sources(app PRIVATE ${app_sources} ${NRF_DIR}/subsys/bluetooth/mesh/scheduler_srv.c ${NRF_DIR}/subsys/bluetooth/mesh/time_util.c - ${ZEPHYR_BASE}/subsys/net/buf.c ../common/sched_test.c ) diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/timing/prj.conf b/tests/subsys/bluetooth/mesh/scheduler_model/timing/prj.conf index 547ba1122804..e627fcbd2a65 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/timing/prj.conf +++ b/tests/subsys/bluetooth/mesh/scheduler_model/timing/prj.conf @@ -8,3 +8,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_TEST_RANDOM_GENERATOR=y + +CONFIG_NET_BUF=y diff --git a/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt b/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt index 55f5f1839580..c605cd8739d0 100644 --- a/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt @@ -18,7 +18,6 @@ target_sources(app PRIVATE ${app_sources} ${NRF_DIR}/subsys/bluetooth/mesh/sensor_types.c ${NRF_DIR}/subsys/bluetooth/mesh/sensor.c - ${ZEPHYR_BASE}/subsys/net/buf.c ${ZEPHYR_BASE}/subsys/bluetooth/mesh/msg.c ) diff --git a/tests/subsys/bluetooth/mesh/sensor_subsys/prj.conf b/tests/subsys/bluetooth/mesh/sensor_subsys/prj.conf index 30c64c195ebd..e3369b3d56d4 100644 --- a/tests/subsys/bluetooth/mesh/sensor_subsys/prj.conf +++ b/tests/subsys/bluetooth/mesh/sensor_subsys/prj.conf @@ -8,3 +8,4 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_CBPRINTF_FP_SUPPORT=y +CONFIG_NET_BUF=y diff --git a/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt b/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt index 3847a55211c8..0cdbe4c69d20 100644 --- a/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt @@ -15,7 +15,6 @@ target_sources(app PRIVATE ${ZEPHYR_BASE}/../zephyr/subsys/bluetooth/common/addr.c ${ZEPHYR_BASE}/../nrf/subsys/bluetooth/mesh/vnd/silvair_enocean_srv.c - ${ZEPHYR_BASE}/subsys/net/buf.c ) target_include_directories(app diff --git a/tests/subsys/bluetooth/mesh/silvair_enocean_model/prj.conf b/tests/subsys/bluetooth/mesh/silvair_enocean_model/prj.conf index e6e9df1cf5e7..8731ff95502c 100644 --- a/tests/subsys/bluetooth/mesh/silvair_enocean_model/prj.conf +++ b/tests/subsys/bluetooth/mesh/silvair_enocean_model/prj.conf @@ -8,3 +8,5 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_MOCKING=y + +CONFIG_NET_BUF=y From 21aca6cb74b1001a112b4abe308acbad89b358c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 19 Apr 2023 12:14:20 -0700 Subject: [PATCH 17/47] scripts: add ANT samples to quarantine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Put these in quarantine until we have time to work with our partners to update the samples. Signed-off-by: Martí Bolívar --- scripts/quarantine.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml index 862747555bbc..cb94e500e21e 100644 --- a/scripts/quarantine.yaml +++ b/scripts/quarantine.yaml @@ -108,3 +108,20 @@ platforms: - thingy53_nrf5340_cpuapp comment: "Configurations excluded to limit resources usage in integration builds" + +- scenarios: + - sample.ant_advanced_burst + - sample.ant_background_scanning + - sample.ant_broadcast_rx + - sample.ant_broadcast_tx + - sample.bpwr_rx + - sample.bpwr_tx + - sample.bsc_rx + - sample.bsc_tx + - sample.hrm_rx + - sample.hrm_tx + - sample.ble_ant_app_hrm + - sample.ant_rpc + platforms: + - all + comment: "ANT samples fail to build; need to change main()'s signature to int main(void)" From 8a5cebf243686a98cbdc32ee5d4e331302382fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 19 Apr 2023 12:45:42 -0700 Subject: [PATCH 18/47] tests: drivers: lpuart: update timer usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream Zephyr has removed all of the CONFIG_COUNTER options in favor of requiring the user to enable the overall driver (CONFIG_COUNTER=y), then enable the relevant timer nodes in devicetree. (CONFIG_NRF_TIMER is def_bool y if any such nodes are enabled.) Continued usage of these options breaks the build; update them. Signed-off-by: Martí Bolívar --- tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf | 1 - tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay | 2 +- tests/drivers/lpuart/boards/nrf9160dk_nrf9160.conf | 1 - tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay | 1 + tests/drivers/lpuart/boards/nrf9160dk_nrf9160_loopback.overlay | 1 + 5 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf index e0071253378a..ebac3cb7f381 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf @@ -5,7 +5,6 @@ CONFIG_UART_1_NRF_ASYNC_LOW_POWER=y CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2 CONFIG_NRF_SW_LPUART=y -CONFIG_COUNTER_TIMER3=y CONFIG_NRFX_TIMER3=y CONFIG_COUNTER=y CONFIG_ENTROPY_CC3XX=y diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay index 1fcfe65b83de..43675e10c83b 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay @@ -49,7 +49,7 @@ }; &timer3 { - status = "ok"; + status = "okay"; interrupts = <26 0>; }; diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.conf b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.conf index 8d806b756ca3..c03142840b2d 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.conf +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.conf @@ -6,6 +6,5 @@ CONFIG_UART_2_NRF_HW_ASYNC=y CONFIG_UART_2_NRF_ASYNC_LOW_POWER=y CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 -CONFIG_COUNTER_TIMER0=y CONFIG_COUNTER=y CONFIG_ENTROPY_CC3XX=y diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay index a8fb0f723827..458063400df4 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay @@ -44,6 +44,7 @@ }; &timer0 { + status = "okay"; interrupts = <15 0>; }; diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160_loopback.overlay b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160_loopback.overlay index bc4261a4dfc2..d6260ff97a95 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf9160_loopback.overlay +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf9160_loopback.overlay @@ -44,6 +44,7 @@ }; &timer0 { + status = "okay"; interrupts = <15 0>; }; From 4efe838fafaf0b1f087e40525d96c92aa45b7e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 19 Apr 2023 13:07:53 -0700 Subject: [PATCH 19/47] samples: wifi: shell: add missing zperf option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not clear to me how this arose, but this sample configuration ends up building zephyr/subsys/net/lib/zperf/zperf_tcp_receiver.c, which in turn uses MY_IP4ADDR from zperf_internal.h as a string, which in turn requires CONFIG_NET_CONFIG_SETTINGS=y for a non-null value to be the resulting expansion of that string. Turn the option on. We still have build errors in this sample due to other renaming that happened in upstream zephyr, but it's progress: Signed-off-by: Martí Bolívar --- samples/wifi/shell/overlay-zperf.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/wifi/shell/overlay-zperf.conf b/samples/wifi/shell/overlay-zperf.conf index 949b13d02317..43eb2e1642bf 100644 --- a/samples/wifi/shell/overlay-zperf.conf +++ b/samples/wifi/shell/overlay-zperf.conf @@ -10,6 +10,9 @@ CONFIG_NET_BUF_DATA_SIZE=1100 CONFIG_NRF700X_QSPI_LOW_POWER=n #CONFIG_SPEED_OPTIMIZATIONS=y +# Necessary for zperf_tcp_receiver.c +CONFIG_NET_CONFIG_SETTINGS=y + # Consumes more memory CONFIG_WIFI_CREDENTIALS=n CONFIG_FLASH=n From ee666d3f33c185e2c389a001b0cf322f29939ebb Mon Sep 17 00:00:00 2001 From: Krishna T Date: Wed, 19 Apr 2023 22:05:43 +0530 Subject: [PATCH 20/47] drivers: wifi: Fix the TWT variable renames Upstream Zephyr has renamed the variables (removing _ms suffix), so, update the variables in drivers. Signed-off-by: Krishna T --- .../wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c index 38c8570e00ce..645eb37db9c0 100644 --- a/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c +++ b/drivers/wifi/nrf700x/zephyr/src/zephyr_wifi_mgmt.c @@ -348,13 +348,13 @@ int wifi_nrf_get_power_save_config(const struct device *dev, } /* TWT interval conversion helpers: User <-> Protocol */ -static struct twt_interval_float wifi_nrf_twt_ms_to_float(uint32_t twt_interval_ms) +static struct twt_interval_float wifi_nrf_twt_ms_to_float(uint32_t twt_interval) { double mantissa = 0; int exponent = 0; struct twt_interval_float twt_interval_float; - mantissa = frexp(twt_interval_ms, &exponent); + mantissa = frexp(twt_interval, &exponent); /* Ceiling and conversion to milli seconds */ twt_interval_float.mantissa = ceil(mantissa * 1000); twt_interval_float.exponent = exponent; @@ -516,8 +516,8 @@ void wifi_nrf_event_proc_get_power_save_info(void *vif_ctx, twt_zep->dialog_token = twt_rpu->dialog_token; twt_interval_float.mantissa = twt_rpu->twt_target_wake_interval_mantissa; twt_interval_float.exponent = twt_rpu->twt_target_wake_interval_exponent; - twt_zep->twt_interval_ms = wifi_nrf_twt_float_to_ms(twt_interval_float); - twt_zep->twt_wake_interval_ms = twt_rpu->nominal_min_twt_wake_duration; + twt_zep->twt_interval = wifi_nrf_twt_float_to_ms(twt_interval_float); + twt_zep->twt_wake_interval = twt_rpu->nominal_min_twt_wake_duration; } vif_ctx_zep->ps_config_info_evnt = true; @@ -554,7 +554,7 @@ int wifi_nrf_set_twt(const struct device *dev, switch (twt_params->operation) { case WIFI_TWT_SETUP: struct twt_interval_float twt_interval_float = - wifi_nrf_twt_ms_to_float(twt_params->setup.twt_interval_ms); + wifi_nrf_twt_ms_to_float(twt_params->setup.twt_interval); twt_info.twt_flow_id = twt_params->flow_id; twt_info.neg_type = twt_wifi_mgmt_to_rpu_neg_type(twt_params->negotiation_type); @@ -568,7 +568,7 @@ int wifi_nrf_set_twt(const struct device *dev, } twt_info.nominal_min_twt_wake_duration = - twt_params->setup.twt_wake_interval_ms; + twt_params->setup.twt_wake_interval; twt_info.twt_target_wake_interval_mantissa = twt_interval_float.mantissa; twt_info.twt_target_wake_interval_exponent = twt_interval_float.exponent; @@ -645,11 +645,11 @@ void wifi_nrf_event_proc_twt_setup_zep(void *vif_ctx, twt_params.setup.implicit = twt_setup_info->info.is_implicit ? 1 : 0; twt_params.setup.announce = twt_setup_info->info.twt_flow_type == NRF_WIFI_TWT_FLOW_TYPE_ANNOUNCED; - twt_params.setup.twt_wake_interval_ms = + twt_params.setup.twt_wake_interval = twt_setup_info->info.nominal_min_twt_wake_duration; twt_interval_float.mantissa = twt_setup_info->info.twt_target_wake_interval_mantissa; twt_interval_float.exponent = twt_setup_info->info.twt_target_wake_interval_exponent; - twt_params.setup.twt_interval_ms = wifi_nrf_twt_float_to_ms(twt_interval_float); + twt_params.setup.twt_interval = wifi_nrf_twt_float_to_ms(twt_interval_float); twt_params.dialog_token = twt_setup_info->info.dialog_token; twt_params.resp_status = twt_setup_info->info.twt_resp_status; From cded9ee361d94e6474b12eda3cea1a0bde69a278 Mon Sep 17 00:00:00 2001 From: Krishna T Date: Wed, 19 Apr 2023 22:06:39 +0530 Subject: [PATCH 21/47] samples: wifi: Fix the TWT variable renames Upstream Zephyr has renamed the variables (removing _ms suffix), so, update the variables in help. Signed-off-by: Krishna T --- samples/wifi/shell/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/wifi/shell/README.rst b/samples/wifi/shell/README.rst index c6c5b8dccabe..69f373b35aa7 100644 --- a/samples/wifi/shell/README.rst +++ b/samples/wifi/shell/README.rst @@ -105,7 +105,7 @@ Supported CLI commands | | | - | + | | | teardown - Teardown a TWT flow: | From 08177f3e7e907e264e1e7c6903feafc5c1c0abcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Fri, 21 Apr 2023 04:29:36 +0200 Subject: [PATCH 22/47] bluetooth: rpc: Adapt to the new oob set flag API. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old API bt_set_oob_data_flag was replaced by 2 new functions: bt_le_oob_set_legacy_flag and bt_le_oob_set_sc_flag. Signed-off-by: Michał Grochala --- .../bluetooth/rpc/client/bt_rpc_conn_client.c | 17 +++++++-- subsys/bluetooth/rpc/common/bt_rpc_common.h | 3 +- subsys/bluetooth/rpc/host/bt_rpc_conn_host.c | 35 ++++++++++++++++--- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c index 545e716c3287..934aab7fbe05 100644 --- a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c +++ b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c @@ -1175,7 +1175,7 @@ void bt_set_bondable(bool enable) &ctx, ser_rsp_decode_void, NULL); } -void bt_set_oob_data_flag(bool enable) +void bt_le_oob_set_legacy_flag(bool enable) { struct nrf_rpc_cbor_ctx ctx; size_t buffer_size_max = 1; @@ -1184,7 +1184,20 @@ void bt_set_oob_data_flag(bool enable) ser_encode_bool(&ctx, enable); - nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_SET_OOB_DATA_FLAG_RPC_CMD, + nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_LE_OOB_SET_LEGACY_FLAG_RPC_CMD, + &ctx, ser_rsp_decode_void, NULL); +} + +void bt_le_oob_set_sc_flag(bool enable) +{ + struct nrf_rpc_cbor_ctx ctx; + size_t buffer_size_max = 1; + + NRF_RPC_CBOR_ALLOC(&bt_rpc_grp, ctx, buffer_size_max); + + ser_encode_bool(&ctx, enable); + + nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_LE_OOB_SET_SC_FLAG_RPC_CMD, &ctx, ser_rsp_decode_void, NULL); } diff --git a/subsys/bluetooth/rpc/common/bt_rpc_common.h b/subsys/bluetooth/rpc/common/bt_rpc_common.h index 0d76873c3d62..235d5e3a720e 100644 --- a/subsys/bluetooth/rpc/common/bt_rpc_common.h +++ b/subsys/bluetooth/rpc/common/bt_rpc_common.h @@ -98,7 +98,8 @@ enum bt_rpc_cmd_from_cli_to_host { BT_CONN_ENC_KEY_SIZE_RPC_CMD, BT_CONN_CB_REGISTER_ON_REMOTE_RPC_CMD, BT_SET_BONDABLE_RPC_CMD, - BT_SET_OOB_DATA_FLAG_RPC_CMD, + BT_LE_OOB_SET_LEGACY_FLAG_RPC_CMD, + BT_LE_OOB_SET_SC_FLAG_RPC_CMD, BT_LE_OOB_SET_LEGACY_TK_RPC_CMD, BT_LE_OOB_SET_SC_DATA_RPC_CMD, BT_LE_OOB_GET_SC_DATA_RPC_CMD, diff --git a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c index 4cd96e2c28cf..e62d1aa3cc4b 100644 --- a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c +++ b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c @@ -964,7 +964,7 @@ NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_set_bondable, BT_SET_BONDABLE_RPC_CMD, bt_set_bondable_rpc_handler, NULL); -static void bt_set_oob_data_flag_rpc_handler(const struct nrf_rpc_group *group, +static void bt_le_oob_set_legacy_flag_rpc_handler(const struct nrf_rpc_group *group, struct nrf_rpc_cbor_ctx *ctx, void *handler_data) { bool enable; @@ -975,17 +975,42 @@ static void bt_set_oob_data_flag_rpc_handler(const struct nrf_rpc_group *group, goto decoding_error; } - bt_set_oob_data_flag(enable); + bt_le_oob_set_legacy_flag(enable); ser_rsp_send_void(group); return; decoding_error: - report_decoding_error(BT_SET_OOB_DATA_FLAG_RPC_CMD, handler_data); + report_decoding_error(BT_LE_OOB_SET_LEGACY_FLAG_RPC_CMD, handler_data); } -NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_set_oob_data_flag, BT_SET_OOB_DATA_FLAG_RPC_CMD, - bt_set_oob_data_flag_rpc_handler, NULL); +NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_le_oob_set_legacy_flag, BT_LE_OOB_SET_LEGACY_FLAG_RPC_CMD, + bt_le_oob_set_legacy_flag_rpc_handler, NULL); + + +static void bt_le_oob_set_sc_flag_rpc_handler(const struct nrf_rpc_group *group, + struct nrf_rpc_cbor_ctx *ctx, void *handler_data) +{ + bool enable; + + enable = ser_decode_bool(ctx); + + if (!ser_decoding_done_and_check(group, ctx)) { + goto decoding_error; + } + + bt_le_oob_set_sc_flag(enable); + + ser_rsp_send_void(group); + + return; +decoding_error: + report_decoding_error(BT_LE_OOB_SET_SC_FLAG_RPC_CMD, handler_data); +} + +NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_le_oob_set_sc_flag, BT_LE_OOB_SET_SC_FLAG_RPC_CMD, + bt_le_oob_set_sc_flag_rpc_handler, NULL); + #if !defined(CONFIG_BT_SMP_SC_PAIR_ONLY) static void bt_le_oob_set_legacy_tk_rpc_handler(const struct nrf_rpc_group *group, From cdb5f923f3f26b1380492063113dace5200b4798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Fri, 21 Apr 2023 04:32:49 +0200 Subject: [PATCH 23/47] samples: bluetooth: Adapt to the new oob set flag API. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old API bt_set_oob_data_flag was replaced by 2 new functions: bt_le_oob_set_legacy_flag and bt_le_oob_set_sc_flag. Signed-off-by: Michał Grochala --- samples/bluetooth/central_nfc_pairing/src/main.c | 12 ++++++------ .../bluetooth/peripheral_nfc_pairing/src/main.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/samples/bluetooth/central_nfc_pairing/src/main.c b/samples/bluetooth/central_nfc_pairing/src/main.c index 9a3a93b1499f..33c9ac16e22a 100644 --- a/samples/bluetooth/central_nfc_pairing/src/main.c +++ b/samples/bluetooth/central_nfc_pairing/src/main.c @@ -313,7 +313,8 @@ static void pairing_complete(struct bt_conn *conn, bool bonded) printk("Pairing completed: %s, bonded: %d\n", addr, bonded); k_poll_signal_raise(&pair_signal, 0); - bt_set_oob_data_flag(false); + bt_le_oob_set_sc_flag(false); + bt_le_oob_set_legacy_flag(false); } @@ -326,7 +327,8 @@ static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason) printk("Pairing failed conn: %s, reason %d\n", addr, reason); k_poll_signal_raise(&pair_signal, 0); - bt_set_oob_data_flag(false); + bt_le_oob_set_sc_flag(false); + bt_le_oob_set_legacy_flag(false); } static struct bt_conn_auth_cb conn_auth_callbacks = { @@ -409,16 +411,14 @@ static int oob_le_data_handle(const struct nfc_ndef_record_desc *rec, return -EINVAL; } - if (oob->le_sc_data || oob->tk_value) { - bt_set_oob_data_flag(true); - } - if (oob->le_sc_data) { + bt_le_oob_set_sc_flag(true); oob_remote.le_sc_data = *oob->le_sc_data; bt_addr_le_copy(&oob_remote.addr, oob->addr); } if (oob->tk_value) { + bt_le_oob_set_legacy_flag(true); memcpy(remote_tk_value, oob->tk_value, sizeof(remote_tk_value)); use_remote_tk = request; } diff --git a/samples/bluetooth/peripheral_nfc_pairing/src/main.c b/samples/bluetooth/peripheral_nfc_pairing/src/main.c index 246568f0f198..848b04a0d0f8 100644 --- a/samples/bluetooth/peripheral_nfc_pairing/src/main.c +++ b/samples/bluetooth/peripheral_nfc_pairing/src/main.c @@ -323,7 +323,8 @@ static void pairing_complete(struct bt_conn *conn, bool bonded) printk("Pairing completed: %s, bonded: %d\n", addr, bonded); k_poll_signal_raise(&pair_signal, 0); - bt_set_oob_data_flag(false); + bt_le_oob_set_sc_flag(false); + bt_le_oob_set_legacy_flag(false); } static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason) @@ -335,14 +336,15 @@ static void pairing_failed(struct bt_conn *conn, enum bt_security_err reason) printk("Pairing failed conn: %s, reason %d\n", addr, reason); k_poll_signal_raise(&pair_signal, 0); - bt_set_oob_data_flag(false); + bt_le_oob_set_sc_flag(false); + bt_le_oob_set_legacy_flag(false); } static enum bt_security_err pairing_accept(struct bt_conn *conn, const struct bt_conn_pairing_feat *const feat) { if (feat->oob_data_flag && (!(feat->auth_req & AUTH_SC_FLAG))) { - bt_set_oob_data_flag(true); + bt_le_oob_set_legacy_flag(true); } return BT_SECURITY_ERR_SUCCESS; @@ -529,17 +531,14 @@ static int oob_le_data_handle(const struct nfc_ndef_record_desc *rec, return -EINVAL; } - if (oob->le_sc_data || oob->tk_value) { - bt_set_oob_data_flag(true); - } - if (oob->le_sc_data) { - + bt_le_oob_set_sc_flag(true); oob_remote.le_sc_data = *oob->le_sc_data; bt_addr_le_copy(&oob_remote.addr, oob->addr); } if (oob->tk_value) { + bt_le_oob_set_legacy_flag(true); memcpy(remote_tk_value, oob->tk_value, sizeof(remote_tk_value)); use_remote_tk = request; } From 2fed13bfca5524916f940a9ec9be52441296b754 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Fri, 21 Apr 2023 12:34:00 +0200 Subject: [PATCH 24/47] applications: asset_tracker_v2: fix sensor_trigger This patch makes the sensor_trigger structs static since they are not stored in the driver anymore. Signed-off-by: Maximilian Deubel --- .../src/ext_sensors/ext_sensors.c | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/applications/asset_tracker_v2/src/ext_sensors/ext_sensors.c b/applications/asset_tracker_v2/src/ext_sensors/ext_sensors.c index 6474f6a48f7e..0aa9b7650de8 100644 --- a/applications/asset_tracker_v2/src/ext_sensors/ext_sensors.c +++ b/applications/asset_tracker_v2/src/ext_sensors/ext_sensors.c @@ -81,7 +81,21 @@ static struct env_sensor accel_sensor_lp = { .dev = DEVICE_DT_GET(DT_ALIAS(accelerometer)), }; +static struct sensor_trigger adxl362_sensor_trigger_motion = { + .chan = SENSOR_CHAN_ACCEL_XYZ, + .type = SENSOR_TRIG_MOTION +}; + +static struct sensor_trigger adxl362_sensor_trigger_stationary = { + .chan = SENSOR_CHAN_ACCEL_XYZ, + .type = SENSOR_TRIG_STATIONARY +}; + #if defined(CONFIG_EXTERNAL_SENSORS_IMPACT_DETECTION) +static struct sensor_trigger adxl372_sensor_trigger = { + .chan = SENSOR_CHAN_ACCEL_XYZ, + .type = SENSOR_TRIG_THRESHOLD +}; /** Sensor struct for the high-G accelerometer */ static struct env_sensor accel_sensor_hg = { .channel = SENSOR_CHAN_ACCEL_XYZ, @@ -128,7 +142,7 @@ static void accelerometer_trigger_handler(const struct device *dev, break; default: - LOG_ERR("Unknown trigger"); + LOG_ERR("Unknown trigger: %d", trig->type); } } @@ -221,13 +235,8 @@ int ext_sensors_init(ext_sensor_handler_t handler) evt.type = EXT_SENSOR_EVT_ACCELEROMETER_ERROR; evt_handler(&evt); } else { - struct sensor_trigger trig = { - .chan = SENSOR_CHAN_ACCEL_XYZ, - .type = SENSOR_TRIG_THRESHOLD - }; - int err = sensor_trigger_set(accel_sensor_hg.dev, - &trig, impact_trigger_handler); + &adxl372_sensor_trigger, impact_trigger_handler); if (err) { LOG_ERR("Could not set trigger for device %s, error: %d", accel_sensor_hg.dev->name, err); @@ -436,20 +445,15 @@ int ext_sensors_inactivity_timeout_set(double inact_time) int ext_sensors_accelerometer_trigger_callback_set(bool enable) { int err; - struct sensor_trigger trig = { - .chan = SENSOR_CHAN_ACCEL_XYZ, - .type = SENSOR_TRIG_MOTION - }; struct ext_sensor_evt evt = {0}; sensor_trigger_handler_t handler = enable ? accelerometer_trigger_handler : NULL; - err = sensor_trigger_set(accel_sensor_lp.dev, &trig, handler); + err = sensor_trigger_set(accel_sensor_lp.dev, &adxl362_sensor_trigger_motion, handler); if (err) { goto error; } - trig.type = SENSOR_TRIG_STATIONARY; - err = sensor_trigger_set(accel_sensor_lp.dev, &trig, handler); + err = sensor_trigger_set(accel_sensor_lp.dev, &adxl362_sensor_trigger_stationary, handler); if (err) { goto error; } From 1289f21ac23890a022561577ca66ce564d9bd578 Mon Sep 17 00:00:00 2001 From: Emanuele Di Santo Date: Fri, 21 Apr 2023 10:50:29 +0200 Subject: [PATCH 25/47] lib: nrf_modem: update nrf91 offloaded net device API The API for an offloaded net device has changed from net_if_api to offloaded_if_api, which introduced an `enable` function pointer. Give that the API structure was passed to a macro, no parameter checking guaranteed that the type was correct. Eventually the networking subsystem would call enable(), which being uninitialized resulted in a MPU fault. Signed-off-by: Emanuele Di Santo --- lib/nrf_modem_lib/nrf91_sockets.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/nrf_modem_lib/nrf91_sockets.c b/lib/nrf_modem_lib/nrf91_sockets.c index 004c9873807f..7416e005a67c 100644 --- a/lib/nrf_modem_lib/nrf91_sockets.c +++ b/lib/nrf_modem_lib/nrf91_sockets.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1049,7 +1050,7 @@ NET_SOCKET_REGISTER(nrf91_socket, NRF91_SOCKET_PRIORITY, AF_UNSPEC, /* Create a network interface for nRF91 */ -static int nrf91_nrf_modem_lib_socket_offload_init(const struct device *arg) +static int nrf91_socket_offload_init(const struct device *arg) { ARG_UNUSED(arg); @@ -1065,28 +1066,38 @@ static const struct socket_dns_offload nrf91_socket_dns_offload_ops = { .freeaddrinfo = nrf91_socket_offload_freeaddrinfo, }; -static struct nrf91_socket_iface_data { +static struct nrf91_iface_data { struct net_if *iface; -} nrf91_socket_iface_data; +} nrf91_iface_data; -static void nrf91_socket_iface_init(struct net_if *iface) +static void nrf91_iface_api_init(struct net_if *iface) { - nrf91_socket_iface_data.iface = iface; + nrf91_iface_data.iface = iface; iface->if_dev->socket_offload = nrf91_socket_create; socket_offload_dns_register(&nrf91_socket_dns_offload_ops); } -static struct net_if_api nrf91_if_api = { - .init = nrf91_socket_iface_init, +static int nrf91_iface_enable(const struct net_if *iface, bool enabled) +{ + /* Enables or disable the device (in response to admin state change) */ + ARG_UNUSED(iface); + ARG_UNUSED(enabled); + + return 0; +} + +static struct offloaded_if_api nrf91_iface_offload_api = { + .iface_api.init = nrf91_iface_api_init, + .enable = nrf91_iface_enable, }; /* TODO Get the actual MTU for the nRF91 LTE link. */ NET_DEVICE_OFFLOAD_INIT(nrf91_socket, "nrf91_socket", - nrf91_nrf_modem_lib_socket_offload_init, + nrf91_socket_offload_init, NULL, - &nrf91_socket_iface_data, NULL, - 0, &nrf91_if_api, 1280); + &nrf91_iface_data, NULL, + 0, &nrf91_iface_offload_api, 1280); #endif From 2e1a47bf7a9eb680e82beacd37729c1a312ddc9a Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk Date: Wed, 5 Apr 2023 13:56:25 +0200 Subject: [PATCH 26/47] samples: Removed setting LOG_DEFAULT_LEVEL to error Removed settings the LOG_DEFAULT_LEVEL to error, when NCS_SAMPLE_DEFAULTS config is enabled. It is related to the change in Zephyr that started to use LOG_DEFAULT_LEVEL for setting the default log level of every created log module. The impact was that log level for multiple applications changed from INF to ERR and CI tests failed. Additionally aligned the configuration of applications that CI tests were affected by this change. Signed-off-by: Kamil Kasperczyk Co-authored-by: Marek Pieta --- applications/nrf_desktop/Kconfig.debug | 6 ------ .../nrf52833dk_nrf52833/child_image/mcuboot/prj.conf | 1 - .../child_image/mcuboot/prj.conf | 1 - .../child_image/mcuboot/prj_mcuboot_qspi.conf | 1 - .../child_image/mcuboot/prj_mcuboot_smp.conf | 1 - samples/Kconfig | 11 ----------- samples/app_event_manager/prj.conf | 1 - 7 files changed, 22 deletions(-) diff --git a/applications/nrf_desktop/Kconfig.debug b/applications/nrf_desktop/Kconfig.debug index 934aa9f92ae2..9a960edaca8a 100644 --- a/applications/nrf_desktop/Kconfig.debug +++ b/applications/nrf_desktop/Kconfig.debug @@ -30,12 +30,6 @@ choice LOG_MODE endchoice -config LOG_DEFAULT_LEVEL - default 2 - help - nRF Desktop Logging configuration sets the Warning level as a default - logging level for modules that do not specify their own logging level. - config LOG_MODE_OVERFLOW default y help diff --git a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/child_image/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/child_image/mcuboot/prj.conf index eea906cbec1e..f0dd2b0f693d 100644 --- a/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/child_image/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52833dk_nrf52833/child_image/mcuboot/prj.conf @@ -58,7 +58,6 @@ CONFIG_USE_SEGGER_RTT=y CONFIG_LOG_BACKEND_UART=n CONFIG_UART_CONSOLE=n CONFIG_LOG=y -CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_MAX_LEVEL=3 CONFIG_LOG_PRINTK=y CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/child_image/mcuboot/prj.conf b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/child_image/mcuboot/prj.conf index eea906cbec1e..f0dd2b0f693d 100644 --- a/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/child_image/mcuboot/prj.conf +++ b/applications/nrf_desktop/configuration/nrf52833dongle_nrf52833/child_image/mcuboot/prj.conf @@ -58,7 +58,6 @@ CONFIG_USE_SEGGER_RTT=y CONFIG_LOG_BACKEND_UART=n CONFIG_UART_CONSOLE=n CONFIG_LOG=y -CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_MAX_LEVEL=3 CONFIG_LOG_PRINTK=y CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_qspi.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_qspi.conf index 95b6336e6b65..7b7d279c1264 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_qspi.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_qspi.conf @@ -34,7 +34,6 @@ CONFIG_BOOT_MAX_IMG_SECTORS=2048 # Logger CONFIG_USE_SEGGER_RTT=y CONFIG_LOG=y -CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_MAX_LEVEL=2 CONFIG_LOG_PRINTK=y CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_smp.conf b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_smp.conf index f4586f94e00e..12b95e9b70d1 100644 --- a/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_smp.conf +++ b/applications/nrf_desktop/configuration/nrf52840dk_nrf52840/child_image/mcuboot/prj_mcuboot_smp.conf @@ -30,7 +30,6 @@ CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y # Logger CONFIG_USE_SEGGER_RTT=y CONFIG_LOG=y -CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_MAX_LEVEL=3 CONFIG_LOG_PRINTK=y CONFIG_LOG_MODE_IMMEDIATE=y diff --git a/samples/Kconfig b/samples/Kconfig index c917de7bd97d..a45c5fe11a60 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -114,17 +114,6 @@ config NCS_SAMPLE_PROVISIONING_NET_CORE_CHILD_IMAGE endif # SOC_SERIES_NRF53X -if LOG - -# LOG_DEFAULT_LEVEL is declared in Zephyr, -# we declare it here for a second time, to set a different default. -# Omit the `prompt` to prevent it from appearing twice in two diffent places. - -config LOG_DEFAULT_LEVEL - default 1 if NCS_SAMPLES_DEFAULTS - -endif # LOG - menu "Image build variants" # These are set by CMake, and they need a prompt. diff --git a/samples/app_event_manager/prj.conf b/samples/app_event_manager/prj.conf index 943af9dfa44d..18532c366941 100644 --- a/samples/app_event_manager/prj.conf +++ b/samples/app_event_manager/prj.conf @@ -8,7 +8,6 @@ CONFIG_ASSERT=y # Logger configuration CONFIG_LOG=y -CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_BACKEND_UART=y # Configuration required by Application Event Manager From 0533672c7a1b5fdb2caa98decea51ae6858ade6b Mon Sep 17 00:00:00 2001 From: Bernard Lee Date: Thu, 20 Apr 2023 18:47:19 +0800 Subject: [PATCH 27/47] gazell: Check that a timer node is not enabled in devicetree Gazell does not use a TIMER instance that is enabled in devicetree. It adheres to the changed timer resource protection semantics. Signed-off-by: Bernard Lee --- subsys/gazell/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/gazell/Kconfig b/subsys/gazell/Kconfig index 08bc9d4762d6..a7951c491a28 100644 --- a/subsys/gazell/Kconfig +++ b/subsys/gazell/Kconfig @@ -109,23 +109,23 @@ choice GAZELL_TIMER config GAZELL_TIMER0 bool "TIMER0" - depends on HAS_HW_NRF_TIMER0 + depends on !$(dt_nodelabel_enabled,timer0) config GAZELL_TIMER1 bool "TIMER1" - depends on HAS_HW_NRF_TIMER1 + depends on !$(dt_nodelabel_enabled,timer1) config GAZELL_TIMER2 bool "TIMER2" - depends on HAS_HW_NRF_TIMER2 + depends on !$(dt_nodelabel_enabled,timer2) config GAZELL_TIMER3 bool "TIMER3" - depends on HAS_HW_NRF_TIMER3 + depends on !$(dt_nodelabel_enabled,timer3) config GAZELL_TIMER4 bool "TIMER4" - depends on HAS_HW_NRF_TIMER4 + depends on !$(dt_nodelabel_enabled,timer4) endchoice From 99d46b95c66ac6661d304144ef39b49d7526215b Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 24 Mar 2023 06:21:09 +0100 Subject: [PATCH 28/47] boards: arm: Cleanup after counter driver update After moving counter driver configuration to the devicetree timer nodes shall not be enabled if not used. Cleaning up board dts files. Signed-off-by: Krzysztof Chruscinski --- .../arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts | 12 ------------ .../nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts | 12 ------------ .../arm/thingy91_nrf9160/thingy91_nrf9160_common.dts | 12 ------------ 3 files changed, 36 deletions(-) diff --git a/boards/arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts b/boards/arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts index c9d916c34062..12865f16c8a6 100644 --- a/boards/arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts +++ b/boards/arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts @@ -203,18 +203,6 @@ arduino_i2c: &i2c1 { }; }; -&timer0 { - status = "okay"; -}; - -&timer1 { - status = "okay"; -}; - -&timer2 { - status = "okay"; -}; - arduino_serial: &uart1 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; diff --git a/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts b/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts index 91f0e41eeb72..5c8947b0c920 100644 --- a/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts +++ b/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts @@ -138,18 +138,6 @@ arduino_spi: &spi0 { pinctrl-names = "default", "sleep"; }; -&timer0 { - status = "okay"; -}; - -&timer1 { - status = "okay"; -}; - -&timer2 { - status = "okay"; -}; - &flash1 { partitions { diff --git a/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts b/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts index ecff87aed4e7..e84476ae8be9 100644 --- a/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts +++ b/boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts @@ -168,18 +168,6 @@ }; }; -&timer0 { - status = "okay"; -}; - -&timer1 { - status = "okay"; -}; - -&timer2 { - status = "okay"; -}; - &uart0 { compatible = "nordic,nrf-uarte"; current-speed = <115200>; From 2fc71663e59dccafd0240581d08918bc08a438c1 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 23 Mar 2023 08:23:51 +0100 Subject: [PATCH 29/47] gazell: Adapt to changes in counter Align to changes in counter driver configuration (from Kconfig to devicetree). Signed-off-by: Krzysztof Chruscinski --- subsys/gazell/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/gazell/Kconfig b/subsys/gazell/Kconfig index a7951c491a28..d3f2f5eba446 100644 --- a/subsys/gazell/Kconfig +++ b/subsys/gazell/Kconfig @@ -109,23 +109,23 @@ choice GAZELL_TIMER config GAZELL_TIMER0 bool "TIMER0" - depends on !$(dt_nodelabel_enabled,timer0) + depends on $(dt_nodelabel_has_compat,timer0,$(DT_COMPAT_NORDIC_NRF_TIMER)) config GAZELL_TIMER1 bool "TIMER1" - depends on !$(dt_nodelabel_enabled,timer1) + depends on $(dt_nodelabel_has_compat,timer1,$(DT_COMPAT_NORDIC_NRF_TIMER)) config GAZELL_TIMER2 bool "TIMER2" - depends on !$(dt_nodelabel_enabled,timer2) + depends on $(dt_nodelabel_has_compat,timer2,$(DT_COMPAT_NORDIC_NRF_TIMER)) config GAZELL_TIMER3 bool "TIMER3" - depends on !$(dt_nodelabel_enabled,timer3) + depends on $(dt_nodelabel_has_compat,timer3,$(DT_COMPAT_NORDIC_NRF_TIMER)) config GAZELL_TIMER4 bool "TIMER4" - depends on !$(dt_nodelabel_enabled,timer4) + depends on $(dt_nodelabel_has_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) endchoice From fab0e584bd0b9151241e3cc010bde907ebf9bd49 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:15:13 +0100 Subject: [PATCH 30/47] zigbee: osif: Remove use of CONFIG_COUNTER_TIMER2 Kconfig option was removed and it must be replaced with device tree node status check. Signed-off-by: Krzysztof Chruscinski --- subsys/zigbee/Kconfig | 7 +++++-- subsys/zigbee/osif/zb_nrf_pwr_mgmt.c | 6 +++--- subsys/zigbee/osif/zb_nrf_timer_counter.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/subsys/zigbee/Kconfig b/subsys/zigbee/Kconfig index 9642d36c0068..11f2dee79a8e 100644 --- a/subsys/zigbee/Kconfig +++ b/subsys/zigbee/Kconfig @@ -360,15 +360,18 @@ config ZIGBEE_TC_REJOIN_ENABLED bool "Enables Trust Center Rejoin" default y +DT_CHOSEN_NCS_ZIGBEE_TIMER := ncs,zigbee-timer + choice prompt "ZBOSS time source" - default ZIGBEE_TIME_COUNTER if ZIGBEE_LIBRARY_PRODUCTION + default ZIGBEE_TIME_COUNTER if ZIGBEE_LIBRARY_PRODUCTION && \ + $(dt_chosen_enabled,$(DT_CHOSEN_NCS_ZIGBEE_TIMER)) default ZIGBEE_TIME_KTIMER if ZIGBEE_LIBRARY_DEVELOPMENT config ZIGBEE_TIME_COUNTER bool "Dedicated timer-based counter" + depends on $(dt_chosen_enabled,$(DT_CHOSEN_NCS_ZIGBEE_TIMER)) imply COUNTER - imply COUNTER_TIMER2 config ZIGBEE_TIME_KTIMER bool "Kernel (system) time" diff --git a/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c b/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c index f1a24082b059..79dd038d1c5e 100644 --- a/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c +++ b/subsys/zigbee/osif/zb_nrf_pwr_mgmt.c @@ -24,10 +24,10 @@ void zb_timer_enable_stop(void); */ void zb_osif_sleep_init(void) { -#ifdef CONFIG_COUNTER_TIMER2 /* Disable timer in inactivity periods on all device types. */ - zb_timer_enable_stop(); -#endif /* CONFIG_COUNTER_TIMER2 */ + if (IS_ENABLED(CONFIG_ZIGBEE_TIME_COUNTER)) { + zb_timer_enable_stop(); + } } /**@brief Function which tries to put the MMCU into sleep mode, diff --git a/subsys/zigbee/osif/zb_nrf_timer_counter.c b/subsys/zigbee/osif/zb_nrf_timer_counter.c index 10c398c22608..59ee957b20c1 100644 --- a/subsys/zigbee/osif/zb_nrf_timer_counter.c +++ b/subsys/zigbee/osif/zb_nrf_timer_counter.c @@ -27,7 +27,7 @@ typedef struct { } zb_timer_t; static zb_timer_t zb_timer = { - .device = DEVICE_DT_GET(DT_NODELABEL(timer2)), + .device = DEVICE_DT_GET(DT_CHOSEN(ncs_zigbee_timer)), .is_init = ZB_FALSE, .is_running = ATOMIC_INIT(0) }; From 3d7eb823413f48ceaa627a08f6f47fae265353a5 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 24 Mar 2023 06:21:57 +0100 Subject: [PATCH 31/47] applications: zigbee_weather_station: Align to zephyr changes Align application to change in counter driver configuration. Signed-off-by: Krzysztof Chruscinski --- .../configuration/thingy53_nrf5340_cpuapp/app.overlay | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/applications/zigbee_weather_station/configuration/thingy53_nrf5340_cpuapp/app.overlay b/applications/zigbee_weather_station/configuration/thingy53_nrf5340_cpuapp/app.overlay index 047a3c6cd30a..6c05cef6236a 100644 --- a/applications/zigbee_weather_station/configuration/thingy53_nrf5340_cpuapp/app.overlay +++ b/applications/zigbee_weather_station/configuration/thingy53_nrf5340_cpuapp/app.overlay @@ -4,6 +4,12 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + &i2c1 { status = "okay"; @@ -14,6 +20,10 @@ }; }; +&timer2 { + status = "okay"; +}; + /* Disable unused peripherals to reduce power consumption */ &pwm0 { status = "disabled"; From 8b2ea197aa9c1105590ce2cad6dd05cd826775a2 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:18:17 +0100 Subject: [PATCH 32/47] samples: zigbee: light_switch: Add overlays enabling counter Counter is now controlled by the device tree and it must be enabled in the sample. Signed-off-by: Krzysztof Chruscinski --- .../boards/nrf21540dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 +++++ 4 files changed, 47 insertions(+) create mode 100644 samples/zigbee/light_switch/boards/nrf21540dk_nrf52840.overlay create mode 100644 samples/zigbee/light_switch/boards/nrf52833dk_nrf52833.overlay create mode 100644 samples/zigbee/light_switch/boards/nrf52840dk_nrf52840.overlay diff --git a/samples/zigbee/light_switch/boards/nrf21540dk_nrf52840.overlay b/samples/zigbee/light_switch/boards/nrf21540dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/light_switch/boards/nrf21540dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_switch/boards/nrf52833dk_nrf52833.overlay b/samples/zigbee/light_switch/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/light_switch/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_switch/boards/nrf52840dk_nrf52840.overlay b/samples/zigbee/light_switch/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/light_switch/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/zigbee/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay index c670799bcdb0..916e83847edb 100644 --- a/samples/zigbee/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/zigbee/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -7,5 +7,10 @@ / { chosen { nordic,pm-ext-flash = &mx25r64; + ncs,zigbee-timer = &timer2; }; }; + +&timer2 { + status = "okay"; +}; From aa8babb686fdbcdd79e56d430bae80831cc27e6e Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:20:17 +0100 Subject: [PATCH 33/47] samples: zigbee: light_bulb: Add overlays enabling counter Counter is now controlled by the device tree and it must be enabled in the sample. Signed-off-by: Krzysztof Chruscinski --- .../zigbee/light_bulb/boards/nrf21540dk_nrf52840.overlay | 8 ++++++++ .../zigbee/light_bulb/boards/nrf52833dk_nrf52833.overlay | 8 ++++++++ .../zigbee/light_bulb/boards/nrf52840dk_nrf52840.overlay | 8 ++++++++ .../light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/samples/zigbee/light_bulb/boards/nrf21540dk_nrf52840.overlay b/samples/zigbee/light_bulb/boards/nrf21540dk_nrf52840.overlay index e27bee37f2de..8c9d4ef533eb 100644 --- a/samples/zigbee/light_bulb/boards/nrf21540dk_nrf52840.overlay +++ b/samples/zigbee/light_bulb/boards/nrf21540dk_nrf52840.overlay @@ -10,6 +10,10 @@ pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; + + chosen { + ncs,zigbee-timer = &timer2; + }; }; &pwm0 { @@ -34,3 +38,7 @@ }; }; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_bulb/boards/nrf52833dk_nrf52833.overlay b/samples/zigbee/light_bulb/boards/nrf52833dk_nrf52833.overlay index c4e45e257079..79bc0f3ca58e 100644 --- a/samples/zigbee/light_bulb/boards/nrf52833dk_nrf52833.overlay +++ b/samples/zigbee/light_bulb/boards/nrf52833dk_nrf52833.overlay @@ -10,6 +10,10 @@ pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; + + chosen { + ncs,zigbee-timer = &timer2; + }; }; &pwm0 { @@ -34,3 +38,7 @@ }; }; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_bulb/boards/nrf52840dk_nrf52840.overlay b/samples/zigbee/light_bulb/boards/nrf52840dk_nrf52840.overlay index c4e45e257079..79bc0f3ca58e 100644 --- a/samples/zigbee/light_bulb/boards/nrf52840dk_nrf52840.overlay +++ b/samples/zigbee/light_bulb/boards/nrf52840dk_nrf52840.overlay @@ -10,6 +10,10 @@ pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; + + chosen { + ncs,zigbee-timer = &timer2; + }; }; &pwm0 { @@ -34,3 +38,7 @@ }; }; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/zigbee/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay index 75b7c4ce7d1b..a6f50f3307ac 100644 --- a/samples/zigbee/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/zigbee/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -11,6 +11,10 @@ pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>; }; }; + + chosen { + ncs,zigbee-timer = &timer2; + }; }; &pwm0 { @@ -35,3 +39,7 @@ }; }; + +&timer2 { + status = "okay"; +}; From 1493b11511d319c520428b22f506b11e18284268 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 14:57:13 +0100 Subject: [PATCH 34/47] samples: zigbee: shell: Add overlays enabling counter Counter is now controlled by the device tree and it must be enabled in the sample. Signed-off-by: Krzysztof Chruscinski Signed-off-by: Sebastian Draus --- .../shell/boards/nrf21540dk_nrf52840.overlay | 14 ++++++ .../shell/boards/nrf52833dk_nrf52833.overlay | 14 ++++++ .../shell/boards/nrf52840dk_nrf52840.overlay | 14 ++++++ .../boards/nrf52840dongle_nrf52840.overlay | 14 ++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++ samples/zigbee/shell/sample.yaml | 45 ++++++++++++++++--- 6 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 samples/zigbee/shell/boards/nrf21540dk_nrf52840.overlay create mode 100644 samples/zigbee/shell/boards/nrf52833dk_nrf52833.overlay create mode 100644 samples/zigbee/shell/boards/nrf52840dk_nrf52840.overlay create mode 100644 samples/zigbee/shell/boards/nrf52840dongle_nrf52840.overlay create mode 100644 samples/zigbee/shell/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/samples/zigbee/shell/boards/nrf21540dk_nrf52840.overlay b/samples/zigbee/shell/boards/nrf21540dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/shell/boards/nrf21540dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/shell/boards/nrf52833dk_nrf52833.overlay b/samples/zigbee/shell/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/shell/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/shell/boards/nrf52840dk_nrf52840.overlay b/samples/zigbee/shell/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/shell/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/shell/boards/nrf52840dongle_nrf52840.overlay b/samples/zigbee/shell/boards/nrf52840dongle_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/shell/boards/nrf52840dongle_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/shell/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/zigbee/shell/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/shell/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/shell/sample.yaml b/samples/zigbee/shell/sample.yaml index 46de9d8cc411..5670e1f835f2 100644 --- a/samples/zigbee/shell/sample.yaml +++ b/samples/zigbee/shell/sample.yaml @@ -12,15 +12,48 @@ tests: platform_allow: nrf52840dk_nrf52840 nrf52833dk_nrf52833 nrf5340dk_nrf5340_cpuapp nrf21540dk_nrf52840 tags: ci_build shell - sample.zigbee.shell.usb: + sample.zigbee.shell.usb.nrf52840dk_nrf52840: build_only: true - extra_args: CONF_FILE=prj_usb.conf + extra_args: + CONF_FILE=prj_usb.conf + DTC_OVERLAY_FILE="app_usb.overlay;boards/nrf52840dk_nrf52840.overlay" integration_platforms: - nrf52840dk_nrf52840 - - nrf52833dk_nrf52833 - - nrf5340dk_nrf5340_cpuapp + platform_allow: nrf52840dk_nrf52840 + tags: ci_build shell + sample.zigbee.shell.usb.nrf21540dk_nrf52840: + build_only: true + extra_args: + CONF_FILE=prj_usb.conf + DTC_OVERLAY_FILE="app_usb.overlay;boards/nrf21540dk_nrf52840.overlay" + integration_platforms: - nrf21540dk_nrf52840 + platform_allow: nrf21540dk_nrf52840 + tags: ci_build shell + sample.zigbee.shell.usb.nrf52833dk_nrf52833: + build_only: true + extra_args: + CONF_FILE=prj_usb.conf + DTC_OVERLAY_FILE="app_usb.overlay;boards/nrf52833dk_nrf52833.overlay" + integration_platforms: + - nrf52833dk_nrf52833 + platform_allow: nrf52833dk_nrf52833 + tags: ci_build shell + sample.zigbee.shell.usb.nrf52840dongle_nrf52840: + build_only: true + extra_args: + CONF_FILE=prj_usb.conf + DTC_OVERLAY_FILE="app_usb.overlay;boards/nrf52840dongle_nrf52840.overlay" + integration_platforms: - nrf52840dongle_nrf52840 - platform_allow: nrf52840dk_nrf52840 nrf52833dk_nrf52833 nrf5340dk_nrf5340_cpuapp - nrf21540dk_nrf52840 nrf52840dongle_nrf52840 + platform_allow: nrf52840dongle_nrf52840 + tags: ci_build shell + sample.zigbee.shell.usb.nrf5340dk_nrf5340_cpuapp: + build_only: true + extra_args: + CONF_FILE=prj_usb.conf + DTC_OVERLAY_FILE="app_usb.overlay;boards/nrf5340dk_nrf5340_cpuapp.overlay" + integration_platforms: + - nrf5340dk_nrf5340_cpuapp + platform_allow: nrf5340dk_nrf5340_cpuapp tags: ci_build shell From 6db3d037be0cfe534427ca939250a402b93fa6e7 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:21:48 +0100 Subject: [PATCH 35/47] samples: zigbee: template: Add overlays enabling counter Counter is now controlled by the device tree and it must be enabled in the sample. Signed-off-by: Krzysztof Chruscinski --- .../template/boards/nrf21540dk_nrf52840.overlay | 14 ++++++++++++++ .../template/boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../template/boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 samples/zigbee/template/boards/nrf21540dk_nrf52840.overlay create mode 100644 samples/zigbee/template/boards/nrf52833dk_nrf52833.overlay create mode 100644 samples/zigbee/template/boards/nrf52840dk_nrf52840.overlay create mode 100644 samples/zigbee/template/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/samples/zigbee/template/boards/nrf21540dk_nrf52840.overlay b/samples/zigbee/template/boards/nrf21540dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/template/boards/nrf21540dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/template/boards/nrf52833dk_nrf52833.overlay b/samples/zigbee/template/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/template/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/template/boards/nrf52840dk_nrf52840.overlay b/samples/zigbee/template/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/template/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/template/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/zigbee/template/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/template/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; From 7a373ad84180f810159660d707fb09c65d307e46 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 24 Mar 2023 06:23:28 +0100 Subject: [PATCH 36/47] samples: zigbee: network_coorindator: Align to zephyr changes Align sample to change in counter driver configuration. Signed-off-by: Krzysztof Chruscinski --- .../boards/nrf21540dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 15 +++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 samples/zigbee/network_coordinator/boards/nrf21540dk_nrf52840.overlay create mode 100644 samples/zigbee/network_coordinator/boards/nrf52833dk_nrf52833.overlay create mode 100644 samples/zigbee/network_coordinator/boards/nrf52840dk_nrf52840.overlay create mode 100644 samples/zigbee/network_coordinator/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/samples/zigbee/network_coordinator/boards/nrf21540dk_nrf52840.overlay b/samples/zigbee/network_coordinator/boards/nrf21540dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/network_coordinator/boards/nrf21540dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/network_coordinator/boards/nrf52833dk_nrf52833.overlay b/samples/zigbee/network_coordinator/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/network_coordinator/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/network_coordinator/boards/nrf52840dk_nrf52840.overlay b/samples/zigbee/network_coordinator/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/samples/zigbee/network_coordinator/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/samples/zigbee/network_coordinator/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/zigbee/network_coordinator/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..450d810bd387 --- /dev/null +++ b/samples/zigbee/network_coordinator/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2022 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ + + / { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; From a8c41ea79f6fe890f856d4dc47021e9282946f52 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 13:15:21 +0100 Subject: [PATCH 37/47] tests: zigbee: osif: timer_counter: Align to zephyr changes Align test to changes in the counter driver (transition to DT configuration. Signed-off-by: Krzysztof Chruscinski --- .../boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++++++++ tests/subsys/zigbee/osif/timer_counter/prj.conf | 1 - 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/subsys/zigbee/osif/timer_counter/boards/nrf52833dk_nrf52833.overlay create mode 100644 tests/subsys/zigbee/osif/timer_counter/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/subsys/zigbee/osif/timer_counter/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/subsys/zigbee/osif/timer_counter/boards/nrf52833dk_nrf52833.overlay b/tests/subsys/zigbee/osif/timer_counter/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/timer_counter/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/osif/timer_counter/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/zigbee/osif/timer_counter/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/timer_counter/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/osif/timer_counter/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/zigbee/osif/timer_counter/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/timer_counter/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/osif/timer_counter/prj.conf b/tests/subsys/zigbee/osif/timer_counter/prj.conf index 430aa95c954f..cd4d9df011d8 100644 --- a/tests/subsys/zigbee/osif/timer_counter/prj.conf +++ b/tests/subsys/zigbee/osif/timer_counter/prj.conf @@ -6,4 +6,3 @@ CONFIG_ZTEST=y CONFIG_COUNTER=y -CONFIG_COUNTER_TIMER2=y From ddb69c3dbc5bbb45186ba3bff4797905a1ae261c Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 23 Mar 2023 21:38:37 +0100 Subject: [PATCH 38/47] tests: zigbee: osif: nvram: Align to zephyr changes Align to configuration counter change (Kconfig to devicetree). Signed-off-by: Krzysztof Chruscinski --- .../osif/nvram/boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../osif/nvram/boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../nvram/boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/subsys/zigbee/osif/nvram/boards/nrf52833dk_nrf52833.overlay create mode 100644 tests/subsys/zigbee/osif/nvram/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/subsys/zigbee/osif/nvram/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/subsys/zigbee/osif/nvram/boards/nrf52833dk_nrf52833.overlay b/tests/subsys/zigbee/osif/nvram/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/nvram/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/osif/nvram/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/zigbee/osif/nvram/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/nvram/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/osif/nvram/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/zigbee/osif/nvram/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/osif/nvram/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; From c62f86be0a0a5c88972ae5c9f500da3f68c02298 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 24 Mar 2023 06:22:18 +0100 Subject: [PATCH 39/47] tests: zigbee: zboss_api: alarm_api: Align to zephyr changes Align test to change in counter driver configuration. Signed-off-by: Krzysztof Chruscinski --- .../alarm_api/boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../alarm_api/boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52833dk_nrf52833.overlay create mode 100644 tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52833dk_nrf52833.overlay b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/alarm_api/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; From de6c0078040f8f515062ee5ff8f12ef85405bd2c Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Fri, 24 Mar 2023 06:22:54 +0100 Subject: [PATCH 40/47] tests: zigbee: zboss_api: callback_api: Align to zephyr changes Align test to change in counter driver configuration. Signed-off-by: Krzysztof Chruscinski --- .../boards/nrf52833dk_nrf52833.overlay | 14 ++++++++++++++ .../boards/nrf52840dk_nrf52840.overlay | 14 ++++++++++++++ .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52833dk_nrf52833.overlay create mode 100644 tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52840dk_nrf52840.overlay create mode 100644 tests/subsys/zigbee/zboss_api/callback_api/boards/nrf5340dk_nrf5340_cpuapp.overlay diff --git a/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52833dk_nrf52833.overlay b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52833dk_nrf52833.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52833dk_nrf52833.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52840dk_nrf52840.overlay b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; diff --git a/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf5340dk_nrf5340_cpuapp.overlay new file mode 100644 index 000000000000..62b6a462f7d1 --- /dev/null +++ b/tests/subsys/zigbee/zboss_api/callback_api/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + */ +/ { + chosen { + ncs,zigbee-timer = &timer2; + }; +}; + +&timer2 { + status = "okay"; +}; From 58f829c54eaf9b4492f7b80cd412b6bcdaf2c62e Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:30:06 +0100 Subject: [PATCH 41/47] tests: drivers: lpuart: Align to counter changes Align to change in counter configuration (from Kconfig to devicetree). Signed-off-by: Krzysztof Chruscinski --- tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf index ebac3cb7f381..687809f706b0 100644 --- a/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf +++ b/tests/drivers/lpuart/boards/nrf9160dk_nrf52840.conf @@ -5,6 +5,5 @@ CONFIG_UART_1_NRF_ASYNC_LOW_POWER=y CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2 CONFIG_NRF_SW_LPUART=y -CONFIG_NRFX_TIMER3=y CONFIG_COUNTER=y CONFIG_ENTROPY_CC3XX=y From 0d8fc85d8743cc222848754cb5a67a9f7f57c3ec Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Wed, 22 Mar 2023 15:51:18 +0100 Subject: [PATCH 42/47] samples: peripheral: lpuart: Adapt to counter changes Adapt sample to changes in counter driver configuration which is now done through the devicetree. Signed-off-by: Krzysztof Chruscinski --- samples/debug/ppi_trace/Kconfig | 12 ------------ .../lpuart/boards/nrf21540dk_nrf52840.overlay | 4 ++++ .../lpuart/boards/nrf52833dk_nrf52833.overlay | 4 ++++ .../lpuart/boards/nrf52840dk_nrf52840.overlay | 4 ++++ .../lpuart/boards/nrf52dk_nrf52832.overlay | 4 ++++ .../lpuart/boards/nrf5340dk_nrf5340_cpuapp.overlay | 4 ++++ .../lpuart/boards/nrf9160dk_nrf9160_ns.overlay | 4 ++++ 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/samples/debug/ppi_trace/Kconfig b/samples/debug/ppi_trace/Kconfig index e6ec1f0ae051..340d3fd543f2 100644 --- a/samples/debug/ppi_trace/Kconfig +++ b/samples/debug/ppi_trace/Kconfig @@ -49,18 +49,6 @@ config PPI_TRACE_PIN_RADIO_ACTIVE endif # USE_BLUETOOTH_RADIO_EVENTS -config USE_RTC2 - bool - default y - depends on HAS_HW_NRF_RTC2 - select COUNTER_RTC2 - -config USE_RTC0 - bool - default y - depends on !HAS_HW_NRF_RTC2 - select COUNTER_RTC0 - endmenu source "Kconfig.zephyr" diff --git a/samples/peripheral/lpuart/boards/nrf21540dk_nrf52840.overlay b/samples/peripheral/lpuart/boards/nrf21540dk_nrf52840.overlay index 49698afc8a84..e7f2d1fb7b8f 100644 --- a/samples/peripheral/lpuart/boards/nrf21540dk_nrf52840.overlay +++ b/samples/peripheral/lpuart/boards/nrf21540dk_nrf52840.overlay @@ -37,3 +37,7 @@ }; }; }; + +&rtc2 { + status = "okay"; +}; diff --git a/samples/peripheral/lpuart/boards/nrf52833dk_nrf52833.overlay b/samples/peripheral/lpuart/boards/nrf52833dk_nrf52833.overlay index dc510cf2c5eb..b9b36fe0a67b 100644 --- a/samples/peripheral/lpuart/boards/nrf52833dk_nrf52833.overlay +++ b/samples/peripheral/lpuart/boards/nrf52833dk_nrf52833.overlay @@ -37,3 +37,7 @@ }; }; }; + +&rtc2 { + status = "okay"; +}; diff --git a/samples/peripheral/lpuart/boards/nrf52840dk_nrf52840.overlay b/samples/peripheral/lpuart/boards/nrf52840dk_nrf52840.overlay index df799d163f6d..b4200293ce94 100644 --- a/samples/peripheral/lpuart/boards/nrf52840dk_nrf52840.overlay +++ b/samples/peripheral/lpuart/boards/nrf52840dk_nrf52840.overlay @@ -37,3 +37,7 @@ }; }; }; + +&rtc2 { + status = "okay"; +}; diff --git a/samples/peripheral/lpuart/boards/nrf52dk_nrf52832.overlay b/samples/peripheral/lpuart/boards/nrf52dk_nrf52832.overlay index 9a2dbdef38b9..4d1aabdf5ebb 100644 --- a/samples/peripheral/lpuart/boards/nrf52dk_nrf52832.overlay +++ b/samples/peripheral/lpuart/boards/nrf52dk_nrf52832.overlay @@ -35,3 +35,7 @@ }; }; + +&rtc2 { + status = "okay"; +}; diff --git a/samples/peripheral/lpuart/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/peripheral/lpuart/boards/nrf5340dk_nrf5340_cpuapp.overlay index a24596038df5..b8d1e2faf309 100644 --- a/samples/peripheral/lpuart/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/peripheral/lpuart/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -55,3 +55,7 @@ }; }; }; + +&rtc0 { + status = "okay"; +}; diff --git a/samples/peripheral/lpuart/boards/nrf9160dk_nrf9160_ns.overlay b/samples/peripheral/lpuart/boards/nrf9160dk_nrf9160_ns.overlay index 12b9722d1bc6..62a79415985c 100644 --- a/samples/peripheral/lpuart/boards/nrf9160dk_nrf9160_ns.overlay +++ b/samples/peripheral/lpuart/boards/nrf9160dk_nrf9160_ns.overlay @@ -38,3 +38,7 @@ }; }; }; + +&rtc0 { + status = "okay"; +}; From 2891ba86536e4152fa6d9b8a5dd32b450667a212 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Mon, 24 Apr 2023 14:11:14 +0200 Subject: [PATCH 43/47] debug: cpu_load: Align timer configuration to upstream changes Counter configuration is moved fully to DT and HAS_HW_NRF_TIMERx cannot longer be used to determine if given TIMER instance is present. Switching to check if not has timer compat. Signed-off-by: Krzysztof Chruscinski --- subsys/debug/cpu_load/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/debug/cpu_load/Kconfig b/subsys/debug/cpu_load/Kconfig index cb4850999d27..9b6250be6b0a 100644 --- a/subsys/debug/cpu_load/Kconfig +++ b/subsys/debug/cpu_load/Kconfig @@ -67,23 +67,23 @@ choice default CPU_LOAD_TIMER_2 config CPU_LOAD_TIMER_0 - depends on HAS_HW_NRF_TIMER0 + depends on $(dt_nodelabel_has_compat,timer0,$(DT_COMPAT_NORDIC_NRF_TIMER)) bool "Timer 0" select NRFX_TIMER0 config CPU_LOAD_TIMER_1 - depends on HAS_HW_NRF_TIMER1 + depends on $(dt_nodelabel_has_compat,timer1,$(DT_COMPAT_NORDIC_NRF_TIMER)) bool "Timer 1" select NRFX_TIMER1 config CPU_LOAD_TIMER_2 - depends on HAS_HW_NRF_TIMER2 + depends on $(dt_nodelabel_has_compat,timer2,$(DT_COMPAT_NORDIC_NRF_TIMER)) bool "Timer 2" select NRFX_TIMER2 config CPU_LOAD_TIMER_3 - depends on HAS_HW_NRF_TIMER3 + depends on $(dt_nodelabel_has_compat,timer3,$(DT_COMPAT_NORDIC_NRF_TIMER)) bool "Timer 3" select NRFX_TIMER3 config CPU_LOAD_TIMER_4 - depends on HAS_HW_NRF_TIMER4 + depends on $(dt_nodelabel_has_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) bool "Timer 4" select NRFX_TIMER4 From aeccaeb67ce4e01cf4d17bf6db3a21ee20bccfe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Tue, 25 Apr 2023 04:28:06 +0200 Subject: [PATCH 44/47] esb: Adapt to the changes in counter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapt to the changes in counter - use device tree instead of Kconfig for Timer instances. Signed-off-by: Michał Grochala --- subsys/esb/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/esb/Kconfig b/subsys/esb/Kconfig index 8918a5845011..9edbebdc2243 100644 --- a/subsys/esb/Kconfig +++ b/subsys/esb/Kconfig @@ -65,27 +65,27 @@ choice ESB_SYS_TIMER config ESB_SYS_TIMER0 bool "TIMER0" - depends on HAS_HW_NRF_TIMER0 + depends on $(dt_nodelabel_has_compat,timer0,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER0 config ESB_SYS_TIMER1 bool "TIMER1" - depends on HAS_HW_NRF_TIMER1 + depends on $(dt_nodelabel_has_compat,timer1,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER1 config ESB_SYS_TIMER2 bool "TIMER2" - depends on HAS_HW_NRF_TIMER2 + depends on $(dt_nodelabel_has_compat,timer2,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER2 config ESB_SYS_TIMER3 bool "TIMER3" - depends on HAS_HW_NRF_TIMER3 + depends on $(dt_nodelabel_has_compat,timer3,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER3 config ESB_SYS_TIMER4 bool "TIMER4" - depends on HAS_HW_NRF_TIMER4 + depends on $(dt_nodelabel_has_compat,timer4,$(DT_COMPAT_NORDIC_NRF_TIMER)) select NRFX_TIMER4 endchoice From 915c5be4d31ba5d5a1dccb3c9deaed968376ae57 Mon Sep 17 00:00:00 2001 From: Tommi Kangas Date: Tue, 25 Apr 2023 15:12:09 +0300 Subject: [PATCH 45/47] samples: nrf9160: modem_shell: fix array overflow in iperf3 Fixed an array overflow in iperf3. Signed-off-by: Tommi Kangas --- ext/iperf3/iperf_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/iperf3/iperf_util.c b/ext/iperf3/iperf_util.c index b1668bc4499b..2f53eb6e2941 100644 --- a/ext/iperf3/iperf_util.c +++ b/ext/iperf3/iperf_util.c @@ -192,12 +192,12 @@ void fill_with_repeating_pattern(void *out, size_t outsize) void make_cookie(char *cookie) { int len = strlen(CONFIG_NRF_IPERF3_HOST_NAME); - char hostname[len]; + char hostname[len + 1]; struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; char temp[100]; /* Generate a string based on hostname, time, randomness, and filler. */ - (void) nrf_iperf3_mock_gethostname(hostname, sizeof(hostname) + 1); + (void) nrf_iperf3_mock_gethostname(hostname, sizeof(hostname)); (void) gettimeofday(&tv, 0); (void) snprintf(temp, sizeof(temp), "%s.%ld.%06ld.%08lx%08lx.%s", hostname, (unsigned long int) tv.tv_sec, (unsigned long int) tv.tv_usec, (unsigned long int) rand(), (unsigned long int) rand(), "1234567890123456789012345678901234567890"); From b92af18eace434b19e825cbfb98227ef447e527d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Wed, 26 Apr 2023 13:33:49 -0700 Subject: [PATCH 46/47] tests: boot_chains: add missing prj.conf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The latest zephyr upmerge has made the absence of this file a hard error. Signed-off-by: Martí Bolívar --- tests/subsys/bootloader/boot_chains/prj.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/subsys/bootloader/boot_chains/prj.conf diff --git a/tests/subsys/bootloader/boot_chains/prj.conf b/tests/subsys/bootloader/boot_chains/prj.conf new file mode 100644 index 000000000000..c5c73046947e --- /dev/null +++ b/tests/subsys/bootloader/boot_chains/prj.conf @@ -0,0 +1 @@ +# Intentionally left empty. From 6436c1ada778e026749429a49b46fc0aebadf22b Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Mon, 24 Apr 2023 10:20:01 +0200 Subject: [PATCH 47/47] applications: nrf5340_audio: Adjust to fit upmerge code - Start to use CONFIG_BT_AUDIO_RX/TX - Some renaming and API changes Signed-off-by: Alexander Svensen --- .../src/bluetooth/Kconfig.defaults | 23 +++++- .../src/bluetooth/ble_audio_services.c | 13 ++-- .../src/bluetooth/le_audio_bis_gateway.c | 10 ++- .../src/bluetooth/le_audio_bis_headset.c | 57 +++++++++------ .../src/bluetooth/le_audio_cis_gateway.c | 28 ++++--- .../src/bluetooth/le_audio_cis_headset.c | 73 +++++++++++-------- 6 files changed, 126 insertions(+), 78 deletions(-) diff --git a/applications/nrf5340_audio/src/bluetooth/Kconfig.defaults b/applications/nrf5340_audio/src/bluetooth/Kconfig.defaults index f3fcb01b9424..6dfb2b747693 100644 --- a/applications/nrf5340_audio/src/bluetooth/Kconfig.defaults +++ b/applications/nrf5340_audio/src/bluetooth/Kconfig.defaults @@ -115,7 +115,6 @@ config BT_MCC default n if WALKIE_TALKIE_DEMO default y - config BT_PACS_SNK_CONTEXT default 0x0007 if STREAM_BIDIRECTIONAL default 0x0005 @@ -130,7 +129,12 @@ config BT_CAP_ACCEPTOR default y config BT_CAP_ACCEPTOR_SET_MEMBER - bool + default y + +config BT_AUDIO_TX + default y if STREAM_BIDIRECTIONAL + +config BT_AUDIO_RX default y endif # AUDIO_DEV = 1 (HEADSET) @@ -194,6 +198,12 @@ config MCTL_LOCAL_PLAYER_CONTROL config MCTL_LOCAL_PLAYER_REMOTE_CONTROL default y +config BT_AUDIO_TX + default y + +config BT_AUDIO_RX + default y if STREAM_BIDIRECTIONAL + endif # AUDIO_DEV = 2 (GATEWAY) endif # TRANSPORT_CIS @@ -222,6 +232,9 @@ config BT_ISO_SYNC_RECEIVER config BT_BAP_BROADCAST_SINK default y +config BT_BAP_SCAN_DELEGATOR + default y + config BT_BAP_BROADCAST_SNK_STREAM_COUNT default 2 @@ -234,6 +247,9 @@ config BT_SMP config BT_PAC_SNK default y +config BT_AUDIO_RX + default y + endif # AUDIO_DEV = 1 (HEADSET) # GATEWAY @@ -261,6 +277,9 @@ config BT_BAP_BROADCAST_SRC_STREAM_COUNT config BT_ISO_MAX_CHAN default 2 +config BT_AUDIO_TX + default y + endif # AUDIO_DEV = 2 (GATEWAY) endif # TRANSPORT_BIS diff --git a/applications/nrf5340_audio/src/bluetooth/ble_audio_services.c b/applications/nrf5340_audio/src/bluetooth/ble_audio_services.c index 96733d9f971e..4ce8778c9402 100644 --- a/applications/nrf5340_audio/src/bluetooth/ble_audio_services.c +++ b/applications/nrf5340_audio/src/bluetooth/ble_audio_services.c @@ -533,8 +533,7 @@ int ble_mcs_discover(struct bt_conn *conn) int ret; uint8_t idx = bt_conn_index(conn); - if (mcp_mcs_disc_status[idx] == FINISHED || - mcp_mcs_disc_status[idx] == IN_PROGRESS) { + if (mcp_mcs_disc_status[idx] == FINISHED || mcp_mcs_disc_status[idx] == IN_PROGRESS) { return -EALREADY; } @@ -570,11 +569,13 @@ int ble_mcs_play_pause(struct bt_conn *conn) int ret = 0; struct mpl_cmd cmd; - uint8_t idx = bt_conn_index(conn); + if (conn != NULL) { + uint8_t idx = bt_conn_index(conn); - if (mcp_mcs_disc_status[idx] != FINISHED) { - LOG_WRN("MCS discovery has not finished"); - return -EBUSY; + if (mcp_mcs_disc_status[idx] != FINISHED) { + LOG_WRN("MCS discovery has not finished"); + return -EBUSY; + } } if (media_player_state == BT_MCS_MEDIA_STATE_PLAYING) { diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio_bis_gateway.c b/applications/nrf5340_audio/src/bluetooth/le_audio_bis_gateway.c index f3af8e1551a1..1dd73b5143f0 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio_bis_gateway.c +++ b/applications/nrf5340_audio/src/bluetooth/le_audio_bis_gateway.c @@ -156,9 +156,13 @@ static void stream_stopped_cb(struct bt_bap_stream *stream, uint8_t reason) } } -static struct bt_bap_stream_ops stream_ops = { .sent = stream_sent_cb, - .started = stream_started_cb, - .stopped = stream_stopped_cb }; +static struct bt_bap_stream_ops stream_ops = { + .started = stream_started_cb, + .stopped = stream_stopped_cb, +#if (CONFIG_BT_AUDIO_TX) + .sent = stream_sent_cb, +#endif /* (CONFIG_BT_AUDIO_TX) */ +}; #if (CONFIG_AURACAST) static void public_broadcast_features_set(uint8_t *features) diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio_bis_headset.c b/applications/nrf5340_audio/src/bluetooth/le_audio_bis_headset.c index e4bff1b5c4f9..ab0fc8025488 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio_bis_headset.c +++ b/applications/nrf5340_audio/src/bluetooth/le_audio_bis_headset.c @@ -78,7 +78,7 @@ static le_audio_receive_cb receive_cb; static bool init_routine_completed; static bool playing_state = true; -static int bis_headset_cleanup(bool from_sync_lost_cb); +static int bis_headset_cleanup(void); static void le_audio_event_publish(enum le_audio_evt_type event) { @@ -185,13 +185,11 @@ static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_rec bad_frame = true; } - uint32_t octets_per_sdu = bt_codec_cfg_get_octets_per_frame(stream->codec); - - if (buf->len != octets_per_sdu && bad_frame != true) { + if (buf->len != active_stream.codec->octets_per_sdu && bad_frame != true) { data_size_mismatch_cnt++; if ((data_size_mismatch_cnt % 500) == 1) { LOG_DBG("Data size mismatch, received: %d, codec: %d, total: %d", buf->len, - octets_per_sdu, data_size_mismatch_cnt); + active_stream.codec->octets_per_sdu, data_size_mismatch_cnt); } return; @@ -206,9 +204,13 @@ static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_rec } } -static struct bt_bap_stream_ops stream_ops = { .started = stream_started_cb, - .stopped = stream_stopped_cb, - .recv = stream_recv_cb }; +static struct bt_bap_stream_ops stream_ops = { + .started = stream_started_cb, + .stopped = stream_stopped_cb, +#if (CONFIG_BT_AUDIO_RX) + .recv = stream_recv_cb, +#endif /* (CONFIG_BT_AUDIO_RX) */ +}; static bool scan_recv_cb(const struct bt_le_scan_recv_info *info, struct net_buf_simple *ad, uint32_t broadcast_id) @@ -264,9 +266,13 @@ static void pa_sync_lost_cb(struct bt_bap_broadcast_sink *sink) return; } + if (!init_routine_completed) { + return; + } + LOG_DBG("Sink disconnected"); - ret = bis_headset_cleanup(true); + ret = bis_headset_cleanup(); if (ret) { LOG_ERR("Error cleaning up"); return; @@ -352,7 +358,7 @@ static void syncable_cb(struct bt_bap_broadcast_sink *sink, bool encrypted) strncpy(bis_encryption_key, CONFIG_BT_AUDIO_BROADCAST_ENCRYPTION_KEY, 16); #endif /* (CONFIG_BT_AUDIO_BROADCAST_ENCRYPTED) */ - if (active_stream.stream->ep->status.state == BT_BAP_EP_STATE_STREAMING || !playing_state) { + if (!playing_state) { LOG_DBG("Syncable received, but either in paused_state or already in a stream"); return; } @@ -361,6 +367,8 @@ static void syncable_cb(struct bt_bap_broadcast_sink *sink, bool encrypted) ret = bt_bap_broadcast_sink_sync(broadcast_sink, bis_index_bitfields[active_stream_index], audio_streams_p, bis_encryption_key); + + active_stream.stream = audio_streams_p[active_stream_index]; if (ret) { LOG_WRN("Unable to sync to broadcast source, ret: %d", ret); return; @@ -429,23 +437,19 @@ static int initialize(le_audio_receive_cb recv_cb) return 0; } -static int bis_headset_cleanup(bool from_sync_lost_cb) +static int bis_headset_cleanup(void) { int ret; + init_routine_completed = false; + ret = bt_bap_broadcast_sink_scan_stop(); if (ret && ret != -EALREADY) { + LOG_WRN("Failed to stop sink scan, ret: %d", ret); return ret; } if (broadcast_sink != NULL) { - if (!from_sync_lost_cb) { - ret = bt_bap_broadcast_sink_stop(broadcast_sink); - if (ret && ret != -EALREADY) { - return ret; - } - } - ret = bt_bap_broadcast_sink_delete(broadcast_sink); if (ret && ret != -EALREADY) { return ret; @@ -454,8 +458,6 @@ static int bis_headset_cleanup(bool from_sync_lost_cb) broadcast_sink = NULL; } - init_routine_completed = false; - return 0; } @@ -492,8 +494,15 @@ static int change_active_brdcast_src(void) { int ret; - /* If the stream has been paused do not stop the sink again */ - ret = bis_headset_cleanup(!playing_state); + if (active_stream.stream->ep->status.state == BT_BAP_EP_STATE_STREAMING) { + ret = bt_bap_broadcast_sink_stop(broadcast_sink); + if (ret) { + LOG_ERR("Failed to stop broadcast sink: %d", ret); + return ret; + } + } + + ret = bis_headset_cleanup(); if (ret) { LOG_ERR("Error cleaning up"); return ret; @@ -631,7 +640,7 @@ int le_audio_enable(le_audio_receive_cb recv_cb, le_audio_timestamp_cb timestmp_ return ret; } - ret = bis_headset_cleanup(false); + ret = bis_headset_cleanup(); if (ret) { LOG_ERR("Error cleaning up"); return ret; @@ -653,7 +662,7 @@ int le_audio_disable(void) { int ret; - ret = bis_headset_cleanup(false); + ret = bis_headset_cleanup(); if (ret) { LOG_ERR("Error cleaning up"); return ret; diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c index a133a649d7ac..9a424044e499 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c +++ b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_gateway.c @@ -111,11 +111,11 @@ static bool ble_acl_gateway_all_links_connected(void); static struct bt_bap_unicast_client_discover_params audio_sink_discover_param[CONFIG_BT_MAX_CONN]; -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_RX) static struct bt_bap_unicast_client_discover_params audio_source_discover_param[CONFIG_BT_MAX_CONN]; static int discover_source(struct bt_conn *conn); -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_RX) */ static void le_audio_event_publish(enum le_audio_evt_type event) { @@ -563,6 +563,7 @@ static void stream_released_cb(struct bt_bap_stream *stream) } } +#if (CONFIG_BT_AUDIO_RX) static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, struct net_buf *buf) { @@ -600,9 +601,9 @@ static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_rec receive_cb(buf->data, buf->len, bad_frame, info->ts, channel_index); } +#endif /* (CONFIG_BT_AUDIO_RX) */ static struct bt_bap_stream_ops stream_ops = { - .sent = stream_sent_cb, .configured = stream_configured_cb, .qos_set = stream_qos_set_cb, .enabled = stream_enabled_cb, @@ -611,7 +612,12 @@ static struct bt_bap_stream_ops stream_ops = { .disabled = stream_disabled_cb, .stopped = stream_stopped_cb, .released = stream_released_cb, +#if (CONFIG_BT_AUDIO_RX) .recv = stream_recv_cb, +#endif /* (CONFIG_BT_AUDIO_RX) */ +#if (CONFIG_BT_AUDIO_TX) + .sent = stream_sent_cb, +#endif /* (CONFIG_BT_AUDIO_TX) */ }; static void work_stream_start(struct k_work *work) @@ -855,15 +861,15 @@ static void discover_sink_cb(struct bt_conn *conn, struct bt_codec *codec, struc memset(temp_cap[temp_cap_index].codec, 0, sizeof(temp_cap[temp_cap_index].codec)); temp_cap[temp_cap_index].conn = NULL; -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_RX) ret = discover_source(conn); if (ret) { LOG_WRN("Failed to discover source: %d", ret); } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_RX) */ } -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_RX) static void discover_source_cb(struct bt_conn *conn, struct bt_codec *codec, struct bt_bap_ep *ep, struct bt_bap_unicast_client_discover_params *params) { @@ -972,7 +978,7 @@ static void discover_source_cb(struct bt_conn *conn, struct bt_codec *codec, str memset(temp_cap[temp_cap_index].codec, 0, sizeof(temp_cap[temp_cap_index].codec)); temp_cap[temp_cap_index].conn = NULL; } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_RX) */ static bool ble_acl_gateway_all_links_connected(void) { @@ -1231,7 +1237,7 @@ static int discover_sink(struct bt_conn *conn) return ret; } -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_RX) static int discover_source(struct bt_conn *conn) { int ret = 0; @@ -1249,7 +1255,7 @@ static int discover_source(struct bt_conn *conn) return ret; } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_RX) */ static void security_changed_cb(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) { @@ -1464,11 +1470,11 @@ static int initialize(le_audio_receive_cb recv_cb, le_audio_timestamp_cb timestm for (int i = 0; i < ARRAY_SIZE(pair_params); i++) { pair_params[i].tx_param = &stream_params[stream_iterator]; stream_iterator++; -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_RX) pair_params[i].rx_param = &stream_params[stream_iterator]; #else pair_params[i].rx_param = NULL; -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_RX) */ stream_iterator++; } diff --git a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_headset.c b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_headset.c index 11987271c801..9798b21b9c34 100644 --- a/applications/nrf5340_audio/src/bluetooth/le_audio_cis_headset.c +++ b/applications/nrf5340_audio/src/bluetooth/le_audio_cis_headset.c @@ -37,7 +37,7 @@ ZBUS_CHAN_DEFINE(le_audio_chan, struct le_audio_msg, NULL, NULL, ZBUS_OBSERVERS_ BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, BT_GAP_ADV_FAST_INT_MIN_1, \ BT_GAP_ADV_FAST_INT_MAX_1, NULL) -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) #define HCI_ISO_BUF_ALLOC_PER_CHAN 2 /* For being able to dynamically define iso_tx_pools */ #define NET_BUF_POOL_ITERATE(i, _) \ @@ -51,7 +51,7 @@ static atomic_t iso_tx_pool_alloc; static struct net_buf_pool *iso_tx_pools[] = { LISTIFY(CONFIG_BT_ASCS_ASE_SRC_COUNT, NET_BUF_POOL_PTR_ITERATE, (,)) }; /* clang-format on */ -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ #define CSIP_SET_SIZE 2 enum csip_set_rank { CSIP_HL_RANK = 1, CSIP_HR_RANK = 2 }; @@ -120,9 +120,9 @@ static struct bt_codec lc3_codec = BT_CODEC_LC3( static enum bt_audio_dir caps_dirs[] = { BT_AUDIO_DIR_SINK, -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) BT_AUDIO_DIR_SOURCE, -#endif +#endif /* (CONFIG_BT_AUDIO_TX) */ }; static const struct bt_codec_qos_pref qos_pref = @@ -136,11 +136,11 @@ static struct bt_pacs_cap caps[] = { { .codec = &lc3_codec, }, -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) { .codec = &lc3_codec, } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ }; /* clang-format on */ @@ -149,14 +149,14 @@ static struct bt_conn *default_conn; static struct bt_bap_stream audio_streams[CONFIG_BT_ASCS_ASE_SNK_COUNT + CONFIG_BT_ASCS_ASE_SRC_COUNT]; -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) BUILD_ASSERT(CONFIG_BT_ASCS_ASE_SRC_COUNT <= 1, "CIS headset only supports one source stream for now"); static struct bt_audio_source { struct bt_bap_stream *stream; uint32_t seq_num; } sources[CONFIG_BT_ASCS_ASE_SRC_COUNT]; -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ /* Left or right channel headset */ static enum audio_channel channel; @@ -284,7 +284,7 @@ static void advertising_start(void) static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_codec *codec, struct bt_bap_stream **stream, - struct bt_codec_qos_pref *const pref) + struct bt_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("LC3 configure call-back"); @@ -310,7 +310,7 @@ static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum print_codec(codec, dir); le_audio_event_publish(LE_AUDIO_EVT_CONFIG_RECEIVED); } -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) else if (dir == BT_AUDIO_DIR_SOURCE) { LOG_DBG("BT_AUDIO_DIR_SOURCE"); print_codec(codec, dir); @@ -318,7 +318,7 @@ static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum /* CIS headset only supports one source stream for now */ sources[0].stream = audio_stream; } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ else { LOG_ERR("UNKNOWN DIR"); return -EINVAL; @@ -335,14 +335,16 @@ static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum } static int lc3_reconfig_cb(struct bt_bap_stream *stream, enum bt_audio_dir dir, - const struct bt_codec *codec, struct bt_codec_qos_pref *const pref) + const struct bt_codec *codec, struct bt_codec_qos_pref *const pref, + struct bt_bap_ascs_rsp *rsp) { LOG_DBG("ASE Codec Reconfig: stream %p", (void *)stream); return 0; } -static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_codec_qos *qos) +static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_codec_qos *qos, + struct bt_bap_ascs_rsp *rsp) { le_audio_event_publish(LE_AUDIO_EVT_PRES_DELAY_SET); @@ -352,7 +354,7 @@ static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_codec_qos *q } static int lc3_enable_cb(struct bt_bap_stream *stream, const struct bt_codec_data *meta, - size_t meta_count) + size_t meta_count, struct bt_bap_ascs_rsp *rsp) { int ret; @@ -362,7 +364,7 @@ static int lc3_enable_cb(struct bt_bap_stream *stream, const struct bt_codec_dat if (IS_ENABLED(CONFIG_BT_MCC)) { ret = ble_mcs_discover(stream->conn); if (ret == -EALREADY) { - LOG_INF("Discovery already run or in progress"); + LOG_DBG("Discovery already run or in progress"); } else if (ret) { LOG_ERR("Failed to start discovery of MCS: %d", ret); } @@ -371,20 +373,20 @@ static int lc3_enable_cb(struct bt_bap_stream *stream, const struct bt_codec_dat return 0; } -static int lc3_start_cb(struct bt_bap_stream *stream) +static int lc3_start_cb(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("Start stream %p", (void *)stream); return 0; } static int lc3_metadata_cb(struct bt_bap_stream *stream, const struct bt_codec_data *meta, - size_t meta_count) + size_t meta_count, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("Metadata: stream %p meta_count %d", (void *)stream, meta_count); return 0; } -static int lc3_disable_cb(struct bt_bap_stream *stream) +static int lc3_disable_cb(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("Disable: stream %p", (void *)stream); @@ -393,7 +395,7 @@ static int lc3_disable_cb(struct bt_bap_stream *stream) return 0; } -static int lc3_stop_cb(struct bt_bap_stream *stream) +static int lc3_stop_cb(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("Stop: stream %p", (void *)stream); @@ -402,7 +404,7 @@ static int lc3_stop_cb(struct bt_bap_stream *stream) return 0; } -static int lc3_release_cb(struct bt_bap_stream *stream) +static int lc3_release_cb(struct bt_bap_stream *stream, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("Release: stream %p", (void *)stream); @@ -423,12 +425,12 @@ static const struct bt_bap_unicast_server_cb unicast_server_cb = { .release = lc3_release_cb, }; +#if (CONFIG_BT_AUDIO_TX) static void stream_sent_cb(struct bt_bap_stream *stream) { -#if CONFIG_STREAM_BIDIRECTIONAL atomic_dec(&iso_tx_pool_alloc); -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ } +#endif /* (CONFIG_BT_AUDIO_TX) */ static void stream_recv_cb(struct bt_bap_stream *stream, const struct bt_iso_recv_info *info, struct net_buf *buf) @@ -496,9 +498,10 @@ static void stream_stop_cb(struct bt_bap_stream *stream, uint8_t reason) { LOG_DBG("Stream %p stopped. Reason: %d", stream, reason); -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) atomic_clear(&iso_tx_pool_alloc); -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ + le_audio_event_publish(LE_AUDIO_EVT_NOT_STREAMING); } @@ -584,12 +587,18 @@ static struct bt_conn_cb conn_callbacks = { .security_changed = security_changed_cb, }; -static struct bt_bap_stream_ops stream_ops = { .recv = stream_recv_cb, - .sent = stream_sent_cb, - .enabled = stream_enabled_cb, - .started = stream_start_cb, - .stopped = stream_stop_cb, - .released = stream_released_cb }; +static struct bt_bap_stream_ops stream_ops = { + .enabled = stream_enabled_cb, + .started = stream_start_cb, + .stopped = stream_stop_cb, + .released = stream_released_cb, +#if (CONFIG_BT_AUDIO_RX) + .recv = stream_recv_cb, +#endif /* (CONFIG_BT_AUDIO_RX) */ +#if (CONFIG_BT_AUDIO_TX) + .sent = stream_sent_cb, +#endif /* (CONFIG_BT_AUDIO_TX) */ +}; static int initialize(le_audio_receive_cb recv_cb, le_audio_timestamp_cb timestmp_cb) { @@ -857,7 +866,7 @@ int le_audio_play_pause(void) int le_audio_send(struct encoded_audio enc_audio) { -#if CONFIG_STREAM_BIDIRECTIONAL +#if (CONFIG_BT_AUDIO_TX) int ret; struct net_buf *buf; static bool hci_wrn_printed; @@ -910,7 +919,7 @@ int le_audio_send(struct encoded_audio enc_audio) net_buf_unref(buf); atomic_dec(&iso_tx_pool_alloc); } -#endif /* CONFIG_STREAM_BIDIRECTIONAL */ +#endif /* (CONFIG_BT_AUDIO_TX) */ return 0; }