Commit Graph

9 Commits

Author SHA1 Message Date
Maureen Helm 92a5ee6ac1 zephyr: Replace broken shell_net_iface() with more general shell_exec().
The zephyr function net_shell_cmd_iface() was removed in zephyr v1.14.0,
therefore the MicroPython zephyr port did not build with newer zephyr
versions when CONFIG_NET_SHELL=y. Replace with a more general
shell_exec() function that can execute any zephyr shell command. For
example:

>>> zephyr.shell_exec("net")

Subcommands:
  allocs     :Print network memory allocations.
  arp        :Print information about IPv4 ARP cache.
  conn       :Print information about network connections.
  dns        :Show how DNS is configured.
  events     :Monitor network management events.
  gptp       :Print information about gPTP support.
  iface      :Print information about network interfaces.
  ipv6       :Print information about IPv6 specific information and
              configuration.
  mem        :Print information about network memory usage.
  nbr        :Print neighbor information.
  ping       :Ping a network host.
  pkt        :net_pkt information.
  ppp        :PPP information.
  resume     :Resume a network interface
  route      :Show network route.
  stacks     :Show network stacks information.
  stats      :Show network statistics.
  suspend    :Suspend a network interface
  tcp        :Connect/send/close TCP connection.
  vlan       :Show VLAN information.
  websocket  :Print information about WebSocket connections.

>>> zephyr.shell_exec("kernel")

kernel - Kernel commands
Subcommands:
  cycles   :Kernel cycles.
  reboot   :Reboot.
  stacks   :List threads stack usage.
  threads  :List kernel threads.
  uptime   :Kernel uptime.
  version  :Kernel version.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-12-07 23:01:00 +11:00
Maureen Helm 38b4f1569e zephyr: Fix and rename stacks_analyze function in zephyr module.
Zephyr deprecated and then removed its stack_analyze function because it
was unsafe.  Use the new zephyr thread analyzer instead and rename the
MicroPython function to zephyr.thread_analyze() to be more consistent with
the implementation.

Tested on mimxrt1050_evk.

The output now looks like this:

>>> zephyr.thread_analyze()
Thread analyze:
 80004ff4            : unused 400 usage 112 / 512 (21 %)
 rx_workq            : unused 1320 usage 180 / 1500 (12 %)
 tx_workq            : unused 992 usage 208 / 1200 (17 %)
 net_mgmt            : unused 656 usage 112 / 768 (14 %)
 sysworkq            : unused 564 usage 460 / 1024 (44 %)
 idle                : unused 256 usage 64 / 320 (20 %)
 main                : unused 2952 usage 1784 / 4736 (37 %)
2020-06-12 10:24:01 +10:00
stijn 84fa3312cf all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of
'force' in order not to alter the comments which use extra spaces after //
as a means of indenting text for clarity.
2020-04-23 11:24:25 +10:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Maureen Helm 86a66960f9 zephyr: Implement block device protocol via zephyr flash map api.
Introduces a new zephyr.FlashArea class that uses the zephyr flash map
api to implement the uos.AbstractBlockDev protocol. The flash driver is
enabled on the frdm_k64f board, reel_board, and rv32m1_vega_ri5cy board.

The standard and extended block device protocols are both supported,
therefore this class can be used with file systems like littlefs which
require the extended interface.
2020-02-07 11:24:06 +11:00
Maureen Helm cc19cf2549 zephyr: Implement block device protocol via zephyr disk access api.
Introduces a new zephyr.DiskAccess class that uses the zephyr disk
access api to implement the uos.AbstractBlockDev protocol. This can be
used with any type of zephyr disk access driver, which currently
includes SDHC, RAM, and FLASH implementations. The SDHC driver is
enabled on the mimxrt1050_evk board.

Only the standard block device protocol (without the offset parameter)
can be supported with the zephyr disk access api, therefore this class
cannot be used with file systems like littlefs which require the
extended interface. In the future it may be possible to implement the
extended interface in a new class using the zephyr flash api.
2020-02-07 11:24:06 +11:00
Maureen Helm c25e12d0dd zephyr: Update include paths for Zephyr v2.0.
Zephyr restructured its includes in v2.0 and removed compatibility shims
after two releases in commit 1342dadc365ee22199e51779185899ddf7478686.
Updates include paths in MicroPython accordingly to fix build errors in
the zephyr port.

These changes are compatible with Zephyr v2.0 and later.
2020-02-04 17:09:19 +11:00
Paul Sokolovsky a42c1d9fd5 zephyr/modzephyr: Revamp stacks_analyze() call.
Underlying k_call_stacks_analyze() was gone in Zephyr, reimplement using
k_thread_foreach().
2019-03-12 17:11:09 +11:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00