This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

zephyr — functionality specific to the Zephyr port

Thezephyr module contains functions and classes specific to the Zephyr port.

Functions

zephyr.is_preempt_thread()

Returns true if the current thread is a preemptible thread.

Zephyr preemptible threads are those with non-negative priority values (low priority levels), which therefore,can be supplanted as soon as a higher or equal priority thread becomes ready.

zephyr.current_tid()

Returns the thread id of the current thread, which is used to reference the thread.

zephyr.thread_analyze(cpu)

Runs the Zephyr debug thread analyzer on the current thread on the given cpuand prints stack size statistics in the format:

thread_name-20s: STACK: unusedavailable_stack_space usagestack_space_used/stack_size (percent_stack_space_used %); CPU:cpu_utilization %”

  • CPU utilization is only printed if runtime statistics are configured via the ``CONFIG_THREAD_RUNTIME_STATS`` kconfig

This function can only be accessed ifCONFIG_THREAD_ANALYZER is configured for the port inzephyr/prj.conf.For more information, see documentation for Zephyrthread analyzer.

Note that thecpu argument is only used in Zephyr v4.0.0 andnewer and ignored otherwise.

zephyr.shell_exec(cmd_in)

Executes the given command on an UART backend. This function can only be accessed ifCONFIG_SHELL_BACKEND_SERIALis configured for the port inzephyr/prj.conf.

A list of possible commands can be found in the documentation for Zephyrshell commands.

Classes

Additional Modules