Skip to content

drivers: gpio: System View Tracing port direction argument mismatch #104589

@prassanna-adi

Description

@prassanna-adi

Describe the bug

Target: MAX32670
Zephyr version: 4.3.0

Using SEGGER RTT SystemView for event trace and building the code with -S rtt-tracing gives me argument mismatch error that requires 3 arguments instead of 2 for SYS_PORT_TRACING_FUNC_EXIT() macro in include/zephyr/drivers/gpio/gpio.h.

Regression

  • This is a regression.

Steps to reproduce

Steps to reproduce this error:

  • prj.conf
CONFIG_SEGGER_SYSTEMVIEW=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_TRACING=y
  • west build -S rtt-tracing

Relevant log output

/home/developer/zephyr/include/zephyr/drivers/gpio.h:1109:8: error: macro "sys_port_trace_gpio_port_get_direction_exit" requires 3 arguments, but only 2 given
 1109 |                 SYS_PORT_TRACING_FUNC_EXIT(gpio_port, get_direction, port, -ENOSYS);
      | ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/developer/zephyr/include/zephyr/tracing/tracing.h:20,
                 from /home/developer/zephyr/include/zephyr/drivers/gpio.h:23:
/home/developer/zephyr/subsys/tracing/sysview/./tracing_sysview.h:838: note: macro "sys_port_trace_gpio_port_get_direction_exit" defined here
  838 | #define sys_port_trace_gpio_port_get_direction_exit(port, map, ret)
      | 
In file included from /home/developer/zephyr/include/zephyr/sys/util_macro.h:34,
                 from /home/developer/zephyr/include/zephyr/irq_multilevel.h:16,
                 from /home/developer/zephyr/include/zephyr/devicetree.h:20,
                 from /home/developer/zephyr/include/zephyr/device.h:12,
                 from /home/developer/ferry-basin-zephyr/firmware/Pal/PalGpio/PalGpio.c:20:
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:58:9: error: 'sys_port_trace_gpio_port_get_direction_exit' undeclared (first use in this function)
   58 |         sys_port_trace_ ## name ## _ ## func ## _exit
      |         ^~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
   72 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   64 |         __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |         ^~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE'
   59 |         __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_macro.h:204:9: note: in expansion of macro 'Z_COND_CODE_1'
  204 |         Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:220:9: note: in expansion of macro 'COND_CODE_1'
  220 |         COND_CODE_1(_SYS_PORT_TRACE_IS_DISABLED(type), (),                                         \
      |         ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:221:22: note: in expansion of macro '_SYS_PORT_TRACE_WRAP'
  221 |                     (_SYS_PORT_TRACE_WRAP(func, __VA_ARGS__)))
      |                      ^~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:284:9: note: in expansion of macro '_SYS_PORT_TRACE_IF_NOT_DISABLED'
  284 |         _SYS_PORT_TRACE_IF_NOT_DISABLED(type, _SYS_PORT_TRACING_FUNC_EXIT(type, func), __VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:284:47: note: in expansion of macro '_SYS_PORT_TRACING_FUNC_EXIT'
  284 |         _SYS_PORT_TRACE_IF_NOT_DISABLED(type, _SYS_PORT_TRACING_FUNC_EXIT(type, func), __VA_ARGS__)
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/drivers/gpio.h:1109:17: note: in expansion of macro 'SYS_PORT_TRACING_FUNC_EXIT'
 1109 |                 SYS_PORT_TRACING_FUNC_EXIT(gpio_port, get_direction, port, -ENOSYS);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:58:9: note: each undeclared identifier is reported only once for each function it appears in
   58 |         sys_port_trace_ ## name ## _ ## func ## _exit
      |         ^~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
   72 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   64 |         __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |         ^~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_internal.h:59:9: note: in expansion of macro '__COND_CODE'
   59 |         __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/sys/util_macro.h:204:9: note: in expansion of macro 'Z_COND_CODE_1'
  204 |         Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:220:9: note: in expansion of macro 'COND_CODE_1'
  220 |         COND_CODE_1(_SYS_PORT_TRACE_IS_DISABLED(type), (),                                         \
      |         ^~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:221:22: note: in expansion of macro '_SYS_PORT_TRACE_WRAP'
  221 |                     (_SYS_PORT_TRACE_WRAP(func, __VA_ARGS__)))
      |                      ^~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:284:9: note: in expansion of macro '_SYS_PORT_TRACE_IF_NOT_DISABLED'
  284 |         _SYS_PORT_TRACE_IF_NOT_DISABLED(type, _SYS_PORT_TRACING_FUNC_EXIT(type, func), __VA_ARGS__)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/tracing/tracing_macros.h:284:47: note: in expansion of macro '_SYS_PORT_TRACING_FUNC_EXIT'
  284 |         _SYS_PORT_TRACE_IF_NOT_DISABLED(type, _SYS_PORT_TRACING_FUNC_EXIT(type, func), __VA_ARGS__)
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/drivers/gpio.h:1109:17: note: in expansion of macro 'SYS_PORT_TRACING_FUNC_EXIT'
 1109 |                 SYS_PORT_TRACING_FUNC_EXIT(gpio_port, get_direction, port, -ENOSYS);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/include/zephyr/drivers/gpio.h:1119:8: error: macro "sys_port_trace_gpio_port_get_direction_exit" requires 3 arguments, but only 2 given
 1119 |         SYS_PORT_TRACING_FUNC_EXIT(gpio_port, get_direction, port, ret);
      | ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developer/zephyr/subsys/tracing/sysview/./tracing_sysview.h:838: note: macro "sys_port_trace_gpio_port_get_direction_exit" defined here
  838 | #define sys_port_trace_gpio_port_get_direction_exit(port, map, ret)
      |

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

OS: Linux
SDK: Zephyr
Zephyr SHA: 3568e1b

Additional Context

I have a patch that can fix this issue.

sysview_gpio.patch

Metadata

Metadata

Labels

area: Segger RTTSEGGER RTT (Real Time Transfer)area: TracingTracingbugThe issue is a bug, or the PR is fixing a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions