Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIGA: Enabling BT in Core fails to compile. #27

Open
mjs513 opened this issue Dec 28, 2024 · 3 comments
Open

GIGA: Enabling BT in Core fails to compile. #27

mjs513 opened this issue Dec 28, 2024 · 3 comments

Comments

@mjs513
Copy link

mjs513 commented Dec 28, 2024

Over the past day been trying to get BT working with the GIGA.

The following was added to the overlay


&uart7 {
	pinctrl-0 = <&uart7_tx_pf7 &uart7_rx_pa8
		     &uart7_cts_pf9 &uart7_rts_pf8>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
	hw-flow-control;

	bt_hci_uart: bt_hci_uart {
		compatible = "zephyr,bt-hci-uart";
		status = "okay";

		murata-1dx {
			compatible = "infineon,cyw43xxx-bt-hci";
			bt-reg-on-gpios = <&gpioa 10 GPIO_ACTIVE_HIGH>;
			bt-host-wake-gpios = <&gpiog 3 GPIO_ACTIVE_HIGH>;
			bt-dev-wake-gpios = <&gpioh 7 GPIO_ACTIVE_HIGH>;
			fw-download-speed = <115200>;
		};
	};
};

		serials = <&cdc_acm_uart0>, <&usart1>, <&usart2>, <&uart4>, <&usart6>, <&uart7>;

and to the gpio list.

						<&gpioa 3 0>;			/* bt_reg_on - 100 */						

However if I add CONF_BT=y i get a series of errors

164/372] Building C object zephyr/drivers/bluetooth...les/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj
FAILED: zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj
ccache /home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DCORE_CM7 -DHSE_VALUE=16000000 -DKERNEL -DK_HEAP_MEM_POOL_SIZE=2048 -DPICOLIBC_DOUBLE_PRINTF_SCANF -DSTM32H747xx -DUSE_FULL_LL_DRIVER -DUSE_HAL_DRIVER -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/home/my_new_zephyr_folder/zephyr/subsys/bluetooth -I/home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated/zephyr -I/home/my_new_zephyr_folder/zephyr/include -I/home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated -I/home/my_new_zephyr_folder/zephyr/soc/st/stm32 -I/home/my_new_zephyr_folder/zephyr/lib/posix/options/getopt -I/home/my_new_zephyr_folder/zephyr/soc/st/stm32/common/. -I/home/my_new_zephyr_folder/zephyr/drivers -I/home/my_new_zephyr_folder/zephyr/soc/st/stm32/stm32h7x/. -I/home/my_new_zephyr_folder/zephyr/subsys/usb/device -I/home/my_new_zephyr_folder/zephyr/subsys/shell/modules/kernel_service/thread/.. -I/home/my_new_zephyr_folder/modules/hal/cmsis/CMSIS/Core/Include -I/home/my_new_zephyr_folder/zephyr/modules/cmsis/. -I/home/my_new_zephyr_folder/modules/hal/stm32/stm32cube/stm32h7xx/soc -I/home/my_new_zephyr_folder/modules/hal/stm32/stm32cube/stm32h7xx/drivers/include -I/home/my_new_zephyr_folder/modules/hal/stm32/stm32cube/common_ll/include -isystem /home/my_new_zephyr_folder/zephyr/lib/libc/common/include -Wshadow -fno-strict-aliasing -Os -imacros /home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated/zephyr/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m7 -mthumb -mabi=aapcs -mfpu=fpv5-d16 -mfloat-abi=hard -mfp16-format=ieee -mtp=soft --sysroot=/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/my_new_zephyr_folder/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/my_new_zephyr_folder/ArduinoCore-zephyr/loader=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/my_new_zephyr_folder/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/my_new_zephyr_folder=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -D_POSIX_THREADS -std=c99 -MD -MT zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj -MF zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj.d -o zephyr/drivers/bluetooth/CMakeFiles/drivers__bluetooth.dir/hci/h4_ifx_cyw43xxx.c.obj -c /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_update_controller_baudrate':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:15: warning: implicit declaration of function 'bt_hci_cmd_create'; did you mean 'bt_id_create'? [-Wimplicit-function-declaration]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |               ^~~~~~~~~~~~~~~~~
      |               bt_id_create
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:13: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |             ^
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:134:15: warning: implicit declaration of function 'bt_hci_cmd_send_sync' [-Wimplicit-function-declaration]
  134 |         err = bt_hci_cmd_send_sync(BT_HCI_VND_OP_UPDATE_BAUDRATE, buf, NULL);
      |               ^~~~~~~~~~~~~~~~~~~~
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_firmware_downloa':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:173:21: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  173 |                 buf = bt_hci_cmd_create(op_code, data_length);
      |                     ^
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_h4_vnd_setup':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:253:36: error: 'BT_HCI_OP_RESET' undeclared (first use in this function)
  253 |         err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, NULL);
      |                                    ^~~~~~~~~~~~~~~
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:253:36: note: each undeclared identifier is reported only once for each function it appears in
[177/372] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_ll_stm32_v2.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/my_new_zephyr_folder/ArduinoCore-zephyr/build
(venv) root@DESKTOP-5R9LQSU:/home/my_new_zephyr_folder/ArduinoCore-zephyr#

