Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

undefined reference to LOG_DBG showing after enabling in menuconfig SEGGERSTUDIO ZEPHYR & general question about application callbacks BT

Hey all

Board:
NRF53840 DK

ERROR: 
Building ‘zephyr/zephyr_prebuilt.elf’ from solution ‘build’ in configuration ‘Common’
undefined reference to `LOG_DBG' (to any area that uses it) <error appears in hci_core.c> 

steps i've taken:
1) https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_BT_LOG_LEVEL_DBG.html
2) Menu path: (Top) → Sub Systems and OS Services → Bluetooth → Max compiled-in log level for bt
3) change to debug for both the network and applicaiton kconfig

4) also changed my kconfig overlay file to add it all in

# BEGIN Configurations from basic/minimal

CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_LBS"
#####################################
# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y
#####################################
# Drivers and peripherals
CONFIG_I2C=y
#CONFIG_I2C=n

CONFIG_WATCHDOG=n

CONFIG_GPIO=y
#CONFIG_GPIO=n

CONFIG_PINMUX=n

CONFIG_SPI=n

#CONFIG_SERIAL=n

#####################################
# Power management
CONFIG_PM=n
#####################################
# Interrupts
CONFIG_DYNAMIC_INTERRUPTS=n
CONFIG_IRQ_OFFLOAD=n
#####################################
# Memory protection
CONFIG_THREAD_STACK_INFO=n
CONFIG_THREAD_CUSTOM_DATA=n
CONFIG_FPU=n
#####################################
# Boot
CONFIG_BOOT_BANNER=n
CONFIG_BOOT_DELAY=0
#####################################
# Console
#CONFIG_CONSOLE=n
#CONFIG_UART_CONSOLE=n
CONFIG_STDOUT_CONSOLE=n
#CONFIG_PRINTK=n
CONFIG_EARLY_CONSOLE=n
#####################################
# Build
CONFIG_SIZE_OPTIMIZATIONS=y
#####################################
# ARM
CONFIG_ARM_MPU=n
# END Configurations from basic/minimal

##########################################################################

# In order to correctly tune the stack sizes for the threads the following
# Configurations can enabled to print the current use:
CONFIG_THREAD_NAME=y
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
CONFIG_THREAD_ANALYZER_USE_PRINTK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_PRINTK=y

CONFIG_BT_DEBUG_HCI_CORE=y

# Example output of thread analyzer
# SDC RX              : unused 816 usage 208 / 1024 (20 %)
# BT RX               : unused 1784 usage 416 / 2200 (18 %)
# BT TX               : unused 992 usage 544 / 1536 (35 %)
# thread_analyzer     : unused 136 usage 376 / 512 (73 %)
# sysworkq            : unused 1824 usage 224 / 2048 (10 %)
# MPSL signal         : unused 520 usage 504 / 1024 (49 %)
# idle 00             : unused 192 usage 64 / 256 (25 %)
# main                : unused 136 usage 888 / 1024 (86 %)
# Configurations set based on thread analyzer output.
CONFIG_SDC_RX_STACK_SIZE=324
CONFIG_BT_RX_STACK_SIZE=1024
CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
CONFIG_BT_HCI_TX_STACK_SIZE=640
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=256
CONFIG_MPSL_SIGNAL_STACK_SIZE=640
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_IDLE_STACK_SIZE=128
CONFIG_ISR_STACK_SIZE=1024

# Disable features not needed
CONFIG_TIMESLICING=n
CONFIG_MINIMAL_LIBC_MALLOC=n
CONFIG_LOG=y
CONFIG_ASSERT=n

# Disable Bluetooth features not needed
CONFIG_BT_DEBUG_NONE=n
CONFIG_BT_ASSERT=n
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_GATT_CACHING=n
CONFIG_BT_GATT_SERVICE_CHANGED=n
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y
CONFIG_BT_HCI_VS_EXT=n

# Disable Bluetooth controller features not needed
CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_CTLR_PHY_2M=n

# Reduce Bluetooth buffers
CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43
CONFIG_BT_BUF_EVT_RX_COUNT=2

CONFIG_BT_CONN_TX_MAX=2
CONFIG_BT_L2CAP_TX_BUF_COUNT=2
CONFIG_BT_CTLR_RX_BUFFERS=1
CONFIG_BT_BUF_ACL_TX_COUNT=3
CONFIG_BT_BUF_ACL_TX_SIZE=27


After enabling it and runing cmake i still get the error, what have i done wrong ?
attached the project *im modifying the peripherals_lbs, is there potentially a cleaner bt example ie bt blinky ?

Q2:
Regarding the callbacks functions like app_button_cb and app_led_cb that are called as functions in read_button and write_led.
is it just out of clean code and seperation of logic that it's organised to appear as callbacks in main ? just curious to as why it's organised to appear as a callback when it's just a function apart of the ble callbacks.

Parents
  • Hi,

    2) Menu path: (Top) → Sub Systems and OS Services → Bluetooth → Max compiled-in log level for bt
    3) change to debug for both the network and applicaiton kconfig
    4) also changed my kconfig overlay file to add it all in

    I'm sorry, I don't really understand what you mean here. Which options are you selecting in menuconfig for the app core, and which options are you selecting for the network core? It would be great if you could provide me with a list for each. 

    Regarding the callbacks functions like app_button_cb and app_led_cb that are called as functions in read_button and write_led.
    is it just out of clean code and seperation of logic that it's organised to appear as callbacks in main ? just curious to as why it's organised to appear as a callback when it's just a function apart of the ble callbacks.

    They are callbacks, because it is simply not the LED Button Service module's job to handle those events, it is up to the application how those events are handled. The LBS module also does not have access to the LEDs or buttons, as it is not meant to directly interact with them. 

  • Oh sorry if i wasnt clear. so i went off this link
    https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_BT_LOG_LEVEL_DBG.html

    so for both the app and network core i went into the 
    Sub Systems and OS Services  part
    then expanded on the bluetooth dropdown and modified the max compiled-in log level for bt to 
    debug

    i then made sure my overlay had CONFIG_DEBUG=y

    The error text:
    error text.txt


    ahhh ok thankyou for explaining it !

Reply Children
  • Could you try deleting the build folders completely, then rebuilding?

    And try adding CONFIG_BT_LOG_LEVEL_DBG=y to prj.conf instead of selecting it in menuconfig.

  • I had wiped the installation and reinstalled it.  enabled those extra configs in trhe prj conf and the error hasnt happened again. i
    it builds perfectly fine now. the only thing i can think that may of screwed it up is when i had gone and attempted to build things via west in the clone zephyr work folder as opposed to using the segger studio launcher. 

    my prj file:

    # BEGIN Configurations from basic/minimal
    
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Nordic_LBS"
    
    # Enable the LBS service
    CONFIG_BT_LBS=y
    CONFIG_BT_LBS_POLL_BUTTON=y
    CONFIG_DK_LIBRARY=y
    
    # Drivers and peripherals
    CONFIG_I2C=y
    CONFIG_WATCHDOG=n
    CONFIG_GPIO=y
    CONFIG_PINMUX=y
    CONFIG_SPI=y
    CONFIG_SERIAL=y
    
    # Power management
    CONFIG_PM=n
    
    # Interrupts
    CONFIG_DYNAMIC_INTERRUPTS=n
    CONFIG_IRQ_OFFLOAD=n
    
    # Memory protection
    CONFIG_THREAD_STACK_INFO=n
    CONFIG_THREAD_CUSTOM_DATA=n
    CONFIG_FPU=n
    
    # Boot
    CONFIG_BOOT_BANNER=n
    CONFIG_BOOT_DELAY=0
    
    # Console
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_PRINTK=y
    CONFIG_EARLY_CONSOLE=y
    
    # Build
    CONFIG_SIZE_OPTIMIZATIONS=y
    
    # ARM
    CONFIG_ARM_MPU=n
    # END Configurations from basic/minimal
    
    # In order to correctly tune the stack sizes for the threads the following
    # Configurations can enabled to print the current use:
     CONFIG_THREAD_NAME=y
     CONFIG_THREAD_ANALYZER=y
     CONFIG_THREAD_ANALYZER_AUTO=y
     CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
     CONFIG_THREAD_ANALYZER_USE_PRINTK=y
     CONFIG_CONSOLE=y
     CONFIG_UART_CONSOLE=y
     CONFIG_SERIAL=y
     CONFIG_PRINTK=y
     CONFIG_BT_LOG_LEVEL_DBG=y 
    
    # Example output of thread analyzer
    # SDC RX              : unused 816 usage 208 / 1024 (20 %)
    # BT RX               : unused 1784 usage 416 / 2200 (18 %)
    # BT TX               : unused 992 usage 544 / 1536 (35 %)
    # thread_analyzer     : unused 136 usage 376 / 512 (73 %)
    # sysworkq            : unused 1824 usage 224 / 2048 (10 %)
    # MPSL signal         : unused 520 usage 504 / 1024 (49 %)
    # idle 00             : unused 192 usage 64 / 256 (25 %)
    # main                : unused 136 usage 888 / 1024 (86 %)
    # Configurations set based on thread analyzer output.
    CONFIG_SDC_RX_STACK_SIZE=324
    CONFIG_BT_RX_STACK_SIZE=1024
    CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
    CONFIG_BT_HCI_TX_STACK_SIZE=640
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=256
    CONFIG_MPSL_SIGNAL_STACK_SIZE=640
    CONFIG_MAIN_STACK_SIZE=1024
    CONFIG_IDLE_STACK_SIZE=128
    CONFIG_ISR_STACK_SIZE=1024
    
    # Disable features not needed
    CONFIG_TIMESLICING=n
    CONFIG_MINIMAL_LIBC_MALLOC=n
    CONFIG_LOG=n
    CONFIG_ASSERT=n
    
    # Disable Bluetooth features not needed
    CONFIG_BT_DEBUG_NONE=y
    CONFIG_BT_ASSERT=n
    CONFIG_BT_DATA_LEN_UPDATE=n
    CONFIG_BT_PHY_UPDATE=n
    CONFIG_BT_GATT_CACHING=n
    CONFIG_BT_GATT_SERVICE_CHANGED=n
    CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n
    CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y
    CONFIG_BT_HCI_VS_EXT=n
    
    # Disable Bluetooth controller features not needed
    CONFIG_BT_CTLR_PRIVACY=n
    CONFIG_BT_CTLR_PHY_2M=n
    
    # Reduce Bluetooth buffers
    CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1
    CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43
    CONFIG_BT_BUF_EVT_RX_COUNT=2
    
    CONFIG_BT_CONN_TX_MAX=2
    CONFIG_BT_L2CAP_TX_BUF_COUNT=2
    CONFIG_BT_CTLR_RX_BUFFERS=1
    CONFIG_BT_BUF_ACL_TX_COUNT=3
    CONFIG_BT_BUF_ACL_TX_SIZE=27
    

    my serial output when loaded onto my device: 

  • hey after enabling https://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LOG_BACKEND_UART.html
    it fixed it and now i see quite a fair bit. few strange things going on with the uart example but il see if i can figure that out by tonight


  • Ok, great to hear!

    Sounds like the original issue is solved then, and if that's the case you should open a new ticket for any new issues.

    Good luck!

Related