zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.96k stars 6.68k forks source link

Compile error when using networking and SystemView Tracing #79805

Closed G-Foote closed 1 month ago

G-Foote commented 1 month ago

Describe the bug

Adding CONFIG_NETWORKING to a project that has SEGGER SystemView tracing enabled causes compile errors.

Board: stm32h573i_dk

To Reproduce

Update Zephyr to SHA:52540d84126

cd zephyr/

Add SystemView configuration to samples/synchronization/prj.conf

CONFIG_STDOUT_CONSOLE=y
CONFIG_DEBUG=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_THREAD_NAME=y
CONFIG_SCHED_CPU_MASK=y
CONFIG_THREAD_ANALYZER=y
CONFIG_DEBUG_THREAD_INFO=y

CONFIG_SEGGER_SYSTEMVIEW=y
CONFIG_USE_SEGGER_RTT=y 
CONFIG_TRACING=y
CONFIG_TRACING_BACKEND_RAM=y 
CONFIG_THREAD_STACK_INFO=y

west build --board=stm32h573i_dk samples/synchronization/

Project builds. Flashed to board and SystemView behaves as expected.

Add networking to config:

CONFIG_NETWORKING=y

Rebuild gives multiple compile errors from undefined references e.g.

zephyr/subsys/net/ip/net_if.c:281: undefined reference to 'sys_port_trace_net_tx_time'

Expected behavior Project builds successfully and allows tracing of networking calls.

Impact Showstopper - we need to be able to trace networking calls to debug issue with mDNS resolution.

Logs and console output

zephyr/subsys/net/ip/net_if.c:281: undefined reference to `sys_port_trace_net_tx_time'

zephyr/subsys/net/ip/net_core.c:370: undefined reference to `sys_port_trace_net_send_data_enter'

zephyr/subsys/net/ip/net_core.c:427: undefined reference to `sys_port_trace_net_send_data_exit'

zephyr/subsys/net/ip/net_core.c:493: undefined reference to `sys_port_trace_net_recv_data_enter'

zephyr/subsys/net/ip/net_core.c:532: undefined reference to `sys_port_trace_net_recv_data_exit'

Environment (please complete the following information):

Additional context Disabling networking tracing with CONFIG_TRACING_NETWORKING=n has no effect.

Having a look at the code, it looks like they are expected to be defined here tracing_sysview.h. It's included from tracing.h when CONFIG_SEGGER_SYSTEMVIEW is set.

github-actions[bot] commented 1 month ago

Hi @G-Foote! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

nashif commented 1 month ago

@jukkar can you take a look? seems like you missed the hooks for systemview when you did the networking tracing support

jukkar commented 1 month ago

Sure, I will fix this asap.