I'm getting the following error at compile time:
/home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:405:17: error: redefinition of '__log_current_const_data' 405 | __log_current_const_data __unused = \ | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/src/main.c:37:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 37 | LOG_MODULE_REGISTER(bikeFinderInfo,LOG_LEVEL_INF); | ^~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:405:17: note: previous definition of '__log_current_const_data' with type 'const struct log_source_const_data *' 405 | __log_current_const_data __unused = \ | ^~~~~~~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/nrf/subsys/bluetooth/services/bas_client.c:14:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 14 | LOG_MODULE_REGISTER(bas_client, CONFIG_BT_BAS_CLIENT_LOG_LEVEL); | ^~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:411:17: error: redefinition of '__log_current_dynamic_data' 411 | __log_current_dynamic_data __unused = \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/src/main.c:37:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 37 | LOG_MODULE_REGISTER(bikeFinderInfo,LOG_LEVEL_INF); | ^~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:411:17: note: previous definition of '__log_current_dynamic_data' with type 'struct log_source_dynamic_data *' 411 | __log_current_dynamic_data __unused = \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/nrf/subsys/bluetooth/services/bas_client.c:14:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 14 | LOG_MODULE_REGISTER(bas_client, CONFIG_BT_BAS_CLIENT_LOG_LEVEL); | ^~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:417:31: error: redefinition of '__log_level' 417 | static const uint32_t __log_level __unused = \ | ^~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/src/main.c:37:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 37 | LOG_MODULE_REGISTER(bikeFinderInfo,LOG_LEVEL_INF); | ^~~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:417:31: note: previous definition of '__log_level' with type 'uint32_t' {aka 'const unsigned int'} 417 | static const uint32_t __log_level __unused = \ | ^~~~~~~~~~~ /home/ernesto/ncs/v2.2.0-rc1/zephyr/include/zephyr/logging/log.h:370:9: note: in expansion of macro 'LOG_MODULE_DECLARE' 370 | LOG_MODULE_DECLARE(__VA_ARGS__) | ^~~~~~~~~~~~~~~~~~ /home/ernesto/ncs/bike_finder/nrf/subsys/bluetooth/services/bas_client.c:14:1: note: in expansion of macro 'LOG_MODULE_REGISTER' 14 | LOG_MODULE_REGISTER(bas_client, CONFIG_BT_BAS_CLIENT_LOG_LEVEL); | ^~~~~~~~~~~~~~~~~~~
In my main, I'm using the following code (reduced to the relevant part):
#include <zephyr/kernel.h> #include <zephyr/types.h> #include <stddef.h> #include <string.h> #include <errno.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/gpio.h> #include <soc.h> #include <zephyr/logging/log.h> #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 "../services/buzzer_service.h" #include <nrfx_pwm.h> #include <bluetooth/services/bas_client.h> #include <nrf/subsys/bluetooth/services/bas_client.c> #include "../battery_measurement/battery.h" LOG_MODULE_REGISTER(bikeFinderInfo,LOG_LEVEL_INF); struct bt_conn *bt_app_conn; static struct bt_bas_client bas; /*...*/
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <zephyr/kernel.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/adc.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/device.h> #include <zephyr/devicetree.h> #include "battery.h" #define LOG_LEVEL CONFIG_BT_BAS_LOG_LEVEL LOG_MODULE_REGISTER(BATTERY,CONFIG_ADC_LOG_LEVEL); #define BATTERY_ADC_GAIN ADC_GAIN_1_5 #define ZEPHYR_USER DT_PATH(zephyr_user) /*...*/
I'm also using the bas_client.h to couple my battery.{h,c} ADC measurement functions to the bas_client service.
What can I do to solve this?