` and on
+ :term:`baremetal` ports (those which offer filesystem and networking
+ support).
diff --git a/docs/reference/index.rst b/docs/reference/index.rst
index 63d9941b1..4d822d6fa 100644
--- a/docs/reference/index.rst
+++ b/docs/reference/index.rst
@@ -19,6 +19,7 @@ implementation and the best practices to use them.
.. toctree::
:maxdepth: 1
+ glossary.rst
repl.rst
isr_rules.rst
speed_python.rst
diff --git a/docs/templates/topindex.html b/docs/templates/topindex.html
index 38a8c1d30..7ee1180ec 100644
--- a/docs/templates/topindex.html
+++ b/docs/templates/topindex.html
@@ -87,6 +87,10 @@
+
+ Glosssary
+ MicroPython terms explained
+
Table of contents
a list of all sections and subsections
From 7e14f99c26af0e1df0979ba97ab6380339014a7d Mon Sep 17 00:00:00 2001
From: Damien George
Date: Sun, 2 Jul 2017 21:29:06 +1000
Subject: [PATCH 111/252] docs/topindex.html: Fix typo in "Glossary" heading.
---
docs/templates/topindex.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/templates/topindex.html b/docs/templates/topindex.html
index 7ee1180ec..3a9269eb1 100644
--- a/docs/templates/topindex.html
+++ b/docs/templates/topindex.html
@@ -88,7 +88,7 @@
|
- Glosssary
+ Glossary
MicroPython terms explained
From 5f0c56bcf1fcb7f2d36a0c420b4681a812047c59 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 14:34:20 +0300
Subject: [PATCH 112/252] docs/conf.py: Switch to "new" format of
intersphinx_mapping.
As described at
http://www.sphinx-doc.org/en/stable/ext/intersphinx.html#confval-intersphinx_mapping
This will allow to explicitly refer to CPython docs for cross-references.
---
docs/conf.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/conf.py b/docs/conf.py
index 2b20d47ab..bb1d61358 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -317,7 +317,7 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'http://docs.python.org/': None}
+intersphinx_mapping = {'python': ('http://docs.python.org/3', None)}
# Append the other ports' specific folders/files to the exclude pattern
exclude_patterns.extend([port + '*' for port in ports if port != micropy_port])
From ebce7984c66b4d977f4540506e243cf65a80db2f Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 15:15:31 +0300
Subject: [PATCH 113/252] docs/conf.py: Add file for global replacements
definition.
The idea is to allow to define a kind of "macros" for repeatitive text,
so all occurrances can be updated in one place. Unfortunately, RST doesn't
support replacements with arguments, which limits usefulness of them and
should be taken into account.
---
docs/conf.py | 6 ++++++
docs/templates/replace.inc | 1 +
2 files changed, 7 insertions(+)
create mode 100644 docs/templates/replace.inc
diff --git a/docs/conf.py b/docs/conf.py
index bb1d61358..b9b112557 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -139,6 +139,12 @@ pygments_style = 'sphinx'
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
+# Global include files. Sphinx docs suggest using rst_epilog in preference
+# of rst_prolog, so we follow. Absolute paths below mean "from the base
+# of the doctree".
+rst_epilog = """
+.. include:: /templates/replace.inc
+"""
# -- Options for HTML output ----------------------------------------------
diff --git a/docs/templates/replace.inc b/docs/templates/replace.inc
new file mode 100644
index 000000000..6ed79cc7c
--- /dev/null
+++ b/docs/templates/replace.inc
@@ -0,0 +1 @@
+.. # This file is intended for global "replace" definitions.
From 465d84b7e72c9fe4a8907ee539f736ff576d9dd6 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 15:37:31 +0300
Subject: [PATCH 114/252] docs/library: Add CPython docs xref to each pertinent
module.
Cross-reference text/link is implemented as RST substitution, so easy to
consistently.
---
docs/library/array.rst | 3 +--
docs/library/builtins.rst | 10 ++++++++++
docs/library/cmath.rst | 2 ++
docs/library/gc.rst | 2 ++
docs/library/math.rst | 2 ++
docs/library/sys.rst | 2 ++
docs/library/ubinascii.rst | 2 ++
docs/library/ucollections.rst | 2 ++
docs/library/uhashlib.rst | 2 ++
docs/library/uheapq.rst | 2 ++
docs/library/uio.rst | 2 ++
docs/library/ujson.rst | 2 ++
docs/library/uos.rst | 2 ++
docs/library/ure.rst | 2 ++
docs/library/uselect.rst | 2 ++
docs/library/usocket.rst | 5 ++---
docs/library/ussl.rst | 2 ++
docs/library/ustruct.rst | 3 +--
docs/library/utime.rst | 2 ++
docs/library/uzlib.rst | 2 ++
docs/templates/replace.inc | 8 +++++++-
21 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/docs/library/array.rst b/docs/library/array.rst
index f52b4b385..d096c6ec4 100644
--- a/docs/library/array.rst
+++ b/docs/library/array.rst
@@ -4,8 +4,7 @@
.. module:: array
:synopsis: efficient arrays of numeric data
-See `Python array `_ for more
-information.
+|see_cpython_module| :mod:`python:array`.
Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
``L``, ``q``, ``Q``, ``f``, ``d`` (the latter 2 depending on the
diff --git a/docs/library/builtins.rst b/docs/library/builtins.rst
index 658d46ecd..365248dc7 100644
--- a/docs/library/builtins.rst
+++ b/docs/library/builtins.rst
@@ -21,6 +21,8 @@ Functions and types
.. class:: bytes()
+ |see_cpython| `python:bytes`.
+
.. function:: callable()
.. function:: chr()
@@ -174,6 +176,10 @@ Exceptions
.. exception:: OSError
+ |see_cpython| `python:OSError`. MicroPython doesn't implement ``errno``
+ attribute, instead use the standard way to access exception arguments:
+ ``exc.args[0]``.
+
.. exception:: RuntimeError
.. exception:: StopIteration
@@ -182,8 +188,12 @@ Exceptions
.. exception:: SystemExit
+ |see_cpython| `python:SystemExit`.
+
.. exception:: TypeError
+ |see_cpython| `python:TypeError`.
+
.. exception:: ValueError
.. exception:: ZeroDivisionError
diff --git a/docs/library/cmath.rst b/docs/library/cmath.rst
index 465cf54ad..59e4ec172 100644
--- a/docs/library/cmath.rst
+++ b/docs/library/cmath.rst
@@ -4,6 +4,8 @@
.. module:: cmath
:synopsis: mathematical functions for complex numbers
+|see_cpython_module| :mod:`python:cmath`.
+
The ``cmath`` module provides some basic mathematical functions for
working with complex numbers.
diff --git a/docs/library/gc.rst b/docs/library/gc.rst
index abc8b7933..c823aed3e 100644
--- a/docs/library/gc.rst
+++ b/docs/library/gc.rst
@@ -4,6 +4,8 @@
.. module:: gc
:synopsis: control the garbage collector
+|see_cpython_module| :mod:`python:gc`.
+
Functions
---------
diff --git a/docs/library/math.rst b/docs/library/math.rst
index 9d5cf7b4b..a6f13d48c 100644
--- a/docs/library/math.rst
+++ b/docs/library/math.rst
@@ -4,6 +4,8 @@
.. module:: math
:synopsis: mathematical functions
+|see_cpython_module| :mod:`python:math`.
+
The ``math`` module provides some basic mathematical functions for
working with floating-point numbers.
diff --git a/docs/library/sys.rst b/docs/library/sys.rst
index 09054becc..0bec35cc9 100644
--- a/docs/library/sys.rst
+++ b/docs/library/sys.rst
@@ -4,6 +4,8 @@
.. module:: sys
:synopsis: system specific functions
+|see_cpython_module| :mod:`python:sys`.
+
Functions
---------
diff --git a/docs/library/ubinascii.rst b/docs/library/ubinascii.rst
index a8d359eb4..0664d5b09 100644
--- a/docs/library/ubinascii.rst
+++ b/docs/library/ubinascii.rst
@@ -4,6 +4,8 @@
.. module:: ubinascii
:synopsis: binary/ASCII conversions
+|see_cpython_module| :mod:`python:binascii`.
+
This module implements conversions between binary data and various
encodings of it in ASCII form (in both directions).
diff --git a/docs/library/ucollections.rst b/docs/library/ucollections.rst
index 4e9de9ac6..96de67acc 100644
--- a/docs/library/ucollections.rst
+++ b/docs/library/ucollections.rst
@@ -4,6 +4,8 @@
.. module:: ucollections
:synopsis: collection and container types
+|see_cpython_module| :mod:`python:collections`.
+
This module implements advanced collection and container types to
hold/accumulate various objects.
diff --git a/docs/library/uhashlib.rst b/docs/library/uhashlib.rst
index 6b9a764ba..50ed658cc 100644
--- a/docs/library/uhashlib.rst
+++ b/docs/library/uhashlib.rst
@@ -4,6 +4,8 @@
.. module:: uhashlib
:synopsis: hashing algorithms
+|see_cpython_module| :mod:`python:hashlib`.
+
This module implements binary data hashing algorithms. The exact inventory
of available algorithms depends on a board. Among the algorithms which may
be implemented:
diff --git a/docs/library/uheapq.rst b/docs/library/uheapq.rst
index c17dac067..f822f1e7f 100644
--- a/docs/library/uheapq.rst
+++ b/docs/library/uheapq.rst
@@ -4,6 +4,8 @@
.. module:: uheapq
:synopsis: heap queue algorithm
+|see_cpython_module| :mod:`python:heapq`.
+
This module implements the heap queue algorithm.
A heap queue is simply a list that has its elements stored in a certain way.
diff --git a/docs/library/uio.rst b/docs/library/uio.rst
index 1239c6394..7042a9e37 100644
--- a/docs/library/uio.rst
+++ b/docs/library/uio.rst
@@ -4,6 +4,8 @@
.. module:: uio
:synopsis: input/output streams
+|see_cpython_module| :mod:`python:io`.
+
This module contains additional types of stream (file-like) objects
and helper functions.
diff --git a/docs/library/ujson.rst b/docs/library/ujson.rst
index 724bc90ee..0932d0ab5 100644
--- a/docs/library/ujson.rst
+++ b/docs/library/ujson.rst
@@ -4,6 +4,8 @@
.. module:: ujson
:synopsis: JSON encoding and decoding
+|see_cpython_module| :mod:`python:json`.
+
This modules allows to convert between Python objects and the JSON
data format.
diff --git a/docs/library/uos.rst b/docs/library/uos.rst
index 1e7f33161..7c52c1eea 100644
--- a/docs/library/uos.rst
+++ b/docs/library/uos.rst
@@ -4,6 +4,8 @@
.. module:: uos
:synopsis: basic "operating system" services
+|see_cpython_module| :mod:`python:os`.
+
The ``uos`` module contains functions for filesystem access and ``urandom``
function.
diff --git a/docs/library/ure.rst b/docs/library/ure.rst
index 92f277af4..67f4f54a1 100644
--- a/docs/library/ure.rst
+++ b/docs/library/ure.rst
@@ -4,6 +4,8 @@
.. module:: ure
:synopsis: regular expressions
+|see_cpython_module| :mod:`python:re`.
+
This module implements regular expression operations. Regular expression
syntax supported is a subset of CPython ``re`` module (and actually is
a subset of POSIX extended regular expressions).
diff --git a/docs/library/uselect.rst b/docs/library/uselect.rst
index a4026e98c..e330207db 100644
--- a/docs/library/uselect.rst
+++ b/docs/library/uselect.rst
@@ -4,6 +4,8 @@
.. module:: uselect
:synopsis: wait for events on a set of streams
+|see_cpython_module| :mod:`python:select`.
+
This module provides functions to efficiently wait for events on multiple
streams (select streams which are ready for operations).
diff --git a/docs/library/usocket.rst b/docs/library/usocket.rst
index a52d4bf9a..70d4f49fc 100644
--- a/docs/library/usocket.rst
+++ b/docs/library/usocket.rst
@@ -5,10 +5,9 @@
.. module:: usocket
:synopsis: socket module
-This module provides access to the BSD socket interface.
+|see_cpython_module| :mod:`python:socket`.
-See the corresponding `CPython module `_
-for comparison.
+This module provides access to the BSD socket interface.
.. admonition:: Difference to CPython
:class: attention
diff --git a/docs/library/ussl.rst b/docs/library/ussl.rst
index 62b6db777..c71b283cc 100644
--- a/docs/library/ussl.rst
+++ b/docs/library/ussl.rst
@@ -4,6 +4,8 @@
.. module:: ussl
:synopsis: TLS/SSL wrapper for socket objects
+|see_cpython_module| :mod:`python:ssl`.
+
This module provides access to Transport Layer Security (previously and
widely known as “Secure Sockets Layer”) encryption and peer authentication
facilities for network sockets, both client-side and server-side.
diff --git a/docs/library/ustruct.rst b/docs/library/ustruct.rst
index a0a0ab65c..81915d0a8 100644
--- a/docs/library/ustruct.rst
+++ b/docs/library/ustruct.rst
@@ -4,8 +4,7 @@
.. module:: ustruct
:synopsis: pack and unpack primitive data types
-See `Python struct `_ for more
-information.
+|see_cpython_module| :mod:`python:struct`.
Supported size/byte order prefixes: ``@``, ``<``, ``>``, ``!``.
diff --git a/docs/library/utime.rst b/docs/library/utime.rst
index 933e70ac5..a39f5ee73 100644
--- a/docs/library/utime.rst
+++ b/docs/library/utime.rst
@@ -4,6 +4,8 @@
.. module:: utime
:synopsis: time related functions
+|see_cpython_module| :mod:`python:time`.
+
The ``utime`` module provides functions for getting the current time and date,
measuring time intervals, and for delays.
diff --git a/docs/library/uzlib.rst b/docs/library/uzlib.rst
index 8775ec3e0..e531407b0 100644
--- a/docs/library/uzlib.rst
+++ b/docs/library/uzlib.rst
@@ -4,6 +4,8 @@
.. module:: uzlib
:synopsis: zlib decompression
+|see_cpython_module| :mod:`python:zlib`.
+
This modules allows to decompress binary data compressed with DEFLATE
algorithm (commonly used in zlib library and gzip archiver). Compression
is not yet implemented.
diff --git a/docs/templates/replace.inc b/docs/templates/replace.inc
index 6ed79cc7c..1db89cb7e 100644
--- a/docs/templates/replace.inc
+++ b/docs/templates/replace.inc
@@ -1 +1,7 @@
-.. # This file is intended for global "replace" definitions.
+.. comment: This file is intended for global "replace" definitions.
+
+.. |see_cpython_module| replace::
+
+ *This module implements a subset of the corresponding* `CPython` *module,
+ as described below. For more information, refer to the original
+ CPython documentation:*
From a6af1a1d9c4d84987fd067a39a1c936df9f89420 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 15:43:12 +0300
Subject: [PATCH 115/252] docs/replace.inc: Add |see_cpython|, to xref
individual symbols from CPython.
The idea is to use it for each symbol in builtins.rst.
---
docs/templates/replace.inc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/templates/replace.inc b/docs/templates/replace.inc
index 1db89cb7e..319c53735 100644
--- a/docs/templates/replace.inc
+++ b/docs/templates/replace.inc
@@ -1,5 +1,7 @@
.. comment: This file is intended for global "replace" definitions.
+.. |see_cpython| replace:: See CPython documentation:
+
.. |see_cpython_module| replace::
*This module implements a subset of the corresponding* `CPython` *module,
From 90c1d54464498237912476d1f02b55b457575105 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 15:50:22 +0300
Subject: [PATCH 116/252] docs/conf.py: Set "version" and "release" to the same
value.
We don't use alpha/beta/RC, so for us version and release should be the
same, or it leads to confusion (for example, current, 1.9.1 docs are
marked as 1.9 at places).
---
docs/conf.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index b9b112557..2c3423d99 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -96,10 +96,9 @@ copyright = '2014-2017, Damien P. George, Paul Sokolovsky, and contributors'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-# The short X.Y version.
-version = '1.9'
-# The full version, including alpha/beta/rc tags.
-release = '1.9.1'
+# We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags"
+# breakdown, so use the same version identifier for both to avoid confusion.
+version = release = '1.9.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
From 65417c5ad9e9ea7b0f110daf6c37e3d7dc19e32f Mon Sep 17 00:00:00 2001
From: Damien George
Date: Sun, 2 Jul 2017 23:35:42 +1000
Subject: [PATCH 117/252] py/objstr: Move uPy function wrappers to just after
the C function.
This matches the coding/layout style of all the other objects.
---
py/objstr.c | 65 +++++++++++++++++++++++------------------------------
1 file changed, 28 insertions(+), 37 deletions(-)
diff --git a/py/objstr.c b/py/objstr.c
index e758dd006..b9cc1b1da 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -469,6 +469,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
// return joined string
return mp_obj_new_str_from_vstr(self_type, &vstr);
}
+MP_DEFINE_CONST_FUN_OBJ_2(str_join_obj, str_join);
mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
@@ -544,6 +545,7 @@ mp_obj_t mp_obj_str_split(size_t n_args, const mp_obj_t *args) {
return res;
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj, 1, 3, mp_obj_str_split);
#if MICROPY_PY_BUILTINS_STR_SPLITLINES
STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -589,6 +591,7 @@ STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return res;
}
+MP_DEFINE_CONST_FUN_OBJ_KW(str_splitlines_obj, 1, str_splitlines);
#endif
STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
@@ -656,6 +659,7 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_FROM_PTR(res);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rsplit_obj, 1, 3, str_rsplit);
STATIC mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, bool is_index) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
@@ -700,18 +704,22 @@ STATIC mp_obj_t str_finder(size_t n_args, const mp_obj_t *args, int direction, b
STATIC mp_obj_t str_find(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, false);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj, 2, 4, str_find);
STATIC mp_obj_t str_rfind(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, false);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rfind_obj, 2, 4, str_rfind);
STATIC mp_obj_t str_index(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, 1, true);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_index_obj, 2, 4, str_index);
STATIC mp_obj_t str_rindex(size_t n_args, const mp_obj_t *args) {
return str_finder(n_args, args, -1, true);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rindex_obj, 2, 4, str_rindex);
// TODO: (Much) more variety in args
STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
@@ -727,6 +735,7 @@ STATIC mp_obj_t str_startswith(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(memcmp(start, prefix, prefix_len) == 0);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_startswith_obj, 2, 3, str_startswith);
STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len);
@@ -740,6 +749,7 @@ STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_bool(memcmp(str + (str_len - suffix_len), suffix, suffix_len) == 0);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_endswith_obj, 2, 3, str_endswith);
enum { LSTRIP, RSTRIP, STRIP };
@@ -817,14 +827,17 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t str_strip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(STRIP, n_args, args);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_strip_obj, 1, 2, str_strip);
STATIC mp_obj_t str_lstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(LSTRIP, n_args, args);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_lstrip_obj, 1, 2, str_lstrip);
STATIC mp_obj_t str_rstrip(size_t n_args, const mp_obj_t *args) {
return str_uni_strip(RSTRIP, n_args, args);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rstrip_obj, 1, 2, str_rstrip);
#if MICROPY_PY_BUILTINS_STR_CENTER
STATIC mp_obj_t str_center(mp_obj_t str_in, mp_obj_t width_in) {
@@ -841,6 +854,7 @@ STATIC mp_obj_t str_center(mp_obj_t str_in, mp_obj_t width_in) {
memcpy(vstr.buf + left, str, str_len);
return mp_obj_new_str_from_vstr(mp_obj_get_type(str_in), &vstr);
}
+MP_DEFINE_CONST_FUN_OBJ_2(str_center_obj, str_center);
#endif
// Takes an int arg, but only parses unsigned numbers, and only changes
@@ -1346,6 +1360,7 @@ mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
vstr_t vstr = mp_obj_str_format_helper((const char*)str, (const char*)str + len, &arg_i, n_args, args, kwargs);
return mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
}
+MP_DEFINE_CONST_FUN_OBJ_KW(str_format_obj, 1, mp_obj_str_format);
STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict) {
mp_check_self(MP_OBJ_IS_STR_OR_BYTES(pattern));
@@ -1649,6 +1664,7 @@ STATIC mp_obj_t str_replace(size_t n_args, const mp_obj_t *args) {
return mp_obj_new_str_from_vstr(self_type, &vstr);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_replace_obj, 3, 4, str_replace);
STATIC mp_obj_t str_count(size_t n_args, const mp_obj_t *args) {
const mp_obj_type_t *self_type = mp_obj_get_type(args[0]);
@@ -1689,6 +1705,7 @@ STATIC mp_obj_t str_count(size_t n_args, const mp_obj_t *args) {
return MP_OBJ_NEW_SMALL_INT(num_occurrences);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_count_obj, 2, 4, str_count);
#if MICROPY_PY_BUILTINS_STR_PARTITION
STATIC mp_obj_t str_partitioner(mp_obj_t self_in, mp_obj_t arg, int direction) {
@@ -1736,10 +1753,12 @@ STATIC mp_obj_t str_partitioner(mp_obj_t self_in, mp_obj_t arg, int direction) {
STATIC mp_obj_t str_partition(mp_obj_t self_in, mp_obj_t arg) {
return str_partitioner(self_in, arg, 1);
}
+MP_DEFINE_CONST_FUN_OBJ_2(str_partition_obj, str_partition);
STATIC mp_obj_t str_rpartition(mp_obj_t self_in, mp_obj_t arg) {
return str_partitioner(self_in, arg, -1);
}
+MP_DEFINE_CONST_FUN_OBJ_2(str_rpartition_obj, str_rpartition);
#endif
// Supposedly not too critical operations, so optimize for code size
@@ -1757,10 +1776,12 @@ STATIC mp_obj_t str_caseconv(unichar (*op)(unichar), mp_obj_t self_in) {
STATIC mp_obj_t str_lower(mp_obj_t self_in) {
return str_caseconv(unichar_tolower, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_lower_obj, str_lower);
STATIC mp_obj_t str_upper(mp_obj_t self_in) {
return str_caseconv(unichar_toupper, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_upper_obj, str_upper);
STATIC mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
GET_STR_DATA_LEN(self_in, self_data, self_len);
@@ -1798,22 +1819,27 @@ STATIC mp_obj_t str_uni_istype(bool (*f)(unichar), mp_obj_t self_in) {
STATIC mp_obj_t str_isspace(mp_obj_t self_in) {
return str_uni_istype(unichar_isspace, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_isspace_obj, str_isspace);
STATIC mp_obj_t str_isalpha(mp_obj_t self_in) {
return str_uni_istype(unichar_isalpha, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_isalpha_obj, str_isalpha);
STATIC mp_obj_t str_isdigit(mp_obj_t self_in) {
return str_uni_istype(unichar_isdigit, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_isdigit_obj, str_isdigit);
STATIC mp_obj_t str_isupper(mp_obj_t self_in) {
return str_uni_istype(unichar_isupper, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_isupper_obj, str_isupper);
STATIC mp_obj_t str_islower(mp_obj_t self_in) {
return str_uni_istype(unichar_islower, self_in);
}
+MP_DEFINE_CONST_FUN_OBJ_1(str_islower_obj, str_islower);
#if MICROPY_CPYTHON_COMPAT
// These methods are superfluous in the presence of str() and bytes()
@@ -1829,6 +1855,7 @@ STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) {
}
return mp_obj_str_make_new(&mp_type_str, n_args, 0, args);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_decode_obj, 1, 3, bytes_decode);
// TODO: should accept kwargs too
STATIC mp_obj_t str_encode(size_t n_args, const mp_obj_t *args) {
@@ -1841,6 +1868,7 @@ STATIC mp_obj_t str_encode(size_t n_args, const mp_obj_t *args) {
}
return bytes_make_new(NULL, n_args, 0, args);
}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj, 1, 3, str_encode);
#endif
mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
@@ -1859,43 +1887,6 @@ mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_u
}
}
-#if MICROPY_CPYTHON_COMPAT
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bytes_decode_obj, 1, 3, bytes_decode);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_encode_obj, 1, 3, str_encode);
-#endif
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_find_obj, 2, 4, str_find);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rfind_obj, 2, 4, str_rfind);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_index_obj, 2, 4, str_index);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rindex_obj, 2, 4, str_rindex);
-MP_DEFINE_CONST_FUN_OBJ_2(str_join_obj, str_join);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj, 1, 3, mp_obj_str_split);
-#if MICROPY_PY_BUILTINS_STR_SPLITLINES
-MP_DEFINE_CONST_FUN_OBJ_KW(str_splitlines_obj, 1, str_splitlines);
-#endif
-#if MICROPY_PY_BUILTINS_STR_CENTER
-MP_DEFINE_CONST_FUN_OBJ_2(str_center_obj, str_center);
-#endif
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rsplit_obj, 1, 3, str_rsplit);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_startswith_obj, 2, 3, str_startswith);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_endswith_obj, 2, 3, str_endswith);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_strip_obj, 1, 2, str_strip);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_lstrip_obj, 1, 2, str_lstrip);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_rstrip_obj, 1, 2, str_rstrip);
-MP_DEFINE_CONST_FUN_OBJ_KW(str_format_obj, 1, mp_obj_str_format);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_replace_obj, 3, 4, str_replace);
-MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_count_obj, 2, 4, str_count);
-#if MICROPY_PY_BUILTINS_STR_PARTITION
-MP_DEFINE_CONST_FUN_OBJ_2(str_partition_obj, str_partition);
-MP_DEFINE_CONST_FUN_OBJ_2(str_rpartition_obj, str_rpartition);
-#endif
-MP_DEFINE_CONST_FUN_OBJ_1(str_lower_obj, str_lower);
-MP_DEFINE_CONST_FUN_OBJ_1(str_upper_obj, str_upper);
-MP_DEFINE_CONST_FUN_OBJ_1(str_isspace_obj, str_isspace);
-MP_DEFINE_CONST_FUN_OBJ_1(str_isalpha_obj, str_isalpha);
-MP_DEFINE_CONST_FUN_OBJ_1(str_isdigit_obj, str_isdigit);
-MP_DEFINE_CONST_FUN_OBJ_1(str_isupper_obj, str_isupper);
-MP_DEFINE_CONST_FUN_OBJ_1(str_islower_obj, str_islower);
-
STATIC const mp_rom_map_elem_t str8_locals_dict_table[] = {
#if MICROPY_CPYTHON_COMPAT
{ MP_ROM_QSTR(MP_QSTR_decode), MP_ROM_PTR(&bytes_decode_obj) },
From e467949a4a0d8f93d275febc8293c11108180cc8 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 2 Jul 2017 19:18:03 +0300
Subject: [PATCH 118/252] docs/*_index: Drop "Indices and tables"
pseudo-section.
This pseudo-section causes artifacts with latexpdf generation (almost
empty page with list containing literal "genindex", "modeindex", "search"
items). For HTML docs, these sections can be accessed from "home" page.
---
docs/esp8266_index.rst | 7 -------
docs/pyboard_index.rst | 7 -------
docs/unix_index.rst | 7 -------
docs/wipy_index.rst | 7 -------
4 files changed, 28 deletions(-)
diff --git a/docs/esp8266_index.rst b/docs/esp8266_index.rst
index d33234897..519acecda 100644
--- a/docs/esp8266_index.rst
+++ b/docs/esp8266_index.rst
@@ -10,10 +10,3 @@ MicroPython documentation and references
reference/index.rst
genrst/index.rst
license.rst
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/docs/pyboard_index.rst b/docs/pyboard_index.rst
index ea82f89d6..9d8f783de 100644
--- a/docs/pyboard_index.rst
+++ b/docs/pyboard_index.rst
@@ -11,10 +11,3 @@ MicroPython documentation and references
reference/index.rst
genrst/index.rst
license.rst
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/docs/unix_index.rst b/docs/unix_index.rst
index 07f245a30..1bfeb0bda 100644
--- a/docs/unix_index.rst
+++ b/docs/unix_index.rst
@@ -7,10 +7,3 @@ MicroPython documentation and references
reference/index.rst
genrst/index.rst
license.rst
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/docs/wipy_index.rst b/docs/wipy_index.rst
index 7edba8f54..15c04c0fb 100644
--- a/docs/wipy_index.rst
+++ b/docs/wipy_index.rst
@@ -10,10 +10,3 @@ MicroPython documentation and references
reference/index.rst
genrst/index.rst
license.rst
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
From 4f23c5d58738cd443d43b8e01cbd2a90ae6a8c9d Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Fri, 30 Jun 2017 22:24:01 +0300
Subject: [PATCH 119/252] docs/pyboard: Move hardware info into General Info
chapter.
This makes top-level ToC of the pyboard docs consistent with other ports
(consisting of 3 chapters: QuickRef, General Info, and Tutorial).
Also, some other minor tweaks applied, like local ToC for General Info and
headings mentioning pyboard.
---
docs/pyboard/general.rst | 3 +++
docs/pyboard/hardware/index.rst | 6 +++---
docs/pyboard/tutorial/index.rst | 4 ++--
docs/pyboard_index.rst | 1 -
docs/templates/topindex.html | 4 ----
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/docs/pyboard/general.rst b/docs/pyboard/general.rst
index 1d040f6cc..8cb801f4d 100644
--- a/docs/pyboard/general.rst
+++ b/docs/pyboard/general.rst
@@ -1,6 +1,8 @@
General information about the pyboard
=====================================
+.. contents::
+
Local filesystem and SD card
----------------------------
@@ -67,3 +69,4 @@ There are currently 2 kinds of errors that you might see:
2. If all 4 LEDs cycle on and off slowly, then there was a hard fault.
This cannot be recovered from and you need to do a hard reset.
+.. include:: hardware/index.rst
diff --git a/docs/pyboard/hardware/index.rst b/docs/pyboard/hardware/index.rst
index bc4726ce2..91fea24e7 100644
--- a/docs/pyboard/hardware/index.rst
+++ b/docs/pyboard/hardware/index.rst
@@ -1,7 +1,7 @@
.. _hardware_index:
The pyboard hardware
-====================
+--------------------
For the pyboard:
@@ -16,14 +16,14 @@ For the official skin modules:
* LCD160CRv1.0: see :mod:`lcd160cr`
Datasheets for the components on the pyboard
-============================================
+--------------------------------------------
* The microcontroller: `STM32F405RGT6 `_ (link to manufacturer's site)
* The accelerometer: `Freescale MMA7660 `_ (800kiB PDF)
* The LDO voltage regulator: `Microchip MCP1802 `_ (400kiB PDF)
Datasheets for other components
-===============================
+-------------------------------
* The LCD display on the LCD touch-sensor skin: `Newhaven Display NHD-C12832A1Z-FSW-FBW-3V3 `_ (460KiB PDF)
* The touch sensor chip on the LCD touch-sensor skin: `Freescale MPR121 `_ (280KiB PDF)
diff --git a/docs/pyboard/tutorial/index.rst b/docs/pyboard/tutorial/index.rst
index 07f136c9b..1dc155f14 100644
--- a/docs/pyboard/tutorial/index.rst
+++ b/docs/pyboard/tutorial/index.rst
@@ -1,7 +1,7 @@
.. _tutorial-index:
-MicroPython tutorial
-====================
+MicroPython tutorial for the pyboard
+====================================
This tutorial is intended to get you started with your pyboard.
All you need is a pyboard and a micro-USB cable to connect it to
diff --git a/docs/pyboard_index.rst b/docs/pyboard_index.rst
index 9d8f783de..2255a7560 100644
--- a/docs/pyboard_index.rst
+++ b/docs/pyboard_index.rst
@@ -6,7 +6,6 @@ MicroPython documentation and references
pyboard/quickref.rst
pyboard/general.rst
pyboard/tutorial/index.rst
- pyboard/hardware/index.rst
library/index.rst
reference/index.rst
genrst/index.rst
diff --git a/docs/templates/topindex.html b/docs/templates/topindex.html
index 3a9269eb1..84f3a3aec 100644
--- a/docs/templates/topindex.html
+++ b/docs/templates/topindex.html
@@ -58,10 +58,6 @@
information about MicroPython specific language features
{% if port == "pyboard" %}
-
- The {{ port }} hardware
- schematics, dimensions and component datasheets
-
Guide for {{ port_name }} on Windows (PDF)
including DFU programming
From ffb13cc63366a4356a3a26df8e4b27632fd71f76 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Mon, 3 Jul 2017 00:55:09 +0300
Subject: [PATCH 120/252] docs/uerrno: Document "uerrno" module.
---
docs/library/index.rst | 3 +++
docs/library/uerrno.rst | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 docs/library/uerrno.rst
diff --git a/docs/library/index.rst b/docs/library/index.rst
index 8a59628e2..e884f266e 100644
--- a/docs/library/index.rst
+++ b/docs/library/index.rst
@@ -77,6 +77,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
@@ -102,6 +103,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
@@ -144,6 +146,7 @@ it will fallback to loading the built-in ``ujson`` module.
sys.rst
ubinascii.rst
ucollections.rst
+ uerrno.rst
uhashlib.rst
uheapq.rst
uio.rst
diff --git a/docs/library/uerrno.rst b/docs/library/uerrno.rst
new file mode 100644
index 000000000..0cdcc8448
--- /dev/null
+++ b/docs/library/uerrno.rst
@@ -0,0 +1,34 @@
+:mod:`uerrno` -- system error codes
+===================================
+
+.. module:: uerrno
+ :synopsis: system error codes
+
+|see_cpython_module| :mod:`python:errno`.
+
+This module provides access to symbolic error codes for `OSError` exception.
+A particular inventory of codes depends on `MicroPython port`.
+
+Constants
+---------
+
+.. data:: EEXIST, EAGAIN, etc.
+
+ Error codes, based on ANSI C/POSIX standard. All error codes start with
+ "E". As mentioned above, inventory of the codes depends on
+ `MicroPython port`. Errors are usually accessible as ``exc.args[0]``
+ where `exc` is an instance of `OSError`. Usage example::
+
+ try:
+ uos.mkdir("my_dir")
+ except OSError as exc:
+ if exc.args[0] == uerrno.EEXIST:
+ print("Directory already exists")
+
+.. data:: errorcode
+
+ Dictionary mapping numeric error codes to strings with symbolic error
+ code (see above)::
+
+ >>> print(uerrno.errorcode[uerrno.EEXIST])
+ EEXIST
From 45b127e7ac95308b51364b22f174c8b15d1f8e89 Mon Sep 17 00:00:00 2001
From: Patrick O'Leary
Date: Sun, 2 Jul 2017 20:02:19 -0500
Subject: [PATCH 121/252] docs/esp8266/general.rst: Fix name of NTP module.
The simple NTP client module is named "ntptime.py".
---
docs/esp8266/general.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/esp8266/general.rst b/docs/esp8266/general.rst
index 47df80d7b..6d186fcd2 100644
--- a/docs/esp8266/general.rst
+++ b/docs/esp8266/general.rst
@@ -116,7 +116,7 @@ Real-time clock
RTC in ESP8266 has very bad accuracy, drift may be seconds per minute. As
a workaround, to measure short enough intervals you can use
``utime.time()``, etc. functions, and for wall clock time, synchronize from
-the net using included ``ntpdate.py`` module.
+the net using included ``ntptime.py`` module.
Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
will overflow every 7:45h. If a long-term working RTC time is required then
From b86c65d31c61af42a3b634c6a3150917509e3e8b Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 3 Jul 2017 14:52:00 +1000
Subject: [PATCH 122/252] extmod/modubinascii: Add check for empty buffer
passed to hexlify.
Previous to this patch hexlify(b'', b':') would lead to a bad crash due to
the computed length of the result being -1=0xffffffff.
---
extmod/modubinascii.c | 6 ++++++
tests/extmod/ubinascii_micropython.py | 3 +++
tests/extmod/ubinascii_micropython.py.exp | 1 +
3 files changed, 10 insertions(+)
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index 07b8b15bf..cf250d27f 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -42,6 +42,12 @@ mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ);
+ // Code below assumes non-zero buffer length when computing size with
+ // separator, so handle the zero-length case here.
+ if (bufinfo.len == 0) {
+ return mp_const_empty_bytes;
+ }
+
vstr_t vstr;
size_t out_len = bufinfo.len * 2;
if (n_args > 1) {
diff --git a/tests/extmod/ubinascii_micropython.py b/tests/extmod/ubinascii_micropython.py
index a4c00a2cb..77084ec9e 100644
--- a/tests/extmod/ubinascii_micropython.py
+++ b/tests/extmod/ubinascii_micropython.py
@@ -10,3 +10,6 @@ except ImportError:
# two arguments supported in uPy but not CPython
a = binascii.hexlify(b'123', ':')
print(a)
+
+# zero length buffer
+print(binascii.hexlify(b'', b':'))
diff --git a/tests/extmod/ubinascii_micropython.py.exp b/tests/extmod/ubinascii_micropython.py.exp
index 0ae3d768e..a195d2602 100644
--- a/tests/extmod/ubinascii_micropython.py.exp
+++ b/tests/extmod/ubinascii_micropython.py.exp
@@ -1 +1,2 @@
b'31:32:33'
+b''
From 3c62577ee9084068c63c5731977c601eb436ddc9 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 3 Jul 2017 15:31:41 +1000
Subject: [PATCH 123/252] docs/pyboard: Move info about using Windows from
topindex to general.
---
docs/pyboard/general.rst | 8 ++++++++
docs/templates/topindex.html | 6 ------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/docs/pyboard/general.rst b/docs/pyboard/general.rst
index 8cb801f4d..97e9aabc0 100644
--- a/docs/pyboard/general.rst
+++ b/docs/pyboard/general.rst
@@ -69,4 +69,12 @@ There are currently 2 kinds of errors that you might see:
2. If all 4 LEDs cycle on and off slowly, then there was a hard fault.
This cannot be recovered from and you need to do a hard reset.
+Guide for using the pyboard with Windows
+----------------------------------------
+
+The following PDF guide gives information about using the pyboard with Windows,
+including setting up the serial prompt and downloading new firmware using
+DFU programming:
+`PDF guide `__.
+
.. include:: hardware/index.rst
diff --git a/docs/templates/topindex.html b/docs/templates/topindex.html
index 84f3a3aec..76e5e18d7 100644
--- a/docs/templates/topindex.html
+++ b/docs/templates/topindex.html
@@ -57,12 +57,6 @@
Language Reference
information about MicroPython specific language features
- {% if port == "pyboard" %}
-
- Guide for {{ port_name }} on Windows (PDF)
- including DFU programming
-
- {% endif %}
License
MicroPython license information
From 5b509dbc7bd542ad9fdc7e94f8b8c096db8bef40 Mon Sep 17 00:00:00 2001
From: Alberto Petrucci
Date: Fri, 30 Jun 2017 14:23:21 +0200
Subject: [PATCH 124/252] stmhal/boards: Add configuration files for
NUCLEO_F429ZI.
---
stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h | 85 ++++
stmhal/boards/NUCLEO_F429ZI/mpconfigboard.mk | 4 +
stmhal/boards/NUCLEO_F429ZI/pins.csv | 117 +++++
.../boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h | 412 ++++++++++++++++++
4 files changed, 618 insertions(+)
create mode 100644 stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
create mode 100644 stmhal/boards/NUCLEO_F429ZI/mpconfigboard.mk
create mode 100644 stmhal/boards/NUCLEO_F429ZI/pins.csv
create mode 100644 stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
diff --git a/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
new file mode 100644
index 000000000..fcbc382a9
--- /dev/null
+++ b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
@@ -0,0 +1,85 @@
+#include STM32_HAL_H
+
+#define MICROPY_HW_BOARD_NAME "NUCLEO-F429ZI"
+#define MICROPY_HW_MCU_NAME "STM32F429"
+
+#define MICROPY_HW_HAS_SWITCH (1)
+#define MICROPY_HW_HAS_FLASH (1)
+#define MICROPY_HW_HAS_SDCARD (0)
+#define MICROPY_HW_HAS_MMA7660 (0)
+#define MICROPY_HW_HAS_LIS3DSH (0)
+#define MICROPY_HW_HAS_LCD (0)
+#define MICROPY_HW_ENABLE_RNG (1)
+#define MICROPY_HW_ENABLE_RTC (1)
+#define MICROPY_HW_ENABLE_TIMER (1)
+#define MICROPY_HW_ENABLE_SERVO (0)
+#define MICROPY_HW_ENABLE_DAC (0)
+#define MICROPY_HW_ENABLE_CAN (1)
+
+// HSE is 8MHz
+#define MICROPY_HW_CLK_PLLM (8)
+#define MICROPY_HW_CLK_PLLN (180)
+#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
+#define MICROPY_HW_CLK_PLLQ (4)
+
+// From the reference manual, for 2.7V to 3.6V
+// 151-180 MHz => 5 wait states
+// 181-210 MHz => 6 wait states
+// 211-216 MHz => 7 wait states
+#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_6
+
+// UART config
+#define MICROPY_HW_UART1_TX (pin_A9)
+#define MICROPY_HW_UART1_RX (pin_A10)
+
+#define MICROPY_HW_UART2_TX (pin_D5)
+#define MICROPY_HW_UART2_RX (pin_D6)
+
+#define MICROPY_HW_UART3_TX (pin_D8)
+#define MICROPY_HW_UART3_RX (pin_D9)
+
+#define MICROPY_HW_UART4_TX (pin_A0)
+#define MICROPY_HW_UART4_RX (pin_C11)
+
+#define MICROPY_HW_UART5_TX (pin_C12)
+#define MICROPY_HW_UART5_RX (pin_D2)
+
+#define MICROPY_HW_UART_REPL PYB_UART_3
+#define MICROPY_HW_UART_REPL_BAUD 115200
+
+// I2C busses
+#define MICROPY_HW_I2C3_SCL (pin_A8)
+#define MICROPY_HW_I2C3_SDA (pin_C9)
+
+// SPI busses
+#define MICROPY_HW_SPI1_NSS (pin_A4)
+#define MICROPY_HW_SPI1_SCK (pin_B3)
+#define MICROPY_HW_SPI1_MISO (pin_B4)
+#define MICROPY_HW_SPI1_MOSI (pin_B5)
+
+#define MICROPY_HW_SPI4_NSS (pin_E4)
+#define MICROPY_HW_SPI4_SCK (pin_E2)
+#define MICROPY_HW_SPI4_MISO (pin_E5)
+#define MICROPY_HW_SPI4_MOSI (pin_E6)
+
+#define MICROPY_HW_SPI5_NSS (pin_F6)
+#define MICROPY_HW_SPI5_SCK (pin_F7)
+#define MICROPY_HW_SPI5_MISO (pin_F8)
+#define MICROPY_HW_SPI5_MOSI (pin_F9)
+
+// USRSW is pulled low. Pressing the button makes the input go high.
+#define MICROPY_HW_USRSW_PIN (pin_C13)
+#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
+#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING)
+#define MICROPY_HW_USRSW_PRESSED (1)
+
+// LEDs
+#define MICROPY_HW_LED1 (pin_B0) // green
+#define MICROPY_HW_LED2 (pin_B7) // blue
+#define MICROPY_HW_LED3 (pin_B14) // red
+#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin))
+#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin))
+
+// USB config (CN13 - USB OTG FS)
+#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
+#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)
diff --git a/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.mk b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.mk
new file mode 100644
index 000000000..1bbf808b6
--- /dev/null
+++ b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.mk
@@ -0,0 +1,4 @@
+MCU_SERIES = f4
+CMSIS_MCU = STM32F429xx
+AF_FILE = boards/stm32f429_af.csv
+LD_FILE = boards/stm32f429.ld
diff --git a/stmhal/boards/NUCLEO_F429ZI/pins.csv b/stmhal/boards/NUCLEO_F429ZI/pins.csv
new file mode 100644
index 000000000..8a892d3c2
--- /dev/null
+++ b/stmhal/boards/NUCLEO_F429ZI/pins.csv
@@ -0,0 +1,117 @@
+PF4,PF4
+PF5,PF5
+PF2,PF2
+PF3,PF3
+PF0,PF0
+PF1,PF1
+PC14,PC14
+PC15,PC15
+PE6,PE6
+PC13,PC13
+PE4,PE4
+PE5,PE5
+PE2,PE2
+PE3,PE3
+PE0,PE0
+PE1,PE1
+PB8,PB8
+PB9,PB9
+PB6,PB6
+PB7,PB7
+PB4,PB4
+PB5,PB5
+PG15,PG15
+PB3,PB3
+PG13,PG13
+PG14,PG14
+PG11,PG11
+PG12,PG12
+PG9,PG9
+PG10,PG10
+PD7,PD7
+PD6,PD6
+PD5,PD5
+PD4,PD4
+PD3,PD3
+PD2,PD2
+PD1,PD1
+PD0,PD0
+PC12,PC12
+PC11,PC11
+PC10,PC10
+PA15,PA15
+PA14,PA14
+PA13,PA13
+PA12,PA12
+PA11,PA11
+PA10,PA10
+PA9,PA9
+PA8,PA8
+PC9,PC9
+PC8,PC8
+PC7,PC7
+PC6,PC6
+PG8,PG8
+PG7,PG7
+PG6,PG6
+PG5,PG5
+PG4,PG4
+PF6,PF6
+PF8,PF8
+PF7,PF7
+PF10,PF10
+PF9,PF9
+PH1,PH1
+PH0,PH0
+PC1,PC1
+PC0,PC0
+PC3,PC3
+PC2,PC2
+PA1,PA1
+PA0,PA0
+PA3,PA3
+PA2,PA2
+PA5,PA5
+PA4,PA4
+PA7,PA7
+PA6,PA6
+PC5,PC5
+PC4,PC4
+PB1,PB1
+PB0,PB0
+PB2,PB2
+PF12,PF12
+PF11,PF11
+PF14,PF14
+PF13,PF13
+PG0,PG0
+PF15,PF15
+PE7,PE7
+PG1,PG1
+PE9,PE9
+PE8,PE8
+PE11,PE11
+PE10,PE10
+PE13,PE13
+PE12,PE12
+PE15,PE15
+PE14,PE14
+PB11,PB11
+PB10,PB10
+PB13,PB13
+PB12,PB12
+PB15,PB15
+PB14,PB14
+PD9,PD9
+PD8,PD8
+PD11,PD11
+PD10,PD10
+PD13,PD13
+PD12,PD12
+PD15,PD15
+PD14,PD14
+PG3,PG3
+PG2,PG2
+SW,PA0
+LED_GREEN,PG13
+LED_RED,PG14
diff --git a/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h b/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
new file mode 100644
index 000000000..4f5962dcb
--- /dev/null
+++ b/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
@@ -0,0 +1,412 @@
+/**
+ ******************************************************************************
+ * @file stm32f4xx_hal_conf.h
+ * @author MCD Application Team
+ * @version V1.1.0
+ * @date 19-June-2014
+ * @brief HAL configuration file.
+ ******************************************************************************
+ * @attention
+ *
+ * © COPYRIGHT(c) 2014 STMicroelectronics
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32F4xx_HAL_CONF_H
+#define __STM32F4xx_HAL_CONF_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+
+#define USE_USB_HS
+#define USE_USB_HS_IN_FS
+
+ /* ########################## Module Selection ############################## */
+/**
+ * @brief This is the list of modules to be used in the HAL driver
+ */
+#define HAL_MODULE_ENABLED
+#define HAL_ADC_MODULE_ENABLED
+#define HAL_CAN_MODULE_ENABLED
+/* #define HAL_CRC_MODULE_ENABLED */
+/* #define HAL_CRYP_MODULE_ENABLED */
+#define HAL_DAC_MODULE_ENABLED
+/* #define HAL_DCMI_MODULE_ENABLED */
+#define HAL_DMA_MODULE_ENABLED
+/* #define HAL_DMA2D_MODULE_ENABLED */
+/* #define HAL_ETH_MODULE_ENABLED */
+#define HAL_FLASH_MODULE_ENABLED
+/* #define HAL_NAND_MODULE_ENABLED */
+/* #define HAL_NOR_MODULE_ENABLED */
+/* #define HAL_PCCARD_MODULE_ENABLED */
+/* #define HAL_SRAM_MODULE_ENABLED */
+/* #define HAL_SDRAM_MODULE_ENABLED */
+/* #define HAL_HASH_MODULE_ENABLED */
+#define HAL_GPIO_MODULE_ENABLED
+#define HAL_I2C_MODULE_ENABLED
+/* #define HAL_I2S_MODULE_ENABLED */
+/* #define HAL_IWDG_MODULE_ENABLED */
+/* #define HAL_LTDC_MODULE_ENABLED */
+#define HAL_PWR_MODULE_ENABLED
+#define HAL_RCC_MODULE_ENABLED
+#define HAL_RNG_MODULE_ENABLED
+#define HAL_RTC_MODULE_ENABLED
+/* #define HAL_SAI_MODULE_ENABLED */
+#define HAL_SD_MODULE_ENABLED
+#define HAL_SPI_MODULE_ENABLED
+#define HAL_TIM_MODULE_ENABLED
+#define HAL_UART_MODULE_ENABLED
+/* #define HAL_USART_MODULE_ENABLED */
+/* #define HAL_IRDA_MODULE_ENABLED */
+/* #define HAL_SMARTCARD_MODULE_ENABLED */
+/* #define HAL_WWDG_MODULE_ENABLED */
+#define HAL_CORTEX_MODULE_ENABLED
+#define HAL_PCD_MODULE_ENABLED
+/* #define HAL_HCD_MODULE_ENABLED */
+
+
+/* ########################## HSE/HSI Values adaptation ##################### */
+/**
+ * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSE is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (HSE_STARTUP_TIMEOUT)
+ #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
+#endif /* HSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief Internal High Speed oscillator (HSI) value.
+ * This value is used by the RCC HAL module to compute the system frequency
+ * (when HSI is used as system clock source, directly or through the PLL).
+ */
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+/**
+ * @brief Internal Low Speed oscillator (LSI) value.
+ */
+#if !defined (LSI_VALUE)
+ #define LSI_VALUE ((uint32_t)40000)
+#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
+ The real value may vary depending on the variations
+ in voltage and temperature. */
+/**
+ * @brief External Low Speed oscillator (LSE) value.
+ */
+#if !defined (LSE_VALUE)
+ #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
+#endif /* LSE_VALUE */
+
+#if !defined (LSE_STARTUP_TIMEOUT)
+ #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
+#endif /* LSE_STARTUP_TIMEOUT */
+
+/**
+ * @brief External clock source for I2S peripheral
+ * This value is used by the I2S HAL module to compute the I2S clock source
+ * frequency, this source is inserted directly through I2S_CKIN pad.
+ */
+#if !defined (EXTERNAL_CLOCK_VALUE)
+ #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000) /*!< Value of the Internal oscillator in Hz*/
+#endif /* EXTERNAL_CLOCK_VALUE */
+
+/* Tip: To avoid modifying this file each time you need to use different HSE,
+ === you can define the HSE value in your toolchain compiler preprocessor. */
+
+/* ########################### System Configuration ######################### */
+/**
+ * @brief This is the HAL system configuration section
+ */
+#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
+#define TICK_INT_PRIORITY ((uint32_t)0x00) /*!< tick interrupt priority */
+#define USE_RTOS 0
+#define PREFETCH_ENABLE 1
+#define INSTRUCTION_CACHE_ENABLE 1
+#define DATA_CACHE_ENABLE 1
+
+/* ########################## Assert Selection ############################## */
+/**
+ * @brief Uncomment the line below to expanse the "assert_param" macro in the
+ * HAL drivers code
+ */
+/* #define USE_FULL_ASSERT 1 */
+
+/* ################## Ethernet peripheral configuration ##################### */
+
+/* Section 1 : Ethernet peripheral configuration */
+
+/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
+#define MAC_ADDR0 2
+#define MAC_ADDR1 0
+#define MAC_ADDR2 0
+#define MAC_ADDR3 0
+#define MAC_ADDR4 0
+#define MAC_ADDR5 0
+
+/* Definition of the Ethernet driver buffers size and count */
+#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
+#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
+#define ETH_RXBUFNB ((uint32_t)4) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
+#define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
+
+/* Section 2: PHY configuration section */
+
+/* DP83848 PHY Address*/
+#define DP83848_PHY_ADDRESS 0x01
+/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
+#define PHY_RESET_DELAY ((uint32_t)0x000000FF)
+/* PHY Configuration delay */
+#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
+
+#define PHY_READ_TO ((uint32_t)0x0000FFFF)
+#define PHY_WRITE_TO ((uint32_t)0x0000FFFF)
+
+/* Section 3: Common PHY Registers */
+
+#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
+#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
+
+#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
+#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
+#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
+#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
+#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
+#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
+#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
+#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
+#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
+#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
+
+#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
+#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
+#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
+
+/* Section 4: Extended PHY Registers */
+
+#define PHY_SR ((uint16_t)0x10) /*!< PHY status register Offset */
+#define PHY_MICR ((uint16_t)0x11) /*!< MII Interrupt Control Register */
+#define PHY_MISR ((uint16_t)0x12) /*!< MII Interrupt Status and Misc. Control Register */
+
+#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */
+#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */
+#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */
+
+#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */
+#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */
+
+#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */
+#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */
+
+/* Includes ------------------------------------------------------------------*/
+/**
+ * @brief Include module's header file
+ */
+
+#ifdef HAL_RCC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rcc.h"
+#endif /* HAL_RCC_MODULE_ENABLED */
+
+#ifdef HAL_GPIO_MODULE_ENABLED
+ #include "stm32f4xx_hal_gpio.h"
+#endif /* HAL_GPIO_MODULE_ENABLED */
+
+#ifdef HAL_DMA_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma.h"
+#endif /* HAL_DMA_MODULE_ENABLED */
+
+#ifdef HAL_CORTEX_MODULE_ENABLED
+ #include "stm32f4xx_hal_cortex.h"
+#endif /* HAL_CORTEX_MODULE_ENABLED */
+
+#ifdef HAL_ADC_MODULE_ENABLED
+ #include "stm32f4xx_hal_adc.h"
+#endif /* HAL_ADC_MODULE_ENABLED */
+
+#ifdef HAL_CAN_MODULE_ENABLED
+ #include "stm32f4xx_hal_can.h"
+#endif /* HAL_CAN_MODULE_ENABLED */
+
+#ifdef HAL_CRC_MODULE_ENABLED
+ #include "stm32f4xx_hal_crc.h"
+#endif /* HAL_CRC_MODULE_ENABLED */
+
+#ifdef HAL_CRYP_MODULE_ENABLED
+ #include "stm32f4xx_hal_cryp.h"
+#endif /* HAL_CRYP_MODULE_ENABLED */
+
+#ifdef HAL_DMA2D_MODULE_ENABLED
+ #include "stm32f4xx_hal_dma2d.h"
+#endif /* HAL_DMA2D_MODULE_ENABLED */
+
+#ifdef HAL_DAC_MODULE_ENABLED
+ #include "stm32f4xx_hal_dac.h"
+#endif /* HAL_DAC_MODULE_ENABLED */
+
+#ifdef HAL_DCMI_MODULE_ENABLED
+ #include "stm32f4xx_hal_dcmi.h"
+#endif /* HAL_DCMI_MODULE_ENABLED */
+
+#ifdef HAL_ETH_MODULE_ENABLED
+ #include "stm32f4xx_hal_eth.h"
+#endif /* HAL_ETH_MODULE_ENABLED */
+
+#ifdef HAL_FLASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_flash.h"
+#endif /* HAL_FLASH_MODULE_ENABLED */
+
+#ifdef HAL_SRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sram.h"
+#endif /* HAL_SRAM_MODULE_ENABLED */
+
+#ifdef HAL_NOR_MODULE_ENABLED
+ #include "stm32f4xx_hal_nor.h"
+#endif /* HAL_NOR_MODULE_ENABLED */
+
+#ifdef HAL_NAND_MODULE_ENABLED
+ #include "stm32f4xx_hal_nand.h"
+#endif /* HAL_NAND_MODULE_ENABLED */
+
+#ifdef HAL_PCCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pccard.h"
+#endif /* HAL_PCCARD_MODULE_ENABLED */
+
+#ifdef HAL_SDRAM_MODULE_ENABLED
+ #include "stm32f4xx_hal_sdram.h"
+#endif /* HAL_SDRAM_MODULE_ENABLED */
+
+#ifdef HAL_HASH_MODULE_ENABLED
+ #include "stm32f4xx_hal_hash.h"
+#endif /* HAL_HASH_MODULE_ENABLED */
+
+#ifdef HAL_I2C_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2c.h"
+#endif /* HAL_I2C_MODULE_ENABLED */
+
+#ifdef HAL_I2S_MODULE_ENABLED
+ #include "stm32f4xx_hal_i2s.h"
+#endif /* HAL_I2S_MODULE_ENABLED */
+
+#ifdef HAL_IWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_iwdg.h"
+#endif /* HAL_IWDG_MODULE_ENABLED */
+
+#ifdef HAL_LTDC_MODULE_ENABLED
+ #include "stm32f4xx_hal_ltdc.h"
+#endif /* HAL_LTDC_MODULE_ENABLED */
+
+#ifdef HAL_PWR_MODULE_ENABLED
+ #include "stm32f4xx_hal_pwr.h"
+#endif /* HAL_PWR_MODULE_ENABLED */
+
+#ifdef HAL_RNG_MODULE_ENABLED
+ #include "stm32f4xx_hal_rng.h"
+#endif /* HAL_RNG_MODULE_ENABLED */
+
+#ifdef HAL_RTC_MODULE_ENABLED
+ #include "stm32f4xx_hal_rtc.h"
+#endif /* HAL_RTC_MODULE_ENABLED */
+
+#ifdef HAL_SAI_MODULE_ENABLED
+ #include "stm32f4xx_hal_sai.h"
+#endif /* HAL_SAI_MODULE_ENABLED */
+
+#ifdef HAL_SD_MODULE_ENABLED
+ #include "stm32f4xx_hal_sd.h"
+#endif /* HAL_SD_MODULE_ENABLED */
+
+#ifdef HAL_SPI_MODULE_ENABLED
+ #include "stm32f4xx_hal_spi.h"
+#endif /* HAL_SPI_MODULE_ENABLED */
+
+#ifdef HAL_TIM_MODULE_ENABLED
+ #include "stm32f4xx_hal_tim.h"
+#endif /* HAL_TIM_MODULE_ENABLED */
+
+#ifdef HAL_UART_MODULE_ENABLED
+ #include "stm32f4xx_hal_uart.h"
+#endif /* HAL_UART_MODULE_ENABLED */
+
+#ifdef HAL_USART_MODULE_ENABLED
+ #include "stm32f4xx_hal_usart.h"
+#endif /* HAL_USART_MODULE_ENABLED */
+
+#ifdef HAL_IRDA_MODULE_ENABLED
+ #include "stm32f4xx_hal_irda.h"
+#endif /* HAL_IRDA_MODULE_ENABLED */
+
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
+ #include "stm32f4xx_hal_smartcard.h"
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
+
+#ifdef HAL_WWDG_MODULE_ENABLED
+ #include "stm32f4xx_hal_wwdg.h"
+#endif /* HAL_WWDG_MODULE_ENABLED */
+
+#ifdef HAL_PCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_pcd.h"
+#endif /* HAL_PCD_MODULE_ENABLED */
+
+#ifdef HAL_HCD_MODULE_ENABLED
+ #include "stm32f4xx_hal_hcd.h"
+#endif /* HAL_HCD_MODULE_ENABLED */
+
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0)
+#endif /* USE_FULL_ASSERT */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32F4xx_HAL_CONF_H */
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
From 80b31dc0972eca3f67dd2be7518b133e316e8f32 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 3 Jul 2017 17:37:22 +1000
Subject: [PATCH 125/252] stmhal: Clean up some header includes.
---
stmhal/boards/LIMIFROG/mpconfigboard.h | 2 --
stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h | 2 --
stmhal/boards/STM32F429DISC/mpconfigboard.h | 2 --
stmhal/boards/STM32L476DISC/mpconfigboard.h | 2 --
stmhal/dac.c | 3 ---
stmhal/dma.c | 3 +--
stmhal/flash.c | 6 ++----
stmhal/modpyb.c | 2 --
stmhal/modstm.c | 8 ++------
stmhal/modutime.c | 3 +--
stmhal/pendsv.c | 1 -
stmhal/rng.c | 2 --
stmhal/rtc.c | 3 ---
stmhal/servo.c | 2 --
stmhal/stm32_it.c | 4 +---
stmhal/system_stm32.c | 3 +--
stmhal/timer.c | 2 --
stmhal/usbd_conf.c | 1 -
stmhal/usbd_conf.h | 1 -
stmhal/wdt.c | 2 --
20 files changed, 8 insertions(+), 46 deletions(-)
diff --git a/stmhal/boards/LIMIFROG/mpconfigboard.h b/stmhal/boards/LIMIFROG/mpconfigboard.h
index d04634ac3..42b862fcf 100644
--- a/stmhal/boards/LIMIFROG/mpconfigboard.h
+++ b/stmhal/boards/LIMIFROG/mpconfigboard.h
@@ -1,5 +1,3 @@
-#include STM32_HAL_H
-
#define MICROPY_HW_BOARD_NAME "LIMIFROG"
#define MICROPY_HW_MCU_NAME "STM32L476"
diff --git a/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
index fcbc382a9..42cc9d68c 100644
--- a/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
+++ b/stmhal/boards/NUCLEO_F429ZI/mpconfigboard.h
@@ -1,5 +1,3 @@
-#include STM32_HAL_H
-
#define MICROPY_HW_BOARD_NAME "NUCLEO-F429ZI"
#define MICROPY_HW_MCU_NAME "STM32F429"
diff --git a/stmhal/boards/STM32F429DISC/mpconfigboard.h b/stmhal/boards/STM32F429DISC/mpconfigboard.h
index a8e379020..fc0702025 100644
--- a/stmhal/boards/STM32F429DISC/mpconfigboard.h
+++ b/stmhal/boards/STM32F429DISC/mpconfigboard.h
@@ -1,5 +1,3 @@
-#include STM32_HAL_H
-
#define MICROPY_HW_BOARD_NAME "F429I-DISCO"
#define MICROPY_HW_MCU_NAME "STM32F429"
diff --git a/stmhal/boards/STM32L476DISC/mpconfigboard.h b/stmhal/boards/STM32L476DISC/mpconfigboard.h
index 258a86b60..9dbadd530 100644
--- a/stmhal/boards/STM32L476DISC/mpconfigboard.h
+++ b/stmhal/boards/STM32L476DISC/mpconfigboard.h
@@ -1,5 +1,3 @@
-#include STM32_HAL_H
-
#define MICROPY_BOARD_EARLY_INIT STM32L476DISC_board_early_init
void STM32L476DISC_board_early_init(void);
diff --git a/stmhal/dac.c b/stmhal/dac.c
index 1c372f73c..243aa08c3 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -28,9 +28,6 @@
#include
#include
-#include STM32_HAL_H
-
-#include "py/nlr.h"
#include "py/runtime.h"
#include "timer.h"
#include "dac.h"
diff --git a/stmhal/dma.c b/stmhal/dma.c
index 04c874dc2..e43b67e73 100644
--- a/stmhal/dma.c
+++ b/stmhal/dma.c
@@ -27,10 +27,9 @@
#include
#include
#include
-#include STM32_HAL_H
-#include "dma.h"
#include "py/obj.h"
+#include "dma.h"
#include "irq.h"
typedef enum {
diff --git a/stmhal/flash.c b/stmhal/flash.c
index 29de8b8da..e374be0e5 100644
--- a/stmhal/flash.c
+++ b/stmhal/flash.c
@@ -24,11 +24,9 @@
* THE SOFTWARE.
*/
-#include STM32_HAL_H
-
-#include "flash.h"
-#include "mpconfigport.h"
+#include "py/mpconfig.h"
#include "py/misc.h"
+#include "flash.h"
typedef struct {
uint32_t base_address;
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index b8da948ab..7322c6a5b 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -27,8 +27,6 @@
#include
#include
-#include STM32_HAL_H
-
#include "py/mpstate.h"
#include "py/nlr.h"
#include "py/obj.h"
diff --git a/stmhal/modstm.c b/stmhal/modstm.c
index 18882fa47..eabbf08e4 100644
--- a/stmhal/modstm.c
+++ b/stmhal/modstm.c
@@ -27,15 +27,11 @@
#include
#include
-#include STM32_HAL_H
-
-#include "py/nlr.h"
#include "py/obj.h"
-#include "extmod/machine_mem.h"
-#include "portmodules.h"
-
#include "py/objint.h"
+#include "extmod/machine_mem.h"
#include "genhdr/modstm_mpz.h"
+#include "portmodules.h"
STATIC const mp_rom_map_elem_t stm_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_stm) },
diff --git a/stmhal/modutime.c b/stmhal/modutime.c
index 97af35c49..58c43a55e 100644
--- a/stmhal/modutime.c
+++ b/stmhal/modutime.c
@@ -26,9 +26,8 @@
#include
#include
-#include STM32_HAL_H
-#include "py/nlr.h"
+#include "py/runtime.h"
#include "py/smallint.h"
#include "py/obj.h"
#include "lib/timeutils/timeutils.h"
diff --git a/stmhal/pendsv.c b/stmhal/pendsv.c
index 200d13a5a..7b3906f25 100644
--- a/stmhal/pendsv.c
+++ b/stmhal/pendsv.c
@@ -25,7 +25,6 @@
*/
#include
-#include STM32_HAL_H
#include "py/mpstate.h"
#include "py/runtime.h"
diff --git a/stmhal/rng.c b/stmhal/rng.c
index 2571bc3a0..a5a9874d1 100644
--- a/stmhal/rng.c
+++ b/stmhal/rng.c
@@ -26,8 +26,6 @@
#include
-#include STM32_HAL_H
-
#include "py/obj.h"
#include "rng.h"
diff --git a/stmhal/rtc.c b/stmhal/rtc.c
index bc9c889c2..755684570 100644
--- a/stmhal/rtc.c
+++ b/stmhal/rtc.c
@@ -26,12 +26,9 @@
#include
-#include STM32_HAL_H
-
#include "py/runtime.h"
#include "rtc.h"
#include "irq.h"
-#include "mphalport.h"
/// \moduleref pyb
/// \class RTC - real time clock
diff --git a/stmhal/servo.c b/stmhal/servo.c
index 1f1aa5a2d..6ea6938ad 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -26,8 +26,6 @@
#include
-#include STM32_HAL_H
-
#include "py/nlr.h"
#include "py/runtime.h"
#include "timer.h"
diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c
index 913f1c931..357b6d79d 100644
--- a/stmhal/stm32_it.c
+++ b/stmhal/stm32_it.c
@@ -67,12 +67,10 @@
#include
-#include "stm32_it.h"
-#include STM32_HAL_H
-
#include "py/mpstate.h"
#include "py/obj.h"
#include "py/mphal.h"
+#include "stm32_it.h"
#include "pendsv.h"
#include "irq.h"
#include "pybthread.h"
diff --git a/stmhal/system_stm32.c b/stmhal/system_stm32.c
index 266b8a92a..a63bd3c57 100644
--- a/stmhal/system_stm32.c
+++ b/stmhal/system_stm32.c
@@ -87,8 +87,7 @@
* @{
*/
-#include "mpconfigboard.h"
-#include STM32_HAL_H
+#include "py/mphal.h"
void __fatal_error(const char *msg);
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 64d445111..7db15f649 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -28,11 +28,9 @@
#include
#include
-#include STM32_HAL_H
#include "usbd_cdc_msc_hid.h"
#include "usbd_cdc_interface.h"
-#include "py/nlr.h"
#include "py/runtime.h"
#include "py/gc.h"
#include "timer.h"
diff --git a/stmhal/usbd_conf.c b/stmhal/usbd_conf.c
index 1da987d89..e2bd6c949 100644
--- a/stmhal/usbd_conf.c
+++ b/stmhal/usbd_conf.c
@@ -30,7 +30,6 @@
*/
/* Includes ------------------------------------------------------------------*/
-#include STM32_HAL_H
#include "usbd_core.h"
#include "py/obj.h"
#include "irq.h"
diff --git a/stmhal/usbd_conf.h b/stmhal/usbd_conf.h
index 5415eb10b..b69ba52c2 100644
--- a/stmhal/usbd_conf.h
+++ b/stmhal/usbd_conf.h
@@ -34,7 +34,6 @@
#define __USBD_CONF_H
/* Includes ------------------------------------------------------------------*/
-#include STM32_HAL_H
#include
#include
#include
diff --git a/stmhal/wdt.c b/stmhal/wdt.c
index 272c575ef..2b4967a43 100644
--- a/stmhal/wdt.c
+++ b/stmhal/wdt.c
@@ -26,8 +26,6 @@
#include
-#include STM32_HAL_H
-
#include "py/runtime.h"
#include "wdt.h"
From 9aeba3e41b70558e3d78f1a19a88e3eafc7bd794 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 02:11:46 +1000
Subject: [PATCH 126/252] py/binary: Add missing "break" statements.
---
py/binary.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/py/binary.c b/py/binary.c
index 34feb384e..4a999b9aa 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -368,6 +368,7 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, mp_uint_t index, m
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
case 'q':
((long long*)p)[index] = val;
+ break;
case 'Q':
((unsigned long long*)p)[index] = val;
break;
@@ -383,5 +384,6 @@ void mp_binary_set_val_array_from_int(char typecode, void *p, mp_uint_t index, m
// Extension to CPython: array of pointers
case 'P':
((void**)p)[index] = (void*)(uintptr_t)val;
+ break;
}
}
From 2138258feaef3e65be8c85e19aaef57252672a64 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 02:12:36 +1000
Subject: [PATCH 127/252] py/runtime: Mark m_malloc_fail() as NORETURN.
---
py/misc.h | 2 +-
py/runtime.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/py/misc.h b/py/misc.h
index caa5945bf..5ac0f933a 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -92,7 +92,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes);
void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move);
void m_free(void *ptr);
#endif
-void *m_malloc_fail(size_t num_bytes);
+NORETURN void *m_malloc_fail(size_t num_bytes);
#if MICROPY_MEM_STATS
size_t m_get_total_bytes_allocated(void);
diff --git a/py/runtime.c b/py/runtime.c
index bf2bfb8ea..0a3a4b12d 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1408,7 +1408,7 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
#endif // MICROPY_ENABLE_COMPILER
-void *m_malloc_fail(size_t num_bytes) {
+NORETURN void *m_malloc_fail(size_t num_bytes) {
DEBUG_printf("memory allocation failed, allocating %u bytes\n", (uint)num_bytes);
if (0) {
// dummy
From 9d2c72ad4f62194b3c83ac9fae9f65329a34cdaf Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 02:13:27 +1000
Subject: [PATCH 128/252] py/objstr: Remove unnecessary "sign" variable in
formatting code.
---
py/objstr.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/py/objstr.c b/py/objstr.c
index b9cc1b1da..cea10770c 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1078,7 +1078,6 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
arg = mp_obj_new_str_from_vstr(&mp_type_str, &arg_vstr);
}
- char sign = '\0';
char fill = '\0';
char align = '\0';
int width = -1;
@@ -1114,7 +1113,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
} else if (*s == ' ') {
flags |= PF_FLAG_SPACE_SIGN;
}
- sign = *s++;
+ s++;
}
if (*s == '#') {
flags |= PF_FLAG_SHOW_PREFIX;
@@ -1160,7 +1159,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
fill = ' ';
}
- if (sign) {
+ if (flags & (PF_FLAG_SHOW_SIGN | PF_FLAG_SPACE_SIGN)) {
if (type == 's') {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
terse_str_format_value_error();
@@ -1176,8 +1175,6 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
"sign not allowed with integer format specifier 'c'");
}
}
- } else {
- sign = '-';
}
switch (align) {
From 9ed5e80eea71c8392b7c178d2e2b69e2428850d8 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 02:14:25 +1000
Subject: [PATCH 129/252] py/vm: Make "if" control flow more obvious in
YIELD_FROM opcode.
---
py/vm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/py/vm.c b/py/vm.c
index 404c79912..7451d53b9 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1159,8 +1159,7 @@ yield:
ip--;
PUSH(ret_value);
goto yield;
- }
- if (ret_kind == MP_VM_RETURN_NORMAL) {
+ } else if (ret_kind == MP_VM_RETURN_NORMAL) {
// Pop exhausted gen
sp--;
// TODO: When ret_value can be MP_OBJ_NULL here??
@@ -1176,8 +1175,8 @@ yield:
// if it was swallowed, we re-raise GeneratorExit
GENERATOR_EXIT_IF_NEEDED(t_exc);
DISPATCH();
- }
- if (ret_kind == MP_VM_RETURN_EXCEPTION) {
+ } else {
+ assert(ret_kind == MP_VM_RETURN_EXCEPTION);
// Pop exhausted gen
sp--;
if (EXC_MATCH(ret_value, MP_OBJ_FROM_PTR(&mp_type_StopIteration))) {
From 6b8b56f8596d3dde544a72d037e9feddd9f70938 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 02:15:11 +1000
Subject: [PATCH 130/252] py/modmath: Check for zero division in log with 2
args.
---
py/modmath.c | 2 ++
tests/float/math_fun.py | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/py/modmath.c b/py/modmath.c
index 10713234c..d5d135fc1 100644
--- a/py/modmath.c
+++ b/py/modmath.c
@@ -168,6 +168,8 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) {
mp_float_t base = mp_obj_get_float(args[1]);
if (base <= (mp_float_t)0.0) {
math_error();
+ } else if (base == (mp_float_t)1.0) {
+ mp_raise_msg(&mp_type_ZeroDivisionError, "division by zero");
}
return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base));
}
diff --git a/tests/float/math_fun.py b/tests/float/math_fun.py
index 80d20bd8a..2835b9bfb 100644
--- a/tests/float/math_fun.py
+++ b/tests/float/math_fun.py
@@ -51,7 +51,7 @@ binary_functions = [('copysign', copysign, [(23., 42.), (-23., 42.), (23., -42.)
('atan2', atan2, ((1., 0.), (0., 1.), (2., 0.5), (-3., 5.), (-3., -4.),)),
('fmod', fmod, ((1., 1.), (0., 1.), (2., 0.5), (-3., 5.), (-3., -4.),)),
('ldexp', ldexp, ((1., 0), (0., 1), (2., 2), (3., -2), (-3., -4),)),
- ('log', log, ((2., 2.), (3., 2.), (4., 5.), (0., 1.), (1., 0.), (-1., 1.), (1., -1.))),
+ ('log', log, ((2., 2.), (3., 2.), (4., 5.), (0., 1.), (1., 0.), (-1., 1.), (1., -1.), (2., 1.))),
]
for function_name, function, test_vals in binary_functions:
@@ -59,5 +59,5 @@ for function_name, function, test_vals in binary_functions:
for value1, value2 in test_vals:
try:
print("{:.5g}".format(function(value1, value2)))
- except ValueError as e:
- print(str(e))
+ except (ValueError, ZeroDivisionError) as e:
+ print(type(e))
From 503cf3d097e273dae88557cc5b284ba39c77e384 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Tue, 4 Jul 2017 02:32:42 +0300
Subject: [PATCH 131/252] docs/uzlib: Update description of decompress() and
mention DecompIO.
---
docs/library/uzlib.rst | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/docs/library/uzlib.rst b/docs/library/uzlib.rst
index e531407b0..fb1746fe8 100644
--- a/docs/library/uzlib.rst
+++ b/docs/library/uzlib.rst
@@ -6,13 +6,33 @@
|see_cpython_module| :mod:`python:zlib`.
-This modules allows to decompress binary data compressed with DEFLATE
-algorithm (commonly used in zlib library and gzip archiver). Compression
+This module allows to decompress binary data compressed with
+`DEFLATE algorithm `_
+(commonly used in zlib library and gzip archiver). Compression
is not yet implemented.
Functions
---------
-.. function:: decompress(data)
+.. function:: decompress(data, wbits=0, bufsize=0)
- Return decompressed data as bytes.
+ Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window
+ size used during compression (8-15, the dictionary size is power of 2 of
+ that value). Additionally, if value is positive, *data* is assumed to be
+ zlib stream (with zlib header). Otherwise, if it's negative, it's assumed
+ to be raw DEFLATE stream. *bufsize* parameter is for compatibility with
+ CPython and is ignored.
+
+.. class:: DecompIO(stream, wbits=0)
+
+ Create a stream wrapper which allows transparent decompression of
+ compressed data in another *stream*. This allows to process compressed
+ streams with data larger than available heap size. In addition to
+ values described in :func:`decompress`, *wbits* may take values
+ 24..31 (16 + 8..15), meaning that input stream has gzip header.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ This class is MicroPython extension. It's included on provisional
+ basis and may be changed considerably or removed in later versions.
From 48b745cfc800e77a49f92530b3c6d15820138edb Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 15:31:36 +1000
Subject: [PATCH 132/252] esp8266/mpconfigport_512k: Use terse error messages
to get 512k to fit.
---
esp8266/mpconfigport_512k.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/esp8266/mpconfigport_512k.h b/esp8266/mpconfigport_512k.h
index 322fb4151..b84c13479 100644
--- a/esp8266/mpconfigport_512k.h
+++ b/esp8266/mpconfigport_512k.h
@@ -5,6 +5,9 @@
#undef MICROPY_EMIT_INLINE_XTENSA
#define MICROPY_EMIT_INLINE_XTENSA (0)
+#undef MICROPY_ERROR_REPORTING
+#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
+
#undef MICROPY_VFS
#define MICROPY_VFS (0)
#undef MICROPY_VFS_FAT
From b51919f5b757ee6409f97b93c0f0a8bec84f55ad Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 22:37:41 +1000
Subject: [PATCH 133/252] py/makeversionhdr.py: Update to parse new release
line in docs/conf.py.
The line in docs/conf.py with the release/version number was recently
changed and this patch makes the makeversionhdr.py script work again.
---
py/makeversionhdr.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py
index 1d8f59bd2..749160b4d 100644
--- a/py/makeversionhdr.py
+++ b/py/makeversionhdr.py
@@ -59,8 +59,8 @@ def get_version_info_from_git():
def get_version_info_from_docs_conf():
with open(os.path.join(os.path.dirname(sys.argv[0]), "..", "docs", "conf.py")) as f:
for line in f:
- if line.startswith("release = '"):
- ver = line.strip()[10:].strip("'")
+ if line.startswith("version = release = '"):
+ ver = line.strip().split(" = ")[2].strip("'")
git_tag = "v" + ver
ver = ver.split(".")
if len(ver) == 2:
From d5ec46ace4bdd0fa3b2ca45371f537259f07a6f2 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 22:49:04 +1000
Subject: [PATCH 134/252] stmhal/boards/NUCLEO_F429ZI: Change USB config from
HS to FS peripheral.
This dev board only has a single USB connector, connected to the FS
peripheral.
---
stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h b/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
index 4f5962dcb..d121b18c5 100644
--- a/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
+++ b/stmhal/boards/NUCLEO_F429ZI/stm32f4xx_hal_conf.h
@@ -46,8 +46,7 @@
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
-#define USE_USB_HS
-#define USE_USB_HS_IN_FS
+#define USE_USB_FS
/* ########################## Module Selection ############################## */
/**
From 8b84b8ab8a1e8136b042fe69b530a1fd45c20ae1 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 23:24:59 +1000
Subject: [PATCH 135/252] py/objdict: Factorise dict accessor helper to reduce
code size.
Code size change in bytes for this patch is:
bare-arm: -72
minimal x86: -48
unix x64: -32
unix nanbox: -120
stmhal: -68
cc3200: -64
esp8266: -56
---
py/objdict.c | 43 ++++++++++++-------------------------------
1 file changed, 12 insertions(+), 31 deletions(-)
diff --git a/py/objdict.c b/py/objdict.c
index 12ba61b2e..23d3008b8 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -278,18 +278,20 @@ STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_fromkeys_fun_obj, 2, 3, dict_fromkeys);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(dict_fromkeys_obj, MP_ROM_PTR(&dict_fromkeys_fun_obj));
-STATIC mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp_map_lookup_kind_t lookup_kind) {
- mp_map_elem_t *elem = mp_map_lookup(self, key, lookup_kind);
+STATIC mp_obj_t dict_get_helper(size_t n_args, const mp_obj_t *args, mp_map_lookup_kind_t lookup_kind) {
+ mp_check_self(MP_OBJ_IS_DICT_TYPE(args[0]));
+ mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
+ mp_map_elem_t *elem = mp_map_lookup(&self->map, args[1], lookup_kind);
mp_obj_t value;
if (elem == NULL || elem->value == MP_OBJ_NULL) {
- if (deflt == MP_OBJ_NULL) {
+ if (n_args == 2) {
if (lookup_kind == MP_MAP_LOOKUP_REMOVE_IF_FOUND) {
- nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, key));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_KeyError, args[1]));
} else {
value = mp_const_none;
}
} else {
- value = deflt;
+ value = args[2];
}
if (lookup_kind == MP_MAP_LOOKUP_ADD_IF_NOT_FOUND) {
elem->value = value;
@@ -304,40 +306,20 @@ STATIC mp_obj_t dict_get_helper(mp_map_t *self, mp_obj_t key, mp_obj_t deflt, mp
}
STATIC mp_obj_t dict_get(size_t n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_DICT_TYPE(args[0]));
- mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
-
- return dict_get_helper(&self->map,
- args[1],
- n_args == 3 ? args[2] : MP_OBJ_NULL,
- MP_MAP_LOOKUP);
+ return dict_get_helper(n_args, args, MP_MAP_LOOKUP);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_get_obj, 2, 3, dict_get);
STATIC mp_obj_t dict_pop(size_t n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_DICT_TYPE(args[0]));
- mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
-
- return dict_get_helper(&self->map,
- args[1],
- n_args == 3 ? args[2] : MP_OBJ_NULL,
- MP_MAP_LOOKUP_REMOVE_IF_FOUND);
+ return dict_get_helper(n_args, args, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_pop_obj, 2, 3, dict_pop);
-
STATIC mp_obj_t dict_setdefault(size_t n_args, const mp_obj_t *args) {
- mp_check_self(MP_OBJ_IS_DICT_TYPE(args[0]));
- mp_obj_dict_t *self = MP_OBJ_TO_PTR(args[0]);
-
- return dict_get_helper(&self->map,
- args[1],
- n_args == 3 ? args[2] : MP_OBJ_NULL,
- MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
+ return dict_get_helper(n_args, args, MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(dict_setdefault_obj, 2, 3, dict_setdefault);
-
STATIC mp_obj_t dict_popitem(mp_obj_t self_in) {
mp_check_self(MP_OBJ_IS_DICT_TYPE(self_in));
mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
@@ -615,9 +597,8 @@ mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value) {
}
mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key) {
- mp_check_self(MP_OBJ_IS_DICT_TYPE(self_in));
- mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_in);
- dict_get_helper(&self->map, key, MP_OBJ_NULL, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
+ mp_obj_t args[2] = {self_in, key};
+ dict_get_helper(2, args, MP_MAP_LOOKUP_REMOVE_IF_FOUND);
return self_in;
}
From 7bd10c1ffe54f9c1e3b63f8f372c024461b3a4ff Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 23:44:22 +1000
Subject: [PATCH 136/252] py: Change mp_uint_t to size_t in builtins code.
---
py/builtinimport.c | 4 ++--
py/modbuiltins.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 5142c7d8f..7746e26a4 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -109,7 +109,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
#if MICROPY_PY_SYS
} else {
// go through each path looking for a directory or file
- for (mp_uint_t i = 0; i < path_num; i++) {
+ for (size_t i = 0; i < path_num; i++) {
vstr_reset(dest);
size_t p_len;
const char *p = mp_obj_str_get_data(path_items[i], &p_len);
@@ -247,7 +247,7 @@ STATIC void chop_component(const char *start, const char **end) {
mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
#if DEBUG_PRINT
DEBUG_printf("__import__:\n");
- for (mp_uint_t i = 0; i < n_args; i++) {
+ for (size_t i = 0; i < n_args; i++) {
DEBUG_printf(" ");
mp_obj_print(args[i], PRINT_REPR);
DEBUG_printf("\n");
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 169714a6b..57d471b1f 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -226,14 +226,14 @@ STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) {
mp_obj_t dir = mp_obj_new_list(0, NULL);
if (dict != NULL) {
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
mp_obj_list_append(dir, dict->map.table[i].key);
}
}
}
if (members != NULL) {
- for (mp_uint_t i = 0; i < members->alloc; i++) {
+ for (size_t i = 0; i < members->alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(members, i)) {
mp_obj_list_append(dir, members->table[i].key);
}
@@ -326,7 +326,7 @@ STATIC mp_obj_t mp_builtin_min_max(size_t n_args, const mp_obj_t *args, mp_map_t
// given many args
mp_obj_t best_key = MP_OBJ_NULL;
mp_obj_t best_obj = MP_OBJ_NULL;
- for (mp_uint_t i = 0; i < n_args; i++) {
+ for (size_t i = 0; i < n_args; i++) {
mp_obj_t key = key_fn == MP_OBJ_NULL ? args[i] : mp_call_function_1(key_fn, args[i]);
if (best_obj == MP_OBJ_NULL || (mp_binary_op(op, key, best_key) == mp_const_true)) {
best_key = key;
@@ -443,7 +443,7 @@ STATIC mp_obj_t mp_builtin_print(size_t n_args, const mp_obj_t *args, mp_map_t *
mp_print_t print = {stream_obj, mp_stream_write_adaptor};
#endif
- for (mp_uint_t i = 0; i < n_args; i++) {
+ for (size_t i = 0; i < n_args; i++) {
if (i > 0) {
#if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
mp_stream_write_adaptor(stream_obj, sep_data, sep_len);
From e66fd568520a22acbd452188f8ac8f38364c477c Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 4 Jul 2017 23:44:54 +1000
Subject: [PATCH 137/252] py/repl: Change mp_uint_t to size_t in repl helpers.
---
lib/mp-readline/readline.c | 6 +++---
py/repl.c | 18 +++++++++---------
py/repl.h | 2 +-
unix/coverage.c | 2 +-
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 4b9875136..5b35c8660 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -188,17 +188,17 @@ int readline_process_char(int c) {
} else if (c == 9) {
// tab magic
const char *compl_str;
- mp_uint_t compl_len = mp_repl_autocomplete(rl.line->buf + rl.orig_line_len, rl.cursor_pos - rl.orig_line_len, &mp_plat_print, &compl_str);
+ size_t compl_len = mp_repl_autocomplete(rl.line->buf + rl.orig_line_len, rl.cursor_pos - rl.orig_line_len, &mp_plat_print, &compl_str);
if (compl_len == 0) {
// no match
- } else if (compl_len == (mp_uint_t)(-1)) {
+ } else if (compl_len == (size_t)(-1)) {
// many matches
mp_hal_stdout_tx_str(rl.prompt);
mp_hal_stdout_tx_strn(rl.line->buf + rl.orig_line_len, rl.cursor_pos - rl.orig_line_len);
redraw_from_cursor = true;
} else {
// one match
- for (mp_uint_t i = 0; i < compl_len; ++i) {
+ for (size_t i = 0; i < compl_len; ++i) {
vstr_ins_byte(rl.line, rl.cursor_pos + i, *compl_str++);
}
// set redraw parameters
diff --git a/py/repl.c b/py/repl.c
index 6d8f7cca4..8e55eb017 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -32,7 +32,7 @@
#if MICROPY_HELPER_REPL
STATIC bool str_startswith_word(const char *str, const char *head) {
- mp_uint_t i;
+ size_t i;
for (i = 0; str[i] && head[i]; i++) {
if (str[i] != head[i]) {
return false;
@@ -124,7 +124,7 @@ bool mp_repl_continue_with_input(const char *input) {
return false;
}
-mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t *print, const char **compl_str) {
+size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str) {
// scan backwards to find start of "a.b.c" chain
const char *org_str = str;
const char *top = str + len;
@@ -145,13 +145,13 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
while (str < top && *str != '.') {
++str;
}
- mp_uint_t s_len = str - s_start;
+ size_t s_len = str - s_start;
if (str < top) {
// a complete word, lookup in current dict
mp_obj_t obj = MP_OBJ_NULL;
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -194,8 +194,8 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
// look for matches
int n_found = 0;
const char *match_str = NULL;
- mp_uint_t match_len = 0;
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ size_t match_len = 0;
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -206,7 +206,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
} else {
// search for longest common prefix of match_str and d_str
// (assumes these strings are null-terminated)
- for (mp_uint_t j = s_len; j <= match_len && j <= d_len; ++j) {
+ for (size_t j = s_len; j <= match_len && j <= d_len; ++j) {
if (match_str[j] != d_str[j]) {
match_len = j;
break;
@@ -245,7 +245,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
#define MAX_LINE_LEN (4 * WORD_SLOT_LEN)
int line_len = MAX_LINE_LEN; // force a newline for first word
- for (mp_uint_t i = 0; i < dict->map.alloc; i++) {
+ for (size_t i = 0; i < dict->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&dict->map, i)) {
size_t d_len;
const char *d_str = mp_obj_str_get_data(dict->map.table[i].key, &d_len);
@@ -270,7 +270,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t
}
mp_print_str(print, "\n");
- return (mp_uint_t)(-1); // indicate many matches
+ return (size_t)(-1); // indicate many matches
}
}
}
diff --git a/py/repl.h b/py/repl.h
index c34a5b869..048b0de0f 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -32,7 +32,7 @@
#if MICROPY_HELPER_REPL
bool mp_repl_continue_with_input(const char *input);
-mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t *print, const char **compl_str);
+size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str);
#endif
#endif // __MICROPY_INCLUDED_PY_REPL_H__
diff --git a/unix/coverage.c b/unix/coverage.c
index 8391cd08b..4a9ab194b 100644
--- a/unix/coverage.c
+++ b/unix/coverage.c
@@ -190,7 +190,7 @@ STATIC mp_obj_t extra_coverage(void) {
mp_printf(&mp_plat_print, "# repl\n");
const char *str;
- mp_uint_t len = mp_repl_autocomplete("__n", 3, &mp_plat_print, &str);
+ size_t len = mp_repl_autocomplete("__n", 3, &mp_plat_print, &str);
mp_printf(&mp_plat_print, "%.*s\n", (int)len, str);
mp_store_global(MP_QSTR_sys, mp_import_name(MP_QSTR_sys, mp_const_none, MP_OBJ_NEW_SMALL_INT(0)));
From f110dbd795395d84790696b8e22b7272a5375388 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 5 Jul 2017 10:38:20 +1000
Subject: [PATCH 138/252] extmod/modujson: Properly initialise temporary
StringIO object.
---
extmod/modujson.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extmod/modujson.c b/extmod/modujson.c
index bb2d45274..f94ec7db8 100644
--- a/extmod/modujson.c
+++ b/extmod/modujson.c
@@ -277,7 +277,7 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
size_t len;
const char *buf = mp_obj_str_get_data(obj, &len);
vstr_t vstr = {len, len, (char*)buf, true};
- mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0};
+ mp_obj_stringio_t sio = {{&mp_type_stringio}, &vstr, 0, MP_OBJ_NULL};
return mod_ujson_load(MP_OBJ_FROM_PTR(&sio));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
From a040fb89e7b8507aa775b0620de1770642b0f5ee Mon Sep 17 00:00:00 2001
From: Krzysztof Blazewicz
Date: Thu, 27 Apr 2017 21:32:50 +0200
Subject: [PATCH 139/252] py/compile: Combine arith and bit-shift ops into 1
compile routine.
This refactoring saves code space.
---
py/compile.c | 39 ++++++++++-----------------------------
py/grammar.h | 4 ++--
2 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/py/compile.c b/py/compile.c
index e0a771112..f284938f3 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2132,48 +2132,29 @@ STATIC void compile_and_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
c_binary_op(comp, pns, MP_BINARY_OP_AND);
}
-STATIC void compile_shift_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
- int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
- compile_node(comp, pns->nodes[0]);
- for (int i = 1; i + 1 < num_nodes; i += 2) {
- compile_node(comp, pns->nodes[i + 1]);
- if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_LESS)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_LSHIFT);
- } else {
- assert(MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_MORE)); // should be
- EMIT_ARG(binary_op, MP_BINARY_OP_RSHIFT);
- }
- }
-}
-
-STATIC void compile_arith_expr(compiler_t *comp, mp_parse_node_struct_t *pns) {
+STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
compile_node(comp, pns->nodes[0]);
for (int i = 1; i + 1 < num_nodes; i += 2) {
compile_node(comp, pns->nodes[i + 1]);
if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_PLUS)) {
EMIT_ARG(binary_op, MP_BINARY_OP_ADD);
- } else {
- assert(MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_MINUS)); // should be
+ } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_MINUS)) {
EMIT_ARG(binary_op, MP_BINARY_OP_SUBTRACT);
- }
- }
-}
-
-STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
- int num_nodes = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
- compile_node(comp, pns->nodes[0]);
- for (int i = 1; i + 1 < num_nodes; i += 2) {
- compile_node(comp, pns->nodes[i + 1]);
- if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_STAR)) {
+ } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_STAR)) {
EMIT_ARG(binary_op, MP_BINARY_OP_MULTIPLY);
} else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_SLASH)) {
EMIT_ARG(binary_op, MP_BINARY_OP_FLOOR_DIVIDE);
} else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_SLASH)) {
EMIT_ARG(binary_op, MP_BINARY_OP_TRUE_DIVIDE);
- } else {
- assert(MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_PERCENT)); // should be
+ } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_PERCENT)) {
EMIT_ARG(binary_op, MP_BINARY_OP_MODULO);
+ } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_LESS)) {
+ EMIT_ARG(binary_op, MP_BINARY_OP_LSHIFT);
+ } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_MORE)) {
+ EMIT_ARG(binary_op, MP_BINARY_OP_RSHIFT);
+ } else {
+ assert(false);
}
}
}
diff --git a/py/grammar.h b/py/grammar.h
index 930d96dc1..0b70538d4 100644
--- a/py/grammar.h
+++ b/py/grammar.h
@@ -244,9 +244,9 @@ DEF_RULE(star_expr, c(star_expr), and(2), tok(OP_STAR), rule(expr))
DEF_RULE(expr, c(expr), list, rule(xor_expr), tok(OP_PIPE))
DEF_RULE(xor_expr, c(xor_expr), list, rule(and_expr), tok(OP_CARET))
DEF_RULE(and_expr, c(and_expr), list, rule(shift_expr), tok(OP_AMPERSAND))
-DEF_RULE(shift_expr, c(shift_expr), list, rule(arith_expr), rule(shift_op))
+DEF_RULE(shift_expr, c(term), list, rule(arith_expr), rule(shift_op))
DEF_RULE_NC(shift_op, or(2), tok(OP_DBL_LESS), tok(OP_DBL_MORE))
-DEF_RULE(arith_expr, c(arith_expr), list, rule(term), rule(arith_op))
+DEF_RULE(arith_expr, c(term), list, rule(term), rule(arith_op))
DEF_RULE_NC(arith_op, or(2), tok(OP_PLUS), tok(OP_MINUS))
DEF_RULE(term, c(term), list, rule(factor), rule(term_op))
DEF_RULE_NC(term_op, or(4), tok(OP_STAR), tok(OP_SLASH), tok(OP_PERCENT), tok(OP_DBL_SLASH))
From 91a385db98711c2a9115ad661cb4d637450d7ee2 Mon Sep 17 00:00:00 2001
From: Krzysztof Blazewicz
Date: Thu, 27 Apr 2017 21:33:11 +0200
Subject: [PATCH 140/252] py/compile: Use switch-case to match token and
operator.
Reduces code size.
---
py/compile.c | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/py/compile.c b/py/compile.c
index f284938f3..70e7b3931 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2137,38 +2137,38 @@ STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[0]);
for (int i = 1; i + 1 < num_nodes; i += 2) {
compile_node(comp, pns->nodes[i + 1]);
- if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_PLUS)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_ADD);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_MINUS)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_SUBTRACT);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_STAR)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_MULTIPLY);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_SLASH)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_FLOOR_DIVIDE);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_SLASH)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_TRUE_DIVIDE);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_PERCENT)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_MODULO);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_LESS)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_LSHIFT);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[i], MP_TOKEN_OP_DBL_MORE)) {
- EMIT_ARG(binary_op, MP_BINARY_OP_RSHIFT);
- } else {
- assert(false);
+ mp_binary_op_t op;
+ mp_token_kind_t tok = MP_PARSE_NODE_LEAF_ARG(pns->nodes[i]);
+ switch (tok) {
+ case MP_TOKEN_OP_PLUS: op = MP_BINARY_OP_ADD; break;
+ case MP_TOKEN_OP_MINUS: op = MP_BINARY_OP_SUBTRACT; break;
+ case MP_TOKEN_OP_STAR: op = MP_BINARY_OP_MULTIPLY; break;
+ case MP_TOKEN_OP_DBL_SLASH: op = MP_BINARY_OP_FLOOR_DIVIDE; break;
+ case MP_TOKEN_OP_SLASH: op = MP_BINARY_OP_TRUE_DIVIDE; break;
+ case MP_TOKEN_OP_PERCENT: op = MP_BINARY_OP_MODULO; break;
+ case MP_TOKEN_OP_DBL_LESS: op = MP_BINARY_OP_LSHIFT; break;
+ default:
+ assert(tok == MP_TOKEN_OP_DBL_MORE);
+ op = MP_BINARY_OP_RSHIFT;
+ break;
}
+ EMIT_ARG(binary_op, op);
}
}
STATIC void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[1]);
- if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[0], MP_TOKEN_OP_PLUS)) {
- EMIT_ARG(unary_op, MP_UNARY_OP_POSITIVE);
- } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[0], MP_TOKEN_OP_MINUS)) {
- EMIT_ARG(unary_op, MP_UNARY_OP_NEGATIVE);
- } else {
- assert(MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[0], MP_TOKEN_OP_TILDE)); // should be
- EMIT_ARG(unary_op, MP_UNARY_OP_INVERT);
+ mp_binary_op_t op;
+ mp_token_kind_t tok = MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]);
+ switch (tok) {
+ case MP_TOKEN_OP_PLUS: op = MP_UNARY_OP_POSITIVE; break;
+ case MP_TOKEN_OP_MINUS: op = MP_UNARY_OP_NEGATIVE; break;
+ default:
+ assert(tok == MP_TOKEN_OP_TILDE);
+ op = MP_UNARY_OP_INVERT;
+ break;
}
+ EMIT_ARG(unary_op, op);
}
STATIC void compile_atom_expr_normal(compiler_t *comp, mp_parse_node_struct_t *pns) {
From 7feb7301b2cefd568fa65ee9907a1a179ea41f1c Mon Sep 17 00:00:00 2001
From: Krzysztof Blazewicz
Date: Thu, 27 Apr 2017 21:33:15 +0200
Subject: [PATCH 141/252] tests/basics: Add tests for arithmetic operators
precedence.
---
tests/basics/op_precedence.py | 43 +++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 tests/basics/op_precedence.py
diff --git a/tests/basics/op_precedence.py b/tests/basics/op_precedence.py
new file mode 100644
index 000000000..519a2a113
--- /dev/null
+++ b/tests/basics/op_precedence.py
@@ -0,0 +1,43 @@
+# see https://docs.python.org/3/reference/expressions.html#operator-precedence
+
+# '|' is the least binding numeric operator
+
+# '^'
+# OK: 1 | (2 ^ 3) = 1 | 1 = 1
+# BAD: (1 | 2) ^ 3 = 3 ^ 3 = 0
+print(1 | 2 ^ 3)
+
+# '&'
+# OK: 3 ^ (2 & 1) = 3 ^ 0 = 3
+# BAD: (3 ^ 2) & 1 = 1 & 1 = 1
+print(3 ^ 2 & 1)
+
+# '<<', '>>'
+# OK: 2 & (3 << 1) = 2 & 6 = 2
+# BAD: (2 & 3) << 1 = 2 << 1 = 4
+print(2 & 3 << 1)
+# OK: 6 & (4 >> 1) = 6 & 2 = 2
+# BAD: (6 & 4) >> 1 = 2 >> 1 = 1
+print(6 & 4 >> 1)
+
+# '+', '-'
+# OK: 1 << (1 + 1) = 1 << 2 = 4
+# BAD: (1 << 1) + 1 = 2 + 1 = 3
+print(1 << 1 + 1)
+
+# '*', '/', '//', '%'
+# OK: 2 + (2 * 2) = 2 + 4 = 6
+# BAD: (2 + 2) * 2 = 4 * 2 = 8
+print(2 + 2 * 2)
+
+# '+x', '-x', '~x'
+
+# '**'
+# OK: -(2**2) = -4
+# BAD: (-2)**2 = 4
+print(-2**2)
+# OK: 2**(-1) = 0.5
+print(2**-1)
+
+# (expr...)
+print((2 + 2) * 2)
From ed52955c6bb05d2a08c009ed24ab3214c88c6fb1 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 5 Jul 2017 23:03:37 +0300
Subject: [PATCH 142/252] tests/cpydiff/modules_deque: Elaborate workaround.
---
tests/cpydiff/modules_deque.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/cpydiff/modules_deque.py b/tests/cpydiff/modules_deque.py
index dc9369d02..a503ea4f5 100644
--- a/tests/cpydiff/modules_deque.py
+++ b/tests/cpydiff/modules_deque.py
@@ -2,7 +2,7 @@
categories: Modules,deque
description: Deque not implemented
cause: Unknown
-workaround: Use regular queues or lists creatively
+workaround: Use regular lists. micropython-lib has implementation of collections.deque.
"""
import collections
D = collections.deque()
From 145796f037715e180b441b38c1ec1ba45ff77797 Mon Sep 17 00:00:00 2001
From: Tom Collins
Date: Fri, 30 Jun 2017 16:23:29 -0700
Subject: [PATCH 143/252] py,extmod: Some casts and minor refactors to quiet
compiler warnings.
---
extmod/utime_mphal.c | 2 +-
py/builtinimport.c | 3 ++-
py/emitbc.c | 2 +-
py/formatfloat.c | 2 +-
py/lexer.c | 2 +-
py/modbuiltins.c | 18 ++++++++----------
py/objint.c | 2 +-
py/runtime.c | 11 ++++-------
py/vstr.c | 2 +-
9 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c
index e99ba46ce..0fe3a3ba1 100644
--- a/extmod/utime_mphal.c
+++ b/extmod/utime_mphal.c
@@ -38,7 +38,7 @@
STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
#if MICROPY_PY_BUILTINS_FLOAT
- mp_hal_delay_ms(1000 * mp_obj_get_float(seconds_o));
+ mp_hal_delay_ms((mp_uint_t)(1000 * mp_obj_get_float(seconds_o)));
#else
mp_hal_delay_ms(1000 * mp_obj_get_int(seconds_o));
#endif
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 7746e26a4..7a8474cac 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -227,10 +227,11 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
do_load_from_lexer(module_obj, lex);
return;
}
- #endif
+ #else
// If we get here then the file was not frozen and we can't compile scripts.
mp_raise_msg(&mp_type_ImportError, "script compilation not supported");
+ #endif
}
STATIC void chop_component(const char *start, const char **end) {
diff --git a/py/emitbc.c b/py/emitbc.c
index ec12a62c6..127bf0bf9 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -902,7 +902,7 @@ void mp_emit_bc_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_ov
emit_write_bytecode_byte(emit, n_closed_over);
} else {
assert(n_closed_over <= 255);
- emit_bc_pre(emit, -2 - n_closed_over + 1);
+ emit_bc_pre(emit, -2 - (mp_int_t)n_closed_over + 1);
emit_write_bytecode_byte_raw_code(emit, MP_BC_MAKE_CLOSURE_DEFARGS, scope->raw_code);
emit_write_bytecode_byte(emit, n_closed_over);
}
diff --git a/py/formatfloat.c b/py/formatfloat.c
index b16746b39..ea5a07977 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -332,7 +332,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
// Print the digits of the mantissa
for (int i = 0; i < num_digits; ++i, --dec) {
- int32_t d = f;
+ int32_t d = (int32_t)f;
*s++ = '0' + d;
if (dec == 0 && prec > 0) {
*s++ = '.';
diff --git a/py/lexer.c b/py/lexer.c
index abc1f3ebb..6e5cc18f4 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -672,7 +672,7 @@ mp_lexer_t *mp_lexer_new(qstr src_name, mp_reader_t reader) {
lex->source_name = src_name;
lex->reader = reader;
lex->line = 1;
- lex->column = -2; // account for 3 dummy bytes
+ lex->column = (size_t)-2; // account for 3 dummy bytes
lex->emit_dent = 0;
lex->nested_bracket_level = 0;
lex->alloc_indent_level = MICROPY_ALLOC_LEXER_INDENT_INIT;
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 57d471b1f..8fbf4daeb 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -91,10 +91,8 @@ STATIC mp_obj_t mp_builtin___build_class__(size_t n_args, const mp_obj_t *args)
MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj, 2, mp_builtin___build_class__);
STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
- if (0) {
- // dummy
-#if MICROPY_PY_BUILTINS_FLOAT
- } else if (mp_obj_is_float(o_in)) {
+ #if MICROPY_PY_BUILTINS_FLOAT
+ if (mp_obj_is_float(o_in)) {
mp_float_t value = mp_obj_float_get(o_in);
// TODO check for NaN etc
if (value < 0) {
@@ -102,17 +100,17 @@ STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) {
} else {
return o_in;
}
-#if MICROPY_PY_BUILTINS_COMPLEX
+ #if MICROPY_PY_BUILTINS_COMPLEX
} else if (MP_OBJ_IS_TYPE(o_in, &mp_type_complex)) {
mp_float_t real, imag;
mp_obj_complex_get(o_in, &real, &imag);
return mp_obj_new_float(MICROPY_FLOAT_C_FUN(sqrt)(real*real + imag*imag));
-#endif
-#endif
- } else {
- // this will raise a TypeError if the argument is not integral
- return mp_obj_int_abs(o_in);
+ #endif
}
+ #endif
+
+ // this will raise a TypeError if the argument is not integral
+ return mp_obj_int_abs(o_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_abs_obj, mp_builtin_abs);
diff --git a/py/objint.c b/py/objint.c
index 0b4904139..2749ec51c 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -106,7 +106,7 @@ STATIC mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val) {
#define MP_FLOAT_SIGN_SHIFT_I32 ((MP_FLOAT_FRAC_BITS + MP_FLOAT_EXP_BITS) % 32)
#define MP_FLOAT_EXP_SHIFT_I32 (MP_FLOAT_FRAC_BITS % 32)
- if (e & (1 << MP_FLOAT_SIGN_SHIFT_I32)) {
+ if (e & (1U << MP_FLOAT_SIGN_SHIFT_I32)) {
#if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
e |= u.i[MP_ENDIANNESS_BIG] != 0;
#endif
diff --git a/py/runtime.c b/py/runtime.c
index 0a3a4b12d..a8a1f73fa 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1410,16 +1410,13 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
NORETURN void *m_malloc_fail(size_t num_bytes) {
DEBUG_printf("memory allocation failed, allocating %u bytes\n", (uint)num_bytes);
- if (0) {
- // dummy
#if MICROPY_ENABLE_GC
- } else if (gc_is_locked()) {
+ if (gc_is_locked()) {
mp_raise_msg(&mp_type_MemoryError, "memory allocation failed, heap is locked");
- #endif
- } else {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_MemoryError,
- "memory allocation failed, allocating %u bytes", (uint)num_bytes));
}
+ #endif
+ nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_MemoryError,
+ "memory allocation failed, allocating %u bytes", (uint)num_bytes));
}
NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg) {
diff --git a/py/vstr.c b/py/vstr.c
index 6a91552b5..f41bd2e23 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -34,7 +34,7 @@
#include "py/mpprint.h"
// returned value is always at least 1 greater than argument
-#define ROUND_ALLOC(a) (((a) & ((~0) - 7)) + 8)
+#define ROUND_ALLOC(a) (((a) & ((~0U) - 7)) + 8)
// Init the vstr so it allocs exactly given number of bytes. Set length to zero.
void vstr_init(vstr_t *vstr, size_t alloc) {
From f69ab79ec8347c1f5ff0c6f31947ec06073fbd52 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 7 Jul 2017 11:47:38 +1000
Subject: [PATCH 144/252] py/objgenerator: Allow to hash generators and
generator instances.
Adds nothing to the code size, since it uses existing empty slots in the
type structures.
---
py/objgenerator.c | 2 ++
tests/basics/builtin_hash_gen.py | 7 +++++++
tests/run-tests | 1 +
3 files changed, 10 insertions(+)
create mode 100644 tests/basics/builtin_hash_gen.py
diff --git a/py/objgenerator.c b/py/objgenerator.c
index 8cb0e60cc..9d6e636b3 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -74,6 +74,7 @@ const mp_obj_type_t mp_type_gen_wrap = {
{ &mp_type_type },
.name = MP_QSTR_generator,
.call = gen_wrap_call,
+ .unary_op = mp_generic_unary_op,
};
mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun) {
@@ -235,6 +236,7 @@ const mp_obj_type_t mp_type_gen_instance = {
{ &mp_type_type },
.name = MP_QSTR_generator,
.print = gen_instance_print,
+ .unary_op = mp_generic_unary_op,
.getiter = mp_identity_getiter,
.iternext = gen_instance_iternext,
.locals_dict = (mp_obj_dict_t*)&gen_instance_locals_dict,
diff --git a/tests/basics/builtin_hash_gen.py b/tests/basics/builtin_hash_gen.py
new file mode 100644
index 000000000..d42e5ebfb
--- /dev/null
+++ b/tests/basics/builtin_hash_gen.py
@@ -0,0 +1,7 @@
+# test builtin hash function, on generators
+
+def gen():
+ yield
+
+print(type(hash(gen)))
+print(type(hash(gen())))
diff --git a/tests/run-tests b/tests/run-tests
index f65124286..bd4a1363c 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -323,6 +323,7 @@ def run_tests(pyb, tests, args, base_path="."):
skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support
skip_tests.add('basics/array_construct2.py') # requires generators
skip_tests.add('basics/bool1.py') # seems to randomly fail
+ skip_tests.add('basics/builtin_hash_gen.py') # requires yield
skip_tests.add('basics/class_bind_self.py') # requires yield
skip_tests.add('basics/del_deref.py') # requires checking for unbound local
skip_tests.add('basics/del_local.py') # requires checking for unbound local
From 0c75990d6ebbe4e2bf8329c695a848bc1171feeb Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 8 Jul 2017 21:36:16 +0300
Subject: [PATCH 145/252] zephyr/Makefile: Rework dependencies and "clean"
target.
Got tired of running rm -rf manually. Make should clean, and should clean
fast. Also, fix always-running config-related commands (by having per-board
merged configs).
---
zephyr/Makefile | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/zephyr/Makefile b/zephyr/Makefile
index 9e8cb31d0..32ccd6f1d 100644
--- a/zephyr/Makefile
+++ b/zephyr/Makefile
@@ -8,7 +8,7 @@
# To build a "minimal" configuration, use "make-minimal" wrapper.
BOARD ?= qemu_x86
-CONF_FILE = prj.conf
+CONF_FILE = prj_$(BOARD)_merged.conf
OUTDIR_PREFIX = $(BOARD)
# Default heap size is 16KB, which is on conservative side, to let
@@ -19,7 +19,9 @@ FROZEN_DIR = scripts
# Zephyr (generated) config files - must be defined before include below
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
+ifneq ($(MAKECMDGOALS), clean)
include $(Z_EXPORTS)
+endif
include ../py/mkenv.mk
include ../py/py.mk
@@ -56,12 +58,12 @@ CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \
include ../py/mkrules.mk
+# We use single target here ($(Z_EXPORTS)) for simplicity, but actually
+# number of things get generated here: 'initconfig' generates C header for
+# Kconfig configuration, 'outputexports' generates make environment with CC,
+# etc., and 'lib' generates other headers which may be included by zephyr.h,
+# e.g. DTS-related.
$(Z_EXPORTS): $(CONF_FILE)
- # We use single target here ($(Z_EXPORTS)) for simplicity, but actually
- # number of things get generated here: 'initconfig' generates C header for
- # Kconfig configuration, 'outputexports' generates make environment with CC,
- # etc., and 'lib' generates other headers which may be included by zephyr.h,
- # e.g. DTS-related.
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports lib
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver
@@ -84,14 +86,14 @@ build/genhdr/qstr.i.last: | $(Z_EXPORTS)
# If we recreate libmicropython, also cause zephyr.bin relink
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
-# Clean Zephyr things too
-clean: z_clean
+# MicroPython's global clean cleans everything, fast
+CLEAN_EXTRA = outdir
+# Clean Zephyr things in Zephyr way
z_clean:
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
-.PHONY: prj.conf
-prj.conf: prj_base.conf
+$(CONF_FILE): prj_base.conf prj_$(BOARD).conf
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
test:
From 0291a624cbb0fc12633291b5b53285f7425dd3dc Mon Sep 17 00:00:00 2001
From: Damien George
Date: Sun, 9 Jul 2017 13:18:14 +1000
Subject: [PATCH 146/252] py/compile: Fix enum variable declaration.
---
py/compile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/py/compile.c b/py/compile.c
index 70e7b3931..d2e05d0b2 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -2158,7 +2158,7 @@ STATIC void compile_term(compiler_t *comp, mp_parse_node_struct_t *pns) {
STATIC void compile_factor_2(compiler_t *comp, mp_parse_node_struct_t *pns) {
compile_node(comp, pns->nodes[1]);
- mp_binary_op_t op;
+ mp_unary_op_t op;
mp_token_kind_t tok = MP_PARSE_NODE_LEAF_ARG(pns->nodes[0]);
switch (tok) {
case MP_TOKEN_OP_PLUS: op = MP_UNARY_OP_POSITIVE; break;
From bfa68ef6b23a2bca9d4a713ea436d76c62633078 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 11:50:21 +0300
Subject: [PATCH 147/252] zephyr/Makefile: Revert prj.conf construction rule to
the previous state.
CONF_FILE can be overriden, e.g. for minimal build, and we don't construct
such overriden conf file like we do for prj_merged.conf.
---
zephyr/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/zephyr/Makefile b/zephyr/Makefile
index 32ccd6f1d..c1337adf0 100644
--- a/zephyr/Makefile
+++ b/zephyr/Makefile
@@ -93,7 +93,9 @@ CLEAN_EXTRA = outdir
z_clean:
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
-$(CONF_FILE): prj_base.conf prj_$(BOARD).conf
+# This rule is for prj_$(BOARD)_merged.conf, not $(CONF_FILE), which
+# can be overriden
+prj_$(BOARD)_merged.conf: prj_base.conf prj_$(BOARD).conf
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
test:
From b2979023ac049cdd1bb4d66761c3b0648387a1b3 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 13:32:17 +0300
Subject: [PATCH 148/252] tests/cpydiff/core_class_mro: Move under Classes, add
workaround.
---
tests/cpydiff/core_class_mro.py | 15 +++++++++++++++
tests/cpydiff/core_mro.py | 15 ---------------
2 files changed, 15 insertions(+), 15 deletions(-)
create mode 100644 tests/cpydiff/core_class_mro.py
delete mode 100644 tests/cpydiff/core_mro.py
diff --git a/tests/cpydiff/core_class_mro.py b/tests/cpydiff/core_class_mro.py
new file mode 100644
index 000000000..99713e790
--- /dev/null
+++ b/tests/cpydiff/core_class_mro.py
@@ -0,0 +1,15 @@
+"""
+categories: Core,Classes
+description: Method Resolution Order (MRO) is not compliant with CPython
+cause: Depth first non-exhaustive method resolution order
+workaround: Avoid complex class hierarchies with multiple inheritance and complex method overrides. Keep in mind that many languages don't support multiple inheritance at all.
+"""
+class Foo:
+ def __str__(self):
+ return "Foo"
+
+class C(tuple, Foo):
+ pass
+
+t = C((1, 2, 3))
+print(t)
diff --git a/tests/cpydiff/core_mro.py b/tests/cpydiff/core_mro.py
deleted file mode 100644
index 35b898b30..000000000
--- a/tests/cpydiff/core_mro.py
+++ /dev/null
@@ -1,15 +0,0 @@
-"""
-categories: Core
-description: Method Resolution Order (MRO) is not compliant with CPython
-cause: Unknown
-workaround: Unknown
-"""
-class Foo:
- def __str__(self):
- return "Foo"
-
-class C(tuple, Foo):
- pass
-
-t = C((1, 2, 3))
-print(t)
From c5efb8159f7bd2aee3aa80412f5c1a3f52f0e812 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 13:36:28 +0300
Subject: [PATCH 149/252] tests/cpydiff/core_arguments: Move under Functions
subsection.
This is the last "orphan" case.
---
tests/cpydiff/{core_arguments.py => core_function_argcount.py} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename tests/cpydiff/{core_arguments.py => core_function_argcount.py} (90%)
diff --git a/tests/cpydiff/core_arguments.py b/tests/cpydiff/core_function_argcount.py
similarity index 90%
rename from tests/cpydiff/core_arguments.py
rename to tests/cpydiff/core_function_argcount.py
index 4734a8062..5f3dca4dc 100644
--- a/tests/cpydiff/core_arguments.py
+++ b/tests/cpydiff/core_function_argcount.py
@@ -1,5 +1,5 @@
"""
-categories: Core
+categories: Core,Functions
description: Error messages for methods may display unexpected argument counts
cause: MicroPython counts "self" as an argument.
workaround: Interpret error messages with the information above in mind.
From 5f65ad8c96ef373f51b7e12e7e3239a51648b220 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 13:47:23 +0300
Subject: [PATCH 150/252] tests/cpydiff/core_class_supermultiple: Same cause as
core_class_mro.
---
tests/cpydiff/core_class_supermultiple.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/cpydiff/core_class_supermultiple.py b/tests/cpydiff/core_class_supermultiple.py
index adf4a17a8..f0823ee11 100644
--- a/tests/cpydiff/core_class_supermultiple.py
+++ b/tests/cpydiff/core_class_supermultiple.py
@@ -1,8 +1,8 @@
"""
categories: Core,Classes
description: When inheriting from multiple classes super() only calls one class
-cause: Depth first non-exhaustive method resolution order
-workaround: Unknown
+cause: See :ref:`cpydiff_core_class_mro`
+workaround: See :ref:`cpydiff_core_class_mro`
"""
class A:
def __init__(self):
From ad5e7a0e6f991e923fe94cce444289252304f589 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 13:51:40 +0300
Subject: [PATCH 151/252] tools/gen-cpydiff: Use case description as 3rd-level
heading.
This is required to easily giving links to a particular difference case.
Also, add RST anchors to allow cases to cross-reference each other.
---
tools/gen-cpydiff.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py
index 4b273d97f..86ec816e9 100644
--- a/tools/gen-cpydiff.py
+++ b/tools/gen-cpydiff.py
@@ -185,7 +185,9 @@ def gen_rst(results):
rst.write(RSTCHARS[min(i, len(RSTCHARS)-1)] * len(section[i]))
rst.write('\n\n')
class_ = section
- rst.write('**' + output.desc + '**\n\n')
+ rst.write('.. _cpydiff_%s:\n\n' % output.name.rsplit('.', 1)[0])
+ rst.write(output.desc + '\n')
+ rst.write('~' * len(output.desc) + '\n\n')
if output.cause != 'Unknown':
rst.write('**Cause:** ' + output.cause + '\n\n')
if output.workaround != 'Unknown':
From 0c5369a1f02c89b1879f76a9d2045a56ae47243b Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 14:33:55 +0300
Subject: [PATCH 152/252] tests/cpydiff/: Improve wording, add more
workarounds.
---
tests/cpydiff/modules_sys_stdassign.py | 4 ++--
tests/cpydiff/types_bytes_keywords.py | 4 ++--
tests/cpydiff/types_bytes_subscrstep.py | 6 +++---
tests/cpydiff/types_exception_instancevar.py | 6 +++---
tests/cpydiff/types_exception_loops.py | 4 ++--
tests/cpydiff/types_float_rounding.py | 2 +-
tests/cpydiff/types_int_subclassconv.py | 2 +-
tests/cpydiff/types_list_delete_subscrstep.py | 2 +-
tests/cpydiff/types_list_store_subscrstep.py | 2 +-
9 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/tests/cpydiff/modules_sys_stdassign.py b/tests/cpydiff/modules_sys_stdassign.py
index 096af430e..1bf2a598a 100644
--- a/tests/cpydiff/modules_sys_stdassign.py
+++ b/tests/cpydiff/modules_sys_stdassign.py
@@ -1,7 +1,7 @@
"""
categories: Modules,sys
-description: Override sys.stdin, sys.stdout and sys.stderr. Impossible as they are stored in read-only memory.
-cause: Unknown
+description: Overriding sys.stdin, sys.stdout and sys.stderr not possible
+cause: They are stored in read-only memory.
workaround: Unknown
"""
import sys
diff --git a/tests/cpydiff/types_bytes_keywords.py b/tests/cpydiff/types_bytes_keywords.py
index 35119e28f..4dc383f26 100644
--- a/tests/cpydiff/types_bytes_keywords.py
+++ b/tests/cpydiff/types_bytes_keywords.py
@@ -1,7 +1,7 @@
"""
categories: Types,bytes
-description: bytes(...) with keywords not implemented
+description: bytes() with keywords not implemented
cause: Unknown
-workaround: Input the encoding format directly. eg. ``print(bytes('abc', 'utf-8'))``
+workaround: Pass the encoding as a positional paramter, e.g. ``print(bytes('abc', 'utf-8'))``
"""
print(bytes('abc', encoding='utf8'))
diff --git a/tests/cpydiff/types_bytes_subscrstep.py b/tests/cpydiff/types_bytes_subscrstep.py
index fd1602d65..2871bda6c 100644
--- a/tests/cpydiff/types_bytes_subscrstep.py
+++ b/tests/cpydiff/types_bytes_subscrstep.py
@@ -1,7 +1,7 @@
"""
categories: Types,bytes
-description: Bytes subscr with step != 1 not implemented
-cause: Unknown
-workaround: Unknown
+description: Bytes subscription with step != 1 not implemented
+cause: MicroPython is highly optimized for memory usage.
+workaround: Use explicit loop for this very rare operation.
"""
print(b'123'[0:3:2])
diff --git a/tests/cpydiff/types_exception_instancevar.py b/tests/cpydiff/types_exception_instancevar.py
index d1015e96c..adc353361 100644
--- a/tests/cpydiff/types_exception_instancevar.py
+++ b/tests/cpydiff/types_exception_instancevar.py
@@ -1,8 +1,8 @@
"""
categories: Types,Exception
-description: Assign instance variable to exception
-cause: Unknown
-workaround: Unknown
+description: User-defined attributes for builtin exceptions are not supported
+cause: MicroPython is highly optimized for memory usage.
+workaround: Use user-defined exception subclasses.
"""
e = Exception()
e.x = 0
diff --git a/tests/cpydiff/types_exception_loops.py b/tests/cpydiff/types_exception_loops.py
index a142e4757..8d326cbbb 100644
--- a/tests/cpydiff/types_exception_loops.py
+++ b/tests/cpydiff/types_exception_loops.py
@@ -1,7 +1,7 @@
"""
categories: Types,Exception
-description: While loop guards will obscure exception line number reporting due to being optimised onto the end of the code block
-cause: Unknown
+description: Exception in while loop condition may have unexpected line number
+cause: Condition checks are optimized to happen at the end of loop body, and that line number is reported.
workaround: Unknown
"""
l = ["-foo", "-bar"]
diff --git a/tests/cpydiff/types_float_rounding.py b/tests/cpydiff/types_float_rounding.py
index 647f61ba2..82a149d85 100644
--- a/tests/cpydiff/types_float_rounding.py
+++ b/tests/cpydiff/types_float_rounding.py
@@ -1,6 +1,6 @@
"""
categories: Types,float
-description: uPy and CPython outputs formats differ
+description: uPy and CPython outputs formats may differ
cause: Unknown
workaround: Unknown
"""
diff --git a/tests/cpydiff/types_int_subclassconv.py b/tests/cpydiff/types_int_subclassconv.py
index 565fbad4b..260b060ed 100644
--- a/tests/cpydiff/types_int_subclassconv.py
+++ b/tests/cpydiff/types_int_subclassconv.py
@@ -2,7 +2,7 @@
categories: Types,int
description: No int conversion for int-derived types available
cause: Unknown
-workaround: Unknown
+workaround: Avoid subclassing builtin types unless really needed. Prefer https://en.wikipedia.org/wiki/Composition_over_inheritance .
"""
class A(int):
__add__ = lambda self, other: A(int(self) + other)
diff --git a/tests/cpydiff/types_list_delete_subscrstep.py b/tests/cpydiff/types_list_delete_subscrstep.py
index f524fa8dc..36e6f526b 100644
--- a/tests/cpydiff/types_list_delete_subscrstep.py
+++ b/tests/cpydiff/types_list_delete_subscrstep.py
@@ -2,7 +2,7 @@
categories: Types,list
description: List delete with step != 1 not implemented
cause: Unknown
-workaround: Unknown
+workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
del l[0:4:2]
diff --git a/tests/cpydiff/types_list_store_subscrstep.py b/tests/cpydiff/types_list_store_subscrstep.py
index 2de2e1a3c..1460372bb 100644
--- a/tests/cpydiff/types_list_store_subscrstep.py
+++ b/tests/cpydiff/types_list_store_subscrstep.py
@@ -2,7 +2,7 @@
categories: Types,list
description: List store with step != 1 not implemented
cause: Unknown
-workaround: Unknown
+workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
l[0:4:2] = [5, 6]
From ad3abcd324cd841ffddd5d8c2713345eed15f5fd Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 9 Jul 2017 15:04:26 +0300
Subject: [PATCH 153/252] tests/cpydiff: Add case for str.ljust/rjust.
---
tests/cpydiff/types_str_ljust_rjust.py | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 tests/cpydiff/types_str_ljust_rjust.py
diff --git a/tests/cpydiff/types_str_ljust_rjust.py b/tests/cpydiff/types_str_ljust_rjust.py
new file mode 100644
index 000000000..498596205
--- /dev/null
+++ b/tests/cpydiff/types_str_ljust_rjust.py
@@ -0,0 +1,7 @@
+"""
+categories: Types,str
+description: str.ljust() and str.rjust() not implemented
+cause: MicroPython is highly optimized for memory usage. Easy workarounds available.
+workaround: Instead of `s.ljust(10)` use `"%-10s" % s`, instead of `s.rjust(10)` use `"% 10s" % s`. Alternatively, `"{:<10}".format(s)` or `"{:>10}".format(s)`.
+"""
+print('abc'.ljust(10))
From 4d55d8805aca614ddafdc4a76abc87af60b1371f Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 11 Jul 2017 16:16:14 +1000
Subject: [PATCH 154/252] cc3200/modusocket: Fix connect() when in non-blocking
or timeout mode.
Non-blocking connect on the CC3100 has non-POSIX behaviour and needs to be
modified to match standard semantics.
---
cc3200/mods/modusocket.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 036682b49..4e17bbae6 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -167,12 +167,30 @@ STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_ob
STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
uint32_t timeout_ms = s->sock_base.timeout_ms;
+
+ // For a non-blocking connect the CC3100 will return SL_EALREADY while the
+ // connection is in progress.
+
for (;;) {
int ret = sl_Connect(s->sock_base.sd, &addr, sizeof(addr));
if (ret == 0) {
return 0;
}
- if (check_timedout(s, ret, &timeout_ms, _errno)) {
+
+ // Check if we are in non-blocking mode and the connection is in progress
+ if (s->sock_base.timeout_ms == 0 && ret == SL_EALREADY) {
+ // To match BSD we return EINPROGRESS here
+ *_errno = MP_EINPROGRESS;
+ return -1;
+ }
+
+ // We are in blocking mode, so if the connection isn't in progress then error out
+ if (ret != SL_EALREADY) {
+ *_errno = convert_sl_errno(ret);
+ return -1;
+ }
+
+ if (check_timedout(s, SL_EAGAIN, &timeout_ms, _errno)) {
return -1;
}
}
From d0db93cf1ff8eb8b2db63da07dd14d86577eebd1 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 12 Jul 2017 11:43:35 +1000
Subject: [PATCH 155/252] unix/modsocket: Remove unnecessary asserts.
These checks are already made, and errors reported, by the uPy runtime.
---
unix/modsocket.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/unix/modsocket.c b/unix/modsocket.c
index c7be6461e..c1f88defc 100644
--- a/unix/modsocket.c
+++ b/unix/modsocket.c
@@ -391,7 +391,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_htons_obj, mod_socket_htons);
STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
- assert(MP_OBJ_IS_TYPE(arg, &mp_type_str));
const char *s = mp_obj_str_get_str(arg);
struct hostent *h = gethostbyname(s);
if (h == NULL) {
@@ -441,9 +440,7 @@ STATIC mp_obj_t mod_socket_inet_ntop(mp_obj_t family_in, mp_obj_t binaddr_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
- // TODO: Implement all args
- assert(n_args >= 2 && n_args <= 4);
- assert(MP_OBJ_IS_STR(args[0]));
+ // TODO: Implement 5th and 6th args
const char *host = mp_obj_str_get_str(args[0]);
const char *serv = NULL;
@@ -510,7 +507,7 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
freeaddrinfo(addr_list);
return list;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
+STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 4, mod_socket_getaddrinfo);
STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
mp_buffer_info_t bufinfo;
From 1e6fd9f2b4072873f5d6846b19b2ef0ccc5e4e52 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 12 Jul 2017 11:56:32 +1000
Subject: [PATCH 156/252] unix/Makefile: Disable assertions in the standard
unix executable.
Reasons to disable:
- the code is relatively robust so doesn't need full checking in the
main executable, and the coverage build is used for full testing
with assertions still enabled;
- reduces code size noticeably, by 27k for x86-64 and 20k for x86;
- allows to more easily track changes in code size, since assertions
can skew things.
---
unix/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/unix/Makefile b/unix/Makefile
index be324dd3d..83c79ac96 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -30,7 +30,7 @@ ifdef DEBUG
CFLAGS += -g
COPT = -O0
else
-COPT = -Os -fdata-sections -ffunction-sections #-DNDEBUG
+COPT = -Os -fdata-sections -ffunction-sections -DNDEBUG
# _FORTIFY_SOURCE is a feature in gcc/glibc which is intended to provide extra
# security for detecting buffer overflows. Some distros (Ubuntu at the very least)
# have it enabled by default.
From 12d4fa9b37408ed682e52c3d78ecd6c269a4904a Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 12 Jul 2017 12:17:38 +1000
Subject: [PATCH 157/252] py/gc: Refactor assertions in gc_free function.
gc_free() expects either NULL or a valid pointer into the heap, so the
checks for a valid pointer can be turned into assertions.
---
py/gc.c | 49 +++++++++++++++++++++++--------------------------
1 file changed, 23 insertions(+), 26 deletions(-)
diff --git a/py/gc.c b/py/gc.c
index 937dae44f..2af886c56 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -536,37 +536,34 @@ void gc_free(void *ptr) {
DEBUG_printf("gc_free(%p)\n", ptr);
- if (VERIFY_PTR(ptr)) {
+ if (ptr == NULL) {
+ GC_EXIT();
+ } else {
+ // get the GC block number corresponding to this pointer
+ assert(VERIFY_PTR(ptr));
size_t block = BLOCK_FROM_PTR(ptr);
- if (ATB_GET_KIND(block) == AT_HEAD) {
- #if MICROPY_ENABLE_FINALISER
- FTB_CLEAR(block);
- #endif
- // set the last_free pointer to this block if it's earlier in the heap
- if (block / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) {
- MP_STATE_MEM(gc_last_free_atb_index) = block / BLOCKS_PER_ATB;
- }
+ assert(ATB_GET_KIND(block) == AT_HEAD);
- // free head and all of its tail blocks
- do {
- ATB_ANY_TO_FREE(block);
- block += 1;
- } while (ATB_GET_KIND(block) == AT_TAIL);
-
- GC_EXIT();
+ #if MICROPY_ENABLE_FINALISER
+ FTB_CLEAR(block);
+ #endif
- #if EXTENSIVE_HEAP_PROFILING
- gc_dump_alloc_table();
- #endif
- } else {
- GC_EXIT();
- assert(!"bad free");
+ // set the last_free pointer to this block if it's earlier in the heap
+ if (block / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) {
+ MP_STATE_MEM(gc_last_free_atb_index) = block / BLOCKS_PER_ATB;
}
- } else if (ptr != NULL) {
- GC_EXIT();
- assert(!"bad free");
- } else {
+
+ // free head and all of its tail blocks
+ do {
+ ATB_ANY_TO_FREE(block);
+ block += 1;
+ } while (ATB_GET_KIND(block) == AT_TAIL);
+
GC_EXIT();
+
+ #if EXTENSIVE_HEAP_PROFILING
+ gc_dump_alloc_table();
+ #endif
}
}
From f1d260d878105bfbf25c0bb68da6190e35fc106a Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 12 Jul 2017 12:51:37 +1000
Subject: [PATCH 158/252] stmhal: Reduce size of ESPRUINO_PICO build so it fits
in flash.
The default frozen modules are no longer included (but users can still
specify their own via FROZEN_MPY_DIR), complex numbers are disabled and so
are the native, viper and asm_thumb emitters. Users needing these features
can tune the build to disable other things.
---
stmhal/boards/ESPRUINO_PICO/mpconfigboard.h | 3 +++
stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk | 3 +++
stmhal/mpconfigport.h | 4 ++++
3 files changed, 10 insertions(+)
diff --git a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.h b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.h
index e84822957..d065180d8 100644
--- a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.h
+++ b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.h
@@ -1,6 +1,9 @@
#define MICROPY_HW_BOARD_NAME "Espruino Pico"
#define MICROPY_HW_MCU_NAME "STM32F401CD"
+#define MICROPY_EMIT_THUMB (0)
+#define MICROPY_EMIT_INLINE_THUMB (0)
+#define MICROPY_PY_BUILTINS_COMPLEX (0)
#define MICROPY_PY_USOCKET (0)
#define MICROPY_PY_NETWORK (0)
diff --git a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
index 4c44022c3..d531a594a 100644
--- a/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
+++ b/stmhal/boards/ESPRUINO_PICO/mpconfigboard.mk
@@ -2,3 +2,6 @@ MCU_SERIES = f4
CMSIS_MCU = STM32F401xE
AF_FILE = boards/stm32f401_af.csv
LD_FILE = boards/stm32f401xd.ld
+
+# Don't include default frozen modules because MCU is tight on flash space
+FROZEN_MPY_DIR ?=
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 96a330d13..d3ce11e02 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -39,8 +39,12 @@
// emitters
#define MICROPY_PERSISTENT_CODE_LOAD (1)
+#ifndef MICROPY_EMIT_THUMB
#define MICROPY_EMIT_THUMB (1)
+#endif
+#ifndef MICROPY_EMIT_INLINE_THUMB
#define MICROPY_EMIT_INLINE_THUMB (1)
+#endif
// compiler configuration
#define MICROPY_COMP_MODULE_CONST (1)
From 2b7075741131c457ed0bd146cd5aecddddd5f7d2 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 14 Jul 2017 16:38:15 +1000
Subject: [PATCH 159/252] stmhal/servo: Make pyb.Servo(n) map to Pin('Xn') on
all MCUs.
Prior to this patch Servo numbers 1, 2, 3, 4 mapped to pins X3, X4, X1, X2
on PYBLITE which doesn't match the standard PYB mapping. This patch fixes
the mapping.
---
stmhal/servo.c | 67 ++++++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 35 deletions(-)
diff --git a/stmhal/servo.c b/stmhal/servo.c
index 6ea6938ad..2916ca280 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -26,26 +26,28 @@
#include
-#include "py/nlr.h"
#include "py/runtime.h"
+#include "py/mphal.h"
+#include "pin.h"
+#include "genhdr/pins.h"
#include "timer.h"
#include "servo.h"
-/// \moduleref pyb
-/// \class Servo - 3-wire hobby servo driver
-///
-/// Servo controls standard hobby servos with 3-wires (ground, power, signal).
-
-// this servo driver uses hardware PWM to drive servos on PA0, PA1, PA2, PA3 = X1, X2, X3, X4
-// TIM2 and TIM5 have CH1, CH2, CH3, CH4 on PA0-PA3 respectively
-// they are both 32-bit counters with 16-bit prescaler
-// we use TIM5
+// This file implements the pyb.Servo class which controls standard hobby servo
+// motors that have 3-wires (ground, power, signal).
+//
+// The driver uses hardware PWM to drive servos on pins X1, X2, X3, X4 which are
+// assumed to be on PA0, PA1, PA2, PA3 but not necessarily in that order (the
+// pins PA0-PA3 are used directly if the X pins are not defined).
+//
+// TIM2 and TIM5 have CH1-CH4 on PA0-PA3 respectively. They are both 32-bit
+// counters with 16-bit prescaler. TIM5 is used by this driver.
#define PYB_SERVO_NUM (4)
typedef struct _pyb_servo_obj_t {
mp_obj_base_t base;
- uint8_t servo_id;
+ const pin_obj_t *pin;
uint8_t pulse_min; // units of 10us
uint8_t pulse_max; // units of 10us
uint8_t pulse_centre; // units of 10us
@@ -65,7 +67,6 @@ void servo_init(void) {
// reset servo objects
for (int i = 0; i < PYB_SERVO_NUM; i++) {
pyb_servo_obj[i].base.type = &pyb_servo_type;
- pyb_servo_obj[i].servo_id = i + 1;
pyb_servo_obj[i].pulse_min = 64;
pyb_servo_obj[i].pulse_max = 242;
pyb_servo_obj[i].pulse_centre = 150;
@@ -75,6 +76,19 @@ void servo_init(void) {
pyb_servo_obj[i].pulse_dest = 0;
pyb_servo_obj[i].time_left = 0;
}
+
+ // assign servo objects to specific pins (must be some permutation of PA0-PA3)
+ #ifdef pyb_pin_X1
+ pyb_servo_obj[0].pin = &pyb_pin_X1;
+ pyb_servo_obj[1].pin = &pyb_pin_X2;
+ pyb_servo_obj[2].pin = &pyb_pin_X3;
+ pyb_servo_obj[3].pin = &pyb_pin_X4;
+ #else
+ pyb_servo_obj[0].pin = &pin_A0;
+ pyb_servo_obj[1].pin = &pin_A1;
+ pyb_servo_obj[2].pin = &pin_A2;
+ pyb_servo_obj[3].pin = &pin_A3;
+ #endif
}
void servo_timer_irq_callback(void) {
@@ -100,12 +114,7 @@ void servo_timer_irq_callback(void) {
need_it = true;
}
// set the pulse width
- switch (s->servo_id) {
- case 1: TIM5->CCR1 = s->pulse_cur; break;
- case 2: TIM5->CCR2 = s->pulse_cur; break;
- case 3: TIM5->CCR3 = s->pulse_cur; break;
- case 4: TIM5->CCR4 = s->pulse_cur; break;
- }
+ *(&TIM5->CCR1 + s->pin->pin) = s->pulse_cur;
}
}
if (need_it) {
@@ -116,24 +125,12 @@ void servo_timer_irq_callback(void) {
}
STATIC void servo_init_channel(pyb_servo_obj_t *s) {
- uint32_t pin;
- uint32_t channel;
- switch (s->servo_id) {
- case 1: pin = GPIO_PIN_0; channel = TIM_CHANNEL_1; break;
- case 2: pin = GPIO_PIN_1; channel = TIM_CHANNEL_2; break;
- case 3: pin = GPIO_PIN_2; channel = TIM_CHANNEL_3; break;
- case 4: pin = GPIO_PIN_3; channel = TIM_CHANNEL_4; break;
- default: return;
- }
+ static const uint8_t channel_table[4] =
+ {TIM_CHANNEL_1, TIM_CHANNEL_2, TIM_CHANNEL_3, TIM_CHANNEL_4};
+ uint32_t channel = channel_table[s->pin->pin];
// GPIO configuration
- GPIO_InitTypeDef GPIO_InitStructure;
- GPIO_InitStructure.Pin = pin;
- GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
- GPIO_InitStructure.Pull = GPIO_NOPULL;
- GPIO_InitStructure.Alternate = GPIO_AF2_TIM5;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
+ mp_hal_pin_config(s->pin, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_NONE, GPIO_AF2_TIM5);
// PWM mode configuration
TIM_OC_InitTypeDef oc_init;
@@ -178,7 +175,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(pyb_pwm_set_obj, pyb_pwm_set);
STATIC void pyb_servo_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_servo_obj_t *self = self_in;
- mp_printf(print, "", self->servo_id, 10 * self->pulse_cur);
+ mp_printf(print, "", self - &pyb_servo_obj[0] + 1, 10 * self->pulse_cur);
}
/// \classmethod \constructor(id)
From 9cca14a5dcba9e850e150fbd77803626df190f55 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 14 Jul 2017 17:03:24 +1000
Subject: [PATCH 160/252] stmhal/pin_named_pins: Remove unreachable print
function.
There are never any instances of these objects so there is no need to have
a print function.
---
stmhal/pin_named_pins.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/stmhal/pin_named_pins.c b/stmhal/pin_named_pins.c
index 9e5f9593b..fac19ee97 100644
--- a/stmhal/pin_named_pins.c
+++ b/stmhal/pin_named_pins.c
@@ -31,22 +31,15 @@
#include "py/mphal.h"
#include "pin.h"
-STATIC void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- pin_named_pins_obj_t *self = self_in;
- mp_printf(print, "", self->name);
-}
-
const mp_obj_type_t pin_cpu_pins_obj_type = {
{ &mp_type_type },
.name = MP_QSTR_cpu,
- .print = pin_named_pins_obj_print,
.locals_dict = (mp_obj_t)&pin_cpu_pins_locals_dict,
};
const mp_obj_type_t pin_board_pins_obj_type = {
{ &mp_type_type },
.name = MP_QSTR_board,
- .print = pin_named_pins_obj_print,
.locals_dict = (mp_obj_t)&pin_board_pins_locals_dict,
};
From 4fa9d97e4db333e3252b0e87584d29753f2da74d Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 14 Jul 2017 17:41:43 +1000
Subject: [PATCH 161/252] stmhal/servo: Don't compile servo code when it's not
enabled.
---
stmhal/servo.c | 4 ++++
stmhal/timer.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/stmhal/servo.c b/stmhal/servo.c
index 2916ca280..e4bcbc30e 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.c
@@ -33,6 +33,8 @@
#include "timer.h"
#include "servo.h"
+#if MICROPY_HW_ENABLE_SERVO
+
// This file implements the pyb.Servo class which controls standard hobby servo
// motors that have 3-wires (ground, power, signal).
//
@@ -328,3 +330,5 @@ const mp_obj_type_t pyb_servo_type = {
.make_new = pyb_servo_make_new,
.locals_dict = (mp_obj_dict_t*)&pyb_servo_locals_dict,
};
+
+#endif // MICROPY_HW_ENABLE_SERVO
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 7db15f649..39f168fc8 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -216,9 +216,11 @@ TIM_HandleTypeDef *timer_tim6_init(uint freq) {
// Interrupt dispatch
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
+ #if MICROPY_HW_ENABLE_SERVO
if (htim == &TIM5_Handle) {
servo_timer_irq_callback();
}
+ #endif
}
// Get the frequency (in Hz) of the source clock for the given timer.
From c9a48eb464879e35217e7df89a5dab568367f395 Mon Sep 17 00:00:00 2001
From: Alexander Steffen
Date: Sat, 15 Jul 2017 11:44:15 +0200
Subject: [PATCH 162/252] docs,teensy: Use the name MicroPython consistently in
documentation
---
docs/library/pyb.rst | 4 ++--
teensy/README.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/library/pyb.rst b/docs/library/pyb.rst
index a8fef9309..799160145 100644
--- a/docs/library/pyb.rst
+++ b/docs/library/pyb.rst
@@ -21,7 +21,7 @@ Time related functions
Returns the number of milliseconds since the board was last reset.
- The result is always a micropython smallint (31-bit signed number), so
+ The result is always a MicroPython smallint (31-bit signed number), so
after 2^30 milliseconds (about 12.4 days) this will start to return
negative numbers.
@@ -33,7 +33,7 @@ Time related functions
Returns the number of microseconds since the board was last reset.
- The result is always a micropython smallint (31-bit signed number), so
+ The result is always a MicroPython smallint (31-bit signed number), so
after 2^30 microseconds (about 17.8 minutes) this will start to return
negative numbers.
diff --git a/teensy/README.md b/teensy/README.md
index 3e4a75b9e..c586853b5 100644
--- a/teensy/README.md
+++ b/teensy/README.md
@@ -18,7 +18,7 @@ cd teensy
ARDUINO=~/arduino-1.0.5 make
```
-To upload micropython to the Teensy 3.1.
+To upload MicroPython to the Teensy 3.1.
Press the Program button on the Teensy 3.1
```bash
From d91c1170ca489b6f754918e678ed412a246eb8cc Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 17 Jul 2017 15:17:06 +1000
Subject: [PATCH 163/252] zephyr: Remove long-obsolete machine_ptr_t typedef's.
---
zephyr/mpconfigport.h | 3 ---
zephyr/mpconfigport_minimal.h | 3 ---
2 files changed, 6 deletions(-)
diff --git a/zephyr/mpconfigport.h b/zephyr/mpconfigport.h
index 2f2526779..b4677f3ed 100644
--- a/zephyr/mpconfigport.h
+++ b/zephyr/mpconfigport.h
@@ -98,9 +98,6 @@
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size
-
-typedef void *machine_ptr_t; // must be of pointer size
-typedef const void *machine_const_ptr_t; // must be of pointer size
typedef long mp_off_t;
#define MP_STATE_PORT MP_STATE_VM
diff --git a/zephyr/mpconfigport_minimal.h b/zephyr/mpconfigport_minimal.h
index 772335c0a..f0e57d756 100644
--- a/zephyr/mpconfigport_minimal.h
+++ b/zephyr/mpconfigport_minimal.h
@@ -80,9 +80,6 @@
typedef int mp_int_t; // must be pointer size
typedef unsigned mp_uint_t; // must be pointer size
-
-typedef void *machine_ptr_t; // must be of pointer size
-typedef const void *machine_const_ptr_t; // must be of pointer size
typedef long mp_off_t;
#define MP_STATE_PORT MP_STATE_VM
From 299bc625864b9e624ed599c94a5f95870516139a Mon Sep 17 00:00:00 2001
From: Alexander Steffen
Date: Thu, 29 Jun 2017 23:14:58 +0200
Subject: [PATCH 164/252] all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.
This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.
The rules are as follows.
Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _
In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.
py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
---
cc3200/bootmgr/bootmgr.h | 7 +++----
cc3200/bootmgr/flc.h | 7 +++----
cc3200/ftp/ftp.h | 7 +++----
cc3200/ftp/updater.h | 8 +++-----
cc3200/hal/cc3200_hal.h | 5 -----
cc3200/misc/antenna.h | 7 +++----
cc3200/misc/mperror.h | 7 +++----
cc3200/misc/mpexception.h | 7 +++----
cc3200/misc/mpirq.h | 7 +++----
cc3200/mods/modnetwork.h | 7 +++----
cc3200/mods/modubinascii.h | 7 +++----
cc3200/mods/moduos.h | 7 +++----
cc3200/mods/modusocket.h | 7 +++----
cc3200/mods/modwlan.h | 7 +++----
cc3200/mods/pybadc.h | 7 +++----
cc3200/mods/pybi2c.h | 7 +++----
cc3200/mods/pybpin.h | 7 +++----
cc3200/mods/pybrtc.h | 7 +++----
cc3200/mods/pybsd.h | 6 +++---
cc3200/mods/pybsleep.h | 7 +++----
cc3200/mods/pybspi.h | 7 +++----
cc3200/mods/pybtimer.h | 3 +++
cc3200/mods/pybuart.h | 7 +++----
cc3200/mods/pybwdt.h | 7 +++----
cc3200/mpconfigport.h | 5 -----
cc3200/mptask.h | 7 +++----
cc3200/mpthreadport.h | 4 ----
cc3200/serverstask.h | 7 +++----
cc3200/telnet/telnet.h | 7 +++----
cc3200/util/cryptohash.h | 7 +++----
cc3200/util/fifo.h | 7 +++----
cc3200/util/gccollect.h | 4 ++++
cc3200/util/gchelper.h | 7 +++----
cc3200/util/random.h | 7 +++----
cc3200/util/sleeprestore.h | 7 +++----
cc3200/util/socketfifo.h | 7 +++----
cc3200/version.h | 7 +++----
drivers/dht/dht.h | 5 +++++
drivers/memory/spiflash.h | 1 -
esp8266/esp_mphal.h | 5 -----
esp8266/espapa102.h | 4 ++++
esp8266/espneopixel.h | 5 +++++
esp8266/esppwm.h | 6 +++---
esp8266/ets_alt_task.h | 5 +++++
esp8266/etshal.h | 6 +++---
esp8266/gccollect.h | 4 ++++
esp8266/modmachine.h | 6 +++---
esp8266/uart.h | 6 +++---
esp8266/xtirq.h | 7 +++----
extmod/lwip-include/arch/cc.h | 6 +++---
extmod/lwip-include/arch/perf.h | 6 +++---
extmod/lwip-include/lwipopts.h | 7 +++----
extmod/machine_i2c.h | 7 +++----
extmod/machine_mem.h | 8 +++-----
extmod/machine_pinbase.h | 8 +++-----
extmod/machine_pulse.h | 7 +++----
extmod/machine_signal.h | 8 +++-----
extmod/machine_spi.h | 1 -
extmod/misc.h | 4 ++++
extmod/modubinascii.h | 7 +++----
extmod/modwebsocket.h | 5 +++++
extmod/utime_mphal.h | 4 ++++
extmod/vfs.h | 1 -
extmod/vfs_fat.h | 4 ++++
extmod/virtpin.h | 4 ++++
lib/mp-readline/readline.h | 4 ++++
lib/netutils/netutils.h | 6 +++---
lib/timeutils/timeutils.h | 7 +++----
lib/utils/interrupt_char.h | 4 ++++
lib/utils/pyexec.h | 6 +++---
pic16bit/board.h | 6 +++---
pic16bit/modpyb.h | 6 +++---
pic16bit/pic16bit_mphal.h | 4 ----
pic16bit/unistd.h | 5 +++++
py/asmarm.h | 6 +++---
py/asmthumb.h | 6 +++---
py/asmx64.h | 6 +++---
py/asmx86.h | 6 +++---
py/bc.h | 6 +++---
py/bc0.h | 6 +++---
py/binary.h | 6 +++---
py/builtin.h | 6 +++---
py/compile.h | 6 +++---
py/emit.h | 7 +++----
py/emitglue.h | 6 +++---
py/formatfloat.h | 6 +++---
py/frozenmod.h | 6 +++---
py/gc.h | 6 +++---
py/lexer.h | 6 +++---
py/misc.h | 6 +++---
py/mpconfig.h | 6 +++---
py/mperrno.h | 7 +++----
py/mphal.h | 6 +++---
py/mpprint.h | 6 +++---
py/mpstate.h | 6 +++---
py/mpthread.h | 6 +++---
py/mpz.h | 6 +++---
py/nlr.h | 6 +++---
py/obj.h | 6 +++---
py/objarray.h | 7 +++----
py/objexcept.h | 6 +++---
py/objfun.h | 6 +++---
py/objgenerator.h | 6 +++---
py/objint.h | 6 +++---
py/objlist.h | 6 +++---
py/objmodule.h | 6 +++---
py/objstr.h | 6 +++---
py/objtuple.h | 6 +++---
py/objtype.h | 6 +++---
py/parse.h | 6 +++---
py/parsenum.h | 6 +++---
py/parsenumbase.h | 6 +++---
py/qstr.h | 6 +++---
py/repl.h | 6 +++---
py/ringbuf.h | 6 +++---
py/runtime.h | 6 +++---
py/runtime0.h | 6 +++---
py/scope.h | 6 +++---
py/smallint.h | 6 +++---
py/stackctrl.h | 6 +++---
py/stream.h | 6 +++---
py/unicode.h | 6 +++---
stmhal/accel.h | 4 ++++
stmhal/adc.h | 4 ++++
stmhal/bufhelper.h | 4 ++++
stmhal/can.h | 4 ++++
stmhal/dac.h | 4 ++++
stmhal/dma.h | 7 +++----
stmhal/extint.h | 4 ++++
stmhal/flash.h | 4 ++++
stmhal/font_petme128_8x8.h | 4 ++++
stmhal/gccollect.h | 4 ++++
stmhal/i2c.h | 4 ++++
stmhal/irq.h | 1 -
stmhal/lcd.h | 4 ++++
stmhal/led.h | 4 ++++
stmhal/modmachine.h | 7 +++----
stmhal/modnetwork.h | 4 ++++
stmhal/mpconfigport.h | 6 ------
stmhal/mpthreadport.h | 4 ----
stmhal/pendsv.h | 4 ++++
stmhal/pin.h | 7 +++----
stmhal/portmodules.h | 4 ++++
stmhal/pybthread.h | 1 -
stmhal/rng.h | 4 ++++
stmhal/rtc.h | 4 ++++
stmhal/sdcard.h | 4 ++++
stmhal/servo.h | 4 ++++
stmhal/spi.h | 4 ++++
stmhal/stm32_it.h | 4 ++++
stmhal/storage.h | 4 ++++
stmhal/systick.h | 4 ++++
stmhal/timer.h | 4 ++++
stmhal/uart.h | 4 ++++
stmhal/usb.h | 4 ++++
stmhal/usbd_cdc_interface.h | 4 ++++
stmhal/usbd_desc.h | 4 ++++
stmhal/usbd_hid_interface.h | 4 ++++
stmhal/usbd_msc_storage.h | 4 ++++
stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h | 7 +++----
stmhal/usrsw.h | 4 ++++
stmhal/wdt.h | 4 ++++
teensy/hal_ftm.h | 4 +++-
teensy/led.h | 5 +++++
teensy/lexermemzip.h | 4 ++++
teensy/reg.h | 5 +++++
teensy/servo.h | 4 ++++
teensy/std.h | 5 +++++
teensy/timer.h | 4 ++++
teensy/usb.h | 5 +++++
unix/fdfile.h | 7 +++----
unix/input.h | 5 +++++
unix/mpthreadport.h | 4 ----
windows/fmode.h | 7 +++----
windows/init.h | 4 ++++
windows/msvc/dirent.h | 4 ++++
windows/msvc/sys/time.h | 4 ++++
windows/msvc/unistd.h | 4 ++++
windows/realpath.h | 4 ++++
windows/sleep.h | 4 ++++
zephyr/modmachine.h | 6 +++---
181 files changed, 574 insertions(+), 414 deletions(-)
diff --git a/cc3200/bootmgr/bootmgr.h b/cc3200/bootmgr/bootmgr.h
index 4b314335c..e5285d4e4 100644
--- a/cc3200/bootmgr/bootmgr.h
+++ b/cc3200/bootmgr/bootmgr.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __BOOTMGR_H__
-#define __BOOTMGR_H__
+#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
+#define MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
//****************************************************************************
//
@@ -66,4 +65,4 @@ extern void Run(unsigned long);
}
#endif
-#endif //__BOOTMGR_H__
+#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
diff --git a/cc3200/bootmgr/flc.h b/cc3200/bootmgr/flc.h
index 4b2aca9ac..7c04c7b05 100644
--- a/cc3200/bootmgr/flc.h
+++ b/cc3200/bootmgr/flc.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __FLC_H__
-#define __FLC_H__
+#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
+#define MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
/******************************************************************************
@@ -93,4 +92,4 @@ typedef struct _sBootInfo_t
}
#endif
-#endif /* __FLC_H__ */
+#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
diff --git a/cc3200/ftp/ftp.h b/cc3200/ftp/ftp.h
index 13b044dcf..7d16002e4 100644
--- a/cc3200/ftp/ftp.h
+++ b/cc3200/ftp/ftp.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef FTP_H_
-#define FTP_H_
+#ifndef MICROPY_INCLUDED_CC3200_FTP_FTP_H
+#define MICROPY_INCLUDED_CC3200_FTP_FTP_H
/******************************************************************************
DECLARE EXPORTED FUNCTIONS
@@ -36,4 +35,4 @@ extern void ftp_enable (void);
extern void ftp_disable (void);
extern void ftp_reset (void);
-#endif /* FTP_H_ */
+#endif // MICROPY_INCLUDED_CC3200_FTP_FTP_H
diff --git a/cc3200/ftp/updater.h b/cc3200/ftp/updater.h
index b581d0fc8..dcca70472 100644
--- a/cc3200/ftp/updater.h
+++ b/cc3200/ftp/updater.h
@@ -23,10 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-
-#ifndef UPDATER_H_
-#define UPDATER_H_
+#ifndef MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
+#define MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
extern void updater_pre_init (void);
extern bool updater_check_path (void *path);
@@ -35,4 +33,4 @@ extern bool updater_write (uint8_t *buf, uint32_t len);
extern void updater_finnish (void);
extern bool updater_verify (uint8_t *rbuff, uint8_t *hasbuff);
-#endif /* UPDATER_H_ */
+#endif // MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
diff --git a/cc3200/hal/cc3200_hal.h b/cc3200/hal/cc3200_hal.h
index fcb85b292..9953f0e5a 100644
--- a/cc3200/hal/cc3200_hal.h
+++ b/cc3200/hal/cc3200_hal.h
@@ -24,9 +24,6 @@
* THE SOFTWARE.
*/
-#ifndef CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
-#define CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
-
#include
#include
@@ -69,5 +66,3 @@ extern void mp_hal_set_interrupt_char (int c);
#define mp_hal_delay_us(usec) UtilsDelay(UTILS_DELAY_US_TO_COUNT(usec))
#define mp_hal_ticks_cpu() (SysTickPeriodGet() - SysTickValueGet())
-
-#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */
diff --git a/cc3200/misc/antenna.h b/cc3200/misc/antenna.h
index b3b1c6162..3bb87e32b 100644
--- a/cc3200/misc/antenna.h
+++ b/cc3200/misc/antenna.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef _ANTENNA_H_
-#define _ANTENNA_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
+#define MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
typedef enum {
ANTENNA_TYPE_INTERNAL = 0,
@@ -35,4 +34,4 @@ typedef enum {
extern void antenna_init0 (void);
extern void antenna_select (antenna_type_t antenna_type);
-#endif /* _ANTENNA_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
diff --git a/cc3200/misc/mperror.h b/cc3200/misc/mperror.h
index e38d129db..46a9b8cb0 100644
--- a/cc3200/misc/mperror.h
+++ b/cc3200/misc/mperror.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MPERROR_H_
-#define MPERROR_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
extern void NORETURN __fatal_error(const char *msg);
@@ -39,4 +38,4 @@ void mperror_heartbeat_signal (void);
void mperror_enable_heartbeat (bool enable);
bool mperror_is_heartbeat_enabled (void);
-#endif // MPERROR_H_
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
diff --git a/cc3200/misc/mpexception.h b/cc3200/misc/mpexception.h
index 2f9d1877c..d23381caf 100644
--- a/cc3200/misc/mpexception.h
+++ b/cc3200/misc/mpexception.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MPEXCEPTION_H_
-#define MPEXCEPTION_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
extern const char mpexception_value_invalid_arguments[];
extern const char mpexception_num_type_invalid_arguments[];
@@ -40,4 +39,4 @@ extern void mpexception_set_interrupt_char (int c);
extern void mpexception_nlr_jump (void *o);
extern void mpexception_keyboard_nlr_jump (void);
-#endif /* MPEXCEPTION_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
diff --git a/cc3200/misc/mpirq.h b/cc3200/misc/mpirq.h
index 3fd21ee09..8b4ab2f1b 100644
--- a/cc3200/misc/mpirq.h
+++ b/cc3200/misc/mpirq.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MPIRQ_H_
-#define MPIRQ_H_
+#ifndef MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
+#define MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
/******************************************************************************
DEFINE CONSTANTS
@@ -72,4 +71,4 @@ void mp_irq_remove (const mp_obj_t parent);
void mp_irq_handler (mp_obj_t self_in);
uint mp_irq_translate_priority (uint priority);
-#endif /* MPIRQ_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
diff --git a/cc3200/mods/modnetwork.h b/cc3200/mods/modnetwork.h
index 8a886c3e4..8e1196e86 100644
--- a/cc3200/mods/modnetwork.h
+++ b/cc3200/mods/modnetwork.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MODNETWORK_H_
-#define MODNETWORK_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
/******************************************************************************
DEFINE CONSTANTS
@@ -71,4 +70,4 @@ extern const mod_network_nic_type_t mod_network_nic_type_wlan;
******************************************************************************/
void mod_network_init0(void);
-#endif // MODNETWORK_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
diff --git a/cc3200/mods/modubinascii.h b/cc3200/mods/modubinascii.h
index c04b70021..3e784e9ae 100644
--- a/cc3200/mods/modubinascii.h
+++ b/cc3200/mods/modubinascii.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
-#ifndef MODUBINASCII_H_
-#define MODUBINASCII_H_
-
-#endif /* MODUBINASCII_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
diff --git a/cc3200/mods/moduos.h b/cc3200/mods/moduos.h
index 4c8bc9659..148cddf2e 100644
--- a/cc3200/mods/moduos.h
+++ b/cc3200/mods/moduos.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MODUOS_H_
-#define MODUOS_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
#include "py/obj.h"
@@ -45,4 +44,4 @@ typedef struct _os_term_dup_obj_t {
******************************************************************************/
void osmount_unmount_all (void);
-#endif // MODUOS_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
diff --git a/cc3200/mods/modusocket.h b/cc3200/mods/modusocket.h
index 851f8e5be..80c1f24cd 100644
--- a/cc3200/mods/modusocket.h
+++ b/cc3200/mods/modusocket.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MODUSOCKET_H_
-#define MODUSOCKET_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
extern const mp_obj_dict_t socket_locals_dict;
extern const mp_stream_p_t socket_stream_p;
@@ -36,4 +35,4 @@ extern void modusocket_socket_delete (int16_t sd);
extern void modusocket_enter_sleep (void);
extern void modusocket_close_all_user_sockets (void);
-#endif /* MODUSOCKET_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
diff --git a/cc3200/mods/modwlan.h b/cc3200/mods/modwlan.h
index 3bfd1fbbf..d37d276e8 100644
--- a/cc3200/mods/modwlan.h
+++ b/cc3200/mods/modwlan.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MODWLAN_H_
-#define MODWLAN_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
+#define MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
/******************************************************************************
DEFINE CONSTANTS
@@ -97,4 +96,4 @@ extern bool wlan_is_connected (void);
extern void wlan_set_current_time (uint32_t seconds_since_2000);
extern void wlan_off_on (void);
-#endif /* MODWLAN_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
diff --git a/cc3200/mods/pybadc.h b/cc3200/mods/pybadc.h
index b77c4af42..50640ee60 100644
--- a/cc3200/mods/pybadc.h
+++ b/cc3200/mods/pybadc.h
@@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBADC_H_
-#define PYBADC_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
extern const mp_obj_type_t pyb_adc_type;
-#endif /* PYBADC_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
diff --git a/cc3200/mods/pybi2c.h b/cc3200/mods/pybi2c.h
index 7adffb2d9..d547f6330 100644
--- a/cc3200/mods/pybi2c.h
+++ b/cc3200/mods/pybi2c.h
@@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBI2C_H_
-#define PYBI2C_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
extern const mp_obj_type_t pyb_i2c_type;
-#endif // PYBI2C_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
diff --git a/cc3200/mods/pybpin.h b/cc3200/mods/pybpin.h
index ad02cc777..6b4b7b1ed 100644
--- a/cc3200/mods/pybpin.h
+++ b/cc3200/mods/pybpin.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBPIN_H_
-#define PYBPIN_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
enum {
PORT_A0 = GPIOA0_BASE,
@@ -138,4 +137,4 @@ uint8_t pin_find_peripheral_unit (const mp_obj_t pin, uint8_t fn, uint8_t type);
uint8_t pin_find_peripheral_type (const mp_obj_t pin, uint8_t fn, uint8_t unit);
int8_t pin_find_af_index (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type);;
-#endif // PYBPIN_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
diff --git a/cc3200/mods/pybrtc.h b/cc3200/mods/pybrtc.h
index 5111b78f7..3fd11ecd6 100644
--- a/cc3200/mods/pybrtc.h
+++ b/cc3200/mods/pybrtc.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBRTC_H_
-#define PYBRTC_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
// RTC triggers
#define PYB_RTC_ALARM0 (0x01)
@@ -56,4 +55,4 @@ extern void pyb_rtc_calc_future_time (uint32_t a_mseconds, uint32_t *f_seconds,
extern void pyb_rtc_repeat_alarm (pyb_rtc_obj_t *self);
extern void pyb_rtc_disable_alarm (void);
-#endif // PYBRTC_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
diff --git a/cc3200/mods/pybsd.h b/cc3200/mods/pybsd.h
index a06df6d8d..084d7caaf 100644
--- a/cc3200/mods/pybsd.h
+++ b/cc3200/mods/pybsd.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef PYBSD_H_
-#define PYBSD_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
/******************************************************************************
DEFINE PUBLIC TYPES
@@ -41,4 +41,4 @@ typedef struct {
extern pybsd_obj_t pybsd_obj;
extern const mp_obj_type_t pyb_sd_type;
-#endif // PYBSD_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
diff --git a/cc3200/mods/pybsleep.h b/cc3200/mods/pybsleep.h
index d34895ae0..513e6fa95 100644
--- a/cc3200/mods/pybsleep.h
+++ b/cc3200/mods/pybsleep.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBSLEEP_H_
-#define PYBSLEEP_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
/******************************************************************************
DEFINE CONSTANTS
@@ -70,4 +69,4 @@ void pyb_sleep_deepsleep (void);
pybsleep_reset_cause_t pyb_sleep_get_reset_cause (void);
pybsleep_wake_reason_t pyb_sleep_get_wake_reason (void);
-#endif /* PYBSLEEP_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
diff --git a/cc3200/mods/pybspi.h b/cc3200/mods/pybspi.h
index 48e0edd61..b533b6056 100644
--- a/cc3200/mods/pybspi.h
+++ b/cc3200/mods/pybspi.h
@@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBSPI_H_
-#define PYBSPI_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
extern const mp_obj_type_t pyb_spi_type;
-#endif // PYBSPI_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
diff --git a/cc3200/mods/pybtimer.h b/cc3200/mods/pybtimer.h
index 4e9de138d..a1b30cd2b 100644
--- a/cc3200/mods/pybtimer.h
+++ b/cc3200/mods/pybtimer.h
@@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
/******************************************************************************
DECLARE EXPORTED DATA
@@ -35,3 +37,4 @@ extern const mp_obj_type_t pyb_timer_type;
******************************************************************************/
void timer_init0 (void);
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
diff --git a/cc3200/mods/pybuart.h b/cc3200/mods/pybuart.h
index 19bc93607..56440987f 100644
--- a/cc3200/mods/pybuart.h
+++ b/cc3200/mods/pybuart.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBUART_H_
-#define PYBUART_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
typedef enum {
PYB_UART_0 = 0,
@@ -43,4 +42,4 @@ int uart_rx_char(pyb_uart_obj_t *uart_obj);
bool uart_tx_char(pyb_uart_obj_t *self, int c);
bool uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len);
-#endif // PYBUART_H_
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
diff --git a/cc3200/mods/pybwdt.h b/cc3200/mods/pybwdt.h
index f87f0a773..2844587cb 100644
--- a/cc3200/mods/pybwdt.h
+++ b/cc3200/mods/pybwdt.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef PYBWDT_H_
-#define PYBWDT_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
+#define MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
#include "py/obj.h"
@@ -36,4 +35,4 @@ void pybwdt_srv_alive (void);
void pybwdt_srv_sleeping (bool state);
void pybwdt_sl_alive (void);
-#endif /* PYBWDT_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 4bd583a4b..78f8c0948 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -25,9 +25,6 @@
* THE SOFTWARE.
*/
-#ifndef __INCLUDED_MPCONFIGPORT_H
-#define __INCLUDED_MPCONFIGPORT_H
-
#include
#ifndef BOOTLOADER
@@ -235,5 +232,3 @@ typedef long mp_off_t;
#define MICROPY_PORT_WLAN_AP_KEY "www.wipy.io"
#define MICROPY_PORT_WLAN_AP_SECURITY SL_SEC_TYPE_WPA_WPA2
#define MICROPY_PORT_WLAN_AP_CHANNEL 5
-
-#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/cc3200/mptask.h b/cc3200/mptask.h
index e0d2f0eec..9276cfc3e 100644
--- a/cc3200/mptask.h
+++ b/cc3200/mptask.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MPTASK_H_
-#define MPTASK_H_
+#ifndef MICROPY_INCLUDED_CC3200_MPTASK_H
+#define MICROPY_INCLUDED_CC3200_MPTASK_H
/******************************************************************************
DEFINE CONSTANTS
@@ -44,4 +43,4 @@ extern StackType_t mpTaskStack[];
******************************************************************************/
extern void TASK_Micropython (void *pvParameters);
-#endif /* MPTASK_H_ */
+#endif // MICROPY_INCLUDED_CC3200_MPTASK_H
diff --git a/cc3200/mpthreadport.h b/cc3200/mpthreadport.h
index 2b49232dd..dc9ba9920 100644
--- a/cc3200/mpthreadport.h
+++ b/cc3200/mpthreadport.h
@@ -23,8 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
#ifndef BOOTLOADER
#include "FreeRTOS.h"
@@ -39,5 +37,3 @@ typedef struct _mp_thread_mutex_t {
void mp_thread_init(void);
void mp_thread_gc_others(void);
-
-#endif // __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
diff --git a/cc3200/serverstask.h b/cc3200/serverstask.h
index 2786ff697..77a3af2f3 100644
--- a/cc3200/serverstask.h
+++ b/cc3200/serverstask.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef SERVERSTASK_H_
-#define SERVERSTASK_H_
+#ifndef MICROPY_INCLUDED_CC3200_SERVERSTASK_H
+#define MICROPY_INCLUDED_CC3200_SERVERSTASK_H
/******************************************************************************
DEFINE CONSTANTS
@@ -73,4 +72,4 @@ extern void server_sleep_sockets (void);
extern void servers_set_timeout (uint32_t timeout);
extern uint32_t servers_get_timeout (void);
-#endif /* SERVERSTASK_H_ */
+#endif // MICROPY_INCLUDED_CC3200_SERVERSTASK_H
diff --git a/cc3200/telnet/telnet.h b/cc3200/telnet/telnet.h
index aa5531394..1e3173b11 100644
--- a/cc3200/telnet/telnet.h
+++ b/cc3200/telnet/telnet.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef TELNET_H_
-#define TELNET_H_
+#ifndef MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
+#define MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
/******************************************************************************
DECLARE EXPORTED FUNCTIONS
@@ -39,4 +38,4 @@ extern void telnet_enable (void);
extern void telnet_disable (void);
extern void telnet_reset (void);
-#endif /* TELNET_H_ */
+#endif // MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
diff --git a/cc3200/util/cryptohash.h b/cc3200/util/cryptohash.h
index d9f624d19..df3a8475c 100644
--- a/cc3200/util/cryptohash.h
+++ b/cc3200/util/cryptohash.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef CRYPTOHASH_H_
-#define CRYPTOHASH_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
+#define MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
@@ -35,4 +34,4 @@ extern void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
extern void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
extern void CRYPTOHASH_SHAMD5Read (uint8_t *hash);
-#endif /* CRYPTOHASH_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
diff --git a/cc3200/util/fifo.h b/cc3200/util/fifo.h
index c8590f5c2..ee7571c26 100644
--- a/cc3200/util/fifo.h
+++ b/cc3200/util/fifo.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef FIFO_H_
-#define FIFO_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
+#define MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
typedef struct {
void *pvElements;
@@ -47,4 +46,4 @@ extern bool FIFO_IsEmpty (FIFO_t *fifo);
extern bool FIFO_IsFull (FIFO_t *fifo);
extern void FIFO_Flush (FIFO_t *fifo);
-#endif /* FIFO_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
diff --git a/cc3200/util/gccollect.h b/cc3200/util/gccollect.h
index 281e84aa8..3c4232b84 100644
--- a/cc3200/util/gccollect.h
+++ b/cc3200/util/gccollect.h
@@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
+#define MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
// variables defining memory layout
extern uint32_t _etext;
@@ -39,3 +41,5 @@ extern uint32_t _stack;
extern uint32_t _estack;
void gc_collect(void);
+
+#endif // MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
diff --git a/cc3200/util/gchelper.h b/cc3200/util/gchelper.h
index 1f7d2fece..0277a754b 100644
--- a/cc3200/util/gchelper.h
+++ b/cc3200/util/gchelper.h
@@ -24,11 +24,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef GC_HELPER_H_
-#define GC_HELPER_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
+#define MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
extern mp_uint_t gc_helper_get_sp(void);
extern mp_uint_t gc_helper_get_regs_and_sp(mp_uint_t *regs);
-#endif /* GC_HELPER_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
diff --git a/cc3200/util/random.h b/cc3200/util/random.h
index 67fd1ff85..60b0b8663 100644
--- a/cc3200/util/random.h
+++ b/cc3200/util/random.h
@@ -23,13 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __RANDOM_H
-#define __RANDOM_H
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
+#define MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
void rng_init0 (void);
uint32_t rng_get (void);
MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
-#endif // __RANDOM_H
+#endif // MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
diff --git a/cc3200/util/sleeprestore.h b/cc3200/util/sleeprestore.h
index 51416f0fc..1c5509db0 100644
--- a/cc3200/util/sleeprestore.h
+++ b/cc3200/util/sleeprestore.h
@@ -23,11 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef SLEEPRESTORE_H_
-#define SLEEPRESTORE_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
+#define MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
extern void sleep_store(void);
extern void sleep_restore(void);
-#endif /* SLEEPRESTORE_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
diff --git a/cc3200/util/socketfifo.h b/cc3200/util/socketfifo.h
index 69b17658f..1309201ee 100644
--- a/cc3200/util/socketfifo.h
+++ b/cc3200/util/socketfifo.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef SOCKETFIFO_H_
-#define SOCKETFIFO_H_
+#ifndef MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
+#define MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
/*----------------------------------------------------------------------------
** Imports
@@ -60,4 +59,4 @@ extern bool SOCKETFIFO_IsFull (void);
extern void SOCKETFIFO_Flush (void);
extern unsigned int SOCKETFIFO_Count (void);
-#endif /* SOCKETFIFO_H_ */
+#endif // MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
diff --git a/cc3200/version.h b/cc3200/version.h
index c8315d771..83e3f8c07 100644
--- a/cc3200/version.h
+++ b/cc3200/version.h
@@ -23,10 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef VERSION_H_
-#define VERSION_H_
+#ifndef MICROPY_INCLUDED_CC3200_VERSION_H
+#define MICROPY_INCLUDED_CC3200_VERSION_H
#define WIPY_SW_VERSION_NUMBER "1.2.0"
-#endif /* VERSION_H_ */
+#endif // MICROPY_INCLUDED_CC3200_VERSION_H
diff --git a/drivers/dht/dht.h b/drivers/dht/dht.h
index 20954036d..883e07796 100644
--- a/drivers/dht/dht.h
+++ b/drivers/dht/dht.h
@@ -1,3 +1,8 @@
+#ifndef MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
+#define MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
+
#include "py/obj.h"
MP_DECLARE_CONST_FUN_OBJ_2(dht_readinto_obj);
+
+#endif // MICROPY_INCLUDED_DRIVERS_DHT_DHT_H
diff --git a/drivers/memory/spiflash.h b/drivers/memory/spiflash.h
index d2e817450..967352b04 100644
--- a/drivers/memory/spiflash.h
+++ b/drivers/memory/spiflash.h
@@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
#ifndef MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H
#define MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h
index d783f1f09..1d1d6de3f 100644
--- a/esp8266/esp_mphal.h
+++ b/esp8266/esp_mphal.h
@@ -24,9 +24,6 @@
* THE SOFTWARE.
*/
-#ifndef _INCLUDED_MPHAL_H_
-#define _INCLUDED_MPHAL_H_
-
#include "py/ringbuf.h"
#include "lib/utils/interrupt_char.h"
#include "xtirq.h"
@@ -96,5 +93,3 @@ void mp_hal_pin_open_drain(mp_hal_pin_obj_t pin);
void *ets_get_esf_buf_ctlblk(void);
int ets_esf_free_bufs(int idx);
-
-#endif // _INCLUDED_MPHAL_H_
diff --git a/esp8266/espapa102.h b/esp8266/espapa102.h
index 82c92025d..dd7c5ab72 100644
--- a/esp8266/espapa102.h
+++ b/esp8266/espapa102.h
@@ -23,5 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_ESP8266_ESPAPA102_H
+#define MICROPY_INCLUDED_ESP8266_ESPAPA102_H
void esp_apa102_write(uint8_t clockPin, uint8_t dataPin, uint8_t *pixels, uint32_t numBytes);
+
+#endif // MICROPY_INCLUDED_ESP8266_ESPAPA102_H
diff --git a/esp8266/espneopixel.h b/esp8266/espneopixel.h
index 4b20afda5..c444740ff 100644
--- a/esp8266/espneopixel.h
+++ b/esp8266/espneopixel.h
@@ -1 +1,6 @@
+#ifndef MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
+#define MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
+
void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, bool is800KHz);
+
+#endif // MICROPY_INCLUDED_ESP8266_ESPNEOPIXEL_H
diff --git a/esp8266/esppwm.h b/esp8266/esppwm.h
index 242a9a2a6..1ee4a2f55 100644
--- a/esp8266/esppwm.h
+++ b/esp8266/esppwm.h
@@ -1,5 +1,5 @@
-#ifndef __ESPPWM_H__
-#define __ESPPWM_H__
+#ifndef MICROPY_INCLUDED_ESP8266_ESPPWM_H
+#define MICROPY_INCLUDED_ESP8266_ESPPWM_H
#include
#include
@@ -14,4 +14,4 @@ uint16_t pwm_get_freq(uint8_t channel);
int pwm_add(uint8_t pin_id, uint32_t pin_mux, uint32_t pin_func);
bool pwm_delete(uint8_t channel);
-#endif
+#endif // MICROPY_INCLUDED_ESP8266_ESPPWM_H
diff --git a/esp8266/ets_alt_task.h b/esp8266/ets_alt_task.h
index dba0c5fa6..33a9d3a00 100644
--- a/esp8266/ets_alt_task.h
+++ b/esp8266/ets_alt_task.h
@@ -1,4 +1,9 @@
+#ifndef MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
+#define MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
+
extern int ets_loop_iter_disable;
extern uint32_t system_time_high_word;
bool ets_loop_iter(void);
+
+#endif // MICROPY_INCLUDED_ESP8266_ETS_ALT_TASK_H
diff --git a/esp8266/etshal.h b/esp8266/etshal.h
index 90af63ba2..34787779f 100644
--- a/esp8266/etshal.h
+++ b/esp8266/etshal.h
@@ -1,5 +1,5 @@
-#ifndef _INCLUDED_ETSHAL_H_
-#define _INCLUDED_ETSHAL_H_
+#ifndef MICROPY_INCLUDED_ESP8266_ETSHAL_H
+#define MICROPY_INCLUDED_ESP8266_ETSHAL_H
#include
@@ -42,4 +42,4 @@ uint32_t SPIRead(uint32_t offset, void *buf, uint32_t len);
uint32_t SPIWrite(uint32_t offset, const void *buf, uint32_t len);
uint32_t SPIEraseSector(int sector);
-#endif // _INCLUDED_ETSHAL_H_
+#endif // MICROPY_INCLUDED_ESP8266_ETSHAL_H
diff --git a/esp8266/gccollect.h b/esp8266/gccollect.h
index d81cba12c..0aee42771 100644
--- a/esp8266/gccollect.h
+++ b/esp8266/gccollect.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
+#define MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
extern uint32_t _text_start;
extern uint32_t _text_end;
@@ -39,3 +41,5 @@ extern uint32_t _heap_end;
void gc_collect(void);
void esp_native_code_gc_collect(void);
+
+#endif // MICROPY_INCLUDED_ESP8266_GCCOLLECT_H
diff --git a/esp8266/modmachine.h b/esp8266/modmachine.h
index 414aaa85b..eae351f68 100644
--- a/esp8266/modmachine.h
+++ b/esp8266/modmachine.h
@@ -1,5 +1,5 @@
-#ifndef __MICROPY_INCLUDED_ESP8266_MODPYB_H__
-#define __MICROPY_INCLUDED_ESP8266_MODPYB_H__
+#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
+#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
#include "py/obj.h"
@@ -38,4 +38,4 @@ void pyb_rtc_set_us_since_2000(uint64_t nowus);
uint64_t pyb_rtc_get_us_since_2000();
void rtc_prepare_deepsleep(uint64_t sleep_us);
-#endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__
+#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H
diff --git a/esp8266/uart.h b/esp8266/uart.h
index f6850c42d..ebcd8b051 100644
--- a/esp8266/uart.h
+++ b/esp8266/uart.h
@@ -1,5 +1,5 @@
-#ifndef _INCLUDED_UART_H_
-#define _INCLUDED_UART_H_
+#ifndef MICROPY_INCLUDED_ESP8266_UART_H
+#define MICROPY_INCLUDED_ESP8266_UART_H
#include
@@ -103,4 +103,4 @@ void uart_setup(uint8 uart);
int uart_rx_any(uint8 uart);
int uart_tx_any_room(uint8 uart);
-#endif // _INCLUDED_UART_H_
+#endif // MICROPY_INCLUDED_ESP8266_UART_H
diff --git a/esp8266/xtirq.h b/esp8266/xtirq.h
index 856ff075a..595052fc7 100644
--- a/esp8266/xtirq.h
+++ b/esp8266/xtirq.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
-#define __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
+#ifndef MICROPY_INCLUDED_ESP8266_XTIRQ_H
+#define MICROPY_INCLUDED_ESP8266_XTIRQ_H
#include
@@ -57,4 +56,4 @@ static inline void enable_irq(uint32_t irq_state) {
restore_irq_pri(irq_state);
}
-#endif // __MICROPY_INCLUDED_ESP8266_XTIRQ_H__
+#endif // MICROPY_INCLUDED_ESP8266_XTIRQ_H
diff --git a/extmod/lwip-include/arch/cc.h b/extmod/lwip-include/arch/cc.h
index 0a7907d34..400dc6ec7 100644
--- a/extmod/lwip-include/arch/cc.h
+++ b/extmod/lwip-include/arch/cc.h
@@ -1,5 +1,5 @@
-#ifndef __CC_H__
-#define __CC_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
#include
@@ -38,4 +38,4 @@ typedef u32_t mem_ptr_t;
#define PACK_STRUCT_BEGIN
#define PACK_STRUCT_END
-#endif /* __ARCH_CC_H__ */
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_CC_H
diff --git a/extmod/lwip-include/arch/perf.h b/extmod/lwip-include/arch/perf.h
index 51710701a..d310fc339 100644
--- a/extmod/lwip-include/arch/perf.h
+++ b/extmod/lwip-include/arch/perf.h
@@ -1,7 +1,7 @@
-#ifndef __PERF_H__
-#define __PERF_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
#define PERF_START /* null definition */
#define PERF_STOP(x) /* null definition */
-#endif /* __PERF_H__ */
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_ARCH_PERF_H
diff --git a/extmod/lwip-include/lwipopts.h b/extmod/lwip-include/lwipopts.h
index e4a33b238..2122f30f0 100644
--- a/extmod/lwip-include/lwipopts.h
+++ b/extmod/lwip-include/lwipopts.h
@@ -1,5 +1,5 @@
-#ifndef __LWIPOPTS_H__
-#define __LWIPOPTS_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
+#define MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
#include
#include
@@ -32,5 +32,4 @@ typedef uint32_t sys_prot_t;
// things like this into a port-provided header file.
#define sys_now mp_hal_ticks_ms
-#endif
-
+#endif // MICROPY_INCLUDED_EXTMOD_LWIP_INCLUDE_LWIPOPTS_H
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h
index d49ff01e4..f5af6656f 100644
--- a/extmod/machine_i2c.h
+++ b/extmod/machine_i2c.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
#include "py/obj.h"
@@ -54,4 +53,4 @@ extern const mp_obj_dict_t mp_machine_soft_i2c_locals_dict;
int mp_machine_soft_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t *dest, size_t len, bool stop);
int mp_machine_soft_i2c_writeto(mp_obj_base_t *self_in, uint16_t addr, const uint8_t *src, size_t len, bool stop);
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H
diff --git a/extmod/machine_mem.h b/extmod/machine_mem.h
index fddd7d46c..4bc9ac127 100644
--- a/extmod/machine_mem.h
+++ b/extmod/machine_mem.h
@@ -23,10 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
#include "py/obj.h"
@@ -48,4 +46,4 @@ uintptr_t MICROPY_MACHINE_MEM_GET_READ_ADDR(mp_obj_t addr_o, uint align);
uintptr_t MICROPY_MACHINE_MEM_GET_WRITE_ADDR(mp_obj_t addr_o, uint align);
#endif
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_MEM_H
diff --git a/extmod/machine_pinbase.h b/extmod/machine_pinbase.h
index ece3384cc..c96abbc46 100644
--- a/extmod/machine_pinbase.h
+++ b/extmod/machine_pinbase.h
@@ -23,13 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
#include "py/obj.h"
extern const mp_obj_type_t machine_pinbase_type;
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H
diff --git a/extmod/machine_pulse.h b/extmod/machine_pulse.h
index cc1c4eda5..e303dca02 100644
--- a/extmod/machine_pulse.h
+++ b/extmod/machine_pulse.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
#include "py/obj.h"
#include "py/mphal.h"
@@ -34,4 +33,4 @@ mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_time_pulse_us_obj);
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H
diff --git a/extmod/machine_signal.h b/extmod/machine_signal.h
index 7f88cbaa8..df1c3e2e9 100644
--- a/extmod/machine_signal.h
+++ b/extmod/machine_signal.h
@@ -23,13 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-
-#ifndef __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
-#define __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
+#define MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
#include "py/obj.h"
extern const mp_obj_type_t machine_signal_type;
-#endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H__
+#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H
diff --git a/extmod/machine_spi.h b/extmod/machine_spi.h
index 88a3e19f4..e24e41eb3 100644
--- a/extmod/machine_spi.h
+++ b/extmod/machine_spi.h
@@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SPI_H
#define MICROPY_INCLUDED_EXTMOD_MACHINE_SPI_H
diff --git a/extmod/misc.h b/extmod/misc.h
index d7ead0654..6c13592c7 100644
--- a/extmod/misc.h
+++ b/extmod/misc.h
@@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_EXTMOD_MISC_H
+#define MICROPY_INCLUDED_EXTMOD_MISC_H
// This file contains cumulative declarations for extmod/ .
@@ -38,3 +40,5 @@ void mp_uos_deactivate(const char *msg, mp_obj_t exc);
#else
#define mp_uos_dupterm_tx_strn(s, l)
#endif
+
+#endif // MICROPY_INCLUDED_EXTMOD_MISC_H
diff --git a/extmod/modubinascii.h b/extmod/modubinascii.h
index 33d0f1cbd..6c0156fc4 100644
--- a/extmod/modubinascii.h
+++ b/extmod/modubinascii.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef MICROPY_EXTMOD_MODUBINASCII
-#define MICROPY_EXTMOD_MODUBINASCII
+#ifndef MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
+#define MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
extern mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args);
extern mp_obj_t mod_binascii_unhexlify(mp_obj_t data);
@@ -39,4 +38,4 @@ MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_binascii_crc32_obj);
-#endif /* MICROPY_EXTMOD_MODUBINASCII */
+#endif // MICROPY_INCLUDED_EXTMOD_MODUBINASCII_H
diff --git a/extmod/modwebsocket.h b/extmod/modwebsocket.h
index 7da147561..2720147df 100644
--- a/extmod/modwebsocket.h
+++ b/extmod/modwebsocket.h
@@ -1,5 +1,10 @@
+#ifndef MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
+#define MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
+
#define FRAME_OPCODE_MASK 0x0f
enum {
FRAME_CONT, FRAME_TXT, FRAME_BIN,
FRAME_CLOSE = 0x8, FRAME_PING, FRAME_PONG
};
+
+#endif // MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
diff --git a/extmod/utime_mphal.h b/extmod/utime_mphal.h
index 644387b67..88a9ed4d3 100644
--- a/extmod/utime_mphal.h
+++ b/extmod/utime_mphal.h
@@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
+#define MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
#include "py/obj.h"
@@ -35,3 +37,5 @@ MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_us_obj);
MP_DECLARE_CONST_FUN_OBJ_0(mp_utime_ticks_cpu_obj);
MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_diff_obj);
MP_DECLARE_CONST_FUN_OBJ_2(mp_utime_ticks_add_obj);
+
+#endif // MICROPY_INCLUDED_EXTMOD_UTIME_MPHAL_H
diff --git a/extmod/vfs.h b/extmod/vfs.h
index edaeb5349..f2efdbe79 100644
--- a/extmod/vfs.h
+++ b/extmod/vfs.h
@@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
#ifndef MICROPY_INCLUDED_EXTMOD_VFS_H
#define MICROPY_INCLUDED_EXTMOD_VFS_H
diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h
index 6c7c05a9a..63c4abb82 100644
--- a/extmod/vfs_fat.h
+++ b/extmod/vfs_fat.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
+#define MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
#include "py/lexer.h"
#include "py/obj.h"
@@ -58,3 +60,5 @@ mp_obj_t fatfs_builtin_open_self(mp_obj_t self_in, mp_obj_t path, mp_obj_t mode)
MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj);
mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type);
+
+#endif // MICROPY_INCLUDED_EXTMOD_VFS_FAT_H
diff --git a/extmod/virtpin.h b/extmod/virtpin.h
index 041010350..706affc19 100644
--- a/extmod/virtpin.h
+++ b/extmod/virtpin.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
+#define MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
#include "py/obj.h"
@@ -41,3 +43,5 @@ void mp_virtual_pin_write(mp_obj_t pin, int value);
// If a port exposes a Pin object, it's constructor should be like this
mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args);
+
+#endif // MICROPY_INCLUDED_EXTMOD_VIRTPIN_H
diff --git a/lib/mp-readline/readline.h b/lib/mp-readline/readline.h
index f73934d23..f53fdeaa8 100644
--- a/lib/mp-readline/readline.h
+++ b/lib/mp-readline/readline.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
+#define MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
#define CHAR_CTRL_A (1)
#define CHAR_CTRL_B (2)
@@ -42,3 +44,5 @@ void readline_push_history(const char *line);
void readline_init(vstr_t *line, const char *prompt);
void readline_note_newline(const char *prompt);
int readline_process_char(int c);
+
+#endif // MICROPY_INCLUDED_LIB_MP_READLINE_READLINE_H
diff --git a/lib/netutils/netutils.h b/lib/netutils/netutils.h
index 45e021640..1e147afa9 100644
--- a/lib/netutils/netutils.h
+++ b/lib/netutils/netutils.h
@@ -24,8 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_LIB_NETUTILS_H__
-#define __MICROPY_INCLUDED_LIB_NETUTILS_H__
+#ifndef MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
+#define MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
#define NETUTILS_IPV4ADDR_BUFSIZE 4
@@ -47,4 +47,4 @@ void netutils_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian
// puts IP in out_ip (which must take at least IPADDR_BUF_SIZE bytes).
mp_uint_t netutils_parse_inet_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian_t endian);
-#endif // __MICROPY_INCLUDED_LIB_NETUTILS_H__
+#endif // MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H
diff --git a/lib/timeutils/timeutils.h b/lib/timeutils/timeutils.h
index c3f1fc2db..1dc486e2e 100644
--- a/lib/timeutils/timeutils.h
+++ b/lib/timeutils/timeutils.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
-#define __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
+#ifndef MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
+#define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
typedef struct _timeutils_struct_time_t {
uint16_t tm_year; // i.e. 2014
@@ -52,4 +51,4 @@ mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
mp_int_t hours, mp_int_t minutes, mp_int_t seconds);
-#endif // __MICROPY_INCLUDED_LIB_TIMEUTILS_H__
+#endif // MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
diff --git a/lib/utils/interrupt_char.h b/lib/utils/interrupt_char.h
index ae0bf57e8..ca50d4d56 100644
--- a/lib/utils/interrupt_char.h
+++ b/lib/utils/interrupt_char.h
@@ -23,7 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
+#define MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
extern int mp_interrupt_char;
void mp_hal_set_interrupt_char(int c);
void mp_keyboard_interrupt(void);
+
+#endif // MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h
index 0c7567e27..69cdb4762 100644
--- a/lib/utils/pyexec.h
+++ b/lib/utils/pyexec.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
-#define __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
+#ifndef MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
+#define MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
typedef enum {
PYEXEC_MODE_RAW_REPL,
@@ -51,4 +51,4 @@ extern uint8_t pyexec_repl_active;
MP_DECLARE_CONST_FUN_OBJ_1(pyb_set_repl_info_obj);
-#endif // __MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H__
+#endif // MICROPY_INCLUDED_LIB_UTILS_PYEXEC_H
diff --git a/pic16bit/board.h b/pic16bit/board.h
index 0eb022436..f79dd3497 100644
--- a/pic16bit/board.h
+++ b/pic16bit/board.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
-#define __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
+#ifndef MICROPY_INCLUDED_PIC16BIT_BOARD_H
+#define MICROPY_INCLUDED_PIC16BIT_BOARD_H
void cpu_init(void);
@@ -40,4 +40,4 @@ int uart_rx_any(void);
int uart_rx_char(void);
void uart_tx_char(int chr);
-#endif // __MICROPY_INCLUDED_PIC16BIT_BOARD_H__
+#endif // MICROPY_INCLUDED_PIC16BIT_BOARD_H
diff --git a/pic16bit/modpyb.h b/pic16bit/modpyb.h
index 6c68cbdfd..910ec1b6e 100644
--- a/pic16bit/modpyb.h
+++ b/pic16bit/modpyb.h
@@ -23,11 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
-#define __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
+#ifndef MICROPY_INCLUDED_PIC16BIT_MODPYB_H
+#define MICROPY_INCLUDED_PIC16BIT_MODPYB_H
extern const mp_obj_type_t pyb_led_type;
extern const mp_obj_type_t pyb_switch_type;
extern const mp_obj_module_t pyb_module;
-#endif // __MICROPY_INCLUDED_PIC16BIT_MODPYB_H__
+#endif // MICROPY_INCLUDED_PIC16BIT_MODPYB_H
diff --git a/pic16bit/pic16bit_mphal.h b/pic16bit/pic16bit_mphal.h
index a858f7e0f..ffcca41bf 100644
--- a/pic16bit/pic16bit_mphal.h
+++ b/pic16bit/pic16bit_mphal.h
@@ -23,13 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
-#define __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
#include "py/mpstate.h"
void mp_hal_init(void);
void mp_hal_set_interrupt_char(int c);
-
-#endif // __MICROPY_INCLUDED_PIC16BIT_PIC16BIT_MPHAL_H__
diff --git a/pic16bit/unistd.h b/pic16bit/unistd.h
index cdd9fe061..5b60c8a62 100644
--- a/pic16bit/unistd.h
+++ b/pic16bit/unistd.h
@@ -1,5 +1,10 @@
+#ifndef MICROPY_INCLUDED_PIC16BIT_UNISTD_H
+#define MICROPY_INCLUDED_PIC16BIT_UNISTD_H
+
// XC16 compiler doesn't seem to have unistd.h file
#define SEEK_CUR 1
typedef int ssize_t;
+
+#endif // MICROPY_INCLUDED_PIC16BIT_UNISTD_H
diff --git a/py/asmarm.h b/py/asmarm.h
index e273b98d7..c5900925f 100644
--- a/py/asmarm.h
+++ b/py/asmarm.h
@@ -24,8 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_ASMARM_H__
-#define __MICROPY_INCLUDED_PY_ASMARM_H__
+#ifndef MICROPY_INCLUDED_PY_ASMARM_H
+#define MICROPY_INCLUDED_PY_ASMARM_H
#include "py/misc.h"
#include "py/asmbase.h"
@@ -202,4 +202,4 @@ void asm_arm_bl_ind(asm_arm_t *as, void *fun_ptr, uint fun_id, uint reg_temp);
#endif // GENERIC_ASM_API
-#endif // __MICROPY_INCLUDED_PY_ASMARM_H__
+#endif // MICROPY_INCLUDED_PY_ASMARM_H
diff --git a/py/asmthumb.h b/py/asmthumb.h
index 52e663b3b..589c481cd 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_ASMTHUMB_H__
-#define __MICROPY_INCLUDED_PY_ASMTHUMB_H__
+#ifndef MICROPY_INCLUDED_PY_ASMTHUMB_H
+#define MICROPY_INCLUDED_PY_ASMTHUMB_H
#include "py/misc.h"
#include "py/asmbase.h"
@@ -318,4 +318,4 @@ void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp
#endif // GENERIC_ASM_API
-#endif // __MICROPY_INCLUDED_PY_ASMTHUMB_H__
+#endif // MICROPY_INCLUDED_PY_ASMTHUMB_H
diff --git a/py/asmx64.h b/py/asmx64.h
index 4499c53c3..a384cca00 100644
--- a/py/asmx64.h
+++ b/py/asmx64.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_ASMX64_H__
-#define __MICROPY_INCLUDED_PY_ASMX64_H__
+#ifndef MICROPY_INCLUDED_PY_ASMX64_H
+#define MICROPY_INCLUDED_PY_ASMX64_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -197,4 +197,4 @@ void asm_x64_call_ind(asm_x64_t* as, void* ptr, int temp_r32);
#endif // GENERIC_ASM_API
-#endif // __MICROPY_INCLUDED_PY_ASMX64_H__
+#endif // MICROPY_INCLUDED_PY_ASMX64_H
diff --git a/py/asmx86.h b/py/asmx86.h
index 0b44af663..fd34228d1 100644
--- a/py/asmx86.h
+++ b/py/asmx86.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_ASMX86_H__
-#define __MICROPY_INCLUDED_PY_ASMX86_H__
+#ifndef MICROPY_INCLUDED_PY_ASMX86_H
+#define MICROPY_INCLUDED_PY_ASMX86_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -195,4 +195,4 @@ void asm_x86_call_ind(asm_x86_t* as, void* ptr, mp_uint_t n_args, int temp_r32);
#endif // GENERIC_ASM_API
-#endif // __MICROPY_INCLUDED_PY_ASMX86_H__
+#endif // MICROPY_INCLUDED_PY_ASMX86_H
diff --git a/py/bc.h b/py/bc.h
index 88045dc55..c55d31fe4 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_BC_H__
-#define __MICROPY_INCLUDED_PY_BC_H__
+#ifndef MICROPY_INCLUDED_PY_BC_H
+#define MICROPY_INCLUDED_PY_BC_H
#include "py/runtime.h"
#include "py/obj.h"
@@ -119,4 +119,4 @@ uint mp_opcode_format(const byte *ip, size_t *opcode_size);
#endif
-#endif // __MICROPY_INCLUDED_PY_BC_H__
+#endif // MICROPY_INCLUDED_PY_BC_H
diff --git a/py/bc0.h b/py/bc0.h
index b5650abe4..be8ac6c15 100644
--- a/py/bc0.h
+++ b/py/bc0.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_BC0_H__
-#define __MICROPY_INCLUDED_PY_BC0_H__
+#ifndef MICROPY_INCLUDED_PY_BC0_H
+#define MICROPY_INCLUDED_PY_BC0_H
// Micro Python byte-codes.
// The comment at the end of the line (if it exists) tells the arguments to the byte-code.
@@ -116,4 +116,4 @@
#define MP_BC_UNARY_OP_MULTI (0xd0) // + op(7)
#define MP_BC_BINARY_OP_MULTI (0xd7) // + op(36)
-#endif // __MICROPY_INCLUDED_PY_BC0_H__
+#endif // MICROPY_INCLUDED_PY_BC0_H
diff --git a/py/binary.h b/py/binary.h
index 997d878c8..04cc6d83b 100644
--- a/py/binary.h
+++ b/py/binary.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_BINARY_H__
-#define __MICROPY_INCLUDED_PY_BINARY_H__
+#ifndef MICROPY_INCLUDED_PY_BINARY_H
+#define MICROPY_INCLUDED_PY_BINARY_H
#include "py/obj.h"
@@ -41,4 +41,4 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, const byte *src);
void mp_binary_set_int(mp_uint_t val_sz, bool big_endian, byte *dest, mp_uint_t val);
-#endif // __MICROPY_INCLUDED_PY_BINARY_H__
+#endif // MICROPY_INCLUDED_PY_BINARY_H
diff --git a/py/builtin.h b/py/builtin.h
index ec326d037..4915383f2 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_BUILTIN_H__
-#define __MICROPY_INCLUDED_PY_BUILTIN_H__
+#ifndef MICROPY_INCLUDED_PY_BUILTIN_H
+#define MICROPY_INCLUDED_PY_BUILTIN_H
#include "py/obj.h"
@@ -120,4 +120,4 @@ extern const mp_obj_module_t mp_module_btree;
extern const char *MICROPY_PY_BUILTINS_HELP_TEXT;
-#endif // __MICROPY_INCLUDED_PY_BUILTIN_H__
+#endif // MICROPY_INCLUDED_PY_BUILTIN_H
diff --git a/py/compile.h b/py/compile.h
index 45a98588d..f6b262d18 100644
--- a/py/compile.h
+++ b/py/compile.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_COMPILE_H__
-#define __MICROPY_INCLUDED_PY_COMPILE_H__
+#ifndef MICROPY_INCLUDED_PY_COMPILE_H
+#define MICROPY_INCLUDED_PY_COMPILE_H
#include "py/lexer.h"
#include "py/parse.h"
@@ -51,4 +51,4 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
// this is implemented in runtime.c
mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_input_kind, mp_obj_dict_t *globals, mp_obj_dict_t *locals);
-#endif // __MICROPY_INCLUDED_PY_COMPILE_H__
+#endif // MICROPY_INCLUDED_PY_COMPILE_H
diff --git a/py/emit.h b/py/emit.h
index 0236a9b8d..a58e20e3d 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_PY_EMIT_H__
-#define __MICROPY_INCLUDED_PY_EMIT_H__
+#ifndef MICROPY_INCLUDED_PY_EMIT_H
+#define MICROPY_INCLUDED_PY_EMIT_H
#include "py/lexer.h"
#include "py/scope.h"
@@ -284,4 +283,4 @@ void mp_emitter_warning(pass_kind_t pass, const char *msg);
#define mp_emitter_warning(pass, msg)
#endif
-#endif // __MICROPY_INCLUDED_PY_EMIT_H__
+#endif // MICROPY_INCLUDED_PY_EMIT_H
diff --git a/py/emitglue.h b/py/emitglue.h
index 37c4f1b18..309996596 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_EMITGLUE_H__
-#define __MICROPY_INCLUDED_PY_EMITGLUE_H__
+#ifndef MICROPY_INCLUDED_PY_EMITGLUE_H
+#define MICROPY_INCLUDED_PY_EMITGLUE_H
#include "py/obj.h"
@@ -74,4 +74,4 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void
mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args);
mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args);
-#endif // __MICROPY_INCLUDED_PY_EMITGLUE_H__
+#endif // MICROPY_INCLUDED_PY_EMITGLUE_H
diff --git a/py/formatfloat.h b/py/formatfloat.h
index 019603447..9c8d137bb 100644
--- a/py/formatfloat.h
+++ b/py/formatfloat.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
-#define __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
+#ifndef MICROPY_INCLUDED_PY_FORMATFLOAT_H
+#define MICROPY_INCLUDED_PY_FORMATFLOAT_H
#include "py/mpconfig.h"
@@ -32,4 +32,4 @@
int mp_format_float(mp_float_t f, char *buf, size_t bufSize, char fmt, int prec, char sign);
#endif
-#endif // __MICROPY_INCLUDED_PY_FORMATFLOAT_H__
+#endif // MICROPY_INCLUDED_PY_FORMATFLOAT_H
diff --git a/py/frozenmod.h b/py/frozenmod.h
index 7c1299b2c..6993167ac 100644
--- a/py/frozenmod.h
+++ b/py/frozenmod.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_FROZENMOD_H__
-#define __MICROPY_INCLUDED_PY_FROZENMOD_H__
+#ifndef MICROPY_INCLUDED_PY_FROZENMOD_H
+#define MICROPY_INCLUDED_PY_FROZENMOD_H
#include "py/lexer.h"
@@ -38,4 +38,4 @@ int mp_find_frozen_module(const char *str, size_t len, void **data);
const char *mp_find_frozen_str(const char *str, size_t *len);
mp_import_stat_t mp_frozen_stat(const char *str);
-#endif // __MICROPY_INCLUDED_PY_FROZENMOD_H__
+#endif // MICROPY_INCLUDED_PY_FROZENMOD_H
diff --git a/py/gc.h b/py/gc.h
index 7d8fe2bf8..136695517 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_GC_H__
-#define __MICROPY_INCLUDED_PY_GC_H__
+#ifndef MICROPY_INCLUDED_PY_GC_H
+#define MICROPY_INCLUDED_PY_GC_H
#include
@@ -64,4 +64,4 @@ void gc_info(gc_info_t *info);
void gc_dump_info(void);
void gc_dump_alloc_table(void);
-#endif // __MICROPY_INCLUDED_PY_GC_H__
+#endif // MICROPY_INCLUDED_PY_GC_H
diff --git a/py/lexer.h b/py/lexer.h
index 5d998b352..435aa096b 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_LEXER_H__
-#define __MICROPY_INCLUDED_PY_LEXER_H__
+#ifndef MICROPY_INCLUDED_PY_LEXER_H
+#define MICROPY_INCLUDED_PY_LEXER_H
#include
@@ -192,4 +192,4 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename);
mp_lexer_t *mp_lexer_new_from_fd(qstr filename, int fd, bool close_fd);
#endif
-#endif // __MICROPY_INCLUDED_PY_LEXER_H__
+#endif // MICROPY_INCLUDED_PY_LEXER_H
diff --git a/py/misc.h b/py/misc.h
index 5ac0f933a..cebbd38ea 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MISC_H__
-#define __MICROPY_INCLUDED_PY_MISC_H__
+#ifndef MICROPY_INCLUDED_PY_MISC_H
+#define MICROPY_INCLUDED_PY_MISC_H
// a mini library of useful types and functions
@@ -223,4 +223,4 @@ static inline mp_uint_t count_lead_ones(byte val) {
#define MP_FLOAT_EXP_BIAS ((1 << (MP_FLOAT_EXP_BITS - 1)) - 1)
#endif // MICROPY_PY_BUILTINS_FLOAT
-#endif // __MICROPY_INCLUDED_PY_MISC_H__
+#endif // MICROPY_INCLUDED_PY_MISC_H
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 32d64828d..fb507a503 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPCONFIG_H__
-#define __MICROPY_INCLUDED_PY_MPCONFIG_H__
+#ifndef MICROPY_INCLUDED_PY_MPCONFIG_H
+#define MICROPY_INCLUDED_PY_MPCONFIG_H
// This file contains default configuration settings for MicroPython.
// You can override any of the options below using mpconfigport.h file
@@ -1253,4 +1253,4 @@ typedef double mp_float_t;
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
#endif
-#endif // __MICROPY_INCLUDED_PY_MPCONFIG_H__
+#endif // MICROPY_INCLUDED_PY_MPCONFIG_H
diff --git a/py/mperrno.h b/py/mperrno.h
index 6ea99ae22..c515ed488 100644
--- a/py/mperrno.h
+++ b/py/mperrno.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_PY_MPERRNO_H__
-#define __MICROPY_INCLUDED_PY_MPERRNO_H__
+#ifndef MICROPY_INCLUDED_PY_MPERRNO_H
+#define MICROPY_INCLUDED_PY_MPERRNO_H
#if MICROPY_USE_INTERNAL_ERRNO
@@ -142,4 +141,4 @@
qstr mp_errno_to_str(mp_obj_t errno_val);
#endif
-#endif // __MICROPY_INCLUDED_PY_MPERRNO_H__
+#endif // MICROPY_INCLUDED_PY_MPERRNO_H
diff --git a/py/mphal.h b/py/mphal.h
index 8d5654f9e..93a0a40ce 100644
--- a/py/mphal.h
+++ b/py/mphal.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPHAL_H__
-#define __MICROPY_INCLUDED_PY_MPHAL_H__
+#ifndef MICROPY_INCLUDED_PY_MPHAL_H
+#define MICROPY_INCLUDED_PY_MPHAL_H
#include "py/mpconfig.h"
@@ -80,4 +80,4 @@ mp_uint_t mp_hal_ticks_cpu(void);
#include "extmod/virtpin.h"
#endif
-#endif // __MICROPY_INCLUDED_PY_MPHAL_H__
+#endif // MICROPY_INCLUDED_PY_MPHAL_H
diff --git a/py/mpprint.h b/py/mpprint.h
index 4fc904a20..20bd875b4 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPPRINT_H__
-#define __MICROPY_INCLUDED_PY_MPPRINT_H__
+#ifndef MICROPY_INCLUDED_PY_MPPRINT_H
+#define MICROPY_INCLUDED_PY_MPPRINT_H
#include "py/mpconfig.h"
@@ -71,4 +71,4 @@ int mp_printf(const mp_print_t *print, const char *fmt, ...);
int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
#endif
-#endif // __MICROPY_INCLUDED_PY_MPPRINT_H__
+#endif // MICROPY_INCLUDED_PY_MPPRINT_H
diff --git a/py/mpstate.h b/py/mpstate.h
index 2b8f29a6a..b09ba08cf 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPSTATE_H__
-#define __MICROPY_INCLUDED_PY_MPSTATE_H__
+#ifndef MICROPY_INCLUDED_PY_MPSTATE_H
+#define MICROPY_INCLUDED_PY_MPSTATE_H
#include
@@ -248,4 +248,4 @@ extern mp_state_thread_t *mp_thread_get_state(void);
#define MP_STATE_THREAD(x) (mp_state_ctx.thread.x)
#endif
-#endif // __MICROPY_INCLUDED_PY_MPSTATE_H__
+#endif // MICROPY_INCLUDED_PY_MPSTATE_H
diff --git a/py/mpthread.h b/py/mpthread.h
index 04d4f1968..602df830c 100644
--- a/py/mpthread.h
+++ b/py/mpthread.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPTHREAD_H__
-#define __MICROPY_INCLUDED_PY_MPTHREAD_H__
+#ifndef MICROPY_INCLUDED_PY_MPTHREAD_H
+#define MICROPY_INCLUDED_PY_MPTHREAD_H
#include "py/mpconfig.h"
@@ -58,4 +58,4 @@ void mp_thread_mutex_unlock(mp_thread_mutex_t *mutex);
#define MP_THREAD_GIL_EXIT()
#endif
-#endif // __MICROPY_INCLUDED_PY_MPTHREAD_H__
+#endif // MICROPY_INCLUDED_PY_MPTHREAD_H
diff --git a/py/mpz.h b/py/mpz.h
index 5c8822722..878febf8b 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_MPZ_H__
-#define __MICROPY_INCLUDED_PY_MPZ_H__
+#ifndef MICROPY_INCLUDED_PY_MPZ_H
+#define MICROPY_INCLUDED_PY_MPZ_H
#include
@@ -139,4 +139,4 @@ mp_float_t mpz_as_float(const mpz_t *z);
#endif
size_t mpz_as_str_inpl(const mpz_t *z, unsigned int base, const char *prefix, char base_char, char comma, char *str);
-#endif // __MICROPY_INCLUDED_PY_MPZ_H__
+#endif // MICROPY_INCLUDED_PY_MPZ_H
diff --git a/py/nlr.h b/py/nlr.h
index 7a71ef34b..624e97307 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_NLR_H__
-#define __MICROPY_INCLUDED_PY_NLR_H__
+#ifndef MICROPY_INCLUDED_PY_NLR_H
+#define MICROPY_INCLUDED_PY_NLR_H
// non-local return
// exception handling, basically a stack of setjmp/longjmp buffers
@@ -112,4 +112,4 @@ NORETURN void nlr_jump_fail(void *val);
#endif
-#endif // __MICROPY_INCLUDED_PY_NLR_H__
+#endif // MICROPY_INCLUDED_PY_NLR_H
diff --git a/py/obj.h b/py/obj.h
index a3c06a261..f88c10004 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJ_H__
-#define __MICROPY_INCLUDED_PY_OBJ_H__
+#ifndef MICROPY_INCLUDED_PY_OBJ_H
+#define MICROPY_INCLUDED_PY_OBJ_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -864,4 +864,4 @@ mp_obj_t mp_seq_extract_slice(size_t len, const mp_obj_t *seq, mp_bound_slice_t
memmove(((char*)dest) + (beg + slice_len) * (item_sz), ((char*)dest) + (end) * (item_sz), ((dest_len) + (len_adj) - ((beg) + (slice_len))) * (item_sz)); \
memmove(((char*)dest) + (beg) * (item_sz), slice, slice_len * (item_sz));
-#endif // __MICROPY_INCLUDED_PY_OBJ_H__
+#endif // MICROPY_INCLUDED_PY_OBJ_H
diff --git a/py/objarray.h b/py/objarray.h
index 06a2a07ef..038966845 100644
--- a/py/objarray.h
+++ b/py/objarray.h
@@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_PY_OBJARRAY_H__
-#define __MICROPY_INCLUDED_PY_OBJARRAY_H__
+#ifndef MICROPY_INCLUDED_PY_OBJARRAY_H
+#define MICROPY_INCLUDED_PY_OBJARRAY_H
#include "py/obj.h"
@@ -40,4 +39,4 @@ typedef struct _mp_obj_array_t {
void *items;
} mp_obj_array_t;
-#endif // __MICROPY_INCLUDED_PY_OBJARRAY_H__
+#endif // MICROPY_INCLUDED_PY_OBJARRAY_H
diff --git a/py/objexcept.h b/py/objexcept.h
index 3128fded7..2232e1e21 100644
--- a/py/objexcept.h
+++ b/py/objexcept.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
-#define __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
+#ifndef MICROPY_INCLUDED_PY_OBJEXCEPT_H
+#define MICROPY_INCLUDED_PY_OBJEXCEPT_H
#include "py/obj.h"
#include "py/objtuple.h"
@@ -37,4 +37,4 @@ typedef struct _mp_obj_exception_t {
mp_obj_tuple_t *args;
} mp_obj_exception_t;
-#endif // __MICROPY_INCLUDED_PY_OBJEXCEPT_H__
+#endif // MICROPY_INCLUDED_PY_OBJEXCEPT_H
diff --git a/py/objfun.h b/py/objfun.h
index d02fada9b..450c98f76 100644
--- a/py/objfun.h
+++ b/py/objfun.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJFUN_H__
-#define __MICROPY_INCLUDED_PY_OBJFUN_H__
+#ifndef MICROPY_INCLUDED_PY_OBJFUN_H
+#define MICROPY_INCLUDED_PY_OBJFUN_H
#include "py/obj.h"
@@ -41,4 +41,4 @@ typedef struct _mp_obj_fun_bc_t {
mp_obj_t extra_args[];
} mp_obj_fun_bc_t;
-#endif // __MICROPY_INCLUDED_PY_OBJFUN_H__
+#endif // MICROPY_INCLUDED_PY_OBJFUN_H
diff --git a/py/objgenerator.h b/py/objgenerator.h
index d1b9be478..d61332a20 100644
--- a/py/objgenerator.h
+++ b/py/objgenerator.h
@@ -23,12 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
-#define __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
+#ifndef MICROPY_INCLUDED_PY_OBJGENERATOR_H
+#define MICROPY_INCLUDED_PY_OBJGENERATOR_H
#include "py/obj.h"
#include "py/runtime.h"
mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_val, mp_obj_t throw_val, mp_obj_t *ret_val);
-#endif // __MICROPY_INCLUDED_PY_OBJGENERATOR_H__
+#endif // MICROPY_INCLUDED_PY_OBJGENERATOR_H
diff --git a/py/objint.h b/py/objint.h
index da56c1862..f341306ed 100644
--- a/py/objint.h
+++ b/py/objint.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJINT_H__
-#define __MICROPY_INCLUDED_PY_OBJINT_H__
+#ifndef MICROPY_INCLUDED_PY_OBJINT_H
+#define MICROPY_INCLUDED_PY_OBJINT_H
#include "py/mpz.h"
#include "py/obj.h"
@@ -63,4 +63,4 @@ mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
mp_obj_t mp_obj_int_binary_op_extra_cases(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in);
mp_obj_t mp_obj_int_pow3(mp_obj_t base, mp_obj_t exponent, mp_obj_t modulus);
-#endif // __MICROPY_INCLUDED_PY_OBJINT_H__
+#endif // MICROPY_INCLUDED_PY_OBJINT_H
diff --git a/py/objlist.h b/py/objlist.h
index 5b2d216fc..740ba9fda 100644
--- a/py/objlist.h
+++ b/py/objlist.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJLIST_H__
-#define __MICROPY_INCLUDED_PY_OBJLIST_H__
+#ifndef MICROPY_INCLUDED_PY_OBJLIST_H
+#define MICROPY_INCLUDED_PY_OBJLIST_H
#include "py/obj.h"
@@ -35,4 +35,4 @@ typedef struct _mp_obj_list_t {
mp_obj_t *items;
} mp_obj_list_t;
-#endif // __MICROPY_INCLUDED_PY_OBJLIST_H__
+#endif // MICROPY_INCLUDED_PY_OBJLIST_H
diff --git a/py/objmodule.h b/py/objmodule.h
index 4e6612adc..5bfbe51d5 100644
--- a/py/objmodule.h
+++ b/py/objmodule.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJMODULE_H__
-#define __MICROPY_INCLUDED_PY_OBJMODULE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJMODULE_H
+#define MICROPY_INCLUDED_PY_OBJMODULE_H
#include "py/obj.h"
@@ -34,4 +34,4 @@ extern const mp_map_t mp_builtin_module_weak_links_map;
mp_obj_t mp_module_get(qstr module_name);
void mp_module_register(qstr qstr, mp_obj_t module);
-#endif // __MICROPY_INCLUDED_PY_OBJMODULE_H__
+#endif // MICROPY_INCLUDED_PY_OBJMODULE_H
diff --git a/py/objstr.h b/py/objstr.h
index e92832d10..6fbed405a 100644
--- a/py/objstr.h
+++ b/py/objstr.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJSTR_H__
-#define __MICROPY_INCLUDED_PY_OBJSTR_H__
+#ifndef MICROPY_INCLUDED_PY_OBJSTR_H
+#define MICROPY_INCLUDED_PY_OBJSTR_H
#include "py/obj.h"
@@ -102,4 +102,4 @@ MP_DECLARE_CONST_FUN_OBJ_1(str_isdigit_obj);
MP_DECLARE_CONST_FUN_OBJ_1(str_isupper_obj);
MP_DECLARE_CONST_FUN_OBJ_1(str_islower_obj);
-#endif // __MICROPY_INCLUDED_PY_OBJSTR_H__
+#endif // MICROPY_INCLUDED_PY_OBJSTR_H
diff --git a/py/objtuple.h b/py/objtuple.h
index 555c3b3c2..686702395 100644
--- a/py/objtuple.h
+++ b/py/objtuple.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJTUPLE_H__
-#define __MICROPY_INCLUDED_PY_OBJTUPLE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJTUPLE_H
+#define MICROPY_INCLUDED_PY_OBJTUPLE_H
#include "py/obj.h"
@@ -61,4 +61,4 @@ void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields,
mp_obj_t mp_obj_new_attrtuple(const qstr *fields, size_t n, const mp_obj_t *items);
-#endif // __MICROPY_INCLUDED_PY_OBJTUPLE_H__
+#endif // MICROPY_INCLUDED_PY_OBJTUPLE_H
diff --git a/py/objtype.h b/py/objtype.h
index 61efd00c0..104b20aab 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_OBJTYPE_H__
-#define __MICROPY_INCLUDED_PY_OBJTYPE_H__
+#ifndef MICROPY_INCLUDED_PY_OBJTYPE_H
+#define MICROPY_INCLUDED_PY_OBJTYPE_H
#include "py/obj.h"
@@ -49,4 +49,4 @@ mp_obj_t mp_obj_instance_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons
// this needs to be exposed for the above macros to work correctly
mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
-#endif // __MICROPY_INCLUDED_PY_OBJTYPE_H__
+#endif // MICROPY_INCLUDED_PY_OBJTYPE_H
diff --git a/py/parse.h b/py/parse.h
index 769f5a875..fec18825b 100644
--- a/py/parse.h
+++ b/py/parse.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_PARSE_H__
-#define __MICROPY_INCLUDED_PY_PARSE_H__
+#ifndef MICROPY_INCLUDED_PY_PARSE_H
+#define MICROPY_INCLUDED_PY_PARSE_H
#include
#include
@@ -104,4 +104,4 @@ typedef struct _mp_parse_t {
mp_parse_tree_t mp_parse(struct _mp_lexer_t *lex, mp_parse_input_kind_t input_kind);
void mp_parse_tree_clear(mp_parse_tree_t *tree);
-#endif // __MICROPY_INCLUDED_PY_PARSE_H__
+#endif // MICROPY_INCLUDED_PY_PARSE_H
diff --git a/py/parsenum.h b/py/parsenum.h
index f140cfc85..77fd0f4a5 100644
--- a/py/parsenum.h
+++ b/py/parsenum.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_PARSENUM_H__
-#define __MICROPY_INCLUDED_PY_PARSENUM_H__
+#ifndef MICROPY_INCLUDED_PY_PARSENUM_H
+#define MICROPY_INCLUDED_PY_PARSENUM_H
#include "py/mpconfig.h"
#include "py/lexer.h"
@@ -34,4 +34,4 @@
mp_obj_t mp_parse_num_integer(const char *restrict str, size_t len, int base, mp_lexer_t *lex);
mp_obj_t mp_parse_num_decimal(const char *str, size_t len, bool allow_imag, bool force_complex, mp_lexer_t *lex);
-#endif // __MICROPY_INCLUDED_PY_PARSENUM_H__
+#endif // MICROPY_INCLUDED_PY_PARSENUM_H
diff --git a/py/parsenumbase.h b/py/parsenumbase.h
index 9da9db841..143796df4 100644
--- a/py/parsenumbase.h
+++ b/py/parsenumbase.h
@@ -23,11 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
-#define __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
+#ifndef MICROPY_INCLUDED_PY_PARSENUMBASE_H
+#define MICROPY_INCLUDED_PY_PARSENUMBASE_H
#include "py/mpconfig.h"
size_t mp_parse_num_base(const char *str, size_t len, int *base);
-#endif // __MICROPY_INCLUDED_PY_PARSENUMBASE_H__
+#endif // MICROPY_INCLUDED_PY_PARSENUMBASE_H
diff --git a/py/qstr.h b/py/qstr.h
index 8c63fbbc8..4116eb81d 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_QSTR_H__
-#define __MICROPY_INCLUDED_PY_QSTR_H__
+#ifndef MICROPY_INCLUDED_PY_QSTR_H
+#define MICROPY_INCLUDED_PY_QSTR_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -76,4 +76,4 @@ const byte *qstr_data(qstr q, size_t *len);
void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes);
void qstr_dump_data(void);
-#endif // __MICROPY_INCLUDED_PY_QSTR_H__
+#endif // MICROPY_INCLUDED_PY_QSTR_H
diff --git a/py/repl.h b/py/repl.h
index 048b0de0f..c2499a270 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_REPL_H__
-#define __MICROPY_INCLUDED_PY_REPL_H__
+#ifndef MICROPY_INCLUDED_PY_REPL_H
+#define MICROPY_INCLUDED_PY_REPL_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -35,4 +35,4 @@ bool mp_repl_continue_with_input(const char *input);
size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str);
#endif
-#endif // __MICROPY_INCLUDED_PY_REPL_H__
+#endif // MICROPY_INCLUDED_PY_REPL_H
diff --git a/py/ringbuf.h b/py/ringbuf.h
index 5e108afad..b41692706 100644
--- a/py/ringbuf.h
+++ b/py/ringbuf.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_RINGBUF_H__
-#define __MICROPY_INCLUDED_PY_RINGBUF_H__
+#ifndef MICROPY_INCLUDED_PY_RINGBUF_H
+#define MICROPY_INCLUDED_PY_RINGBUF_H
typedef struct _ringbuf_t {
uint8_t *buf;
@@ -69,4 +69,4 @@ static inline int ringbuf_put(ringbuf_t *r, uint8_t v) {
return 0;
}
-#endif // __MICROPY_INCLUDED_PY_RINGBUF_H__
+#endif // MICROPY_INCLUDED_PY_RINGBUF_H
diff --git a/py/runtime.h b/py/runtime.h
index d75d23ff1..0add564cc 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_RUNTIME_H__
-#define __MICROPY_INCLUDED_PY_RUNTIME_H__
+#ifndef MICROPY_INCLUDED_PY_RUNTIME_H
+#define MICROPY_INCLUDED_PY_RUNTIME_H
#include "py/mpstate.h"
#include "py/obj.h"
@@ -178,4 +178,4 @@ void mp_warning(const char *msg, ...);
#define mp_warning(msg, ...)
#endif
-#endif // __MICROPY_INCLUDED_PY_RUNTIME_H__
+#endif // MICROPY_INCLUDED_PY_RUNTIME_H
diff --git a/py/runtime0.h b/py/runtime0.h
index 720fe6a23..060ee8c0a 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_RUNTIME0_H__
-#define __MICROPY_INCLUDED_PY_RUNTIME0_H__
+#ifndef MICROPY_INCLUDED_PY_RUNTIME0_H
+#define MICROPY_INCLUDED_PY_RUNTIME0_H
// These must fit in 8 bits; see scope.h
#define MP_SCOPE_FLAG_VARARGS (0x01)
@@ -151,4 +151,4 @@ typedef enum {
extern void *const mp_fun_table[MP_F_NUMBER_OF];
-#endif // __MICROPY_INCLUDED_PY_RUNTIME0_H__
+#endif // MICROPY_INCLUDED_PY_RUNTIME0_H
diff --git a/py/scope.h b/py/scope.h
index 826064d7e..4d0c1b1d9 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_SCOPE_H__
-#define __MICROPY_INCLUDED_PY_SCOPE_H__
+#ifndef MICROPY_INCLUDED_PY_SCOPE_H
+#define MICROPY_INCLUDED_PY_SCOPE_H
#include "py/parse.h"
#include "py/emitglue.h"
@@ -94,4 +94,4 @@ id_info_t *scope_find(scope_t *scope, qstr qstr);
id_info_t *scope_find_global(scope_t *scope, qstr qstr);
void scope_find_local_and_close_over(scope_t *scope, id_info_t *id, qstr qst);
-#endif // __MICROPY_INCLUDED_PY_SCOPE_H__
+#endif // MICROPY_INCLUDED_PY_SCOPE_H
diff --git a/py/smallint.h b/py/smallint.h
index b9686be30..b2bfc6df9 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_SMALLINT_H__
-#define __MICROPY_INCLUDED_PY_SMALLINT_H__
+#ifndef MICROPY_INCLUDED_PY_SMALLINT_H
+#define MICROPY_INCLUDED_PY_SMALLINT_H
#include "py/mpconfig.h"
#include "py/misc.h"
@@ -65,4 +65,4 @@ bool mp_small_int_mul_overflow(mp_int_t x, mp_int_t y);
mp_int_t mp_small_int_modulo(mp_int_t dividend, mp_int_t divisor);
mp_int_t mp_small_int_floor_divide(mp_int_t num, mp_int_t denom);
-#endif // __MICROPY_INCLUDED_PY_SMALLINT_H__
+#endif // MICROPY_INCLUDED_PY_SMALLINT_H
diff --git a/py/stackctrl.h b/py/stackctrl.h
index e915f5000..84c0e1427 100644
--- a/py/stackctrl.h
+++ b/py/stackctrl.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_STACKCTRL_H__
-#define __MICROPY_INCLUDED_PY_STACKCTRL_H__
+#ifndef MICROPY_INCLUDED_PY_STACKCTRL_H
+#define MICROPY_INCLUDED_PY_STACKCTRL_H
#include "py/mpconfig.h"
@@ -45,4 +45,4 @@ void mp_stack_check(void);
#endif
-#endif // __MICROPY_INCLUDED_PY_STACKCTRL_H__
+#endif // MICROPY_INCLUDED_PY_STACKCTRL_H
diff --git a/py/stream.h b/py/stream.h
index 01199ab60..0b5fd7cc0 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_STREAM_H__
-#define __MICROPY_INCLUDED_PY_STREAM_H__
+#ifndef MICROPY_INCLUDED_PY_STREAM_H
+#define MICROPY_INCLUDED_PY_STREAM_H
#include "py/obj.h"
#include "py/mperrno.h"
@@ -103,4 +103,4 @@ int mp_stream_posix_fsync(mp_obj_t stream);
#define mp_is_nonblocking_error(errno) (0)
#endif
-#endif // __MICROPY_INCLUDED_PY_STREAM_H__
+#endif // MICROPY_INCLUDED_PY_STREAM_H
diff --git a/py/unicode.h b/py/unicode.h
index 89c28ed0e..f99c9705d 100644
--- a/py/unicode.h
+++ b/py/unicode.h
@@ -23,12 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_PY_UNICODE_H__
-#define __MICROPY_INCLUDED_PY_UNICODE_H__
+#ifndef MICROPY_INCLUDED_PY_UNICODE_H
+#define MICROPY_INCLUDED_PY_UNICODE_H
#include "py/mpconfig.h"
#include "py/misc.h"
mp_uint_t utf8_ptr_to_index(const byte *s, const byte *ptr);
-#endif // __MICROPY_INCLUDED_PY_UNICODE_H__
+#endif // MICROPY_INCLUDED_PY_UNICODE_H
diff --git a/stmhal/accel.h b/stmhal/accel.h
index 10b095f79..42b156329 100644
--- a/stmhal/accel.h
+++ b/stmhal/accel.h
@@ -23,7 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_ACCEL_H
+#define MICROPY_INCLUDED_STMHAL_ACCEL_H
extern const mp_obj_type_t pyb_accel_type;
void accel_init(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_ACCEL_H
diff --git a/stmhal/adc.h b/stmhal/adc.h
index ebaccbee3..6ec558464 100644
--- a/stmhal/adc.h
+++ b/stmhal/adc.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_ADC_H
+#define MICROPY_INCLUDED_STMHAL_ADC_H
extern const mp_obj_type_t pyb_adc_type;
extern const mp_obj_type_t pyb_adc_all_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_ADC_H
diff --git a/stmhal/bufhelper.h b/stmhal/bufhelper.h
index abdeea6a8..55f57be8e 100644
--- a/stmhal/bufhelper.h
+++ b/stmhal/bufhelper.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_BUFHELPER_H
+#define MICROPY_INCLUDED_STMHAL_BUFHELPER_H
void pyb_buf_get_for_send(mp_obj_t o, mp_buffer_info_t *bufinfo, byte *tmp_data);
mp_obj_t pyb_buf_get_for_recv(mp_obj_t o, vstr_t *vstr);
+
+#endif // MICROPY_INCLUDED_STMHAL_BUFHELPER_H
diff --git a/stmhal/can.h b/stmhal/can.h
index 4d4b1bb83..7c40e9bf9 100644
--- a/stmhal/can.h
+++ b/stmhal/can.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_CAN_H
+#define MICROPY_INCLUDED_STMHAL_CAN_H
#define PYB_CAN_1 (1)
#define PYB_CAN_2 (2)
@@ -32,3 +34,5 @@ extern const mp_obj_type_t pyb_can_type;
void can_init0(void);
void can_deinit(void);
void can_rx_irq_handler(uint can_id, uint fifo_id);
+
+#endif // MICROPY_INCLUDED_STMHAL_CAN_H
diff --git a/stmhal/dac.h b/stmhal/dac.h
index ba44158f3..93192c0fe 100644
--- a/stmhal/dac.h
+++ b/stmhal/dac.h
@@ -23,7 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_DAC_H
+#define MICROPY_INCLUDED_STMHAL_DAC_H
void dac_init(void);
extern const mp_obj_type_t pyb_dac_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_DAC_H
diff --git a/stmhal/dma.h b/stmhal/dma.h
index 57b8f866d..d8b11ca3a 100644
--- a/stmhal/dma.h
+++ b/stmhal/dma.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_STMHAL_DMA_H__
-#define __MICROPY_INCLUDED_STMHAL_DMA_H__
+#ifndef MICROPY_INCLUDED_STMHAL_DMA_H
+#define MICROPY_INCLUDED_STMHAL_DMA_H
typedef struct _dma_descr_t dma_descr_t;
@@ -101,4 +100,4 @@ void dma_deinit(const dma_descr_t *dma_descr);
void dma_invalidate_channel(const dma_descr_t *dma_descr);
void dma_idle_handler(int controller);
-#endif //__MICROPY_INCLUDED_STMHAL_DMA_H__
+#endif // MICROPY_INCLUDED_STMHAL_DMA_H
diff --git a/stmhal/extint.h b/stmhal/extint.h
index b04224c40..0eae8942c 100644
--- a/stmhal/extint.h
+++ b/stmhal/extint.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_EXTINT_H
+#define MICROPY_INCLUDED_STMHAL_EXTINT_H
// Vectors 0-15 are for regular pins
// Vectors 16-22 are for internal sources.
@@ -61,3 +63,5 @@ void extint_swint(uint line);
void Handle_EXTI_Irq(uint32_t line);
extern const mp_obj_type_t extint_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_EXTINT_H
diff --git a/stmhal/flash.h b/stmhal/flash.h
index 007155ecb..c5b5bf352 100644
--- a/stmhal/flash.h
+++ b/stmhal/flash.h
@@ -23,7 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_FLASH_H
+#define MICROPY_INCLUDED_STMHAL_FLASH_H
uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *size);
void flash_erase(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32);
void flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32);
+
+#endif // MICROPY_INCLUDED_STMHAL_FLASH_H
diff --git a/stmhal/font_petme128_8x8.h b/stmhal/font_petme128_8x8.h
index 7f928edda..f27277760 100644
--- a/stmhal/font_petme128_8x8.h
+++ b/stmhal/font_petme128_8x8.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
+#define MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
static const uint8_t font_petme128_8x8[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 32=
@@ -122,3 +124,5 @@ static const uint8_t font_petme128_8x8[] = {
0x00,0x02,0x03,0x01,0x03,0x02,0x03,0x01, // 126=~
0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, // 127
};
+
+#endif // MICROPY_INCLUDED_STMHAL_FONT_PETME128_8X8_H
diff --git a/stmhal/gccollect.h b/stmhal/gccollect.h
index 07797be7e..2cb32a8d4 100644
--- a/stmhal/gccollect.h
+++ b/stmhal/gccollect.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
+#define MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
// variables defining memory layout
// (these probably belong somewhere else...)
@@ -37,3 +39,5 @@ extern uint32_t _heap_start;
extern uint32_t _heap_end;
extern uint32_t _estack;
extern uint32_t _ram_end;
+
+#endif // MICROPY_INCLUDED_STMHAL_GCCOLLECT_H
diff --git a/stmhal/i2c.h b/stmhal/i2c.h
index fc7a6f613..eda076e82 100644
--- a/stmhal/i2c.h
+++ b/stmhal/i2c.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_I2C_H
+#define MICROPY_INCLUDED_STMHAL_I2C_H
#include "dma.h"
@@ -49,3 +51,5 @@ void i2c_init_freq(const pyb_i2c_obj_t *self, mp_int_t freq);
uint32_t i2c_get_baudrate(I2C_InitTypeDef *init);
void i2c_ev_irq_handler(mp_uint_t i2c_id);
void i2c_er_irq_handler(mp_uint_t i2c_id);
+
+#endif // MICROPY_INCLUDED_STMHAL_I2C_H
diff --git a/stmhal/irq.h b/stmhal/irq.h
index 35187520a..8d44b50ed 100644
--- a/stmhal/irq.h
+++ b/stmhal/irq.h
@@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
#ifndef MICROPY_INCLUDED_STMHAL_IRQ_H
#define MICROPY_INCLUDED_STMHAL_IRQ_H
diff --git a/stmhal/lcd.h b/stmhal/lcd.h
index 6a4b004bd..be4f6ed25 100644
--- a/stmhal/lcd.h
+++ b/stmhal/lcd.h
@@ -23,5 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_LCD_H
+#define MICROPY_INCLUDED_STMHAL_LCD_H
extern const mp_obj_type_t pyb_lcd_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_LCD_H
diff --git a/stmhal/led.h b/stmhal/led.h
index f4cd67336..fc9348181 100644
--- a/stmhal/led.h
+++ b/stmhal/led.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_LED_H
+#define MICROPY_INCLUDED_STMHAL_LED_H
typedef enum {
// PYBv3
@@ -48,3 +50,5 @@ void led_toggle(pyb_led_t led);
void led_debug(int value, int delay);
extern const mp_obj_type_t pyb_led_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_LED_H
diff --git a/stmhal/modmachine.h b/stmhal/modmachine.h
index 164c5cfda..ac39f854e 100644
--- a/stmhal/modmachine.h
+++ b/stmhal/modmachine.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
-#define __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
+#ifndef MICROPY_INCLUDED_STMHAL_MODMACHINE_H
+#define MICROPY_INCLUDED_STMHAL_MODMACHINE_H
#include "py/mpstate.h"
#include "py/nlr.h"
@@ -41,4 +40,4 @@ MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj);
MP_DECLARE_CONST_FUN_OBJ_0(machine_sleep_obj);
MP_DECLARE_CONST_FUN_OBJ_0(machine_deepsleep_obj);
-#endif // __MICROPY_INCLUDED_STMHAL_MODMACHINE_H__
+#endif // MICROPY_INCLUDED_STMHAL_MODMACHINE_H
diff --git a/stmhal/modnetwork.h b/stmhal/modnetwork.h
index d3bc5674d..83e4255d5 100644
--- a/stmhal/modnetwork.h
+++ b/stmhal/modnetwork.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_MODNETWORK_H
+#define MICROPY_INCLUDED_STMHAL_MODNETWORK_H
#define MOD_NETWORK_IPADDR_BUF_SIZE (4)
@@ -77,3 +79,5 @@ extern const mod_network_nic_type_t mod_network_nic_type_cc3k;
void mod_network_init(void);
void mod_network_register_nic(mp_obj_t nic);
mp_obj_t mod_network_find_nic(const uint8_t *ip);
+
+#endif // MICROPY_INCLUDED_STMHAL_MODNETWORK_H
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index d3ce11e02..a8ea2f02a 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -27,10 +27,6 @@
// Options to control how MicroPython is built for this port,
// overriding defaults in py/mpconfig.h.
-#pragma once
-#ifndef __INCLUDED_MPCONFIGPORT_H
-#define __INCLUDED_MPCONFIGPORT_H
-
// board specific definitions
#include "mpconfigboard.h"
@@ -350,5 +346,3 @@ static inline mp_uint_t disable_irq(void) {
#include
#define MICROPY_PIN_DEFS_PORT_H "pin_defs_stmhal.h"
-
-#endif // __INCLUDED_MPCONFIGPORT_H
diff --git a/stmhal/mpthreadport.h b/stmhal/mpthreadport.h
index 3d8b4ef01..8e2372dcb 100644
--- a/stmhal/mpthreadport.h
+++ b/stmhal/mpthreadport.h
@@ -23,8 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
#include "py/mpthread.h"
#include "pybthread.h"
@@ -53,5 +51,3 @@ static inline int mp_thread_mutex_lock(mp_thread_mutex_t *m, int wait) {
static inline void mp_thread_mutex_unlock(mp_thread_mutex_t *m) {
pyb_mutex_unlock(m);
}
-
-#endif // __MICROPY_INCLUDED_STMHAL_MPTHREADPORT_H__
diff --git a/stmhal/pendsv.h b/stmhal/pendsv.h
index 77c78d4c1..b64e61386 100644
--- a/stmhal/pendsv.h
+++ b/stmhal/pendsv.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_PENDSV_H
+#define MICROPY_INCLUDED_STMHAL_PENDSV_H
void pendsv_init(void);
void pendsv_kbd_intr(void);
@@ -30,3 +32,5 @@ void pendsv_kbd_intr(void);
// since we play tricks with the stack, the compiler must not generate a
// prelude for this function
void pendsv_isr_handler(void) __attribute__((naked));
+
+#endif // MICROPY_INCLUDED_STMHAL_PENDSV_H
diff --git a/stmhal/pin.h b/stmhal/pin.h
index a11b0a0f8..1ec4bd6b8 100644
--- a/stmhal/pin.h
+++ b/stmhal/pin.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_STMHAL_PIN_H__
-#define __MICROPY_INCLUDED_STMHAL_PIN_H__
+#ifndef MICROPY_INCLUDED_STMHAL_PIN_H
+#define MICROPY_INCLUDED_STMHAL_PIN_H
// This file requires pin_defs_xxx.h (which has port specific enums and
// defines, so we include it here. It should never be included directly
@@ -98,4 +97,4 @@ const pin_af_obj_t *pin_find_af(const pin_obj_t *pin, uint8_t fn, uint8_t unit);
const pin_af_obj_t *pin_find_af_by_index(const pin_obj_t *pin, mp_uint_t af_idx);
const pin_af_obj_t *pin_find_af_by_name(const pin_obj_t *pin, const char *name);
-#endif // __MICROPY_INCLUDED_STMHAL_PIN_H__
+#endif // MICROPY_INCLUDED_STMHAL_PIN_H
diff --git a/stmhal/portmodules.h b/stmhal/portmodules.h
index 0b460f38c..4e892da96 100644
--- a/stmhal/portmodules.h
+++ b/stmhal/portmodules.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_PORTMODULES_H
+#define MICROPY_INCLUDED_STMHAL_PORTMODULES_H
extern const mp_obj_module_t pyb_module;
extern const mp_obj_module_t stm_module;
@@ -37,3 +39,5 @@ MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_us_obj);
MP_DECLARE_CONST_FUN_OBJ_0(mod_os_sync_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_dupterm_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_PORTMODULES_H
diff --git a/stmhal/pybthread.h b/stmhal/pybthread.h
index 6edb2400e..f628f934b 100644
--- a/stmhal/pybthread.h
+++ b/stmhal/pybthread.h
@@ -23,7 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
#ifndef MICROPY_INCLUDED_STMHAL_PYBTHREAD_H
#define MICROPY_INCLUDED_STMHAL_PYBTHREAD_H
diff --git a/stmhal/rng.h b/stmhal/rng.h
index ce1833e80..f022f3a67 100644
--- a/stmhal/rng.h
+++ b/stmhal/rng.h
@@ -23,8 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_RNG_H
+#define MICROPY_INCLUDED_STMHAL_RNG_H
void rng_init0(void);
uint32_t rng_get(void);
MP_DECLARE_CONST_FUN_OBJ_0(pyb_rng_get_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_RNG_H
diff --git a/stmhal/rtc.h b/stmhal/rtc.h
index 69d64c778..f382fa6b6 100644
--- a/stmhal/rtc.h
+++ b/stmhal/rtc.h
@@ -23,9 +23,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_RTC_H
+#define MICROPY_INCLUDED_STMHAL_RTC_H
extern RTC_HandleTypeDef RTCHandle;
extern const mp_obj_type_t pyb_rtc_type;
void rtc_init_start(bool force_init);
void rtc_init_finalise(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_RTC_H
diff --git a/stmhal/sdcard.h b/stmhal/sdcard.h
index 237e48d8b..d595f0f1a 100644
--- a/stmhal/sdcard.h
+++ b/stmhal/sdcard.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_SDCARD_H
+#define MICROPY_INCLUDED_STMHAL_SDCARD_H
// this is a fixed size and should not be changed
#define SDCARD_BLOCK_SIZE (512)
@@ -42,3 +44,5 @@ extern const struct _mp_obj_base_t pyb_sdcard_obj;
struct _fs_user_mount_t;
void sdcard_init_vfs(struct _fs_user_mount_t *vfs, int part);
+
+#endif // MICROPY_INCLUDED_STMHAL_SDCARD_H
diff --git a/stmhal/servo.h b/stmhal/servo.h
index 0fca8fea1..18fd493d5 100644
--- a/stmhal/servo.h
+++ b/stmhal/servo.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_SERVO_H
+#define MICROPY_INCLUDED_STMHAL_SERVO_H
void servo_init(void);
void servo_timer_irq_callback(void);
@@ -31,3 +33,5 @@ extern const mp_obj_type_t pyb_servo_type;
MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
+
+#endif // MICROPY_INCLUDED_STMHAL_SERVO_H
diff --git a/stmhal/spi.h b/stmhal/spi.h
index 5686bde64..e6752fdd1 100644
--- a/stmhal/spi.h
+++ b/stmhal/spi.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_SPI_H
+#define MICROPY_INCLUDED_STMHAL_SPI_H
extern SPI_HandleTypeDef SPIHandle1;
extern SPI_HandleTypeDef SPIHandle2;
@@ -37,3 +39,5 @@ extern const mp_obj_type_t machine_hard_spi_type;
void spi_init0(void);
void spi_init(SPI_HandleTypeDef *spi, bool enable_nss_pin);
SPI_HandleTypeDef *spi_get_handle(mp_obj_t o);
+
+#endif // MICROPY_INCLUDED_STMHAL_SPI_H
diff --git a/stmhal/stm32_it.h b/stmhal/stm32_it.h
index a168cda83..d6ed1b2b9 100644
--- a/stmhal/stm32_it.h
+++ b/stmhal/stm32_it.h
@@ -25,6 +25,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_STM32_IT_H
+#define MICROPY_INCLUDED_STMHAL_STM32_IT_H
/**
******************************************************************************
@@ -80,3 +82,5 @@ void OTG_FS_IRQHandler(void);
#ifdef USE_USB_HS
void OTG_HS_IRQHandler(void);
#endif
+
+#endif // MICROPY_INCLUDED_STMHAL_STM32_IT_H
diff --git a/stmhal/storage.h b/stmhal/storage.h
index 4d3de77ed..0ecb5715a 100644
--- a/stmhal/storage.h
+++ b/stmhal/storage.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_STORAGE_H
+#define MICROPY_INCLUDED_STMHAL_STORAGE_H
#define FLASH_BLOCK_SIZE (512)
@@ -45,3 +47,5 @@ extern const struct _mp_obj_type_t pyb_flash_type;
struct _fs_user_mount_t;
void pyb_flash_init_vfs(struct _fs_user_mount_t *vfs);
+
+#endif // MICROPY_INCLUDED_STMHAL_STORAGE_H
diff --git a/stmhal/systick.h b/stmhal/systick.h
index 1e7f62335..524afae40 100644
--- a/stmhal/systick.h
+++ b/stmhal/systick.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_SYSTICK_H
+#define MICROPY_INCLUDED_STMHAL_SYSTICK_H
void sys_tick_wait_at_least(uint32_t stc, uint32_t delay_ms);
bool sys_tick_has_passed(uint32_t stc, uint32_t delay_ms);
+
+#endif // MICROPY_INCLUDED_STMHAL_SYSTICK_H
diff --git a/stmhal/timer.h b/stmhal/timer.h
index a18d7cf10..72e461f2f 100644
--- a/stmhal/timer.h
+++ b/stmhal/timer.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_TIMER_H
+#define MICROPY_INCLUDED_STMHAL_TIMER_H
extern TIM_HandleTypeDef TIM5_Handle;
@@ -36,3 +38,5 @@ uint32_t timer_get_source_freq(uint32_t tim_id);
void timer_irq_handler(uint tim_id);
TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer);
+
+#endif // MICROPY_INCLUDED_STMHAL_TIMER_H
diff --git a/stmhal/uart.h b/stmhal/uart.h
index 7fdc59de7..749530954 100644
--- a/stmhal/uart.h
+++ b/stmhal/uart.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_UART_H
+#define MICROPY_INCLUDED_STMHAL_UART_H
typedef enum {
PYB_UART_NONE = 0,
@@ -47,3 +49,5 @@ mp_uint_t uart_rx_any(pyb_uart_obj_t *uart_obj);
int uart_rx_char(pyb_uart_obj_t *uart_obj);
void uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len);
void uart_tx_strn_cooked(pyb_uart_obj_t *uart_obj, const char *str, uint len);
+
+#endif // MICROPY_INCLUDED_STMHAL_UART_H
diff --git a/stmhal/usb.h b/stmhal/usb.h
index 42e6c76f8..e04fe70d7 100644
--- a/stmhal/usb.h
+++ b/stmhal/usb.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USB_H
+#define MICROPY_INCLUDED_STMHAL_USB_H
#include "usbd_cdc_msc_hid0.h"
@@ -67,3 +69,5 @@ void usb_vcp_send_strn_cooked(const char *str, int len);
void pyb_usb_host_init(void);
void pyb_usb_host_process(void);
uint pyb_usb_host_get_keyboard(void);
+
+#endif // MICROPY_INCLUDED_STMHAL_USB_H
diff --git a/stmhal/usbd_cdc_interface.h b/stmhal/usbd_cdc_interface.h
index d96861a7e..6f9a1e8a3 100644
--- a/stmhal/usbd_cdc_interface.h
+++ b/stmhal/usbd_cdc_interface.h
@@ -1,6 +1,8 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H
+#define MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H
/**
******************************************************************************
@@ -39,3 +41,5 @@ void USBD_CDC_TxAlways(const uint8_t *buf, uint32_t len);
int USBD_CDC_RxNum(void);
int USBD_CDC_Rx(uint8_t *buf, uint32_t len, uint32_t timeout);
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H
diff --git a/stmhal/usbd_desc.h b/stmhal/usbd_desc.h
index 93e222fc9..f48e364e1 100644
--- a/stmhal/usbd_desc.h
+++ b/stmhal/usbd_desc.h
@@ -23,7 +23,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_DESC_H
+#define MICROPY_INCLUDED_STMHAL_USBD_DESC_H
extern const USBD_DescriptorsTypeDef USBD_Descriptors;
void USBD_SetVIDPIDRelease(uint16_t vid, uint16_t pid, uint16_t device_release_num, int cdc_only);
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_DESC_H
diff --git a/stmhal/usbd_hid_interface.h b/stmhal/usbd_hid_interface.h
index fbc874796..b2ff75fa1 100644
--- a/stmhal/usbd_hid_interface.h
+++ b/stmhal/usbd_hid_interface.h
@@ -1,6 +1,8 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H
+#define MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H
#include "usbd_cdc_msc_hid.h"
@@ -8,3 +10,5 @@ extern const USBD_HID_ItfTypeDef USBD_HID_fops;
int USBD_HID_RxNum(void);
int USBD_HID_Rx(USBD_HandleTypeDef *pdev, uint8_t *buf, uint32_t len, uint32_t timeout);
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_HID_INTERFACE_H
diff --git a/stmhal/usbd_msc_storage.h b/stmhal/usbd_msc_storage.h
index 4a0d28ca8..a4bc8004a 100644
--- a/stmhal/usbd_msc_storage.h
+++ b/stmhal/usbd_msc_storage.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
+#define MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
extern const USBD_StorageTypeDef USBD_FLASH_STORAGE_fops;
extern const USBD_StorageTypeDef USBD_SDCARD_STORAGE_fops;
+
+#endif // MICROPY_INCLUDED_STMHAL_USBD_MSC_STORAGE_H
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
index bc9d0d21a..ec03c860a 100644
--- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
+++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
-#define __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
+#ifndef MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
+#define MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
// these are exports for the CDC/MSC/HID interface that are independent
// from any other definitions/declarations
@@ -49,4 +48,4 @@ typedef struct _USBD_HID_ModeInfoTypeDef {
const uint8_t *report_desc;
} USBD_HID_ModeInfoTypeDef;
-#endif // __MICROPY_INCLUDED_STMHAL_USB_CDC_MSC_HID0_H__
+#endif // MICROPY_INCLUDED_STMHAL_USBDEV_CLASS_INC_USBD_CDC_MSC_HID0_H
diff --git a/stmhal/usrsw.h b/stmhal/usrsw.h
index b6dff2c43..9fbe6109d 100644
--- a/stmhal/usrsw.h
+++ b/stmhal/usrsw.h
@@ -23,8 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_USRSW_H
+#define MICROPY_INCLUDED_STMHAL_USRSW_H
void switch_init0(void);
int switch_get(void);
extern const mp_obj_type_t pyb_switch_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_USRSW_H
diff --git a/stmhal/wdt.h b/stmhal/wdt.h
index 362d6ef68..0a486f704 100644
--- a/stmhal/wdt.h
+++ b/stmhal/wdt.h
@@ -23,5 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_STMHAL_WDT_H
+#define MICROPY_INCLUDED_STMHAL_WDT_H
extern const mp_obj_type_t pyb_wdt_type;
+
+#endif // MICROPY_INCLUDED_STMHAL_WDT_H
diff --git a/teensy/hal_ftm.h b/teensy/hal_ftm.h
index 3dc15300d..ad627358b 100644
--- a/teensy/hal_ftm.h
+++ b/teensy/hal_ftm.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_TEENSY_HAL_FTM_H
+#define MICROPY_INCLUDED_TEENSY_HAL_FTM_H
#define FTM0 ((FTM_TypeDef *)&FTM0_SC)
#define FTM1 ((FTM_TypeDef *)&FTM1_SC)
@@ -181,4 +183,4 @@ void HAL_FTM_IC_Start(FTM_HandleTypeDef *hftm, uint32_t channel);
void HAL_FTM_IC_Start_IT(FTM_HandleTypeDef *hftm, uint32_t channel);
void HAL_FTM_IC_DeInit(FTM_HandleTypeDef *hftm);
-
+#endif // MICROPY_INCLUDED_TEENSY_HAL_FTM_H
diff --git a/teensy/led.h b/teensy/led.h
index 7f4ba18f2..5c45166ef 100644
--- a/teensy/led.h
+++ b/teensy/led.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_LED_H
+#define MICROPY_INCLUDED_TEENSY_LED_H
+
typedef enum {
PYB_LED_BUILTIN = 1,
} pyb_led_t;
@@ -7,3 +10,5 @@ void led_state(pyb_led_t led, int state);
void led_toggle(pyb_led_t led);
extern const mp_obj_type_t pyb_led_type;
+
+#endif // MICROPY_INCLUDED_TEENSY_LED_H
diff --git a/teensy/lexermemzip.h b/teensy/lexermemzip.h
index e5d4be5ea..cd7326a43 100644
--- a/teensy/lexermemzip.h
+++ b/teensy/lexermemzip.h
@@ -1,2 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
+#define MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
+
mp_lexer_t *mp_lexer_new_from_memzip_file(const char *filename);
+#endif // MICROPY_INCLUDED_TEENSY_LEXERMEMZIP_H
diff --git a/teensy/reg.h b/teensy/reg.h
index 5d1d27443..0da6378ee 100644
--- a/teensy/reg.h
+++ b/teensy/reg.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_REG_H
+#define MICROPY_INCLUDED_TEENSY_REG_H
+
typedef struct {
const char *name;
mp_uint_t offset;
@@ -6,3 +9,5 @@ typedef struct {
#define REG_ENTRY(st, name) { #name, offsetof(st, name) }
mp_obj_t reg_cmd(void *base, reg_t *reg, mp_uint_t num_reg, uint n_args, const mp_obj_t *args);
+
+#endif // MICROPY_INCLUDED_TEENSY_REG_H
diff --git a/teensy/servo.h b/teensy/servo.h
index 5f1c87b69..1ad34353d 100644
--- a/teensy/servo.h
+++ b/teensy/servo.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_SERVO_H
+#define MICROPY_INCLUDED_TEENSY_SERVO_H
+
void servo_init(void);
extern const mp_obj_type_t pyb_servo_type;
@@ -5,3 +8,4 @@ extern const mp_obj_type_t pyb_servo_type;
MP_DECLARE_CONST_FUN_OBJ_2(pyb_servo_set_obj);
MP_DECLARE_CONST_FUN_OBJ_2(pyb_pwm_set_obj);
+#endif // MICROPY_INCLUDED_TEENSY_SERVO_H
diff --git a/teensy/std.h b/teensy/std.h
index 42791877a..ef55d22dd 100644
--- a/teensy/std.h
+++ b/teensy/std.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_STD_H
+#define MICROPY_INCLUDED_TEENSY_STD_H
+
typedef unsigned int size_t;
void __assert_func(void);
@@ -18,3 +21,5 @@ char *strcat(char *dest, const char *src);
int printf(const char *fmt, ...);
int snprintf(char *str, size_t size, const char *fmt, ...);
+
+#endif // MICROPY_INCLUDED_TEENSY_STD_H
diff --git a/teensy/timer.h b/teensy/timer.h
index bfa7636f4..89095b076 100644
--- a/teensy/timer.h
+++ b/teensy/timer.h
@@ -23,8 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_TEENSY_TIMER_H
+#define MICROPY_INCLUDED_TEENSY_TIMER_H
extern const mp_obj_type_t pyb_timer_type;
void timer_init0(void);
void timer_deinit(void);
+
+#endif // MICROPY_INCLUDED_TEENSY_TIMER_H
diff --git a/teensy/usb.h b/teensy/usb.h
index 949d7a59c..50fb3ff90 100644
--- a/teensy/usb.h
+++ b/teensy/usb.h
@@ -1,3 +1,6 @@
+#ifndef MICROPY_INCLUDED_TEENSY_USB_H
+#define MICROPY_INCLUDED_TEENSY_USB_H
+
bool usb_vcp_is_connected(void);
bool usb_vcp_is_enabled(void);
int usb_vcp_rx_num(void);
@@ -5,3 +8,5 @@ int usb_vcp_recv_byte(uint8_t *ptr);
void usb_vcp_send_str(const char* str);
void usb_vcp_send_strn(const char* str, int len);
void usb_vcp_send_strn_cooked(const char *str, int len);
+
+#endif // MICROPY_INCLUDED_TEENSY_USB_H
diff --git a/unix/fdfile.h b/unix/fdfile.h
index 8e8e97c79..591159deb 100644
--- a/unix/fdfile.h
+++ b/unix/fdfile.h
@@ -24,12 +24,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_UNIX_FDFILE_H
+#define MICROPY_INCLUDED_UNIX_FDFILE_H
#include "py/obj.h"
-#ifndef __MICROPY_INCLUDED_UNIX_FILE_H__
-#define __MICROPY_INCLUDED_UNIX_FILE_H__
-
typedef struct _mp_obj_fdfile_t {
mp_obj_base_t base;
int fd;
@@ -38,4 +37,4 @@ typedef struct _mp_obj_fdfile_t {
extern const mp_obj_type_t mp_type_fileio;
extern const mp_obj_type_t mp_type_textio;
-#endif // __MICROPY_INCLUDED_UNIX_FILE_H__
+#endif // MICROPY_INCLUDED_UNIX_FDFILE_H
diff --git a/unix/input.h b/unix/input.h
index 7cbee33c5..a76b87e64 100644
--- a/unix/input.h
+++ b/unix/input.h
@@ -1,3 +1,8 @@
+#ifndef MICROPY_INCLUDED_UNIX_INPUT_H
+#define MICROPY_INCLUDED_UNIX_INPUT_H
+
char *prompt(char *p);
void prompt_read_history(void);
void prompt_write_history(void);
+
+#endif // MICROPY_INCLUDED_UNIX_INPUT_H
diff --git a/unix/mpthreadport.h b/unix/mpthreadport.h
index 51cf8d786..b158ed5bc 100644
--- a/unix/mpthreadport.h
+++ b/unix/mpthreadport.h
@@ -23,8 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
-#define __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
#include
@@ -32,5 +30,3 @@ typedef pthread_mutex_t mp_thread_mutex_t;
void mp_thread_init(void);
void mp_thread_gc_others(void);
-
-#endif // __MICROPY_INCLUDED_UNIX_MPTHREADPORT_H__
diff --git a/windows/fmode.h b/windows/fmode.h
index 23d6d3d54..c661c84d0 100644
--- a/windows/fmode.h
+++ b/windows/fmode.h
@@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-#ifndef __MICROPY_INCLUDED_WINDOWS_FMODE_H__
-#define __MICROPY_INCLUDED_WINDOWS_FMODE_H__
+#ifndef MICROPY_INCLUDED_WINDOWS_FMODE_H
+#define MICROPY_INCLUDED_WINDOWS_FMODE_H
// Treat files opened by open() as binary. No line ending translation is done.
void set_fmode_binary(void);
@@ -35,4 +34,4 @@ void set_fmode_binary(void);
// When writing to the file \n will be converted into \r\n.
void set_fmode_text(void);
-#endif
+#endif // MICROPY_INCLUDED_WINDOWS_FMODE_H
diff --git a/windows/init.h b/windows/init.h
index 69e577689..480befef6 100644
--- a/windows/init.h
+++ b/windows/init.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_INIT_H
+#define MICROPY_INCLUDED_WINDOWS_INIT_H
void init(void);
void deinit(void);
+
+#endif // MICROPY_INCLUDED_WINDOWS_INIT_H
diff --git a/windows/msvc/dirent.h b/windows/msvc/dirent.h
index 6172913ee..fca06785a 100644
--- a/windows/msvc/dirent.h
+++ b/windows/msvc/dirent.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
// dirent.h implementation for msvc
@@ -42,3 +44,5 @@ typedef struct dirent {
DIR *opendir(const char *name);
int closedir(DIR *dir);
struct dirent *readdir(DIR *dir);
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_DIRENT_H
diff --git a/windows/msvc/sys/time.h b/windows/msvc/sys/time.h
index 96bca1ccb..a36648beb 100644
--- a/windows/msvc/sys/time.h
+++ b/windows/msvc/sys/time.h
@@ -23,6 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
// Get the definitions for timeval etc
#include
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_SYS_TIME_H
diff --git a/windows/msvc/unistd.h b/windows/msvc/unistd.h
index add10c884..87787c3d8 100644
--- a/windows/msvc/unistd.h
+++ b/windows/msvc/unistd.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
+#define MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
// There's no unistd.h, but this is the equivalent
#include
@@ -38,3 +40,5 @@
#define SEEK_CUR 1
#define SEEK_END 2
#define SEEK_SET 0
+
+#endif // MICROPY_INCLUDED_WINDOWS_MSVC_UNISTD_H
diff --git a/windows/realpath.h b/windows/realpath.h
index 6f0a29a7e..c7bb3acd7 100644
--- a/windows/realpath.h
+++ b/windows/realpath.h
@@ -23,5 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_REALPATH_H
+#define MICROPY_INCLUDED_WINDOWS_REALPATH_H
extern char *realpath(const char *path, char *resolved_path);
+
+#endif // MICROPY_INCLUDED_WINDOWS_REALPATH_H
diff --git a/windows/sleep.h b/windows/sleep.h
index 09ad4afdc..6c0c00332 100644
--- a/windows/sleep.h
+++ b/windows/sleep.h
@@ -23,6 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+#ifndef MICROPY_INCLUDED_WINDOWS_SLEEP_H
+#define MICROPY_INCLUDED_WINDOWS_SLEEP_H
void init_sleep(void);
void deinit_sleep(void);
@@ -30,3 +32,5 @@ void msec_sleep(double msec);
#ifdef _MSC_VER
int usleep(__int64 usec);
#endif
+
+#endif // MICROPY_INCLUDED_WINDOWS_SLEEP_H
diff --git a/zephyr/modmachine.h b/zephyr/modmachine.h
index 596c59b17..84e4d10a8 100644
--- a/zephyr/modmachine.h
+++ b/zephyr/modmachine.h
@@ -1,5 +1,5 @@
-#ifndef __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
-#define __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
+#ifndef MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H
+#define MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H
#include "py/obj.h"
@@ -13,4 +13,4 @@ typedef struct _machine_pin_obj_t {
uint32_t pin;
} machine_pin_obj_t;
-#endif // __MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H__
+#endif // MICROPY_INCLUDED_ZEPHYR_MODMACHINE_H
From 016325dd0a5ad0904378004e728ccca19ee2b30d Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 18 Jul 2017 16:17:23 +1000
Subject: [PATCH 165/252] py/vm: Make n_state variable local to just set-up
part of VM.
It's not used anywhere else in the VM loop, and clashes with (is shadowed
by) the n_state variable that's redeclared towards the end of the
mp_execute_bytecode function. Code size is unchanged.
---
py/vm.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/py/vm.c b/py/vm.c
index 7451d53b9..bb120e775 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -162,9 +162,13 @@ mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp
run_code_state: ;
#endif
// Pointers which are constant for particular invocation of mp_execute_bytecode()
- size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
- mp_obj_t * /*const*/ fastn = &code_state->state[n_state - 1];
- mp_exc_stack_t * /*const*/ exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
+ mp_obj_t * /*const*/ fastn;
+ mp_exc_stack_t * /*const*/ exc_stack;
+ {
+ size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
+ fastn = &code_state->state[n_state - 1];
+ exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
+ }
// variables that are visible to the exception handler (declared volatile)
volatile bool currently_in_except_block = MP_TAGPTR_TAG0(code_state->exc_sp); // 0 or 1, to detect nested exceptions
From 3235b95f087751f54c5531e24033e802be199d7c Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 18 Jul 2017 17:30:23 +1000
Subject: [PATCH 166/252] py/asmx64: Support moving a 64-bit immediate to one
of top 8 registers.
If constants (eg mp_const_none_obj) are placed in very high memory
locations that require 64-bits for the pointer then the assembler must be
able to emit instructions to move such pointers to one of the top 8
registers (ie r8-r15).
---
py/asmx64.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/py/asmx64.c b/py/asmx64.c
index cf1a86b3f..6775e8e93 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -344,8 +344,9 @@ STATIC void asm_x64_mov_i32_to_r64(asm_x64_t *as, int src_i32, int dest_r64) {
void asm_x64_mov_i64_to_r64(asm_x64_t *as, int64_t src_i64, int dest_r64) {
// cpu defaults to i32 to r64
// to mov i64 to r64 need to use REX prefix
- assert(dest_r64 < 8);
- asm_x64_write_byte_2(as, REX_PREFIX | REX_W, OPCODE_MOV_I64_TO_R64 | dest_r64);
+ asm_x64_write_byte_2(as,
+ REX_PREFIX | REX_W | (dest_r64 < 8 ? 0 : REX_B),
+ OPCODE_MOV_I64_TO_R64 | (dest_r64 & 7));
asm_x64_write_word64(as, src_i64);
}
From cadbd7f3e62488fb3c62cd35f53530e8fdb8cfea Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 18 Jul 2017 22:30:22 +1000
Subject: [PATCH 167/252] py/modmicropython: Cast stack_limit value so it
prints correctly.
Without this cast the print will give a wrong result on nan-boxing builds.
---
py/modmicropython.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/py/modmicropython.c b/py/modmicropython.c
index d76706230..46a3922e6 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -72,7 +72,8 @@ mp_obj_t mp_micropython_mem_info(size_t n_args, const mp_obj_t *args) {
(mp_uint_t)m_get_total_bytes_allocated(), (mp_uint_t)m_get_current_bytes_allocated(), (mp_uint_t)m_get_peak_bytes_allocated());
#endif
#if MICROPY_STACK_CHECK
- mp_printf(&mp_plat_print, "stack: " UINT_FMT " out of " INT_FMT "\n", mp_stack_usage(), MP_STATE_THREAD(stack_limit));
+ mp_printf(&mp_plat_print, "stack: " UINT_FMT " out of " UINT_FMT "\n",
+ mp_stack_usage(), (mp_uint_t)MP_STATE_THREAD(stack_limit));
#else
mp_printf(&mp_plat_print, "stack: " UINT_FMT "\n", mp_stack_usage());
#endif
From c972c60dbe72d7448faff7f631dfb798b694093e Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 19 Jul 2017 13:01:22 +1000
Subject: [PATCH 168/252] stmhal: Clean up USB CDC/MSC files and remove
commented-out code.
---
stmhal/usbd_cdc_interface.c | 79 +++++--------------------------------
stmhal/usbd_msc_storage.c | 48 ++--------------------
2 files changed, 13 insertions(+), 114 deletions(-)
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c
index addcf8c85..3e107d418 100644
--- a/stmhal/usbd_cdc_interface.c
+++ b/stmhal/usbd_cdc_interface.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* Taken from ST Cube library and heavily modified. See below for original
* copyright header.
@@ -23,8 +23,8 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
@@ -102,52 +102,14 @@ const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
* @param None
* @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
*/
-static int8_t CDC_Itf_Init(USBD_HandleTypeDef *pdev)
-{
-#if 0
- /*##-1- Configure the UART peripheral ######################################*/
- /* Put the USART peripheral in the Asynchronous mode (UART Mode) */
- /* USART configured as follow:
- - Word Length = 8 Bits
- - Stop Bit = One Stop bit
- - Parity = No parity
- - BaudRate = 115200 baud
- - Hardware flow control disabled (RTS and CTS signals) */
- UartHandle.Instance = USARTx;
- UartHandle.Init.BaudRate = 115200;
- UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
- UartHandle.Init.StopBits = UART_STOPBITS_1;
- UartHandle.Init.Parity = UART_PARITY_NONE;
- UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
- UartHandle.Init.Mode = UART_MODE_TX_RX;
-
- if(HAL_UART_Init(&UartHandle) != HAL_OK)
- {
- /* Initialization Error */
- Error_Handler();
- }
-
- /*##-2- Put UART peripheral in IT reception process ########################*/
- /* Any data received will be stored in "UserTxBuffer" buffer */
- if(HAL_UART_Receive_IT(&UartHandle, (uint8_t *)UserTxBuffer, 1) != HAL_OK)
- {
- /* Transfer error in reception process */
- Error_Handler();
- }
-
- /*##-3- Configure the TIM Base generation #################################*/
- now done in HAL_MspInit
- TIM_Config();
-#endif
-
- /*##-5- Set Application Buffers ############################################*/
+static int8_t CDC_Itf_Init(USBD_HandleTypeDef *pdev) {
USBD_CDC_SetTxBuffer(pdev, UserTxBuffer, 0);
USBD_CDC_SetRxBuffer(pdev, cdc_rx_packet_buf);
cdc_rx_buf_put = 0;
cdc_rx_buf_get = 0;
-
- return (USBD_OK);
+
+ return USBD_OK;
}
/**
@@ -156,22 +118,14 @@ static int8_t CDC_Itf_Init(USBD_HandleTypeDef *pdev)
* @param None
* @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
*/
-static int8_t CDC_Itf_DeInit(void)
-{
-#if 0
- /* DeInitialize the UART peripheral */
- if(HAL_UART_DeInit(&UartHandle) != HAL_OK)
- {
- /* Initialization Error */
- }
-#endif
- return (USBD_OK);
+static int8_t CDC_Itf_DeInit(void) {
+ return USBD_OK;
}
/**
* @brief CDC_Itf_Control
* Manage the CDC class requests
- * @param Cmd: Command code
+ * @param Cmd: Command code
* @param Buf: Buffer containing command data (request parameters)
* @param Len: Number of data to be sent (in bytes)
* @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
@@ -210,16 +164,6 @@ static int8_t CDC_Itf_Control(uint8_t cmd, uint8_t* pbuf, uint16_t length) {
break;
case CDC_GET_LINE_CODING:
- #if 0
- pbuf[0] = (uint8_t)(LineCoding.bitrate);
- pbuf[1] = (uint8_t)(LineCoding.bitrate >> 8);
- pbuf[2] = (uint8_t)(LineCoding.bitrate >> 16);
- pbuf[3] = (uint8_t)(LineCoding.bitrate >> 24);
- pbuf[4] = LineCoding.format;
- pbuf[5] = LineCoding.paritytype;
- pbuf[6] = LineCoding.datatype;
- #endif
-
/* Add your code here */
pbuf[0] = (uint8_t)(115200);
pbuf[1] = (uint8_t)(115200 >> 8);
@@ -318,11 +262,6 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
* free to modify it.
*/
static int8_t CDC_Itf_Receive(USBD_HandleTypeDef *pdev, uint8_t* Buf, uint32_t *Len) {
-#if 0
- // this sends the data over the UART using DMA
- HAL_UART_Transmit_DMA(&UartHandle, Buf, *Len);
-#endif
-
// copy the incoming data into the circular buffer
for (uint8_t *src = Buf, *top = Buf + *Len; src < top; ++src) {
if (mp_interrupt_char != -1 && *src == mp_interrupt_char) {
diff --git a/stmhal/usbd_msc_storage.c b/stmhal/usbd_msc_storage.c
index cec973741..f825c3d70 100644
--- a/stmhal/usbd_msc_storage.c
+++ b/stmhal/usbd_msc_storage.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*/
/**
@@ -20,13 +20,13 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
- * Heavily modified by dpgeorge for Micro Python.
+ * Heavily modified by dpgeorge for MicroPython.
*
******************************************************************************
*/
@@ -134,13 +134,6 @@ int8_t FLASH_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
*/
int8_t FLASH_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
storage_read_blocks(buf, blk_addr, blk_len);
- /*
- for (int i = 0; i < blk_len; i++) {
- if (!storage_read_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- */
return 0;
}
@@ -154,13 +147,6 @@ int8_t FLASH_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t
*/
int8_t FLASH_STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
storage_write_blocks(buf, blk_addr, blk_len);
- /*
- for (int i = 0; i < blk_len; i++) {
- if (!storage_write_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {
- return -1;
- }
- }
- */
return 0;
}
@@ -213,20 +199,6 @@ static const int8_t SDCARD_STORAGE_Inquirydata[] = { // 36 bytes
* @retval Status
*/
int8_t SDCARD_STORAGE_Init(uint8_t lun) {
- /*
-#ifndef USE_STM3210C_EVAL
- NVIC_InitTypeDef NVIC_InitStructure;
- NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0;
- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
-#endif
- if( SD_Init() != 0)
- {
- return (-1);
- }
- */
if (!sdcard_power_on()) {
return -1;
}
@@ -243,20 +215,8 @@ int8_t SDCARD_STORAGE_Init(uint8_t lun) {
* @retval Status
*/
int8_t SDCARD_STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size) {
-/*
-#ifdef USE_STM3210C_EVAL
- SD_CardInfo SDCardInfo;
- SD_GetCardInfo(&SDCardInfo);
-#else
- if(SD_GetStatus() != 0 ) {
- return (-1);
- }
-#endif
- */
-
*block_size = SDCARD_BLOCK_SIZE;
*block_num = sdcard_get_capacity_in_bytes() / SDCARD_BLOCK_SIZE;
-
return 0;
}
From 761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 19 Jul 2017 13:12:10 +1000
Subject: [PATCH 169/252] all: Remove trailing spaces, per coding conventions.
---
.gitignore | 2 +-
CODECONVENTIONS.md | 2 +-
bare-arm/stm32f405.ld | 10 +++++-----
esp8266/hspi_register.h | 2 +-
examples/embedding/Makefile.upylib | 2 +-
extmod/modubinascii.c | 2 +-
minimal/stm32f405.ld | 4 ++--
mpy-cross/Makefile | 2 +-
py/asmarm.c | 2 +-
py/formatfloat.c | 16 ++++++++--------
py/mkrules.mk | 2 +-
py/objtype.c | 2 +-
py/runtime.c | 2 +-
stmhal/boards/common.ld | 10 +++++-----
stmhal/boards/stm32f401xd.ld | 2 +-
stmhal/boards/stm32f401xe.ld | 2 +-
stmhal/boards/stm32f405.ld | 2 +-
stmhal/boards/stm32f411.ld | 4 ++--
stmhal/boards/stm32f429.ld | 6 +++---
stmhal/boards/stm32l476xe.ld | 4 ++--
stmhal/boards/stm32l476xg.ld | 4 ++--
stmhal/i2c.c | 2 +-
stmhal/sdcard.c | 2 +-
stmhal/timer.c | 2 +-
stmhal/uart.c | 2 +-
tests/README | 2 +-
tools/codestats.sh | 6 +++---
windows/msvc/gettimeofday.c | 2 +-
windows/sleep.c | 2 +-
29 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/.gitignore b/.gitignore
index 280db388f..5e841a89c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,7 @@
*.dis
*.exe
-# Packages
+# Packages
############
# Logs and Databases
diff --git a/CODECONVENTIONS.md b/CODECONVENTIONS.md
index f9dce71dd..982b95831 100644
--- a/CODECONVENTIONS.md
+++ b/CODECONVENTIONS.md
@@ -73,7 +73,7 @@ White space:
keyword and the opening parenthesis.
- Put 1 space after a comma, and 1 space around operators.
-Braces:
+Braces:
- Use braces for all blocks, even no-line and single-line pieces of
code.
- Put opening braces on the end of the line it belongs to, not on
diff --git a/bare-arm/stm32f405.ld b/bare-arm/stm32f405.ld
index 345a92d3c..dd688a024 100644
--- a/bare-arm/stm32f405.ld
+++ b/bare-arm/stm32f405.ld
@@ -11,7 +11,7 @@ MEMORY
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */
}
-
+
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
@@ -30,7 +30,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH_ISR
-
+
/* The program code and other data goes into FLASH */
.text :
{
@@ -46,7 +46,7 @@ SECTIONS
_etext = .; /* define a global symbol at end of code */
_sidata = _etext; /* This is used by the startup in order to initialize the .data secion */
} >FLASH_TEXT
-
+
/*
.ARM.extab :
{
@@ -60,7 +60,7 @@ SECTIONS
__exidx_end = .;
} >FLASH
*/
-
+
/* This is the initialized data section
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH (inidata).
@@ -76,7 +76,7 @@ SECTIONS
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM
-
+
/* Uninitialized data section */
.bss :
{
diff --git a/esp8266/hspi_register.h b/esp8266/hspi_register.h
index 30a5ff588..4dd335b40 100644
--- a/esp8266/hspi_register.h
+++ b/esp8266/hspi_register.h
@@ -3,7 +3,7 @@
* Modified by David Ogilvy (MetalPhreak)
* Based on original file included in SDK 1.0.0
*
- * Missing defines from previous SDK versions have
+ * Missing defines from previous SDK versions have
* been added and are noted with comments. The
* names of these defines are likely to change.
*/
diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib
index 4663ad30a..bb48fd507 100644
--- a/examples/embedding/Makefile.upylib
+++ b/examples/embedding/Makefile.upylib
@@ -56,7 +56,7 @@ endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
# The unix port of micropython on OSX must be compiled with clang,
-# while cross-compile ports require gcc, so we test here for OSX and
+# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index cf250d27f..4dda3c442 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -118,7 +118,7 @@ mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
vstr_init_len(&vstr, 0);
}
else {
- vstr_init_len(&vstr, ((bufinfo.len / 4) * 3) - ((in[bufinfo.len-1] == '=') ? ((in[bufinfo.len-2] == '=') ? 2 : 1 ) : 0));
+ vstr_init_len(&vstr, ((bufinfo.len / 4) * 3) - ((in[bufinfo.len-1] == '=') ? ((in[bufinfo.len-2] == '=') ? 2 : 1 ) : 0));
}
byte *out = (byte*)vstr.buf;
for (mp_uint_t i = bufinfo.len; i; i -= 4) {
diff --git a/minimal/stm32f405.ld b/minimal/stm32f405.ld
index b4aeda744..a202294a5 100644
--- a/minimal/stm32f405.ld
+++ b/minimal/stm32f405.ld
@@ -9,7 +9,7 @@ MEMORY
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */
}
-
+
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
@@ -45,7 +45,7 @@ SECTIONS
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM
-
+
/* Uninitialized data section */
.bss :
{
diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile
index f5b643c6c..c04adaf6a 100644
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -45,7 +45,7 @@ endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
# The unix port of micropython on OSX must be compiled with clang,
-# while cross-compile ports require gcc, so we test here for OSX and
+# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
CC = clang
diff --git a/py/asmarm.c b/py/asmarm.c
index da07680e3..ff22aba90 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -135,7 +135,7 @@ STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
void asm_arm_bkpt(asm_arm_t *as) {
// bkpt #0
- emit_al(as, 0x1200070);
+ emit_al(as, 0x1200070);
}
// locals:
diff --git a/py/formatfloat.c b/py/formatfloat.c
index ea5a07977..2f10d425a 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -161,7 +161,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
if (fmt == 'g' && prec == 0) {
prec = 1;
}
- int e, e1;
+ int e, e1;
int dec = 0;
char e_sign = '\0';
int num_digits = 0;
@@ -209,7 +209,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
e_sign_char = '+';
}
} else if (fp_isless1(f)) {
- e++;
+ e++;
f *= FPCONST(10.0);
}
@@ -232,7 +232,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
num_digits = prec;
if (num_digits) {
- *s++ = '.';
+ *s++ = '.';
while (--e && num_digits) {
*s++ = '0';
num_digits--;
@@ -266,7 +266,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
f *= FPCONST(0.1);
}
- // If the user specified fixed format (fmt == 'f') and e makes the
+ // If the user specified fixed format (fmt == 'f') and e makes the
// number too big to fit into the available buffer, then we'll
// switch to the 'e' format.
@@ -327,7 +327,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
if (prec == 0) {
prec = 1;
}
- num_digits = prec;
+ num_digits = prec;
}
// Print the digits of the mantissa
@@ -365,7 +365,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
if (rs == buf) {
break;
}
- rs--;
+ rs--;
}
if (*rs == '0') {
// We need to insert a 1
@@ -380,13 +380,13 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch
e_sign = '+';
}
} else {
- e++;
+ e++;
}
} else {
// Need at extra digit at the end to make room for the leading '1'
s++;
}
- char *ss = s;
+ char *ss = s;
while (ss > rs) {
*ss = ss[-1];
ss--;
diff --git a/py/mkrules.mk b/py/mkrules.mk
index 00ed27917..e66082001 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -6,7 +6,7 @@ endif
# This file expects that OBJ contains a list of all of the object files.
# The directory portion of each object file is used to locate the source
-# and should not contain any ..'s but rather be relative to the top of the
+# and should not contain any ..'s but rather be relative to the top of the
# tree.
#
# So for example, py/map.c would have an object file name py/map.o
diff --git a/py/objtype.c b/py/objtype.c
index 2a119e40f..0c0826cf9 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -375,7 +375,7 @@ STATIC mp_obj_t instance_unary_op(mp_uint_t op, mp_obj_t self_in) {
if (member[0] == MP_OBJ_NULL) {
// https://docs.python.org/3/reference/datamodel.html#object.__hash__
// "User-defined classes have __eq__() and __hash__() methods by default;
- // with them, all objects compare unequal (except with themselves) and
+ // with them, all objects compare unequal (except with themselves) and
// x.__hash__() returns an appropriate value such that x == y implies
// both that x is y and hash(x) == hash(y)."
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)self_in);
diff --git a/py/runtime.c b/py/runtime.c
index a8a1f73fa..ecc3ae2f5 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -127,7 +127,7 @@ void mp_deinit(void) {
//mp_obj_dict_free(&dict_main);
//mp_map_deinit(&MP_STATE_VM(mp_loaded_modules_map));
- // call port specific deinitialization if any
+ // call port specific deinitialization if any
#ifdef MICROPY_PORT_INIT_FUNC
MICROPY_PORT_DEINIT_FUNC;
#endif
diff --git a/stmhal/boards/common.ld b/stmhal/boards/common.ld
index fcae1b4c6..e5dea49d0 100644
--- a/stmhal/boards/common.ld
+++ b/stmhal/boards/common.ld
@@ -27,7 +27,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH_ISR
-
+
/* The program code and other data goes into FLASH */
.text :
{
@@ -40,10 +40,10 @@ SECTIONS
. = ALIGN(4);
_etext = .; /* define a global symbol at end of code */
} >FLASH_TEXT
-
+
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
-
+
/* This is the initialized data section
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH (inidata).
@@ -51,13 +51,13 @@ SECTIONS
.data :
{
. = ALIGN(4);
- _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
+ _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM AT> FLASH_TEXT
-
+
/* Uninitialized data section */
.bss :
{
diff --git a/stmhal/boards/stm32f401xd.ld b/stmhal/boards/stm32f401xd.ld
index 53aa83d53..415c25849 100644
--- a/stmhal/boards/stm32f401xd.ld
+++ b/stmhal/boards/stm32f401xd.ld
@@ -15,7 +15,7 @@ MEMORY
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32f401xe.ld b/stmhal/boards/stm32f401xe.ld
index a91eee079..a2e693b49 100644
--- a/stmhal/boards/stm32f401xe.ld
+++ b/stmhal/boards/stm32f401xe.ld
@@ -15,7 +15,7 @@ MEMORY
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32f405.ld b/stmhal/boards/stm32f405.ld
index 1a256c131..c6107913f 100644
--- a/stmhal/boards/stm32f405.ld
+++ b/stmhal/boards/stm32f405.ld
@@ -16,7 +16,7 @@ MEMORY
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32f411.ld b/stmhal/boards/stm32f411.ld
index 0b7bcb553..d156e852a 100644
--- a/stmhal/boards/stm32f411.ld
+++ b/stmhal/boards/stm32f411.ld
@@ -11,11 +11,11 @@ MEMORY
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x060000 /* sectors 5,6,7 3*128KiB = 384 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */
}
-
+
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32f429.ld b/stmhal/boards/stm32f429.ld
index 0feb5bd62..f358233a6 100644
--- a/stmhal/boards/stm32f429.ld
+++ b/stmhal/boards/stm32f429.ld
@@ -4,18 +4,18 @@
/* Specify the memory areas */
MEMORY
-{
+{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x0200000 /* entire flash, 2048 KiB */
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sector 0, 16 KiB */
FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 0x0088000 /* sectors 5,6,7,8, 4*128KiB = 512 KiB (could increase it more) */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x0030000 /* 192 KiB */
SDRAM(xrw) : ORIGIN = 0xC0000000, LENGTH = 0x0800000 /* 8 MByte */
}
-
+
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32l476xe.ld b/stmhal/boards/stm32l476xe.ld
index 114158d8c..bb9895d2a 100644
--- a/stmhal/boards/stm32l476xe.ld
+++ b/stmhal/boards/stm32l476xe.ld
@@ -4,7 +4,7 @@
/* Specify the memory areas */
MEMORY
-{
+{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sectors 0-7, 16 KiB */
FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 0x005C000 /* sectors 8-191, 368 KiB */
@@ -16,7 +16,7 @@ MEMORY
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define the top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/boards/stm32l476xg.ld b/stmhal/boards/stm32l476xg.ld
index b9c29d624..684078c43 100644
--- a/stmhal/boards/stm32l476xg.ld
+++ b/stmhal/boards/stm32l476xg.ld
@@ -4,7 +4,7 @@
/* Specify the memory areas */
MEMORY
-{
+{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 0x0004000 /* sectors 0-7, 16 KiB */
FLASH_TEXT (rx) : ORIGIN = 0x08004000, LENGTH = 0x007C000 /* sectors 8-255, 496 KiB */
@@ -18,7 +18,7 @@ ENTRY(Reset_Handler)
/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
-
+
/* Define the top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index d0d877818..f77222715 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -283,7 +283,7 @@ void i2c_init(I2C_HandleTypeDef *i2c) {
const pyb_i2c_obj_t *self = &pyb_i2c_obj[i2c_unit - 1];
dma_invalidate_channel(self->tx_dma_descr);
dma_invalidate_channel(self->rx_dma_descr);
-
+
if (0) {
#if defined(MICROPY_HW_I2C1_SCL)
} else if (i2c->Instance == I2C1) {
diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c
index c7ddbbde3..5260e0a50 100644
--- a/stmhal/sdcard.c
+++ b/stmhal/sdcard.c
@@ -216,7 +216,7 @@ void sdcard_power_off(void) {
if (!sd_handle.Instance) {
return;
}
- HAL_SD_DeInit(&sd_handle);
+ HAL_SD_DeInit(&sd_handle);
sd_handle.Instance = NULL;
}
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 39f168fc8..6513f95d3 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -1149,7 +1149,7 @@ STATIC mp_obj_t pyb_timer_period(mp_uint_t n_args, const mp_obj_t *args) {
// Reset the counter to zero. Otherwise, if counter >= period it will
// continue counting until it wraps (at either 16 or 32 bits depending
// on the timer).
- __HAL_TIM_SetCounter(&self->tim, 0);
+ __HAL_TIM_SetCounter(&self->tim, 0);
return mp_const_none;
}
}
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 735c6f168..b4ff40e79 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -656,7 +656,7 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, mp_uint_t n_args, con
self->read_buf_len = args.read_buf_len.u_int + 1; // +1 to adjust for usable length of buffer
self->read_buf = m_new(byte, self->read_buf_len << self->char_width);
__HAL_UART_ENABLE_IT(&self->uart, UART_IT_RXNE);
- HAL_NVIC_SetPriority(self->irqn, IRQ_PRI_UART, IRQ_SUBPRI_UART);
+ HAL_NVIC_SetPriority(self->irqn, IRQ_PRI_UART, IRQ_SUBPRI_UART);
HAL_NVIC_EnableIRQ(self->irqn);
}
diff --git a/tests/README b/tests/README
index b028cd062..3458f36a8 100644
--- a/tests/README
+++ b/tests/README
@@ -13,6 +13,6 @@ condition a test. The run-tests script uses small scripts in the
feature_check directory to check whether each such feature is present,
and skips the relevant tests if not.
-When creating new tests, anything that relies on float support should go in the
+When creating new tests, anything that relies on float support should go in the
float/ subdirectory. Anything that relies on import x, where x is not a built-in
module, should go in the import/ subdirectory.
diff --git a/tools/codestats.sh b/tools/codestats.sh
index c868199e1..5272f3e9c 100755
--- a/tools/codestats.sh
+++ b/tools/codestats.sh
@@ -28,9 +28,9 @@ bin_stmhal=stmhal/build-PYBV10/firmware.elf
bin_barearm_1=bare-arm/build/flash.elf
bin_barearm_2=bare-arm/build/firmware.elf
bin_minimal=minimal/build/firmware.elf
-bin_cc3200_1=cc3200/build/LAUNCHXL/application.axf
-bin_cc3200_2=cc3200/build/LAUNCHXL/release/application.axf
-bin_cc3200_3=cc3200/build/WIPY/release/application.axf
+bin_cc3200_1=cc3200/build/LAUNCHXL/application.axf
+bin_cc3200_2=cc3200/build/LAUNCHXL/release/application.axf
+bin_cc3200_3=cc3200/build/WIPY/release/application.axf
# start at zero size; if build fails reuse previous valid size
size_unix="0"
diff --git a/windows/msvc/gettimeofday.c b/windows/msvc/gettimeofday.c
index 363d59d7b..6d7264ae7 100644
--- a/windows/msvc/gettimeofday.c
+++ b/windows/msvc/gettimeofday.c
@@ -43,7 +43,7 @@ int gettimeofday(struct timeval *tp, struct timezone *tz) {
// to microseconds
ft.tm /= 10;
-
+
// convert to unix format
// number of microseconds intervals between the 1st january 1601 and the 1st january 1970 (369 years + 89 leap days)
const unsigned __int64 deltaEpoch = 11644473600000000ull;
diff --git a/windows/sleep.c b/windows/sleep.c
index 214d6d622..b8f0a2e9b 100644
--- a/windows/sleep.c
+++ b/windows/sleep.c
@@ -31,7 +31,7 @@
HANDLE waitTimer = NULL;
void init_sleep(void) {
- waitTimer = CreateWaitableTimer(NULL, TRUE, NULL);
+ waitTimer = CreateWaitableTimer(NULL, TRUE, NULL);
}
void deinit_sleep(void) {
From 46620061197e51d386c9eece6ef840d762ecad02 Mon Sep 17 00:00:00 2001
From: Alex Robbins
Date: Thu, 6 Jul 2017 18:21:27 -0500
Subject: [PATCH 170/252] esp8266/mpconfigport.h: Make socket a weak link
This way it can be overridden by a socket module in Python, as in other
ports.
---
esp8266/mpconfigport.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index f7df43577..ab5591bb7 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -162,7 +162,6 @@ extern const struct _mp_obj_module_t mp_module_onewire;
#define MICROPY_PORT_BUILTIN_MODULES \
{ MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&mp_module_lwip }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_lwip }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&network_module }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \
@@ -176,6 +175,7 @@ extern const struct _mp_obj_module_t mp_module_onewire;
{ MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_errno), (mp_obj_t)&mp_module_uerrno }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_select), (mp_obj_t)&mp_module_uselect }, \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&mp_module_lwip }, \
#define MP_STATE_PORT MP_STATE_VM
From 4368ae31424f93f3272209ea61847f2406dd23ad Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Thu, 20 Jul 2017 00:20:53 +0300
Subject: [PATCH 171/252] extmod/modussl_axtls: Allow to close ssl stream
multiple times.
Make sure that 2nd close has no effect and operations on closed streams
are handled properly.
---
extmod/modussl_axtls.c | 22 +++++++++++++++++++---
tests/extmod/ussl_basic.py | 8 ++++++++
tests/extmod/ussl_basic.py.exp | 3 ++-
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index a27f0f1fe..a5ab8896c 100644
--- a/extmod/modussl_axtls.c
+++ b/extmod/modussl_axtls.c
@@ -102,6 +102,11 @@ STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
+ if (o->ssl_sock == NULL) {
+ *errcode = EBADF;
+ return MP_STREAM_ERROR;
+ }
+
while (o->bytes_left == 0) {
mp_int_t r = ssl_read(o->ssl_sock, &o->buf);
if (r == SSL_OK) {
@@ -131,6 +136,12 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
+
+ if (o->ssl_sock == NULL) {
+ *errcode = EBADF;
+ return MP_STREAM_ERROR;
+ }
+
mp_int_t r = ssl_write(o->ssl_sock, buf, size);
if (r < 0) {
*errcode = r;
@@ -151,9 +162,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(self_in);
- ssl_free(self->ssl_sock);
- ssl_ctx_free(self->ssl_ctx);
- return mp_stream_close(self->sock);
+ if (self->ssl_sock != NULL) {
+ ssl_free(self->ssl_sock);
+ ssl_ctx_free(self->ssl_ctx);
+ self->ssl_sock = NULL;
+ return mp_stream_close(self->sock);
+ }
+
+ return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
diff --git a/tests/extmod/ussl_basic.py b/tests/extmod/ussl_basic.py
index 9f8019a0b..e8710ed51 100644
--- a/tests/extmod/ussl_basic.py
+++ b/tests/extmod/ussl_basic.py
@@ -43,6 +43,14 @@ except OSError as er:
# close
ss.close()
+# close 2nd time
+ss.close()
+
+# read on closed socket
+try:
+ ss.read(10)
+except OSError as er:
+ print('read:', repr(er))
# write on closed socket
try:
diff --git a/tests/extmod/ussl_basic.py.exp b/tests/extmod/ussl_basic.py.exp
index b4dd03860..cb9c51f7a 100644
--- a/tests/extmod/ussl_basic.py.exp
+++ b/tests/extmod/ussl_basic.py.exp
@@ -5,4 +5,5 @@ setblocking: NotImplementedError
4
b''
read: OSError(-261,)
-write: OSError(-256,)
+read: OSError(9,)
+write: OSError(9,)
From 6c1b7e008d48799c2324e8fa44acd9af365e62e2 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 21 Jul 2017 15:11:24 +1000
Subject: [PATCH 172/252] tests: Rename exec1.py to builtin_exec.py.
---
tests/basics/{exec1.py => builtin_exec.py} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename tests/basics/{exec1.py => builtin_exec.py} (100%)
diff --git a/tests/basics/exec1.py b/tests/basics/builtin_exec.py
similarity index 100%
rename from tests/basics/exec1.py
rename to tests/basics/builtin_exec.py
From bb3bddabb53e00965f9becba6df6af99c6c9bc77 Mon Sep 17 00:00:00 2001
From: Tom Collins
Date: Tue, 11 Jul 2017 15:27:42 -0700
Subject: [PATCH 173/252] py/builtinevex: Add typechecking of globals/locals
args to eval/exec.
---
py/builtinevex.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/py/builtinevex.c b/py/builtinevex.c
index d9a3833cc..4390d0cc7 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -113,12 +113,15 @@ STATIC mp_obj_t eval_exec_helper(size_t n_args, const mp_obj_t *args, mp_parse_i
// work out the context
mp_obj_dict_t *globals = mp_globals_get();
mp_obj_dict_t *locals = mp_locals_get();
- if (n_args > 1) {
- globals = MP_OBJ_TO_PTR(args[1]);
- if (n_args > 2) {
- locals = MP_OBJ_TO_PTR(args[2]);
- } else {
- locals = globals;
+ for (size_t i = 1; i < 3 && i < n_args; ++i) {
+ if (args[i] != mp_const_none) {
+ if (!MP_OBJ_IS_TYPE(args[i], &mp_type_dict)) {
+ mp_raise_TypeError(NULL);
+ }
+ locals = MP_OBJ_TO_PTR(args[i]);
+ if (i == 1) {
+ globals = locals;
+ }
}
}
From 6cfe73759707e410d48783303ada318658d21e02 Mon Sep 17 00:00:00 2001
From: Tom Collins
Date: Tue, 11 Jul 2017 15:59:05 -0700
Subject: [PATCH 174/252] tests/basics/builtin_exec: Test various
globals/locals args to exec().
---
tests/basics/builtin_exec.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/basics/builtin_exec.py b/tests/basics/builtin_exec.py
index 59de5d69a..fd4e65c53 100644
--- a/tests/basics/builtin_exec.py
+++ b/tests/basics/builtin_exec.py
@@ -4,3 +4,29 @@ print(foo())
d = {}
exec("def bar(): return 84", d)
print(d["bar"]())
+
+# passing None/dict as args to globals/locals
+foo = 11
+exec('print(foo)')
+exec('print(foo)', None)
+exec('print(foo)', {'foo':3}, None)
+exec('print(foo)', None, {'foo':3})
+exec('print(foo)', None, {'bar':3})
+exec('print(foo)', {'bar':3}, locals())
+
+try:
+ exec('print(foo)', {'bar':3}, None)
+except NameError:
+ print('NameError')
+
+# invalid arg passed to globals
+try:
+ exec('print(1)', 'foo')
+except TypeError:
+ print('TypeError')
+
+# invalid arg passed to locals
+try:
+ exec('print(1)', None, 123)
+except TypeError:
+ print('TypeError')
From 8c9e22c12740477035bd5d78e43beeb6df598588 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Mali=C5=84ski?=
Date: Wed, 19 Jul 2017 09:44:44 +0200
Subject: [PATCH 175/252] docs/pyboard/tutorial/amp_skin: Add example for
playing large WAV files.
---
docs/pyboard/tutorial/amp_skin.rst | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/docs/pyboard/tutorial/amp_skin.rst b/docs/pyboard/tutorial/amp_skin.rst
index 64f139bb7..697637f9d 100644
--- a/docs/pyboard/tutorial/amp_skin.rst
+++ b/docs/pyboard/tutorial/amp_skin.rst
@@ -69,4 +69,30 @@ Then you can do::
>>> f = wave.open('test.wav')
>>> dac.write_timed(f.readframes(f.getnframes()), f.getframerate())
-This should play the WAV file.
+This should play the WAV file. Note that this will read the whole file into RAM
+so it has to be small enough to fit in it.
+
+To play larger wave files you will have to use the micro-SD card to store it.
+Also the file must be read and sent to the DAC in small chunks that will fit
+the RAM limit of the microcontroller. Here is an example function that can
+play 8-bit wave files with up to 16kHz sampling::
+
+ import wave
+ from pyb import DAC
+ from pyb import delay
+ dac = DAC(1)
+
+ def play(filename):
+ f = wave.open(filename, 'r')
+ total_frames = f.getnframes()
+ framerate = f.getframerate()
+
+ for position in range(0, total_frames, framerate):
+ f.setpos(position)
+ dac.write_timed(f.readframes(framerate), framerate)
+ delay(1000)
+
+This function reads one second worth of data and sends it to DAC. It then waits
+one second and moves the file cursor to the new position to read the next second
+of data in the next iteration of the for-loop. It plays one second of audio at
+a time every one second.
From 6ede921731aaf6ab6c8bcbeb4e53a9ad04b2900b Mon Sep 17 00:00:00 2001
From: Peter Hinch
Date: Wed, 19 Jul 2017 16:57:42 +0100
Subject: [PATCH 176/252] eps8266/general: Add known issue of WiFi RX buffers
overflow.
---
docs/esp8266/general.rst | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/docs/esp8266/general.rst b/docs/esp8266/general.rst
index 6d186fcd2..68ed701be 100644
--- a/docs/esp8266/general.rst
+++ b/docs/esp8266/general.rst
@@ -122,3 +122,26 @@ Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
will overflow every 7:45h. If a long-term working RTC time is required then
``time()`` or ``localtime()`` must be called at least once within 7 hours.
MicroPython will then handle the overflow.
+
+Sockets and WiFi buffers overflow
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Socket instances remain active until they are explicitly closed. This has two
+consequences. Firstly they occupy RAM, so an application which opens sockets
+without closing them may eventually run out of memory. Secondly not properly
+closed socket can cause the low-level part of the vendor WiFi stack to emit
+``Lmac`` errors. This occurs if data comes in for a socket and is not
+processed in a timely manner. This can overflow the WiFi stack input queue
+and lead to a deadlock. The only recovery is by a hard reset.
+
+The above may also happen after an application terminates and quits to the REPL
+for any reason including an exception. Subsequent arrival of data provokes the
+failure with the above error message repeatedly issued. So, sockets should be
+closed in any case, regardless whether an application terminates successfully
+or by an exeption, for example using try/finally::
+
+ sock = socket(...)
+ try:
+ # Use sock
+ finally:
+ s.close()
From 205c368fa1e03e93af3b45ae08ac02f87ca866b5 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Fri, 21 Jul 2017 12:08:18 +0300
Subject: [PATCH 177/252] eps8266/general: Fix typo in recent example.
---
docs/esp8266/general.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/esp8266/general.rst b/docs/esp8266/general.rst
index 68ed701be..e23acb469 100644
--- a/docs/esp8266/general.rst
+++ b/docs/esp8266/general.rst
@@ -144,4 +144,4 @@ or by an exeption, for example using try/finally::
try:
# Use sock
finally:
- s.close()
+ sock.close()
From a6bec531771f2e2103148ed98dc96d4ce90e44e1 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 19 Jul 2017 12:21:52 +1000
Subject: [PATCH 178/252] minimal/Makefile: Enable gc-sections to remove unused
code.
---
minimal/Makefile | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/minimal/Makefile b/minimal/Makefile
index d61515797..994d26880 100644
--- a/minimal/Makefile
+++ b/minimal/Makefile
@@ -22,23 +22,21 @@ DFU = ../tools/dfu.py
PYDFU = ../tools/pydfu.py
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
+LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
else
+LD = gcc
CFLAGS = -m32 $(INC) -Wall -Werror -std=c99 $(COPT)
+LDFLAGS = -m32 -Wl,-Map=$@.map,--cref -Wl,--gc-sections
endif
-#Debugging/Optimization
+# Tune for Debugging or Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -ggdb
else
CFLAGS += -Os -DNDEBUG
+CFLAGS += -fdata-sections -ffunction-sections
endif
-ifeq ($(CROSS), 1)
-LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref
-else
-LD = gcc
-LDFLAGS = -m32 -Wl,-Map=$@.map,--cref
-endif
LIBS =
SRC_C = \
From 71173cd57de9fc0a84c899e9f1d1e00c8910ade2 Mon Sep 17 00:00:00 2001
From: Alexander Steffen
Date: Sat, 15 Jul 2017 11:39:05 +0200
Subject: [PATCH 179/252] cc3200: Use the name MicroPython consistently in
code.
In a few places the cc3200 port uses the incorrect spelling Micropython
instead of MicroPython.
---
cc3200/ftp/ftp.c | 2 +-
cc3200/main.c | 2 +-
cc3200/mptask.c | 2 +-
cc3200/mptask.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cc3200/ftp/ftp.c b/cc3200/ftp/ftp.c
index 1febe291f..b56e3f4ce 100644
--- a/cc3200/ftp/ftp.c
+++ b/cc3200/ftp/ftp.c
@@ -335,7 +335,7 @@ void ftp_run (void) {
ftp_data.loggin.uservalid = false;
ftp_data.loggin.passvalid = false;
strcpy (ftp_path, "/");
- ftp_send_reply (220, "Micropython FTP Server");
+ ftp_send_reply (220, "MicroPython FTP Server");
break;
}
}
diff --git a/cc3200/main.c b/cc3200/main.c
index 7c6c4b545..1ffb98188 100644
--- a/cc3200/main.c
+++ b/cc3200/main.c
@@ -89,7 +89,7 @@ int main (void) {
#ifndef DEBUG
OsiTaskHandle mpTaskHandle;
#endif
- mpTaskHandle = xTaskCreateStatic(TASK_Micropython, "MicroPy",
+ mpTaskHandle = xTaskCreateStatic(TASK_MicroPython, "MicroPy",
MICROPY_TASK_STACK_LEN, NULL, MICROPY_TASK_PRIORITY, mpTaskStack, &mpTaskTCB);
ASSERT(mpTaskHandle != NULL);
diff --git a/cc3200/mptask.c b/cc3200/mptask.c
index d446711a2..50c3c769d 100644
--- a/cc3200/mptask.c
+++ b/cc3200/mptask.c
@@ -112,7 +112,7 @@ static const char fresh_boot_py[] = "# boot.py -- run on boot-up\r\n"
DECLARE PUBLIC FUNCTIONS
******************************************************************************/
-void TASK_Micropython (void *pvParameters) {
+void TASK_MicroPython (void *pvParameters) {
// get the top of the stack to initialize the garbage collector
uint32_t sp = gc_helper_get_sp();
diff --git a/cc3200/mptask.h b/cc3200/mptask.h
index 9276cfc3e..5345ecfda 100644
--- a/cc3200/mptask.h
+++ b/cc3200/mptask.h
@@ -41,6 +41,6 @@ extern StackType_t mpTaskStack[];
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
******************************************************************************/
-extern void TASK_Micropython (void *pvParameters);
+extern void TASK_MicroPython (void *pvParameters);
#endif // MICROPY_INCLUDED_CC3200_MPTASK_H
From 7901741bf192cb239bb6b5f76464432852bc8e25 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 22 Jul 2017 17:12:15 +0300
Subject: [PATCH 180/252] tools/pyboard: Add license header.
---
tools/pyboard.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/pyboard.py b/tools/pyboard.py
index 921ffc52d..d15f520ac 100755
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -1,4 +1,28 @@
#!/usr/bin/env python
+#
+# This file is part of the MicroPython project, http://micropython.org/
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2014-2016 Damien P. George
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
"""
pyboard interface
From d003daee06d0547c496169fcc306ed82082e34be Mon Sep 17 00:00:00 2001
From: Matthew Brener
Date: Sun, 23 Jul 2017 22:53:34 +1000
Subject: [PATCH 181/252] docs/esp8266/tutorial: Fix typo, "its" to "it's" in
powerctrl.rst.
---
docs/esp8266/tutorial/powerctrl.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/esp8266/tutorial/powerctrl.rst b/docs/esp8266/tutorial/powerctrl.rst
index 9e44339c8..3502624ab 100644
--- a/docs/esp8266/tutorial/powerctrl.rst
+++ b/docs/esp8266/tutorial/powerctrl.rst
@@ -22,7 +22,7 @@ processing power, at the expense of current consumption::
160000000
You can change to the higher frequency just while your code does the heavy
-processing and then change back when its finished.
+processing and then change back when it's finished.
Deep-sleep mode
---------------
From 513dfcf4fe3277fa1cb1e383db0b60e4a3fc843b Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 24 Jul 2017 15:07:48 +1000
Subject: [PATCH 182/252] extmod/modussl_mbedtls: Support server_side mode.
To use server_side mode one must pass valid values in the "key" and "cert"
parameters.
---
extmod/modussl_mbedtls.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index 40dd8c049..ad29666ae 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -128,7 +128,7 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
}
ret = mbedtls_ssl_config_defaults(&o->conf,
- MBEDTLS_SSL_IS_CLIENT,
+ args->server_side.u_bool ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT);
if (ret != 0) {
@@ -172,15 +172,11 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
assert(ret == 0);
}
- if (args->server_side.u_bool) {
- assert(0);
- } else {
- while ((ret = mbedtls_ssl_handshake(&o->ssl)) != 0) {
- if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
- //assert(0);
- printf("mbedtls_ssl_handshake error: -%x\n", -ret);
- mp_raise_OSError(MP_EIO);
- }
+ while ((ret = mbedtls_ssl_handshake(&o->ssl)) != 0) {
+ if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
+ //assert(0);
+ printf("mbedtls_ssl_handshake error: -%x\n", -ret);
+ mp_raise_OSError(MP_EIO);
}
}
From 1ed3356540f55c9ed4167c87166f6d18b2868f9c Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 24 Jul 2017 15:50:47 +1000
Subject: [PATCH 183/252] py/py.mk: Make berkeley-db C-defs apply only to
relevant source files.
Otherwise they can interfere (eg redefinition of "abort") with other source
files in a given uPy port.
---
py/py.mk | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/py/py.mk b/py/py.mk
index 70891677d..02f2df8e1 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -74,7 +74,7 @@ endif
ifeq ($(MICROPY_PY_BTREE),1)
BTREE_DIR = lib/berkeley-db-1.xx
-CFLAGS_MOD += -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER="
+BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER="
INC += -I../$(BTREE_DIR)/PORT/include
SRC_MOD += extmod/modbtree.c
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
@@ -95,7 +95,9 @@ mpool/mpool.c \
)
CFLAGS_MOD += -DMICROPY_PY_BTREE=1
# we need to suppress certain warnings to get berkeley-db to compile cleanly
-$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter
+# and we have separate BTREE_DEFS so the definitions don't interfere with other source code
+$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
+$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
endif
# py object files
From a559098fecd0a0e2aa98d2a8b3b6ba080b4e096f Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 24 Jul 2017 18:41:24 +1000
Subject: [PATCH 184/252] py/mperrno: Allow mperrno.h to be correctly included
before other hdrs.
Before this patch the mperrno.h file could be included and would silently
succeed with incorrect config settings, because mpconfig.h was not yet
included.
---
py/mperrno.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/py/mperrno.h b/py/mperrno.h
index c515ed488..f439f6555 100644
--- a/py/mperrno.h
+++ b/py/mperrno.h
@@ -26,6 +26,8 @@
#ifndef MICROPY_INCLUDED_PY_MPERRNO_H
#define MICROPY_INCLUDED_PY_MPERRNO_H
+#include "py/mpconfig.h"
+
#if MICROPY_USE_INTERNAL_ERRNO
// MP_Exxx errno's are defined directly as numeric values
@@ -138,7 +140,11 @@
#endif
#if MICROPY_PY_UERRNO
+
+#include "py/obj.h"
+
qstr mp_errno_to_str(mp_obj_t errno_val);
+
#endif
#endif // MICROPY_INCLUDED_PY_MPERRNO_H
From aa7be82a4dff59b22763abbe1bd5e74c0e37b453 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 24 Jul 2017 18:43:14 +1000
Subject: [PATCH 185/252] all: Don't include system errno.h when it's not
needed.
---
cc3200/mods/pybuart.c | 1 -
extmod/modbtree.c | 2 +-
extmod/modussl_axtls.c | 1 -
extmod/modussl_mbedtls.c | 1 -
extmod/modwebrepl.c | 1 -
extmod/modwebsocket.c | 5 ++---
extmod/uos_dupterm.c | 1 -
extmod/vfs_fat_file.c | 1 -
mpy-cross/main.c | 1 -
py/reader.c | 1 -
10 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index 92bb3e46e..06938bdd4 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -27,7 +27,6 @@
#include
#include
-#include
#include
#include "py/mpconfig.h"
diff --git a/extmod/modbtree.c b/extmod/modbtree.c
index 127dd71a3..229daaf0f 100644
--- a/extmod/modbtree.c
+++ b/extmod/modbtree.c
@@ -26,7 +26,7 @@
#include
#include
-#include
+#include // for declaration of global errno variable
#include
#include "py/nlr.h"
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index a5ab8896c..be1aa0359 100644
--- a/extmod/modussl_axtls.c
+++ b/extmod/modussl_axtls.c
@@ -26,7 +26,6 @@
#include
#include
-#include
#include "py/nlr.h"
#include "py/runtime.h"
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index ad29666ae..f4b551cb9 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -29,7 +29,6 @@
#include
#include
-#include
#include "py/nlr.h"
#include "py/runtime.h"
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index ce3c7dcbd..9e3f16fe7 100644
--- a/extmod/modwebrepl.c
+++ b/extmod/modwebrepl.c
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include "py/nlr.h"
#include "py/obj.h"
diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c
index 9e17d6a6d..6c6e32c1a 100644
--- a/extmod/modwebsocket.c
+++ b/extmod/modwebsocket.c
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include "py/nlr.h"
#include "py/obj.h"
@@ -88,7 +87,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
self->buf_pos += out_sz;
self->to_recv -= out_sz;
if (self->to_recv != 0) {
- *errcode = EAGAIN;
+ *errcode = MP_EAGAIN;
return MP_STREAM_ERROR;
}
}
@@ -267,7 +266,7 @@ STATIC mp_uint_t websocket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t
return cur;
}
default:
- *errcode = EINVAL;
+ *errcode = MP_EINVAL;
return MP_STREAM_ERROR;
}
}
diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c
index d888099df..29a62ab89 100644
--- a/extmod/uos_dupterm.c
+++ b/extmod/uos_dupterm.c
@@ -24,7 +24,6 @@
* THE SOFTWARE.
*/
-#include
#include
#include "py/mpconfig.h"
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index edffa37c7..22907c12a 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -28,7 +28,6 @@
#if MICROPY_VFS && MICROPY_VFS_FAT
#include
-#include
#include "py/nlr.h"
#include "py/runtime.h"
diff --git a/mpy-cross/main.c b/mpy-cross/main.c
index 4c88c7222..ca8d9633f 100644
--- a/mpy-cross/main.c
+++ b/mpy-cross/main.c
@@ -28,7 +28,6 @@
#include
#include
#include
-#include
#include "py/mpstate.h"
#include "py/compile.h"
diff --git a/py/reader.c b/py/reader.c
index 5df45c495..c4d18d53d 100644
--- a/py/reader.c
+++ b/py/reader.c
@@ -71,7 +71,6 @@ void mp_reader_new_mem(mp_reader_t *reader, const byte *buf, size_t len, size_t
#include
#include
#include
-#include
typedef struct _mp_reader_posix_t {
bool close_fd;
From 4d1fb6107fdedb0dda8dfb1491c033bf731222c6 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 25 Jul 2017 11:32:04 +1000
Subject: [PATCH 186/252] py/mpz: Make mpz_is_zero() an inline function.
It's more efficient as an inline function, and saves code size.
---
py/mpz.c | 4 ----
py/mpz.h | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/py/mpz.c b/py/mpz.c
index f5675a291..80473df88 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -939,10 +939,6 @@ void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf)
z->len = mpn_remove_trailing_zeros(z->dig, z->dig + z->len);
}
-bool mpz_is_zero(const mpz_t *z) {
- return z->len == 0;
-}
-
#if 0
these functions are unused
diff --git a/py/mpz.h b/py/mpz.h
index 878febf8b..2ff404ffa 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -111,7 +111,7 @@ void mpz_set_from_float(mpz_t *z, mp_float_t src);
size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigned int base);
void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf);
-bool mpz_is_zero(const mpz_t *z);
+static inline bool mpz_is_zero(const mpz_t *z) { return z->len == 0; }
int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs);
void mpz_abs_inpl(mpz_t *dest, const mpz_t *z);
From 04552ff71b6c722b21597d93481f024c72457cef Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 25 Jul 2017 11:49:22 +1000
Subject: [PATCH 187/252] py: Implement raising a big-int to a negative power.
Before this patch raising a big-int to a negative power would just return
0. Now it returns a floating-point number with the correct value.
---
py/mpz.c | 4 ----
py/mpz.h | 1 +
py/objint_longlong.c | 7 +++++++
py/objint_mpz.c | 7 +++++++
tests/float/int_big_float.py | 4 ++++
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/py/mpz.c b/py/mpz.c
index 80473df88..f58e262e2 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -946,10 +946,6 @@ bool mpz_is_pos(const mpz_t *z) {
return z->len > 0 && z->neg == 0;
}
-bool mpz_is_neg(const mpz_t *z) {
- return z->len > 0 && z->neg != 0;
-}
-
bool mpz_is_odd(const mpz_t *z) {
return z->len > 0 && (z->dig[0] & 1) != 0;
}
diff --git a/py/mpz.h b/py/mpz.h
index 2ff404ffa..55967cc4c 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -112,6 +112,7 @@ size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigne
void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf);
static inline bool mpz_is_zero(const mpz_t *z) { return z->len == 0; }
+static inline bool mpz_is_neg(const mpz_t *z) { return z->len != 0 && z->neg != 0; }
int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs);
void mpz_abs_inpl(mpz_t *dest, const mpz_t *z);
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index eb80407bc..1d184a7dc 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -191,6 +191,13 @@ mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
case MP_BINARY_OP_POWER:
case MP_BINARY_OP_INPLACE_POWER: {
+ if (rhs_val < 0) {
+ #if MICROPY_PY_BUILTINS_FLOAT
+ return mp_obj_float_binary_op(op, lhs_val, rhs_in);
+ #else
+ mp_raise_ValueError("negative power with no float support");
+ #endif
+ }
long long ans = 1;
while (rhs_val > 0) {
if (rhs_val & 1) {
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index d818b6f40..26492aab4 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -290,6 +290,13 @@ mp_obj_t mp_obj_int_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
case MP_BINARY_OP_POWER:
case MP_BINARY_OP_INPLACE_POWER:
+ if (mpz_is_neg(zrhs)) {
+ #if MICROPY_PY_BUILTINS_FLOAT
+ return mp_obj_float_binary_op(op, mpz_as_float(zlhs), rhs_in);
+ #else
+ mp_raise_ValueError("negative power with no float support");
+ #endif
+ }
mpz_pow_inpl(&res->mpz, zlhs, zrhs);
break;
diff --git a/tests/float/int_big_float.py b/tests/float/int_big_float.py
index b1a26ca73..0bd166218 100644
--- a/tests/float/int_big_float.py
+++ b/tests/float/int_big_float.py
@@ -18,6 +18,10 @@ print("%.5g" % (i / 1.2))
# this should delegate to complex
print("%.5g" % (i * 1.2j).imag)
+# negative power should produce float
+print("%.5g" % (i ** -1))
+print("%.5g" % ((2 + i - i) ** -3))
+
try:
i / 0
except ZeroDivisionError:
From a10467b58ab92352217c7ab42eafd320bb671565 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 3 Mar 2017 15:46:23 +1100
Subject: [PATCH 188/252] extmod/modussl_mbedtls: When reading and peer wants
to close, return 0.
If this particular code is returned then there's no more data, it's not
really an error.
---
extmod/modussl_mbedtls.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index f4b551cb9..ef3f319fe 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -192,6 +192,10 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
int ret = mbedtls_ssl_read(&o->ssl, buf, size);
+ if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
+ // end of stream
+ return 0;
+ }
if (ret >= 0) {
return ret;
}
From 363087aa11a5121ecff38f9e3a2372a42fa224ac Mon Sep 17 00:00:00 2001
From: Radomir Dopieralski
Date: Mon, 24 Jul 2017 12:58:30 +0200
Subject: [PATCH 189/252] extmod/modframebuf: Fix invalid stride for odd widths
in GS4_HMSB fmt.
Since the stride is specified in pixels, in a 4-bit horizontal format it
has to always be even, otherwise the computation is wrong and we can
write outside of the buffer sometimes.
---
extmod/modframebuf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 062a63c3b..00a48379b 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -237,12 +237,14 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size
switch (o->format) {
case FRAMEBUF_MVLSB:
case FRAMEBUF_RGB565:
- case FRAMEBUF_GS4_HMSB:
break;
case FRAMEBUF_MHLSB:
case FRAMEBUF_MHMSB:
o->stride = (o->stride + 7) & ~7;
break;
+ case FRAMEBUF_GS4_HMSB:
+ o->stride = (o->stride + 1) & ~1;
+ break;
default:
mp_raise_ValueError("invalid format");
}
From 0893b273b9471acb02510820f61753501dc04219 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 25 Jul 2017 14:00:45 +1000
Subject: [PATCH 190/252] extmod/modussl_mbedtls: Make socket.close() free all
TLS resources.
Also, use mp_stream_close() helper to close the underlying socket.
---
extmod/modussl_mbedtls.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index ef3f319fe..8c90c2cf4 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -227,15 +227,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(self_in);
+ mbedtls_pk_free(&self->pkey);
+ mbedtls_x509_crt_free(&self->cert);
mbedtls_x509_crt_free(&self->cacert);
mbedtls_ssl_free(&self->ssl);
mbedtls_ssl_config_free(&self->conf);
mbedtls_ctr_drbg_free(&self->ctr_drbg);
mbedtls_entropy_free(&self->entropy);
- mp_obj_t dest[2];
- mp_load_method(self->sock, MP_QSTR_close, dest);
- return mp_call_method_n_kw(0, 0, dest);
+ return mp_stream_close(self->sock);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
From f3687109d56793b73288e081a5f4ad6884ded28d Mon Sep 17 00:00:00 2001
From: Damien George
Date: Tue, 25 Jul 2017 14:06:44 +1000
Subject: [PATCH 191/252] extmod/modframebuf: Consistently use "col" as name
for colour variables.
Thanks to @kamikaze, aka Oleg Korsak, for the original idea and patch.
---
extmod/modframebuf.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 00a48379b..779214bb7 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -62,10 +62,10 @@ typedef struct _mp_framebuf_p_t {
// Functions for MHLSB and MHMSB
-STATIC void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) {
+STATIC void mono_horiz_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
size_t index = (x + y * fb->stride) >> 3;
int offset = fb->format == FRAMEBUF_MHMSB ? x & 0x07 : 7 - (x & 0x07);
- ((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((color != 0) << offset);
+ ((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
STATIC uint32_t mono_horiz_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
@@ -90,10 +90,10 @@ STATIC void mono_horiz_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int
// Functions for MVLSB format
-STATIC void mvlsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) {
+STATIC void mvlsb_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
size_t index = (y >> 3) * fb->stride + x;
uint8_t offset = y & 0x07;
- ((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((color != 0) << offset);
+ ((uint8_t*)fb->buf)[index] = (((uint8_t*)fb->buf)[index] & ~(0x01 << offset)) | ((col != 0) << offset);
}
STATIC uint32_t mvlsb_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
@@ -114,19 +114,19 @@ STATIC void mvlsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, in
// Functions for RGB565 format
-STATIC void rgb565_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) {
- ((uint16_t*)fb->buf)[x + y * fb->stride] = color;
+STATIC void rgb565_setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
+ ((uint16_t*)fb->buf)[x + y * fb->stride] = col;
}
STATIC uint32_t rgb565_getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
return ((uint16_t*)fb->buf)[x + y * fb->stride];
}
-STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t colour) {
+STATIC void rgb565_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, uint32_t col) {
uint16_t *b = &((uint16_t*)fb->buf)[x + y * fb->stride];
while (h--) {
for (int ww = w; ww; --ww) {
- *b++ = colour;
+ *b++ = col;
}
b += fb->stride - w;
}
@@ -156,7 +156,7 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
col &= 0x0f;
uint8_t *pixel_pair = &((uint8_t*)fb->buf)[(x + y * fb->stride) >> 1];
uint8_t col_shifted_left = col << 4;
- uint8_t colored_pixel_pair = col_shifted_left | col;
+ uint8_t col_pixel_pair = col_shifted_left | col;
int pixel_count_till_next_line = (fb->stride - w) >> 1;
bool odd_x = (x % 2 == 1);
@@ -169,7 +169,7 @@ STATIC void gs4_hmsb_fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w,
ww--;
}
- memset(pixel_pair, colored_pixel_pair, ww >> 1);
+ memset(pixel_pair, col_pixel_pair, ww >> 1);
pixel_pair += ww >> 1;
if (ww % 2) {
@@ -191,8 +191,8 @@ STATIC mp_framebuf_p_t formats[] = {
[FRAMEBUF_MHMSB] = {mono_horiz_setpixel, mono_horiz_getpixel, mono_horiz_fill_rect},
};
-static inline void setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t color) {
- formats[fb->format].setpixel(fb, x, y, color);
+static inline void setpixel(const mp_obj_framebuf_t *fb, int x, int y, uint32_t col) {
+ formats[fb->format].setpixel(fb, x, y, col);
}
static inline uint32_t getpixel(const mp_obj_framebuf_t *fb, int x, int y) {
@@ -277,9 +277,9 @@ STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t width = mp_obj_get_int(args[3]);
mp_int_t height = mp_obj_get_int(args[4]);
- mp_int_t color = mp_obj_get_int(args[5]);
+ mp_int_t col = mp_obj_get_int(args[5]);
- fill_rect(self, x, y, width, height, color);
+ fill_rect(self, x, y, width, height, col);
return mp_const_none;
}
@@ -444,14 +444,13 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
int y1 = MAX(0, -y);
int x0end = MIN(self->width, x + source->width);
int y0end = MIN(self->height, y + source->height);
- uint32_t color;
for (; y0 < y0end; ++y0) {
int cx1 = x1;
for (int cx0 = x0; cx0 < x0end; ++cx0) {
- color = getpixel(source, cx1, y1);
- if (color != (uint32_t)key) {
- setpixel(self, cx0, y0, color);
+ uint32_t col = getpixel(source, cx1, y1);
+ if (col != (uint32_t)key) {
+ setpixel(self, cx0, y0, col);
}
++cx1;
}
From 6b4d4a25ceb1b3f016f9e4954bc630e6a0b7167f Mon Sep 17 00:00:00 2001
From: Eric Poulsen
Date: Fri, 21 Jul 2017 10:30:35 -0700
Subject: [PATCH 192/252] extmod/modussl_mbedtls: Implement non-blocking SSL
sockets.
---
extmod/modussl_mbedtls.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index 8c90c2cf4..597eaee73 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -29,6 +29,7 @@
#include
#include
+#include // needed because mp_is_nonblocking_error uses system error codes
#include "py/nlr.h"
#include "py/runtime.h"
@@ -83,6 +84,9 @@ int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
int out_sz = sock_stream->write(sock, buf, len, &err);
if (out_sz == MP_STREAM_ERROR) {
+ if (mp_is_nonblocking_error(err)) {
+ return MBEDTLS_ERR_SSL_WANT_WRITE;
+ }
return -err;
} else {
return out_sz;
@@ -97,6 +101,9 @@ int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
int out_sz = sock_stream->read(sock, buf, len, &err);
if (out_sz == MP_STREAM_ERROR) {
+ if (mp_is_nonblocking_error(err)) {
+ return MBEDTLS_ERR_SSL_WANT_READ;
+ }
return -err;
} else {
return out_sz;
@@ -199,6 +206,9 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
if (ret >= 0) {
return ret;
}
+ if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
+ ret = MP_EWOULDBLOCK;
+ }
*errcode = ret;
return MP_STREAM_ERROR;
}
@@ -210,17 +220,20 @@ STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
if (ret >= 0) {
return ret;
}
+ if (ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
+ ret = MP_EWOULDBLOCK;
+ }
*errcode = ret;
return MP_STREAM_ERROR;
}
STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
- // Currently supports only blocking mode
- (void)self_in;
- if (!mp_obj_is_true(flag_in)) {
- mp_not_implemented("");
- }
- return mp_const_none;
+ mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(self_in);
+ mp_obj_t sock = o->sock;
+ mp_obj_t dest[3];
+ mp_load_method(sock, MP_QSTR_setblocking, dest);
+ dest[2] = flag_in;
+ return mp_call_method_n_kw(1, 0, dest);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
From 653a0c2d71100998a9cce0b7e2eb29ce54014aab Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 26 Jul 2017 12:51:46 +1000
Subject: [PATCH 193/252] extmod/machine_signal: Fix parsing of invert arg when
Pin is first arg.
---
extmod/machine_signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extmod/machine_signal.c b/extmod/machine_signal.c
index d08931296..78d0c3fee 100644
--- a/extmod/machine_signal.c
+++ b/extmod/machine_signal.c
@@ -96,7 +96,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
if (n_args == 1) {
if (n_kw == 0) {
} else if (n_kw == 1 && args[1] == MP_OBJ_NEW_QSTR(MP_QSTR_invert)) {
- invert = mp_obj_is_true(args[1]);
+ invert = mp_obj_is_true(args[2]);
} else {
goto error;
}
From a3cd349eafb2f612379f10c45ab1ad4175e322e2 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Thu, 27 Jul 2017 14:41:27 +0300
Subject: [PATCH 194/252] tools/mpy_bin2res: Tools to convert binary resources
to Python module.
Afterwards, they can be access using pkg_resource module from
micropython-lib.
---
tools/mpy_bin2res.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100755 tools/mpy_bin2res.py
diff --git a/tools/mpy_bin2res.py b/tools/mpy_bin2res.py
new file mode 100755
index 000000000..0c89e7e92
--- /dev/null
+++ b/tools/mpy_bin2res.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+#
+# This tool converts binary resource files passed on the command line
+# into a Python source file containing data from these files, which can
+# be accessed using standard pkg_resources.resource_stream() function
+# from micropython-lib:
+# https://github.com/micropython/micropython-lib/tree/master/pkg_resources
+#
+import sys
+
+print("R = {")
+
+for fname in sys.argv[1:]:
+ with open(fname, "rb") as f:
+ b = f.read()
+ print("%r: %r," % (fname, b))
+
+print("}")
From f578947ae3fee5610c5bc1123baf878b92eaa248 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Fri, 28 Jul 2017 17:24:31 +0300
Subject: [PATCH 195/252] .travis.yml: Pin cpp-coveralls at 0.3.12.
Next version, 0.4.0 appears to depend on newer version of urllib3 and
conflicts with version installed in Travis.
---
.travis.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index 9915cdd00..14d5df0a4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,7 +20,8 @@ before_script:
# For teensy build
- sudo apt-get install realpath
# For coverage testing
- - sudo pip install cpp-coveralls
+ # cpp-coveralls 0.4 conflicts with urllib3 preinstalled in Travis VM
+ - sudo pip install cpp-coveralls==0.3.12
- gcc --version
- arm-none-eabi-gcc --version
- python3 --version
From 456450437fc572d0296d52be0035e135ab6814d8 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Fri, 28 Jul 2017 21:41:42 +0300
Subject: [PATCH 196/252] py/modio: BufferedWriter: Convert to
mp_rom_map_elem_t.
---
py/modio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/py/modio.c b/py/modio.c
index 2d317d022..a6a093278 100644
--- a/py/modio.c
+++ b/py/modio.c
@@ -112,9 +112,9 @@ STATIC mp_obj_t bufwriter_flush(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bufwriter_flush_obj, bufwriter_flush);
-STATIC const mp_map_elem_t bufwriter_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flush), (mp_obj_t)&bufwriter_flush_obj },
+STATIC const mp_rom_map_elem_t bufwriter_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&bufwriter_flush_obj) },
};
STATIC MP_DEFINE_CONST_DICT(bufwriter_locals_dict, bufwriter_locals_dict_table);
@@ -127,7 +127,7 @@ STATIC const mp_obj_type_t bufwriter_type = {
.name = MP_QSTR_BufferedWriter,
.make_new = bufwriter_make_new,
.protocol = &bufwriter_stream_p,
- .locals_dict = (mp_obj_t)&bufwriter_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&bufwriter_locals_dict,
};
#endif // MICROPY_PY_IO_BUFFEREDWRITER
From 036b58228c36ea971ec80ee4df875d858eacdfb3 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 29 Jul 2017 10:26:41 +0300
Subject: [PATCH 197/252] extmod/modframebuf: Use correct initialization for
.locals_dict.
---
extmod/modframebuf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index 779214bb7..d3318899a 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -549,7 +549,7 @@ STATIC const mp_obj_type_t mp_type_framebuf = {
.name = MP_QSTR_FrameBuffer,
.make_new = framebuf_make_new,
.buffer_p = { .get_buffer = framebuf_get_buffer },
- .locals_dict = (mp_obj_t)&framebuf_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&framebuf_locals_dict,
};
// this factory function is provided for backwards compatibility with old FrameBuffer1 class
From f2140f94466f043677d58352bbecbdbe98e82d20 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 29 Jul 2017 18:09:33 +0300
Subject: [PATCH 198/252] extmod/mod{lwip,onewire,webrepl}: Convert to
mp_rom_map_elem_t.
---
extmod/modlwip.c | 82 ++++++++++++++++++++++-----------------------
extmod/modonewire.c | 14 ++++----
extmod/modwebrepl.c | 20 +++++------
3 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 01190d200..48b4190e9 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 2013, 2014 Damien P. George
* Copyright (c) 2015 Galen Hazelwood
- * Copyright (c) 2015-2016 Paul Sokolovsky
+ * Copyright (c) 2015-2017 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -148,8 +148,8 @@ STATIC mp_obj_t lwip_slip_status(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(lwip_slip_status_obj, lwip_slip_status);
-STATIC const mp_map_elem_t lwip_slip_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_status), (mp_obj_t)&lwip_slip_status_obj },
+STATIC const mp_rom_map_elem_t lwip_slip_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&lwip_slip_status_obj) },
};
STATIC MP_DEFINE_CONST_DICT(lwip_slip_locals_dict, lwip_slip_locals_dict_table);
@@ -158,7 +158,7 @@ STATIC const mp_obj_type_t lwip_slip_type = {
{ &mp_type_type },
.name = MP_QSTR_slip,
.make_new = lwip_slip_make_new,
- .locals_dict = (mp_obj_t)&lwip_slip_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&lwip_slip_locals_dict,
};
#endif // MICROPY_PY_LWIP_SLIP
@@ -1160,27 +1160,27 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_
return ret;
}
-STATIC const mp_map_elem_t lwip_socket_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___del__), (mp_obj_t)&lwip_socket_close_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&lwip_socket_close_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_bind), (mp_obj_t)&lwip_socket_bind_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_listen), (mp_obj_t)&lwip_socket_listen_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_accept), (mp_obj_t)&lwip_socket_accept_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&lwip_socket_connect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_send), (mp_obj_t)&lwip_socket_send_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&lwip_socket_recv_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sendto), (mp_obj_t)&lwip_socket_sendto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_recvfrom), (mp_obj_t)&lwip_socket_recvfrom_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sendall), (mp_obj_t)&lwip_socket_sendall_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_settimeout), (mp_obj_t)&lwip_socket_settimeout_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_setblocking), (mp_obj_t)&lwip_socket_setblocking_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_setsockopt), (mp_obj_t)&lwip_socket_setsockopt_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_makefile), (mp_obj_t)&lwip_socket_makefile_obj },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
- { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
+STATIC const mp_rom_map_elem_t lwip_socket_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&lwip_socket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&lwip_socket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&lwip_socket_bind_obj) },
+ { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&lwip_socket_listen_obj) },
+ { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&lwip_socket_accept_obj) },
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&lwip_socket_connect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&lwip_socket_send_obj) },
+ { MP_ROM_QSTR(MP_QSTR_recv), MP_ROM_PTR(&lwip_socket_recv_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&lwip_socket_sendto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_recvfrom), MP_ROM_PTR(&lwip_socket_recvfrom_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&lwip_socket_sendall_obj) },
+ { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&lwip_socket_settimeout_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&lwip_socket_setblocking_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&lwip_socket_setsockopt_obj) },
+ { MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&lwip_socket_makefile_obj) },
+
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
+ { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
};
STATIC MP_DEFINE_CONST_DICT(lwip_socket_locals_dict, lwip_socket_locals_dict_table);
@@ -1196,7 +1196,7 @@ STATIC const mp_obj_type_t lwip_socket_type = {
.print = lwip_socket_print,
.make_new = lwip_socket_make_new,
.protocol = &lwip_socket_stream_p,
- .locals_dict = (mp_obj_t)&lwip_socket_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&lwip_socket_locals_dict,
};
/******************************************************************************/
@@ -1321,27 +1321,27 @@ MP_DEFINE_CONST_FUN_OBJ_0(lwip_print_pcbs_obj, lwip_print_pcbs);
#ifdef MICROPY_PY_LWIP
-STATIC const mp_map_elem_t mp_module_lwip_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_lwip) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&mod_lwip_reset_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_callback), (mp_obj_t)&mod_lwip_callback_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&lwip_getaddrinfo_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_print_pcbs), (mp_obj_t)&lwip_print_pcbs_obj },
+STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_lwip) },
+ { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&mod_lwip_reset_obj) },
+ { MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&mod_lwip_callback_obj) },
+ { MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&lwip_getaddrinfo_obj) },
+ { MP_ROM_QSTR(MP_QSTR_print_pcbs), MP_ROM_PTR(&lwip_print_pcbs_obj) },
// objects
- { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&lwip_socket_type },
+ { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&lwip_socket_type) },
#ifdef MICROPY_PY_LWIP_SLIP
- { MP_OBJ_NEW_QSTR(MP_QSTR_slip), (mp_obj_t)&lwip_slip_type },
+ { MP_ROM_QSTR(MP_QSTR_slip), MP_ROM_PTR(&lwip_slip_type) },
#endif
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_AF_INET), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AF_INET6), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET6) },
+ { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET) },
+ { MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET6) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_STREAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_STREAM) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_DGRAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_DGRAM) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_RAW), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_RAW) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_STREAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_DGRAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_RAW) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOL_SOCKET), MP_OBJ_NEW_SMALL_INT(1) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SO_REUSEADDR), MP_OBJ_NEW_SMALL_INT(SOF_REUSEADDR) },
+ { MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_OBJ_NEW_SMALL_INT(1) },
+ { MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_OBJ_NEW_SMALL_INT(SOF_REUSEADDR) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table);
diff --git a/extmod/modonewire.c b/extmod/modonewire.c
index 8583cc1c2..53c9456c2 100644
--- a/extmod/modonewire.c
+++ b/extmod/modonewire.c
@@ -143,15 +143,15 @@ STATIC mp_obj_t onewire_crc8(mp_obj_t data) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(onewire_crc8_obj, onewire_crc8);
-STATIC const mp_map_elem_t onewire_module_globals_table[] = {
+STATIC const mp_rom_map_elem_t onewire_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewire) },
- { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR((mp_obj_t)&onewire_reset_obj) },
- { MP_ROM_QSTR(MP_QSTR_readbit), MP_ROM_PTR((mp_obj_t)&onewire_readbit_obj) },
- { MP_ROM_QSTR(MP_QSTR_readbyte), MP_ROM_PTR((mp_obj_t)&onewire_readbyte_obj) },
- { MP_ROM_QSTR(MP_QSTR_writebit), MP_ROM_PTR((mp_obj_t)&onewire_writebit_obj) },
- { MP_ROM_QSTR(MP_QSTR_writebyte), MP_ROM_PTR((mp_obj_t)&onewire_writebyte_obj) },
- { MP_ROM_QSTR(MP_QSTR_crc8), MP_ROM_PTR((mp_obj_t)&onewire_crc8_obj) },
+ { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&onewire_reset_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readbit), MP_ROM_PTR(&onewire_readbit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readbyte), MP_ROM_PTR(&onewire_readbyte_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writebit), MP_ROM_PTR(&onewire_writebit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writebyte), MP_ROM_PTR(&onewire_writebyte_obj) },
+ { MP_ROM_QSTR(MP_QSTR_crc8), MP_ROM_PTR(&onewire_crc8_obj) },
};
STATIC MP_DEFINE_CONST_DICT(onewire_module_globals, onewire_module_globals_table);
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index 9e3f16fe7..d618f5370 100644
--- a/extmod/modwebrepl.c
+++ b/extmod/modwebrepl.c
@@ -317,11 +317,11 @@ STATIC mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(webrepl_set_password_obj, webrepl_set_password);
-STATIC const mp_map_elem_t webrepl_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&webrepl_close_obj },
+STATIC const mp_rom_map_elem_t webrepl_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
+ { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&webrepl_close_obj) },
};
STATIC MP_DEFINE_CONST_DICT(webrepl_locals_dict, webrepl_locals_dict_table);
@@ -335,13 +335,13 @@ STATIC const mp_obj_type_t webrepl_type = {
.name = MP_QSTR__webrepl,
.make_new = webrepl_make_new,
.protocol = &webrepl_stream_p,
- .locals_dict = (mp_obj_t)&webrepl_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&webrepl_locals_dict,
};
-STATIC const mp_map_elem_t webrepl_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR__webrepl) },
- { MP_OBJ_NEW_QSTR(MP_QSTR__webrepl), (mp_obj_t)&webrepl_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_password), (mp_obj_t)&webrepl_set_password_obj },
+STATIC const mp_rom_map_elem_t webrepl_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__webrepl) },
+ { MP_ROM_QSTR(MP_QSTR__webrepl), MP_ROM_PTR(&webrepl_type) },
+ { MP_ROM_QSTR(MP_QSTR_password), MP_ROM_PTR(&webrepl_set_password_obj) },
};
STATIC MP_DEFINE_CONST_DICT(webrepl_module_globals, webrepl_module_globals_table);
From e280122b1490136b51469c22a1fb4d2375b5a2b8 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 30 Jul 2017 10:03:14 +0300
Subject: [PATCH 199/252] unix/modjni: Convert to mp_rom_map_elem_t.
---
unix/modjni.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/unix/modjni.c b/unix/modjni.c
index 0aeb0601f..896f2f919 100644
--- a/unix/modjni.c
+++ b/unix/modjni.c
@@ -168,9 +168,9 @@ STATIC mp_obj_t jclass_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
return call_method(self->cls, NULL, methods, true, n_args, args);
}
-STATIC const mp_map_elem_t jclass_locals_dict_table[] = {
-// { MP_OBJ_NEW_QSTR(MP_QSTR_get), (mp_obj_t)&ffivar_get_obj },
-// { MP_OBJ_NEW_QSTR(MP_QSTR_set), (mp_obj_t)&ffivar_set_obj },
+STATIC const mp_rom_map_elem_t jclass_locals_dict_table[] = {
+// { MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&ffivar_get_obj) },
+// { MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&ffivar_set_obj) },
};
STATIC MP_DEFINE_CONST_DICT(jclass_locals_dict, jclass_locals_dict_table);
@@ -181,7 +181,7 @@ STATIC const mp_obj_type_t jclass_type = {
.print = jclass_print,
.attr = jclass_attr,
.call = jclass_call,
- .locals_dict = (mp_obj_t)&jclass_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&jclass_locals_dict,
};
STATIC mp_obj_t new_jclass(jclass jc) {
@@ -331,7 +331,7 @@ STATIC const mp_obj_type_t jobject_type = {
.attr = jobject_attr,
.subscr = jobject_subscr,
.getiter = subscr_getiter,
-// .locals_dict = (mp_obj_t)&jobject_locals_dict,
+// .locals_dict = (mp_obj_dict_t*)&jobject_locals_dict,
};
STATIC mp_obj_t new_jobject(jobject jo) {
@@ -578,7 +578,7 @@ STATIC const mp_obj_type_t jmethod_type = {
.print = jmethod_print,
.call = jmethod_call,
// .attr = jobject_attr,
-// .locals_dict = (mp_obj_t)&jobject_locals_dict,
+// .locals_dict = (mp_obj_dict_t*)&jobject_locals_dict,
};
#ifdef __ANDROID__
@@ -707,11 +707,11 @@ STATIC mp_obj_t mod_jni_env() {
}
MP_DEFINE_CONST_FUN_OBJ_0(mod_jni_env_obj, mod_jni_env);
-STATIC const mp_map_elem_t mp_module_jni_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_jni) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_cls), (mp_obj_t)&mod_jni_cls_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mod_jni_array_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_env), (mp_obj_t)&mod_jni_env_obj },
+STATIC const mp_rom_map_elem_t mp_module_jni_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_jni) },
+ { MP_ROM_QSTR(MP_QSTR_cls), MP_ROM_PTR(&mod_jni_cls_obj) },
+ { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mod_jni_array_obj) },
+ { MP_ROM_QSTR(MP_QSTR_env), MP_ROM_PTR(&mod_jni_env_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_jni_globals, mp_module_jni_globals_table);
From e3864b59070c012d913d41c6ecbbd443ace3f0bc Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 30 Jul 2017 12:35:57 +0300
Subject: [PATCH 200/252] esp8266/modesp: Remove unused constants: STA_MODE,
etc.
WiFi mode selection happens on the level of individual interfaces.
---
esp8266/modesp.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index 5eaae27d6..b85a05ccb 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -384,13 +384,6 @@ STATIC const mp_map_elem_t esp_module_globals_table[] = {
MP_OBJ_NEW_SMALL_INT(LIGHT_SLEEP_T) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP_MODEM),
MP_OBJ_NEW_SMALL_INT(MODEM_SLEEP_T) },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_STA_MODE),
- MP_OBJ_NEW_SMALL_INT(STATION_MODE)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_AP_MODE),
- MP_OBJ_NEW_SMALL_INT(SOFTAP_MODE)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STA_AP_MODE),
- MP_OBJ_NEW_SMALL_INT(STATIONAP_MODE)},
#endif
};
From e6bb25317b7768ae3423f520e69dbb1f7109605c Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 30 Jul 2017 18:13:01 +0300
Subject: [PATCH 201/252] esp8266: Convert to mp_rom_map_elem_t.
---
esp8266/machine_adc.c | 6 ++--
esp8266/machine_pin.c | 32 ++++++++---------
esp8266/machine_rtc.c | 16 ++++-----
esp8266/machine_wdt.c | 8 ++---
esp8266/modesp.c | 55 ++++++++++++++--------------
esp8266/modmachine.c | 14 ++++----
esp8266/modnetwork.c | 84 ++++++++++++++++++-------------------------
7 files changed, 98 insertions(+), 117 deletions(-)
diff --git a/esp8266/machine_adc.c b/esp8266/machine_adc.c
index f1fb5be31..73ec05208 100644
--- a/esp8266/machine_adc.c
+++ b/esp8266/machine_adc.c
@@ -70,8 +70,8 @@ STATIC mp_obj_t pyb_adc_read(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_adc_read_obj, pyb_adc_read);
-STATIC const mp_map_elem_t pyb_adc_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&pyb_adc_read_obj }
+STATIC const mp_rom_map_elem_t pyb_adc_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&pyb_adc_read_obj) }
};
STATIC MP_DEFINE_CONST_DICT(pyb_adc_locals_dict, pyb_adc_locals_dict_table);
@@ -79,5 +79,5 @@ const mp_obj_type_t pyb_adc_type = {
{ &mp_type_type },
.name = MP_QSTR_ADC,
.make_new = pyb_adc_make_new,
- .locals_dict = (mp_obj_t)&pyb_adc_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&pyb_adc_locals_dict,
};
diff --git a/esp8266/machine_pin.c b/esp8266/machine_pin.c
index febbc1587..6f75a0a6a 100644
--- a/esp8266/machine_pin.c
+++ b/esp8266/machine_pin.c
@@ -426,24 +426,24 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i
return -1;
}
-STATIC const mp_map_elem_t pyb_pin_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_pin_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_pin_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_value), (mp_obj_t)&pyb_pin_value_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_off), (mp_obj_t)&pyb_pin_off_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_on), (mp_obj_t)&pyb_pin_on_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pyb_pin_irq_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_pin_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_pin_value_obj) },
+ { MP_ROM_QSTR(MP_QSTR_off), MP_ROM_PTR(&pyb_pin_off_obj) },
+ { MP_ROM_QSTR(MP_QSTR_on), MP_ROM_PTR(&pyb_pin_on_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_pin_irq_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_IN), MP_OBJ_NEW_SMALL_INT(GPIO_MODE_INPUT) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_OUT), MP_OBJ_NEW_SMALL_INT(GPIO_MODE_OUTPUT) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_OPEN_DRAIN), MP_OBJ_NEW_SMALL_INT(GPIO_MODE_OPEN_DRAIN) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_UP), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_UP) },
- //{ MP_OBJ_NEW_QSTR(MP_QSTR_PULL_DOWN), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_DOWN) },
-
- // IRG triggers, can be or'd together
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_RISING), MP_OBJ_NEW_SMALL_INT(GPIO_PIN_INTR_POSEDGE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_FALLING), MP_OBJ_NEW_SMALL_INT(GPIO_PIN_INTR_NEGEDGE) },
+ { MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_INT(GPIO_MODE_INPUT) },
+ { MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_MODE_OUTPUT) },
+ { MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_INT(GPIO_MODE_OPEN_DRAIN) },
+ { MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(GPIO_PULL_UP) },
+ //{ MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(GPIO_PULL_DOWN) },
+
+ // IRQ triggers, can be or'd together
+ { MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_PIN_INTR_POSEDGE) },
+ { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_PIN_INTR_NEGEDGE) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_pin_locals_dict, pyb_pin_locals_dict_table);
@@ -459,7 +459,7 @@ const mp_obj_type_t pyb_pin_type = {
.make_new = mp_pin_make_new,
.call = pyb_pin_call,
.protocol = &pin_pin_p,
- .locals_dict = (mp_obj_t)&pyb_pin_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&pyb_pin_locals_dict,
};
/******************************************************************************/
diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c
index b92ce1d5a..984e8b6e8 100644
--- a/esp8266/machine_rtc.c
+++ b/esp8266/machine_rtc.c
@@ -255,13 +255,13 @@ STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_rtc_irq_obj, 1, pyb_rtc_irq);
-STATIC const mp_map_elem_t pyb_rtc_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_datetime), (mp_obj_t)&pyb_rtc_datetime_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_memory), (mp_obj_t)&pyb_rtc_memory_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_alarm), (mp_obj_t)&pyb_rtc_alarm_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_alarm_left), (mp_obj_t)&pyb_rtc_alarm_left_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pyb_rtc_irq_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ALARM0), MP_OBJ_NEW_SMALL_INT(0) },
+STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&pyb_rtc_datetime_obj) },
+ { MP_ROM_QSTR(MP_QSTR_memory), MP_ROM_PTR(&pyb_rtc_memory_obj) },
+ { MP_ROM_QSTR(MP_QSTR_alarm), MP_ROM_PTR(&pyb_rtc_alarm_obj) },
+ { MP_ROM_QSTR(MP_QSTR_alarm_left), MP_ROM_PTR(&pyb_rtc_alarm_left_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_rtc_irq_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ALARM0), MP_ROM_INT(0) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
@@ -269,5 +269,5 @@ const mp_obj_type_t pyb_rtc_type = {
{ &mp_type_type },
.name = MP_QSTR_RTC,
.make_new = pyb_rtc_make_new,
- .locals_dict = (mp_obj_t)&pyb_rtc_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&pyb_rtc_locals_dict,
};
diff --git a/esp8266/machine_wdt.c b/esp8266/machine_wdt.c
index 83b5e8f32..5e23ff782 100644
--- a/esp8266/machine_wdt.c
+++ b/esp8266/machine_wdt.c
@@ -71,9 +71,9 @@ STATIC mp_obj_t machine_wdt_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_wdt_deinit_obj, machine_wdt_deinit);
-STATIC const mp_map_elem_t machine_wdt_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_feed), (mp_obj_t)&machine_wdt_feed_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&machine_wdt_deinit_obj },
+STATIC const mp_rom_map_elem_t machine_wdt_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_feed), MP_ROM_PTR(&machine_wdt_feed_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_wdt_deinit_obj) },
};
STATIC MP_DEFINE_CONST_DICT(machine_wdt_locals_dict, machine_wdt_locals_dict_table);
@@ -81,5 +81,5 @@ const mp_obj_type_t esp_wdt_type = {
{ &mp_type_type },
.name = MP_QSTR_WDT,
.make_new = machine_wdt_make_new,
- .locals_dict = (mp_obj_t)&machine_wdt_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&machine_wdt_locals_dict,
};
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index b85a05ccb..1aec1f90e 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -347,43 +347,40 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp_set_native_code_location_obj, esp_set_nativ
#endif
-STATIC const mp_map_elem_t esp_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_esp) },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_osdebug), (mp_obj_t)&esp_osdebug_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sleep_type), (mp_obj_t)&esp_sleep_type_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deepsleep), (mp_obj_t)&esp_deepsleep_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_id), (mp_obj_t)&esp_flash_id_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_read), (mp_obj_t)&esp_flash_read_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_write), (mp_obj_t)&esp_flash_write_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_erase), (mp_obj_t)&esp_flash_erase_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_size), (mp_obj_t)&esp_flash_size_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flash_user_start), (mp_obj_t)&esp_flash_user_start_obj },
+STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp) },
+
+ { MP_ROM_QSTR(MP_QSTR_osdebug), MP_ROM_PTR(&esp_osdebug_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sleep_type), MP_ROM_PTR(&esp_sleep_type_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deepsleep), MP_ROM_PTR(&esp_deepsleep_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_id), MP_ROM_PTR(&esp_flash_id_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_read), MP_ROM_PTR(&esp_flash_read_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_write), MP_ROM_PTR(&esp_flash_write_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_erase), MP_ROM_PTR(&esp_flash_erase_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_size), MP_ROM_PTR(&esp_flash_size_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flash_user_start), MP_ROM_PTR(&esp_flash_user_start_obj) },
#if MICROPY_ESP8266_NEOPIXEL
- { MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write), (mp_obj_t)&esp_neopixel_write_obj },
+ { MP_ROM_QSTR(MP_QSTR_neopixel_write), MP_ROM_PTR(&esp_neopixel_write_obj) },
#endif
#if MICROPY_ESP8266_APA102
- { MP_OBJ_NEW_QSTR(MP_QSTR_apa102_write), (mp_obj_t)&esp_apa102_write_obj },
+ { MP_ROM_QSTR(MP_QSTR_apa102_write), MP_ROM_PTR(&esp_apa102_write_obj) },
#endif
- { MP_OBJ_NEW_QSTR(MP_QSTR_dht_readinto), (mp_obj_t)&dht_readinto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_freemem), (mp_obj_t)&esp_freemem_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_meminfo), (mp_obj_t)&esp_meminfo_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_check_fw), (mp_obj_t)&esp_check_fw_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&pyb_info_obj }, // TODO delete/rename/move elsewhere
- { MP_OBJ_NEW_QSTR(MP_QSTR_malloc), (mp_obj_t)&esp_malloc_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_free), (mp_obj_t)&esp_free_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_esf_free_bufs), (mp_obj_t)&esp_esf_free_bufs_obj },
+ { MP_ROM_QSTR(MP_QSTR_dht_readinto), MP_ROM_PTR(&dht_readinto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_freemem), MP_ROM_PTR(&esp_freemem_obj) },
+ { MP_ROM_QSTR(MP_QSTR_meminfo), MP_ROM_PTR(&esp_meminfo_obj) },
+ { MP_ROM_QSTR(MP_QSTR_check_fw), MP_ROM_PTR(&esp_check_fw_obj) },
+ { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&pyb_info_obj) }, // TODO delete/rename/move elsewhere
+ { MP_ROM_QSTR(MP_QSTR_malloc), MP_ROM_PTR(&esp_malloc_obj) },
+ { MP_ROM_QSTR(MP_QSTR_free), MP_ROM_PTR(&esp_free_obj) },
+ { MP_ROM_QSTR(MP_QSTR_esf_free_bufs), MP_ROM_PTR(&esp_esf_free_bufs_obj) },
#if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA
- { MP_OBJ_NEW_QSTR(MP_QSTR_set_native_code_location), (mp_obj_t)&esp_set_native_code_location_obj },
+ { MP_ROM_QSTR(MP_QSTR_set_native_code_location), MP_ROM_PTR(&esp_set_native_code_location_obj) },
#endif
#if MODESP_INCLUDE_CONSTANTS
- { MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP_NONE),
- MP_OBJ_NEW_SMALL_INT(NONE_SLEEP_T) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP_LIGHT),
- MP_OBJ_NEW_SMALL_INT(LIGHT_SLEEP_T) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP_MODEM),
- MP_OBJ_NEW_SMALL_INT(MODEM_SLEEP_T) },
+ { MP_ROM_QSTR(MP_QSTR_SLEEP_NONE), MP_ROM_INT(NONE_SLEEP_T) },
+ { MP_ROM_QSTR(MP_QSTR_SLEEP_LIGHT), MP_ROM_INT(LIGHT_SLEEP_T) },
+ { MP_ROM_QSTR(MP_QSTR_SLEEP_MODEM), MP_ROM_INT(MODEM_SLEEP_T) },
#endif
};
diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c
index c26c63396..070e6fc54 100644
--- a/esp8266/modmachine.c
+++ b/esp8266/modmachine.c
@@ -193,12 +193,12 @@ STATIC mp_obj_t esp_timer_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_timer_deinit_obj, esp_timer_deinit);
-STATIC const mp_map_elem_t esp_timer_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&esp_timer_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&esp_timer_init_obj },
-// { MP_OBJ_NEW_QSTR(MP_QSTR_callback), (mp_obj_t)&esp_timer_callback_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ONE_SHOT), MP_OBJ_NEW_SMALL_INT(false) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PERIODIC), MP_OBJ_NEW_SMALL_INT(true) },
+STATIC const mp_rom_map_elem_t esp_timer_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp_timer_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&esp_timer_init_obj) },
+// { MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&esp_timer_callback_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(false) },
+ { MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(true) },
};
STATIC MP_DEFINE_CONST_DICT(esp_timer_locals_dict, esp_timer_locals_dict_table);
@@ -207,7 +207,7 @@ const mp_obj_type_t esp_timer_type = {
.name = MP_QSTR_Timer,
.print = esp_timer_print,
.make_new = esp_timer_make_new,
- .locals_dict = (mp_obj_t)&esp_timer_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&esp_timer_locals_dict,
};
// this bit is unused in the Xtensa PS register
diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c
index eb9d75e28..a621522d0 100644
--- a/esp8266/modnetwork.c
+++ b/esp8266/modnetwork.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 Paul Sokolovsky
+ * Copyright (c) 2015-2016 Paul Sokolovsky
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -427,15 +427,15 @@ unknown:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_config_obj, 1, esp_config);
-STATIC const mp_map_elem_t wlan_if_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_active), (mp_obj_t)&esp_active_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&esp_connect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)&esp_disconnect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_status), (mp_obj_t)&esp_status_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_scan), (mp_obj_t)&esp_scan_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_isconnected), (mp_obj_t)&esp_isconnected_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_config), (mp_obj_t)&esp_config_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ifconfig), (mp_obj_t)&esp_ifconfig_obj },
+STATIC const mp_rom_map_elem_t wlan_if_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&esp_active_obj) },
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&esp_connect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&esp_disconnect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&esp_status_obj) },
+ { MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&esp_scan_obj) },
+ { MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&esp_isconnected_obj) },
+ { MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&esp_config_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&esp_ifconfig_obj) },
};
STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
@@ -443,7 +443,7 @@ STATIC MP_DEFINE_CONST_DICT(wlan_if_locals_dict, wlan_if_locals_dict_table);
const mp_obj_type_t wlan_if_type = {
{ &mp_type_type },
.name = MP_QSTR_WLAN,
- .locals_dict = (mp_obj_t)&wlan_if_locals_dict,
+ .locals_dict = (mp_obj_dict_t*)&wlan_if_locals_dict,
};
STATIC mp_obj_t esp_phy_mode(mp_uint_t n_args, const mp_obj_t *args) {
@@ -456,47 +456,31 @@ STATIC mp_obj_t esp_phy_mode(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_phy_mode_obj, 0, 1, esp_phy_mode);
-STATIC const mp_map_elem_t mp_module_network_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_network) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WLAN), (mp_obj_t)&get_wlan_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_phy_mode), (mp_obj_t)&esp_phy_mode_obj },
+STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_network) },
+ { MP_ROM_QSTR(MP_QSTR_WLAN), MP_ROM_PTR(&get_wlan_obj) },
+ { MP_ROM_QSTR(MP_QSTR_phy_mode), MP_ROM_PTR(&esp_phy_mode_obj) },
#if MODNETWORK_INCLUDE_CONSTANTS
- { MP_OBJ_NEW_QSTR(MP_QSTR_STA_IF),
- MP_OBJ_NEW_SMALL_INT(STATION_IF)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_AP_IF),
- MP_OBJ_NEW_SMALL_INT(SOFTAP_IF)},
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_IDLE),
- MP_OBJ_NEW_SMALL_INT(STATION_IDLE)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_CONNECTING),
- MP_OBJ_NEW_SMALL_INT(STATION_CONNECTING)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_WRONG_PASSWORD),
- MP_OBJ_NEW_SMALL_INT(STATION_WRONG_PASSWORD)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_NO_AP_FOUND),
- MP_OBJ_NEW_SMALL_INT(STATION_NO_AP_FOUND)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_CONNECT_FAIL),
- MP_OBJ_NEW_SMALL_INT(STATION_CONNECT_FAIL)},
- { MP_OBJ_NEW_QSTR(MP_QSTR_STAT_GOT_IP),
- MP_OBJ_NEW_SMALL_INT(STATION_GOT_IP)},
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11B),
- MP_OBJ_NEW_SMALL_INT(PHY_MODE_11B) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11G),
- MP_OBJ_NEW_SMALL_INT(PHY_MODE_11G) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_MODE_11N),
- MP_OBJ_NEW_SMALL_INT(PHY_MODE_11N) },
-
- { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_OPEN),
- MP_OBJ_NEW_SMALL_INT(AUTH_OPEN) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WEP),
- MP_OBJ_NEW_SMALL_INT(AUTH_WEP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA_PSK),
- MP_OBJ_NEW_SMALL_INT(AUTH_WPA_PSK) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA2_PSK),
- MP_OBJ_NEW_SMALL_INT(AUTH_WPA2_PSK) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AUTH_WPA_WPA2_PSK),
- MP_OBJ_NEW_SMALL_INT(AUTH_WPA_WPA2_PSK) },
+ { MP_ROM_QSTR(MP_QSTR_STA_IF), MP_ROM_INT(STATION_IF)},
+ { MP_ROM_QSTR(MP_QSTR_AP_IF), MP_ROM_INT(SOFTAP_IF)},
+
+ { MP_ROM_QSTR(MP_QSTR_STAT_IDLE), MP_ROM_INT(STATION_IDLE)},
+ { MP_ROM_QSTR(MP_QSTR_STAT_CONNECTING), MP_ROM_INT(STATION_CONNECTING)},
+ { MP_ROM_QSTR(MP_QSTR_STAT_WRONG_PASSWORD), MP_ROM_INT(STATION_WRONG_PASSWORD)},
+ { MP_ROM_QSTR(MP_QSTR_STAT_NO_AP_FOUND), MP_ROM_INT(STATION_NO_AP_FOUND)},
+ { MP_ROM_QSTR(MP_QSTR_STAT_CONNECT_FAIL), MP_ROM_INT(STATION_CONNECT_FAIL)},
+ { MP_ROM_QSTR(MP_QSTR_STAT_GOT_IP), MP_ROM_INT(STATION_GOT_IP)},
+
+ { MP_ROM_QSTR(MP_QSTR_MODE_11B), MP_ROM_INT(PHY_MODE_11B) },
+ { MP_ROM_QSTR(MP_QSTR_MODE_11G), MP_ROM_INT(PHY_MODE_11G) },
+ { MP_ROM_QSTR(MP_QSTR_MODE_11N), MP_ROM_INT(PHY_MODE_11N) },
+
+ { MP_ROM_QSTR(MP_QSTR_AUTH_OPEN), MP_ROM_INT(AUTH_OPEN) },
+ { MP_ROM_QSTR(MP_QSTR_AUTH_WEP), MP_ROM_INT(AUTH_WEP) },
+ { MP_ROM_QSTR(MP_QSTR_AUTH_WPA_PSK), MP_ROM_INT(AUTH_WPA_PSK) },
+ { MP_ROM_QSTR(MP_QSTR_AUTH_WPA2_PSK), MP_ROM_INT(AUTH_WPA2_PSK) },
+ { MP_ROM_QSTR(MP_QSTR_AUTH_WPA_WPA2_PSK), MP_ROM_INT(AUTH_WPA_WPA2_PSK) },
#endif
};
From b62bb53d0efd027f9b3f6b757870fd584b213d98 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 31 Jul 2017 12:59:39 +1000
Subject: [PATCH 202/252] py/modsys: Use MP_ROM_INT for int values in an
mp_rom_map_elem_t.
---
py/modsys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/py/modsys.c b/py/modsys.c
index b8c427ba8..0a8f3cd50 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -168,7 +168,7 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
// to not try to compare sys.maxsize to some literal number (as this
// number might not fit in available int size), but instead count number
// of "one" bits in sys.maxsize.
- { MP_ROM_QSTR(MP_QSTR_maxsize), MP_OBJ_NEW_SMALL_INT(MP_SMALL_INT_MAX) },
+ { MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_INT(MP_SMALL_INT_MAX) },
#else
{ MP_ROM_QSTR(MP_QSTR_maxsize), MP_ROM_PTR(&mp_maxsize_obj) },
#endif
From bbced3b4bbc8fd7ed7843d39143b6c600adc2c60 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 31 Jul 2017 13:00:34 +1000
Subject: [PATCH 203/252] extmod: Use MP_ROM_INT for int values in an
mp_rom_map_elem_t.
---
extmod/modframebuf.c | 12 ++++++------
extmod/modlwip.c | 14 +++++++-------
extmod/moduselect.c | 8 ++++----
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c
index d3318899a..f4e857129 100644
--- a/extmod/modframebuf.c
+++ b/extmod/modframebuf.c
@@ -578,12 +578,12 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_framebuf) },
{ MP_ROM_QSTR(MP_QSTR_FrameBuffer), MP_ROM_PTR(&mp_type_framebuf) },
{ MP_ROM_QSTR(MP_QSTR_FrameBuffer1), MP_ROM_PTR(&legacy_framebuffer1_obj) },
- { MP_ROM_QSTR(MP_QSTR_MVLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) },
- { MP_ROM_QSTR(MP_QSTR_MONO_VLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MVLSB) },
- { MP_ROM_QSTR(MP_QSTR_RGB565), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_RGB565) },
- { MP_ROM_QSTR(MP_QSTR_GS4_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_GS4_HMSB) },
- { MP_ROM_QSTR(MP_QSTR_MONO_HLSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHLSB) },
- { MP_ROM_QSTR(MP_QSTR_MONO_HMSB), MP_OBJ_NEW_SMALL_INT(FRAMEBUF_MHMSB) },
+ { MP_ROM_QSTR(MP_QSTR_MVLSB), MP_ROM_INT(FRAMEBUF_MVLSB) },
+ { MP_ROM_QSTR(MP_QSTR_MONO_VLSB), MP_ROM_INT(FRAMEBUF_MVLSB) },
+ { MP_ROM_QSTR(MP_QSTR_RGB565), MP_ROM_INT(FRAMEBUF_RGB565) },
+ { MP_ROM_QSTR(MP_QSTR_GS4_HMSB), MP_ROM_INT(FRAMEBUF_GS4_HMSB) },
+ { MP_ROM_QSTR(MP_QSTR_MONO_HLSB), MP_ROM_INT(FRAMEBUF_MHLSB) },
+ { MP_ROM_QSTR(MP_QSTR_MONO_HMSB), MP_ROM_INT(FRAMEBUF_MHMSB) },
};
STATIC MP_DEFINE_CONST_DICT(framebuf_module_globals, framebuf_module_globals_table);
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 48b4190e9..9d1a8c4d0 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -1333,15 +1333,15 @@ STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_slip), MP_ROM_PTR(&lwip_slip_type) },
#endif
// class constants
- { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET) },
- { MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_AF_INET6) },
+ { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(MOD_NETWORK_AF_INET) },
+ { MP_ROM_QSTR(MP_QSTR_AF_INET6), MP_ROM_INT(MOD_NETWORK_AF_INET6) },
- { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_STREAM) },
- { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_DGRAM) },
- { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_OBJ_NEW_SMALL_INT(MOD_NETWORK_SOCK_RAW) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(MOD_NETWORK_SOCK_STREAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(MOD_NETWORK_SOCK_DGRAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(MOD_NETWORK_SOCK_RAW) },
- { MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_OBJ_NEW_SMALL_INT(1) },
- { MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_OBJ_NEW_SMALL_INT(SOF_REUSEADDR) },
+ { MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
+ { MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table);
diff --git a/extmod/moduselect.c b/extmod/moduselect.c
index 88dd29a49..2b8b87b5a 100644
--- a/extmod/moduselect.c
+++ b/extmod/moduselect.c
@@ -362,10 +362,10 @@ STATIC const mp_rom_map_elem_t mp_module_select_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uselect) },
{ MP_ROM_QSTR(MP_QSTR_select), MP_ROM_PTR(&mp_select_select_obj) },
{ MP_ROM_QSTR(MP_QSTR_poll), MP_ROM_PTR(&mp_select_poll_obj) },
- { MP_ROM_QSTR(MP_QSTR_POLLIN), MP_OBJ_NEW_SMALL_INT(MP_STREAM_POLL_RD) },
- { MP_ROM_QSTR(MP_QSTR_POLLOUT), MP_OBJ_NEW_SMALL_INT(MP_STREAM_POLL_WR) },
- { MP_ROM_QSTR(MP_QSTR_POLLERR), MP_OBJ_NEW_SMALL_INT(MP_STREAM_POLL_ERR) },
- { MP_ROM_QSTR(MP_QSTR_POLLHUP), MP_OBJ_NEW_SMALL_INT(MP_STREAM_POLL_HUP) },
+ { MP_ROM_QSTR(MP_QSTR_POLLIN), MP_ROM_INT(MP_STREAM_POLL_RD) },
+ { MP_ROM_QSTR(MP_QSTR_POLLOUT), MP_ROM_INT(MP_STREAM_POLL_WR) },
+ { MP_ROM_QSTR(MP_QSTR_POLLERR), MP_ROM_INT(MP_STREAM_POLL_ERR) },
+ { MP_ROM_QSTR(MP_QSTR_POLLHUP), MP_ROM_INT(MP_STREAM_POLL_HUP) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_select_globals, mp_module_select_globals_table);
From 55f33240f3d7051d4213629e92437a36f1fac50e Mon Sep 17 00:00:00 2001
From: Alexander Steffen
Date: Fri, 30 Jun 2017 09:22:17 +0200
Subject: [PATCH 204/252] all: Use the name MicroPython consistently in
comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
---
bare-arm/mpconfigport.h | 2 +-
cc3200/application.lds | 8 ++++----
cc3200/boards/LAUNCHXL/mpconfigboard.h | 2 +-
cc3200/boards/WIPY/mpconfigboard.h | 2 +-
cc3200/boards/cc3200_prefix.c | 2 +-
cc3200/bootmgr/bootmgr.h | 2 +-
cc3200/bootmgr/bootmgr.lds | 2 +-
cc3200/bootmgr/flc.h | 2 +-
cc3200/bootmgr/main.c | 2 +-
cc3200/ftp/ftp.c | 2 +-
cc3200/ftp/ftp.h | 2 +-
cc3200/ftp/updater.c | 2 +-
cc3200/ftp/updater.h | 2 +-
cc3200/hal/cc3200_asm.h | 2 +-
cc3200/hal/cc3200_hal.c | 2 +-
cc3200/hal/cc3200_hal.h | 2 +-
cc3200/hal/fault_registers.h | 2 +-
cc3200/main.c | 2 +-
cc3200/misc/FreeRTOSHooks.c | 2 +-
cc3200/misc/antenna.c | 2 +-
cc3200/misc/antenna.h | 2 +-
cc3200/misc/help.c | 2 +-
cc3200/misc/mperror.c | 2 +-
cc3200/misc/mperror.h | 2 +-
cc3200/misc/mpexception.c | 2 +-
cc3200/misc/mpexception.h | 2 +-
cc3200/misc/mpirq.c | 4 ++--
cc3200/misc/mpirq.h | 2 +-
cc3200/mods/modmachine.c | 4 ++--
cc3200/mods/modnetwork.c | 2 +-
cc3200/mods/modnetwork.h | 2 +-
cc3200/mods/modubinascii.c | 4 ++--
cc3200/mods/modubinascii.h | 2 +-
cc3200/mods/moduhashlib.c | 4 ++--
cc3200/mods/moduos.c | 4 ++--
cc3200/mods/moduos.h | 2 +-
cc3200/mods/modusocket.c | 2 +-
cc3200/mods/modusocket.h | 2 +-
cc3200/mods/modussl.c | 4 ++--
cc3200/mods/modutime.c | 4 ++--
cc3200/mods/modwipy.c | 2 +-
cc3200/mods/modwlan.c | 4 ++--
cc3200/mods/modwlan.h | 2 +-
cc3200/mods/pybadc.c | 4 ++--
cc3200/mods/pybadc.h | 2 +-
cc3200/mods/pybi2c.c | 4 ++--
cc3200/mods/pybi2c.h | 2 +-
cc3200/mods/pybpin.c | 4 ++--
cc3200/mods/pybpin.h | 2 +-
cc3200/mods/pybrtc.c | 4 ++--
cc3200/mods/pybrtc.h | 2 +-
cc3200/mods/pybsd.c | 4 ++--
cc3200/mods/pybsd.h | 2 +-
cc3200/mods/pybsleep.c | 2 +-
cc3200/mods/pybsleep.h | 2 +-
cc3200/mods/pybspi.c | 4 ++--
cc3200/mods/pybspi.h | 2 +-
cc3200/mods/pybtimer.c | 4 ++--
cc3200/mods/pybtimer.h | 2 +-
cc3200/mods/pybuart.c | 4 ++--
cc3200/mods/pybuart.h | 2 +-
cc3200/mods/pybwdt.c | 4 ++--
cc3200/mods/pybwdt.h | 2 +-
cc3200/mpconfigport.h | 4 ++--
cc3200/mptask.c | 2 +-
cc3200/mptask.h | 2 +-
cc3200/qstrdefsport.h | 2 +-
cc3200/serverstask.c | 2 +-
cc3200/serverstask.h | 2 +-
cc3200/telnet/telnet.c | 2 +-
cc3200/telnet/telnet.h | 2 +-
cc3200/util/cryptohash.c | 2 +-
cc3200/util/cryptohash.h | 2 +-
cc3200/util/fifo.c | 2 +-
cc3200/util/fifo.h | 2 +-
cc3200/util/gccollect.c | 2 +-
cc3200/util/gccollect.h | 2 +-
cc3200/util/gchelper.h | 2 +-
cc3200/util/random.c | 4 ++--
cc3200/util/random.h | 2 +-
cc3200/util/sleeprestore.h | 2 +-
cc3200/util/socketfifo.c | 2 +-
cc3200/util/socketfifo.h | 2 +-
cc3200/version.h | 2 +-
drivers/nrf24l01/nrf24l01.py | 2 +-
drivers/sdcard/sdcard.py | 2 +-
drivers/wiznet5k/README.md | 2 +-
esp8266/esp_mphal.c | 2 +-
esp8266/esp_mphal.h | 2 +-
esp8266/fatfs_port.c | 2 +-
esp8266/gccollect.c | 2 +-
esp8266/gccollect.h | 2 +-
esp8266/hspi.c | 6 +++---
esp8266/machine_adc.c | 2 +-
esp8266/machine_pin.c | 2 +-
esp8266/machine_pwm.c | 2 +-
esp8266/machine_rtc.c | 2 +-
esp8266/main.c | 2 +-
esp8266/modesp.c | 2 +-
esp8266/modnetwork.c | 2 +-
esp8266/modpyb.c | 2 +-
esp8266/moduos.c | 2 +-
esp8266/modutime.c | 2 +-
esp8266/mpconfigport.h | 2 +-
esp8266/qstrdefsport.h | 2 +-
examples/embedding/Makefile.upylib | 2 +-
examples/embedding/hello-embed.c | 2 +-
examples/embedding/mpconfigport_minimal.h | 4 ++--
extmod/machine_mem.c | 2 +-
extmod/machine_mem.h | 2 +-
extmod/modubinascii.c | 2 +-
extmod/modubinascii.h | 2 +-
extmod/moductypes.c | 2 +-
extmod/moduhashlib.c | 2 +-
extmod/moduheapq.c | 2 +-
extmod/modure.c | 2 +-
extmod/moduselect.c | 2 +-
extmod/modussl_axtls.c | 2 +-
extmod/moduzlib.c | 2 +-
extmod/vfs_fat.h | 2 +-
extmod/vfs_fat_diskio.c | 2 +-
extmod/vfs_fat_file.c | 2 +-
lib/libc/string0.c | 2 +-
lib/libm/ef_rem_pio2.c | 2 +-
lib/libm/erf_lgamma.c | 2 +-
lib/libm/fdlibm.h | 2 +-
lib/libm/kf_cos.c | 2 +-
lib/libm/kf_rem_pio2.c | 2 +-
lib/libm/kf_sin.c | 2 +-
lib/libm/kf_tan.c | 2 +-
lib/libm/math.c | 2 +-
lib/libm/sf_cos.c | 2 +-
lib/libm/sf_erf.c | 2 +-
lib/libm/sf_frexp.c | 2 +-
lib/libm/sf_ldexp.c | 2 +-
lib/libm/sf_modf.c | 2 +-
lib/libm/sf_sin.c | 2 +-
lib/libm/sf_tan.c | 2 +-
lib/libm/wf_lgamma.c | 2 +-
lib/libm/wf_tgamma.c | 2 +-
lib/mp-readline/readline.c | 2 +-
lib/mp-readline/readline.h | 2 +-
lib/netutils/netutils.c | 2 +-
lib/netutils/netutils.h | 2 +-
lib/timeutils/timeutils.c | 4 ++--
lib/timeutils/timeutils.h | 2 +-
lib/utils/printf.c | 2 +-
lib/utils/pyexec.c | 2 +-
lib/utils/pyexec.h | 2 +-
logo/FONT-LICENSE.txt | 2 +-
minimal/mpconfigport.h | 2 +-
mpy-cross/Makefile | 2 +-
pic16bit/board.c | 2 +-
pic16bit/board.h | 2 +-
pic16bit/main.c | 2 +-
pic16bit/modpyb.c | 2 +-
pic16bit/modpyb.h | 2 +-
pic16bit/modpybled.c | 2 +-
pic16bit/modpybswitch.c | 2 +-
pic16bit/mpconfigport.h | 2 +-
pic16bit/pic16bit_mphal.c | 2 +-
pic16bit/pic16bit_mphal.h | 2 +-
py/argcheck.c | 2 +-
py/asmarm.c | 2 +-
py/asmarm.h | 2 +-
py/asmthumb.c | 2 +-
py/asmthumb.h | 2 +-
py/asmx64.c | 2 +-
py/asmx64.h | 2 +-
py/asmx86.c | 2 +-
py/asmx86.h | 2 +-
py/bc.c | 2 +-
py/bc.h | 2 +-
py/bc0.h | 4 ++--
py/binary.c | 2 +-
py/binary.h | 2 +-
py/builtin.h | 2 +-
py/builtinevex.c | 2 +-
py/builtinimport.c | 2 +-
py/compile.c | 18 +++++++++---------
py/compile.h | 2 +-
py/emit.h | 2 +-
py/emitbc.c | 2 +-
py/emitcommon.c | 2 +-
py/emitglue.c | 2 +-
py/emitglue.h | 2 +-
py/emitinlinethumb.c | 2 +-
py/emitnative.c | 2 +-
py/formatfloat.c | 2 +-
py/formatfloat.h | 2 +-
py/frozenmod.c | 2 +-
py/frozenmod.h | 2 +-
py/gc.c | 2 +-
py/gc.h | 2 +-
py/grammar.h | 4 ++--
py/lexer.c | 2 +-
py/lexer.h | 4 ++--
py/malloc.c | 4 ++--
py/map.c | 2 +-
py/misc.h | 2 +-
py/mkrules.mk | 2 +-
py/modarray.c | 2 +-
py/modbuiltins.c | 2 +-
py/modcmath.c | 2 +-
py/modcollections.c | 2 +-
py/modgc.c | 2 +-
py/modio.c | 2 +-
py/modmath.c | 2 +-
py/modmicropython.c | 2 +-
py/modstruct.c | 2 +-
py/modsys.c | 4 ++--
py/mphal.h | 2 +-
py/mpprint.c | 2 +-
py/mpprint.h | 2 +-
py/mpstate.c | 2 +-
py/mpstate.h | 4 ++--
py/mpz.c | 2 +-
py/mpz.h | 2 +-
py/nativeglue.c | 6 +++---
py/nlr.h | 2 +-
py/nlrsetjmp.c | 2 +-
py/obj.c | 2 +-
py/obj.h | 2 +-
py/objarray.c | 2 +-
py/objattrtuple.c | 2 +-
py/objbool.c | 2 +-
py/objboundmeth.c | 2 +-
py/objcell.c | 2 +-
py/objclosure.c | 2 +-
py/objcomplex.c | 2 +-
py/objdict.c | 2 +-
py/objenumerate.c | 2 +-
py/objexcept.c | 2 +-
py/objexcept.h | 2 +-
py/objfilter.c | 2 +-
py/objfloat.c | 2 +-
py/objfun.c | 4 ++--
py/objfun.h | 2 +-
py/objgenerator.c | 2 +-
py/objgenerator.h | 2 +-
py/objgetitemiter.c | 2 +-
py/objint.c | 2 +-
py/objint.h | 2 +-
py/objint_longlong.c | 2 +-
py/objint_mpz.c | 2 +-
py/objlist.c | 2 +-
py/objlist.h | 2 +-
py/objmap.c | 2 +-
py/objmodule.c | 2 +-
py/objmodule.h | 2 +-
py/objnamedtuple.c | 2 +-
py/objnone.c | 2 +-
py/objobject.c | 2 +-
py/objproperty.c | 2 +-
py/objrange.c | 2 +-
py/objreversed.c | 2 +-
py/objset.c | 2 +-
py/objsingleton.c | 2 +-
py/objslice.c | 2 +-
py/objstr.c | 2 +-
py/objstr.h | 2 +-
py/objstringio.c | 2 +-
py/objstrunicode.c | 2 +-
py/objtuple.c | 2 +-
py/objtuple.h | 2 +-
py/objtype.c | 6 +++---
py/objtype.h | 2 +-
py/objzip.c | 2 +-
py/opmethods.c | 2 +-
py/parse.c | 2 +-
py/parse.h | 2 +-
py/parsenum.c | 2 +-
py/parsenum.h | 2 +-
py/parsenumbase.c | 2 +-
py/parsenumbase.h | 2 +-
py/qstr.c | 2 +-
py/qstr.h | 2 +-
py/qstrdefs.h | 2 +-
py/repl.c | 2 +-
py/repl.h | 2 +-
py/runtime.c | 4 ++--
py/runtime.h | 2 +-
py/runtime0.h | 2 +-
py/runtime_utils.c | 2 +-
py/scope.c | 2 +-
py/scope.h | 2 +-
py/sequence.c | 2 +-
py/showbc.c | 2 +-
py/smallint.c | 2 +-
py/smallint.h | 2 +-
py/stackctrl.c | 2 +-
py/stackctrl.h | 2 +-
py/stream.c | 2 +-
py/stream.h | 2 +-
py/unicode.c | 2 +-
py/unicode.h | 2 +-
py/vm.c | 2 +-
py/vmentrytable.h | 2 +-
py/vstr.c | 2 +-
py/warning.c | 2 +-
qemu-arm/mpconfigport.h | 2 +-
stmhal/accel.c | 4 ++--
stmhal/accel.h | 2 +-
stmhal/adc.c | 6 +++---
stmhal/adc.h | 2 +-
stmhal/bufhelper.c | 2 +-
stmhal/bufhelper.h | 2 +-
stmhal/can.c | 4 ++--
stmhal/can.h | 2 +-
stmhal/dac.c | 4 ++--
stmhal/dac.h | 2 +-
stmhal/dma.c | 2 +-
stmhal/dma.h | 2 +-
stmhal/extint.c | 2 +-
stmhal/extint.h | 2 +-
stmhal/flash.c | 2 +-
stmhal/flash.h | 2 +-
stmhal/font_petme128_8x8.h | 2 +-
stmhal/gccollect.c | 2 +-
stmhal/gccollect.h | 2 +-
stmhal/hal/l4/inc/stm32l4xx_hal_uart.h | 2 +-
stmhal/hal/l4/src/stm32l4xx_hal_uart.c | 2 +-
stmhal/help.c | 2 +-
stmhal/i2c.c | 4 ++--
stmhal/i2c.h | 2 +-
stmhal/irq.c | 2 +-
stmhal/irq.h | 2 +-
stmhal/lcd.c | 2 +-
stmhal/lcd.h | 2 +-
stmhal/led.c | 2 +-
stmhal/led.h | 2 +-
stmhal/main.c | 4 ++--
stmhal/modnetwork.c | 2 +-
stmhal/modnetwork.h | 2 +-
stmhal/modnwcc3k.c | 4 ++--
stmhal/modnwwiznet5k.c | 4 ++--
stmhal/modpyb.c | 2 +-
stmhal/modstm.c | 2 +-
stmhal/moduos.c | 2 +-
stmhal/modusocket.c | 2 +-
stmhal/modutime.c | 2 +-
stmhal/pendsv.c | 2 +-
stmhal/pendsv.h | 2 +-
stmhal/pin.c | 2 +-
stmhal/pin.h | 2 +-
stmhal/pin_defs_stmhal.h | 2 +-
stmhal/pin_named_pins.c | 2 +-
stmhal/portmodules.h | 2 +-
stmhal/qstrdefsport.h | 2 +-
stmhal/rng.c | 2 +-
stmhal/rng.h | 2 +-
stmhal/rtc.c | 4 ++--
stmhal/rtc.h | 2 +-
stmhal/sdcard.c | 4 ++--
stmhal/sdcard.h | 2 +-
stmhal/servo.c | 4 ++--
stmhal/servo.h | 2 +-
stmhal/spi.c | 2 +-
stmhal/spi.h | 2 +-
stmhal/stm32_it.c | 2 +-
stmhal/stm32_it.h | 2 +-
stmhal/storage.c | 2 +-
stmhal/storage.h | 2 +-
stmhal/system_stm32.c | 2 +-
stmhal/systick.c | 2 +-
stmhal/systick.h | 2 +-
stmhal/timer.c | 4 ++--
stmhal/timer.h | 2 +-
stmhal/uart.c | 4 ++--
stmhal/uart.h | 2 +-
stmhal/usb.c | 8 ++++----
stmhal/usb.h | 2 +-
stmhal/usbd_cdc_interface.h | 2 +-
stmhal/usbd_conf.c | 2 +-
stmhal/usbd_conf.h | 2 +-
stmhal/usbd_desc.c | 2 +-
stmhal/usbd_desc.h | 2 +-
stmhal/usbd_msc_storage.h | 2 +-
stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h | 2 +-
stmhal/usbdev/class/src/usbd_cdc_msc_hid.c | 2 +-
stmhal/usrsw.c | 4 ++--
stmhal/usrsw.h | 2 +-
teensy/hal_ftm.c | 2 +-
teensy/hal_ftm.h | 2 +-
teensy/help.c | 2 +-
teensy/led.c | 2 +-
teensy/main.c | 2 +-
teensy/modpyb.c | 6 +++---
teensy/mpconfigport.h | 2 +-
teensy/timer.c | 4 ++--
teensy/timer.h | 2 +-
teensy/uart.c | 4 ++--
tests/basics/bytearray_slice_assign.py | 2 +-
tests/basics/list_slice_assign.py | 2 +-
tests/io/stringio1.py | 2 +-
tests/run-bench-tests | 2 +-
tests/run-tests | 2 +-
tools/gen-cpydiff.py | 2 +-
unix/Makefile | 2 +-
unix/alloc.c | 2 +-
unix/fdfile.h | 2 +-
unix/file.c | 2 +-
unix/gccollect.c | 2 +-
unix/input.c | 2 +-
unix/main.c | 2 +-
unix/modffi.c | 2 +-
unix/modjni.c | 2 +-
unix/modmachine.c | 2 +-
unix/modos.c | 2 +-
unix/modsocket.c | 2 +-
unix/modtermios.c | 2 +-
unix/modtime.c | 2 +-
unix/moduselect.c | 2 +-
unix/mpconfigport.h | 4 ++--
unix/mpconfigport_fast.h | 2 +-
unix/mpconfigport_minimal.h | 4 ++--
unix/mphalport.h | 2 +-
unix/qstrdefsport.h | 2 +-
unix/unix_mphal.c | 2 +-
windows/init.c | 2 +-
windows/init.h | 2 +-
windows/mpconfigport.h | 4 ++--
windows/msvc/gettimeofday.c | 2 +-
windows/msvc/sys/time.h | 2 +-
windows/msvc/unistd.h | 2 +-
windows/realpath.c | 2 +-
windows/realpath.h | 2 +-
windows/sleep.c | 2 +-
windows/sleep.h | 2 +-
windows/windows_mphal.c | 2 +-
windows/windows_mphal.h | 2 +-
zephyr/machine_pin.c | 2 +-
zephyr/modutime.c | 2 +-
433 files changed, 504 insertions(+), 504 deletions(-)
diff --git a/bare-arm/mpconfigport.h b/bare-arm/mpconfigport.h
index 97e866bdb..17f794521 100644
--- a/bare-arm/mpconfigport.h
+++ b/bare-arm/mpconfigport.h
@@ -1,6 +1,6 @@
#include
-// options to control how Micro Python is built
+// options to control how MicroPython is built
#define MICROPY_QSTR_BYTES_IN_HASH (1)
#define MICROPY_ALLOC_PATH_MAX (512)
diff --git a/cc3200/application.lds b/cc3200/application.lds
index 22ad1968d..3f5e72f8b 100644
--- a/cc3200/application.lds
+++ b/cc3200/application.lds
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -37,7 +37,7 @@ ENTRY(ResetISR)
SECTIONS
{
- /* place the FreeRTOS heap (the micropython stack will live here) */
+ /* place the FreeRTOS heap (the MicroPython stack will live here) */
.rtos_heap (NOLOAD) :
{
. = ALIGN(8);
@@ -83,7 +83,7 @@ SECTIONS
} > SRAM
/* place here functions that are only called during boot up, */
- /* that way, we can re-use this area for the micropython heap */
+ /* that way, we can re-use this area for the MicroPython heap */
.boot :
{
. = ALIGN(8);
@@ -93,7 +93,7 @@ SECTIONS
_eboot = .;
} > SRAM
- /* allocate the micropython heap */
+ /* allocate the MicroPython heap */
.heap :
{
. = ALIGN(8);
diff --git a/cc3200/boards/LAUNCHXL/mpconfigboard.h b/cc3200/boards/LAUNCHXL/mpconfigboard.h
index 32ef5290b..b3d766d1e 100644
--- a/cc3200/boards/LAUNCHXL/mpconfigboard.h
+++ b/cc3200/boards/LAUNCHXL/mpconfigboard.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/boards/WIPY/mpconfigboard.h b/cc3200/boards/WIPY/mpconfigboard.h
index 9f04dbf23..af15cca35 100644
--- a/cc3200/boards/WIPY/mpconfigboard.h
+++ b/cc3200/boards/WIPY/mpconfigboard.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/boards/cc3200_prefix.c b/cc3200/boards/cc3200_prefix.c
index 971285745..d03efe024 100644
--- a/cc3200/boards/cc3200_prefix.c
+++ b/cc3200/boards/cc3200_prefix.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/bootmgr/bootmgr.h b/cc3200/bootmgr/bootmgr.h
index e5285d4e4..5a370f8c9 100644
--- a/cc3200/bootmgr/bootmgr.h
+++ b/cc3200/bootmgr/bootmgr.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/bootmgr/bootmgr.lds b/cc3200/bootmgr/bootmgr.lds
index e67fe23ae..9c911a0d0 100644
--- a/cc3200/bootmgr/bootmgr.lds
+++ b/cc3200/bootmgr/bootmgr.lds
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/bootmgr/flc.h b/cc3200/bootmgr/flc.h
index 7c04c7b05..8f05bb320 100644
--- a/cc3200/bootmgr/flc.h
+++ b/cc3200/bootmgr/flc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/bootmgr/main.c b/cc3200/bootmgr/main.c
index 0d9ab35f8..cfb8dec21 100644
--- a/cc3200/bootmgr/main.c
+++ b/cc3200/bootmgr/main.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/ftp/ftp.c b/cc3200/ftp/ftp.c
index b56e3f4ce..5461f9180 100644
--- a/cc3200/ftp/ftp.c
+++ b/cc3200/ftp/ftp.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/ftp/ftp.h b/cc3200/ftp/ftp.h
index 7d16002e4..af4c14fa3 100644
--- a/cc3200/ftp/ftp.h
+++ b/cc3200/ftp/ftp.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/ftp/updater.c b/cc3200/ftp/updater.c
index fece70095..5be2c6063 100644
--- a/cc3200/ftp/updater.c
+++ b/cc3200/ftp/updater.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/ftp/updater.h b/cc3200/ftp/updater.h
index dcca70472..51248e4bf 100644
--- a/cc3200/ftp/updater.h
+++ b/cc3200/ftp/updater.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/hal/cc3200_asm.h b/cc3200/hal/cc3200_asm.h
index dcaaf57e1..742c9a6f7 100644
--- a/cc3200/hal/cc3200_asm.h
+++ b/cc3200/hal/cc3200_asm.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/hal/cc3200_hal.c b/cc3200/hal/cc3200_hal.c
index 5c0e9c30f..b4848e99e 100644
--- a/cc3200/hal/cc3200_hal.c
+++ b/cc3200/hal/cc3200_hal.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/hal/cc3200_hal.h b/cc3200/hal/cc3200_hal.h
index 9953f0e5a..71e245eeb 100644
--- a/cc3200/hal/cc3200_hal.h
+++ b/cc3200/hal/cc3200_hal.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/hal/fault_registers.h b/cc3200/hal/fault_registers.h
index 739745e92..ade516b9e 100644
--- a/cc3200/hal/fault_registers.h
+++ b/cc3200/hal/fault_registers.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/main.c b/cc3200/main.c
index 1ffb98188..e2299e146 100644
--- a/cc3200/main.c
+++ b/cc3200/main.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/FreeRTOSHooks.c b/cc3200/misc/FreeRTOSHooks.c
index dac9a9282..c618279b7 100644
--- a/cc3200/misc/FreeRTOSHooks.c
+++ b/cc3200/misc/FreeRTOSHooks.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/antenna.c b/cc3200/misc/antenna.c
index 0fbf79f0f..afeed85e1 100644
--- a/cc3200/misc/antenna.c
+++ b/cc3200/misc/antenna.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/antenna.h b/cc3200/misc/antenna.h
index 3bb87e32b..c9d845453 100644
--- a/cc3200/misc/antenna.h
+++ b/cc3200/misc/antenna.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/help.c b/cc3200/misc/help.c
index cce515898..739303e19 100644
--- a/cc3200/misc/help.c
+++ b/cc3200/misc/help.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/mperror.c b/cc3200/misc/mperror.c
index 81b853b48..082d940e2 100644
--- a/cc3200/misc/mperror.c
+++ b/cc3200/misc/mperror.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/mperror.h b/cc3200/misc/mperror.h
index 46a9b8cb0..1c3eb6269 100644
--- a/cc3200/misc/mperror.h
+++ b/cc3200/misc/mperror.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/mpexception.c b/cc3200/misc/mpexception.c
index 068adb70b..72b203fae 100644
--- a/cc3200/misc/mpexception.c
+++ b/cc3200/misc/mpexception.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/mpexception.h b/cc3200/misc/mpexception.h
index d23381caf..88134857c 100644
--- a/cc3200/misc/mpexception.h
+++ b/cc3200/misc/mpexception.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/misc/mpirq.c b/cc3200/misc/mpirq.c
index 37149089f..321663088 100644
--- a/cc3200/misc/mpirq.c
+++ b/cc3200/misc/mpirq.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -143,7 +143,7 @@ void mp_irq_handler (mp_obj_t self_in) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC mp_obj_t mp_irq_init (mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_irq_obj_t *self = pos_args[0];
diff --git a/cc3200/misc/mpirq.h b/cc3200/misc/mpirq.h
index 8b4ab2f1b..35ce66e2d 100644
--- a/cc3200/misc/mpirq.h
+++ b/cc3200/misc/mpirq.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c
index fd1485607..5f63d0196 100644
--- a/cc3200/mods/modmachine.c
+++ b/cc3200/mods/modmachine.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -72,7 +72,7 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
///
/******************************************************************************/
-// Micro Python bindings;
+// MicroPython bindings;
STATIC mp_obj_t machine_reset(void) {
// disable wlan
diff --git a/cc3200/mods/modnetwork.c b/cc3200/mods/modnetwork.c
index d44f75aca..249e1be37 100644
--- a/cc3200/mods/modnetwork.c
+++ b/cc3200/mods/modnetwork.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modnetwork.h b/cc3200/mods/modnetwork.h
index 8e1196e86..6ec90a2ba 100644
--- a/cc3200/mods/modnetwork.h
+++ b/cc3200/mods/modnetwork.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modubinascii.c b/cc3200/mods/modubinascii.c
index 09f4b1e10..8bc2feacc 100644
--- a/cc3200/mods/modubinascii.c
+++ b/cc3200/mods/modubinascii.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -44,7 +44,7 @@
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC const mp_map_elem_t mp_module_binascii_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ubinascii) },
diff --git a/cc3200/mods/modubinascii.h b/cc3200/mods/modubinascii.h
index 3e784e9ae..eb9fc4f21 100644
--- a/cc3200/mods/modubinascii.h
+++ b/cc3200/mods/modubinascii.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/moduhashlib.c b/cc3200/mods/moduhashlib.c
index e1145e4d8..c90c727c2 100644
--- a/cc3200/mods/moduhashlib.c
+++ b/cc3200/mods/moduhashlib.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -117,7 +117,7 @@ STATIC mp_obj_t hash_read (mp_obj_t self_in) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
/// \classmethod \constructor([data[, block_size]])
/// initial data must be given if block_size wants to be passed
diff --git a/cc3200/mods/moduos.c b/cc3200/mods/moduos.c
index ed8879bf3..51dc5834d 100644
--- a/cc3200/mods/moduos.c
+++ b/cc3200/mods/moduos.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -78,7 +78,7 @@ void osmount_unmount_all (void) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
//
STATIC const qstr os_uname_info_fields[] = {
diff --git a/cc3200/mods/moduos.h b/cc3200/mods/moduos.h
index 148cddf2e..f183715c9 100644
--- a/cc3200/mods/moduos.h
+++ b/cc3200/mods/moduos.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 4e17bbae6..739355360 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modusocket.h b/cc3200/mods/modusocket.h
index 80c1f24cd..6e7758662 100644
--- a/cc3200/mods/modusocket.h
+++ b/cc3200/mods/modusocket.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/modussl.c b/cc3200/mods/modussl.c
index 95ecdbce7..808267571 100644
--- a/cc3200/mods/modussl.c
+++ b/cc3200/mods/modussl.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -57,7 +57,7 @@ typedef struct _mp_obj_ssl_socket_t {
STATIC const mp_obj_type_t ssl_socket_type;
/******************************************************************************/
-// Micro Python bindings; SSL class
+// MicroPython bindings; SSL class
// ssl sockets inherit from normal socket, so we take its
// locals and stream methods
diff --git a/cc3200/mods/modutime.c b/cc3200/mods/modutime.c
index 48fde67e7..428b00f93 100644
--- a/cc3200/mods/modutime.c
+++ b/cc3200/mods/modutime.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -51,7 +51,7 @@
/// and for sleeping.
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
/// \function localtime([secs])
/// Convert a time expressed in seconds since Jan 1, 2000 into an 8-tuple which
diff --git a/cc3200/mods/modwipy.c b/cc3200/mods/modwipy.c
index b4c18d153..21a9cc63b 100644
--- a/cc3200/mods/modwipy.c
+++ b/cc3200/mods/modwipy.c
@@ -5,7 +5,7 @@
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC mp_obj_t mod_wipy_heartbeat (mp_uint_t n_args, const mp_obj_t *args) {
if (n_args) {
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index 68d892364..77f5bd991 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -763,7 +763,7 @@ STATIC bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid) {
}
/******************************************************************************/
-// Micro Python bindings; WLAN class
+// MicroPython bindings; WLAN class
/// \class WLAN - WiFi driver
diff --git a/cc3200/mods/modwlan.h b/cc3200/mods/modwlan.h
index d37d276e8..b806644f5 100644
--- a/cc3200/mods/modwlan.h
+++ b/cc3200/mods/modwlan.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybadc.c b/cc3200/mods/pybadc.c
index 696e7650b..0b4f0ba68 100644
--- a/cc3200/mods/pybadc.c
+++ b/cc3200/mods/pybadc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -126,7 +126,7 @@ STATIC void pyb_adc_deinit_all_channels (void) {
}
/******************************************************************************/
-/* Micro Python bindings : adc object */
+/* MicroPython bindings : adc object */
STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_adc_obj_t *self = self_in;
diff --git a/cc3200/mods/pybadc.h b/cc3200/mods/pybadc.h
index 50640ee60..db04b006b 100644
--- a/cc3200/mods/pybadc.h
+++ b/cc3200/mods/pybadc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index 9fc97d914..9c62ffdc4 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -281,7 +281,7 @@ STATIC void pyb_i2c_readmem_into (mp_arg_val_t *args, vstr_t *vstr) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
/******************************************************************************/
STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_i2c_obj_t *self = self_in;
diff --git a/cc3200/mods/pybi2c.h b/cc3200/mods/pybi2c.h
index d547f6330..dcc3f0468 100644
--- a/cc3200/mods/pybi2c.h
+++ b/cc3200/mods/pybi2c.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybpin.c b/cc3200/mods/pybpin.c
index c2a469117..d59f113eb 100644
--- a/cc3200/mods/pybpin.c
+++ b/cc3200/mods/pybpin.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -519,7 +519,7 @@ STATIC void EXTI_Handler(uint port) {
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC const mp_arg_t pin_init_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
diff --git a/cc3200/mods/pybpin.h b/cc3200/mods/pybpin.h
index 6b4b7b1ed..74f0af2b3 100644
--- a/cc3200/mods/pybpin.h
+++ b/cc3200/mods/pybpin.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybrtc.c b/cc3200/mods/pybrtc.c
index 134bd440e..14c4cd419 100644
--- a/cc3200/mods/pybrtc.c
+++ b/cc3200/mods/pybrtc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -278,7 +278,7 @@ STATIC void rtc_msec_add (uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC const mp_arg_t pyb_rtc_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },
diff --git a/cc3200/mods/pybrtc.h b/cc3200/mods/pybrtc.h
index 3fd11ecd6..f73de3f5a 100644
--- a/cc3200/mods/pybrtc.h
+++ b/cc3200/mods/pybrtc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybsd.c b/cc3200/mods/pybsd.c
index 306baea8b..5ba6119b2 100644
--- a/cc3200/mods/pybsd.c
+++ b/cc3200/mods/pybsd.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -118,7 +118,7 @@ STATIC mp_obj_t pyb_sd_init_helper (pybsd_obj_t *self, const mp_arg_val_t *args)
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
//
STATIC const mp_arg_t pyb_sd_init_args[] = {
diff --git a/cc3200/mods/pybsd.h b/cc3200/mods/pybsd.h
index 084d7caaf..af942084d 100644
--- a/cc3200/mods/pybsd.h
+++ b/cc3200/mods/pybsd.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybsleep.c b/cc3200/mods/pybsleep.c
index ced7fef85..a7488c5f1 100644
--- a/cc3200/mods/pybsleep.c
+++ b/cc3200/mods/pybsleep.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybsleep.h b/cc3200/mods/pybsleep.h
index 513e6fa95..e98636178 100644
--- a/cc3200/mods/pybsleep.h
+++ b/cc3200/mods/pybsleep.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybspi.c b/cc3200/mods/pybspi.c
index 3cd384266..9edad579a 100644
--- a/cc3200/mods/pybspi.c
+++ b/cc3200/mods/pybspi.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -144,7 +144,7 @@ STATIC void pybspi_transfer (pyb_spi_obj_t *self, const char *txdata, char *rxda
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
/******************************************************************************/
STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_spi_obj_t *self = self_in;
diff --git a/cc3200/mods/pybspi.h b/cc3200/mods/pybspi.h
index b533b6056..b0fce8870 100644
--- a/cc3200/mods/pybspi.h
+++ b/cc3200/mods/pybspi.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybtimer.c b/cc3200/mods/pybtimer.c
index d25ac6c2b..1ef9a4a44 100644
--- a/cc3200/mods/pybtimer.c
+++ b/cc3200/mods/pybtimer.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -264,7 +264,7 @@ STATIC void timer_channel_init (pyb_timer_channel_obj_t *ch) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_obj_t *tim = self_in;
diff --git a/cc3200/mods/pybtimer.h b/cc3200/mods/pybtimer.h
index a1b30cd2b..0af0864ca 100644
--- a/cc3200/mods/pybtimer.h
+++ b/cc3200/mods/pybtimer.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index 06938bdd4..626357179 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -311,7 +311,7 @@ STATIC int uart_irq_flags (mp_obj_t self_in) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
STATIC void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_uart_obj_t *self = self_in;
diff --git a/cc3200/mods/pybuart.h b/cc3200/mods/pybuart.h
index 56440987f..d481242f1 100644
--- a/cc3200/mods/pybuart.h
+++ b/cc3200/mods/pybuart.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mods/pybwdt.c b/cc3200/mods/pybwdt.c
index 76c701ca0..114e7ac96 100644
--- a/cc3200/mods/pybwdt.c
+++ b/cc3200/mods/pybwdt.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -87,7 +87,7 @@ void pybwdt_sl_alive (void) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC const mp_arg_t pyb_wdt_init_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = mp_const_none} },
diff --git a/cc3200/mods/pybwdt.h b/cc3200/mods/pybwdt.h
index 2844587cb..275c49435 100644
--- a/cc3200/mods/pybwdt.h
+++ b/cc3200/mods/pybwdt.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 78f8c0948..dcde9aae0 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -32,7 +32,7 @@
#include "semphr.h"
#endif
-// options to control how Micro Python is built
+// options to control how MicroPython is built
#define MICROPY_ALLOC_PATH_MAX (128)
#define MICROPY_PERSISTENT_CODE_LOAD (1)
diff --git a/cc3200/mptask.c b/cc3200/mptask.c
index 50c3c769d..09be8c441 100644
--- a/cc3200/mptask.c
+++ b/cc3200/mptask.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/mptask.h b/cc3200/mptask.h
index 5345ecfda..a1c3eb2cb 100644
--- a/cc3200/mptask.h
+++ b/cc3200/mptask.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/qstrdefsport.h b/cc3200/qstrdefsport.h
index 2fc56668c..d5f22d70a 100644
--- a/cc3200/qstrdefsport.h
+++ b/cc3200/qstrdefsport.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/serverstask.c b/cc3200/serverstask.c
index 6b5899e18..100b8d33b 100644
--- a/cc3200/serverstask.c
+++ b/cc3200/serverstask.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/serverstask.h b/cc3200/serverstask.h
index 77a3af2f3..c4533d717 100644
--- a/cc3200/serverstask.h
+++ b/cc3200/serverstask.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/telnet/telnet.c b/cc3200/telnet/telnet.c
index 26e45a75f..2f0818f6b 100644
--- a/cc3200/telnet/telnet.c
+++ b/cc3200/telnet/telnet.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/telnet/telnet.h b/cc3200/telnet/telnet.h
index 1e3173b11..51c569104 100644
--- a/cc3200/telnet/telnet.h
+++ b/cc3200/telnet/telnet.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/cryptohash.c b/cc3200/util/cryptohash.c
index d2d6222ff..909dadc8c 100644
--- a/cc3200/util/cryptohash.c
+++ b/cc3200/util/cryptohash.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/cryptohash.h b/cc3200/util/cryptohash.h
index df3a8475c..15d46b705 100644
--- a/cc3200/util/cryptohash.h
+++ b/cc3200/util/cryptohash.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/fifo.c b/cc3200/util/fifo.c
index 166f99d98..421f83710 100644
--- a/cc3200/util/fifo.c
+++ b/cc3200/util/fifo.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/fifo.h b/cc3200/util/fifo.h
index ee7571c26..6ede57e1e 100644
--- a/cc3200/util/fifo.h
+++ b/cc3200/util/fifo.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/gccollect.c b/cc3200/util/gccollect.c
index 8963852f7..baee2eeef 100644
--- a/cc3200/util/gccollect.c
+++ b/cc3200/util/gccollect.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/gccollect.h b/cc3200/util/gccollect.h
index 3c4232b84..08d43d283 100644
--- a/cc3200/util/gccollect.h
+++ b/cc3200/util/gccollect.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/gchelper.h b/cc3200/util/gchelper.h
index 0277a754b..48e81bc61 100644
--- a/cc3200/util/gchelper.h
+++ b/cc3200/util/gchelper.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/random.c b/cc3200/util/random.c
index 54aaa829c..f8e9cdf0c 100644
--- a/cc3200/util/random.c
+++ b/cc3200/util/random.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -67,7 +67,7 @@ STATIC uint32_t lfsr (uint32_t input) {
}
/******************************************************************************/
-// Micro Python bindings;
+// MicroPython bindings;
STATIC mp_obj_t machine_rng_get(void) {
return mp_obj_new_int(rng_get());
diff --git a/cc3200/util/random.h b/cc3200/util/random.h
index 60b0b8663..02cde6b52 100644
--- a/cc3200/util/random.h
+++ b/cc3200/util/random.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/sleeprestore.h b/cc3200/util/sleeprestore.h
index 1c5509db0..e178f4c2d 100644
--- a/cc3200/util/sleeprestore.h
+++ b/cc3200/util/sleeprestore.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/socketfifo.c b/cc3200/util/socketfifo.c
index eb25f3be3..d0a715048 100644
--- a/cc3200/util/socketfifo.c
+++ b/cc3200/util/socketfifo.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/util/socketfifo.h b/cc3200/util/socketfifo.h
index 1309201ee..e6cf851b1 100644
--- a/cc3200/util/socketfifo.h
+++ b/cc3200/util/socketfifo.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/cc3200/version.h b/cc3200/version.h
index 83e3f8c07..fccb95c52 100644
--- a/cc3200/version.h
+++ b/cc3200/version.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/drivers/nrf24l01/nrf24l01.py b/drivers/nrf24l01/nrf24l01.py
index b45c137c6..7274a7927 100644
--- a/drivers/nrf24l01/nrf24l01.py
+++ b/drivers/nrf24l01/nrf24l01.py
@@ -1,4 +1,4 @@
-"""NRF24L01 driver for Micro Python
+"""NRF24L01 driver for MicroPython
"""
from micropython import const
diff --git a/drivers/sdcard/sdcard.py b/drivers/sdcard/sdcard.py
index e749d5376..75a0c501e 100644
--- a/drivers/sdcard/sdcard.py
+++ b/drivers/sdcard/sdcard.py
@@ -1,5 +1,5 @@
"""
-Micro Python driver for SD cards using SPI bus.
+MicroPython driver for SD cards using SPI bus.
Requires an SPI bus and a CS pin. Provides readblocks and writeblocks
methods so the device can be mounted as a filesystem.
diff --git a/drivers/wiznet5k/README.md b/drivers/wiznet5k/README.md
index 4f907e0b1..88f25a2b8 100644
--- a/drivers/wiznet5k/README.md
+++ b/drivers/wiznet5k/README.md
@@ -1,6 +1,6 @@
This is the driver for the WIZnet5x00 series of Ethernet controllers.
-Adapted for Micro Python.
+Adapted for MicroPython.
Original source: https://github.com/Wiznet/W5500_EVB/tree/master/ioLibrary
Taken on: 30 August 2014
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c
index 55f9a5894..61848fd34 100644
--- a/esp8266/esp_mphal.c
+++ b/esp8266/esp_mphal.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h
index 1d1d6de3f..913bd70dc 100644
--- a/esp8266/esp_mphal.h
+++ b/esp8266/esp_mphal.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/fatfs_port.c b/esp8266/fatfs_port.c
index 02384f605..a8865c817 100644
--- a/esp8266/fatfs_port.c
+++ b/esp8266/fatfs_port.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/gccollect.c b/esp8266/gccollect.c
index 1b9349f57..cd5d4932c 100644
--- a/esp8266/gccollect.c
+++ b/esp8266/gccollect.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/gccollect.h b/esp8266/gccollect.h
index 0aee42771..5735d8a39 100644
--- a/esp8266/gccollect.h
+++ b/esp8266/gccollect.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/hspi.c b/esp8266/hspi.c
index 436fb4f6f..554a50460 100644
--- a/esp8266/hspi.c
+++ b/esp8266/hspi.c
@@ -28,7 +28,7 @@
/*
Wrapper to setup HSPI/SPI GPIO pins and default SPI clock
spi_no - SPI (0) or HSPI (1)
-Not used in Micropython.
+Not used in MicroPython.
*/
void spi_init(uint8_t spi_no) {
spi_init_gpio(spi_no, SPI_CLK_USE_DIV);
@@ -48,7 +48,7 @@ Configures SPI mode parameters for clock edge and clock polarity.
(1) Data is valid on clock trailing edge
spi_cpol - (0) Clock is low when inactive
(1) Clock is high when inactive
-For Micropython this version is different from original.
+For MicroPython this version is different from original.
*/
void spi_mode(uint8_t spi_no, uint8_t spi_cpha, uint8_t spi_cpol) {
if (spi_cpol) {
@@ -99,7 +99,7 @@ void spi_init_gpio(uint8_t spi_no, uint8_t sysclk_as_spiclk) {
// GPIO14 is HSPI CLK pin (Clock)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);
// GPIO15 is HSPI CS pin (Chip Select / Slave Select)
- // In Micropython, we are handling CS ourself in drivers.
+ // In MicroPython, we are handling CS ourself in drivers.
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);
}
}
diff --git a/esp8266/machine_adc.c b/esp8266/machine_adc.c
index 73ec05208..c8c08695b 100644
--- a/esp8266/machine_adc.c
+++ b/esp8266/machine_adc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/machine_pin.c b/esp8266/machine_pin.c
index 6f75a0a6a..de65735ba 100644
--- a/esp8266/machine_pin.c
+++ b/esp8266/machine_pin.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/machine_pwm.c b/esp8266/machine_pwm.c
index 5d30f0965..8d73e6bb1 100644
--- a/esp8266/machine_pwm.c
+++ b/esp8266/machine_pwm.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c
index 984e8b6e8..2ad44318f 100644
--- a/esp8266/machine_rtc.c
+++ b/esp8266/machine_rtc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/main.c b/esp8266/main.c
index 43b83759e..957198aa0 100644
--- a/esp8266/main.c
+++ b/esp8266/main.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index 1aec1f90e..a63d50564 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c
index a621522d0..283abecaf 100644
--- a/esp8266/modnetwork.c
+++ b/esp8266/modnetwork.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c
index 9fe8039bc..e977191ee 100644
--- a/esp8266/modpyb.c
+++ b/esp8266/modpyb.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/moduos.c b/esp8266/moduos.c
index 807d2e18a..d0554096e 100644
--- a/esp8266/moduos.c
+++ b/esp8266/moduos.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/modutime.c b/esp8266/modutime.c
index bdeb3bb45..afb14dfd6 100644
--- a/esp8266/modutime.c
+++ b/esp8266/modutime.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index ab5591bb7..bbded43f4 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -1,6 +1,6 @@
#include
-// options to control how Micro Python is built
+// options to control how MicroPython is built
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)
#define MICROPY_ALLOC_PATH_MAX (128)
diff --git a/esp8266/qstrdefsport.h b/esp8266/qstrdefsport.h
index 7610eb33d..8f301a69c 100644
--- a/esp8266/qstrdefsport.h
+++ b/esp8266/qstrdefsport.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib
index bb48fd507..a9b653517 100644
--- a/examples/embedding/Makefile.upylib
+++ b/examples/embedding/Makefile.upylib
@@ -55,7 +55,7 @@ CFLAGS += -U _FORTIFY_SOURCE
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
-# The unix port of micropython on OSX must be compiled with clang,
+# The unix port of MicroPython on OSX must be compiled with clang,
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
diff --git a/examples/embedding/hello-embed.c b/examples/embedding/hello-embed.c
index e3a484783..3473e5bcd 100644
--- a/examples/embedding/hello-embed.c
+++ b/examples/embedding/hello-embed.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/examples/embedding/mpconfigport_minimal.h b/examples/embedding/mpconfigport_minimal.h
index 87c87fa97..5b96aa4b0 100644
--- a/examples/embedding/mpconfigport_minimal.h
+++ b/examples/embedding/mpconfigport_minimal.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-// options to control how Micro Python is built
+// options to control how MicroPython is built
#define MICROPY_ALLOC_PATH_MAX (PATH_MAX)
#define MICROPY_ENABLE_GC (1)
diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c
index 88c176803..af987cb7f 100644
--- a/extmod/machine_mem.c
+++ b/extmod/machine_mem.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/machine_mem.h b/extmod/machine_mem.h
index 4bc9ac127..a48a52c82 100644
--- a/extmod/machine_mem.h
+++ b/extmod/machine_mem.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index 4dda3c442..d79191b3e 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/modubinascii.h b/extmod/modubinascii.h
index 6c0156fc4..fb3169267 100644
--- a/extmod/modubinascii.h
+++ b/extmod/modubinascii.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index d2d2e85de..9678fd58f 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c
index 13525cc3f..f3beb3939 100644
--- a/extmod/moduhashlib.c
+++ b/extmod/moduhashlib.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c
index 567ee83da..e6e417d2b 100644
--- a/extmod/moduheapq.c
+++ b/extmod/moduheapq.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/modure.c b/extmod/modure.c
index b4c7a364f..b85ba2673 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/moduselect.c b/extmod/moduselect.c
index 2b8b87b5a..a9f25c195 100644
--- a/extmod/moduselect.c
+++ b/extmod/moduselect.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index be1aa0359..86dd8e29c 100644
--- a/extmod/modussl_axtls.c
+++ b/extmod/modussl_axtls.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c
index 6e045c403..a05d0f2ed 100644
--- a/extmod/moduzlib.c
+++ b/extmod/moduzlib.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h
index 63c4abb82..443e4eda8 100644
--- a/extmod/vfs_fat.h
+++ b/extmod/vfs_fat.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/extmod/vfs_fat_diskio.c b/extmod/vfs_fat_diskio.c
index 24c00ffba..ff23c6b0c 100644
--- a/extmod/vfs_fat_diskio.c
+++ b/extmod/vfs_fat_diskio.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* Original template for this file comes from:
* Low level disk I/O module skeleton for FatFs, (C)ChaN, 2013
diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c
index 22907c12a..8fb48f01a 100644
--- a/extmod/vfs_fat_file.c
+++ b/extmod/vfs_fat_file.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/libc/string0.c b/lib/libc/string0.c
index 1b37169ed..c2f2abd0f 100644
--- a/lib/libc/string0.c
+++ b/lib/libc/string0.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/libm/ef_rem_pio2.c b/lib/libm/ef_rem_pio2.c
index f7a695e17..ca55243fb 100644
--- a/lib/libm/ef_rem_pio2.c
+++ b/lib/libm/ef_rem_pio2.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/erf_lgamma.c b/lib/libm/erf_lgamma.c
index a0da86b8d..877816a0c 100644
--- a/lib/libm/erf_lgamma.c
+++ b/lib/libm/erf_lgamma.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/fdlibm.h b/lib/libm/fdlibm.h
index 529a3975a..ace3b2da2 100644
--- a/lib/libm/fdlibm.h
+++ b/lib/libm/fdlibm.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* This file is adapted from from newlib-nano-2, the newlib/libm/common/fdlib.h,
* available from https://github.com/32bitmicro/newlib-nano-2. The main change
diff --git a/lib/libm/kf_cos.c b/lib/libm/kf_cos.c
index f1f883ced..691f9842f 100644
--- a/lib/libm/kf_cos.c
+++ b/lib/libm/kf_cos.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/kf_rem_pio2.c b/lib/libm/kf_rem_pio2.c
index e267b65f9..c7e947957 100644
--- a/lib/libm/kf_rem_pio2.c
+++ b/lib/libm/kf_rem_pio2.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/kf_sin.c b/lib/libm/kf_sin.c
index 81390b4eb..07ea99344 100644
--- a/lib/libm/kf_sin.c
+++ b/lib/libm/kf_sin.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/kf_tan.c b/lib/libm/kf_tan.c
index 68254c682..6da9bd817 100644
--- a/lib/libm/kf_tan.c
+++ b/lib/libm/kf_tan.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/math.c b/lib/libm/math.c
index d7e27e775..984636627 100644
--- a/lib/libm/math.c
+++ b/lib/libm/math.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/libm/sf_cos.c b/lib/libm/sf_cos.c
index 33cde50e2..fabb129cd 100644
--- a/lib/libm/sf_cos.c
+++ b/lib/libm/sf_cos.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_erf.c b/lib/libm/sf_erf.c
index 00ac4baf1..3f0172c6e 100644
--- a/lib/libm/sf_erf.c
+++ b/lib/libm/sf_erf.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_frexp.c b/lib/libm/sf_frexp.c
index 397373fde..df50fb773 100644
--- a/lib/libm/sf_frexp.c
+++ b/lib/libm/sf_frexp.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_ldexp.c b/lib/libm/sf_ldexp.c
index a0941df9f..37968d475 100644
--- a/lib/libm/sf_ldexp.c
+++ b/lib/libm/sf_ldexp.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_modf.c b/lib/libm/sf_modf.c
index 4fcae057a..410db2a37 100644
--- a/lib/libm/sf_modf.c
+++ b/lib/libm/sf_modf.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/common
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_sin.c b/lib/libm/sf_sin.c
index 585ab8d8c..d27050778 100644
--- a/lib/libm/sf_sin.c
+++ b/lib/libm/sf_sin.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/sf_tan.c b/lib/libm/sf_tan.c
index a9296d8bf..148b16d61 100644
--- a/lib/libm/sf_tan.c
+++ b/lib/libm/sf_tan.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/wf_lgamma.c b/lib/libm/wf_lgamma.c
index 7d2f42c54..d86ede790 100644
--- a/lib/libm/wf_lgamma.c
+++ b/lib/libm/wf_lgamma.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/libm/wf_tgamma.c b/lib/libm/wf_tgamma.c
index afd16bf67..64b2488d1 100644
--- a/lib/libm/wf_tgamma.c
+++ b/lib/libm/wf_tgamma.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* These math functions are taken from newlib-nano-2, the newlib/libm/math
* directory, available from https://github.com/32bitmicro/newlib-nano-2.
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 5b35c8660..9d254d8cf 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/mp-readline/readline.h b/lib/mp-readline/readline.h
index f53fdeaa8..00aa9622a 100644
--- a/lib/mp-readline/readline.h
+++ b/lib/mp-readline/readline.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/netutils/netutils.c b/lib/netutils/netutils.c
index a2ea31cf3..a32452161 100644
--- a/lib/netutils/netutils.c
+++ b/lib/netutils/netutils.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/netutils/netutils.h b/lib/netutils/netutils.h
index 1e147afa9..4befc90db 100644
--- a/lib/netutils/netutils.h
+++ b/lib/netutils/netutils.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/timeutils/timeutils.c b/lib/timeutils/timeutils.c
index 06915f25a..eb3dc80d4 100644
--- a/lib/timeutils/timeutils.c
+++ b/lib/timeutils/timeutils.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -67,7 +67,7 @@ mp_uint_t timeutils_year_day(mp_uint_t year, mp_uint_t month, mp_uint_t date) {
void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm) {
// The following algorithm was adapted from musl's __secs_to_tm and adapted
- // for differences in Micro Python's timebase.
+ // for differences in MicroPython's timebase.
mp_int_t seconds = t - LEAPOCH;
diff --git a/lib/timeutils/timeutils.h b/lib/timeutils/timeutils.h
index 1dc486e2e..9b1abeb8f 100644
--- a/lib/timeutils/timeutils.h
+++ b/lib/timeutils/timeutils.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index 303edfcca..51dfa5b96 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index 7d0d1cc38..d3500b42b 100644
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h
index 69cdb4762..bc98ba94a 100644
--- a/lib/utils/pyexec.h
+++ b/lib/utils/pyexec.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/logo/FONT-LICENSE.txt b/logo/FONT-LICENSE.txt
index 18ac0379f..69c49d84c 100644
--- a/logo/FONT-LICENSE.txt
+++ b/logo/FONT-LICENSE.txt
@@ -1,4 +1,4 @@
-The font used for the Micro Python logo is "Exo",
+The font used for the MicroPython logo is "Exo",
http://www.google.com/fonts/specimen/Exo.
Copyright (c) 2013, Natanael Gama (https://plus.google.com/u/0/+NatanaelGama),
diff --git a/minimal/mpconfigport.h b/minimal/mpconfigport.h
index 47fc98429..ce4f8f240 100644
--- a/minimal/mpconfigport.h
+++ b/minimal/mpconfigport.h
@@ -1,6 +1,6 @@
#include
-// options to control how Micro Python is built
+// options to control how MicroPython is built
// You can disable the built-in MicroPython compiler by setting the following
// config option to 0. If you do this then you won't get a REPL prompt, but you
diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile
index c04adaf6a..cdec130ee 100644
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -44,7 +44,7 @@ COPT = -Os #-DNDEBUG
endif
# On OSX, 'gcc' is a symlink to clang unless a real gcc is installed.
-# The unix port of micropython on OSX must be compiled with clang,
+# The unix port of MicroPython on OSX must be compiled with clang,
# while cross-compile ports require gcc, so we test here for OSX and
# if necessary override the value of 'CC' set in py/mkenv.mk
ifeq ($(UNAME_S),Darwin)
diff --git a/pic16bit/board.c b/pic16bit/board.c
index 77f059fc7..0321b0ee2 100644
--- a/pic16bit/board.c
+++ b/pic16bit/board.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/board.h b/pic16bit/board.h
index f79dd3497..f45f87544 100644
--- a/pic16bit/board.h
+++ b/pic16bit/board.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/main.c b/pic16bit/main.c
index 343fe86d0..4a61c5ff5 100644
--- a/pic16bit/main.c
+++ b/pic16bit/main.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/modpyb.c b/pic16bit/modpyb.c
index 326d37f8a..4a608541e 100644
--- a/pic16bit/modpyb.c
+++ b/pic16bit/modpyb.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/modpyb.h b/pic16bit/modpyb.h
index 910ec1b6e..ac19fd2f3 100644
--- a/pic16bit/modpyb.h
+++ b/pic16bit/modpyb.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/modpybled.c b/pic16bit/modpybled.c
index 797246d13..eb04689aa 100644
--- a/pic16bit/modpybled.c
+++ b/pic16bit/modpybled.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/modpybswitch.c b/pic16bit/modpybswitch.c
index aa102e821..4af0c9dfc 100644
--- a/pic16bit/modpybswitch.c
+++ b/pic16bit/modpybswitch.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/mpconfigport.h b/pic16bit/mpconfigport.h
index e4113956b..3cd099c67 100644
--- a/pic16bit/mpconfigport.h
+++ b/pic16bit/mpconfigport.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/pic16bit_mphal.c b/pic16bit/pic16bit_mphal.c
index 557b1e0da..35955f2d3 100644
--- a/pic16bit/pic16bit_mphal.c
+++ b/pic16bit/pic16bit_mphal.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/pic16bit/pic16bit_mphal.h b/pic16bit/pic16bit_mphal.h
index ffcca41bf..f5da6cdc8 100644
--- a/pic16bit/pic16bit_mphal.h
+++ b/pic16bit/pic16bit_mphal.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/argcheck.c b/py/argcheck.c
index 9f225345d..22fd9cd2c 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmarm.c b/py/asmarm.c
index ff22aba90..552fdfb34 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmarm.h b/py/asmarm.h
index c5900925f..a302b1590 100644
--- a/py/asmarm.h
+++ b/py/asmarm.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 7e92e4de4..4360a6af9 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmthumb.h b/py/asmthumb.h
index 589c481cd..7070e03ac 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmx64.c b/py/asmx64.c
index 6775e8e93..aa2a8ec7c 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmx64.h b/py/asmx64.h
index a384cca00..425bdf2d3 100644
--- a/py/asmx64.h
+++ b/py/asmx64.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmx86.c b/py/asmx86.c
index dd3ad0224..6a78fbd5e 100644
--- a/py/asmx86.c
+++ b/py/asmx86.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/asmx86.h b/py/asmx86.h
index fd34228d1..0a00e2e7c 100644
--- a/py/asmx86.h
+++ b/py/asmx86.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/bc.c b/py/bc.c
index 2e481bce7..522eb0aeb 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/bc.h b/py/bc.h
index c55d31fe4..69e213e42 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/bc0.h b/py/bc0.h
index be8ac6c15..f671c5b5a 100644
--- a/py/bc0.h
+++ b/py/bc0.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -26,7 +26,7 @@
#ifndef MICROPY_INCLUDED_PY_BC0_H
#define MICROPY_INCLUDED_PY_BC0_H
-// Micro Python byte-codes.
+// MicroPython byte-codes.
// The comment at the end of the line (if it exists) tells the arguments to the byte-code.
#define MP_BC_LOAD_CONST_FALSE (0x10)
diff --git a/py/binary.c b/py/binary.c
index 4a999b9aa..e38aae8ea 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/binary.h b/py/binary.h
index 04cc6d83b..7b5c60f1a 100644
--- a/py/binary.h
+++ b/py/binary.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/builtin.h b/py/builtin.h
index 4915383f2..a637b6e22 100644
--- a/py/builtin.h
+++ b/py/builtin.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/builtinevex.c b/py/builtinevex.c
index 4390d0cc7..ba8048f70 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 7a8474cac..e0ce91d9b 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/compile.c b/py/compile.c
index d2e05d0b2..00052e190 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -569,7 +569,7 @@ STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int
for (int j = 0; j < this_scope->id_info_len; j++) {
id_info_t *id2 = &this_scope->id_info[j];
if (id2->kind == ID_INFO_KIND_FREE && id->qst == id2->qst) {
- // in Micro Python we load closures using LOAD_FAST
+ // in MicroPython we load closures using LOAD_FAST
EMIT_LOAD_FAST(id->qst, id->local_num);
nfree += 1;
}
@@ -654,9 +654,9 @@ STATIC void compile_funcdef_lambdef_param(compiler_t *comp, mp_parse_node_t pn)
if (comp->have_star) {
comp->num_dict_params += 1;
- // in Micro Python we put the default dict parameters into a dictionary using the bytecode
+ // in MicroPython we put the default dict parameters into a dictionary using the bytecode
if (comp->num_dict_params == 1) {
- // in Micro Python we put the default positional parameters into a tuple using the bytecode
+ // in MicroPython we put the default positional parameters into a tuple using the bytecode
// we need to do this here before we start building the map for the default keywords
if (comp->num_default_params > 0) {
EMIT_ARG(build_tuple, comp->num_default_params);
@@ -700,7 +700,7 @@ STATIC void compile_funcdef_lambdef(compiler_t *comp, scope_t *scope, mp_parse_n
return;
}
- // in Micro Python we put the default positional parameters into a tuple using the bytecode
+ // in MicroPython we put the default positional parameters into a tuple using the bytecode
// the default keywords args may have already made the tuple; if not, do it now
if (comp->num_default_params > 0 && comp->num_dict_params == 0) {
EMIT_ARG(build_tuple, comp->num_default_params);
@@ -3275,7 +3275,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
#endif
STATIC void scope_compute_things(scope_t *scope) {
- // in Micro Python we put the *x parameter after all other parameters (except **y)
+ // in MicroPython we put the *x parameter after all other parameters (except **y)
if (scope->scope_flags & MP_SCOPE_FLAG_VARARGS) {
id_info_t *id_param = NULL;
for (int i = scope->id_info_len - 1; i >= 0; i--) {
@@ -3313,7 +3313,7 @@ STATIC void scope_compute_things(scope_t *scope) {
// compute the index of cell vars
for (int i = 0; i < scope->id_info_len; i++) {
id_info_t *id = &scope->id_info[i];
- // in Micro Python the cells come right after the fast locals
+ // in MicroPython the cells come right after the fast locals
// parameters are not counted here, since they remain at the start
// of the locals, even if they are cell vars
if (id->kind == ID_INFO_KIND_CELL && !(id->flags & ID_FLAG_IS_PARAM)) {
@@ -3333,14 +3333,14 @@ STATIC void scope_compute_things(scope_t *scope) {
id_info_t *id2 = &scope->id_info[j];
if (id2->kind == ID_INFO_KIND_FREE && id->qst == id2->qst) {
assert(!(id2->flags & ID_FLAG_IS_PARAM)); // free vars should not be params
- // in Micro Python the frees come first, before the params
+ // in MicroPython the frees come first, before the params
id2->local_num = num_free;
num_free += 1;
}
}
}
}
- // in Micro Python shift all other locals after the free locals
+ // in MicroPython shift all other locals after the free locals
if (num_free > 0) {
for (int i = 0; i < scope->id_info_len; i++) {
id_info_t *id = &scope->id_info[i];
diff --git a/py/compile.h b/py/compile.h
index f6b262d18..3297e83ae 100644
--- a/py/compile.h
+++ b/py/compile.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emit.h b/py/emit.h
index a58e20e3d..2b2c904f6 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitbc.c b/py/emitbc.c
index 127bf0bf9..677020925 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitcommon.c b/py/emitcommon.c
index e914431d3..07b1dbb4c 100644
--- a/py/emitcommon.c
+++ b/py/emitcommon.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitglue.c b/py/emitglue.c
index fb7a54926..383e6a136 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitglue.h b/py/emitglue.h
index 309996596..43930333d 100644
--- a/py/emitglue.h
+++ b/py/emitglue.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c
index c1a4eac5d..577f65672 100644
--- a/py/emitinlinethumb.c
+++ b/py/emitinlinethumb.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/emitnative.c b/py/emitnative.c
index 99adc809c..5ed69ff9b 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/formatfloat.c b/py/formatfloat.c
index 2f10d425a..4130e8b26 100644
--- a/py/formatfloat.c
+++ b/py/formatfloat.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/formatfloat.h b/py/formatfloat.h
index 9c8d137bb..9a1643b4d 100644
--- a/py/formatfloat.h
+++ b/py/formatfloat.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/frozenmod.c b/py/frozenmod.c
index 1eaaf574a..06d4f84c8 100644
--- a/py/frozenmod.c
+++ b/py/frozenmod.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/frozenmod.h b/py/frozenmod.h
index 6993167ac..8cddef681 100644
--- a/py/frozenmod.h
+++ b/py/frozenmod.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/gc.c b/py/gc.c
index 2af886c56..7253b7db6 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/gc.h b/py/gc.h
index 136695517..739349c1f 100644
--- a/py/gc.h
+++ b/py/gc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/grammar.h b/py/grammar.h
index 0b70538d4..6abb1de8c 100644
--- a/py/grammar.h
+++ b/py/grammar.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -32,7 +32,7 @@
// # single_input is a single interactive statement;
// # file_input is a module or sequence of commands read from an input file;
// # eval_input is the input for the eval() functions.
-// # NB: compound_stmt in single_input is followed by extra NEWLINE! --> not in Micro Python
+// # NB: compound_stmt in single_input is followed by extra NEWLINE! --> not in MicroPython
// single_input: NEWLINE | simple_stmt | compound_stmt
// file_input: (NEWLINE | stmt)* ENDMARKER
// eval_input: testlist NEWLINE* ENDMARKER
diff --git a/py/lexer.c b/py/lexer.c
index 6e5cc18f4..32b3567cc 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/lexer.h b/py/lexer.h
index 435aa096b..a29709107 100644
--- a/py/lexer.h
+++ b/py/lexer.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -32,7 +32,7 @@
#include "py/qstr.h"
#include "py/reader.h"
-/* lexer.h -- simple tokeniser for Micro Python
+/* lexer.h -- simple tokeniser for MicroPython
*
* Uses (byte) length instead of null termination.
* Tokens are the same - UTF-8 with (byte) length.
diff --git a/py/malloc.c b/py/malloc.c
index f48cb8da4..e679e2092 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -46,7 +46,7 @@
#include "py/gc.h"
// We redirect standard alloc functions to GC heap - just for the rest of
-// this module. In the rest of micropython source, system malloc can be
+// this module. In the rest of MicroPython source, system malloc can be
// freely accessed - for interfacing with system and 3rd-party libs for
// example. On the other hand, some (e.g. bare-metal) ports may use GC
// heap as system heap, so, to avoid warnings, we do undef's first.
diff --git a/py/map.c b/py/map.c
index 50d74f38f..7f3c90059 100644
--- a/py/map.c
+++ b/py/map.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/misc.h b/py/misc.h
index cebbd38ea..71425b85e 100644
--- a/py/misc.h
+++ b/py/misc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mkrules.mk b/py/mkrules.mk
index e66082001..860074caa 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -47,7 +47,7 @@ $(BUILD)/%.o: %.c
$(call compile_c)
# List all native flags since the current build system doesn't have
-# the micropython configuration available. However, these flags are
+# the MicroPython configuration available. However, these flags are
# needed to extract all qstrings
QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB -DN_ARM -DN_XTENSA
QSTR_GEN_EXTRA_CFLAGS += -I$(BUILD)/tmp
diff --git a/py/modarray.c b/py/modarray.c
index 356e48bee..c0cdca928 100644
--- a/py/modarray.c
+++ b/py/modarray.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 8fbf4daeb..1711ae58b 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modcmath.c b/py/modcmath.c
index 7ad8f5ad6..627a2cbad 100644
--- a/py/modcmath.c
+++ b/py/modcmath.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modcollections.c b/py/modcollections.c
index e610a28d2..1a1560387 100644
--- a/py/modcollections.c
+++ b/py/modcollections.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modgc.c b/py/modgc.c
index 24564622e..d45e007eb 100644
--- a/py/modgc.c
+++ b/py/modgc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modio.c b/py/modio.c
index a6a093278..353a00286 100644
--- a/py/modio.c
+++ b/py/modio.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modmath.c b/py/modmath.c
index d5d135fc1..c56056a5d 100644
--- a/py/modmath.c
+++ b/py/modmath.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modmicropython.c b/py/modmicropython.c
index 46a3922e6..6fa3f9ad2 100644
--- a/py/modmicropython.c
+++ b/py/modmicropython.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modstruct.c b/py/modstruct.c
index 3c99ef1d8..1daa33338 100644
--- a/py/modstruct.c
+++ b/py/modstruct.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/modsys.c b/py/modsys.c
index 0a8f3cd50..ee6f8686e 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -87,7 +87,7 @@ STATIC const mp_rom_obj_tuple_t mp_sys_implementation_obj = {
#undef I
#ifdef MICROPY_PY_SYS_PLATFORM
-/// \constant platform - the platform that Micro Python is running on
+/// \constant platform - the platform that MicroPython is running on
STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM);
#endif
diff --git a/py/mphal.h b/py/mphal.h
index 93a0a40ce..92de01d08 100644
--- a/py/mphal.h
+++ b/py/mphal.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mpprint.c b/py/mpprint.c
index 0afd8ca3b..6c02d7cef 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mpprint.h b/py/mpprint.h
index 20bd875b4..07462bddc 100644
--- a/py/mpprint.h
+++ b/py/mpprint.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mpstate.c b/py/mpstate.c
index 4fc8bc506..6ce64adfd 100644
--- a/py/mpstate.c
+++ b/py/mpstate.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mpstate.h b/py/mpstate.h
index b09ba08cf..eca14a9e4 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -36,7 +36,7 @@
#include "py/objlist.h"
#include "py/objexcept.h"
-// This file contains structures defining the state of the Micro Python
+// This file contains structures defining the state of the MicroPython
// memory system, runtime and virtual machine. The state is a global
// variable, but in the future it is hoped that the state can become local.
diff --git a/py/mpz.c b/py/mpz.c
index f58e262e2..d300a8e5d 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/mpz.h b/py/mpz.h
index 55967cc4c..e2d0c30aa 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/nativeglue.c b/py/nativeglue.c
index c75e5ec04..46c6906d9 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -42,7 +42,7 @@
#if MICROPY_EMIT_NATIVE
-// convert a Micro Python object to a valid native value based on type
+// convert a MicroPython object to a valid native value based on type
mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
DEBUG_printf("mp_convert_obj_to_native(%p, " UINT_FMT ")\n", obj, type);
switch (type & 0xf) {
@@ -66,7 +66,7 @@ mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) {
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
-// convert a native value to a Micro Python object based on type
+// convert a native value to a MicroPython object based on type
mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type) {
DEBUG_printf("mp_convert_native_to_obj(" UINT_FMT ", " UINT_FMT ")\n", val, type);
switch (type & 0xf) {
diff --git a/py/nlr.h b/py/nlr.h
index 624e97307..63fe392d9 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/nlrsetjmp.c b/py/nlrsetjmp.c
index c3873e0b6..1fb459440 100644
--- a/py/nlrsetjmp.c
+++ b/py/nlrsetjmp.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/obj.c b/py/obj.c
index 1238b7011..515a95b2e 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/obj.h b/py/obj.h
index f88c10004..22bfda0f9 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objarray.c b/py/objarray.c
index 21479a800..99146bd4c 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objattrtuple.c b/py/objattrtuple.c
index 8c5e79575..3cc298d4e 100644
--- a/py/objattrtuple.c
+++ b/py/objattrtuple.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objbool.c b/py/objbool.c
index 5bc04bb6f..e5bc3c228 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 57be6a6cf..890f8b15b 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objcell.c b/py/objcell.c
index 06a88b954..111906412 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objclosure.c b/py/objclosure.c
index 3e12358bb..4eb9eb8b8 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objcomplex.c b/py/objcomplex.c
index e4fbed1e8..f945f3560 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objdict.c b/py/objdict.c
index 23d3008b8..a272ebdb6 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objenumerate.c b/py/objenumerate.c
index faae6516c..1a9d30f83 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objexcept.c b/py/objexcept.c
index 4722aca91..a9fe04094 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objexcept.h b/py/objexcept.h
index 2232e1e21..f67651a7e 100644
--- a/py/objexcept.h
+++ b/py/objexcept.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objfilter.c b/py/objfilter.c
index a655b8a78..cb965d8c3 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objfloat.c b/py/objfloat.c
index d0e616612..15edd810f 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objfun.c b/py/objfun.c
index 9f3589124..eaba13129 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -480,7 +480,7 @@ typedef mp_uint_t (*inline_asm_fun_2_t)(mp_uint_t, mp_uint_t);
typedef mp_uint_t (*inline_asm_fun_3_t)(mp_uint_t, mp_uint_t, mp_uint_t);
typedef mp_uint_t (*inline_asm_fun_4_t)(mp_uint_t, mp_uint_t, mp_uint_t, mp_uint_t);
-// convert a Micro Python object to a sensible value for inline asm
+// convert a MicroPython object to a sensible value for inline asm
STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) {
// TODO for byte_array, pass pointer to the array
if (MP_OBJ_IS_SMALL_INT(obj)) {
diff --git a/py/objfun.h b/py/objfun.h
index 450c98f76..fbb351626 100644
--- a/py/objfun.h
+++ b/py/objfun.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objgenerator.c b/py/objgenerator.c
index 9d6e636b3..2f39f3a52 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objgenerator.h b/py/objgenerator.h
index d61332a20..80bf9cd86 100644
--- a/py/objgenerator.h
+++ b/py/objgenerator.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index a3c754448..afd6fb22b 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objint.c b/py/objint.c
index 2749ec51c..29d889629 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objint.h b/py/objint.h
index f341306ed..394c23714 100644
--- a/py/objint.h
+++ b/py/objint.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objint_longlong.c b/py/objint_longlong.c
index 1d184a7dc..02c005d2f 100644
--- a/py/objint_longlong.c
+++ b/py/objint_longlong.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 26492aab4..0791a8af2 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objlist.c b/py/objlist.c
index 45e69c8bc..ba1c50677 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objlist.h b/py/objlist.h
index 740ba9fda..28b5495a9 100644
--- a/py/objlist.h
+++ b/py/objlist.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objmap.c b/py/objmap.c
index 111c964fd..908c61507 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objmodule.c b/py/objmodule.c
index 43bb36b98..fc8507c27 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objmodule.h b/py/objmodule.h
index 5bfbe51d5..b5c07dc33 100644
--- a/py/objmodule.h
+++ b/py/objmodule.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index 7ec5c2f41..fb9d9f02c 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objnone.c b/py/objnone.c
index 5d5b83540..cd7319bec 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objobject.c b/py/objobject.c
index f9a7d17c3..49d2ec62e 100644
--- a/py/objobject.c
+++ b/py/objobject.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objproperty.c b/py/objproperty.c
index 8189935d2..0934fad05 100644
--- a/py/objproperty.c
+++ b/py/objproperty.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objrange.c b/py/objrange.c
index 8c4e14f49..33b07a9d4 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objreversed.c b/py/objreversed.c
index fc85e72bf..a596a2fde 100644
--- a/py/objreversed.c
+++ b/py/objreversed.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objset.c b/py/objset.c
index f74bc74a0..376439b73 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objsingleton.c b/py/objsingleton.c
index 394c12767..ea72ae38c 100644
--- a/py/objsingleton.c
+++ b/py/objsingleton.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objslice.c b/py/objslice.c
index 928be6dab..358c44d06 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objstr.c b/py/objstr.c
index cea10770c..ddad7d3bd 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objstr.h b/py/objstr.h
index 6fbed405a..3aef8c68e 100644
--- a/py/objstr.h
+++ b/py/objstr.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objstringio.c b/py/objstringio.c
index 645c441cb..046d32580 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index d53428586..0cf791ff7 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objtuple.c b/py/objtuple.c
index eaf0e37f4..0b05755fb 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objtuple.h b/py/objtuple.h
index 686702395..05c6490fe 100644
--- a/py/objtuple.h
+++ b/py/objtuple.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objtype.c b/py/objtype.c
index 0c0826cf9..a258915f3 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -917,8 +917,8 @@ const mp_obj_type_t mp_type_type = {
};
mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) {
- assert(MP_OBJ_IS_TYPE(bases_tuple, &mp_type_tuple)); // Micro Python restriction, for now
- assert(MP_OBJ_IS_TYPE(locals_dict, &mp_type_dict)); // Micro Python restriction, for now
+ assert(MP_OBJ_IS_TYPE(bases_tuple, &mp_type_tuple)); // MicroPython restriction, for now
+ assert(MP_OBJ_IS_TYPE(locals_dict, &mp_type_dict)); // MicroPython restriction, for now
// TODO might need to make a copy of locals_dict; at least that's how CPython does it
diff --git a/py/objtype.h b/py/objtype.h
index 104b20aab..52419f3cd 100644
--- a/py/objtype.h
+++ b/py/objtype.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/objzip.c b/py/objzip.c
index 6f72d1595..0183925e3 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/opmethods.c b/py/opmethods.c
index 80a953fb8..1200ba39e 100644
--- a/py/opmethods.c
+++ b/py/opmethods.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parse.c b/py/parse.c
index 2f16748a6..e399aac53 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parse.h b/py/parse.h
index fec18825b..9a1a2b4dd 100644
--- a/py/parse.h
+++ b/py/parse.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parsenum.c b/py/parsenum.c
index 177118843..b62029f7c 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parsenum.h b/py/parsenum.h
index 77fd0f4a5..a5bed731d 100644
--- a/py/parsenum.h
+++ b/py/parsenum.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parsenumbase.c b/py/parsenumbase.c
index 73a3372f0..ba1059122 100644
--- a/py/parsenumbase.c
+++ b/py/parsenumbase.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/parsenumbase.h b/py/parsenumbase.h
index 143796df4..3a525f993 100644
--- a/py/parsenumbase.h
+++ b/py/parsenumbase.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/qstr.c b/py/qstr.c
index 5aa161064..fdb38f1de 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/qstr.h b/py/qstr.h
index 4116eb81d..e2bdcc351 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 4581e5e1b..9375b9101 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/repl.c b/py/repl.c
index 8e55eb017..7e8922e19 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/repl.h b/py/repl.h
index c2499a270..a7a4136ca 100644
--- a/py/repl.h
+++ b/py/repl.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/runtime.c b/py/runtime.c
index ecc3ae2f5..6a0db007e 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -1038,7 +1038,7 @@ void mp_load_method_maybe(mp_obj_t obj, qstr attr, mp_obj_t *dest) {
} else if (type->locals_dict != NULL) {
// generic method lookup
// this is a lookup in the object (ie not class or type)
- assert(type->locals_dict->base.type == &mp_type_dict); // Micro Python restriction, for now
+ assert(type->locals_dict->base.type == &mp_type_dict); // MicroPython restriction, for now
mp_map_t *locals_map = &type->locals_dict->map;
mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
if (elem != NULL) {
diff --git a/py/runtime.h b/py/runtime.h
index 0add564cc..fe492885b 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/runtime0.h b/py/runtime0.h
index 060ee8c0a..d22c2fabe 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/runtime_utils.c b/py/runtime_utils.c
index e0495495a..56a918064 100644
--- a/py/runtime_utils.c
+++ b/py/runtime_utils.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/scope.c b/py/scope.c
index 8fe6f960a..1a6ae7b8a 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/scope.h b/py/scope.h
index 4d0c1b1d9..e3b6a57c7 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/sequence.c b/py/sequence.c
index 32db640dc..0752ee109 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/showbc.c b/py/showbc.c
index 0bccf8427..bb2b084ed 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/smallint.c b/py/smallint.c
index 4c42ee0cc..aa542ca7b 100644
--- a/py/smallint.c
+++ b/py/smallint.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/smallint.h b/py/smallint.h
index b2bfc6df9..42679a78f 100644
--- a/py/smallint.h
+++ b/py/smallint.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/stackctrl.c b/py/stackctrl.c
index 1843e7339..0bcd82f4f 100644
--- a/py/stackctrl.c
+++ b/py/stackctrl.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/stackctrl.h b/py/stackctrl.h
index 84c0e1427..ff8da0ab1 100644
--- a/py/stackctrl.h
+++ b/py/stackctrl.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/stream.c b/py/stream.c
index 018609903..5d1868153 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/stream.h b/py/stream.h
index 0b5fd7cc0..401ae313c 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/unicode.c b/py/unicode.c
index c6f872038..eddb007d5 100644
--- a/py/unicode.c
+++ b/py/unicode.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/unicode.h b/py/unicode.h
index f99c9705d..19487a65a 100644
--- a/py/unicode.h
+++ b/py/unicode.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/vm.c b/py/vm.c
index bb120e775..c7fc83d04 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/vmentrytable.h b/py/vmentrytable.h
index dd9789e34..352a6dc31 100644
--- a/py/vmentrytable.h
+++ b/py/vmentrytable.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/vstr.c b/py/vstr.c
index f41bd2e23..8a00f6c6f 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/py/warning.c b/py/warning.c
index 4cdf3b3f1..46b31ecca 100644
--- a/py/warning.c
+++ b/py/warning.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h
index ebec027e8..87e537af7 100644
--- a/qemu-arm/mpconfigport.h
+++ b/qemu-arm/mpconfigport.h
@@ -1,6 +1,6 @@
#include
-// options to control how Micro Python is built
+// options to control how MicroPython is built
#define MICROPY_ALLOC_PATH_MAX (512)
#define MICROPY_EMIT_X64 (0)
diff --git a/stmhal/accel.c b/stmhal/accel.c
index 0e6eaf03d..512a6e313 100644
--- a/stmhal/accel.c
+++ b/stmhal/accel.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -102,7 +102,7 @@ STATIC void accel_start(void) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
#define NUM_AXIS (3)
#define FILT_DEPTH (4)
diff --git a/stmhal/accel.h b/stmhal/accel.h
index 42b156329..fc35f7775 100644
--- a/stmhal/accel.h
+++ b/stmhal/accel.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/stmhal/adc.c b/stmhal/adc.c
index 6485e2ab7..dd59e29c8 100644
--- a/stmhal/adc.c
+++ b/stmhal/adc.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -263,7 +263,7 @@ STATIC uint32_t adc_read_channel(ADC_HandleTypeDef *adcHandle) {
}
/******************************************************************************/
-/* Micro Python bindings : adc object (single channel) */
+/* MicroPython bindings : adc object (single channel) */
STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_obj_adc_t *self = self_in;
@@ -596,7 +596,7 @@ float adc_read_core_vref(ADC_HandleTypeDef *adcHandle) {
#endif
/******************************************************************************/
-/* Micro Python bindings : adc_all object */
+/* MicroPython bindings : adc_all object */
STATIC mp_obj_t adc_all_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check number of arguments
diff --git a/stmhal/adc.h b/stmhal/adc.h
index 6ec558464..c90e6b343 100644
--- a/stmhal/adc.h
+++ b/stmhal/adc.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/stmhal/bufhelper.c b/stmhal/bufhelper.c
index ca76e9496..79511969b 100644
--- a/stmhal/bufhelper.c
+++ b/stmhal/bufhelper.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/stmhal/bufhelper.h b/stmhal/bufhelper.h
index 55f57be8e..c1967bf43 100644
--- a/stmhal/bufhelper.h
+++ b/stmhal/bufhelper.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/stmhal/can.c b/stmhal/can.c
index 6152022b7..9047e78ca 100644
--- a/stmhal/can.c
+++ b/stmhal/can.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -262,7 +262,7 @@ STATIC HAL_StatusTypeDef CAN_Transmit(CAN_HandleTypeDef *hcan, uint32_t Timeout)
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC void pyb_can_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_can_obj_t *self = self_in;
diff --git a/stmhal/can.h b/stmhal/can.h
index 7c40e9bf9..860012813 100644
--- a/stmhal/can.h
+++ b/stmhal/can.h
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
diff --git a/stmhal/dac.c b/stmhal/dac.c
index 243aa08c3..cdb3a9bcd 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -1,5 +1,5 @@
/*
- * This file is part of the Micro Python project, http://micropython.org/
+ * This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@@ -124,7 +124,7 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
typedef enum {
DAC_STATE_RESET,
diff --git a/stmhal/dac.h b/stmhal/dac.h
index 93192c0fe..f487f52a9 100644
--- a/stmhal/dac.h
+++ b/stmhal/dac |