-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Supporting User Mode on ARM Cortex-M Baseline #19689
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
Supporting User Mode on ARM Cortex-M Baseline #19689
Conversation
34da53a
to
cd35177
Compare
All checks are passing now. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
7dc3a2f
to
e31138e
Compare
03ff9e6
to
acd3131
Compare
2577fe3
to
a549446
Compare
a549446
to
4762c04
Compare
5fb8333
to
e0abf95
Compare
@erwango I would appreciate if you could do some testing. Pls, run user mode tests on this board, and report your findings. |
@@ -52,6 +48,9 @@ | |||
#include <stm32g0xx_ll_usart.h> | |||
#endif | |||
|
|||
/* Add include for DTS generated information */ | |||
#include <generated_dts_board.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we include this at the end of the file here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is standard for ARM SoCs. We first include vendor headers, followed by including DTS generated headers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this way we prevent from having inclusion cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems broken by design TBH
What does generated_dts_board.h pull in which requires it at the end of file and not the beginning?
And since nothing in the header uses the definitions, why is it pulled in here at all? Pulling in headers from other headers which aren't actually needed by the including header is what causes inclusion cycle problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I was not clear sorry. It can be anywhere in the file. The inclusions were caused by including kernel headers here. That's what I removed.
Just for consistency with other SOCs, I prefer to pull in the dts generated headers after the vendor headers but this should not matter.
We enable Memory Protection on stm32 nucleo_g071rb board, since the respective SoC series implements the ARM MPU. Signed-off-by: Ioannis Glaropoulos <[email protected]>
Remove the inclusion of kernel_includes.h from soc.h and replace it with including the board-specific auto-generated headers. This aligns the soc.h header with the current policy not to include kernel headers in soc.h. Signed-off-by: Ioannis Glaropoulos <[email protected]>
ARMv6-M architecture has an MPU that requires minimum region size of 256 bytes. Signed-off-by: Ioannis Glaropoulos <[email protected]>
We do not support HW Stack protection capabilities in Cortex-M Baseline CPUs (unless they have built-in stack overflow detection capability). We adapt the Kconfig option to reflect this. Signed-off-by: Ioannis Glaropoulos <[email protected]>
In this commit we implement the assembly functions in swap_helper.S, namely - z_arm_pendsv() - z_arm_svc() for ARMv6-M and ARMv8-M Baseline architecture. We "inline" the implementation for Baseline, along with the Mainline (ARMv7-M) implementation, i.e. we rework only what is required to build for Baseline Cortex-M. Signed-off-by: Ioannis Glaropoulos <[email protected]>
In this commit we implement the assembly functions in userspace.S - z_arm_userspace_enter() - z_arm_do_syscall() - z_arch_user_string_nlen() for ARMv6-M and ARMv8-M Baseline architecture. We "inline" the implementation for Baseline, along with the Mainline (ARMv7-M) implementation, i.e. we rework only what is required to build for Baseline Cortex-M. Signed-off-by: Ioannis Glaropoulos <[email protected]>
e0abf95
to
0ef7752
Compare
Fixes #12961.
The work has been tested (manually) on
nucleo_g071rb
board. Flashing this board with west/pyocd is currently broken (at least for me), so I have tested manually all the-t userspace
tests; they are passing on the board.There is no QEMU for Cortex-M0+ -
nucleo_g071rb
is the only CM0+ board with user mode support.The added patches are completely isolated from Cortex-M0 port (i.e. simple ARMv6 without MPU) and Cortex-M Mainline port (v7m, v8m), i.e. there should be no impact on the other aRM ARCHes.