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

boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards #21860

Merged

Conversation

ulfalizer
Copy link
Collaborator

@ulfalizer ulfalizer commented Jan 13, 2020

boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards

HAS_SEGGER_RTT is assigned by various Nordic boards, but assignments
have no effect on promptless symbols. This symbol is enabled through
being select'ed by SOC_SERIES_NRF52X.

Holyiot, nRF52833-PCA10100, nRF52840-PCA10056, and nRF52-PCA10040 only
assign HAS_SEGGER_RTT without assigning USE_SEGGER_RTT. They probably
meant to enable USE_SEGGER_RTT, so do that instead.

Also add a help text to HAS_SEGGER_RTT and a warning re. HAS_SEGGER_RTT
vs. USE_SEGGER_RTT to the documentation.

Flagged by #20742.

@@ -6,8 +6,5 @@ CONFIG_BOARD_HOLYIOT_YJ16019=y
# Enable MPU
CONFIG_ARM_MPU=y

# Enable RTT
CONFIG_HAS_SEGGER_RTT=y

Copy link
Member

Choose a reason for hiding this comment

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

This should probable be CONFIG_USE_SEGGER_RTT=y since this board has no physical pins for a UART for console.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. See new PR comment.

Copy link
Member

@ioannisg ioannisg left a comment

Choose a reason for hiding this comment

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

This does not look like accidental enabling of prompt-less symbols; seems there has been a confusion among the board contributors regarding which symbol actually enables RTT.
Removing these is of course a no-op; i wonder, though, if we could replace these with the correct _USE_RTT symbol.

And since you're touching the documentation, I'd suggest to add like saying that HAS_RTT denotes platform capabilities, while _USE_RTT is the user option to use the feature..

@ulfalizer ulfalizer changed the title boards: kconfig: Do not assign promptless HAS_SEGGER_RTT sym boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards Jan 14, 2020
@ulfalizer ulfalizer added the bug The issue is a bug, or the PR is fixing a bug label Jan 14, 2020
@ulfalizer
Copy link
Collaborator Author

Yeah... I wasn't sure HAS_SEGGER_RTT was even being enabled properly for these boards, so I got a bit lazy while batch-fixing.

Turns out it is, because these are all SOC_SERIES_NRF52X, which has select HAS_SEGGER_RTT.

Did a proper fix that switches the boards that only assigned HAS_SEGGER_RTT to assign USE_SEGGER_RTT instead. Added a help text and a warning too.

See updated commit message.

@lemrey
Copy link
Collaborator

lemrey commented Jan 14, 2020

One thing is to clean up the assignment of HAS_SEGGER_RTT, another is to change that assignment to USE_SEGGER_RTT; that will change the default board configuration, right? I just built a sample for nrf52840_pca10056 and USE_SEGGER_RTT is n, this patch would change that to y afaics?

@ulfalizer
Copy link
Collaborator Author

One thing is to clean up the assignment of HAS_SEGGER_RTT, another is to change that assignment to USE_SEGGER_RTT; that will change the default board configuration, right? I just built a sample for nrf52840_pca10056 and USE_SEGGER_RTT is n, this patch would change that to y afaics?

Yup... we're assuming people wanted to enable it, but assigned the wrong symbol. Could be wrong.

Copy link
Member

@carlescufi carlescufi left a comment

Choose a reason for hiding this comment

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

I am not quite convinced by this, because Segger RTT support is determined at the board level, not at the SoC level, since RTT is a mechanism that is implemented in the debugger chip that sits on the board, not in the SoC itself. The original idea with this was to set HAS_SEGGER_RTT at the board level to indicate which boards support this, but it might now have gone out of date. Perhaps @anangl or @nordic-krch could comment as well.

@lemrey
Copy link
Collaborator

lemrey commented Jan 14, 2020

Yup... we're assuming people wanted to enable it, but assigned the wrong symbol. Could be wrong.

Personally, I'd leave the default setting.

Plus I agree with what @carlescufi said, HAS_SEGGER_RTT is a board capability. For example the nrf52840 SoC is present on two boards pca10056 and pca10059 the former has Segger the latter doesn't. We should have HAS_SEGGER_RTT in the board defconfig files.

@ioannisg
Copy link
Member

I am fine with any solution you pick, I would only like to see us having 2 Kconfig options - one _HAS_RTT to signify RTT capabilities (at SoC or Board level), and a user option (depending on that) for enabling the feature.

@ulfalizer
Copy link
Collaborator Author

ulfalizer commented Jan 14, 2020

Yup... we're assuming people wanted to enable it, but assigned the wrong symbol. Could be wrong.

Personally, I'd leave the default setting.

Plus I agree with what @carlescufi said, HAS_SEGGER_RTT is a board capability. For example the nrf52840 SoC is present on two boards pca10056 and pca10059 the former has Segger the latter doesn't. We should have HAS_SEGGER_RTT in the board defconfig files.

So do you think HAS_SEGGER_RTT should be user-configurable?

Note that assigning it is currently a no-op, because it isn't user-configurable (since it has no prompt).

One icky thing about having it user-configurable is that you could go into the menuconfig and toggle it, even though it's a fixed hardware thing (afaik).

@ulfalizer
Copy link
Collaborator Author

ulfalizer commented Jan 14, 2020

I am not quite convinced by this, because Segger RTT support is determined at the board level, not at the SoC level, since RTT is a mechanism that is implemented in the debugger chip that sits on the board, not in the SoC itself. The original idea with this was to set HAS_SEGGER_RTT at the board level to indicate which boards support this, but it might now have gone out of date. Perhaps @anangl or @nordic-krch could comment as well.

