Skip to content

V2.2.1 - #130

Open
RainerZ wants to merge 116 commits into
vectorgrp:masterfrom
RainerZ:V2.2.1
Open

V2.2.1#130
RainerZ wants to merge 116 commits into
vectorgrp:masterfrom
RainerZ:V2.2.1

Conversation

@RainerZ

@RainerZ RainerZ commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

XCP on UDP - RAW ethernet and CMP HAL support

Replaced fragile definition of _GNU_SOURCE in platform.h with a guard
…API header files. Requires XCPLITE_CONFIGURATION and XCPLIB_CFG_OVERRIDE to be public in CMakeLists.txt.
RainerZ and others added 30 commits September 6, 2026 20:43
    - Improved variable registration for global and static variables
    - Global variables and local static variables in functions without event trigger are registered, but not associated to any specific default DAQ event
    - no_a2l_demo, no_a2l_demo_cpp: more demo cases
… scopes (ELF->A2L)

- Struct/class types with the same DWARF name in different namespaces, classes or
  functions get scope qualified typedef names (motor_control.Input, valve_control.Input).
  Previously all variables of such types referenced the first registered typedef and
  were shown with the wrong type.
- Typedefs with identical content are merged (same type in several compilation units),
  a name still used by different content gets a numeric suffix. A type used for
  measurement and for calibration variables gets separate typedefs.
- Global variables with the same name in different namespaces get namespace qualified
  instance names instead of being dropped as duplicates.
- GCC declaration/definition entry pairs of namespace scope variables are merged.
- Symbol table address resolution: mangled names for namespace scope statics without
  DWARF location, only local symbols for function local variables (no more stack
  variables mapped onto same-named globals).
- Metadata macros in the same namespace or function as the variable need no scope
  prefix (XCP_COMMENT(input, ...) in namespace motor_control annotates
  motor_control.input), explicit prefixes keep working. Metadata for typedef fields
  of namespace qualified instances.
- Fixture cpp_namespaces.elf and unit tests, README, TECHNICAL.md and CHANGELOG updated.
- no_a2l_demo_cpp: same-named types and variables in namespaces with XCP_COMMENT,
  volatile test_array, regenerated CANape A2L/ELF.
- xcpclient version 3.0.10

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…fixtures and tests

- DebugData::qualified_type_names is filled once after the types are loaded: it follows
  const/volatile qualifiers to the named type, finds the names used in more than one
  scope and stores the dotted name for those types only. DebugData::get_type_name
  returns it or the plain DWARF name; register_struct keeps only the content
  signature and the numeric suffix. No change in the generated A2L files.
- cpp_namespaces.cpp: volatile and const qualified variables of the colliding Input types
- c_local_types_a.c/_b.c: struct tags with the same name but different content in two
  compilation units, registered as state and state_1
- cpp_type_name_collisions.cpp: fixture contributed with pull request
  vectorgrp#126
- Unit tests for the three fixtures and for the qualified names at DWARF level

Co-Authored-By: Pamir Mundt and Claude Fable 5.1
TECHNICAL.md restructured
Different READMEs updated
# Conflicts:
#	CHANGELOG.md
#	src/platform.c
Fixed older protocol layer versions
Restore dropped the CMP CHANGELOG entries
Changed several places still describing the old MTU convention
Added MTU check to lwip sendto

Version aligned to 2.2.1 in CMakeLists.txt and in OPTION_VERSION_MAJOR/_MINOR/_PATCH in xcplib_cfg.h
…ddress size of the ELF file

- .debug_frame and .eh_frame were parsed with the 8 byte address size of the host, which produced
  unusable frame descriptions for ARM and Xtensa targets and a CFA offset of 0 by accident
- Xtensa (ESP32): CFA offset 0 by design, the trigger macros pass the CFA itself
  (__builtin_dwarf_cfa()), verified on ESP32-S3 with freertos_esp32_demo
- ARM Cortex-M: the stack frame relative addresses of local variables change, the frame pointer
  to CFA distance is added now, to be verified with freertos_stm32_demo
- Location expressions which can not be evaluated (registers, entry values, optimized code in
  other compilation units) and variables without a name are logged at debug level
- Frame address convention documented in TECHNICAL.md and OFFLINE_A2L.md
…cope pins enabled by default, ADS1115 optional
…iables in generated A2L files

- register_variables takes the default event: global variables and static variables in
  functions without an event trigger get it as default event (DAQ_EVENT VARIABLE with
  DEFAULT_EVENT_LIST), stack variables and statics with a trigger keep their fixed event
- The default event id is checked against the registry, an unknown id is reported
- Unit test with the C++ fixture, README usage and example, CHANGELOG and OFFLINE_A2L.md
- Verified on ESP32-S3: A2L created with --default-event 1, global_counter measured with it
…tos_esp32_demo remote A2L generator scripts

Improved xcpclient error handling and exitcode
… event trigger

- Location lists referenced by index (DW_FORM_loclistx, clang) are evaluated like the
  location lists of DWARF 4, they were reported as unexpected location attributes
- A location list is accepted only if all its entries describe the same memory location,
  the trigger point of the event is not known. Previously the first memory location in
  the list was used, which may be valid only in a part of the function
- A variable in a register or with changing locations is reported as not measurable,
  like a register location, and not looked up in the symbol table by name. Returning
  no location matched a local variable to the xcp_meta__unit__ marker symbol of the
  same name suffix and registered a bogus measurement
- New attribute macro XCP_NOINLINE in xcplib.h for functions which trigger an event and
  measure their local variables, used by foo() in no_a2l_demo and no_a2l_demo_cpp.
  The xcpclient warning for inlined functions and docs/OFFLINE_A2L.md refer to it
- Verified with no_a2l_demo (clang, aarch64) and freertos_emu_demo (GCC -O1, location
  lists): measurement names and addresses unchanged
…tions

Function scope XCP_COMMENT/XCP_UNIT markers are static const variables without
DWARF location, their address is resolved from the symbol table. The unique
suffix search became ambiguous as soon as several functions defined a marker
with the same name, all of them were dropped with address 0.
…A parser

Clang emits DWARF 5 with DW_FORM_addrx for DW_AT_low_pc and DW_FORM_strx for
names. The CFA parser only handled the direct forms, every function of such a
build was skipped silently and all events got a stack frame offset of 0, the
stack relative variable addresses were wrong.
…ros changed,

- xcp_get_frame_addr() passes the frame base the compiler uses in the DWARF locations of the local variables: __builtin_frame_address(0) under clang (frame pointer register).
- __builtin_dwarf_cfa() under GCC on every architecture, Xtensa special case removed.
- xcpclient uses the DW_OP_fbreg offsets of the local variables without correction and
  checks the frame base (DW_AT_frame_base) of the function of every event trigger. A frame
  base which is neither the CFA nor the frame pointer register, e.g. the stack pointer of a
  function without frame pointer under clang, gets a warning and its stack relative
  variables are not registered.
- The call frame information parser in xcpclient (cfa.rs) is removed. Its heuristics were wrong for
  clang builds, where the frame base is the frame pointer and nothing needs to be added, and
  for GCC AArch64 functions whose frame record is not at the stack pointer.
- New macros DaqTriggerEventCapture, DaqTriggerEventCaptureAt and
  DaqCreateAndTriggerEventCapture in xcplib.h. They declare a struct cap__<event> in the
  function, copy the given local variables into it when the event is triggered and pass
  its address as the base address of address extension 3, marker trg__AASR__<event>.
  The originals stay in their registers, the copy of a scalar is one store instruction
- xcpclient registers the members of the capture struct as measurements named
  <function>.<member> with the event of the trigger as fixed event and the offset of the
  member as address. A captured variable is not registered again as a stack variable
- Captured variables do not depend on the stack frame, so a function which captures may
  be inlined. The diagnostics about the stack frame of a trigger function are reported
  only when it has stack frame relative variables which are not captured
- The unimplemented DaqCapture macro, which copied into a hidden static, is removed
…ixed

- The capture macros work in C++ as well. The struct member of a captured variable is
  declared through a pointer to the variable now, in both languages: a member whose type
  expression names a variable of the same name changes the meaning of that name inside
  the class scope, which GCC rejects in C++
- In C++ the pointer removes the const qualifier and resolves a reference to the object
  it refers to, so a const variable and a reference can be captured there. The member
  type is the type of the variable, no helper type of the macro appears in the A2L file
- xcpclient registers captured variables of struct or union type, which were skipped as
  an unsupported type: a member of such a type refers to the loaded type instead of
  repeating it.
…r xcp::cap_ptr in

  C++, so no helper type appears as the type of a capture struct member: clang recorded
  the alias std::remove_const_t<T> as the member type, which ended up as the name of the
  TYPEDEF_STRUCTURE of a captured struct in the A2L file
…re structs with a simple member renaming concept

const capability lost in C++, but was not worth the price (stack consumption)
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

Successfully merging this pull request may close these issues.

1 participant