Not sure what else needs to be done for this or wifi

@mjs513
Copy link
Author

mjs513 commented Dec 29, 2024

@facchinm
This a bit more organized than what I deleted and makes more sense and documents the things I tried.

CONFIG_BT=y

  1. CMake Warning at /home/my_new_zephyr_folder/zephyr/modules/mbedtls/CMakeLists.txt:11 (message):
    No entropy device on the system, using fake entropy source!

  2. Errors

cyw43xxx.c.obj -c /home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_update_controller_baudrate':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:15: warning: implicit declaration of function 'bt_hci_cmd_create'; did you mean 'bt_id_create'? [-Wimplicit-function-declaration]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |               ^~~~~~~~~~~~~~~~~
      |               bt_id_create
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:13: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |             ^
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:134:15: warning: implicit declaration of function 'bt_hci_cmd_send_sync' [-Wimplicit-function-declaration]
  134 |         err = bt_hci_cmd_send_sync(BT_HCI_VND_OP_UPDATE_BAUDRATE, buf, NULL);
      |               ^~~~~~~~~~~~~~~~~~~~
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_firmware_downloa':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:173:21: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  173 |                 buf = bt_hci_cmd_create(op_code, data_length);
      |                     ^
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_h4_vnd_setup':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:253:36: error: 'BT_HCI_OP_RESET' undeclared (first use in this function)
  253 |         err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, NULL);

The one error is for BT_HCI_OP_RESET which is in hci_types.h which doesn't seem to get linked in. But is referenced in HCI.h.

  1. As a hack I added hci_types.h to bluetooth.h and did get a bit farther
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/mbedtls/libmbedTLSBase.a(zephyr_entropy.c.obj): in function `sys_rand_get':
/home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated/zephyr/syscalls/random.h:37: undefined reference to `z_impl_sys_rand_get'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_bt_conn_get_dst_+0x4): undefined reference to `bt_conn_get_dst'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_bt_buf_get_tx_+0x4): undefined reference to `bt_buf_get_tx'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_bt_hci_raw_set_mode_+0x4): undefined reference to `bt_hci_raw_set_mode'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_bt_enable_raw_+0x4): undefined reference to `bt_enable_raw'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_tls_credential_add_+0x4): undefined reference to `tls_credential_add'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

which implies those bt references in llext_exports.c no longer needed.

  1. Commenting them out:
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/mbedtls/libmbedTLSBase.a(zephyr_entropy.c.obj): in function `sys_rand_get':
/home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated/zephyr/syscalls/random.h:37: undefined reference to `z_impl_sys_rand_get'
/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(llext_exports.c.obj):(._llext_const_symbol.static.__llext_sym_tls_credential_add_+0x4): undefined reference to `tls_credential_add'
  1. doing a CONFIG_MBEDTLS=y still gives the me the error on ttls so just commented it out. I am left without these warnings
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:15: warning: implicit declaration of function 'bt_hci_cmd_create'; did you mean 'bt_id_create'? [-Wimplicit-function-declaration]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |               ^~~~~~~~~~~~~~~~~
      |               bt_id_create
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:123:13: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  123 |         buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
      |             ^
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:134:15: warning: implicit declaration of function 'bt_hci_cmd_send_sync' [-Wimplicit-function-declaration]
  134 |         err = bt_hci_cmd_send_sync(BT_HCI_VND_OP_UPDATE_BAUDRATE, buf, NULL);
      |               ^~~~~~~~~~~~~~~~~~~~
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c: In function 'bt_firmware_downloa':
/home/my_new_zephyr_folder/zephyr/drivers/bluetooth/hci/h4_ifx_cyw43xxx.c:173:21: warning: assignment to 'struct net_buf *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  173 |                 buf = bt_hci_cmd_create(op_code, data_length);

and error on entropy

/home/zephyr-sdk-0.16.8/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/mbedtls/libmbedTLSBase.a(zephyr_entropy.c.obj): in function `sys_rand_get':
/home/my_new_zephyr_folder/ArduinoCore-zephyr/build/zephyr/include/generated/zephyr/syscalls/random.h:37: undefined reference to `z_impl_sys_rand_get'
collect2: error: ld returned 1 exit status

I did add

&rng {
	status = "okay";
};