Could select HAS_SEGGER_RTT from the board symbols instead, if that'd make more sense. Not sure if I'm the most qualified guy to do it though.

Maybe we could just go with something that works as intended here.

@ulfalizer ulfalizer changed the title boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards [DNM - testing fix for broken build] boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards Jan 15, 2020
@zephyrbot zephyrbot added the area: Shell Shell subsystem label Jan 15, 2020
ulfalizer added a commit to ulfalizer/zephyr that referenced this pull request Jan 15, 2020
RTT_CONSOLE depends on CONSOLE, but SEGGER_SYSTEMVIEW and
SHELL_BACKEND_RTT select RTT_CONSOLE without also selecting CONSOLE.

This leads to a build failure in drivers/console/rtt_console.c (compiled
if RTT_CONSOLE is enabled) unless CONSOLE is enabled some other way.
Symbols like CONFIG_RTT_RETRY_DELAY_MS won't be defined, because they
depend on CONSOLE.

Came up in zephyrproject-rtos#21860. This
fix was verified there.

(Would be nice to get rid of some 'select's in the console subsystem at
some point. This is a quick fix.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
@ulfalizer
Copy link
Collaborator Author

Depends on #21961.

@carlescufi
Copy link
Member

I am not quite convinced by this, because Segger RTT support is determined at the board level, not at the SoC level, since RTT is a mechanism that is implemented in the debugger chip that sits on the board, not in the SoC itself. The original idea with this was to set HAS_SEGGER_RTT at the board level to indicate which boards support this, but it might now have gone out of date. Perhaps @anangl or @nordic-krch could comment as well.

Could select HAS_SEGGER_RTT from the board symbols instead, if that'd make more sense. Not sure if I'm the most qualified guy to do it though.

Maybe we could just go with something that works as intended here.

I don't think HAS_SEGGER_RTT should be user-configurable. It should be just like any other board-specific setting that is hardcoded on the board defconfig, since it's essentially a "has" property, just like CPU_HAS_FPU. It's a bit trickier because people can indeed override the firmware in the board's debug controller and get rid of Segger, but I still think this makes sense as a non-configurable property of the board. The one that should be configurable is USE_SEGGER_RTT.

carlescufi pushed a commit that referenced this pull request Jan 16, 2020
RTT_CONSOLE depends on CONSOLE, but SEGGER_SYSTEMVIEW and
SHELL_BACKEND_RTT select RTT_CONSOLE without also selecting CONSOLE.

This leads to a build failure in drivers/console/rtt_console.c (compiled
if RTT_CONSOLE is enabled) unless CONSOLE is enabled some other way.
Symbols like CONFIG_RTT_RETRY_DELAY_MS won't be defined, because they
depend on CONSOLE.

Came up in #21860. This
fix was verified there.

(Would be nice to get rid of some 'select's in the console subsystem at
some point. This is a quick fix.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
HAS_SEGGER_RTT is assigned by various Nordic boards, but assignments
have no effect on promptless symbols. This symbol is enabled through
being select'ed by SOC_SERIES_NRF52X.

Holyiot, nRF52833-PCA10100, nRF52840-PCA10056, and nRF52-PCA10040 only
assign HAS_SEGGER_RTT without assigning USE_SEGGER_RTT. They probably
meant to enable USE_SEGGER_RTT, so do that instead.

Also add a help text to HAS_SEGGER_RTT and a warning re. HAS_SEGGER_RTT
vs. USE_SEGGER_RTT to the documentation.

Flagged by zephyrproject-rtos#20742.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
@ulfalizer ulfalizer changed the title [DNM - testing fix for broken build] boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards boards: kconfig: Fix enabling USE_SEGGER_RTT for various boards Jan 16, 2020
@ulfalizer
Copy link
Collaborator Author

ulfalizer commented Jan 16, 2020

#21961 is in now, so removing DNM.

I don't think HAS_SEGGER_RTT should be user-configurable. It should be just like any other board-specific setting that is hardcoded on the board defconfig, since it's essentially a "has" property, just like CPU_HAS_FPU. It's a bit trickier because people can indeed override the firmware in the board's debug controller and get rid of Segger, but I still think this makes sense as a non-configurable property of the board. The one that should be configurable is USE_SEGGER_RTT.

USE_SEGGER_RTT is the only one that's configurable. The issue was that configuration files tried to enable HAS_SEGGER_RTT.

Question is if the configuration files that enabled HAS_SEGGER_RTT (in a no-op way) really meant to enable USE_SEGGER_RTT. Latest version of the PR is assuming that.

Maybe I'm missing something. Will look more tomorrow.

@ulfalizer
Copy link
Collaborator Author

ulfalizer commented Jan 17, 2020

@lemrey

Personally, I'd leave the default setting.

Plus I agree with what @carlescufi said, HAS_SEGGER_RTT is a board capability. For example the nrf52840 SoC is present on two boards pca10056 and pca10059 the former has Segger the latter doesn't. We should have HAS_SEGGER_RTT in the board defconfig files.

As in just removing the (no-op) CONFIG_HAS_SEGGER_RTT=y assignments, instead of changing them to CONFIG_USE_SEGGER_RTT=y?

Note that all the CONFIG_HAS_SEGGER_RTT=y assignments had no effect previously, and that HAS_SEGGER_RTT is already enabled for these boards (through select).

@carlescufi carlescufi merged commit a8fe296 into zephyrproject-rtos:master Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards area: Documentation area: Shell Shell subsystem bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants