Wykres commitów

13 Commity (master)

Autor SHA1 Wiadomość Data
Angus Gratton decf8e6a8b all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit
d5df6cd44a.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07 14:20:42 +11:00
Maureen Helm 4fd54a4756 zephyr: Update include paths to use the zephyr namespace.
Zephyr v3.1.0 moved all public headers to include/zephyr.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-06-17 16:44:30 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Jim Mussared ec2fe5d6ca zephyr: Make port-specific modules use MP_REGISTER_MODULE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:57:09 +10:00
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