but still get the error.

  1. Found this zephyr issue undefined references to `sys_rand32_get' zephyrproject-rtos/zephyr#15565 which recommends adding the following to pjrf.conf file.
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

doing that the core now compiles.

More on test case in next post

@mjs513
Copy link
Author

mjs513 commented Dec 29, 2024

Since the ArduinoBLE lib has to have major changes to work with zephyr I tried this example:


#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/uuid.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/services/bas.h>
#include <zephyr/bluetooth/services/hrs.h>
#include "LibPrintf.h"

static bool hrf_ntf_enabled;
#define CONFIG_BT_DEVICE_NAME "Heart rate sample"

static const struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA_BYTES(BT_DATA_UUID16_ALL,
		      BT_UUID_16_ENCODE(BT_UUID_HRS_VAL),
		      BT_UUID_16_ENCODE(BT_UUID_BAS_VAL),
		      BT_UUID_16_ENCODE(BT_UUID_DIS_VAL)),
#if defined(CONFIG_BT_EXT_ADV)
	BT_DATA(BT_DATA_NAME_COMPLETE, CONFIG_BT_DEVICE_NAME, sizeof(CONFIG_BT_DEVICE_NAME) - 1),
#endif /* CONFIG_BT_EXT_ADV */
};

#if !defined(CONFIG_BT_EXT_ADV)
static const struct bt_data sd[] = {
	BT_DATA(BT_DATA_NAME_COMPLETE, CONFIG_BT_DEVICE_NAME, sizeof(CONFIG_BT_DEVICE_NAME) - 1),
};
#endif /* !CONFIG_BT_EXT_ADV */

/* Use atomic variable, 2 bits for connection and disconnection state */
static ATOMIC_DEFINE(state, 2U);

#define STATE_CONNECTED    1U
#define STATE_DISCONNECTED 2U

static void connected(struct bt_conn *conn, uint8_t err)
{
	if (err) {
		printf("Connection failed, err 0x%02x %s\n", err, bt_hci_err_to_str(err));
	} else {
		printf("Connected\n");

		(void)atomic_set_bit(state, STATE_CONNECTED);
	}
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	printf("Disconnected, reason 0x%02x %s\n", reason, bt_hci_err_to_str(reason));

	(void)atomic_set_bit(state, STATE_DISCONNECTED);
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.connected = connected,
	.disconnected = disconnected,
};

static void hrs_ntf_changed(bool enabled)
{
	hrf_ntf_enabled = enabled;

	printf("HRS notification status changed: %s\n",
	       enabled ? "enabled" : "disabled");
}

static struct bt_hrs_cb hrs_cb = {
	.ntf_changed = hrs_ntf_changed,
};

static void auth_cancel(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printf("Pairing cancelled: %s\n", addr);
}

static struct bt_conn_auth_cb auth_cb_display = {
	.cancel = auth_cancel,
};

static void bas_notify(void)
{
	uint8_t battery_level = bt_bas_get_battery_level();

	battery_level--;

	if (!battery_level) {
		battery_level = 100U;
	}

	bt_bas_set_battery_level(battery_level);
}

static void hrs_notify(void)
{
	static uint8_t heartrate = 90U;

	/* Heartrate measurements simulation */
	heartrate++;
	if (heartrate == 160U) {
		heartrate = 90U;
	}

	if (hrf_ntf_enabled) {
		bt_hrs_notify(heartrate);
	}
}

#if defined(CONFIG_GPIO)
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)

#if DT_NODE_HAS_STATUS_OKAY(LED0_NODE)
#include <zephyr/drivers/gpio.h>
#define HAS_LED     1
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
#define BLINK_ONOFF K_MSEC(500)

static struct k_work_delayable blink_work;
static bool                  led_is_on;

static void blink_timeout(struct k_work *work)
{
	led_is_on = !led_is_on;
	gpio_pin_set(led.port, led.pin, (int)led_is_on);

	k_work_schedule(&blink_work, BLINK_ONOFF);
}

static int blink_setup(void)
{
	int err;

	printf("Checking LED device...");
	if (!gpio_is_ready_dt(&led)) {
		printf("failed.\n");
		return -EIO;
	}
	printf("done.\n");

	printf("Configuring GPIO pin...");
	err = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
	if (err) {
		printf("failed.\n");
		return -EIO;
	}
	printf("done.\n");

	k_work_init_delayable(&blink_work, blink_timeout);

	return 0;
}

static void blink_start(void)
{
	printf("Start blinking LED...\n");
	led_is_on = false;
	gpio_pin_set(led.port, led.pin, (int)led_is_on);
	k_work_schedule(&blink_work, BLINK_ONOFF);
}

static void blink_stop(void)
{
	struct k_work_sync work_sync;

	printf("Stop blinking LED.\n");
	k_work_cancel_delayable_sync(&blink_work, &work_sync);

	/* Keep LED on */
	led_is_on = true;
	gpio_pin_set(led.port, led.pin, (int)led_is_on);
}
#endif /* LED0_NODE */
#endif /* CONFIG_GPIO */



void setup() {

Serial.begin(9600);
delay(1000);

	int err;

	err = bt_enable(NULL);
	if (err) {
		printf("Bluetooth init failed (err %d)\n", err);
				while(1);
	}

	printf("Bluetooth initialized\n");

	bt_conn_auth_cb_register(&auth_cb_display);

	bt_hrs_cb_register(&hrs_cb);

#if !defined(CONFIG_BT_EXT_ADV)
	printf("Starting Legacy Advertising (connectable and scannable)\n");
	err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
	if (err) {
		printf("Advertising failed to start (err %d)\n", err);
				while(1);
	}

#else /* CONFIG_BT_EXT_ADV */
	struct bt_le_adv_param adv_param = {
		.id = BT_ID_DEFAULT,
		.sid = 0U,
		.secondary_max_skip = 0U,
		.options = (BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_CODED),
		.interval_min = BT_GAP_ADV_FAST_INT_MIN_2,
		.interval_max = BT_GAP_ADV_FAST_INT_MAX_2,
		.peer = NULL,
	};
	struct bt_le_ext_adv *adv;

	printf("Creating a Coded PHY connectable non-scannable advertising set\n");
	err = bt_le_ext_adv_create(&adv_param, NULL, &adv);
	if (err) {
		printf("Failed to create Coded PHY extended advertising set (err %d)\n", err);

		printf("Creating a non-Coded PHY connectable non-scannable advertising set\n");
		adv_param.options &= ~BT_LE_ADV_OPT_CODED;
		err = bt_le_ext_adv_create(&adv_param, NULL, &adv);
		if (err) {
			printf("Failed to create extended advertising set (err %d)\n", err);
				while(1);
		}
	}

	printf("Setting extended advertising data\n");
	err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);
	if (err) {
		printf("Failed to set extended advertising data (err %d)\n", err);
				while(1);
	}

	printf("Starting Extended Advertising (connectable non-scannable)\n");
	err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
	if (err) {
		printf("Failed to start extended advertising set (err %d)\n", err);
				while(1);
	}
#endif /* CONFIG_BT_EXT_ADV */

	printf("Advertising successfully started\n");

#if defined(HAS_LED)
	err = blink_setup();
	if (err) {
				while(1);
	}

	blink_start();
#endif /* HAS_LED */

	/* Implement notification. */
	while (1) {
		k_sleep(K_SECONDS(1));

		/* Heartrate measurements simulation */
		hrs_notify();

		/* Battery level simulation */
		bas_notify();

		if (atomic_test_and_clear_bit(state, STATE_CONNECTED)) {
			/* Connected callback executed */

#if defined(HAS_LED)
			blink_stop();
#endif /* HAS_LED */
		} else if (atomic_test_and_clear_bit(state, STATE_DISCONNECTED)) {
#if !defined(CONFIG_BT_EXT_ADV)
			printf("Starting Legacy Advertising (connectable and scannable)\n");
			err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_1, ad, ARRAY_SIZE(ad), sd,
					      ARRAY_SIZE(sd));
			if (err) {
				printf("Advertising failed to start (err %d)\n", err);
				while(1);
			}

#else /* CONFIG_BT_EXT_ADV */
			printf("Starting Extended Advertising (connectable and non-scannable)\n");
			err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
			if (err) {
				printf("Failed to start extended advertising set (err %d)\n", err);
				while(1);
			}
#endif /* CONFIG_BT_EXT_ADV */

#if defined(HAS_LED)
			blink_start();
#endif /* HAS_LED */
		}
	}

}

void loop() {
  // put your main code here, to run repeatedly:

}

however I am back to the error:

�[1;32muart:~$ �[msketch
[00:00:18.826,000] �[1;31m<err> llext: Undefined symbol with no entry in symbol table bt_conn_get_dst, offset 292, link section 12�[0m
[00:00:18.826,000] �[1;31m<err> llext: Failed to link, ret -61�[0m
Failed to load sketch, rc -61

but if I add it in the core does not compile as I mentioned. Catch 22.

@mjs513
Copy link
Author

mjs513 commented Dec 29, 2024

Saw this for the Nicola_vision:

if BT

choice AIROC_PART
	default CYW4343W
endchoice

choice CYW4343W_MODULE
	default CYW4343W_MURATA_1DX
endchoice

so how does that get incorporated for arduino_core?

PS Moved the entropy generator conf to the m7.conf file.

ANSWER:
#CONFIG_CYW4343W=y
CONFIG_CYW4343W_MURATA_1DX=y

@mjs513 mjs513 changed the title Arduino GIGA BT not working` GIGA: Enabling BT in Core fails to compile. Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant