Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: tracing: Add Segger RTT linker section options #53569

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

giansta
Copy link
Contributor

@giansta giansta commented Jan 6, 2023

Allows optionally placing Segger RTT data either in a specific
linker section that is located at RAM start, or in a specific linker
section defined by a memory region in DTS, as third and fourth
alternative to the DTCM section or the default data section.
This is useful to share the fixed address for different programs,
typically bootloader and application, and have seamless logging.

Signed-off-by: Giancarlo Stasi [email protected]

fixes #53544

@giansta
Copy link
Contributor Author

giansta commented Jan 6, 2023

Expected to fix #53544 with zephyrproject-rtos/segger#17 in Segger repo

@microbuilder
Copy link
Member

@nordic-krch Seems OK to me, but mind having a look since you maintain the Segger integration?

@giansta
Copy link
Contributor Author

giansta commented Jan 10, 2023

@nordic-krch Seems OK to me, but mind having a look since you maintain the Segger integration?

If you mean that the approval depends on the approval of the segger PR, I totally agree :-)

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jan 30, 2023

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@giansta giansta force-pushed the fix/rtt-cb-common-addr branch 2 times, most recently from 32093e9 to 9c52b9e Compare January 31, 2023 09:59
@giansta giansta force-pushed the fix/rtt-cb-common-addr branch from 9c52b9e to 59be1f1 Compare February 20, 2023 20:42
@nordicjm nordicjm self-requested a review March 9, 2023 16:15
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.

Can you also update west so that it points to the changes in segger repo?

@@ -74,6 +74,9 @@ config SEGGER_RTT_SECTION_NONE
config SEGGER_RTT_SECTION_DTCM
bool "Place RTT data in the DTCM linker section"

config SEGGER_RTT_SECTION_FIXED_ADDR
bool "Place RTT data in specific linker section with fixed address"
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we want default y? If bootloader is not used then it has no difference and when bootload is used then probably most users would like to get logs from bootloader and application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, done.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we could depend on the fact that we use Cortex-M here (since it's not supported by linker scripts of other architectures)?

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've added a if CPU_CORTEX_M, thanks.

@giansta giansta force-pushed the fix/rtt-cb-common-addr branch from 59be1f1 to c2e9d2d Compare March 10, 2023 21:49
@nordicjm
Copy link
Collaborator

@giansta needs rebase

@nordicjm
Copy link
Collaborator

@ioannisg @bbolen @microbuilder @povergoing @nordic-krch @MarekPieta since this is a very old PR and gets merge conflicts can you review and approve if you find it acceptable so that the module update can be merged and this is able to be merged without encountering another merge conflict?

giansta added 3 commits April 25, 2024 14:13
Allows optionally placing Segger RTT data either in a specific
linker section that is located at RAM start, or in a specific linker
section defined by a memory region in DTS, as third and fourth
alternative to the DTCM section or the default data section.
This is useful to share the fixed address for different programs,
typically bootloader and application, and have seamless logging.

Signed-off-by: Giancarlo Stasi <[email protected]>
Use recommended write API that internally locks RTT usage and checks
if the RTTcontrol block initialization is done.

Signed-off-by: Giancarlo Stasi <[email protected]>
Allows RTT inizialization function to either init Cntrol Block always
or initialize only after checking it it's not already initialized by
another program, typically by a bootloader.

Signed-off-by: Giancarlo Stasi <[email protected]>
@giansta giansta force-pushed the fix/rtt-cb-common-addr branch from a876d07 to 42f1b2c Compare April 25, 2024 12:25
@kartben
Copy link
Collaborator

kartben commented Jun 12, 2024

@nordic-krch would be good to try to get this and the associated Segger PR in for 3.7?

Copy link
Member

@cfriedt cfriedt left a comment

Choose a reason for hiding this comment

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

Definite improvement

@nordicjm nordicjm requested a review from ithinuel July 24, 2024 06:14
@cfriedt
Copy link
Member

cfriedt commented Jul 26, 2024

Was able to verify this working with a custom stm32 board, tests/boot/test_mcuboot

Also needed the wrapper here, which would also be a good reason to build something like this into west.

There is a PR for that.
#75508

@carlescufi carlescufi merged commit 19c67d5 into zephyrproject-rtos:main Aug 12, 2024
21 checks passed
@carlescufi
Copy link
Member

@giansta thanks so much for your patience.

@giansta
Copy link
Contributor Author

giansta commented Aug 12, 2024

Thanks @carlescufi! Anyway, this PR requires even zephyrproject-rtos/segger#17
I would expect it to be merged too.

@gchwier
Copy link
Collaborator

gchwier commented Aug 14, 2024

Hi, after merging this PR not working tests:

on nrf52840dk/nrf52840.
To reproduce:
${ZEPHYR_BASE}/scripts/twister -p nrf52840dk/nrf52840 -T ${ZEPHYR_BASE}/tests/subsys/dfu/img_util -s dfu.image_util --west-flash --device-testing --device-serial /dev/ttyACM0 -c -vv
output:

DEBUG   - DEVICE: Running TESTSUITE img_util
DEBUG   - DEVICE: ===================================================================
DEBUG   - DEVICE: START - test_check_flash
DEBUG   - DEVICE: ASSERTION FAIL [0] @ WEST_TOPDIR/zephyr/lib/utils/onoff.c:283
DEBUG   - DEVICE: E: r0/a1:  0x00000004  r1/a2:  0x0000011b  r2/a3:  0x00000001
DEBUG   - DEVICE: E: r3/a4:  0x00000004 r12/ip:  0x00000040 r14/lr:  0x00000871
DEBUG   - DEVICE: E:  xpsr:  0x21000000
DEBUG   - DEVICE: E: Faulting instruction address (r15/pc): 0x000074d0
DEBUG   - DEVICE: E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
DEBUG   - DEVICE: E: Current thread: 0 (unknown)
DEBUG   - DEVICE: E: Halting system
DEBUG   - Timed out while monitoring 

bisect shows that commit: 711ed08

Edit: added issue #77058

@kartben
Copy link
Collaborator

kartben commented Aug 14, 2024

@gchwier I think it might be because zephyrproject-rtos/segger#17 still hasn't been merged? cc @carlescufi

@gchwier
Copy link
Collaborator

gchwier commented Aug 14, 2024

@kartben I've used that PR and looks that it does not help, still the same issue.

brycewilkins added a commit to brycewilkins/zephyr that referenced this pull request Nov 15, 2024
Kconfig options for RTT control block initialization and linker
section were added in zephyrproject-rtos#53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
brycewilkins added a commit to brycewilkins/zephyr that referenced this pull request Nov 15, 2024
Kconfig options for RTT control block initialization and linker
section were added in zephyrproject-rtos#53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
brycewilkins added a commit to brycewilkins/zephyr that referenced this pull request Nov 15, 2024
Kconfig options for RTT control block initialization and linker
section were added in zephyrproject-rtos#53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
@brycewilkins
Copy link
Contributor

brycewilkins commented Nov 15, 2024

@giansta I hope you don't mind me trying to help (#81425) get your Segger repo PR merged! I've encountered the problems here also and would love to see this resolved. Great work!

brycewilkins added a commit to brycewilkins/zephyr that referenced this pull request Nov 15, 2024
Kconfig options for RTT control block initialization and linker
section were added in zephyrproject-rtos#53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
brycewilkins added a commit to brycewilkins/zephyr that referenced this pull request Nov 18, 2024
Kconfig options for RTT control block initialization and linker
section were added in zephyrproject-rtos#53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
nashif pushed a commit that referenced this pull request Nov 19, 2024
Kconfig options for RTT control block initialization and linker
section were added in #53569, however the Zephyr west.yml was not
updated to incorporate the Segger repository changes to make use
of the new Kconfig options.

This fixes that.

Signed-off-by: Bryce Wilkins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot see both bootloader and application RTT output