Logging in a user-mode thread with 'no-optimization' #88068
Unanswered
cjwinklhofer
asked this question in
Q&A
Replies: 1 comment
-
After doing some more analysis, I think that CONFIG_LOG_ALWAYS_RUNTIME=y does not work in a user-mode thread. In addition, when CONFIG_NO_OPTIMIZATIONS=n the logging module declarations (__log_current_data) are optimized out and the user-mode thread does not get a MPU violation. I created a pull-request with a possible solution: #88269 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When using the logging library in a user-mode thread, I get an MPU error when building with no-optimization. The CONFIG_NO_OPTIMIZATIONS=y implies CONFIG_LOG_ALWAYS_RUNTIME=y so the relevant part should be in:
include/zephyr/logging/log_msg.h
When I understand correctly, the z_log_msg_runtime_create should be a system-call to work properly from a user-mode thread?
So I tried to make a system-call instead (actually I added a new one that takes the composed string, instead of the var-args) - however, I noticed that already the access to '_source' results in an MPU violation when it is accessed in a user-thread. In case with CONFIG_NO_OPTIMIZATIONS=n the '_source' can be used without an MPU error. I think, with the optimization, the address of _source is directly passed to the system-call and therefore does not trigger the MPU error?
I am not sure, good chance that I mixed something up or could this be a general issue with logging, user-mode threads and no-optimization? Tested on a 'NUCLEO-U575ZI-Q' board.
Thanks
Christoph
Beta Was this translation helpful? Give feedback.
All reactions