Skip to content

Feature/segger rtt sysview#449

Open
pogadam7 wants to merge 4 commits intoalifsemi:mainfrom
pogadam7:feature/segger_rtt_sysview
Open

Feature/segger rtt sysview#449
pogadam7 wants to merge 4 commits intoalifsemi:mainfrom
pogadam7:feature/segger_rtt_sysview

Conversation

@pogadam7
Copy link
Copy Markdown

Summary

This pull request enhances tracing support for Alif Ensemble SoCs and improves the SEGGER SystemView integration in Zephyr. The main changes add support for SEGGER RTT, enable richer system descriptions (including ISR name mappings), and provide a user hook for custom SystemView descriptions.

Tracing and debug improvements:

  • Added HAS_SEGGER_RTT selection to both RTSS_HE and RTSS_HP SoC configurations in Kconfig, enabling SEGGER RTT support for these cores. [1] [2]
  • In sysview_config.c, included symbol table and ISR table headers when CONFIG_SYMTAB is enabled, preparing for symbol-based features.
  • Enhanced the SystemView system description callback (cbSendSystemDesc) to emit IRQ name mappings when CONFIG_SYMTAB is enabled, improving traceability of interrupts in SystemView.

Extensibility:

  • Introduced a weakly-defined sysview_app_send_sys_desc() function as a user hook, allowing applications to inject additional SystemView system description strings (e.g., custom IRQ mappings) without modifying Zephyr core code.

pogadam7 and others added 3 commits March 27, 2026 14:18
Both HP and HE cores support segger RTT.

Signed-off-by: Adam Pogonyi <adam.pogonyi@arm.com>
With symtab enabled, the isr name is collected by symbol table

Signed-off-by: WenBin Zhang <freey7955@gmail.com>
Add user config hook to inject customm descriptors into sysview.

Signed-off-by: Adam Pogonyi <adam.pogonyi@arm.com>
@VeijoPesonen VeijoPesonen requested a review from a team March 30, 2026 10:07
@RupeshKumar-AlifSemi RupeshKumar-AlifSemi requested review from Copilot and removed request for Copilot April 1, 2026 07:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves SEGGER SystemView tracing integration by enabling SEGGER RTT on Alif Ensemble RTSS cores and enriching SystemView’s system description output (including optional IRQ-to-name mappings), while also adding an application hook for custom system description strings.

Changes:

  • Enable HAS_SEGGER_RTT for Alif Ensemble RTSS_HE and RTSS_HP SoC configs.
  • Extend cbSendSystemDesc() to emit IRQ name mappings when CONFIG_SYMTAB is enabled.
  • Add a weak sysview_app_send_sys_desc() hook for applications to append SystemView system-description entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
subsys/tracing/sysview/sysview_config.c Adds optional symbol-based IRQ name emission to SystemView sys-desc and introduces an app hook for extensibility.
soc/alif/ensemble/Kconfig Selects HAS_SEGGER_RTT for RTSS cores to enable RTT-based tracing support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
const char *name = symtab_find_symbol_name((uintptr_t)entry->isr, NULL);

snprintf(isr_desc, SEGGER_SYSVIEW_MAX_STRING_LEN, "I#%d=%s", idx + 16, name);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idx + 16 IRQ number offset is hard-coded and will produce incorrect IRQ numbering on architectures (or configurations) where the external IRQ vector base is not 16. Use the platform/configured IRQ vector base (e.g., CONFIG_GEN_IRQ_START_VECTOR on platforms that provide it, or an appropriate Zephyr/arch macro) instead of a literal 16 so the mapping matches the real vector numbering.

Copilot uses AI. Check for mistakes.
continue;
}
const char *name = symtab_find_symbol_name((uintptr_t)entry->isr, NULL);

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

symtab_find_symbol_name() may return NULL when no symbol is found. Passing a NULL pointer to %s is not portable and can crash on some C libraries/targets. Add a fallback (e.g., skip emitting the mapping, or use a placeholder like "unknown") when name == NULL.

Suggested change
if (name == NULL) {
name = "unknown";
}

Copilot uses AI. Check for mistakes.
SEGGER_SYSVIEW_SendSysDesc("O=Zephyr");

#ifdef CONFIG_SYMTAB
char isr_desc[SEGGER_SYSVIEW_MAX_STRING_LEN];
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Zephyr, using snprintk() (and sizeof(isr_desc) / ARRAY_SIZE(isr_desc) for the buffer size) is typically preferred over snprintf() to avoid pulling in heavier libc formatting and to match common Zephyr patterns in constrained builds. This also removes dependence on SEGGER_SYSVIEW_MAX_STRING_LEN matching the actual buffer size.

Copilot uses AI. Check for mistakes.
}
const char *name = symtab_find_symbol_name((uintptr_t)entry->isr, NULL);

snprintf(isr_desc, SEGGER_SYSVIEW_MAX_STRING_LEN, "I#%d=%s", idx + 16, name);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Zephyr, using snprintk() (and sizeof(isr_desc) / ARRAY_SIZE(isr_desc) for the buffer size) is typically preferred over snprintf() to avoid pulling in heavier libc formatting and to match common Zephyr patterns in constrained builds. This also removes dependence on SEGGER_SYSVIEW_MAX_STRING_LEN matching the actual buffer size.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to move to snprintk but that would diverge the code from the upstream zephyr. Code owners shall decide.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@VeijoPesonen
Copy link
Copy Markdown
Contributor

@pogadam7 Please squash the Copilot changes.

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.

4 participants