Skip to content

Conversation

karstenkoenig
Copy link
Contributor

The coresight subsystem for the Nordic Haltium family of devices is a combination of different coresight modules that can be used in combination for logging, data tracing, instruction tracing etc.
This adds a driver and bindings for the coresight subsystem that powers and then applies a configuration based on a selected operating mode. It replaces the previous system where the configuration was applied by a closed-source firmware bit.

This also adds the needed pinctrl handling for trace pins.
Furthermore the existing samples and snippets are adjusted accordingly.

Copy link
Contributor

@nordic-krch nordic-krch left a comment

Choose a reason for hiding this comment

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

Looks ok. One more thing that might be added is early logging on app. On sdfw there was a RAM buffer (CONFIG_LOG_FRONTEND_STMESP_EARLY_BUF_SIZE!=0) that was collecting logging data and flushing it to STM when system notified that ETR is ready. using log_frontend_stmesp_etr_ready(). Now it should be done on app but it can be added later as well.

}
}

err = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT);
Copy link
Contributor

Choose a reason for hiding this comment

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

Recently I wanted to use DWT->CYCCNT for accurate code execution measurement. On nrf54hx I had to power up TDD (or use debug session). I wonder if there are other use cases where app would like to power up TDD. Maybe there should be tdd-on-only default mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good idea, you are right there is quite a bit in the coresight subsystem that'd be nice to use without having to handle a full blown mode (beyond power up tdd and pinctrl) in the coresight driver. This will also be convenient to use with ETM, as there coresight can be configured externally from a debugger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added CORESIGHT_NRF_MODE_UNCONFIGURED to indicate coresight subsystem is active but unconfigured, so that pinctrl and tdd power are handled, but the coresight peripherals themselves remain at reset values

Copy link
Contributor

@masz-nordic masz-nordic left a comment

Choose a reason for hiding this comment

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

Driver should be using HAL and fixups should be added to the nrfx.

@karstenkoenig
Copy link
Contributor Author

Driver should be using HAL and fixups should be added to the nrfx.

You mean the nrf hal? There is no nrf hal for the coresight peripherals, these aren't nordic IPs, they come from ARM.

How about I add a coresight.h header where the coresight peripherals are defined in an MDK like fashion but no reference to NRF types but instead ARM__Type? Could I then write straight to such ARM_ structs in the coresight_nrf.c driver or would I still need to add an extra hal layer to set fields?

@masz-nordic
Copy link
Contributor

Sounds good, then the driver could be vendor-agnostic - coresight_arm.c.

@nordic-krch
Copy link
Contributor

@JarmouniA JarmouniA added the platform: ARM Arm Limited label Sep 2, 2025
@JarmouniA JarmouniA requested a review from wearyzen September 2, 2025 08:11
@karstenkoenig
Copy link
Contributor Author

for STMESP I did https://github.com/zephyrproject-rtos/zephyr/blob/8d508a2f94970561b696a87feb35132c4a9dcc1a/include/zephyr/drivers/misc/coresight/stmesp.h.

Yes I am looking into something like this for the coresight peripherals. I was going to do something without structs for the register map but OFFSET definitions but this actually does look nicer, so I'll change it to that.

Are the funnels architecture in TDD Nordic specific?

The funnels aren't nordic specific, but the way the whole trace and debug domain is setup is highly nordic specific, so the way all the different funnel and replicators link together various trace data sources and sinks. So I still plan to have a coresight_nrf that just configures all of those in one go and assume this design will hold for other users as well.

tmon-nordic
tmon-nordic previously approved these changes Oct 7, 2025
@karstenkoenig karstenkoenig force-pushed the coresight_on_app_zephyr branch from 324b0a4 to 4191458 Compare October 7, 2025 09:58
nordic-krch
nordic-krch previously approved these changes Oct 7, 2025
@karstenkoenig
Copy link
Contributor Author

Looks good to me. You may want to add a migration guide entry for the renamed ETR Kconfig options?

Added an entry into the migration guide for it

@zephyrbot zephyrbot requested a review from nordic-krch October 7, 2025 10:00
Migration guide for the move of drivers/misc/nrf_etr to
drivers/debug/debug_nrf_etr.

Signed-off-by: Karsten Koenig <[email protected]>
Pinctrl needs to set the needed drive and direction of the pins. Also
this later allows automatically setting the clock bit for the traceclk
pin.

Signed-off-by: Karsten Koenig <[email protected]>
Added driver and bindings for the coresight nrf submodule.
add integrated it for the nrf54h20.
The coresight subsystem is a combination of ARM Coresight peripherals
that get configured together to achieve a simplified configuration based
on a desired operating mode.

This also replaces the previous handling in the nrf54h20 soc.c which was
powering the subsystem up but not configuring it.

Signed-off-by: Karsten Koenig <[email protected]>
Replaced the old tddconf with the full coresight driver that configures
the coresight peripherals locally on the running core.
Also fixed minor bug in the corresponding sample where messages were not
shown for the radio core.

Signed-off-by: Karsten Koenig <[email protected]>
Make sure the nordic_vpr_launcher gets started after the coresight
driver if that is present.

Signed-off-by: Karsten Koenig <[email protected]>
Added a new convience snippet to redirect logs to STM and then sink them
to TPIU where they can be captured by a trace probe.

Signed-off-by: Karsten Koenig <[email protected]>
The JLinkScript originally configured more than needed which reduces
readability, so stripped it down to the minimum.
At the same time improved behavior under reset and added ETM to the
radiocore JLinkScript.

Signed-off-by: Karsten Koenig <[email protected]>
@karstenkoenig karstenkoenig dismissed stale reviews from nordic-krch and tmon-nordic via 48d90ba October 7, 2025 11:32
@karstenkoenig karstenkoenig force-pushed the coresight_on_app_zephyr branch from 4191458 to 48d90ba Compare October 7, 2025 11:32
Copy link

sonarqubecloud bot commented Oct 7, 2025

@nordic-krch nordic-krch self-assigned this Oct 8, 2025
@kartben
Copy link
Contributor

kartben commented Oct 8, 2025

@nordic-krch there were already 3 assignees on this, can you please document and elaborate on why you self-assigned?

@nordic-krch
Copy link
Contributor

@kartben I was the initial author of coresight/STM Nordic support in Zephyr so most of modified files are were created by me. I don't think that @anangl @masz-nordic @bjarki-andreasen have much expertise in that area so I would not expect a review from them.

@nordic-krch
Copy link
Contributor

I should probably have added myself as the maintainer before.

@kartben kartben merged commit a50dc9f into zephyrproject-rtos:main Oct 8, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.