` 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 63d9941b1f..4d822d6fa6 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 38a8c1d307..7ee1180ec2 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 7ee1180ec2..3a9269eb17 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 2b20d47ab3..bb1d613584 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 bb1d613584..b9b1125572 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 0000000000..6ed79cc7ce
--- /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 f52b4b385e..d096c6ec48 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 658d46ecd1..365248dc76 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 465cf54ad3..59e4ec1722 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 abc8b7933f..c823aed3e6 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 9d5cf7b4ba..a6f13d48c1 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 09054becc4..0bec35cc90 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 a8d359eb47..0664d5b09d 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 4e9de9ac67..96de67acc4 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 6b9a764ba8..50ed658cc1 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 c17dac0675..f822f1e7f3 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 1239c6394e..7042a9e376 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 724bc90ee1..0932d0ab55 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 1e7f33161a..7c52c1eead 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 92f277af42..67f4f54a1d 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 a4026e98c3..e330207dbd 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 a52d4bf9a1..70d4f49fc2 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 62b6db777b..c71b283ccb 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 a0a0ab65c0..81915d0a8d 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 933e70ac57..a39f5ee733 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 8775ec3e07..e531407b0f 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 6ed79cc7ce..1db89cb7e1 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 1db89cb7e1..319c53735f 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 b9b1125572..2c3423d99b 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 e758dd0062..b9cc1b1dab 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 d332348973..519acecda5 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 ea82f89d61..9d8f783dec 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 07f245a30d..1bfeb0bdac 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 7edba8f545..15c04c0fba 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 1d040f6ccc..8cb801f4d6 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 bc4726ce2d..91fea24e7a 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 07f136c9b4..1dc155f149 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 9d8f783dec..2255a75607 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 3a9269eb17..84f3a3aecf 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 8a59628e2d..e884f266ee 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 0000000000..0cdcc84487
--- /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 47df80d7ba..6d186fcd2f 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 07b8b15bf7..cf250d27f1 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 a4c00a2cb8..77084ec9ee 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 0ae3d768ef..a195d2602c 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 8cb801f4d6..97e9aabc0b 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 84f3a3aecf..76e5e18d72 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 0000000000..fcbc382a93
--- /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 0000000000..1bbf808b69
--- /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 0000000000..8a892d3c2f
--- /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 0000000000..4f5962dcbd
--- /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 d04634ac38..42b862fcf5 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 fcbc382a93..42cc9d68cd 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 a8e379020c..fc07020252 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 258a86b606..9dbadd5300 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 1c372f73c4..243aa08c3e 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 04c874dc27..e43b67e73d 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 29de8b8daa..e374be0e50 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 b8da948ab5..7322c6a5ba 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 18882fa47a..eabbf08e4a 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 97af35c491..58c43a55eb 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 200d13a5a9..7b3906f250 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 2571bc3a01..a5a9874d1c 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 bc9c889c26..755684570d 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 1f1aa5a2d2..6ea6938ada 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 913f1c9315..357b6d79d7 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 266b8a92a5..a63bd3c570 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 64d445111a..7db15f6492 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 1da987d89a..e2bd6c949f 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 5415eb10b4..b69ba52c2f 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 272c575ef5..2b4967a434 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 34feb384ea..4a999b9aab 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 caa5945bf2..5ac0f933a3 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 bf2bfb8eae..0a3a4b12dc 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 b9cc1b1dab..cea10770c8 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 404c799123..7451d53b91 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 10713234c7..d5d135fc11 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 80d20bd8a5..2835b9bfbd 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 e531407b0f..fb1746fe8e 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 322fb4151a..b84c134792 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 1d8f59bd22..749160b4df 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 4f5962dcbd..d121b18c5e 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 12ba61b2e9..23d3008b8f 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 5142c7d8f5..7746e26a4b 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 169714a6b6..57d471b1fc 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 4b98751367..5b35c8660a 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 6d8f7cca46..8e55eb017d 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 c34a5b8692..048b0de0f9 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 8391cd08be..4a9ab194bb 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 bb2d452749..f94ec7db88 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 e0a7711121..f284938f38 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 930d96dc15..0b70538d48 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 f284938f38..70e7b39312 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 0000000000..519a2a1137
--- /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 dc9369d022..a503ea4f55 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 e99ba46ce5..0fe3a3ba1d 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 7746e26a4b..7a8474cac3 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 ec12a62c6c..127bf0bf9a 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 b16746b39b..ea5a07977b 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 abc1f3ebbb..6e5cc18f44 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 57d471b1fc..8fbf4daeb2 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 0b49041399..2749ec51c2 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 0a3a4b12dc..a8a1f73fa4 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 6a91552b5a..f41bd2e232 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 8cb0e60ccb..9d6e636b38 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 0000000000..d42e5ebfbc
--- /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 f651242862..bd4a1363cb 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 9e8cb31d0a..32ccd6f1de 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 70e7b39312..d2e05d0b2e 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 32ccd6f1de..c1337adf0e 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 0000000000..99713e790c
--- /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 35b898b303..0000000000
--- 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 4734a80627..5f3dca4dcd 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 adf4a17a8d..f0823ee11d 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 4b273d97f1..86ec816e90 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 096af430e4..1bf2a598a0 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 35119e28f5..4dc383f262 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 fd1602d65f..2871bda6c1 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 d1015e96cb..adc353361f 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 a142e47579..8d326cbbbb 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 647f61ba22..82a149d859 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 565fbad4b4..260b060ed6 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 f524fa8dc1..36e6f526b3 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 2de2e1a3c3..1460372bb1 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 0000000000..4985962059
--- /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 036682b498..4e17bbae62 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 c7be6461e8..c1f88defce 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 be324dd3dd..83c79ac96d 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 | 53 +++++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 28 deletions(-)
diff --git a/py/gc.c b/py/gc.c
index 937dae44f7..2af886c56b 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)) {
- 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;
- }
-
- // 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
- } else {
- GC_EXIT();
- assert(!"bad free");
- }
- } else if (ptr != NULL) {
+ if (ptr == NULL) {
GC_EXIT();
- assert(!"bad free");
} else {
+ // get the GC block number corresponding to this pointer
+ assert(VERIFY_PTR(ptr));
+ size_t block = BLOCK_FROM_PTR(ptr);
+ assert(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;
+ }
+
+ // 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 e84822957d..d065180d8a 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 4c44022c32..d531a594a1 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 96a330d139..d3ce11e02d 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 6ea6938ada..2916ca2807 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 9e5f9593b4..fac19ee97b 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 2916ca2807..e4bcbc30e5 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 7db15f6492..39f168fc89 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 a8fef9309f..7991601457 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 3e4a75b9ed..c586853b52 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 2f25267795..b4677f3ed5 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 772335c0a1..f0e57d7566 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 4b314335c0..e5285d4e46 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 4b2aca9ac5..7c04c7b054 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 13b044dcfa..7d16002e46 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 b581d0fc8a..dcca704728 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 fcb85b2928..9953f0e5a2 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 b3b1c61624..3bb87e32b9 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 e38d129db0..46a9b8cb04 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 2f9d1877c8..d23381cafc 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 3fd21ee094..8b4ab2f1b8 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 8a886c3e40..8e1196e868 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 c04b70021f..3e784e9aec 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 MODUBINASCII_H_
-#define MODUBINASCII_H_
+#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
+#define MICROPY_INCLUDED_CC3200_MODS_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 4c8bc96595..148cddf2e2 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 851f8e5be7..80c1f24cd8 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 3bfd1fbbf9..d37d276e8c 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 b77c4af422..50640ee603 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 7adffb2d99..d547f6330e 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 ad02cc777a..6b4b7b1ed8 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 5111b78f7c..3fd11ecd60 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 a06df6d8d1..084d7caaf2 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 d34895ae0d..513e6fa951 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 48e0edd613..b533b6056e 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 4e9de138d8..a1b30cd2b0 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 19bc93607d..56440987f6 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 f87f0a7738..2844587cb3 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 4bd583a4b8..78f8c09480 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 e0d2f0eec1..9276cfc3ed 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 2b49232ddf..dc9ba99204 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 2786ff6976..77a3af2f3d 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 aa55313940..1e3173b11a 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 d9f624d192..df3a8475c9 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 c8590f5c2c..ee7571c265 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 281e84aa83..3c4232b847 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 1f7d2fece4..0277a754b1 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 67fd1ff855..60b0b86639 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 51416f0fce..1c5509db05 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 69b17658ff..1309201eec 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 c8315d771c..83e3f8c075 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 20954036df..883e077961 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 d2e817450c..967352b04e 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 d783f1f09a..1d1d6de3fb 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 82c92025d3..dd7c5ab729 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 4b20afda58..c444740ff9 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 242a9a2a6f..1ee4a2f55a 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 dba0c5fa64..33a9d3a002 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 90af63ba2d..34787779f9 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 d81cba12c4..0aee427711 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 414aaa85b0..eae351f68d 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 f6850c42db..ebcd8b051a 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 856ff075ac..595052fc73 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 0a7907d347..400dc6ec75 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 51710701a2..d310fc339f 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 e4a33b2381..2122f30f04 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 d49ff01e46..f5af6656f5 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 fddd7d46c1..4bc9ac127e 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 ece3384cc6..c96abbc46c 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 cc1c4eda5f..e303dca02e 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 7f88cbaa87..df1c3e2e90 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 88a3e19f41..e24e41eb3d 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 d7ead06549..6c13592c75 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 33d0f1cbd8..6c0156fc4e 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 7da147561c..2720147dfd 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 644387b676..88a9ed4d37 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 edaeb53496..f2efdbe795 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 6c7c05a9ac..63c4abb826 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 0410103505..706affc192 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 f73934d237..f53fdeaa85 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 45e0216402..1e147afa95 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 c3f1fc2db1..1dc486e2e4 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 ae0bf57e8a..ca50d4d567 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 0c7567e273..69cdb47620 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 0eb022436b..f79dd34973 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 6c68cbdfdd..910ec1b6e2 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 a858f7e0fd..ffcca41bfd 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 cdd9fe0616..5b60c8a626 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 e273b98d73..c5900925f6 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 52e663b3bd..589c481cd5 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 4499c53c32..a384cca007 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 0b44af6639..fd34228d10 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 88045dc55b..c55d31fe4c 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 b5650abe41..be8ac6c15c 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 997d878c81..04cc6d83be 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 ec326d037b..4915383f25 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 45a98588d8..f6b262d18c 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 0236a9b8d0..a58e20e3d7 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 37c4f1b18f..3099965966 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 0196034471..9c8d137bb1 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 7c1299b2c5..6993167ac4 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 7d8fe2bf8c..1366955170 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 5d998b3521..435aa096b1 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 5ac0f933a3..cebbd38ea0 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 32d64828d1..fb507a503e 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 6ea99ae227..c515ed4888 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 8d5654f9e3..93a0a40ced 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 4fc904a20a..20bd875b4a 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 2b8f29a6ae..b09ba08cfe 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 04d4f19684..602df830c4 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 5c88227223..878febf8b4 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 7a71ef34bd..624e973070 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 a3c06a261a..f88c100047 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 06a2a07efb..0389668458 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 3128fded79..2232e1e214 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 d02fada9b1..450c98f765 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 d1b9be4780..d61332a206 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 da56c18624..f341306ed7 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 5b2d216fc2..740ba9fda9 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 4e6612adc7..5bfbe51d5f 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 e92832d106..6fbed405a7 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 555c3b3c2c..6867023959 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 61efd00c05..104b20aab1 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 769f5a8757..fec18825b8 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 f140cfc85e..77fd0f4a50 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 9da9db8412..143796df48 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 8c63fbbc8d..4116eb81d4 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 048b0de0f9..c2499a270a 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 5e108afad7..b416927060 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 d75d23ff18..0add564cc6 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 720fe6a23b..060ee8c0ad 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 826064d7ef..4d0c1b1d9b 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 b9686be30a..b2bfc6df91 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 e915f5000f..84c0e1427e 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 01199ab601..0b5fd7cc09 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 89c28ed0ec..f99c9705d5 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 10b095f799..42b1563292 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 ebaccbee3d..6ec5584643 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 abdeea6a80..55f57be8e4 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 4d4b1bb833..7c40e9bf99 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 ba44158f39..93192c0fee 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 57b8f866d9..d8b11ca3a9 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 b04224c401..0eae8942ce 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 007155ecb5..c5b5bf3522 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 7f928edda4..f27277760f 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 07797be7e4..2cb32a8d45 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 fc7a6f613e..eda076e829 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 35187520a0..8d44b50edf 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 6a4b004bd9..be4f6ed251 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 f4cd673362..fc93481818 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 164c5cfda2..ac39f854ed 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 d3bc5674de..83e4255d5a 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 d3ce11e02d..a8ea2f02aa 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 3d8b4ef011..8e2372dcb4 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 77c78d4c18..b64e61386d 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 a11b0a0f8e..1ec4bd6b87 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 0b460f38c2..4e892da963 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 6edb2400e2..f628f934bc 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 ce1833e80b..f022f3a677 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 69d64c778a..f382fa6b63 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 237e48d8b9..d595f0f1af 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 0fca8fea17..18fd493d52 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 5686bde649..e6752fdd18 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 a168cda838..d6ed1b2b9b 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 4d3de77eda..0ecb5715a2 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 1e7f623355..524afae40e 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 a18d7cf104..72e461f2f1 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 7fdc59de75..7495309542 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 42e6c76f81..e04fe70d77 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 d96861a7e5..6f9a1e8a3f 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 93e222fc93..f48e364e1f 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 fbc874796e..b2ff75fa13 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 4a0d28ca82..a4bc8004af 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 bc9d0d21a6..ec03c860a4 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 b6dff2c431..9fbe6109d6 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 362d6ef68b..0a486f704d 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 3dc15300d7..ad627358b6 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 7f4ba18f26..5c45166ef2 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 e5d4be5eae..cd7326a435 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 5d1d27443b..0da6378ee7 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 5f1c87b693..1ad34353d9 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 42791877a3..ef55d22ddc 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 bfa7636f49..89095b0764 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 949d7a59c0..50fb3ff90d 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 8e8e97c795..591159deb5 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 7cbee33c5d..a76b87e644 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 51cf8d7860..b158ed5bcc 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 23d6d3d54d..c661c84d0c 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 69e577689e..480befef66 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 6172913ee1..fca06785a6 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 96bca1ccbe..a36648beb7 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 add10c8843..87787c3d8d 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 6f0a29a7e1..c7bb3acd7e 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 09ad4afdca..6c0c003321 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 596c59b178..84e4d10a88 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 7451d53b91..bb120e7757 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 cf1a86b3f0..6775e8e93d 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 d767062301..46a3922e6d 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 addcf8c854..3e107d418e 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 cec9737418..f825c3d70d 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 280db388f5..5e841a89c0 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 f9dce71ddd..982b958313 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 345a92d3c1..dd688a0246 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 30a5ff5884..4dd335b400 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 4663ad30ab..bb48fd5075 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 cf250d27f1..4dda3c4426 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 b4aeda744e..a202294a54 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 f5b643c6cc..c04adaf6ad 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 da07680e31..ff22aba90a 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 ea5a07977b..2f10d425a8 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 00ed279176..e660820016 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 2a119e40fb..0c0826cf93 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 a8a1f73fa4..ecc3ae2f51 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 fcae1b4c6e..e5dea49d08 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 53aa83d53b..415c258496 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 a91eee0798..a2e693b491 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 1a256c1317..c6107913f2 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 0b7bcb553c..d156e852a0 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 0feb5bd621..f358233a60 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 114158d8c8..bb9895d2a7 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 b9c29d624d..684078c430 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 d0d877818a..f77222715a 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 c7ddbbde3a..5260e0a500 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 39f168fc89..6513f95d37 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 735c6f168b..b4ff40e797 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 b028cd062a..3458f36a80 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 c868199e1c..5272f3e9c1 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 363d59d7bc..6d7264ae7e 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 214d6d622a..b8f0a2e9b0 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 f7df435773..ab5591bb7d 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 a27f0f1fe5..a5ab8896c0 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 9f8019a0bc..e8710ed51a 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 b4dd038606..cb9c51f7a1 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 d9a3833ccc..4390d0cc7c 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 59de5d69a2..fd4e65c539 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 64f139bb7e..697637f9d2 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 6d186fcd2f..68ed701beb 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 68ed701beb..e23acb469b 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 d615157970..994d26880d 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 1febe291f9..b56e3f4ce5 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 7c6c4b545d..1ffb981880 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 d446711a29..50c3c769da 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 9276cfc3ed..5345ecfda4 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 921ffc52d3..d15f520ac7 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 9e44339c86..3502624ab5 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 40dd8c049f..ad29666ae8 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 70891677d6..02f2df8e12 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 c515ed4888..f439f65554 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 92bb3e46e6..06938bdd40 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 127dd71a39..229daaf0f9 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 a5ab8896c0..be1aa0359c 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 ad29666ae8..f4b551cb9b 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 ce3c7dcbd5..9e3f16fe72 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 9e17d6a6d8..6c6e32c1a2 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 d888099dff..29a62ab898 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 edffa37c76..22907c12a2 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 4c88c72224..ca8d9633fa 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 5df45c4957..c4d18d53dc 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 f5675a2917..80473df882 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 878febf8b4..2ff404ffa8 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 80473df882..f58e262e23 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 2ff404ffa8..55967cc4c3 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 eb80407bcb..1d184a7dc2 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 d818b6f407..26492aab48 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 b1a26ca73d..0bd1662186 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 f4b551cb9b..ef3f319fe1 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 062a63c3b2..00a48379b6 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 ef3f319fe1..8c90c2cf46 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 00a48379b6..779214bb7d 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 8c90c2cf46..597eaee73d 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 d089312962..78d0c3feef 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 0000000000..0c89e7e92b
--- /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 9915cdd009..14d5df0a45 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 2d317d022a..a6a0932787 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 779214bb7d..d3318899a8 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 | 80 ++++++++++++++++++++++-----------------------
extmod/modonewire.c | 14 ++++----
extmod/modwebrepl.c | 20 ++++++------
3 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 01190d200c..48b4190e9e 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 },
+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_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 },
+ { 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 8583cc1c26..53c9456c20 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 9e3f16fe72..d618f5370d 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 0aeb0601fc..896f2f9193 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 5eaae27d6a..b85a05ccb0 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 | 30 ++++++++---------
esp8266/machine_rtc.c | 16 ++++-----
esp8266/machine_wdt.c | 8 ++---
esp8266/modesp.c | 53 ++++++++++++++---------------
esp8266/modmachine.c | 14 ++++----
esp8266/modnetwork.c | 78 +++++++++++++++++--------------------------
7 files changed, 93 insertions(+), 112 deletions(-)
diff --git a/esp8266/machine_adc.c b/esp8266/machine_adc.c
index f1fb5be315..73ec052082 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 febbc15878..6f75a0a6a9 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) },
+ { 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) },
- // 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) },
+ // 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 b92ce1d5a9..984e8b6e8d 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 83b5e8f322..5e23ff7826 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 b85a05ccb0..1aec1f90ee 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) },
+STATIC const mp_rom_map_elem_t esp_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_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 },
+ { 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 c26c633967..070e6fc54c 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 eb9d75e284..a621522d04 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_ROM_QSTR(MP_QSTR_STA_IF), MP_ROM_INT(STATION_IF)},
+ { MP_ROM_QSTR(MP_QSTR_AP_IF), MP_ROM_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_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_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_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_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_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 b8c427ba87..0a8f3cd50e 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 d3318899a8..f4e8571297 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 48b4190e9e..9d1a8c4d06 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 88dd29a49e..2b8b87b5ad 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 97e866bdb7..17f7945218 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 22ad1968d5..3f5e72f8bd 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 32ef5290b4..b3d766d1e2 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 9f04dbf237..af15cca350 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 9712857453..d03efe0240 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 e5285d4e46..5a370f8c99 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 e67fe23ae6..9c911a0d08 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 7c04c7b054..8f05bb320e 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 0d9ab35f83..cfb8dec21d 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 b56e3f4ce5..5461f9180a 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 7d16002e46..af4c14fa3b 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 fece70095b..5be2c6063c 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 dcca704728..51248e4bf3 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 dcaaf57e1b..742c9a6f7f 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 5c0e9c30fb..b4848e99e8 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 9953f0e5a2..71e245eeb1 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 739745e92a..ade516b9e4 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 1ffb981880..e2299e1460 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 dac9a92826..c618279b7e 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 0fbf79f0fc..afeed85e18 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 3bb87e32b9..c9d845453e 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 cce515898e..739303e193 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 81b853b482..082d940e2f 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 46a9b8cb04..1c3eb62697 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 068adb70b0..72b203fae3 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 d23381cafc..88134857c1 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 37149089f2..321663088d 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 8b4ab2f1b8..35ce66e2da 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 fd14856076..5f63d01967 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 d44f75acae..249e1be372 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 8e1196e868..6ec90a2bac 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 09f4b1e101..8bc2feacc1 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 3e784e9aec..eb9fc4f219 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 e1145e4d8f..c90c727c2a 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 ed8879bf3e..51dc5834d4 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 148cddf2e2..f183715c90 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 4e17bbae62..7393553607 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 80c1f24cd8..6e7758662e 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 95ecdbce7d..8082675718 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 48fde67e7e..428b00f93e 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 b4c18d1530..21a9cc63b5 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 68d892364f..77f5bd9915 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 d37d276e8c..b806644f55 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 696e7650b3..0b4f0ba68c 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 50640ee603..db04b006bc 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 9fc97d9140..9c62ffdc4c 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 d547f6330e..dcc3f0468c 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 c2a4691174..d59f113eb5 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 6b4b7b1ed8..74f0af2b3c 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 134bd440e7..14c4cd4199 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 3fd11ecd60..f73de3f5a7 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 306baea8ba..5ba6119b29 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 084d7caaf2..af942084d7 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 ced7fef852..a7488c5f14 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 513e6fa951..e98636178d 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 3cd384266a..9edad579a3 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 b533b6056e..b0fce88703 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 d25ac6c2b3..1ef9a4a440 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 a1b30cd2b0..0af0864ca1 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 06938bdd40..626357179b 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 56440987f6..d481242f1f 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 76c701ca07..114e7ac96a 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 2844587cb3..275c49435c 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 78f8c09480..dcde9aae09 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 50c3c769da..09be8c441d 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 5345ecfda4..a1c3eb2cbf 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 2fc56668c3..d5f22d70a8 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 6b5899e186..100b8d33b0 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 77a3af2f3d..c4533d7174 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 26e45a75f1..2f0818f6ba 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 1e3173b11a..51c5691041 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 d2d6222ffc..909dadc8cf 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 df3a8475c9..15d46b705b 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 166f99d985..421f837100 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 ee7571c265..6ede57e1e5 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 8963852f7a..baee2eeef9 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 3c4232b847..08d43d2837 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 0277a754b1..48e81bc61d 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 54aaa829cb..f8e9cdf0cb 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 60b0b86639..02cde6b522 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 1c5509db05..e178f4c2d0 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 eb25f3be3e..d0a7150485 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 1309201eec..e6cf851b1a 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 83e3f8c075..fccb95c521 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 b45c137c6c..7274a79278 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 e749d5376f..75a0c501ee 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 4f907e0b1d..88f25a2b8d 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 55f9a58948..61848fd343 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 1d1d6de3fb..913bd70dc9 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 02384f6055..a8865c817e 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 1b9349f574..cd5d4932c5 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 0aee427711..5735d8a390 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 436fb4f6f4..554a50460f 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 73ec052082..c8c08695bd 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 6f75a0a6a9..de65735ba7 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 5d30f09656..8d73e6bb17 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 984e8b6e8d..2ad44318f2 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 43b83759ec..957198aa05 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 1aec1f90ee..a63d505645 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 a621522d04..283abecafe 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 9fe8039bc6..e977191ee6 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 807d2e18a5..d0554096ed 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 bdeb3bb453..afb14dfd6a 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 ab5591bb7d..bbded43f4b 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 7610eb33da..8f301a69c5 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 bb48fd5075..a9b6535170 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 e3a4847835..3473e5bcd8 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 87c87fa971..5b96aa4b01 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 88c176803f..af987cb7f7 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 4bc9ac127e..a48a52c820 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 4dda3c4426..d79191b3e5 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 6c0156fc4e..fb31692678 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 d2d2e85de1..9678fd58fd 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 13525cc3fa..f3beb39399 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 567ee83da6..e6e417d2bc 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 b4c7a364fe..b85ba26737 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 2b8b87b5ad..a9f25c1954 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 be1aa0359c..86dd8e29c8 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 6e045c4034..a05d0f2ed0 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 63c4abb826..443e4eda82 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 24c00ffba1..ff23c6b0cd 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 22907c12a2..8fb48f01a6 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 1b37169edd..c2f2abd0f9 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 f7a695e179..ca55243fb4 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 a0da86b8df..877816a0c2 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 529a3975ac..ace3b2da22 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 f1f883ced0..691f9842fd 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 e267b65f9a..c7e9479571 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 81390b4ebb..07ea993446 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 68254c682c..6da9bd8171 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 d7e27e775b..984636627c 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 33cde50e28..fabb129cd9 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 00ac4baf1c..3f0172c6e9 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 397373fdeb..df50fb7737 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 a0941df9fd..37968d475a 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 4fcae057a5..410db2a373 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 585ab8d8c9..d270507785 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 a9296d8bfb..148b16d618 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 7d2f42c54b..d86ede790b 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 afd16bf674..64b2488d1d 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 5b35c8660a..9d254d8cfe 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 f53fdeaa85..00aa9622a8 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 a2ea31cf38..a324521613 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 1e147afa95..4befc90db0 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 06915f25ae..eb3dc80d4b 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 1dc486e2e4..9b1abeb8f3 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 303edfcca0..51dfa5b963 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 7d0d1cc38b..d3500b42b3 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 69cdb47620..bc98ba94a7 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 18ac0379f6..69c49d84c8 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 47fc984290..ce4f8f2404 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 c04adaf6ad..cdec130eed 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 77f059fc70..0321b0ee22 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 f79dd34973..f45f875449 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 343fe86d05..4a61c5ff53 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 326d37f8a1..4a608541e5 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 910ec1b6e2..ac19fd2f36 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 797246d13c..eb04689aa8 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 aa102e8217..4af0c9dfc5 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 e4113956b3..3cd099c67a 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 557b1e0dad..35955f2d3e 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 ffcca41bfd..f5da6cdc8d 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 9f225345d5..22fd9cd2c7 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 ff22aba90a..552fdfb344 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 c5900925f6..a302b15905 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 7e92e4de41..4360a6af9b 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 589c481cd5..7070e03ac2 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 6775e8e93d..aa2a8ec7cc 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 a384cca007..425bdf2d39 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 dd3ad02242..6a78fbd5ea 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 fd34228d10..0a00e2e7c2 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 2e481bce77..522eb0aeb0 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 c55d31fe4c..69e213e422 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 be8ac6c15c..f671c5b5a7 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 4a999b9aab..e38aae8ea3 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 04cc6d83be..7b5c60f1ac 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 4915383f25..a637b6e222 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 4390d0cc7c..ba8048f702 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 7a8474cac3..e0ce91d9be 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 d2e05d0b2e..00052e190a 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 f6b262d18c..3297e83aeb 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 a58e20e3d7..2b2c904f60 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 127bf0bf9a..6770209257 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 e914431d32..07b1dbb4ce 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 fb7a549264..383e6a136b 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 3099965966..43930333d6 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 c1a4eac5d0..577f656720 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 99adc809c7..5ed69ff9b0 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 2f10d425a8..4130e8b26b 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 9c8d137bb1..9a1643b4dd 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 1eaaf574a2..06d4f84c8e 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 6993167ac4..8cddef6819 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 2af886c56b..7253b7db68 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 1366955170..739349c1f5 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 0b70538d48..6abb1de8c0 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 6e5cc18f44..32b3567cc2 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 435aa096b1..a29709107d 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 f48cb8da4f..e679e20926 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 50d74f38f5..7f3c900590 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 cebbd38ea0..71425b85e1 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 e660820016..860074caae 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 356e48bee0..c0cdca9286 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 8fbf4daeb2..1711ae58b1 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 7ad8f5ad60..627a2cbadb 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 e610a28d24..1a1560387a 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 24564622ec..d45e007ebe 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 a6a0932787..353a002865 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 d5d135fc11..c56056a5dd 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 46a3922e6d..6fa3f9ad28 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 3c99ef1d8d..1daa333388 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 0a8f3cd50e..ee6f8686e0 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 93a0a40ced..92de01d08b 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 0afd8ca3b1..6c02d7cefb 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 20bd875b4a..07462bddcc 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 4fc8bc506e..6ce64adfd1 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 b09ba08cfe..eca14a9e44 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 f58e262e23..d300a8e5db 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 55967cc4c3..e2d0c30aac 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 c75e5ec047..46c6906d96 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 624e973070..63fe392d9e 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 c3873e0b6d..1fb4594403 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 1238b7011a..515a95b2e4 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 f88c100047..22bfda0f99 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 21479a800f..99146bd4c1 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 8c5e795757..3cc298d4e9 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 5bc04bb6f9..e5bc3c2287 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 57be6a6cfd..890f8b15b6 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 06a88b9547..111906412e 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 3e12358bbd..4eb9eb8b84 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 e4fbed1e8d..f945f35608 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 23d3008b8f..a272ebdb63 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 faae6516c0..1a9d30f836 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 4722aca914..a9fe040941 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 2232e1e214..f67651a7eb 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 a655b8a785..cb965d8c32 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 d0e6166121..15edd810f1 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 9f35891243..eaba131293 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 450c98f765..fbb3516261 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 9d6e636b38..2f39f3a52b 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 d61332a206..80bf9cd860 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 a3c754448f..afd6fb22b0 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 2749ec51c2..29d889629f 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 f341306ed7..394c23714b 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 1d184a7dc2..02c005d2fd 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 26492aab48..0791a8af2c 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 45e69c8bcf..ba1c506771 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 740ba9fda9..28b5495a92 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 111c964fdd..908c61507e 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 43bb36b98c..fc8507c27b 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 5bfbe51d5f..b5c07dc333 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 7ec5c2f412..fb9d9f02cf 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 5d5b83540d..cd7319bec8 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 f9a7d17c34..49d2ec62ee 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 8189935d20..0934fad058 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 8c4e14f49c..33b07a9d44 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 fc85e72bfb..a596a2fde3 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 f74bc74a07..376439b73e 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 394c127677..ea72ae38cc 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 928be6dab1..358c44d061 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 cea10770c8..ddad7d3bdf 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 6fbed405a7..3aef8c68e2 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 645c441cb2..046d325806 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 d534285865..0cf791ff7c 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 eaf0e37f47..0b05755fb3 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 6867023959..05c6490fe6 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 0c0826cf93..a258915f34 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 104b20aab1..52419f3cdc 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 6f72d15954..0183925e3c 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 80a953fb89..1200ba39ef 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 2f16748a6c..e399aac535 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 fec18825b8..9a1a2b4dd4 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 1771188434..b62029f7c7 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 77fd0f4a50..a5bed731d2 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 73a3372f0a..ba10591226 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 143796df48..3a525f993c 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 5aa1610648..fdb38f1dec 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 4116eb81d4..e2bdcc351e 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 4581e5e1b1..9375b9101a 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 8e55eb017d..7e8922e19a 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 c2499a270a..a7a4136cad 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 ecc3ae2f51..6a0db007e3 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 0add564cc6..fe492885b1 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 060ee8c0ad..d22c2fabe6 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 e0495495aa..56a9180645 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 8fe6f960ad..1a6ae7b8ad 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 4d0c1b1d9b..e3b6a57c79 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 32db640dc1..0752ee1098 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 0bccf8427f..bb2b084ed7 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 4c42ee0cc9..aa542ca7bf 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 b2bfc6df91..42679a78fb 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 1843e7339e..0bcd82f4f6 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 84c0e1427e..ff8da0ab13 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 0186099034..5d18681538 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 0b5fd7cc09..401ae313cd 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 c6f872038d..eddb007d5e 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 f99c9705d5..19487a65ae 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 bb120e7757..c7fc83d048 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 dd9789e348..352a6dc315 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 f41bd2e232..8a00f6c6f7 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 4cdf3b3f10..46b31ecca7 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 ebec027e80..87e537af74 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 0e6eaf03db..512a6e313a 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 42b1563292..fc35f77756 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 6485e2ab77..dd59e29c88 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 6ec5584643..c90e6b3433 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 ca76e9496d..79511969b7 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 55f57be8e4..c1967bf430 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 6152022b76..9047e78ca6 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 7c40e9bf99..8600128139 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 243aa08c3e..cdb3a9bcd7 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 93192c0fee..f487f52a92 100644
--- a/stmhal/dac.h
+++ b/stmhal/dac.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/dma.c b/stmhal/dma.c
index e43b67e73d..df6275d652 100644
--- a/stmhal/dma.c
+++ b/stmhal/dma.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/dma.h b/stmhal/dma.h
index d8b11ca3a9..55fb621758 100644
--- a/stmhal/dma.h
+++ b/stmhal/dma.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/extint.c b/stmhal/extint.c
index 70023557f4..24a68c2a22 100644
--- a/stmhal/extint.c
+++ b/stmhal/extint.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/extint.h b/stmhal/extint.h
index 0eae8942ce..846790b9be 100644
--- a/stmhal/extint.h
+++ b/stmhal/extint.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/flash.c b/stmhal/flash.c
index e374be0e50..bebb3a1619 100644
--- a/stmhal/flash.c
+++ b/stmhal/flash.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/flash.h b/stmhal/flash.h
index c5b5bf3522..688e70a3cd 100644
--- a/stmhal/flash.h
+++ b/stmhal/flash.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/font_petme128_8x8.h b/stmhal/font_petme128_8x8.h
index f27277760f..8b0cc9cb01 100644
--- a/stmhal/font_petme128_8x8.h
+++ b/stmhal/font_petme128_8x8.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/gccollect.c b/stmhal/gccollect.c
index d7223dedc3..937fb6f36e 100644
--- a/stmhal/gccollect.c
+++ b/stmhal/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/stmhal/gccollect.h b/stmhal/gccollect.h
index 2cb32a8d45..1b64a51a6a 100644
--- a/stmhal/gccollect.h
+++ b/stmhal/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/stmhal/hal/l4/inc/stm32l4xx_hal_uart.h b/stmhal/hal/l4/inc/stm32l4xx_hal_uart.h
index b890c3d987..52ca6406bc 100644
--- a/stmhal/hal/l4/inc/stm32l4xx_hal_uart.h
+++ b/stmhal/hal/l4/inc/stm32l4xx_hal_uart.h
@@ -1370,7 +1370,7 @@ void UART_AdvFeatureConfig(UART_HandleTypeDef *huart);
/**
* @}
*/
-/* Functions added by micropython */
+/* Functions added by MicroPython */
uint32_t HAL_UART_CalcBrr(uint32_t fck, uint32_t baud);
#ifdef __cplusplus
diff --git a/stmhal/hal/l4/src/stm32l4xx_hal_uart.c b/stmhal/hal/l4/src/stm32l4xx_hal_uart.c
index 2b0d76d301..adb3d79ab7 100644
--- a/stmhal/hal/l4/src/stm32l4xx_hal_uart.c
+++ b/stmhal/hal/l4/src/stm32l4xx_hal_uart.c
@@ -2104,7 +2104,7 @@ static HAL_StatusTypeDef UART_Receive_IT(UART_HandleTypeDef *huart)
/**
* @brief Calculate register BRR value without using uint64.
- * @note This function is added by the micropython project.
+ * @note This function is added by the MicroPython project.
* @param fck: Input clock frequency to the uart block in Hz.
* @param baud: baud rate should be one of {300, 600, 1200, 2400, 4800, 9600, 19200, 57600, 115200}.
* @retval BRR value
diff --git a/stmhal/help.c b/stmhal/help.c
index 83ef7e596f..87b2af526e 100644
--- a/stmhal/help.c
+++ b/stmhal/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/stmhal/i2c.c b/stmhal/i2c.c
index f77222715a..f102fd0f2c 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.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)
*
@@ -511,7 +511,7 @@ STATIC HAL_StatusTypeDef i2c_wait_dma_finished(I2C_HandleTypeDef *i2c, uint32_t
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
STATIC inline bool in_master_mode(pyb_i2c_obj_t *self) { return self->i2c->Init.OwnAddress1 == PYB_I2C_MASTER_ADDRESS; }
diff --git a/stmhal/i2c.h b/stmhal/i2c.h
index eda076e829..6affe3973b 100644
--- a/stmhal/i2c.h
+++ b/stmhal/i2c.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/irq.c b/stmhal/irq.c
index 44758e11bc..d6db8e83d8 100644
--- a/stmhal/irq.c
+++ b/stmhal/irq.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/irq.h b/stmhal/irq.h
index 8d44b50edf..2cf58639ea 100644
--- a/stmhal/irq.h
+++ b/stmhal/irq.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/lcd.c b/stmhal/lcd.c
index cdf9fa0d1a..7368193cf8 100644
--- a/stmhal/lcd.c
+++ b/stmhal/lcd.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/lcd.h b/stmhal/lcd.h
index be4f6ed251..c0d9bd97da 100644
--- a/stmhal/lcd.h
+++ b/stmhal/lcd.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/led.c b/stmhal/led.c
index 4b9895fc55..030a814dd6 100644
--- a/stmhal/led.c
+++ b/stmhal/led.c
@@ -279,7 +279,7 @@ void led_debug(int n, int delay) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_led_obj_t *self = self_in;
diff --git a/stmhal/led.h b/stmhal/led.h
index fc93481818..f1b05d1e28 100644
--- a/stmhal/led.h
+++ b/stmhal/led.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/main.c b/stmhal/main.c
index 566c2db07f..056c590cda 100644
--- a/stmhal/main.c
+++ b/stmhal/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)
*
@@ -511,7 +511,7 @@ soft_reset:
// GC init
gc_init(&_heap_start, &_heap_end);
- // Micro Python init
+ // MicroPython init
mp_init();
mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
diff --git a/stmhal/modnetwork.c b/stmhal/modnetwork.c
index 09a80ef3cb..6b4949a0de 100644
--- a/stmhal/modnetwork.c
+++ b/stmhal/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/stmhal/modnetwork.h b/stmhal/modnetwork.h
index 83e4255d5a..ecda94da41 100644
--- a/stmhal/modnetwork.h
+++ b/stmhal/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/stmhal/modnwcc3k.c b/stmhal/modnwcc3k.c
index 957d74e6ec..a04a2d260c 100644
--- a/stmhal/modnwcc3k.c
+++ b/stmhal/modnwcc3k.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)
*
@@ -412,7 +412,7 @@ STATIC int cc3k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request
}
/******************************************************************************/
-// Micro Python bindings; CC3K class
+// MicroPython bindings; CC3K class
typedef struct _cc3k_obj_t {
mp_obj_base_t base;
diff --git a/stmhal/modnwwiznet5k.c b/stmhal/modnwwiznet5k.c
index 4752cdc0bc..eb7eb84438 100644
--- a/stmhal/modnwwiznet5k.c
+++ b/stmhal/modnwwiznet5k.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)
*
@@ -314,7 +314,7 @@ STATIC mp_obj_t wiznet5k_socket_disconnect(mp_obj_t self_in) {
#endif
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
/// \classmethod \constructor(spi, pin_cs, pin_rst)
/// Create and return a WIZNET5K object.
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 7322c6a5ba..5dc28e1325 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/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/stmhal/modstm.c b/stmhal/modstm.c
index eabbf08e4a..2084c0aa0e 100644
--- a/stmhal/modstm.c
+++ b/stmhal/modstm.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/moduos.c b/stmhal/moduos.c
index ece6019fbf..77a60c0cbc 100644
--- a/stmhal/moduos.c
+++ b/stmhal/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/stmhal/modusocket.c b/stmhal/modusocket.c
index 081a322ae2..e1da53a4b3 100644
--- a/stmhal/modusocket.c
+++ b/stmhal/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/stmhal/modutime.c b/stmhal/modutime.c
index 58c43a55eb..fe13f80c06 100644
--- a/stmhal/modutime.c
+++ b/stmhal/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/stmhal/pendsv.c b/stmhal/pendsv.c
index 7b3906f250..00ea12f460 100644
--- a/stmhal/pendsv.c
+++ b/stmhal/pendsv.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/pendsv.h b/stmhal/pendsv.h
index b64e61386d..6a9eb0d794 100644
--- a/stmhal/pendsv.h
+++ b/stmhal/pendsv.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/pin.c b/stmhal/pin.c
index f30474e1f5..0dce0c1c08 100644
--- a/stmhal/pin.c
+++ b/stmhal/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/stmhal/pin.h b/stmhal/pin.h
index 1ec4bd6b87..90de79e5ce 100644
--- a/stmhal/pin.h
+++ b/stmhal/pin.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/pin_defs_stmhal.h b/stmhal/pin_defs_stmhal.h
index d6a2ef4242..6cf3b1b832 100644
--- a/stmhal/pin_defs_stmhal.h
+++ b/stmhal/pin_defs_stmhal.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/pin_named_pins.c b/stmhal/pin_named_pins.c
index fac19ee97b..726da54dd6 100644
--- a/stmhal/pin_named_pins.c
+++ b/stmhal/pin_named_pins.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/portmodules.h b/stmhal/portmodules.h
index 4e892da963..b575109b89 100644
--- a/stmhal/portmodules.h
+++ b/stmhal/portmodules.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/qstrdefsport.h b/stmhal/qstrdefsport.h
index 1d83f43bdd..31220c5a42 100644
--- a/stmhal/qstrdefsport.h
+++ b/stmhal/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/stmhal/rng.c b/stmhal/rng.c
index a5a9874d1c..c0c5e9aeb5 100644
--- a/stmhal/rng.c
+++ b/stmhal/rng.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/rng.h b/stmhal/rng.h
index f022f3a677..43e49fe72e 100644
--- a/stmhal/rng.h
+++ b/stmhal/rng.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/rtc.c b/stmhal/rtc.c
index 755684570d..4efc56d5c8 100644
--- a/stmhal/rtc.c
+++ b/stmhal/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)
*
@@ -412,7 +412,7 @@ STATIC void RTC_CalendarConfig(void) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
typedef struct _pyb_rtc_obj_t {
mp_obj_base_t base;
diff --git a/stmhal/rtc.h b/stmhal/rtc.h
index f382fa6b63..09ab2aedff 100644
--- a/stmhal/rtc.h
+++ b/stmhal/rtc.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/sdcard.c b/stmhal/sdcard.c
index 5260e0a500..dfa7158a4c 100644
--- a/stmhal/sdcard.c
+++ b/stmhal/sdcard.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)
*
@@ -356,7 +356,7 @@ mp_uint_t sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t n
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
//
// Expose the SD card as an object with the block protocol.
diff --git a/stmhal/sdcard.h b/stmhal/sdcard.h
index d595f0f1af..8c698fc2f7 100644
--- a/stmhal/sdcard.h
+++ b/stmhal/sdcard.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/servo.c b/stmhal/servo.c
index e4bcbc30e5..fa39587a8e 100644
--- a/stmhal/servo.c
+++ b/stmhal/servo.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)
*
@@ -147,7 +147,7 @@ STATIC void servo_init_channel(pyb_servo_obj_t *s) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
STATIC mp_obj_t pyb_servo_set(mp_obj_t port, mp_obj_t value) {
int p = mp_obj_get_int(port);
diff --git a/stmhal/servo.h b/stmhal/servo.h
index 18fd493d52..c602a07da5 100644
--- a/stmhal/servo.h
+++ b/stmhal/servo.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/spi.c b/stmhal/spi.c
index b710fc3a7c..574fed0739 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.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/spi.h b/stmhal/spi.h
index e6752fdd18..eda109a7ef 100644
--- a/stmhal/spi.h
+++ b/stmhal/spi.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/stm32_it.c b/stmhal/stm32_it.c
index 357b6d79d7..2111da1ae1 100644
--- a/stmhal/stm32_it.c
+++ b/stmhal/stm32_it.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 from ST Cube library. See below for header.
*
diff --git a/stmhal/stm32_it.h b/stmhal/stm32_it.h
index d6ed1b2b9b..b498dee8da 100644
--- a/stmhal/stm32_it.h
+++ b/stmhal/stm32_it.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/
*
* Original template from ST Cube library. See below for header.
*
diff --git a/stmhal/storage.c b/stmhal/storage.c
index 1931cd6079..6da1ba95c6 100644
--- a/stmhal/storage.c
+++ b/stmhal/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/
*
* The MIT License (MIT)
*
diff --git a/stmhal/storage.h b/stmhal/storage.h
index 0ecb5715a2..291e09a9ae 100644
--- a/stmhal/storage.h
+++ b/stmhal/storage.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/system_stm32.c b/stmhal/system_stm32.c
index a63bd3c570..7fc16b1483 100644
--- a/stmhal/system_stm32.c
+++ b/stmhal/system_stm32.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 modified. See below for original header.
*
diff --git a/stmhal/systick.c b/stmhal/systick.c
index 4eac583e2a..c07d0fabce 100644
--- a/stmhal/systick.c
+++ b/stmhal/systick.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/systick.h b/stmhal/systick.h
index 524afae40e..c1def50c29 100644
--- a/stmhal/systick.h
+++ b/stmhal/systick.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/timer.c b/stmhal/timer.c
index 6513f95d37..570558775b 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.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)
*
@@ -247,7 +247,7 @@ uint32_t timer_get_source_freq(uint32_t tim_id) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
STATIC const mp_obj_type_t pyb_timer_channel_type;
diff --git a/stmhal/timer.h b/stmhal/timer.h
index 72e461f2f1..775accc3d4 100644
--- a/stmhal/timer.h
+++ b/stmhal/timer.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/uart.c b/stmhal/uart.c
index b4ff40e797..ddff8b9f2a 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.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)
*
@@ -509,7 +509,7 @@ void uart_irq_handler(mp_uint_t uart_id) {
}
/******************************************************************************/
-/* 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/stmhal/uart.h b/stmhal/uart.h
index 7495309542..e96b25b5f4 100644
--- a/stmhal/uart.h
+++ b/stmhal/uart.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/usb.c b/stmhal/usb.c
index f70dea1428..9bf351f499 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.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)
*
@@ -169,7 +169,7 @@ void usb_vcp_send_strn_cooked(const char *str, int len) {
}
/******************************************************************************/
-// Micro Python bindings for USB
+// MicroPython bindings for USB
/*
Philosophy of USB driver and Python API: pyb.usb_mode(...) configures the USB
@@ -324,7 +324,7 @@ bad_mode:
MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_mode_obj, 0, pyb_usb_mode);
/******************************************************************************/
-// Micro Python bindings for USB VCP
+// MicroPython bindings for USB VCP
/// \moduleref pyb
/// \class USB_VCP - USB virtual comm port
@@ -525,7 +525,7 @@ const mp_obj_type_t pyb_usb_vcp_type = {
};
/******************************************************************************/
-// Micro Python bindings for USB HID
+// MicroPython bindings for USB HID
typedef struct _pyb_usb_hid_obj_t {
mp_obj_base_t base;
diff --git a/stmhal/usb.h b/stmhal/usb.h
index e04fe70d77..d39f49a6cc 100644
--- a/stmhal/usb.h
+++ b/stmhal/usb.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/usbd_cdc_interface.h b/stmhal/usbd_cdc_interface.h
index 6f9a1e8a3f..811a289280 100644
--- a/stmhal/usbd_cdc_interface.h
+++ b/stmhal/usbd_cdc_interface.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/
*/
#ifndef MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H
#define MICROPY_INCLUDED_STMHAL_USBD_CDC_INTERFACE_H
diff --git a/stmhal/usbd_conf.c b/stmhal/usbd_conf.c
index e2bd6c949f..d39144851f 100644
--- a/stmhal/usbd_conf.c
+++ b/stmhal/usbd_conf.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/
*/
/**
diff --git a/stmhal/usbd_conf.h b/stmhal/usbd_conf.h
index b69ba52c2f..34ebe27b9a 100644
--- a/stmhal/usbd_conf.h
+++ b/stmhal/usbd_conf.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/
*/
/**
diff --git a/stmhal/usbd_desc.c b/stmhal/usbd_desc.c
index 1ad960b468..09e1608c84 100644
--- a/stmhal/usbd_desc.c
+++ b/stmhal/usbd_desc.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/
*/
/**
diff --git a/stmhal/usbd_desc.h b/stmhal/usbd_desc.h
index f48e364e1f..05cbbe5b17 100644
--- a/stmhal/usbd_desc.h
+++ b/stmhal/usbd_desc.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/usbd_msc_storage.h b/stmhal/usbd_msc_storage.h
index a4bc8004af..6cc40d2d62 100644
--- a/stmhal/usbd_msc_storage.h
+++ b/stmhal/usbd_msc_storage.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/usbdev/class/inc/usbd_cdc_msc_hid0.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
index ec03c860a4..08882bb1ae 100644
--- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.h
+++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid0.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/usbdev/class/src/usbd_cdc_msc_hid.c b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c
index e0edf13702..d61073f4d5 100644
--- a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c
+++ b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.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/usrsw.c b/stmhal/usrsw.c
index 63cd440d41..a7721ad779 100644
--- a/stmhal/usrsw.c
+++ b/stmhal/usrsw.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)
*
@@ -63,7 +63,7 @@ int switch_get(void) {
}
/******************************************************************************/
-// Micro Python bindings
+// MicroPython bindings
typedef struct _pyb_switch_obj_t {
mp_obj_base_t base;
diff --git a/stmhal/usrsw.h b/stmhal/usrsw.h
index 9fbe6109d6..d96e3c2813 100644
--- a/stmhal/usrsw.h
+++ b/stmhal/usrsw.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/teensy/hal_ftm.c b/teensy/hal_ftm.c
index 28992881be..3c031bf6dd 100644
--- a/teensy/hal_ftm.c
+++ b/teensy/hal_ftm.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/teensy/hal_ftm.h b/teensy/hal_ftm.h
index ad627358b6..84fae8312b 100644
--- a/teensy/hal_ftm.h
+++ b/teensy/hal_ftm.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/teensy/help.c b/teensy/help.c
index 3b3916b943..ebe4bed6bf 100644
--- a/teensy/help.c
+++ b/teensy/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/teensy/led.c b/teensy/led.c
index c7ac8be1ff..c043e43996 100644
--- a/teensy/led.c
+++ b/teensy/led.c
@@ -81,7 +81,7 @@ void led_toggle(pyb_led_t led) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
void led_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_led_obj_t *self = self_in;
diff --git a/teensy/main.c b/teensy/main.c
index 41bbeb5d93..3edaa28a06 100644
--- a/teensy/main.c
+++ b/teensy/main.c
@@ -266,7 +266,7 @@ soft_reset:
// GC init
gc_init(&_heap_start, (void*)HEAP_END);
- // Micro Python init
+ // MicroPython init
mp_init();
mp_obj_list_init(mp_sys_path, 0);
mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script)
diff --git a/teensy/modpyb.c b/teensy/modpyb.c
index 9f601e327b..deb1f32f97 100644
--- a/teensy/modpyb.c
+++ b/teensy/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)
*
@@ -154,7 +154,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_sync_obj, pyb_sync);
/// \function millis()
/// 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.
STATIC mp_obj_t pyb_millis(void) {
@@ -185,7 +185,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
/// \function micros()
/// 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.
STATIC mp_obj_t pyb_micros(void) {
diff --git a/teensy/mpconfigport.h b/teensy/mpconfigport.h
index de30924d9e..69cd69d532 100644
--- a/teensy/mpconfigport.h
+++ b/teensy/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 (128)
#define MICROPY_EMIT_THUMB (1)
diff --git a/teensy/timer.c b/teensy/timer.c
index 45bcc2b8fb..bc560d85e0 100644
--- a/teensy/timer.c
+++ b/teensy/timer.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)
*
@@ -119,7 +119,7 @@ mp_uint_t get_prescaler_shift(mp_int_t prescaler) {
}
/******************************************************************************/
-/* Micro Python bindings */
+/* MicroPython bindings */
STATIC const mp_obj_type_t pyb_timer_channel_type;
diff --git a/teensy/timer.h b/teensy/timer.h
index 89095b0764..75c2e654e2 100644
--- a/teensy/timer.h
+++ b/teensy/timer.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/teensy/uart.c b/teensy/uart.c
index b4c0a4d5b6..3dd2c50519 100644
--- a/teensy/uart.c
+++ b/teensy/uart.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)
*
@@ -221,7 +221,7 @@ void uart_tx_strn_cooked(pyb_uart_obj_t *uart_obj, const char *str, uint len) {
}
/******************************************************************************/
-/* 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/tests/basics/bytearray_slice_assign.py b/tests/basics/bytearray_slice_assign.py
index 48f5938a58..7f7d1d119a 100644
--- a/tests/basics/bytearray_slice_assign.py
+++ b/tests/basics/bytearray_slice_assign.py
@@ -4,7 +4,7 @@ except TypeError:
print("SKIP")
raise SystemExit
-# test slices; only 2 argument version supported by Micro Python at the moment
+# test slices; only 2 argument version supported by MicroPython at the moment
x = bytearray(range(10))
# Assignment
diff --git a/tests/basics/list_slice_assign.py b/tests/basics/list_slice_assign.py
index 1ad1ef27c1..8856157172 100644
--- a/tests/basics/list_slice_assign.py
+++ b/tests/basics/list_slice_assign.py
@@ -1,4 +1,4 @@
-# test slices; only 2 argument version supported by Micro Python at the moment
+# test slices; only 2 argument version supported by MicroPython at the moment
x = list(range(10))
# Assignment
diff --git a/tests/io/stringio1.py b/tests/io/stringio1.py
index fa50f282e1..9f7c1e44ef 100644
--- a/tests/io/stringio1.py
+++ b/tests/io/stringio1.py
@@ -36,7 +36,7 @@ print(a.read())
a = io.StringIO()
a.close()
for f in [a.read, a.getvalue, lambda:a.write("")]:
- # CPython throws for operations on closed I/O, micropython makes
+ # CPython throws for operations on closed I/O, MicroPython makes
# the underlying string empty unless MICROPY_CPYTHON_COMPAT defined
try:
f()
diff --git a/tests/run-bench-tests b/tests/run-bench-tests
index 1e5e7804be..d48b4b7ec5 100755
--- a/tests/run-bench-tests
+++ b/tests/run-bench-tests
@@ -26,7 +26,7 @@ def run_tests(pyb, test_dict):
print(base_test + ":")
for test_file in tests:
- # run Micro Python
+ # run MicroPython
if pyb is None:
# run on PC
try:
diff --git a/tests/run-tests b/tests/run-tests
index bd4a1363cb..f9c26283dc 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -388,7 +388,7 @@ def run_tests(pyb, tests, args, base_path="."):
if args.write_exp:
continue
- # run Micro Python
+ # run MicroPython
output_mupy = run_micropython(pyb, args, test_file)
if output_mupy == b'SKIP\n':
diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py
index 86ec816e90..aff5b56e7b 100644
--- a/tools/gen-cpydiff.py
+++ b/tools/gen-cpydiff.py
@@ -33,7 +33,7 @@ import time
import re
from collections import namedtuple
-# Micropython supports syntax of CPython 3.4 with some features from 3.5, and
+# MicroPython supports syntax of CPython 3.4 with some features from 3.5, and
# such version should be used to test for differences. If your default python3
# executable is of lower version, you can point MICROPY_CPYTHON3 environment var
# to the correct executable.
diff --git a/unix/Makefile b/unix/Makefile
index 83c79ac96d..8672b4f188 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -59,7 +59,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/unix/alloc.c b/unix/alloc.c
index 54fc1d3c4a..ca12d025b6 100644
--- a/unix/alloc.c
+++ b/unix/alloc.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/unix/fdfile.h b/unix/fdfile.h
index 591159deb5..69a9b6be41 100644
--- a/unix/fdfile.h
+++ b/unix/fdfile.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/unix/file.c b/unix/file.c
index a60840c813..f27e23547d 100644
--- a/unix/file.c
+++ b/unix/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/unix/gccollect.c b/unix/gccollect.c
index 4ec8c2bf54..02f6fc91a8 100644
--- a/unix/gccollect.c
+++ b/unix/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/unix/input.c b/unix/input.c
index 4b10350dfc..7d60b46cc7 100644
--- a/unix/input.c
+++ b/unix/input.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/unix/main.c b/unix/main.c
index 633144c863..e861d7f112 100644
--- a/unix/main.c
+++ b/unix/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/unix/modffi.c b/unix/modffi.c
index 8b392f1c38..6c5e4f22ee 100644
--- a/unix/modffi.c
+++ b/unix/modffi.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/unix/modjni.c b/unix/modjni.c
index 896f2f9193..540964d446 100644
--- a/unix/modjni.c
+++ b/unix/modjni.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/unix/modmachine.c b/unix/modmachine.c
index 33a3b098e4..48dddec0ae 100644
--- a/unix/modmachine.c
+++ b/unix/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)
*
diff --git a/unix/modos.c b/unix/modos.c
index 8e746c1637..8b5d5790f3 100644
--- a/unix/modos.c
+++ b/unix/modos.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/unix/modsocket.c b/unix/modsocket.c
index c1f88defce..c612f870d9 100644
--- a/unix/modsocket.c
+++ b/unix/modsocket.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/unix/modtermios.c b/unix/modtermios.c
index 5e82e772ac..fe19aac83c 100644
--- a/unix/modtermios.c
+++ b/unix/modtermios.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/unix/modtime.c b/unix/modtime.c
index 2a6487df2a..a74b81f374 100644
--- a/unix/modtime.c
+++ b/unix/modtime.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/unix/moduselect.c b/unix/moduselect.c
index 37a3a33b28..ba1c195ef4 100644
--- a/unix/moduselect.c
+++ b/unix/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/unix/mpconfigport.h b/unix/mpconfigport.h
index 047121fe66..b557f3d448 100644
--- a/unix/mpconfigport.h
+++ b/unix/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)
*
@@ -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_PERSISTENT_CODE_LOAD (1)
diff --git a/unix/mpconfigport_fast.h b/unix/mpconfigport_fast.h
index b5be9f334f..442159eb4f 100644
--- a/unix/mpconfigport_fast.h
+++ b/unix/mpconfigport_fast.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/unix/mpconfigport_minimal.h b/unix/mpconfigport_minimal.h
index b4d9f81439..e37605eabf 100644
--- a/unix/mpconfigport_minimal.h
+++ b/unix/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_QSTR_CHUNK_INIT (64)
#define MICROPY_ALLOC_PARSE_RULE_INIT (8)
diff --git a/unix/mphalport.h b/unix/mphalport.h
index cf227872f9..ff7a51567c 100644
--- a/unix/mphalport.h
+++ b/unix/mphalport.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/unix/qstrdefsport.h b/unix/qstrdefsport.h
index 8ab2db58f5..ebfaa6ccab 100644
--- a/unix/qstrdefsport.h
+++ b/unix/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/unix/unix_mphal.c b/unix/unix_mphal.c
index 800484498e..02cdbea11f 100644
--- a/unix/unix_mphal.c
+++ b/unix/unix_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/windows/init.c b/windows/init.c
index 6690923478..09fa10417b 100644
--- a/windows/init.c
+++ b/windows/init.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/windows/init.h b/windows/init.h
index 480befef66..c6fddb257e 100644
--- a/windows/init.h
+++ b/windows/init.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/windows/mpconfigport.h b/windows/mpconfigport.h
index f2f6cbd323..c4e6ba131a 100644
--- a/windows/mpconfigport.h
+++ b/windows/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)
*
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-// options to control how Micro Python is built
+// options to control how MicroPython is built
// Linking with GNU readline (MICROPY_USE_READLINE == 2) causes binary to be licensed under GPL
#ifndef MICROPY_USE_READLINE
diff --git a/windows/msvc/gettimeofday.c b/windows/msvc/gettimeofday.c
index 6d7264ae7e..5f816df709 100644
--- a/windows/msvc/gettimeofday.c
+++ b/windows/msvc/gettimeofday.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/windows/msvc/sys/time.h b/windows/msvc/sys/time.h
index a36648beb7..7c95d409e4 100644
--- a/windows/msvc/sys/time.h
+++ b/windows/msvc/sys/time.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/windows/msvc/unistd.h b/windows/msvc/unistd.h
index 87787c3d8d..1a1629be4f 100644
--- a/windows/msvc/unistd.h
+++ b/windows/msvc/unistd.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/windows/realpath.c b/windows/realpath.c
index c0ed6b84da..ac9adf8125 100644
--- a/windows/realpath.c
+++ b/windows/realpath.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/windows/realpath.h b/windows/realpath.h
index c7bb3acd7e..869fe80fae 100644
--- a/windows/realpath.h
+++ b/windows/realpath.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/windows/sleep.c b/windows/sleep.c
index b8f0a2e9b0..6043ec7b7b 100644
--- a/windows/sleep.c
+++ b/windows/sleep.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/windows/sleep.h b/windows/sleep.h
index 6c0c003321..430ec3a436 100644
--- a/windows/sleep.h
+++ b/windows/sleep.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/windows/windows_mphal.c b/windows/windows_mphal.c
index a73140e544..153b044235 100644
--- a/windows/windows_mphal.c
+++ b/windows/windows_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/windows/windows_mphal.h b/windows/windows_mphal.h
index 854e14a7a8..5a93d4e184 100644
--- a/windows/windows_mphal.h
+++ b/windows/windows_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/zephyr/machine_pin.c b/zephyr/machine_pin.c
index 38971399cc..c3722926a0 100644
--- a/zephyr/machine_pin.c
+++ b/zephyr/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/zephyr/modutime.c b/zephyr/modutime.c
index 0c268046a9..a5d32fe665 100644
--- a/zephyr/modutime.c
+++ b/zephyr/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)
*
From ee0452509785faa41a3e15a3646130e35f3556cd Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Mon, 31 Jul 2017 22:38:37 +0300
Subject: [PATCH 205/252] extmod/modlwip: Implement
setsockopt(IP_ADD_MEMBERSHIP).
Allows to join multicast groups.
---
extmod/modlwip.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index 9d1a8c4d06..bde251ccac 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -45,6 +45,7 @@
//#include "lwip/raw.h"
#include "lwip/dns.h"
#include "lwip/tcp_impl.h"
+#include "lwip/igmp.h"
#if 0 // print debugging info
#define DEBUG_printf DEBUG_printf
@@ -52,6 +53,10 @@
#define DEBUG_printf(...) (void)0
#endif
+// All socket options should be globally distinct,
+// because we ignore option levels for efficiency.
+#define IP_ADD_MEMBERSHIP 0x400
+
// For compatibilily with older lwIP versions.
#ifndef ip_set_option
#define ip_set_option(pcb, opt) ((pcb)->so_options |= (opt))
@@ -1079,10 +1084,10 @@ STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
- // Integer options
- mp_int_t val = mp_obj_get_int(args[3]);
switch (opt) {
- case SOF_REUSEADDR:
+ // level: SOL_SOCKET
+ case SOF_REUSEADDR: {
+ mp_int_t val = mp_obj_get_int(args[3]);
// Options are common for UDP and TCP pcb's.
if (val) {
ip_set_option(socket->pcb.tcp, SOF_REUSEADDR);
@@ -1090,6 +1095,24 @@ STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
ip_reset_option(socket->pcb.tcp, SOF_REUSEADDR);
}
break;
+ }
+
+ // level: IPPROTO_IP
+ case IP_ADD_MEMBERSHIP: {
+ mp_buffer_info_t bufinfo;
+ mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
+ if (bufinfo.len != sizeof(ip_addr_t) * 2) {
+ mp_raise_ValueError(NULL);
+ }
+
+ // POSIX setsockopt has order: group addr, if addr, lwIP has it vice-versa
+ err_t err = igmp_joingroup((ip_addr_t*)bufinfo.buf + 1, bufinfo.buf);
+ if (err != ERR_OK) {
+ mp_raise_OSError(error_lookup_table[-err]);
+ }
+ break;
+ }
+
default:
printf("Warning: lwip.setsockopt() not implemented\n");
}
@@ -1342,6 +1365,9 @@ STATIC const mp_rom_map_elem_t mp_module_lwip_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(1) },
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SOF_REUSEADDR) },
+
+ { MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(0) },
+ { MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_lwip_globals, mp_module_lwip_globals_table);
From 0f12082f5b7d957d920bce4e40ee589abce84e38 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 2 Aug 2017 13:42:34 +1000
Subject: [PATCH 206/252] py,extmod,stmhal: Use "static inline" for funcs that
should be inline.
"STATIC inline" can expand to "inline" if STATIC is defined to nothing, and
this case can lead to link errors.
---
extmod/moductypes.c | 4 ++--
py/modbuiltins.c | 2 +-
stmhal/i2c.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index 9678fd58fd..c2d2265628 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -281,13 +281,13 @@ STATIC mp_obj_t uctypes_struct_sizeof(mp_obj_t obj_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(uctypes_struct_sizeof_obj, uctypes_struct_sizeof);
-STATIC inline mp_obj_t get_unaligned(uint val_type, byte *p, int big_endian) {
+static inline mp_obj_t get_unaligned(uint val_type, byte *p, int big_endian) {
char struct_type = big_endian ? '>' : '<';
static const char type2char[16] = "BbHhIiQq------fd";
return mp_binary_get_val(struct_type, type2char[val_type], &p);
}
-STATIC inline void set_unaligned(uint val_type, byte *p, int big_endian, mp_obj_t val) {
+static inline void set_unaligned(uint val_type, byte *p, int big_endian, mp_obj_t val) {
char struct_type = big_endian ? '>' : '<';
static const char type2char[16] = "BbHhIiQq------fd";
mp_binary_set_val(struct_type, type2char[val_type], val, &p);
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index 1711ae58b1..1c76b80739 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -540,7 +540,7 @@ STATIC mp_obj_t mp_builtin_sorted(size_t n_args, const mp_obj_t *args, mp_map_t
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_sorted_obj, 1, mp_builtin_sorted);
// See mp_load_attr() if making any changes
-STATIC inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t defval) {
+static inline mp_obj_t mp_load_attr_default(mp_obj_t base, qstr attr, mp_obj_t defval) {
mp_obj_t dest[2];
// use load_method, raising or not raising exception
((defval == MP_OBJ_NULL) ? mp_load_method : mp_load_method_maybe)(base, attr, dest);
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index f102fd0f2c..3fcce327f4 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -513,7 +513,7 @@ STATIC HAL_StatusTypeDef i2c_wait_dma_finished(I2C_HandleTypeDef *i2c, uint32_t
/******************************************************************************/
/* MicroPython bindings */
-STATIC inline bool in_master_mode(pyb_i2c_obj_t *self) { return self->i2c->Init.OwnAddress1 == PYB_I2C_MASTER_ADDRESS; }
+static inline bool in_master_mode(pyb_i2c_obj_t *self) { return self->i2c->Init.OwnAddress1 == PYB_I2C_MASTER_ADDRESS; }
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;
From ca582675e1386fada206b9901e6b8fe3af7fee28 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Thu, 3 Aug 2017 00:16:38 +0300
Subject: [PATCH 207/252] zephyr/Makefile: Explicitly define default target as
"all".
For some reason, with the latest Zephyr master, running just "make" led
to executing Zephyr's "qemu" target.
---
zephyr/Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/zephyr/Makefile b/zephyr/Makefile
index c1337adf0e..988b32fe89 100644
--- a/zephyr/Makefile
+++ b/zephyr/Makefile
@@ -17,6 +17,9 @@ OUTDIR_PREFIX = $(BOARD)
MICROPY_HEAP_SIZE = 16384
FROZEN_DIR = scripts
+# Default target
+all:
+
# Zephyr (generated) config files - must be defined before include below
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
ifneq ($(MAKECMDGOALS), clean)
From 4dc7c5649b0be88e542b4f7ec050a1d6e00d436c Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 6 Aug 2017 15:42:37 +0300
Subject: [PATCH 208/252] py/mkrules.mk: Show frozen modules sizes together
with executable size.
This works for Unix and similar ports so far.
---
py/mkrules.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/py/mkrules.mk b/py/mkrules.mk
index 860074caae..de2c92a3f4 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -135,7 +135,7 @@ $(PROG): $(OBJ)
ifndef DEBUG
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
endif
- $(Q)$(SIZE) $(PROG)
+ $(Q)$(SIZE) $$(find $(BUILD)/build -name "frozen*.o") $(PROG)
clean: clean-prog
clean-prog:
From 642d9fd2a57af682d1c176087a1a2c9ca3469dcb Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Mon, 7 Aug 2017 21:36:57 +0300
Subject: [PATCH 209/252] zephyr/modusocket: Allow to use socketized
net_context in upstream.
Accesses recv_q, accept_q directly in net_context.
---
zephyr/modusocket.c | 28 ++++++++++++++++++----------
zephyr/prj_base.conf | 1 +
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index cec0eec7c4..ebd516fa2a 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -48,10 +48,12 @@
typedef struct _socket_obj_t {
mp_obj_base_t base;
struct net_context *ctx;
+ #ifndef CONFIG_NET_SOCKETS
union {
struct k_fifo recv_q;
struct k_fifo accept_q;
};
+ #endif
#define STATE_NEW 0
#define STATE_CONNECTING 1
@@ -62,6 +64,12 @@ typedef struct _socket_obj_t {
STATIC const mp_obj_type_t socket_type;
+#ifdef CONFIG_NET_SOCKETS
+#define SOCK_FIELD(ptr, field) ((ptr)->ctx->field)
+#else
+#define SOCK_FIELD(ptr, field) ((ptr)->field)
+#endif
+
// k_fifo extended API
static inline void *_k_fifo_peek_head(struct k_fifo *fifo)
@@ -171,10 +179,10 @@ static void sock_received_cb(struct net_context *context, struct net_pkt *pkt, i
// if net_buf == NULL, EOF
if (pkt == NULL) {
- struct net_pkt *last_pkt = _k_fifo_peek_tail(&socket->recv_q);
+ struct net_pkt *last_pkt = _k_fifo_peek_tail(&SOCK_FIELD(socket, recv_q));
if (last_pkt == NULL) {
socket->state = STATE_PEER_CLOSED;
- k_fifo_cancel_wait(&socket->recv_q);
+ k_fifo_cancel_wait(&SOCK_FIELD(socket, recv_q));
DEBUG_printf("Marked socket %p as peer-closed\n", socket);
} else {
// We abuse "buf_sent" flag to store EOF flag
@@ -191,7 +199,7 @@ static void sock_received_cb(struct net_context *context, struct net_pkt *pkt, i
unsigned header_len = net_pkt_appdata(pkt) - pkt->frags->data;
net_buf_pull(pkt->frags, header_len);
- k_fifo_put(&socket->recv_q, pkt);
+ k_fifo_put(&SOCK_FIELD(socket, recv_q), pkt);
}
// Callback for incoming connections.
@@ -200,13 +208,12 @@ static void sock_accepted_cb(struct net_context *new_ctx, struct sockaddr *addr,
DEBUG_printf("accept cb: context: %p, status: %d, new ctx: %p\n", socket->ctx, status, new_ctx);
DEBUG_printf("new_ctx ref_cnt: %d\n", new_ctx->refcount);
- k_fifo_put(&socket->accept_q, new_ctx);
+ k_fifo_put(&SOCK_FIELD(socket, accept_q), new_ctx);
}
socket_obj_t *socket_new(void) {
socket_obj_t *socket = m_new_obj_with_finaliser(socket_obj_t);
socket->base.type = (mp_obj_t)&socket_type;
- k_fifo_init(&socket->recv_q);
socket->state = STATE_NEW;
return socket;
}
@@ -250,6 +257,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
RAISE_ERRNO(net_context_get(family, socktype, proto, &socket->ctx));
+ k_fifo_init(&SOCK_FIELD(socket, recv_q));
return MP_OBJ_FROM_PTR(socket);
}
@@ -302,7 +310,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
socket_obj_t *socket = self_in;
socket_check_closed(socket);
- struct net_context *ctx = k_fifo_get(&socket->accept_q, K_FOREVER);
+ struct net_context *ctx = k_fifo_get(&SOCK_FIELD(socket, accept_q), K_FOREVER);
// Was overwritten by fifo
ctx->refcount = 1;
@@ -375,7 +383,7 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
if (sock_type == SOCK_DGRAM) {
- struct net_pkt *pkt = k_fifo_get(&socket->recv_q, K_FOREVER);
+ struct net_pkt *pkt = k_fifo_get(&SOCK_FIELD(socket, recv_q), K_FOREVER);
recv_len = net_pkt_appdatalen(pkt);
DEBUG_printf("recv: pkt=%p, appdatalen: %d\n", pkt, recv_len);
@@ -395,8 +403,8 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
return 0;
}
- _k_fifo_wait_non_empty(&socket->recv_q, K_FOREVER);
- struct net_pkt *pkt = _k_fifo_peek_head(&socket->recv_q);
+ _k_fifo_wait_non_empty(&SOCK_FIELD(socket, recv_q), K_FOREVER);
+ struct net_pkt *pkt = _k_fifo_peek_head(&SOCK_FIELD(socket, recv_q));
if (pkt == NULL) {
DEBUG_printf("TCP recv: NULL return from fifo\n");
continue;
@@ -426,7 +434,7 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
if (frag == NULL) {
DEBUG_printf("Finished processing pkt %p\n", pkt);
// Drop head packet from queue
- k_fifo_get(&socket->recv_q, K_NO_WAIT);
+ k_fifo_get(&SOCK_FIELD(socket, recv_q), K_NO_WAIT);
// If "sent" flag was set, it's last packet and we reached EOF
if (net_pkt_sent(pkt)) {
diff --git a/zephyr/prj_base.conf b/zephyr/prj_base.conf
index 4346f20bf9..50b195b2f7 100644
--- a/zephyr/prj_base.conf
+++ b/zephyr/prj_base.conf
@@ -14,6 +14,7 @@ CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
+CONFIG_NET_SOCKETS=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_NBUF_RX_COUNT=5
From 6c55cdafa32e4db9e2aaf08b1ec597b4723721ea Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Mon, 7 Aug 2017 21:41:03 +0300
Subject: [PATCH 210/252] zephyr/modusocket: socket, close: Switch to native
Zephyr socket calls.
---
zephyr/modusocket.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index ebd516fa2a..ff82ab67c8 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -37,6 +37,9 @@
#include
#include
#include
+#ifdef CONFIG_NET_SOCKETS
+#include
+#endif
#define DEBUG_PRINT 0
#if DEBUG_PRINT // print debugging info
@@ -103,6 +106,7 @@ static inline void _k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
// Helper functions
#define RAISE_ERRNO(x) { int _err = x; if (_err < 0) mp_raise_OSError(-_err); }
+#define RAISE_SOCK_ERRNO(x) { if ((int)(x) == -1) mp_raise_OSError(errno); }
STATIC void socket_check_closed(socket_obj_t *socket) {
if (socket->ctx == NULL) {
@@ -256,8 +260,13 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
}
+ #ifdef CONFIG_NET_SOCKETS
+ socket->ctx = (void*)zsock_socket(family, socktype, proto);
+ RAISE_SOCK_ERRNO(socket->ctx);
+ #else
RAISE_ERRNO(net_context_get(family, socktype, proto, &socket->ctx));
k_fifo_init(&SOCK_FIELD(socket, recv_q));
+ #endif
return MP_OBJ_FROM_PTR(socket);
}
@@ -491,9 +500,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_mak
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
socket_obj_t *socket = self_in;
- if (socket->ctx != NULL) {
- RAISE_ERRNO(net_context_put(socket->ctx));
- socket->ctx = NULL;
+ if (socket->ctx != -1) {
+ int res = zsock_close(socket->ctx);
+ RAISE_SOCK_ERRNO(res);
+ socket->ctx = -1;
}
return mp_const_none;
}
From 600f5afed3a1a576d9bce5e0c75009fa06f0dad7 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Tue, 8 Aug 2017 12:31:59 +0300
Subject: [PATCH 211/252] zephyr/modusocket: bind, connect, listen, accept:
Swtich to native sockets.
---
zephyr/modusocket.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index ff82ab67c8..080e6b275c 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -278,7 +278,9 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
struct sockaddr sockaddr;
parse_inet_addr(socket, addr_in, &sockaddr);
- RAISE_ERRNO(net_context_bind(socket->ctx, &sockaddr, sizeof(sockaddr)));
+ int res = zsock_bind(socket->ctx, &sockaddr, sizeof(sockaddr));
+ RAISE_SOCK_ERRNO(res);
+
// For DGRAM socket, we expect to receive packets after call to bind(),
// but for STREAM socket, next expected operation is listen(), which
// doesn't work if recv callback is set.
@@ -297,7 +299,9 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
struct sockaddr sockaddr;
parse_inet_addr(socket, addr_in, &sockaddr);
- RAISE_ERRNO(net_context_connect(socket->ctx, &sockaddr, sizeof(sockaddr), NULL, K_FOREVER, NULL));
+ int res = zsock_connect(socket->ctx, &sockaddr, sizeof(sockaddr));
+ RAISE_SOCK_ERRNO(res);
+
DEBUG_printf("Setting recv cb after connect()\n");
RAISE_ERRNO(net_context_recv(socket->ctx, sock_received_cb, K_NO_WAIT, socket));
return mp_const_none;
@@ -309,8 +313,9 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) {
socket_check_closed(socket);
mp_int_t backlog = mp_obj_get_int(backlog_in);
- RAISE_ERRNO(net_context_listen(socket->ctx, backlog));
- RAISE_ERRNO(net_context_accept(socket->ctx, sock_accepted_cb, K_NO_WAIT, socket));
+ int res = zsock_listen(socket->ctx, backlog);
+ RAISE_SOCK_ERRNO(res);
+
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
@@ -319,9 +324,9 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
socket_obj_t *socket = self_in;
socket_check_closed(socket);
- struct net_context *ctx = k_fifo_get(&SOCK_FIELD(socket, accept_q), K_FOREVER);
- // Was overwritten by fifo
- ctx->refcount = 1;
+ struct sockaddr sockaddr;
+ socklen_t addrlen = sizeof(sockaddr);
+ void *ctx = zsock_accept(socket->ctx, &sockaddr, &addrlen);
socket_obj_t *socket2 = socket_new();
socket2->ctx = ctx;
From 675ceb2dd9b66285b22c5e6a2a2d1a95036c3882 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 9 Aug 2017 10:17:15 +0300
Subject: [PATCH 212/252] zephyr/modusocket: send: Switch to native sockets.
---
zephyr/modusocket.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index 080e6b275c..bcf2caee7f 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -344,28 +344,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
STATIC mp_uint_t sock_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
socket_obj_t *socket = self_in;
- if (socket->ctx == NULL) {
+ if (socket->ctx == -1) {
// already closed
*errcode = EBADF;
return MP_STREAM_ERROR;
}
- struct net_pkt *send_pkt = net_pkt_get_tx(socket->ctx, K_FOREVER);
-
- unsigned len = net_if_get_mtu(net_context_get_iface(socket->ctx));
- // Arbitrary value to account for protocol headers
- len -= 64;
- if (len > size) {
- len = size;
- }
-
- // TODO: Return value of 0 is a hard case (as we wait forever, should
- // not happen).
- len = net_pkt_append(send_pkt, len, buf, K_FOREVER);
-
- int err = net_context_send(send_pkt, /*cb*/NULL, K_FOREVER, NULL, NULL);
- if (err < 0) {
- *errcode = -err;
+ ssize_t len = zsock_send(socket->ctx, buf, size, 0);
+ if (len == -1) {
+ *errcode = errno;
return MP_STREAM_ERROR;
}
From cb7ecda9f0a1eac1d0b2a3148f5af592c5aa6211 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 9 Aug 2017 10:22:41 +0300
Subject: [PATCH 213/252] zephyr/modusocket: recv: Switch to native sockets.
---
zephyr/modusocket.c | 73 +++------------------------------------------
1 file changed, 4 insertions(+), 69 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index bcf2caee7f..7dc44c79c5 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -379,75 +379,10 @@ STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *
return MP_STREAM_ERROR;
}
- enum net_sock_type sock_type = net_context_get_type(socket->ctx);
- unsigned recv_len;
-
- if (sock_type == SOCK_DGRAM) {
-
- struct net_pkt *pkt = k_fifo_get(&SOCK_FIELD(socket, recv_q), K_FOREVER);
-
- recv_len = net_pkt_appdatalen(pkt);
- DEBUG_printf("recv: pkt=%p, appdatalen: %d\n", pkt, recv_len);
-
- if (recv_len > max_len) {
- recv_len = max_len;
- }
-
- net_pkt_gather(pkt, buf, recv_len);
- net_pkt_unref(pkt);
-
- } else if (sock_type == SOCK_STREAM) {
-
- do {
-
- if (socket->state == STATE_PEER_CLOSED) {
- return 0;
- }
-
- _k_fifo_wait_non_empty(&SOCK_FIELD(socket, recv_q), K_FOREVER);
- struct net_pkt *pkt = _k_fifo_peek_head(&SOCK_FIELD(socket, recv_q));
- if (pkt == NULL) {
- DEBUG_printf("TCP recv: NULL return from fifo\n");
- continue;
- }
-
- DEBUG_printf("TCP recv: cur_pkt: %p\n", pkt);
-
- struct net_buf *frag = pkt->frags;
- if (frag == NULL) {
- printf("net_pkt has empty fragments on start!\n");
- assert(0);
- }
-
- unsigned frag_len = frag->len;
- recv_len = frag_len;
- if (recv_len > max_len) {
- recv_len = max_len;
- }
- DEBUG_printf("%d data bytes in head frag, going to read %d\n", frag_len, recv_len);
-
- memcpy(buf, frag->data, recv_len);
-
- if (recv_len != frag_len) {
- net_buf_pull(frag, recv_len);
- } else {
- frag = net_pkt_frag_del(pkt, NULL, frag);
- if (frag == NULL) {
- DEBUG_printf("Finished processing pkt %p\n", pkt);
- // Drop head packet from queue
- k_fifo_get(&SOCK_FIELD(socket, recv_q), K_NO_WAIT);
-
- // If "sent" flag was set, it's last packet and we reached EOF
- if (net_pkt_sent(pkt)) {
- socket->state = STATE_PEER_CLOSED;
- }
- net_pkt_unref(pkt);
- }
- }
- // Keep repeating while we're getting empty fragments
- // Zephyr IP stack appears to have fed empty net_buf's with empty
- // frags for various TCP control packets - in previous versions.
- } while (recv_len == 0);
+ ssize_t recv_len = zsock_recv(socket->ctx, buf, max_len, 0);
+ if (recv_len == -1) {
+ *errcode = errno;
+ return MP_STREAM_ERROR;
}
return recv_len;
From eb2784e8a2dc17b0f551b68d2b41eece3e5348a7 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 9 Aug 2017 21:20:42 +1000
Subject: [PATCH 214/252] py/objtuple: Allow to use inplace-multiplication
operator on tuples.
---
py/objtuple.c | 3 ++-
tests/basics/tuple_mult.py | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/py/objtuple.c b/py/objtuple.c
index 0b05755fb3..cbe6454943 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -148,7 +148,8 @@ mp_obj_t mp_obj_tuple_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_seq_cat(s->items, o->items, o->len, p->items, p->len, mp_obj_t);
return MP_OBJ_FROM_PTR(s);
}
- case MP_BINARY_OP_MULTIPLY: {
+ case MP_BINARY_OP_MULTIPLY:
+ case MP_BINARY_OP_INPLACE_MULTIPLY: {
mp_int_t n;
if (!mp_obj_get_int_maybe(rhs, &n)) {
return MP_OBJ_NULL; // op not supported
diff --git a/tests/basics/tuple_mult.py b/tests/basics/tuple_mult.py
index b128b29689..cac95185a0 100644
--- a/tests/basics/tuple_mult.py
+++ b/tests/basics/tuple_mult.py
@@ -11,6 +11,11 @@ a = (1, 2, 3)
c = a * 3
print(a, c)
+# inplace multiplication
+a = (1, 2)
+a *= 2
+print(a)
+
# unsupported type on RHS
try:
() * None
From 3d25d9c7d96f9a54ad510391901af8f5bd82b306 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Wed, 9 Aug 2017 21:25:48 +1000
Subject: [PATCH 215/252] py/objstr: Raise an exception for wrong type on RHS
of str binary op.
The main case to catch is invalid types for the containment operator, of
the form str.__contains__(non-str).
---
py/objstr.c | 5 +++--
tests/basics/containment.py | 11 +++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/py/objstr.c b/py/objstr.c
index ddad7d3bdf..cc3dda59e5 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -347,8 +347,9 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
rhs_data = bufinfo.buf;
rhs_len = bufinfo.len;
} else {
- // incompatible types
- return MP_OBJ_NULL; // op not supported
+ // LHS is str and RHS has an incompatible type
+ // (except if operation is EQUAL, but that's handled by mp_obj_equal)
+ bad_implicit_conversion(rhs_in);
}
switch (op) {
diff --git a/tests/basics/containment.py b/tests/basics/containment.py
index bae3661131..4c94a9bae4 100644
--- a/tests/basics/containment.py
+++ b/tests/basics/containment.py
@@ -16,6 +16,17 @@ for needle in [haystack[:i+1] for i in range(len(haystack))]:
print(haystack, "in", needle, "::", haystack in needle)
print(haystack, "not in", needle, "::", haystack not in needle)
+# containment of bytes/ints in bytes
+print(b'' in b'123')
+print(b'0' in b'123', b'1' in b'123')
+print(48 in b'123', 49 in b'123')
+
+# containment of int in str is an error
+try:
+ 1 in '123'
+except TypeError:
+ print('TypeError')
+
# until here, the tests would work without the 'second attempt' iteration thing.
for i in 1, 2:
From 63edc2e78b5ed77455caee20989fe708a45a9cb5 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 9 Aug 2017 13:19:22 +0300
Subject: [PATCH 216/252] zephyr/modusocket: Fully switch to native Zephyr
sockets.
---
zephyr/modusocket.c | 142 +++-----------------------------------------
1 file changed, 8 insertions(+), 134 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index 7dc44c79c5..f8d668a709 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -50,13 +50,7 @@
typedef struct _socket_obj_t {
mp_obj_base_t base;
- struct net_context *ctx;
- #ifndef CONFIG_NET_SOCKETS
- union {
- struct k_fifo recv_q;
- struct k_fifo accept_q;
- };
- #endif
+ int ctx;
#define STATE_NEW 0
#define STATE_CONNECTING 1
@@ -67,49 +61,13 @@ typedef struct _socket_obj_t {
STATIC const mp_obj_type_t socket_type;
-#ifdef CONFIG_NET_SOCKETS
-#define SOCK_FIELD(ptr, field) ((ptr)->ctx->field)
-#else
-#define SOCK_FIELD(ptr, field) ((ptr)->field)
-#endif
-
-// k_fifo extended API
-
-static inline void *_k_fifo_peek_head(struct k_fifo *fifo)
-{
-#if KERNEL_VERSION_NUMBER < 0x010763 /* 1.7.99 */
- return sys_slist_peek_head(&fifo->data_q);
-#else
- return sys_slist_peek_head(&fifo->_queue.data_q);
-#endif
-}
-
-static inline void *_k_fifo_peek_tail(struct k_fifo *fifo)
-{
-#if KERNEL_VERSION_NUMBER < 0x010763 /* 1.7.99 */
- return sys_slist_peek_tail(&fifo->data_q);
-#else
- return sys_slist_peek_tail(&fifo->_queue.data_q);
-#endif
-}
-
-static inline void _k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
-{
- struct k_poll_event events[] = {
- K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE, K_POLL_MODE_NOTIFY_ONLY, fifo),
- };
-
- k_poll(events, MP_ARRAY_SIZE(events), timeout);
- DEBUG_printf("poll res: %d\n", events[0].state);
-}
-
// Helper functions
#define RAISE_ERRNO(x) { int _err = x; if (_err < 0) mp_raise_OSError(-_err); }
#define RAISE_SOCK_ERRNO(x) { if ((int)(x) == -1) mp_raise_OSError(errno); }
STATIC void socket_check_closed(socket_obj_t *socket) {
- if (socket->ctx == NULL) {
+ if (socket->ctx == -1) {
// already closed
mp_raise_OSError(EBADF);
}
@@ -121,7 +79,7 @@ STATIC void parse_inet_addr(socket_obj_t *socket, mp_obj_t addr_in, struct socka
mp_obj_t *addr_items;
mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
- sockaddr_in->sin_family = net_context_get_family(socket->ctx);
+ sockaddr_in->sin_family = net_context_get_family((void*)socket->ctx);
RAISE_ERRNO(net_addr_pton(sockaddr_in->sin_family, mp_obj_str_get_str(addr_items[0]), &sockaddr_in->sin_addr));
sockaddr_in->sin_port = htons(mp_obj_get_int(addr_items[1]));
}
@@ -147,74 +105,6 @@ STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
return MP_OBJ_FROM_PTR(tuple);
}
-// Copy data from Zephyr net_buf chain into linear buffer.
-// We don't use net_pkt_read(), because it's weird (e.g., we'd like to
-// free processed data fragment ASAP, while net_pkt_read() holds onto
-// the whole fragment chain to do its deeds, and that's minor comparing
-// to the fact that it copies data byte by byte).
-static char *net_pkt_gather(struct net_pkt *pkt, char *to, unsigned max_len) {
- struct net_buf *tmp = pkt->frags;
-
- while (tmp && max_len) {
- unsigned len = tmp->len;
- if (len > max_len) {
- len = max_len;
- }
- memcpy(to, tmp->data, len);
- to += len;
- max_len -= len;
- tmp = net_pkt_frag_del(pkt, NULL, tmp);
- }
-
- return to;
-}
-
-// Callback for incoming packets.
-static void sock_received_cb(struct net_context *context, struct net_pkt *pkt, int status, void *user_data) {
- socket_obj_t *socket = (socket_obj_t*)user_data;
- DEBUG_printf("recv cb: context: %p, status: %d, pkt: %p", context, status, pkt);
- if (pkt) {
- DEBUG_printf(" (appdatalen=%d), token: %p", pkt->appdatalen, net_pkt_token(pkt));
- }
- DEBUG_printf("\n");
- #if DEBUG_PRINT > 1
- net_pkt_print_frags(pkt);
- #endif
-
- // if net_buf == NULL, EOF
- if (pkt == NULL) {
- struct net_pkt *last_pkt = _k_fifo_peek_tail(&SOCK_FIELD(socket, recv_q));
- if (last_pkt == NULL) {
- socket->state = STATE_PEER_CLOSED;
- k_fifo_cancel_wait(&SOCK_FIELD(socket, recv_q));
- DEBUG_printf("Marked socket %p as peer-closed\n", socket);
- } else {
- // We abuse "buf_sent" flag to store EOF flag
- net_pkt_set_sent(last_pkt, true);
- DEBUG_printf("Set EOF flag on %p\n", last_pkt);
- }
- return;
- }
-
- // Make sure that "EOF flag" is not set
- net_pkt_set_sent(pkt, false);
-
- // We don't care about packet header, so get rid of it asap
- unsigned header_len = net_pkt_appdata(pkt) - pkt->frags->data;
- net_buf_pull(pkt->frags, header_len);
-
- k_fifo_put(&SOCK_FIELD(socket, recv_q), pkt);
-}
-
-// Callback for incoming connections.
-static void sock_accepted_cb(struct net_context *new_ctx, struct sockaddr *addr, socklen_t addrlen, int status, void *user_data) {
- socket_obj_t *socket = (socket_obj_t*)user_data;
- DEBUG_printf("accept cb: context: %p, status: %d, new ctx: %p\n", socket->ctx, status, new_ctx);
- DEBUG_printf("new_ctx ref_cnt: %d\n", new_ctx->refcount);
-
- k_fifo_put(&SOCK_FIELD(socket, accept_q), new_ctx);
-}
-
socket_obj_t *socket_new(void) {
socket_obj_t *socket = m_new_obj_with_finaliser(socket_obj_t);
socket->base.type = (mp_obj_t)&socket_type;
@@ -226,10 +116,10 @@ socket_obj_t *socket_new(void) {
STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
socket_obj_t *self = self_in;
- if (self->ctx == NULL) {
+ if (self->ctx == -1) {
mp_printf(print, "");
} else {
- struct net_context *ctx = self->ctx;
+ struct net_context *ctx = (void*)self->ctx;
mp_printf(print, "", ctx, net_context_get_type(ctx));
}
}
@@ -260,13 +150,8 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
}
}
- #ifdef CONFIG_NET_SOCKETS
- socket->ctx = (void*)zsock_socket(family, socktype, proto);
+ socket->ctx = zsock_socket(family, socktype, proto);
RAISE_SOCK_ERRNO(socket->ctx);
- #else
- RAISE_ERRNO(net_context_get(family, socktype, proto, &socket->ctx));
- k_fifo_init(&SOCK_FIELD(socket, recv_q));
- #endif
return MP_OBJ_FROM_PTR(socket);
}
@@ -281,13 +166,6 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
int res = zsock_bind(socket->ctx, &sockaddr, sizeof(sockaddr));
RAISE_SOCK_ERRNO(res);
- // For DGRAM socket, we expect to receive packets after call to bind(),
- // but for STREAM socket, next expected operation is listen(), which
- // doesn't work if recv callback is set.
- if (net_context_get_type(socket->ctx) == SOCK_DGRAM) {
- DEBUG_printf("Setting recv cb after bind\n");
- RAISE_ERRNO(net_context_recv(socket->ctx, sock_received_cb, K_NO_WAIT, socket));
- }
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
@@ -302,8 +180,6 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
int res = zsock_connect(socket->ctx, &sockaddr, sizeof(sockaddr));
RAISE_SOCK_ERRNO(res);
- DEBUG_printf("Setting recv cb after connect()\n");
- RAISE_ERRNO(net_context_recv(socket->ctx, sock_received_cb, K_NO_WAIT, socket));
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
@@ -326,12 +202,10 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
struct sockaddr sockaddr;
socklen_t addrlen = sizeof(sockaddr);
- void *ctx = zsock_accept(socket->ctx, &sockaddr, &addrlen);
+ int ctx = zsock_accept(socket->ctx, &sockaddr, &addrlen);
socket_obj_t *socket2 = socket_new();
socket2->ctx = ctx;
- DEBUG_printf("Setting recv cb after accept()\n");
- RAISE_ERRNO(net_context_recv(ctx, sock_received_cb, K_NO_WAIT, socket2));
mp_obj_tuple_t *client = mp_obj_new_tuple(2, NULL);
client->items[0] = MP_OBJ_FROM_PTR(socket2);
@@ -373,7 +247,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
STATIC mp_uint_t sock_read(mp_obj_t self_in, void *buf, mp_uint_t max_len, int *errcode) {
socket_obj_t *socket = self_in;
- if (socket->ctx == NULL) {
+ if (socket->ctx == -1) {
// already closed
*errcode = EBADF;
return MP_STREAM_ERROR;
From f9dfd8aa3b9030e325f382ebf51ed2627243e238 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 11 Aug 2017 12:17:47 +1000
Subject: [PATCH 217/252] minimal,esp8266,pic16bit: Remove unused stmhal
include from Makefile.
---
esp8266/Makefile | 1 -
minimal/Makefile | 1 -
pic16bit/Makefile | 1 -
3 files changed, 3 deletions(-)
diff --git a/esp8266/Makefile b/esp8266/Makefile
index 1c169862ea..452efb2cdf 100644
--- a/esp8266/Makefile
+++ b/esp8266/Makefile
@@ -24,7 +24,6 @@ ESP_SDK = $(shell $(CC) -print-sysroot)/usr
INC += -I.
INC += -I..
-INC += -I../stmhal
INC += -I$(BUILD)
INC += -I$(ESP_SDK)/include
diff --git a/minimal/Makefile b/minimal/Makefile
index 994d26880d..0fc9194387 100644
--- a/minimal/Makefile
+++ b/minimal/Makefile
@@ -14,7 +14,6 @@ endif
INC += -I.
INC += -I..
-INC += -I../stmhal
INC += -I$(BUILD)
ifeq ($(CROSS), 1)
diff --git a/pic16bit/Makefile b/pic16bit/Makefile
index 1da4449521..b953612fdb 100644
--- a/pic16bit/Makefile
+++ b/pic16bit/Makefile
@@ -14,7 +14,6 @@ PART = 33FJ256GP506
INC += -I.
INC += -I..
-INC += -I../stmhal
INC += -I$(BUILD)
INC += -I$(XC16)/include
INC += -I$(XC16)/support/$(PARTFAMILY)/h
From 7d4a2f773cc6ce24a91e2d210378188f3371e8a6 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Fri, 11 Aug 2017 12:22:19 +1000
Subject: [PATCH 218/252] all: Make use of $(TOP) variable in Makefiles,
instead of "..".
$(TOP) is defined in py/mkenv.mk and should be used to refer to the top
level of this repository.
---
bare-arm/Makefile | 6 ++---
cc3200/Makefile | 4 +--
cc3200/application.mk | 6 ++---
cc3200/bootmgr/bootloader.mk | 4 +--
esp8266/Makefile | 16 +++++------
minimal/Makefile | 12 ++++-----
mpy-cross/Makefile | 6 ++---
pic16bit/Makefile | 6 ++---
py/py.mk | 10 +++----
qemu-arm/Makefile | 12 ++++-----
stmhal/Makefile | 16 +++++------
teensy/Makefile | 10 +++----
unix/Makefile | 52 ++++++++++++++++++------------------
windows/Makefile | 6 ++---
zephyr/Makefile | 8 +++---
15 files changed, 87 insertions(+), 87 deletions(-)
diff --git a/bare-arm/Makefile b/bare-arm/Makefile
index cfd427c609..90c13de11f 100644
--- a/bare-arm/Makefile
+++ b/bare-arm/Makefile
@@ -4,12 +4,12 @@ include ../py/mkenv.mk
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
CROSS_COMPILE = arm-none-eabi-
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
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
@@ -45,4 +45,4 @@ $(BUILD)/firmware.elf: $(OBJ)
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/cc3200/Makefile b/cc3200/Makefile
index 663496435b..4c8b0b8325 100644
--- a/cc3200/Makefile
+++ b/cc3200/Makefile
@@ -34,7 +34,7 @@ ifeq ($(BTARGET), application)
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
# include MicroPython make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
include application.mk
else
ifeq ($(BTARGET), bootloader)
@@ -45,7 +45,7 @@ endif
endif
# always include MicroPython make rules
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
erase:
cc3200tool -p $(PORT) format_flash --size $(FLASH_SIZE_$(BOARD))
diff --git a/cc3200/application.mk b/cc3200/application.mk
index c6b91ed0ed..3ac28823a1 100644
--- a/cc3200/application.mk
+++ b/cc3200/application.mk
@@ -1,5 +1,5 @@
APP_INC = -I.
-APP_INC += -I..
+APP_INC += -I$(TOP)
APP_INC += -Ifatfs/src
APP_INC += -Ifatfs/src/drivers
APP_INC += -IFreeRTOS
@@ -10,7 +10,7 @@ APP_INC += -Ihal
APP_INC += -Ihal/inc
APP_INC += -Imisc
APP_INC += -Imods
-APP_INC += -I../drivers/cc3100/inc
+APP_INC += -I$(TOP)/drivers/cc3100/inc
APP_INC += -Isimplelink
APP_INC += -Isimplelink/oslib
APP_INC += -Itelnet
@@ -18,7 +18,7 @@ APP_INC += -Iutil
APP_INC += -Ibootmgr
APP_INC += -I$(BUILD)
APP_INC += -I$(BUILD)/genhdr
-APP_INC += -I../stmhal
+APP_INC += -I$(TOP)/stmhal
APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
diff --git a/cc3200/bootmgr/bootloader.mk b/cc3200/bootmgr/bootloader.mk
index ee52369135..b8aa9082c9 100644
--- a/cc3200/bootmgr/bootloader.mk
+++ b/cc3200/bootmgr/bootloader.mk
@@ -4,13 +4,13 @@ BOOT_INC = -Ibootmgr
BOOT_INC += -Ibootmgr/sl
BOOT_INC += -Ihal
BOOT_INC += -Ihal/inc
-BOOT_INC += -I../drivers/cc3100/inc
+BOOT_INC += -I$(TOP)/drivers/cc3100/inc
BOOT_INC += -Imisc
BOOT_INC += -Imods
BOOT_INC += -Isimplelink
BOOT_INC += -Isimplelink/oslib
BOOT_INC += -Iutil
-BOOT_INC += -I..
+BOOT_INC += -I$(TOP)
BOOT_INC += -I.
BOOT_INC += -I$(BUILD)
diff --git a/esp8266/Makefile b/esp8266/Makefile
index 452efb2cdf..fce11a7d41 100644
--- a/esp8266/Makefile
+++ b/esp8266/Makefile
@@ -12,7 +12,7 @@ FROZEN_DIR ?= scripts
FROZEN_MPY_DIR ?= modules
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
FWBIN = $(BUILD)/firmware-combined.bin
PORT ?= /dev/ttyACM0
@@ -23,7 +23,7 @@ CROSS_COMPILE = xtensa-lx106-elf-
ESP_SDK = $(shell $(CC) -print-sysroot)/usr
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
INC += -I$(ESP_SDK)/include
@@ -220,16 +220,16 @@ ota:
#$(BUILD)/pins_$(BOARD).o: $(BUILD)/pins_$(BOARD).c
# $(call compile_c)
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
axtls: $(BUILD)/libaxtls.a
$(BUILD)/libaxtls.a:
- cd ../lib/axtls; cp config/upyconfig config/.config
- cd ../lib/axtls; $(MAKE) oldconfig -B
- cd ../lib/axtls; $(MAKE) clean
- cd ../lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
- cp ../lib/axtls/_stage/libaxtls.a $@
+ cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
+ cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
+ cd $(TOP)/lib/axtls; $(MAKE) clean
+ cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)" AR="$(AR)" CFLAGS_EXTRA="$(CFLAGS_XTENSA) -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096"
+ cp $(TOP)/lib/axtls/_stage/libaxtls.a $@
clean-modules:
git clean -f -d modules
diff --git a/minimal/Makefile b/minimal/Makefile
index 0fc9194387..c95d639aff 100644
--- a/minimal/Makefile
+++ b/minimal/Makefile
@@ -6,19 +6,19 @@ CROSS = 0
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
ifeq ($(CROSS), 1)
CROSS_COMPILE = arm-none-eabi-
endif
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
ifeq ($(CROSS), 1)
-DFU = ../tools/dfu.py
-PYDFU = ../tools/pydfu.py
+DFU = $(TOP)/tools/dfu.py
+PYDFU = $(TOP)/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
@@ -57,7 +57,7 @@ endif
$(BUILD)/_frozen_mpy.c: frozentest.mpy $(BUILD)/genhdr/qstrdefs.generated.h
$(ECHO) "MISC freezing bytecode"
- $(Q)../tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $< > $@
+ $(Q)$(TOP)/tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $< > $@
$(BUILD)/firmware.elf: $(OBJ)
$(ECHO) "LINK $@"
@@ -87,4 +87,4 @@ run:
test: $(BUILD)/firmware.elf
$(Q)/bin/echo -e "print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\\r\\n\\x04" | $(BUILD)/firmware.elf | tail -n2 | grep "^hello world! \\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\]eol"
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile
index cdec130eed..5399b5ae77 100644
--- a/mpy-cross/Makefile
+++ b/mpy-cross/Makefile
@@ -23,10 +23,10 @@ QSTR_DEFS = qstrdefsport.h
UNAME_S := $(shell uname -s)
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
@@ -71,4 +71,4 @@ endif
OBJ = $(PY_O)
OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/pic16bit/Makefile b/pic16bit/Makefile
index b953612fdb..ebf4fc2e80 100644
--- a/pic16bit/Makefile
+++ b/pic16bit/Makefile
@@ -4,7 +4,7 @@ include ../py/mkenv.mk
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
XC16 = /opt/microchip/xc16/v1.24
CROSS_COMPILE = $(XC16)/bin/xc16-
@@ -13,7 +13,7 @@ PARTFAMILY = dsPIC33F
PART = 33FJ256GP506
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
INC += -I$(XC16)/include
INC += -I$(XC16)/support/$(PARTFAMILY)/h
@@ -67,4 +67,4 @@ $(BUILD)/firmware.elf: $(OBJ)
$(PY_BUILD)/gc.o: CFLAGS += -O1
$(PY_BUILD)/vm.o: CFLAGS += -O1
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/py/py.mk b/py/py.mk
index 02f2df8e12..6632376032 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -22,13 +22,13 @@ CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\"
ifeq ($(MICROPY_PY_USSL),1)
CFLAGS_MOD += -DMICROPY_PY_USSL=1
ifeq ($(MICROPY_SSL_AXTLS),1)
-CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I../lib/axtls/ssl -I../lib/axtls/crypto -I../lib/axtls/config
+CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I$(TOP)/lib/axtls/ssl -I$(TOP)/lib/axtls/crypto -I$(TOP)/lib/axtls/config
LDFLAGS_MOD += -Lbuild -laxtls
else ifeq ($(MICROPY_SSL_MBEDTLS),1)
# Can be overridden by ports which have "builtin" mbedTLS
-MICROPY_SSL_MBEDTLS_INCLUDE ?= ../lib/mbedtls/include
+MICROPY_SSL_MBEDTLS_INCLUDE ?= $(TOP)/lib/mbedtls/include
CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(MICROPY_SSL_MBEDTLS_INCLUDE)
-LDFLAGS_MOD += -L../lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto
+LDFLAGS_MOD += -L$(TOP)/lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto
endif
endif
@@ -38,7 +38,7 @@ endif
ifeq ($(MICROPY_PY_LWIP),1)
LWIP_DIR = lib/lwip/src
-INC += -I../lib/lwip/src/include -I../lib/lwip/src/include/ipv4 -I../extmod/lwip-include
+INC += -I$(TOP)/lib/lwip/src/include -I$(TOP)/lib/lwip/src/include/ipv4 -I$(TOP)/extmod/lwip-include
CFLAGS_MOD += -DMICROPY_PY_LWIP=1
SRC_MOD += extmod/modlwip.c lib/netutils/netutils.c
SRC_MOD += $(addprefix $(LWIP_DIR)/,\
@@ -75,7 +75,7 @@ endif
ifeq ($(MICROPY_PY_BTREE),1)
BTREE_DIR = lib/berkeley-db-1.xx
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
+INC += -I$(TOP)/$(BTREE_DIR)/PORT/include
SRC_MOD += extmod/modbtree.c
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
btree/bt_close.c \
diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile
index 743b6683a8..71403cb5e7 100644
--- a/qemu-arm/Makefile
+++ b/qemu-arm/Makefile
@@ -5,14 +5,14 @@ include ../py/mkenv.mk
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
CROSS_COMPILE = arm-none-eabi-
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
-INC += -I../tools/tinytest/
+INC += -I$(TOP)/tools/tinytest/
CFLAGS_CORTEX_M3 = -mthumb -mcpu=cortex-m3 -mfloat-abi=soft
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -std=gnu99 $(CFLAGS_CORTEX_M3) $(COPT) \
@@ -98,10 +98,10 @@ test: $(BUILD)/firmware-test.elf
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
$(BUILD)/genhdr/tests.h:
- $(Q)echo "Generating $@";(cd ../tests; ../tools/tinytest-codegen.py) > $@
+ $(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@
$(BUILD)/tinytest.o:
- $(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c ../tools/tinytest/tinytest.c
+ $(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TOP)/tools/tinytest/tinytest.c
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
$(BUILD)/firmware.elf: $(OBJ_COMMON) $(OBJ_RUN)
@@ -112,4 +112,4 @@ $(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(Q)$(SIZE) $@
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/stmhal/Makefile b/stmhal/Makefile
index ae1db2ae95..8735d84c31 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -19,7 +19,7 @@ QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h $(BUILD)/modstm_qstr.h
FROZEN_MPY_DIR ?= modules
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
LD_DIR=boards
CMSIS_DIR=cmsis
@@ -27,10 +27,10 @@ HAL_DIR=hal/$(MCU_SERIES)
USBDEV_DIR=usbdev
#USBHOST_DIR=usbhost
FATFS_DIR=lib/oofatfs
-DFU=../tools/dfu.py
+DFU=$(TOP)/tools/dfu.py
# may need to prefix dfu-util with sudo
USE_PYDFU ?= 1
-PYDFU ?= ../tools/pydfu.py
+PYDFU ?= $(TOP)/tools/pydfu.py
DFU_UTIL ?= dfu-util
DEVICE=0483:df11
STFLASH ?= st-flash
@@ -40,9 +40,9 @@ OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg
CROSS_COMPILE = arm-none-eabi-
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
-INC += -I../lib/cmsis/inc
+INC += -I$(TOP)/lib/cmsis/inc
INC += -I$(CMSIS_DIR)/
INC += -I$(HAL_DIR)/inc
INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc
@@ -406,8 +406,8 @@ GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
GEN_PINS_AF_CONST = $(HEADER_BUILD)/pins_af_const.h
GEN_PINS_AF_PY = $(BUILD)/pins_af.py
-INSERT_USB_IDS = ../tools/insert-usb-ids.py
-FILE2H = ../tools/file2h.py
+INSERT_USB_IDS = $(TOP)/tools/insert-usb-ids.py
+FILE2H = $(TOP)/tools/file2h.py
USB_IDS_FILE = usb.h
CDCINF_TEMPLATE = pybcdc.inf_template
@@ -464,4 +464,4 @@ $(GEN_CDCINF_FILE): $(CDCINF_TEMPLATE) $(INSERT_USB_IDS) $(USB_IDS_FILE) | $(HEA
$(ECHO) "Create $@"
$(Q)$(PYTHON) $(INSERT_USB_IDS) $(USB_IDS_FILE) $< > $@
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/teensy/Makefile b/teensy/Makefile
index 575e15e542..944e281a43 100644
--- a/teensy/Makefile
+++ b/teensy/Makefile
@@ -4,7 +4,7 @@ include ../py/mkenv.mk
QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
# If you set USE_ARDUINO_TOOLCHAIN=1 then this makefile will attempt to use
# the toolchain that comes with Teensyduino
@@ -30,8 +30,8 @@ CFLAGS_TEENSY = -DF_CPU=96000000 -DUSB_SERIAL -D__MK20DX256__
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -mfloat-abi=soft -fsingle-precision-constant -Wdouble-promotion $(CFLAGS_TEENSY)
INC += -I.
-INC += -I..
-INC += -I../stmhal
+INC += -I$(TOP)
+INC += -I$(TOP)/stmhal
INC += -I$(BUILD)
INC += -Icore
@@ -135,7 +135,7 @@ SRC_C += \
OBJ += $(BUILD)/memzip-files.o
-MAKE_MEMZIP = ../lib/memzip/make-memzip.py
+MAKE_MEMZIP = $(TOP)/lib/memzip/make-memzip.py
ifeq ($(MEMZIP_DIR),)
MEMZIP_DIR = memzip_files
endif
@@ -232,4 +232,4 @@ $(BUILD)/%.pp: $(BUILD)/%.c
$(ECHO) "PreProcess $<"
$(Q)$(CC) $(CFLAGS) -E -Wp,-C,-dD,-dI -o $@ $<
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/unix/Makefile b/unix/Makefile
index 8672b4f188..08bd4db306 100644
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -14,10 +14,10 @@ QSTR_DEFS = qstrdefsport.h
UNAME_S := $(shell uname -s)
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
@@ -87,7 +87,7 @@ endif
endif
ifeq ($(MICROPY_USE_READLINE),1)
-INC += -I../lib/mp-readline
+INC += -I$(TOP)/lib/mp-readline
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
LIB_SRC_C_EXTRA += mp-readline/readline.c
endif
@@ -107,11 +107,11 @@ endif
ifeq ($(MICROPY_PY_FFI),1)
ifeq ($(MICROPY_STANDALONE),1)
-LIBFFI_CFLAGS_MOD := -I$(shell ls -1d ../lib/libffi/build_dir/out/lib/libffi-*/include)
+LIBFFI_CFLAGS_MOD := -I$(shell ls -1d $(TOP)/lib/libffi/build_dir/out/lib/libffi-*/include)
ifeq ($(MICROPY_FORCE_32BIT),1)
- LIBFFI_LDFLAGS_MOD = ../lib/libffi/build_dir/out/lib32/libffi.a
+ LIBFFI_LDFLAGS_MOD = $(TOP)/lib/libffi/build_dir/out/lib32/libffi.a
else
- LIBFFI_LDFLAGS_MOD = ../lib/libffi/build_dir/out/lib/libffi.a
+ LIBFFI_LDFLAGS_MOD = $(TOP)/lib/libffi/build_dir/out/lib/libffi.a
endif
else
LIBFFI_CFLAGS_MOD := $(shell pkg-config --cflags libffi)
@@ -183,13 +183,13 @@ MPY_CROSS_FLAGS += -mcache-lookup-bc
endif
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
.PHONY: test
-test: $(PROG) ../tests/run-tests
+test: $(PROG) $(TOP)/tests/run-tests
$(eval DIRNAME=$(notdir $(CURDIR)))
- cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
+ cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests
# install micropython in /usr/local/bin
TARGET = micropython
@@ -254,12 +254,12 @@ coverage:
coverage_test: coverage
$(eval DIRNAME=$(notdir $(CURDIR)))
- cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests
- cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests -d thread
- cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native
- cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --via-mpy -d basics float
- gcov -o build-coverage/py ../py/*.c
- gcov -o build-coverage/extmod ../extmod/*.c
+ cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests
+ cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests -d thread
+ cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native
+ cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --via-mpy -d basics float
+ gcov -o build-coverage/py $(TOP)/py/*.c
+ gcov -o build-coverage/extmod $(TOP)/extmod/*.c
# Value of configure's --host= option (required for cross-compilation).
# Deduce it from CROSS_COMPILE by default, but can be overridden.
@@ -274,21 +274,21 @@ deplibs: libffi axtls
# install-exec-recursive & install-data-am targets are used to avoid building
# docs and depending on makeinfo
libffi:
- cd ../lib/libffi; git clean -d -x -f
- cd ../lib/libffi; ./autogen.sh
- mkdir -p ../lib/libffi/build_dir; cd ../lib/libffi/build_dir; \
+ cd $(TOP)/lib/libffi; git clean -d -x -f
+ cd $(TOP)/lib/libffi; ./autogen.sh
+ mkdir -p $(TOP)/lib/libffi/build_dir; cd $(TOP)/lib/libffi/build_dir; \
../configure $(CROSS_COMPILE_HOST) --prefix=$$PWD/out --disable-structs CC="$(CC)" CXX="$(CXX)" LD="$(LD)" CFLAGS="-Os -fomit-frame-pointer -fstrict-aliasing -ffast-math -fno-exceptions"; \
$(MAKE) install-exec-recursive; $(MAKE) -C include install-data-am
axtls: $(BUILD)/libaxtls.a
-$(BUILD)/libaxtls.a: ../lib/axtls/README | $(OBJ_DIRS)
- cd ../lib/axtls; cp config/upyconfig config/.config
- cd ../lib/axtls; $(MAKE) oldconfig -B
- cd ../lib/axtls; $(MAKE) clean
- cd ../lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)"
- cp ../lib/axtls/_stage/libaxtls.a $@
+$(BUILD)/libaxtls.a: $(TOP)/lib/axtls/README | $(OBJ_DIRS)
+ cd $(TOP)/lib/axtls; cp config/upyconfig config/.config
+ cd $(TOP)/lib/axtls; $(MAKE) oldconfig -B
+ cd $(TOP)/lib/axtls; $(MAKE) clean
+ cd $(TOP)/lib/axtls; $(MAKE) all CC="$(CC)" LD="$(LD)"
+ cp $(TOP)/lib/axtls/_stage/libaxtls.a $@
-../lib/axtls/README:
+$(TOP)/lib/axtls/README:
@echo "You cloned without --recursive, fetching submodules for you."
- (cd ..; git submodule update --init --recursive)
+ (cd $(TOP); git submodule update --init --recursive)
diff --git a/windows/Makefile b/windows/Makefile
index 72c97381bd..a39d348266 100644
--- a/windows/Makefile
+++ b/windows/Makefile
@@ -8,10 +8,10 @@ PROG = micropython.exe
QSTR_DEFS = ../unix/qstrdefsport.h
# include py core make definitions
-include ../py/py.mk
+include $(TOP)/py/py.mk
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
# compiler settings
@@ -62,4 +62,4 @@ SRC_QSTR += $(SRC_C)
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=
-include ../py/mkrules.mk
+include $(TOP)/py/mkrules.mk
diff --git a/zephyr/Makefile b/zephyr/Makefile
index 988b32fe89..5840cc47ec 100644
--- a/zephyr/Makefile
+++ b/zephyr/Makefile
@@ -27,10 +27,10 @@ include $(Z_EXPORTS)
endif
include ../py/mkenv.mk
-include ../py/py.mk
+include $(TOP)/py/py.mk
INC += -I.
-INC += -I..
+INC += -I$(TOP)
INC += -I$(BUILD)
INC += -I$(ZEPHYR_BASE)/net/ip
INC += -I$(ZEPHYR_BASE)/net/ip/contiki
@@ -59,7 +59,7 @@ OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \
-std=gnu99 -fomit-frame-pointer -DNDEBUG -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE) $(CFLAGS_EXTRA) $(INC)
-include ../py/mkrules.mk
+include $(TOP)/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
@@ -102,4 +102,4 @@ prj_$(BOARD)_merged.conf: prj_base.conf prj_$(BOARD).conf
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
test:
- cd ../tests && ./run-tests --target minimal --device "execpty:make -C ../zephyr run BOARD=$(BOARD) QEMU_PTY=1"
+ cd $(TOP)/tests && ./run-tests --target minimal --device "execpty:make -C ../zephyr run BOARD=$(BOARD) QEMU_PTY=1"
From bfc2092dc55d1faab4a6d7e832005afd61d25c3c Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Fri, 11 Aug 2017 09:42:39 +0300
Subject: [PATCH 219/252] py/modsys: Initial implementation of sys.getsizeof().
Implemented as a new MP_UNARY_OP. This patch adds support lists, dicts and
instances.
---
py/modsys.c | 12 ++++++++++++
py/mpconfig.h | 5 +++++
py/objdict.c | 6 ++++++
py/objlist.c | 6 ++++++
py/objtype.c | 16 ++++++++++++++++
py/runtime0.h | 1 +
tests/unix/extra_coverage.py.exp | 3 ++-
unix/mpconfigport_coverage.h | 1 +
8 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/py/modsys.c b/py/modsys.c
index ee6f8686e0..b7d55fdcc6 100644
--- a/py/modsys.c
+++ b/py/modsys.c
@@ -4,6 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2014-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
@@ -31,8 +32,11 @@
#include "py/objtuple.h"
#include "py/objstr.h"
#include "py/objint.h"
+#include "py/objtype.h"
#include "py/stream.h"
#include "py/smallint.h"
+#include "py/runtime0.h"
+#include "py/runtime.h"
#if MICROPY_PY_SYS
@@ -143,6 +147,11 @@ STATIC mp_obj_t mp_sys_exc_info(void) {
MP_DEFINE_CONST_FUN_OBJ_0(mp_sys_exc_info_obj, mp_sys_exc_info);
#endif
+STATIC mp_obj_t mp_sys_getsizeof(mp_obj_t obj) {
+ return mp_unary_op(MP_UNARY_OP_SIZEOF, obj);
+}
+MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_getsizeof_obj, mp_sys_getsizeof);
+
STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) },
@@ -192,6 +201,9 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
#if MICROPY_PY_SYS_EXC_INFO
{ MP_ROM_QSTR(MP_QSTR_exc_info), MP_ROM_PTR(&mp_sys_exc_info_obj) },
#endif
+ #if MICROPY_PY_SYS_GETSIZEOF
+ { MP_ROM_QSTR(MP_QSTR_getsizeof), MP_ROM_PTR(&mp_sys_getsizeof_obj) },
+ #endif
/*
* Extensions to CPython
diff --git a/py/mpconfig.h b/py/mpconfig.h
index fb507a503e..0e76a1ff5e 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -944,6 +944,11 @@ typedef double mp_float_t;
#define MICROPY_PY_SYS_EXIT (1)
#endif
+// Whether to provide "sys.getsizeof" function
+#ifndef MICROPY_PY_SYS_GETSIZEOF
+#define MICROPY_PY_SYS_GETSIZEOF (0)
+#endif
+
// Whether to provide sys.{stdin,stdout,stderr} objects
#ifndef MICROPY_PY_SYS_STDFILES
#define MICROPY_PY_SYS_STDFILES (0)
diff --git a/py/objdict.c b/py/objdict.c
index a272ebdb63..f6357a905b 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -105,6 +105,12 @@ STATIC mp_obj_t dict_unary_op(mp_uint_t op, mp_obj_t self_in) {
switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->map.used != 0);
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->map.used);
+ #if MICROPY_PY_SYS_GETSIZEOF
+ case MP_UNARY_OP_SIZEOF: {
+ size_t sz = sizeof(*self) + sizeof(*self->map.table) * self->map.alloc;
+ return MP_OBJ_NEW_SMALL_INT(sz);
+ }
+ #endif
default: return MP_OBJ_NULL; // op not supported
}
}
diff --git a/py/objlist.c b/py/objlist.c
index ba1c506771..5957c9d4ad 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -104,6 +104,12 @@ STATIC mp_obj_t list_unary_op(mp_uint_t op, mp_obj_t self_in) {
switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->len != 0);
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->len);
+ #if MICROPY_PY_SYS_GETSIZEOF
+ case MP_UNARY_OP_SIZEOF: {
+ size_t sz = sizeof(*self) + sizeof(mp_obj_t) * self->alloc;
+ return MP_OBJ_NEW_SMALL_INT(sz);
+ }
+ #endif
default: return MP_OBJ_NULL; // op not supported
}
}
diff --git a/py/objtype.c b/py/objtype.c
index a258915f34..87c0cc9e5c 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -339,11 +339,27 @@ const qstr mp_unary_op_method_name[] = {
[MP_UNARY_OP_NEGATIVE] = MP_QSTR___neg__,
[MP_UNARY_OP_INVERT] = MP_QSTR___invert__,
#endif
+ #if MICROPY_PY_SYS_GETSIZEOF
+ [MP_UNARY_OP_SIZEOF] = MP_QSTR_getsizeof,
+ #endif
[MP_UNARY_OP_NOT] = MP_QSTR_, // don't need to implement this, used to make sure array has full size
};
STATIC mp_obj_t instance_unary_op(mp_uint_t op, mp_obj_t self_in) {
mp_obj_instance_t *self = MP_OBJ_TO_PTR(self_in);
+
+ #if MICROPY_PY_SYS_GETSIZEOF
+ if (MP_UNLIKELY(op == MP_UNARY_OP_SIZEOF)) {
+ // TODO: This doesn't count inherited objects (self->subobj)
+ const mp_obj_type_t *native_base;
+ size_t num_native_bases = instance_count_native_bases(mp_obj_get_type(self_in), &native_base);
+
+ size_t sz = sizeof(*self) + sizeof(*self->subobj) * num_native_bases
+ + sizeof(*self->members.table) * self->members.alloc;
+ return MP_OBJ_NEW_SMALL_INT(sz);
+ }
+ #endif
+
qstr op_name = mp_unary_op_method_name[op];
/* Still try to lookup native slot
if (op_name == 0) {
diff --git a/py/runtime0.h b/py/runtime0.h
index d22c2fabe6..703c950f2d 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -50,6 +50,7 @@ typedef enum {
MP_UNARY_OP_NEGATIVE,
MP_UNARY_OP_INVERT,
MP_UNARY_OP_NOT,
+ MP_UNARY_OP_SIZEOF, // for sys.getsizeof()
} mp_unary_op_t;
typedef enum {
diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp
index 390ff1669d..ab638a632d 100644
--- a/tests/unix/extra_coverage.py.exp
+++ b/tests/unix/extra_coverage.py.exp
@@ -25,7 +25,8 @@ ame__
__name__ path argv version
version_info implementation platform byteorder
maxsize exit stdin stdout
-stderr modules exc_info print_exception
+stderr modules exc_info getsizeof
+print_exception
ementation
# attrtuple
(start=1, stop=2, step=3)
diff --git a/unix/mpconfigport_coverage.h b/unix/mpconfigport_coverage.h
index 5fc8d7107a..a9e0a38fa0 100644
--- a/unix/mpconfigport_coverage.h
+++ b/unix/mpconfigport_coverage.h
@@ -37,6 +37,7 @@
#define MICROPY_PY_DELATTR_SETATTR (1)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_MODULES (1)
+#define MICROPY_PY_SYS_GETSIZEOF (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_IO_BUFFEREDWRITER (1)
#undef MICROPY_VFS_FAT
From b6a328956467339f568b19d9192fbbfdfa47a572 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Sat, 12 Aug 2017 22:26:18 +1000
Subject: [PATCH 220/252] tools/mpy-tool.py: Don't generate const_table if it's
empty.
---
tools/mpy-tool.py | 49 ++++++++++++++++++++++++++---------------------
1 file changed, 27 insertions(+), 22 deletions(-)
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index 544f90cc85..887b3f5164 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -331,27 +331,29 @@ class RawCode:
# TODO
raise FreezeError(self, 'freezing of object %r is not implemented' % (obj,))
- # generate constant table
- print('STATIC const mp_rom_obj_t const_table_data_%s[%u] = {'
- % (self.escaped_name, len(self.qstrs) + len(self.objs) + len(self.raw_codes)))
- for qst in self.qstrs:
- print(' MP_ROM_QSTR(%s),' % global_qstrs[qst].qstr_id)
- for i in range(len(self.objs)):
- if type(self.objs[i]) is float:
- print('#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B')
- print(' MP_ROM_PTR(&const_obj_%s_%u),' % (self.escaped_name, i))
- print('#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C')
- n = struct.unpack('':
@@ -362,7 +364,10 @@ class RawCode:
print(' .n_pos_args = %u,' % self.prelude[3])
print(' .data.u_byte = {')
print(' .bytecode = bytecode_data_%s,' % self.escaped_name)
- print(' .const_table = (mp_uint_t*)const_table_data_%s,' % self.escaped_name)
+ if const_table_len:
+ print(' .const_table = (mp_uint_t*)const_table_data_%s,' % self.escaped_name)
+ else:
+ print(' .const_table = NULL,')
print(' #if MICROPY_PERSISTENT_CODE_SAVE')
print(' .bc_len = %u,' % len(self.bytecode))
print(' .n_obj = %u,' % len(self.objs))
From 35a1fea90b2cae9d5cc8e9eab62ba4c67e8786db Mon Sep 17 00:00:00 2001
From: Javier Candeira
Date: Wed, 9 Aug 2017 14:40:45 +1000
Subject: [PATCH 221/252] all: Raise exceptions via mp_raise_XXX
- Changed: ValueError, TypeError, NotImplementedError
- OSError invocations unchanged, because the corresponding utility
function takes ints, not strings like the long form invocation.
- OverflowError, IndexError and RuntimeError etc. not changed for now
until we decide whether to add new utility functions.
---
drivers/dht/dht.c | 2 +-
esp8266/machine_hspi.c | 6 ++----
esp8266/machine_pin.c | 6 +++---
esp8266/machine_rtc.c | 7 +++----
esp8266/modesp.c | 2 +-
esp8266/modmachine.c | 3 +--
esp8266/modnetwork.c | 12 ++++--------
extmod/modlwip.c | 8 ++++----
extmod/modubinascii.c | 6 +++---
extmod/moductypes.c | 8 ++++----
extmod/moduheapq.c | 2 +-
extmod/modujson.c | 2 +-
extmod/modure.c | 4 ++--
extmod/modussl_axtls.c | 2 +-
extmod/moduzlib.c | 2 +-
lib/netutils/netutils.c | 3 ++-
py/argcheck.c | 2 +-
py/emitnative.c | 8 ++++----
py/lexer.c | 2 +-
py/objarray.c | 6 +++---
py/objlist.c | 4 ++--
py/objstr.c | 8 ++++----
py/objstrunicode.c | 2 +-
py/objtuple.c | 2 +-
py/runtime.c | 2 +-
py/runtime.h | 2 +-
stmhal/dac.c | 2 +-
stmhal/i2c.c | 12 ++++++------
stmhal/modmachine.c | 4 ++--
stmhal/moduos.c | 2 +-
stmhal/pin.c | 2 +-
stmhal/rtc.c | 8 +++-----
stmhal/spi.c | 2 +-
stmhal/timer.c | 12 ++++++------
stmhal/usb.c | 4 ++--
teensy/servo.c | 2 +-
teensy/teensy_hal.c | 2 +-
teensy/timer.c | 10 +++++-----
unix/file.c | 2 +-
unix/modffi.c | 2 +-
unix/modjni.c | 2 +-
41 files changed, 86 insertions(+), 95 deletions(-)
diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c
index 6bdda44b46..5d92ae39a3 100644
--- a/drivers/dht/dht.c
+++ b/drivers/dht/dht.c
@@ -40,7 +40,7 @@ STATIC mp_obj_t dht_readinto(mp_obj_t pin_in, mp_obj_t buf_in) {
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE);
if (bufinfo.len < 5) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "buffer too small"));
+ mp_raise_ValueError("buffer too small");
}
// issue start command
diff --git a/esp8266/machine_hspi.c b/esp8266/machine_hspi.c
index 1be342b526..eaabbab7ea 100644
--- a/esp8266/machine_hspi.c
+++ b/esp8266/machine_hspi.c
@@ -122,15 +122,13 @@ STATIC void machine_hspi_init(mp_obj_base_t *self_in, size_t n_args, const mp_ob
spi_init_gpio(HSPI, SPI_CLK_80MHZ_NODIV);
spi_clock(HSPI, 0, 0);
} else if (self->baudrate > 40000000L) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "impossible baudrate"));
+ mp_raise_ValueError("impossible baudrate");
} else {
uint32_t divider = 40000000L / self->baudrate;
uint16_t prediv = MIN(divider, SPI_CLKDIV_PRE + 1);
uint16_t cntdiv = (divider / prediv) * 2; // cntdiv has to be even
if (cntdiv > SPI_CLKCNT_N + 1 || cntdiv == 0 || prediv == 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "impossible baudrate"));
+ mp_raise_ValueError("impossible baudrate");
}
self->baudrate = 80000000L / (prediv * cntdiv);
spi_init_gpio(HSPI, SPI_CLK_USE_DIV);
diff --git a/esp8266/machine_pin.c b/esp8266/machine_pin.c
index de65735ba7..673082065b 100644
--- a/esp8266/machine_pin.c
+++ b/esp8266/machine_pin.c
@@ -125,7 +125,7 @@ void pin_intr_handler(uint32_t status) {
pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in) {
if (mp_obj_get_type(pin_in) != &pyb_pin_type) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "expecting a pin"));
+ mp_raise_ValueError("expecting a pin");
}
pyb_pin_obj_t *self = pin_in;
return self;
@@ -280,7 +280,7 @@ STATIC mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, mp_uint_t n_args, c
// only pull-down seems to be supported by the hardware, and
// we only expose pull-up behaviour in software
if (pull != GPIO_PULL_NONE) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Pin(16) doesn't support pull"));
+ mp_raise_ValueError("Pin(16) doesn't support pull");
}
} else {
PIN_FUNC_SELECT(self->periph, self->func);
@@ -319,7 +319,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw,
pin = (pyb_pin_obj_t*)&pyb_pin_obj[wanted_pin];
}
if (pin == NULL || pin->base.type == NULL) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid pin"));
+ mp_raise_ValueError("invalid pin");
}
if (n_args > 1 || n_kw > 0) {
diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c
index 2ad44318f2..c5d04e0cfa 100644
--- a/esp8266/machine_rtc.c
+++ b/esp8266/machine_rtc.c
@@ -183,8 +183,7 @@ STATIC mp_obj_t pyb_rtc_memory(mp_uint_t n_args, const mp_obj_t *args) {
mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ);
if (bufinfo.len > MEM_USER_MAXLEN) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "buffer too long"));
+ mp_raise_ValueError("buffer too long");
}
len = bufinfo.len;
@@ -208,7 +207,7 @@ STATIC mp_obj_t pyb_rtc_alarm(mp_obj_t self_in, mp_obj_t alarm_id, mp_obj_t time
// check we want alarm0
if (mp_obj_get_int(alarm_id) != 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid alarm"));
+ mp_raise_ValueError("invalid alarm");
}
// set expiry time (in microseconds)
@@ -245,7 +244,7 @@ STATIC mp_obj_t pyb_rtc_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k
// check we want alarm0
if (args[ARG_trigger].u_int != 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid alarm"));
+ mp_raise_ValueError("invalid alarm");
}
// set the wake value
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index a63d505645..6ddca0733b 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -118,7 +118,7 @@ STATIC mp_obj_t esp_flash_write(mp_obj_t offset_in, const mp_obj_t buf_in) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
if (bufinfo.len & 0x3) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "len must be multiple of 4"));
+ mp_raise_ValueError("len must be multiple of 4");
}
SpiFlashOpResult res = spi_flash_write(offset, bufinfo.buf, bufinfo.len);
if (res == SPI_FLASH_RESULT_OK) {
diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c
index 070e6fc54c..98bc495586 100644
--- a/esp8266/modmachine.c
+++ b/esp8266/modmachine.c
@@ -59,8 +59,7 @@ STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
// set
mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
if (freq != 80 && freq != 160) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "frequency can only be either 80Mhz or 160MHz"));
+ mp_raise_ValueError("frequency can only be either 80Mhz or 160MHz");
}
system_update_cpu_freq(freq);
return mp_const_none;
diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c
index 283abecafe..b893209c65 100644
--- a/esp8266/modnetwork.c
+++ b/esp8266/modnetwork.c
@@ -275,8 +275,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_ifconfig_obj, 1, 2, esp_ifconfig)
STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
if (n_args != 1 && kwargs->used != 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
- "either pos or kw args are allowed"));
+ mp_raise_TypeError("either pos or kw args are allowed");
}
wlan_if_obj_t *self = MP_OBJ_TO_PTR(args[0]);
@@ -303,8 +302,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(kwargs->table[i].value, &bufinfo, MP_BUFFER_READ);
if (bufinfo.len != 6) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "invalid buffer length"));
+ mp_raise_ValueError("invalid buffer length");
}
wifi_set_macaddr(self->if_id, bufinfo.buf);
break;
@@ -374,8 +372,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
// Get config
if (n_args != 2) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError,
- "can query only one param"));
+ mp_raise_TypeError("can query only one param");
}
mp_obj_t val;
@@ -422,8 +419,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
return val;
unknown:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "unknown config param"));
+ mp_raise_ValueError("unknown config param");
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp_config_obj, 1, esp_config);
diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index bde251ccac..cc10523e54 100644
--- a/extmod/modlwip.c
+++ b/extmod/modlwip.c
@@ -129,15 +129,15 @@ STATIC mp_obj_t lwip_slip_make_new(mp_obj_t type_in, size_t n_args, size_t n_kw,
ip_addr_t iplocal, ipremote;
if (!ipaddr_aton(mp_obj_str_get_str(args[1]), &iplocal)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "not a valid local IP"));
+ mp_raise_ValueError("not a valid local IP");
}
if (!ipaddr_aton(mp_obj_str_get_str(args[2]), &ipremote)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "not a valid remote IP"));
+ mp_raise_ValueError("not a valid remote IP");
}
struct netif *n = &lwip_slip_obj.lwip_netif;
if (netif_add(n, &iplocal, IP_ADDR_BROADCAST, &ipremote, NULL, slipif_init, ip_input) == NULL) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "out of memory"));
+ mp_raise_ValueError("out of memory");
}
netif_set_up(n);
netif_set_default(n);
@@ -1033,7 +1033,7 @@ STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
break;
}
case MOD_NETWORK_SOCK_DGRAM:
- mp_not_implemented("");
+ mp_raise_NotImplementedError("");
break;
}
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index d79191b3e5..d3092a4df1 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -109,7 +109,7 @@ mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
if (bufinfo.len % 4 != 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "incorrect padding"));
+ mp_raise_ValueError("incorrect padding");
}
vstr_t vstr;
@@ -136,11 +136,11 @@ mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
hold[j] = 63;
} else if (in[j] == '=') {
if (j < 2 || i > 4) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "incorrect padding"));
+ mp_raise_ValueError("incorrect padding");
}
hold[j] = 64;
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid character"));
+ mp_raise_ValueError("invalid character");
}
}
in += 4;
diff --git a/extmod/moductypes.c b/extmod/moductypes.c
index c2d2265628..dc03f6de50 100644
--- a/extmod/moductypes.c
+++ b/extmod/moductypes.c
@@ -118,7 +118,7 @@ typedef struct _mp_obj_uctypes_struct_t {
} mp_obj_uctypes_struct_t;
STATIC NORETURN void syntax_error(void) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "syntax error in uctypes descriptor"));
+ mp_raise_TypeError("syntax error in uctypes descriptor");
}
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
@@ -215,7 +215,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
// but scalar structure field is lowered into native Python int, so all
// type info is lost. So, we cannot say if it's scalar type description,
// or such lowered scalar.
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "Cannot unambiguously get sizeof scalar"));
+ mp_raise_TypeError("Cannot unambiguously get sizeof scalar");
}
syntax_error();
}
@@ -393,7 +393,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
// TODO: Support at least OrderedDict in addition
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "struct: no fields"));
+ mp_raise_TypeError("struct: no fields");
}
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
@@ -526,7 +526,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_ob
} else {
// load / store
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "struct: cannot index"));
+ mp_raise_TypeError("struct: cannot index");
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c
index e6e417d2bc..4a620bad81 100644
--- a/extmod/moduheapq.c
+++ b/extmod/moduheapq.c
@@ -35,7 +35,7 @@
STATIC mp_obj_list_t *get_heap(mp_obj_t heap_in) {
if (!MP_OBJ_IS_TYPE(heap_in, &mp_type_list)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "heap must be a list"));
+ mp_raise_TypeError("heap must be a list");
}
return MP_OBJ_TO_PTR(heap_in);
}
diff --git a/extmod/modujson.c b/extmod/modujson.c
index f94ec7db88..6c4aa1611d 100644
--- a/extmod/modujson.c
+++ b/extmod/modujson.c
@@ -269,7 +269,7 @@ STATIC mp_obj_t mod_ujson_load(mp_obj_t stream_obj) {
return stack_top;
fail:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "syntax error in JSON"));
+ mp_raise_ValueError("syntax error in JSON");
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_load_obj, mod_ujson_load);
diff --git a/extmod/modure.c b/extmod/modure.c
index b85ba26737..2baebdecc6 100644
--- a/extmod/modure.c
+++ b/extmod/modure.c
@@ -156,7 +156,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
mp_obj_t s = mp_obj_new_str_of_type(str_type, (const byte*)subj.begin, caps[0] - subj.begin);
mp_obj_list_append(retval, s);
if (self->re.sub > 0) {
- mp_not_implemented("Splitting with sub-captures");
+ mp_raise_NotImplementedError("Splitting with sub-captures");
}
subj.begin = caps[1];
if (maxsplit > 0 && --maxsplit == 0) {
@@ -200,7 +200,7 @@ STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
int error = re1_5_compilecode(&o->re, re_str);
if (error != 0) {
error:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Error in regex"));
+ mp_raise_ValueError("Error in regex");
}
if (flags & FLAG_DEBUG) {
re1_5_dumpcode(&o->re);
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index 86dd8e29c8..b5d2412d26 100644
--- a/extmod/modussl_axtls.c
+++ b/extmod/modussl_axtls.c
@@ -153,7 +153,7 @@ 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("");
+ mp_raise_NotImplementedError("");
}
return mp_const_none;
}
diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c
index a05d0f2ed0..b446dba737 100644
--- a/extmod/moduzlib.c
+++ b/extmod/moduzlib.c
@@ -92,7 +92,7 @@ STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size
dict_opt = uzlib_zlib_parse_header(&o->decomp);
if (dict_opt < 0) {
header_error:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "compression header"));
+ mp_raise_ValueError("compression header");
}
dict_sz = 1 << dict_opt;
} else {
diff --git a/lib/netutils/netutils.c b/lib/netutils/netutils.c
index a324521613..15e70397cb 100644
--- a/lib/netutils/netutils.c
+++ b/lib/netutils/netutils.c
@@ -31,6 +31,7 @@
#include "py/obj.h"
#include "py/nlr.h"
+#include "py/runtime.h"
#include "lib/netutils/netutils.h"
// Takes an array with a raw IPv4 address and returns something like '192.168.0.1'.
@@ -80,7 +81,7 @@ void netutils_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian
} else if (i > 0 && s < s_top && *s == '.') {
s++;
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "invalid arguments"));
+ mp_raise_ValueError("invalid arguments");
}
}
}
diff --git a/py/argcheck.c b/py/argcheck.c
index 22fd9cd2c7..0c5c5ca954 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -142,6 +142,6 @@ NORETURN void mp_arg_error_terse_mismatch(void) {
#if MICROPY_CPYTHON_COMPAT
NORETURN void mp_arg_error_unimpl_kw(void) {
- mp_not_implemented("keyword argument(s) not yet implemented - use normal args instead");
+ mp_raise_NotImplementedError("keyword argument(s) not yet implemented - use normal args instead");
}
#endif
diff --git a/py/emitnative.c b/py/emitnative.c
index 5ed69ff9b0..7ce6196254 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -824,7 +824,7 @@ STATIC void emit_get_stack_pointer_to_reg_for_pop(emit_t *emit, mp_uint_t reg_de
break;
default:
// not handled
- mp_not_implemented("conversion to object");
+ mp_raise_NotImplementedError("conversion to object");
}
}
@@ -2158,7 +2158,7 @@ STATIC void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_u
break;
default:
// this can happen when casting a cast: int(int)
- mp_not_implemented("casting");
+ mp_raise_NotImplementedError("casting");
}
} else {
assert(vtype_fun == VTYPE_PYOBJ);
@@ -2232,12 +2232,12 @@ STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
STATIC void emit_native_yield_value(emit_t *emit) {
// not supported (for now)
(void)emit;
- mp_not_implemented("native yield");
+ mp_raise_NotImplementedError("native yield");
}
STATIC void emit_native_yield_from(emit_t *emit) {
// not supported (for now)
(void)emit;
- mp_not_implemented("native yield from");
+ mp_raise_NotImplementedError("native yield from");
}
STATIC void emit_native_start_except_handler(emit_t *emit) {
diff --git a/py/lexer.c b/py/lexer.c
index 32b3567cc2..074d6f3561 100644
--- a/py/lexer.c
+++ b/py/lexer.c
@@ -341,7 +341,7 @@ STATIC void parse_string_literal(mp_lexer_t *lex, bool is_raw) {
// 3MB of text; even gzip-compressed and with minimal structure, it'll take
// roughly half a meg of storage. This form of Unicode escape may be added
// later on, but it's definitely not a priority right now. -- CJA 20140607
- mp_not_implemented("unicode name escapes");
+ mp_raise_NotImplementedError("unicode name escapes");
break;
default:
if (c >= '0' && c <= '7') {
diff --git a/py/objarray.c b/py/objarray.c
index 99146bd4c1..a31c536804 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -288,7 +288,7 @@ STATIC mp_obj_t array_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in)
// Otherwise, can only look for a scalar numeric value in an array
if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {
- mp_not_implemented("");
+ mp_raise_NotImplementedError("");
}
return mp_const_false;
@@ -378,7 +378,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
} else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(o->len, index_in, &slice)) {
- mp_not_implemented("only slices with step=1 (aka None) are supported");
+ mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
}
if (value != MP_OBJ_SENTINEL) {
#if MICROPY_PY_ARRAY_SLICE_ASSIGN
@@ -409,7 +409,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
src_len = bufinfo.len;
src_items = bufinfo.buf;
} else {
- mp_not_implemented("array/bytes required on right side");
+ mp_raise_NotImplementedError("array/bytes required on right side");
}
// TODO: check src/dst compat
diff --git a/py/objlist.c b/py/objlist.c
index 5957c9d4ad..86d4300620 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -162,7 +162,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
- mp_not_implemented("");
+ mp_raise_NotImplementedError("");
}
mp_int_t len_adj = slice.start - slice.stop;
@@ -202,7 +202,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_get_array(value, &value_len, &value_items);
mp_bound_slice_t slice_out;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice_out)) {
- mp_not_implemented("");
+ mp_raise_NotImplementedError("");
}
mp_int_t len_adj = value_len - (slice_out.stop - slice_out.start);
//printf("Len adj: %d\n", len_adj);
diff --git a/py/objstr.c b/py/objstr.c
index cc3dda59e5..d4c038a686 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -404,7 +404,7 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self_len, index, &slice)) {
- mp_not_implemented("only slices with step=1 (aka None) are supported");
+ mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
}
return mp_obj_new_str_of_type(type, self_data + slice.start, slice.stop - slice.start);
}
@@ -618,7 +618,7 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
mp_int_t idx = splits;
if (sep == mp_const_none) {
- mp_not_implemented("rsplit(None,n)");
+ mp_raise_NotImplementedError("rsplit(None,n)");
} else {
size_t sep_len;
const char *sep_str = mp_obj_str_get_data(sep, &sep_len);
@@ -742,7 +742,7 @@ STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
GET_STR_DATA_LEN(args[0], str, str_len);
GET_STR_DATA_LEN(args[1], suffix, suffix_len);
if (n_args > 2) {
- mp_not_implemented("start/end indices");
+ mp_raise_NotImplementedError("start/end indices");
}
if (suffix_len > str_len) {
@@ -1044,7 +1044,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
arg = key_elem->value;
}
if (field_name < field_name_top) {
- mp_not_implemented("attributes not supported yet");
+ mp_raise_NotImplementedError("attributes not supported yet");
}
} else {
if (*arg_i < 0) {
diff --git a/py/objstrunicode.c b/py/objstrunicode.c
index 0cf791ff7c..036f7f3c14 100644
--- a/py/objstrunicode.c
+++ b/py/objstrunicode.c
@@ -188,7 +188,7 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_t ostart, ostop, ostep;
mp_obj_slice_get(index, &ostart, &ostop, &ostep);
if (ostep != mp_const_none && ostep != MP_OBJ_NEW_SMALL_INT(1)) {
- mp_not_implemented("only slices with step=1 (aka None) are supported");
+ mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
}
const byte *pstart, *pstop;
diff --git a/py/objtuple.c b/py/objtuple.c
index cbe6454943..765edb907c 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -181,7 +181,7 @@ mp_obj_t mp_obj_tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
- mp_not_implemented("only slices with step=1 (aka None) are supported");
+ mp_raise_NotImplementedError("only slices with step=1 (aka None) are supported");
}
mp_obj_tuple_t *res = MP_OBJ_TO_PTR(mp_obj_new_tuple(slice.stop - slice.start, NULL));
mp_seq_copy(res->items, self->items + slice.start, res->len, mp_obj_t);
diff --git a/py/runtime.c b/py/runtime.c
index 6a0db007e3..9c3edeb9c8 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1439,6 +1439,6 @@ NORETURN void mp_raise_OSError(int errno_) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno_)));
}
-NORETURN void mp_not_implemented(const char *msg) {
+NORETURN void mp_raise_NotImplementedError(const char *msg) {
mp_raise_msg(&mp_type_NotImplementedError, msg);
}
diff --git a/py/runtime.h b/py/runtime.h
index fe492885b1..428e2571cc 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -149,8 +149,8 @@ NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg);
//NORETURN void nlr_raise_msg_varg(const mp_obj_type_t *exc_type, const char *fmt, ...);
NORETURN void mp_raise_ValueError(const char *msg);
NORETURN void mp_raise_TypeError(const char *msg);
+NORETURN void mp_raise_NotImplementedError(const char *msg);
NORETURN void mp_raise_OSError(int errno_);
-NORETURN void mp_not_implemented(const char *msg); // Raise NotImplementedError with given message
NORETURN void mp_exc_recursion_depth(void);
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
diff --git a/stmhal/dac.c b/stmhal/dac.c
index cdb3a9bcd7..14bd59b41a 100644
--- a/stmhal/dac.c
+++ b/stmhal/dac.c
@@ -119,7 +119,7 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) {
return DAC_TRIGGER_T8_TRGO;
#endif
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Timer does not support DAC triggering"));
+ mp_raise_ValueError("Timer does not support DAC triggering");
}
}
diff --git a/stmhal/i2c.c b/stmhal/i2c.c
index 3fcce327f4..48a1e49af8 100644
--- a/stmhal/i2c.c
+++ b/stmhal/i2c.c
@@ -670,7 +670,7 @@ STATIC mp_obj_t pyb_i2c_is_ready(mp_obj_t self_in, mp_obj_t i2c_addr_o) {
pyb_i2c_obj_t *self = self_in;
if (!in_master_mode(self)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "I2C must be a master"));
+ mp_raise_TypeError("I2C must be a master");
}
mp_uint_t i2c_addr = mp_obj_get_int(i2c_addr_o) << 1;
@@ -693,7 +693,7 @@ STATIC mp_obj_t pyb_i2c_scan(mp_obj_t self_in) {
pyb_i2c_obj_t *self = self_in;
if (!in_master_mode(self)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "I2C must be a master"));
+ mp_raise_TypeError("I2C must be a master");
}
mp_obj_t list = mp_obj_new_list(0, NULL);
@@ -754,7 +754,7 @@ STATIC mp_obj_t pyb_i2c_send(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
if (use_dma) {
dma_deinit(self->tx_dma_descr);
}
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "addr argument required"));
+ mp_raise_TypeError("addr argument required");
}
mp_uint_t i2c_addr = args[1].u_int << 1;
if (!use_dma) {
@@ -830,7 +830,7 @@ STATIC mp_obj_t pyb_i2c_recv(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
HAL_StatusTypeDef status;
if (in_master_mode(self)) {
if (args[1].u_int == PYB_I2C_MASTER_ADDRESS) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "addr argument required"));
+ mp_raise_TypeError("addr argument required");
}
mp_uint_t i2c_addr = args[1].u_int << 1;
if (!use_dma) {
@@ -897,7 +897,7 @@ STATIC mp_obj_t pyb_i2c_mem_read(mp_uint_t n_args, const mp_obj_t *pos_args, mp_
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(pyb_i2c_mem_read_allowed_args), pyb_i2c_mem_read_allowed_args, args);
if (!in_master_mode(self)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "I2C must be a master"));
+ mp_raise_TypeError("I2C must be a master");
}
// get the buffer to read into
@@ -965,7 +965,7 @@ STATIC mp_obj_t pyb_i2c_mem_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(pyb_i2c_mem_read_allowed_args), pyb_i2c_mem_read_allowed_args, args);
if (!in_master_mode(self)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "I2C must be a master"));
+ mp_raise_TypeError("I2C must be a master");
}
// get the buffer to write from
diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c
index c5444ec980..cb7957681d 100644
--- a/stmhal/modmachine.c
+++ b/stmhal/modmachine.c
@@ -258,7 +258,7 @@ STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
mp_int_t wanted_sysclk = mp_obj_get_int(args[0]) / 1000000;
#if defined(MCU_SERIES_L4)
- nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError, "machine.freq set not supported yet"));
+ mp_raise_NotImplementedError("machine.freq set not supported yet");
#endif
// default PLL parameters that give 48MHz on PLL48CK
@@ -318,7 +318,7 @@ STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
goto set_clk;
}
}
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "can't make valid freq"));
+ mp_raise_ValueError("can't make valid freq");
}
set_clk:
diff --git a/stmhal/moduos.c b/stmhal/moduos.c
index 77a60c0cbc..e02f6aefa8 100644
--- a/stmhal/moduos.c
+++ b/stmhal/moduos.c
@@ -121,7 +121,7 @@ STATIC mp_obj_t os_dupterm(mp_uint_t n_args, const mp_obj_t *args) {
} else if (mp_obj_get_type(args[0]) == &pyb_uart_type) {
MP_STATE_PORT(pyb_stdio_uart) = args[0];
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "need a UART object"));
+ mp_raise_ValueError("need a UART object");
}
return mp_const_none;
}
diff --git a/stmhal/pin.c b/stmhal/pin.c
index 0dce0c1c08..8d4e800223 100644
--- a/stmhal/pin.c
+++ b/stmhal/pin.c
@@ -120,7 +120,7 @@ const pin_obj_t *pin_find(mp_obj_t user_obj) {
pin_obj = mp_call_function_1(MP_STATE_PORT(pin_class_mapper), user_obj);
if (pin_obj != mp_const_none) {
if (!MP_OBJ_IS_TYPE(pin_obj, &pin_type)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Pin.mapper didn't return a Pin object"));
+ mp_raise_ValueError("Pin.mapper didn't return a Pin object");
}
if (pin_class_debug) {
printf("Pin.mapper maps ");
diff --git a/stmhal/rtc.c b/stmhal/rtc.c
index 4efc56d5c8..6cb6ef047e 100644
--- a/stmhal/rtc.c
+++ b/stmhal/rtc.c
@@ -575,7 +575,7 @@ mp_obj_t pyb_rtc_wakeup(mp_uint_t n_args, const mp_obj_t *args) {
wut -= 0x10000;
if (wut > 0x10000) {
// wut still too large
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "wakeup value too large"));
+ mp_raise_ValueError("wakeup value too large");
}
}
}
@@ -685,12 +685,10 @@ mp_obj_t pyb_rtc_calibration(mp_uint_t n_args, const mp_obj_t *args) {
}
return mp_obj_new_int(cal & 1);
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "calibration value out of range"));
+ mp_raise_ValueError("calibration value out of range");
}
#else
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
- "calibration value out of range"));
+ mp_raise_ValueError("calibration value out of range");
#endif
}
if (cal > 0) {
diff --git a/stmhal/spi.c b/stmhal/spi.c
index 574fed0739..d25e13f986 100644
--- a/stmhal/spi.c
+++ b/stmhal/spi.c
@@ -765,7 +765,7 @@ STATIC mp_obj_t pyb_spi_send_recv(mp_uint_t n_args, const mp_obj_t *pos_args, mp
// recv argument given
mp_get_buffer_raise(args[1].u_obj, &bufinfo_recv, MP_BUFFER_WRITE);
if (bufinfo_recv.len != bufinfo_send.len) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "recv must be same length as send"));
+ mp_raise_ValueError("recv must be same length as send");
}
o_ret = args[1].u_obj;
}
diff --git a/stmhal/timer.c b/stmhal/timer.c
index 570558775b..938e965971 100644
--- a/stmhal/timer.c
+++ b/stmhal/timer.c
@@ -278,7 +278,7 @@ STATIC uint32_t compute_prescaler_period_from_freq(pyb_timer_obj_t *self, mp_obj
if (freq <= 0) {
goto bad_freq;
bad_freq:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "must have positive freq"));
+ mp_raise_ValueError("must have positive freq");
}
period = source_freq / freq;
}
@@ -429,7 +429,7 @@ STATIC void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks) {
TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer) {
if (mp_obj_get_type(timer) != &pyb_timer_type) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "need a Timer object"));
+ mp_raise_ValueError("need a Timer object");
}
pyb_timer_obj_t *self = timer;
return &self->tim;
@@ -541,7 +541,7 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, mp_uint_t n_args, c
init->Prescaler = args[1].u_int;
init->Period = args[2].u_int;
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "must specify either freq, or prescaler and period"));
+ mp_raise_TypeError("must specify either freq, or prescaler and period");
}
init->CounterMode = args[3].u_int;
@@ -891,7 +891,7 @@ STATIC mp_obj_t pyb_timer_channel(mp_uint_t n_args, const mp_obj_t *pos_args, mp
mp_obj_t pin_obj = args[2].u_obj;
if (pin_obj != mp_const_none) {
if (!MP_OBJ_IS_TYPE(pin_obj, &pin_type)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "pin argument needs to be be a Pin type"));
+ mp_raise_ValueError("pin argument needs to be be a Pin type");
}
const pin_obj_t *pin = pin_obj;
const pin_af_obj_t *af = pin_find_af(pin, AF_FN_TIM, self->tim_id);
@@ -1174,7 +1174,7 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
HAL_TIM_Base_Start_IT(&self->tim); // This will re-enable the IRQ
HAL_NVIC_EnableIRQ(self->irqn);
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "callback must be None or a callable object"));
+ mp_raise_ValueError("callback must be None or a callable object");
}
return mp_const_none;
}
@@ -1331,7 +1331,7 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
break;
}
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "callback must be None or a callable object"));
+ mp_raise_ValueError("callback must be None or a callable object");
}
return mp_const_none;
}
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 9bf351f499..e2cbd6745c 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -319,7 +319,7 @@ STATIC mp_obj_t pyb_usb_mode(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_
return mp_const_none;
bad_mode:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "bad USB mode"));
+ mp_raise_ValueError("bad USB mode");
}
MP_DEFINE_CONST_FUN_OBJ_KW(pyb_usb_mode_obj, 0, pyb_usb_mode);
@@ -590,7 +590,7 @@ STATIC mp_obj_t pyb_usb_hid_send(mp_obj_t self_in, mp_obj_t report_in) {
mp_obj_t *items;
mp_obj_get_array(report_in, &bufinfo.len, &items);
if (bufinfo.len > sizeof(temp_buf)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "tuple/list too large for HID report; use bytearray instead"));
+ mp_raise_ValueError("tuple/list too large for HID report; use bytearray instead");
}
for (int i = 0; i < bufinfo.len; i++) {
temp_buf[i] = mp_obj_get_int(items[i]);
diff --git a/teensy/servo.c b/teensy/servo.c
index 6ccdb05e92..262daaeb66 100644
--- a/teensy/servo.c
+++ b/teensy/servo.c
@@ -217,7 +217,7 @@ mp_obj_t pyb_Servo(void) {
self->servo_id++;
}
m_del_obj(pyb_servo_obj_t, self);
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "No available servo ids"));
+ mp_raise_ValueError("No available servo ids");
return mp_const_none;
}
diff --git a/teensy/teensy_hal.c b/teensy/teensy_hal.c
index 4fcf999225..439e3380d9 100644
--- a/teensy/teensy_hal.c
+++ b/teensy/teensy_hal.c
@@ -61,5 +61,5 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio) {
}
void extint_register_pin(const void *pin, uint32_t mode, int hard_irq, mp_obj_t callback_obj) {
- mp_not_implemented(NULL);
+ mp_raise_NotImplementedError(NULL);
}
diff --git a/teensy/timer.c b/teensy/timer.c
index bc560d85e0..6e578acc14 100644
--- a/teensy/timer.c
+++ b/teensy/timer.c
@@ -255,7 +255,7 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, uint n_args, const
// set prescaler and period from frequency
if (vals[0].u_int == 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "can't have 0 frequency"));
+ mp_raise_ValueError("can't have 0 frequency");
}
uint32_t period = MAX(1, F_BUS / vals[0].u_int);
@@ -277,7 +277,7 @@ STATIC mp_obj_t pyb_timer_init_helper(pyb_timer_obj_t *self, uint n_args, const
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "period must be between 0 and 65535, not %d", init->Period));
}
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "must specify either freq, or prescaler and period"));
+ mp_raise_TypeError("must specify either freq, or prescaler and period");
}
init->CounterMode = vals[3].u_int;
@@ -498,7 +498,7 @@ STATIC mp_obj_t pyb_timer_channel(mp_uint_t n_args, const mp_obj_t *args, mp_map
mp_obj_t pin_obj = vals[1].u_obj;
if (pin_obj != mp_const_none) {
if (!MP_OBJ_IS_TYPE(pin_obj, &pin_type)) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "pin argument needs to be be a Pin type"));
+ mp_raise_ValueError("pin argument needs to be be a Pin type");
}
const pin_obj_t *pin = pin_obj;
const pin_af_obj_t *af = pin_find_af(pin, AF_FN_FTM, self->tim_id);
@@ -668,7 +668,7 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) {
// start timer, so that it interrupts on overflow
HAL_FTM_Base_Start_IT(&self->ftm);
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "callback must be None or a callable object"));
+ mp_raise_ValueError("callback must be None or a callable object");
}
return mp_const_none;
}
@@ -846,7 +846,7 @@ STATIC mp_obj_t pyb_timer_channel_callback(mp_obj_t self_in, mp_obj_t callback)
break;
}
} else {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "callback must be None or a callable object"));
+ mp_raise_ValueError("callback must be None or a callable object");
}
return mp_const_none;
}
diff --git a/unix/file.c b/unix/file.c
index f27e23547d..0d65f9ca0d 100644
--- a/unix/file.c
+++ b/unix/file.c
@@ -47,7 +47,7 @@
#ifdef MICROPY_CPYTHON_COMPAT
STATIC void check_fd_is_open(const mp_obj_fdfile_t *o) {
if (o->fd < 0) {
- nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "I/O operation on closed file"));
+ mp_raise_ValueError("I/O operation on closed file");
}
}
#else
diff --git a/unix/modffi.c b/unix/modffi.c
index 6c5e4f22ee..9b514371bc 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -409,7 +409,7 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
}
error:
- nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "Don't know how to pass object to native function"));
+ mp_raise_TypeError("Don't know how to pass object to native function");
}
STATIC const mp_obj_type_t ffifunc_type = {
diff --git a/unix/modjni.c b/unix/modjni.c
index 540964d446..df9cd9d67a 100644
--- a/unix/modjni.c
+++ b/unix/modjni.c
@@ -268,7 +268,7 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
return mp_const_none;
}
}
- mp_not_implemented("");
+ mp_raise_NotImplementedError("");
}
if (!JJ(IsInstanceOf, self->obj, List_class)) {
From c127ace28a4faeb93ef86743c703a14258137efc Mon Sep 17 00:00:00 2001
From: Javier Candeira
Date: Mon, 14 Aug 2017 15:42:25 +1000
Subject: [PATCH 222/252] docs/library/machine.RTC.rst: Fix typo.
---
docs/library/machine.RTC.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/library/machine.RTC.rst b/docs/library/machine.RTC.rst
index 2a53b91469..95fa2b4ce6 100644
--- a/docs/library/machine.RTC.rst
+++ b/docs/library/machine.RTC.rst
@@ -38,7 +38,7 @@ Methods
Resets the RTC to the time of January 1, 2015 and starts running it again.
-.. method:: RTC.alarm(id, time, /*, repeat=False)
+.. method:: RTC.alarm(id, time, \*, repeat=False)
Set the RTC alarm. Time might be either a millisecond value to program the alarm to
current time + time_in_ms in the future, or a datetimetuple. If the time passed is in
From a14ce77b28146526661c79c89b2e6ff6837c2bb0 Mon Sep 17 00:00:00 2001
From: Bas van Sisseren
Date: Sat, 12 Aug 2017 14:40:49 +0200
Subject: [PATCH 223/252] py/binary.c: Fix bug when packing big-endian 'Q'
values.
Without bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x10\x00\x00\x00\x00'
With bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x00\x00\x00\x00\x10'
---
py/binary.c | 5 ++++-
tests/basics/struct1_intbig.py | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/py/binary.c b/py/binary.c
index e38aae8ea3..870a0942ba 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -303,7 +303,10 @@ void mp_binary_set_val(char struct_type, char val_type, mp_obj_t val_in, byte **
// zero/sign extend if needed
if (BYTES_PER_WORD < 8 && size > sizeof(val)) {
int c = (is_signed(val_type) && (mp_int_t)val < 0) ? 0xff : 0x00;
- memset(p + sizeof(val), c, size - sizeof(val));
+ memset(p, c, size);
+ if (struct_type == '>') {
+ p += size - sizeof(val);
+ }
}
}
}
diff --git a/tests/basics/struct1_intbig.py b/tests/basics/struct1_intbig.py
index b1fec527ef..380293f36c 100644
--- a/tests/basics/struct1_intbig.py
+++ b/tests/basics/struct1_intbig.py
@@ -12,6 +12,8 @@ print(struct.pack("Q", 1))
print(struct.pack("Q", 2**64 - 1))
print(struct.pack("
Date: Mon, 24 Jul 2017 18:55:14 +0200
Subject: [PATCH 224/252] py: Add verbose debug compile-time flag
MICROPY_DEBUG_VERBOSE.
It enables all the DEBUG_printf outputs in the py/ source code.
---
py/bc.c | 2 +-
py/builtinimport.c | 2 +-
py/emitglue.c | 2 +-
py/emitnative.c | 2 +-
py/gc.c | 2 +-
py/malloc.c | 2 +-
py/modthread.c | 2 +-
py/mpconfig.h | 5 +++++
py/nativeglue.c | 2 +-
py/objfun.c | 2 +-
py/objtype.c | 2 +-
py/qstr.c | 2 +-
py/runtime.c | 2 +-
13 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/py/bc.c b/py/bc.c
index 522eb0aeb0..917eba57d9 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -35,7 +35,7 @@
#include "py/bc0.h"
#include "py/bc.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#else // don't print debugging info
#define DEBUG_PRINT (0)
diff --git a/py/builtinimport.c b/py/builtinimport.c
index e0ce91d9be..f5bfb0d982 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -37,7 +37,7 @@
#include "py/builtin.h"
#include "py/frozenmod.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
diff --git a/py/emitglue.c b/py/emitglue.c
index 383e6a136b..d2add988f2 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -35,7 +35,7 @@
#include "py/runtime0.h"
#include "py/bc.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define WRITE_CODE (1)
#define DEBUG_printf DEBUG_printf
diff --git a/py/emitnative.c b/py/emitnative.c
index 7ce6196254..4608cd1e0c 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -50,7 +50,7 @@
#include "py/emit.h"
#include "py/bc.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
diff --git a/py/gc.c b/py/gc.c
index 7253b7db68..3a505e9c78 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -35,7 +35,7 @@
#if MICROPY_ENABLE_GC
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
diff --git a/py/malloc.c b/py/malloc.c
index e679e20926..af4ccf2e81 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -32,7 +32,7 @@
#include "py/misc.h"
#include "py/mpstate.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
#define DEBUG_printf(...) (void)0
diff --git a/py/modthread.c b/py/modthread.c
index 1d76027893..bf74128e81 100644
--- a/py/modthread.c
+++ b/py/modthread.c
@@ -34,7 +34,7 @@
#include "py/mpthread.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 0e76a1ff5e..dac8a903c9 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -373,6 +373,11 @@
#define MICROPY_DEBUG_PRINTERS (0)
#endif
+// Whether to enable all debugging outputs (it will be extremely verbose)
+#ifndef MICROPY_DEBUG_VERBOSE
+#define MICROPY_DEBUG_VERBOSE (0)
+#endif
+
/*****************************************************************************/
/* Optimisations */
diff --git a/py/nativeglue.c b/py/nativeglue.c
index 46c6906d96..e954234c27 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -34,7 +34,7 @@
#include "py/emitglue.h"
#include "py/bc.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
#define DEBUG_printf(...) (void)0
diff --git a/py/objfun.c b/py/objfun.c
index eaba131293..5606511d8a 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -36,7 +36,7 @@
#include "py/bc.h"
#include "py/stackctrl.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#else // don't print debugging info
#define DEBUG_PRINT (0)
diff --git a/py/objtype.c b/py/objtype.c
index 87c0cc9e5c..e1a24da7e7 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -35,7 +35,7 @@
#include "py/runtime0.h"
#include "py/runtime.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
diff --git a/py/qstr.c b/py/qstr.c
index fdb38f1dec..95c9b6835e 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -36,7 +36,7 @@
// ultimately we will replace this with a static hash table of some kind
// also probably need to include the length in the string data, to allow null bytes in the string
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_printf DEBUG_printf
#else // don't print debugging info
#define DEBUG_printf(...) (void)0
diff --git a/py/runtime.c b/py/runtime.c
index 9c3edeb9c8..eb1298813f 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -44,7 +44,7 @@
#include "py/stackctrl.h"
#include "py/gc.h"
-#if 0 // print debugging info
+#if MICROPY_DEBUG_VERBOSE // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf DEBUG_printf
#define DEBUG_OP_printf(...) DEBUG_printf(__VA_ARGS__)
From d5191edf7ff81f5f07243cb2a318508c1e9cc5df Mon Sep 17 00:00:00 2001
From: Eric Poulsen
Date: Tue, 15 Aug 2017 07:49:11 -0700
Subject: [PATCH 225/252] extmod/modussl_mbedtls.c: Add ussl.getpeercert()
method.
Behaviour is as per CPython but only the binary form is implemented here.
A test is included.
---
extmod/modussl_mbedtls.c | 12 ++++++++++++
tests/net_hosted/ssl_getpeercert.py | 21 +++++++++++++++++++++
tests/net_hosted/ssl_getpeercert.py.exp | 1 +
3 files changed, 34 insertions(+)
create mode 100644 tests/net_hosted/ssl_getpeercert.py
create mode 100644 tests/net_hosted/ssl_getpeercert.py.exp
diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c
index 597eaee73d..12ec60a756 100644
--- a/extmod/modussl_mbedtls.c
+++ b/extmod/modussl_mbedtls.c
@@ -34,6 +34,7 @@
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/stream.h"
+#include "py/obj.h"
// mbedtls_time_t
#include "mbedtls/platform.h"
@@ -189,6 +190,16 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
return o;
}
+STATIC mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
+ mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
+ if (!mp_obj_is_true(binary_form)) {
+ mp_raise_NotImplementedError(NULL);
+ }
+ const mbedtls_x509_crt* peer_cert = mbedtls_ssl_get_peer_cert(&o->ssl);
+ return mp_obj_new_bytes(peer_cert->raw.p, peer_cert->raw.len);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_ssl_getpeercert_obj, mod_ssl_getpeercert);
+
STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(self_in);
@@ -259,6 +270,7 @@ STATIC const mp_rom_map_elem_t ussl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_getpeercert), MP_ROM_PTR(&mod_ssl_getpeercert_obj) },
};
STATIC MP_DEFINE_CONST_DICT(ussl_socket_locals_dict, ussl_socket_locals_dict_table);
diff --git a/tests/net_hosted/ssl_getpeercert.py b/tests/net_hosted/ssl_getpeercert.py
new file mode 100644
index 0000000000..e265c830d0
--- /dev/null
+++ b/tests/net_hosted/ssl_getpeercert.py
@@ -0,0 +1,21 @@
+# test ssl.getpeercert() method
+
+try:
+ import usocket as socket
+ import ussl as ssl
+except:
+ import socket
+ import ssl
+
+
+def test(peer_addr):
+ s = socket.socket()
+ s.connect(peer_addr)
+ s = ssl.wrap_socket(s)
+ cert = s.getpeercert(True)
+ print(type(cert), len(cert) > 100)
+ s.close()
+
+
+if __name__ == "__main__":
+ test(socket.getaddrinfo('micropython.org', 443)[0][-1])
diff --git a/tests/net_hosted/ssl_getpeercert.py.exp b/tests/net_hosted/ssl_getpeercert.py.exp
new file mode 100644
index 0000000000..ff7ef5adf1
--- /dev/null
+++ b/tests/net_hosted/ssl_getpeercert.py.exp
@@ -0,0 +1 @@
+ True
From ad937c49aa10e038dacbf27560ce34b76d84f861 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 16 Aug 2017 09:17:33 +0300
Subject: [PATCH 226/252] zephyr/modzephyr: Add current_tid() and
stacks_analyze() functions.
current_tid() returns current thread ID. stacks_analyze() calls
k_call_stacks_analyze() which, with CONFIG_INIT_STACKS enabled,
will print stack usage for some well-known threads in the system.
---
zephyr/modzephyr.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/zephyr/modzephyr.c b/zephyr/modzephyr.c
index 4bac5c970f..37c788ba4a 100644
--- a/zephyr/modzephyr.c
+++ b/zephyr/modzephyr.c
@@ -28,6 +28,7 @@
#if MICROPY_PY_ZEPHYR
#include
+#include
#include "py/runtime.h"
@@ -36,9 +37,22 @@ STATIC mp_obj_t mod_is_preempt_thread(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_is_preempt_thread_obj, mod_is_preempt_thread);
+STATIC mp_obj_t mod_current_tid(void) {
+ return MP_OBJ_NEW_SMALL_INT(k_current_get());
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_current_tid_obj, mod_current_tid);
+
+STATIC mp_obj_t mod_stacks_analyze(void) {
+ k_call_stacks_analyze();
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_stacks_analyze_obj, mod_stacks_analyze);
+
STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zephyr) },
{ MP_ROM_QSTR(MP_QSTR_is_preempt_thread), MP_ROM_PTR(&mod_is_preempt_thread_obj) },
+ { MP_ROM_QSTR(MP_QSTR_current_tid), MP_ROM_PTR(&mod_current_tid_obj) },
+ { MP_ROM_QSTR(MP_QSTR_stacks_analyze), MP_ROM_PTR(&mod_stacks_analyze_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
From 9404093606c3c8c45f497a80789ee9ac21040751 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Wed, 16 Aug 2017 09:22:30 +0300
Subject: [PATCH 227/252] zephyr/prj_base.conf: Enable CONFIG_INIT_STACKS.
As required for zephyr.stack_analyze().
---
zephyr/prj_base.conf | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/zephyr/prj_base.conf b/zephyr/prj_base.conf
index 50b195b2f7..4f3ff5035a 100644
--- a/zephyr/prj_base.conf
+++ b/zephyr/prj_base.conf
@@ -24,6 +24,11 @@ CONFIG_DNS_RESOLVER_ADDITIONAL_QUERIES=2
CONFIG_DNS_SERVER_IP_ADDRESSES=y
CONFIG_DNS_SERVER1="192.0.2.2"
+# Diagnostics and debugging
+
+# Required for zephyr.stack_analyze()
+CONFIG_INIT_STACKS=y
+
# Required for usocket.pkt_get_info()
CONFIG_NET_BUF_POOL_USAGE=y
From e4ab404780dfa194864c579407a054cf6c75db3a Mon Sep 17 00:00:00 2001
From: stijn
Date: Wed, 16 Aug 2017 10:37:00 +0200
Subject: [PATCH 228/252] tools/mpy-tool.py: Fix missing argument in dump()
function
This makes the -d commandline argument usable again.
Pass empty string as parent name as listing starts from the root.
---
tools/mpy-tool.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py
index 887b3f5164..ded9624878 100755
--- a/tools/mpy-tool.py
+++ b/tools/mpy-tool.py
@@ -239,7 +239,7 @@ class RawCode:
def dump(self):
# dump children first
for rc in self.raw_codes:
- rc.freeze()
+ rc.freeze('')
# TODO
def freeze(self, parent_name):
From 025e5f2b339377ebc54ebc9cab2612946145a6fa Mon Sep 17 00:00:00 2001
From: Damien George
Date: Thu, 17 Aug 2017 16:16:11 +1000
Subject: [PATCH 229/252] py/binary: Change internal bytearray typecode from 0
to 1.
The value of 0 can't be used because otherwise mp_binary_get_size will let
a null byte through as the type code (intepreted as byterray). This can
lead to invalid type-specifier strings being let through without an error
in the struct module, and even buffer overruns.
---
py/binary.h | 5 +++--
tests/basics/struct2.py | 27 +++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/py/binary.h b/py/binary.h
index 7b5c60f1ac..0dae6a29e6 100644
--- a/py/binary.h
+++ b/py/binary.h
@@ -29,8 +29,9 @@
#include "py/obj.h"
// Use special typecode to differentiate repr() of bytearray vs array.array('B')
-// (underlyingly they're same).
-#define BYTEARRAY_TYPECODE 0
+// (underlyingly they're same). Can't use 0 here because that's used to detect
+// type-specification errors due to end-of-string.
+#define BYTEARRAY_TYPECODE 1
size_t mp_binary_get_size(char struct_type, char val_type, mp_uint_t *palign);
mp_obj_t mp_binary_get_val_array(char typecode, void *p, mp_uint_t index);
diff --git a/tests/basics/struct2.py b/tests/basics/struct2.py
index d8234d0d36..3b9dd5c1f6 100644
--- a/tests/basics/struct2.py
+++ b/tests/basics/struct2.py
@@ -40,3 +40,30 @@ try:
struct.calcsize('0z')
except:
print('Exception')
+
+# check that a count without a type specifier raises an exception
+
+try:
+ struct.calcsize('1')
+except:
+ print('Exception')
+
+try:
+ struct.pack('1')
+except:
+ print('Exception')
+
+try:
+ struct.pack_into('1', bytearray(4), 0, 'xx')
+except:
+ print('Exception')
+
+try:
+ struct.unpack('1', 'xx')
+except:
+ print('Exception')
+
+try:
+ struct.unpack_from('1', 'xx')
+except:
+ print('Exception')
From c89254fd0f7f4517163e095f144bfe154f47758a Mon Sep 17 00:00:00 2001
From: Alex Robbins
Date: Fri, 4 Aug 2017 17:30:34 -0500
Subject: [PATCH 230/252] extmod/modubinascii: Rewrite mod_binascii_a2b_base64.
This implementation ignores invalid characters in the input. This allows
it to decode the output of b2a_base64, and also mimics the behavior of
CPython.
---
extmod/modubinascii.c | 94 +++++++++++++++-------------
tests/extmod/ubinascii_a2b_base64.py | 7 +++
2 files changed, 59 insertions(+), 42 deletions(-)
diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c
index d3092a4df1..b02d833185 100644
--- a/extmod/modubinascii.c
+++ b/extmod/modubinascii.c
@@ -105,54 +105,64 @@ mp_obj_t mod_binascii_unhexlify(mp_obj_t data) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_unhexlify_obj, mod_binascii_unhexlify);
+// If ch is a character in the base64 alphabet, and is not a pad character, then
+// the corresponding integer between 0 and 63, inclusively, is returned.
+// Otherwise, -1 is returned.
+static int mod_binascii_sextet(byte ch) {
+ if (ch >= 'A' && ch <= 'Z') {
+ return ch - 'A';
+ } else if (ch >= 'a' && ch <= 'z') {
+ return ch - 'a' + 26;
+ } else if (ch >= '0' && ch <= '9') {
+ return ch - '0' + 52;
+ } else if (ch == '+') {
+ return 62;
+ } else if (ch == '/') {
+ return 63;
+ } else {
+ return -1;
+ }
+}
+
mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
- if (bufinfo.len % 4 != 0) {
+ byte *in = bufinfo.buf;
+
+ vstr_t vstr;
+ vstr_init(&vstr, (bufinfo.len / 4) * 3 + 1); // Potentially over-allocate
+ byte *out = (byte *)vstr.buf;
+
+ uint shift = 0;
+ int nbits = 0; // Number of meaningful bits in shift
+ bool hadpad = false; // Had a pad character since last valid character
+ for (size_t i = 0; i < bufinfo.len; i++) {
+ if (in[i] == '=') {
+ if ((nbits == 2) || ((nbits == 4) && hadpad)) {
+ nbits = 0;
+ break;
+ }
+ hadpad = true;
+ }
+
+ int sextet = mod_binascii_sextet(in[i]);
+ if (sextet == -1) {
+ continue;
+ }
+ hadpad = false;
+ shift = (shift << 6) | sextet;
+ nbits += 6;
+
+ if (nbits >= 8) {
+ nbits -= 8;
+ out[vstr.len++] = (shift >> nbits) & 0xFF;
+ }
+ }
+
+ if (nbits) {
mp_raise_ValueError("incorrect padding");
}
- vstr_t vstr;
- byte *in = bufinfo.buf;
- if (bufinfo.len == 0) {
- 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));
- }
- byte *out = (byte*)vstr.buf;
- for (mp_uint_t i = bufinfo.len; i; i -= 4) {
- char hold[4];
- for (int j = 4; j--;) {
- if (in[j] >= 'A' && in[j] <= 'Z') {
- hold[j] = in[j] - 'A';
- } else if (in[j] >= 'a' && in[j] <= 'z') {
- hold[j] = in[j] - 'a' + 26;
- } else if (in[j] >= '0' && in[j] <= '9') {
- hold[j] = in[j] - '0' + 52;
- } else if (in[j] == '+') {
- hold[j] = 62;
- } else if (in[j] == '/') {
- hold[j] = 63;
- } else if (in[j] == '=') {
- if (j < 2 || i > 4) {
- mp_raise_ValueError("incorrect padding");
- }
- hold[j] = 64;
- } else {
- mp_raise_ValueError("invalid character");
- }
- }
- in += 4;
-
- *out++ = (hold[0]) << 2 | (hold[1]) >> 4;
- if (hold[2] != 64) {
- *out++ = (hold[1] & 0x0F) << 4 | hold[2] >> 2;
- if (hold[3] != 64) {
- *out++ = (hold[2] & 0x03) << 6 | hold[3];
- }
- }
- }
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj, mod_binascii_a2b_base64);
diff --git a/tests/extmod/ubinascii_a2b_base64.py b/tests/extmod/ubinascii_a2b_base64.py
index b35f265910..05a3169f3a 100644
--- a/tests/extmod/ubinascii_a2b_base64.py
+++ b/tests/extmod/ubinascii_a2b_base64.py
@@ -21,6 +21,13 @@ print(binascii.a2b_base64(b'f4D/'))
print(binascii.a2b_base64(b'f4D+')) # convert '+'
print(binascii.a2b_base64(b'MTIzNEFCQ0RhYmNk'))
+# Ignore invalid characters and pad sequences
+print(binascii.a2b_base64(b'Zm9v\n'))
+print(binascii.a2b_base64(b'Zm\x009v\n'))
+print(binascii.a2b_base64(b'Zm9v=='))
+print(binascii.a2b_base64(b'Zm9v==='))
+print(binascii.a2b_base64(b'Zm9v===YmFy'))
+
try:
print(binascii.a2b_base64(b'abc'))
except ValueError:
From 0aa1d3f4477f56faf3bfc2891be627b86d87a63b Mon Sep 17 00:00:00 2001
From: Alex Robbins
Date: Fri, 4 Aug 2017 18:01:35 -0500
Subject: [PATCH 231/252] docs/library/ubinascii: Update base64 docs.
This clarifies return values and the handling of invalid (e.g. newline)
characters.
Encoding conforms to RFC 3548, but decoding does not, as it ignores invalid
characters in base64 input. Instead, it conforms to MIME handling of base64
(RFC 2045).
Note that CPython doesn't document handling of invalid characters in
a2b_base64() docs:
https://docs.python.org/3/library/binascii.html#binascii.a2b_base64 , so
we specify it more explicitly than it, based on CPython's actual behavior
(with which MicroPython now compliant).
---
docs/library/ubinascii.rst | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/library/ubinascii.rst b/docs/library/ubinascii.rst
index 0664d5b09d..192d34514b 100644
--- a/docs/library/ubinascii.rst
+++ b/docs/library/ubinascii.rst
@@ -29,8 +29,12 @@ Functions
.. function:: a2b_base64(data)
- Convert Base64-encoded data to binary representation. Returns bytes string.
+ Decode base64-encoded data, ignoring invalid characters in the input.
+ Conforms to `RFC 2045 s.6.8 `_.
+ Returns a bytes object.
.. function:: b2a_base64(data)
- Encode binary data in Base64 format. Returns string.
+ Encode binary data in base64 format, as in `RFC 3548
+ `_. Returns the encoded data
+ followed by a newline character, as a bytes object.
From 09b561f108965565986a17ded3c4b869ee09fc14 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 19 Aug 2017 11:45:21 +0300
Subject: [PATCH 232/252] zephyr/modusocket: Update struct sockaddr family
field name.
Was changed to "sa_family" for POSIX compatibility.
---
zephyr/modusocket.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index f8d668a709..9319f4f980 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -88,8 +88,8 @@ STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
// We employ the fact that port and address offsets are the same for IPv4 & IPv6
struct sockaddr_in6 *sockaddr_in6 = (struct sockaddr_in6*)addr;
char buf[40];
- net_addr_ntop(addr->family, &sockaddr_in6->sin6_addr, buf, sizeof(buf));
- mp_obj_tuple_t *tuple = mp_obj_new_tuple(addr->family == AF_INET ? 2 : 4, NULL);
+ net_addr_ntop(addr->sa_family, &sockaddr_in6->sin6_addr, buf, sizeof(buf));
+ mp_obj_tuple_t *tuple = mp_obj_new_tuple(addr->sa_family == AF_INET ? 2 : 4, NULL);
tuple->items[0] = mp_obj_new_str(buf, strlen(buf), false);
// We employ the fact that port offset is the same for IPv4 & IPv6
@@ -97,7 +97,7 @@ STATIC mp_obj_t format_inet_addr(struct sockaddr *addr, mp_obj_t port) {
//tuple->items[1] = mp_obj_new_int(ntohs(((struct sockaddr_in*)addr)->sin_port));
tuple->items[1] = port;
- if (addr->family == AF_INET6) {
+ if (addr->sa_family == AF_INET6) {
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0); // flow_info
tuple->items[3] = MP_OBJ_NEW_SMALL_INT(sockaddr_in6->sin6_scope_id);
}
From 394c5366758bf7b77174750007c020075e2507f4 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sat, 19 Aug 2017 11:55:18 +0300
Subject: [PATCH 233/252] zephyr/prj_96b_carbon.conf: Re-enable networking on
Carbon.
The original issue leading to crash on startup if no default network
interface was presented, was resolved some time ago.
Note that this enables generic networking subsystem, not networking
on Carbon.
---
zephyr/prj_96b_carbon.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zephyr/prj_96b_carbon.conf b/zephyr/prj_96b_carbon.conf
index 3e41e25329..40b57e69c9 100644
--- a/zephyr/prj_96b_carbon.conf
+++ b/zephyr/prj_96b_carbon.conf
@@ -1,2 +1,2 @@
# TODO: Enable networking
-CONFIG_NETWORKING=n
+CONFIG_NETWORKING=y
From 478887c62ffae50cbb8e60e24405e2a4eae7b322 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 08:45:00 +0300
Subject: [PATCH 234/252] zephyr/modzephyr: Add shell_net_iface() function.
Calls out to Zephyr's shell, submodule "net", command "iface", and shows
network interface information (if CONFIG_NET_SHELL is enabled).
---
zephyr/modzephyr.c | 16 ++++++++++++++++
zephyr/prj_base.conf | 3 +++
2 files changed, 19 insertions(+)
diff --git a/zephyr/modzephyr.c b/zephyr/modzephyr.c
index 37c788ba4a..265fc882dc 100644
--- a/zephyr/modzephyr.c
+++ b/zephyr/modzephyr.c
@@ -48,11 +48,27 @@ STATIC mp_obj_t mod_stacks_analyze(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_stacks_analyze_obj, mod_stacks_analyze);
+#ifdef CONFIG_NET_SHELL
+
+//int net_shell_cmd_iface(int argc, char *argv[]);
+
+STATIC mp_obj_t mod_shell_net_iface(void) {
+ net_shell_cmd_iface(0, NULL);
+ return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_shell_net_iface_obj, mod_shell_net_iface);
+
+#endif // CONFIG_NET_SHELL
+
STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_zephyr) },
{ MP_ROM_QSTR(MP_QSTR_is_preempt_thread), MP_ROM_PTR(&mod_is_preempt_thread_obj) },
{ MP_ROM_QSTR(MP_QSTR_current_tid), MP_ROM_PTR(&mod_current_tid_obj) },
{ MP_ROM_QSTR(MP_QSTR_stacks_analyze), MP_ROM_PTR(&mod_stacks_analyze_obj) },
+
+ #ifdef CONFIG_NET_SHELL
+ { MP_ROM_QSTR(MP_QSTR_shell_net_iface), MP_ROM_PTR(&mod_shell_net_iface_obj) },
+ #endif
};
STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);
diff --git a/zephyr/prj_base.conf b/zephyr/prj_base.conf
index 4f3ff5035a..c3ba2812f4 100644
--- a/zephyr/prj_base.conf
+++ b/zephyr/prj_base.conf
@@ -32,6 +32,9 @@ CONFIG_INIT_STACKS=y
# Required for usocket.pkt_get_info()
CONFIG_NET_BUF_POOL_USAGE=y
+# Required for usocket.shell_*()
+#CONFIG_NET_SHELL=y
+
# Uncomment to enable "INFO" level net_buf logging
#CONFIG_NET_LOG=y
#CONFIG_NET_DEBUG_NET_BUF=y
From ccaad5327087eb93c3c5329b02ba7c11d95c0487 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 09:04:48 +0300
Subject: [PATCH 235/252] docs/library/usocket: Move socket.error to its own
section.
It's too minor a point to start the module description with it.
---
docs/library/usocket.rst | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/docs/library/usocket.rst b/docs/library/usocket.rst
index 70d4f49fc2..18a8f8fcd5 100644
--- a/docs/library/usocket.rst
+++ b/docs/library/usocket.rst
@@ -9,12 +9,6 @@
This module provides access to the BSD socket interface.
-.. admonition:: Difference to CPython
- :class: attention
-
- CPython used to have a ``socket.error`` exception which is now deprecated,
- and is an alias of `OSError`. In MicroPython, use `OSError` directly.
-
.. admonition:: Difference to CPython
:class: attention
@@ -250,3 +244,13 @@ Methods
the length of *buf*.
Return value: number of bytes written.
+
+.. exception:: socket.error
+
+ MicroPython does NOT have this exception.
+
+ .. admonition:: Difference to CPython
+ :class: attention
+
+ CPython used to have a ``socket.error`` exception which is now deprecated,
+ and is an alias of `OSError`. In MicroPython, use `OSError` directly.
From 3f915704833e2bf8b2d8b977640e8c630c5c5ef7 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 09:49:12 +0300
Subject: [PATCH 236/252] docs/library/usocket: Describe complete information
on address formats.
Describe that the only portable way to deal with addresses is by using
getaddrinfo(). Describe that some ports may support tuple addresses using
"socket" module (vs "usocket" of native MicroPython).
---
docs/library/usocket.rst | 46 +++++++++++++++++++++++++++++++++++-----
1 file changed, 41 insertions(+), 5 deletions(-)
diff --git a/docs/library/usocket.rst b/docs/library/usocket.rst
index 18a8f8fcd5..65e24e2662 100644
--- a/docs/library/usocket.rst
+++ b/docs/library/usocket.rst
@@ -21,11 +21,47 @@ This module provides access to the BSD socket interface.
Socket address format(s)
------------------------
-The functions below which expect a network address, accept it in the format of
-*(ipv4_address, port)*, where *ipv4_address* is a string with dot-notation numeric
-IPv4 address, e.g. ``"8.8.8.8"``, and port is integer port number in the range
-1-65535. Note the domain names are not accepted as *ipv4_address*, they should be
-resolved first using `usocket.getaddrinfo()`.
+The native socket address format of the ``usocket`` module is an opaque data type
+returned by `getaddrinfo` function, which must be used to resolve textual address
+(including numeric addresses)::
+
+ sockaddr = usocket.getaddrinfo('www.micropython.org', 80)[0][-1]
+ # You must use getaddrinfo() even for numeric addresses
+ sockaddr = usocket.getaddrinfo('127.0.0.1', 80)[0][-1]
+ # Now you can use that address
+ sock.connect(addr)
+
+Using `getaddrinfo` is the most efficient (both in terms of memory and processing
+power) and portable way to work with addresses.
+
+However, ``socket`` module (note the difference with native MicroPython
+``usocket`` module described here) provides CPython-compatible way to specify
+addresses using tuples, as described below. Note that depending on a
+`MicroPython port`, ``socket`` module can be builtin or need to be
+installed from `micropython-lib` (as in the case of `MicroPython Unix port`),
+and some ports still accept only numeric addresses in the tuple format,
+and require to use `getaddrinfo` function to resolve domain names.
+
+Summing up:
+
+* Always use `getaddrinfo` when writing portable applications.
+* Tuple addresses described below can be used as a shortcut for
+ quick hacks and interactive use, if your port supports them.
+
+Tuple address format for ``socket`` module:
+
+* IPv4: *(ipv4_address, port)*, where *ipv4_address* is a string with
+ dot-notation numeric IPv4 address, e.g. ``"8.8.8.8"``, and *port* is and
+ integer port number in the range 1-65535. Note the domain names are not
+ accepted as *ipv4_address*, they should be resolved first using
+ `usocket.getaddrinfo()`.
+* IPv6: *(ipv6_address, port, flowinfo, scopeid)*, where *ipv6_address*
+ is a string with colon-notation numeric IPv6 address, e.g. ``"2001:db8::1"``,
+ and *port* is an integer port number in the range 1-65535. *flowinfo*
+ must be 0. *scopeid* is the interface scope identifier for link-local
+ addresses. Note the domain names are not accepted as *ipv6_address*,
+ they should be resolved first using `usocket.getaddrinfo()`. Availability
+ of IPv6 support depends on a `MicroPython port`.
Functions
---------
From 46583e905771222d7b8395e4c33569e2624f1943 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 10:11:44 +0300
Subject: [PATCH 237/252] docs/glossary: Elaborate on possible MicroPython port
differences.
State that this doc describes generic, "core" MicroPython functionality,
any particular port may diverge in both directions, by both omitting
some functionality, and adding more, both cases described outside the
generic documentation.
---
docs/reference/glossary.rst | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/reference/glossary.rst b/docs/reference/glossary.rst
index 4099ae9516..0f93fff23c 100644
--- a/docs/reference/glossary.rst
+++ b/docs/reference/glossary.rst
@@ -68,7 +68,13 @@ Glossary
MicroPython supports different :term:`boards `, RTOSes,
and OSes, and can be relatively easily adapted to new systems.
MicroPython with support for a particular system is called a
- "port" to that system.
+ "port" to that system. Different ports may have widely different
+ functionality. This documentation is intended to be a reference
+ of the generic APIs available across different ports ("MicroPython
+ core"). Note that some ports may still omit some APIs described
+ here (e.g. due to resource constraints). Any such differences,
+ and port-specific extensions beyond MicroPython core functionality,
+ would be described in the separate port-specific documentation.
MicroPython Unix port
Unix port is one of the major :term:`MicroPython ports `.
From 387a8d26f9b54b37928aa08641b159334b669219 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 10:44:02 +0300
Subject: [PATCH 238/252] docs/glossary: Fix typos in micropython-lib
paragraph.
---
docs/reference/glossary.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/reference/glossary.rst b/docs/reference/glossary.rst
index 0f93fff23c..98979afa92 100644
--- a/docs/reference/glossary.rst
+++ b/docs/reference/glossary.rst
@@ -54,10 +54,10 @@ Glossary
separate project
`micropython-lib `_
which provides implementations for many modules from CPython's
- standard library. However, large subset of these modules required
+ standard library. However, large subset of these modules require
POSIX-like environment (Linux, MacOS, Windows may be partially
supported), and thus would work or make sense only with MicroPython
- Unix port. Some subset of modules however usable for baremetal ports
+ Unix port. Some subset of modules is however usable for baremetal ports
too.
Unlike monolithic :term:`CPython` stdlib, micropython-lib modules
From 168350cd9849b0ab56867c487cfd78ca68c2b228 Mon Sep 17 00:00:00 2001
From: Tom Collins
Date: Thu, 25 May 2017 13:53:49 -0700
Subject: [PATCH 239/252] py/objstringio: Prevent offset wraparound for
io.BytesIO objects.
Too big positive, or too big negative offset values could lead to overflow
and address space wraparound and thus access to unrelated areas of memory
(a security issue).
---
py/objstringio.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/py/objstringio.c b/py/objstringio.c
index 046d325806..cb8003bcdd 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -125,8 +125,19 @@ STATIC mp_uint_t stringio_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
ref = o->vstr->len;
break;
}
- o->pos = ref + s->offset;
- s->offset = o->pos;
+ mp_uint_t new_pos = ref + s->offset;
+ if (s->offset < 0) {
+ if (new_pos > ref) {
+ // Negative offset from SEEK_CUR or SEEK_END went past 0.
+ // CPython sets position to 0, POSIX returns an EINVAL error
+ new_pos = 0;
+ }
+ } else if (new_pos < ref) {
+ // positive offset went beyond the limit of mp_uint_t
+ *errcode = MP_EINVAL; // replace with MP_EOVERFLOW when defined
+ return MP_STREAM_ERROR;
+ }
+ s->offset = o->pos = new_pos;
return 0;
}
case MP_STREAM_FLUSH:
From 0cd9ab77550eada4def492a3a25286ead71a3b24 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 21:32:17 +0300
Subject: [PATCH 240/252] py/objstringio: Fix regression with handling
SEEK_SET.
For SEEK_SET, offset should be treated as unsigned, to allow full-width
stream sizes (e.g. 32-bit instead of 31-bit). This is now fully documented
in stream.h. Also, seek symbolic constants are added.
---
py/objstringio.c | 8 +++++---
py/stream.h | 8 ++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/py/objstringio.c b/py/objstringio.c
index cb8003bcdd..61da0203e1 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -118,15 +118,17 @@ STATIC mp_uint_t stringio_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg,
struct mp_stream_seek_t *s = (struct mp_stream_seek_t*)arg;
mp_uint_t ref = 0;
switch (s->whence) {
- case 1: // SEEK_CUR
+ case MP_SEEK_CUR:
ref = o->pos;
break;
- case 2: // SEEK_END
+ case MP_SEEK_END:
ref = o->vstr->len;
break;
}
mp_uint_t new_pos = ref + s->offset;
- if (s->offset < 0) {
+
+ // For MP_SEEK_SET, offset is unsigned
+ if (s->whence != MP_SEEK_SET && s->offset < 0) {
if (new_pos > ref) {
// Negative offset from SEEK_CUR or SEEK_END went past 0.
// CPython sets position to 0, POSIX returns an EINVAL error
diff --git a/py/stream.h b/py/stream.h
index 401ae313cd..fbe3d7d859 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -50,10 +50,18 @@
// Argument structure for MP_STREAM_SEEK
struct mp_stream_seek_t {
+ // If whence == MP_SEEK_SET, offset should be treated as unsigned.
+ // This allows dealing with full-width stream sizes (16, 32, 64,
+ // etc. bits). For other seek types, should be treated as signed.
mp_off_t offset;
int whence;
};
+// seek ioctl "whence" values
+#define MP_SEEK_SET (0)
+#define MP_SEEK_CUR (1)
+#define MP_SEEK_END (2)
+
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_read1_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_readinto_obj);
From e3383e9352ca7704e650b07038207719c60b56fb Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky
Date: Sun, 20 Aug 2017 21:57:36 +0300
Subject: [PATCH 241/252] py/stream: seek: Consistently handle negative offset
for SEEK_SET.
Per POSIX, this is EINVAL, so raises OSError(EINVAL).
---
py/stream.c | 7 ++++++-
tests/io/bytesio_ext2.py | 13 +++++++++++++
tests/io/bytesio_ext2.py.exp | 1 +
3 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 tests/io/bytesio_ext2.py
create mode 100644 tests/io/bytesio_ext2.py.exp
diff --git a/py/stream.c b/py/stream.c
index 5d18681538..0029a59a75 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -448,11 +448,16 @@ STATIC mp_obj_t stream_seek(size_t n_args, const mp_obj_t *args) {
struct mp_stream_seek_t seek_s;
// TODO: Could be uint64
seek_s.offset = mp_obj_get_int(args[1]);
- seek_s.whence = 0;
+ seek_s.whence = SEEK_SET;
if (n_args == 3) {
seek_s.whence = mp_obj_get_int(args[2]);
}
+ // In POSIX, it's error to seek before end of stream, we enforce it here.
+ if (seek_s.whence == SEEK_SET && seek_s.offset < 0) {
+ mp_raise_OSError(MP_EINVAL);
+ }
+
int error;
mp_uint_t res = stream_p->ioctl(args[0], MP_STREAM_SEEK, (mp_uint_t)(uintptr_t)&seek_s, &error);
if (res == MP_STREAM_ERROR) {
diff --git a/tests/io/bytesio_ext2.py b/tests/io/bytesio_ext2.py
new file mode 100644
index 0000000000..c07ad900c9
--- /dev/null
+++ b/tests/io/bytesio_ext2.py
@@ -0,0 +1,13 @@
+try:
+ import uio as io
+except ImportError:
+ import io
+
+a = io.BytesIO(b"foobar")
+try:
+ a.seek(-10)
+except Exception as e:
+ # CPython throws ValueError, but MicroPython has consistent stream
+ # interface, so BytesIO raises the same error as a real file, which
+ # is OSError(EINVAL).
+ print(repr(e))
diff --git a/tests/io/bytesio_ext2.py.exp b/tests/io/bytesio_ext2.py.exp
new file mode 100644
index 0000000000..b52e4978aa
--- /dev/null
+++ b/tests/io/bytesio_ext2.py.exp
@@ -0,0 +1 @@
+OSError(22,)
From b16a755a0b6f471fff8dc1d29794b9c4105fc093 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 21 Aug 2017 20:32:30 +1000
Subject: [PATCH 242/252] py/mkrules.mk: Use "find -path" when searching for
frozen obj files.
This allows the command to succeed without error even if there is no
$(BUILD)/build directory, which is the case for mpy-cross.
---
py/mkrules.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/py/mkrules.mk b/py/mkrules.mk
index de2c92a3f4..bf6ad29410 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -135,7 +135,7 @@ $(PROG): $(OBJ)
ifndef DEBUG
$(Q)$(STRIP) $(STRIPFLAGS_EXTRA) $(PROG)
endif
- $(Q)$(SIZE) $$(find $(BUILD)/build -name "frozen*.o") $(PROG)
+ $(Q)$(SIZE) $$(find $(BUILD) -path "$(BUILD)/build/frozen*.o") $(PROG)
clean: clean-prog
clean-prog:
From 4c736ea8fc046dc564f9167967a5dd92f07ed002 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 21 Aug 2017 20:47:22 +1000
Subject: [PATCH 243/252] extmod,unix: For uos.stat interpret st_size member as
an unsigned int.
This prevents large files (eg larger than 2gb on a 32-bit arch) from
showing up as having a negative size. Fixes issue #3227.
---
extmod/vfs_fat.c | 2 +-
unix/modos.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 0ec3fe6d2e..b270541119 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -243,7 +243,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
t->items[3] = MP_OBJ_NEW_SMALL_INT(0); // st_nlink
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
- t->items[6] = MP_OBJ_NEW_SMALL_INT(fno.fsize); // st_size
+ t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
diff --git a/unix/modos.c b/unix/modos.c
index 8b5d5790f3..5030fbb65b 100644
--- a/unix/modos.c
+++ b/unix/modos.c
@@ -58,7 +58,7 @@ STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) {
t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.st_nlink);
t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.st_uid);
t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.st_gid);
- t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.st_size);
+ t->items[6] = mp_obj_new_int_from_uint(sb.st_size);
t->items[7] = MP_OBJ_NEW_SMALL_INT(sb.st_atime);
t->items[8] = MP_OBJ_NEW_SMALL_INT(sb.st_mtime);
t->items[9] = MP_OBJ_NEW_SMALL_INT(sb.st_ctime);
From 4ec803a42ae3080d4af959c7c2edf81e57f79377 Mon Sep 17 00:00:00 2001
From: Damien George
Date: Mon, 21 Aug 2017 21:34:23 +1000
Subject: [PATCH 244/252] all: Make static dicts use mp_rom_map_elem_t type and
MP_ROM_xxx macros.
---
bare-arm/mpconfigport.h | 2 +-
cc3200/boards/make-pins.py | 4 +-
cc3200/misc/mpirq.c | 10 +--
cc3200/mods/modmachine.c | 72 +++++++++----------
cc3200/mods/modnetwork.c | 18 ++---
cc3200/mods/modubinascii.c | 12 ++--
cc3200/mods/moduhashlib.c | 16 ++---
cc3200/mods/moduos.c | 38 +++++-----
cc3200/mods/modusocket.c | 60 ++++++++--------
cc3200/mods/modussl.c | 22 +++---
cc3200/mods/modutime.c | 26 +++----
cc3200/mods/modwipy.c | 6 +-
cc3200/mods/modwlan.c | 50 +++++++-------
cc3200/mods/pybadc.c | 16 ++---
cc3200/mods/pybflash.c | 8 +--
cc3200/mods/pybi2c.c | 20 +++---
cc3200/mods/pybpin.c | 48 ++++++-------
cc3200/mods/pybrtc.c | 18 ++---
cc3200/mods/pybsd.c | 12 ++--
cc3200/mods/pybspi.c | 16 ++---
cc3200/mods/pybtimer.c | 36 +++++-----
cc3200/mods/pybuart.c | 22 +++---
cc3200/mods/pybwdt.c | 4 +-
cc3200/mpconfigport.h | 44 ++++++------
esp8266/mpconfigport.h | 28 ++++----
examples/embedding/mpconfigport_minimal.h | 2 +-
minimal/mpconfigport.h | 2 +-
pic16bit/modpyb.c | 14 ++--
pic16bit/modpybled.c | 8 +--
pic16bit/modpybswitch.c | 4 +-
pic16bit/mpconfigport.h | 4 +-
qemu-arm/mpconfigport.h | 2 +-
stmhal/boards/make-pins.py | 4 +-
stmhal/make-stmconst.py | 10 +--
stmhal/mpconfigport.h | 58 ++++++++--------
teensy/led.c | 8 +--
teensy/make-pins.py | 4 +-
teensy/modpyb.c | 84 +++++++++++------------
teensy/mpconfigport.h | 4 +-
teensy/timer.c | 60 ++++++++--------
teensy/uart.c | 12 ++--
unix/mpconfigport_minimal.h | 2 +-
windows/mpconfigport.h | 8 +--
zephyr/machine_pin.c | 18 ++---
zephyr/modusocket.c | 52 +++++++-------
zephyr/mpconfigport.h | 6 +-
46 files changed, 487 insertions(+), 487 deletions(-)
diff --git a/bare-arm/mpconfigport.h b/bare-arm/mpconfigport.h
index 17f7945218..3fbd3769f1 100644
--- a/bare-arm/mpconfigport.h
+++ b/bare-arm/mpconfigport.h
@@ -60,7 +60,7 @@ typedef long mp_off_t;
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
+ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
// We need to provide a declaration/definition of alloca()
#include
diff --git a/cc3200/boards/make-pins.py b/cc3200/boards/make-pins.py
index 26ca5a0b92..30db4ac9ec 100644
--- a/cc3200/boards/make-pins.py
+++ b/cc3200/boards/make-pins.py
@@ -133,10 +133,10 @@ class Pins:
def print_named(self, label, pins):
print('')
- print('STATIC const mp_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{'.format(label))
+ print('STATIC const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{'.format(label))
for pin in pins:
if pin.board_pin:
- print(' {{ MP_OBJ_NEW_QSTR(MP_QSTR_{:6s}), (mp_obj_t)&pin_{:6s} }},'.format(pin.name, pin.name))
+ print(' {{ MP_ROM_QSTR(MP_QSTR_{:6s}), MP_ROM_PTR(&pin_{:6s}) }},'.format(pin.name, pin.name))
print('};')
print('MP_DEFINE_CONST_DICT(pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);'.format(label, label));
diff --git a/cc3200/misc/mpirq.c b/cc3200/misc/mpirq.c
index 321663088d..d05f9181b8 100644
--- a/cc3200/misc/mpirq.c
+++ b/cc3200/misc/mpirq.c
@@ -182,12 +182,12 @@ STATIC mp_obj_t mp_irq_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
return mp_const_none;
}
-STATIC const mp_map_elem_t mp_irq_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t mp_irq_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&mp_irq_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_enable), (mp_obj_t)&mp_irq_enable_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_disable), (mp_obj_t)&mp_irq_disable_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_flags), (mp_obj_t)&mp_irq_flags_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mp_irq_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_enable), MP_ROM_PTR(&mp_irq_enable_obj) },
+ { MP_ROM_QSTR(MP_QSTR_disable), MP_ROM_PTR(&mp_irq_disable_obj) },
+ { MP_ROM_QSTR(MP_QSTR_flags), MP_ROM_PTR(&mp_irq_flags_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
diff --git a/cc3200/mods/modmachine.c b/cc3200/mods/modmachine.c
index 5f63d01967..fb0fe7f2c7 100644
--- a/cc3200/mods/modmachine.c
+++ b/cc3200/mods/modmachine.c
@@ -160,49 +160,49 @@ STATIC mp_obj_t machine_wake_reason (void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason);
-STATIC const mp_map_elem_t machine_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) },
+STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_umachine) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj },
+ { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
#ifdef DEBUG
- { MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj },
+ { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&machine_info_obj) },
#endif
- { MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&machine_freq_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_unique_id), (mp_obj_t)&machine_unique_id_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_main), (mp_obj_t)&machine_main_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&machine_rng_get_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_idle), (mp_obj_t)&machine_idle_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sleep), (mp_obj_t)&machine_sleep_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deepsleep), (mp_obj_t)&machine_deepsleep_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_reset_cause), (mp_obj_t)&machine_reset_cause_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_wake_reason), (mp_obj_t)&machine_wake_reason_obj },
+ { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) },
+ { MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
+ { MP_ROM_QSTR(MP_QSTR_main), MP_ROM_PTR(&machine_main_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rng), MP_ROM_PTR(&machine_rng_get_obj) },
+ { MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&machine_sleep_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deepsleep), MP_ROM_PTR(&machine_deepsleep_obj) },
+ { MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
+ { MP_ROM_QSTR(MP_QSTR_wake_reason), MP_ROM_PTR(&machine_wake_reason_obj) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&pyb_disable_irq_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&pyb_enable_irq_obj },
+ { MP_ROM_QSTR(MP_QSTR_disable_irq), MP_ROM_PTR(&pyb_disable_irq_obj) },
+ { MP_ROM_QSTR(MP_QSTR_enable_irq), MP_ROM_PTR(&pyb_enable_irq_obj) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_RTC), (mp_obj_t)&pyb_rtc_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pin_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SPI), (mp_obj_t)&pyb_spi_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_Timer), (mp_obj_t)&pyb_timer_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WDT), (mp_obj_t)&pyb_wdt_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SD), (mp_obj_t)&pyb_sd_type },
+ { MP_ROM_QSTR(MP_QSTR_RTC), MP_ROM_PTR(&pyb_rtc_type) },
+ { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pin_type) },
+ { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&pyb_adc_type) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&pyb_spi_type) },
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&pyb_uart_type) },
+ { MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type) },
+ { MP_ROM_QSTR(MP_QSTR_WDT), MP_ROM_PTR(&pyb_wdt_type) },
+ { MP_ROM_QSTR(MP_QSTR_SD), MP_ROM_PTR(&pyb_sd_type) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_IDLE), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_ACTIVE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_LPDS) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_HIBERNATE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_POWER_ON), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) }, // legacy constant
- { MP_OBJ_NEW_QSTR(MP_QSTR_PWRON_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_HARD_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HARD_RESET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WDT_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WDT_RESET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HIB_RESET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOFT_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_SOFT_RESET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WLAN_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_WLAN) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PIN_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_GPIO) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_RTC_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_RTC) },
+ { MP_ROM_QSTR(MP_QSTR_IDLE), MP_ROM_INT(PYB_PWR_MODE_ACTIVE) },
+ { MP_ROM_QSTR(MP_QSTR_SLEEP), MP_ROM_INT(PYB_PWR_MODE_LPDS) },
+ { MP_ROM_QSTR(MP_QSTR_DEEPSLEEP), MP_ROM_INT(PYB_PWR_MODE_HIBERNATE) },
+ { MP_ROM_QSTR(MP_QSTR_POWER_ON), MP_ROM_INT(PYB_SLP_PWRON_RESET) }, // legacy constant
+ { MP_ROM_QSTR(MP_QSTR_PWRON_RESET), MP_ROM_INT(PYB_SLP_PWRON_RESET) },
+ { MP_ROM_QSTR(MP_QSTR_HARD_RESET), MP_ROM_INT(PYB_SLP_HARD_RESET) },
+ { MP_ROM_QSTR(MP_QSTR_WDT_RESET), MP_ROM_INT(PYB_SLP_WDT_RESET) },
+ { MP_ROM_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_ROM_INT(PYB_SLP_HIB_RESET) },
+ { MP_ROM_QSTR(MP_QSTR_SOFT_RESET), MP_ROM_INT(PYB_SLP_SOFT_RESET) },
+ { MP_ROM_QSTR(MP_QSTR_WLAN_WAKE), MP_ROM_INT(PYB_SLP_WAKED_BY_WLAN) },
+ { MP_ROM_QSTR(MP_QSTR_PIN_WAKE), MP_ROM_INT(PYB_SLP_WAKED_BY_GPIO) },
+ { MP_ROM_QSTR(MP_QSTR_RTC_WAKE), MP_ROM_INT(PYB_SLP_WAKED_BY_RTC) },
};
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
diff --git a/cc3200/mods/modnetwork.c b/cc3200/mods/modnetwork.c
index 249e1be372..221b664da1 100644
--- a/cc3200/mods/modnetwork.c
+++ b/cc3200/mods/modnetwork.c
@@ -147,12 +147,12 @@ STATIC mp_obj_t network_server_deinit(mp_obj_t self_in) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_server_deinit_obj, network_server_deinit);
#endif
-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)&mod_network_nic_type_wlan },
+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(&mod_network_nic_type_wlan) },
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
- { MP_OBJ_NEW_QSTR(MP_QSTR_Server), (mp_obj_t)&network_server_type },
+ { MP_ROM_QSTR(MP_QSTR_Server), MP_ROM_PTR(&network_server_type) },
#endif
};
@@ -164,11 +164,11 @@ const mp_obj_module_t mp_module_network = {
};
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
-STATIC const mp_map_elem_t network_server_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&network_server_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&network_server_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_timeout), (mp_obj_t)&network_server_timeout_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_isrunning), (mp_obj_t)&network_server_running_obj },
+STATIC const mp_rom_map_elem_t network_server_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&network_server_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&network_server_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&network_server_timeout_obj) },
+ { MP_ROM_QSTR(MP_QSTR_isrunning), MP_ROM_PTR(&network_server_running_obj) },
};
STATIC MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table);
diff --git a/cc3200/mods/modubinascii.c b/cc3200/mods/modubinascii.c
index 8bc2feacc1..7f51a8f3d1 100644
--- a/cc3200/mods/modubinascii.c
+++ b/cc3200/mods/modubinascii.c
@@ -46,12 +46,12 @@
/******************************************************************************/
// 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) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_hexlify), (mp_obj_t)&mod_binascii_hexlify_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_unhexlify), (mp_obj_t)&mod_binascii_unhexlify_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_a2b_base64), (mp_obj_t)&mod_binascii_a2b_base64_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_b2a_base64), (mp_obj_t)&mod_binascii_b2a_base64_obj },
+STATIC const mp_rom_map_elem_t mp_module_binascii_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ubinascii) },
+ { MP_ROM_QSTR(MP_QSTR_hexlify), MP_ROM_PTR(&mod_binascii_hexlify_obj) },
+ { MP_ROM_QSTR(MP_QSTR_unhexlify), MP_ROM_PTR(&mod_binascii_unhexlify_obj) },
+ { MP_ROM_QSTR(MP_QSTR_a2b_base64), MP_ROM_PTR(&mod_binascii_a2b_base64_obj) },
+ { MP_ROM_QSTR(MP_QSTR_b2a_base64), MP_ROM_PTR(&mod_binascii_b2a_base64_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globals_table);
diff --git a/cc3200/mods/moduhashlib.c b/cc3200/mods/moduhashlib.c
index c90c727c2a..bec88d7ca9 100644
--- a/cc3200/mods/moduhashlib.c
+++ b/cc3200/mods/moduhashlib.c
@@ -165,9 +165,9 @@ STATIC mp_obj_t hash_digest(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest);
-STATIC const mp_map_elem_t hash_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_update), (mp_obj_t) &hash_update_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_digest), (mp_obj_t) &hash_digest_obj },
+STATIC const mp_rom_map_elem_t hash_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hash_update_obj) },
+ { MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hash_digest_obj) },
};
STATIC MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
@@ -193,11 +193,11 @@ STATIC const mp_obj_type_t sha256_type = {
.locals_dict = (mp_obj_t)&hash_locals_dict,
};
-STATIC const mp_map_elem_t mp_module_hashlib_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uhashlib) },
-// { MP_OBJ_NEW_QSTR(MP_QSTR_md5), (mp_obj_t)&md5_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sha1), (mp_obj_t)&sha1_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sha256), (mp_obj_t)&sha256_type },
+STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uhashlib) },
+ //{ MP_ROM_QSTR(MP_QSTR_md5), MP_ROM_PTR(&md5_type) },
+ { MP_ROM_QSTR(MP_QSTR_sha1), MP_ROM_PTR(&sha1_type) },
+ { MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&sha256_type) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
diff --git a/cc3200/mods/moduos.c b/cc3200/mods/moduos.c
index 51dc5834d4..ba8fd86a6b 100644
--- a/cc3200/mods/moduos.c
+++ b/cc3200/mods/moduos.c
@@ -148,32 +148,32 @@ STATIC mp_obj_t os_dupterm(uint n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_dupterm_obj, 0, 1, os_dupterm);
-STATIC const mp_map_elem_t os_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uos) },
+STATIC const mp_rom_map_elem_t os_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_uname), (mp_obj_t)&os_uname_obj },
+ { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_chdir), (mp_obj_t)&mp_vfs_chdir_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_getcwd), (mp_obj_t)&mp_vfs_getcwd_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ilistdir), (mp_obj_t)&mp_vfs_ilistdir_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_listdir), (mp_obj_t)&mp_vfs_listdir_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_mkdir), (mp_obj_t)&mp_vfs_mkdir_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_rename), (mp_obj_t)&mp_vfs_rename_obj},
- { MP_OBJ_NEW_QSTR(MP_QSTR_remove), (mp_obj_t)&mp_vfs_remove_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_rmdir), (mp_obj_t)&mp_vfs_rmdir_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_stat), (mp_obj_t)&mp_vfs_stat_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_unlink), (mp_obj_t)&mp_vfs_remove_obj }, // unlink aliases to remove
+ { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) },
+ { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) },
+ { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) },
+ { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) },
+ { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) },
+ { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) },
+ { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove
- { MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&os_sync_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_urandom), (mp_obj_t)&os_urandom_obj },
+ { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&os_sync_obj) },
+ { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) },
// MicroPython additions
// removed: mkfs
// renamed: unmount -> umount
- { MP_OBJ_NEW_QSTR(MP_QSTR_mount), (mp_obj_t)&mp_vfs_mount_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_umount), (mp_obj_t)&mp_vfs_umount_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_VfsFat), (mp_obj_t)&mp_fat_vfs_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_dupterm), (mp_obj_t)&os_dupterm_obj },
+ { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
+ { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) },
+ { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) },
+ { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&os_dupterm_obj) },
};
STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 7393553607..1e3e1eafbf 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -703,28 +703,28 @@ STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 6, socket_makefile);
-STATIC const mp_map_elem_t socket_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___del__), (mp_obj_t)&socket_close_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&socket_close_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_bind), (mp_obj_t)&socket_bind_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_listen), (mp_obj_t)&socket_listen_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_accept), (mp_obj_t)&socket_accept_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&socket_connect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_send), (mp_obj_t)&socket_send_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sendall), (mp_obj_t)&socket_send_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&socket_recv_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sendto), (mp_obj_t)&socket_sendto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_recvfrom), (mp_obj_t)&socket_recvfrom_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_setsockopt), (mp_obj_t)&socket_setsockopt_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_settimeout), (mp_obj_t)&socket_settimeout_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_setblocking), (mp_obj_t)&socket_setblocking_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_makefile), (mp_obj_t)&socket_makefile_obj },
+STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&socket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&socket_close_obj) },
+ { MP_ROM_QSTR(MP_QSTR_bind), MP_ROM_PTR(&socket_bind_obj) },
+ { MP_ROM_QSTR(MP_QSTR_listen), MP_ROM_PTR(&socket_listen_obj) },
+ { MP_ROM_QSTR(MP_QSTR_accept), MP_ROM_PTR(&socket_accept_obj) },
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&socket_connect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&socket_send_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&socket_send_obj) },
+ { MP_ROM_QSTR(MP_QSTR_recv), MP_ROM_PTR(&socket_recv_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socket_sendto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_recvfrom), MP_ROM_PTR(&socket_recvfrom_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socket_setsockopt_obj) },
+ { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socket_settimeout_obj) },
+ { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
+ { MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&socket_makefile_obj) },
// stream methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read1_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 },
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read1_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) },
};
MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
@@ -799,21 +799,21 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_usocket_getaddrinfo_obj, mod_usocket_getaddrinfo);
-STATIC const mp_map_elem_t mp_module_usocket_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usocket) },
+STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_usocket) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&socket_type },
- { MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&mod_usocket_getaddrinfo_obj },
+ { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socket_type) },
+ { MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&mod_usocket_getaddrinfo_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_AF_INET), MP_OBJ_NEW_SMALL_INT(SL_AF_INET) },
+ { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(SL_AF_INET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_STREAM), MP_OBJ_NEW_SMALL_INT(SL_SOCK_STREAM) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_DGRAM), MP_OBJ_NEW_SMALL_INT(SL_SOCK_DGRAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SL_SOCK_STREAM) },
+ { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SL_SOCK_DGRAM) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_SEC), MP_OBJ_NEW_SMALL_INT(SL_SEC_SOCKET) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_TCP), MP_OBJ_NEW_SMALL_INT(SL_IPPROTO_TCP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_UDP), MP_OBJ_NEW_SMALL_INT(SL_IPPROTO_UDP) },
+ { MP_ROM_QSTR(MP_QSTR_IPPROTO_SEC), MP_ROM_INT(SL_SEC_SOCKET) },
+ { MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SL_IPPROTO_TCP) },
+ { MP_ROM_QSTR(MP_QSTR_IPPROTO_UDP), MP_ROM_INT(SL_IPPROTO_UDP) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_usocket_globals, mp_module_usocket_globals_table);
diff --git a/cc3200/mods/modussl.c b/cc3200/mods/modussl.c
index 8082675718..0c15e120d0 100644
--- a/cc3200/mods/modussl.c
+++ b/cc3200/mods/modussl.c
@@ -137,22 +137,22 @@ arg_error:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 0, mod_ssl_wrap_socket);
-STATIC const mp_map_elem_t mp_module_ussl_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ussl) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_wrap_socket), (mp_obj_t)&mod_ssl_wrap_socket_obj },
+STATIC const mp_rom_map_elem_t mp_module_ussl_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ussl) },
+ { MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&mod_ssl_wrap_socket_obj) },
// class exceptions
- { MP_OBJ_NEW_QSTR(MP_QSTR_SSLError), (mp_obj_t)&mp_type_OSError },
+ { MP_ROM_QSTR(MP_QSTR_SSLError), MP_ROM_PTR(&mp_type_OSError) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_CERT_NONE), MP_OBJ_NEW_SMALL_INT(SSL_CERT_NONE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_CERT_OPTIONAL), MP_OBJ_NEW_SMALL_INT(SSL_CERT_OPTIONAL) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_CERT_REQUIRED), MP_OBJ_NEW_SMALL_INT(SSL_CERT_REQUIRED) },
+ { MP_ROM_QSTR(MP_QSTR_CERT_NONE), MP_ROM_INT(SSL_CERT_NONE) },
+ { MP_ROM_QSTR(MP_QSTR_CERT_OPTIONAL), MP_ROM_INT(SSL_CERT_OPTIONAL) },
+ { MP_ROM_QSTR(MP_QSTR_CERT_REQUIRED), MP_ROM_INT(SSL_CERT_REQUIRED) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PROTOCOL_SSLv3), MP_OBJ_NEW_SMALL_INT(SL_SO_SEC_METHOD_SSLV3) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PROTOCOL_TLSv1), MP_OBJ_NEW_SMALL_INT(SL_SO_SEC_METHOD_TLSV1) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PROTOCOL_TLSv1_1), MP_OBJ_NEW_SMALL_INT(SL_SO_SEC_METHOD_TLSV1_1) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PROTOCOL_TLSv1_2), MP_OBJ_NEW_SMALL_INT(SL_SO_SEC_METHOD_TLSV1_2) },
+ { MP_ROM_QSTR(MP_QSTR_PROTOCOL_SSLv3), MP_ROM_INT(SL_SO_SEC_METHOD_SSLV3) },
+ { MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLSv1), MP_ROM_INT(SL_SO_SEC_METHOD_TLSV1) },
+ { MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLSv1_1), MP_ROM_INT(SL_SO_SEC_METHOD_TLSV1_1) },
+ { MP_ROM_QSTR(MP_QSTR_PROTOCOL_TLSv1_2), MP_ROM_INT(SL_SO_SEC_METHOD_TLSV1_2) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_ussl_globals, mp_module_ussl_globals_table);
diff --git a/cc3200/mods/modutime.c b/cc3200/mods/modutime.c
index 428b00f93e..cd36ef6040 100644
--- a/cc3200/mods/modutime.c
+++ b/cc3200/mods/modutime.c
@@ -131,22 +131,22 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) {
}
MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep);
-STATIC const mp_map_elem_t time_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_utime) },
+STATIC const mp_rom_map_elem_t time_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utime) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_localtime), (mp_obj_t)&time_localtime_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_mktime), (mp_obj_t)&time_mktime_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&time_time_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sleep), (mp_obj_t)&time_sleep_obj },
+ { MP_ROM_QSTR(MP_QSTR_localtime), MP_ROM_PTR(&time_localtime_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mktime), MP_ROM_PTR(&time_mktime_obj) },
+ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&time_time_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&time_sleep_obj) },
// MicroPython additions
- { MP_OBJ_NEW_QSTR(MP_QSTR_sleep_ms), (mp_obj_t)&mp_utime_sleep_ms_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sleep_us), (mp_obj_t)&mp_utime_sleep_us_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ticks_ms), (mp_obj_t)&mp_utime_ticks_ms_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ticks_us), (mp_obj_t)&mp_utime_ticks_us_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ticks_cpu), (mp_obj_t)&mp_utime_ticks_cpu_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ticks_add), (mp_obj_t)&mp_utime_ticks_add_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ticks_diff), (mp_obj_t)&mp_utime_ticks_diff_obj },
+ { MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_utime_sleep_ms_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_utime_sleep_us_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_utime_ticks_ms_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mp_utime_ticks_us_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ticks_cpu), MP_ROM_PTR(&mp_utime_ticks_cpu_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ticks_add), MP_ROM_PTR(&mp_utime_ticks_add_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_utime_ticks_diff_obj) },
};
STATIC MP_DEFINE_CONST_DICT(time_module_globals, time_module_globals_table);
diff --git a/cc3200/mods/modwipy.c b/cc3200/mods/modwipy.c
index 21a9cc63b5..c1b326fa2f 100644
--- a/cc3200/mods/modwipy.c
+++ b/cc3200/mods/modwipy.c
@@ -17,9 +17,9 @@ STATIC mp_obj_t mod_wipy_heartbeat (mp_uint_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_wipy_heartbeat_obj, 0, 1, mod_wipy_heartbeat);
-STATIC const mp_map_elem_t wipy_module_globals_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_wipy) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_heartbeat), (mp_obj_t)&mod_wipy_heartbeat_obj },
+STATIC const mp_rom_map_elem_t wipy_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_wipy) },
+ { MP_ROM_QSTR(MP_QSTR_heartbeat), MP_ROM_PTR(&mod_wipy_heartbeat_obj) },
};
STATIC MP_DEFINE_CONST_DICT(wipy_module_globals, wipy_module_globals_table);
diff --git a/cc3200/mods/modwlan.c b/cc3200/mods/modwlan.c
index 77f5bd9915..feee8db8e2 100644
--- a/cc3200/mods/modwlan.c
+++ b/cc3200/mods/modwlan.c
@@ -1254,35 +1254,35 @@ STATIC mp_obj_t wlan_print_ver(void) {
STATIC MP_DEFINE_CONST_FUN_OBJ_0(wlan_print_ver_fun_obj, wlan_print_ver);
STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(wlan_print_ver_obj, MP_ROM_PTR(&wlan_print_ver_fun_obj));
-STATIC const mp_map_elem_t wlan_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&wlan_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_scan), (mp_obj_t)&wlan_scan_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&wlan_connect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_disconnect), (mp_obj_t)&wlan_disconnect_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_isconnected), (mp_obj_t)&wlan_isconnected_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ifconfig), (mp_obj_t)&wlan_ifconfig_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_mode), (mp_obj_t)&wlan_mode_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ssid), (mp_obj_t)&wlan_ssid_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_auth), (mp_obj_t)&wlan_auth_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_channel), (mp_obj_t)&wlan_channel_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_antenna), (mp_obj_t)&wlan_antenna_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_mac), (mp_obj_t)&wlan_mac_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&wlan_irq_obj },
- // { MP_OBJ_NEW_QSTR(MP_QSTR_connections), (mp_obj_t)&wlan_connections_obj },
- // { MP_OBJ_NEW_QSTR(MP_QSTR_urn), (mp_obj_t)&wlan_urn_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_print_ver), (mp_obj_t)&wlan_print_ver_obj },
+STATIC const mp_rom_map_elem_t wlan_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&wlan_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&wlan_scan_obj) },
+ { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&wlan_connect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&wlan_disconnect_obj) },
+ { MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&wlan_isconnected_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&wlan_ifconfig_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mode), MP_ROM_PTR(&wlan_mode_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wlan_ssid_obj) },
+ { MP_ROM_QSTR(MP_QSTR_auth), MP_ROM_PTR(&wlan_auth_obj) },
+ { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&wlan_channel_obj) },
+ { MP_ROM_QSTR(MP_QSTR_antenna), MP_ROM_PTR(&wlan_antenna_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mac), MP_ROM_PTR(&wlan_mac_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&wlan_irq_obj) },
+ //{ MP_ROM_QSTR(MP_QSTR_connections), MP_ROM_PTR(&wlan_connections_obj) },
+ //{ MP_ROM_QSTR(MP_QSTR_urn), MP_ROM_PTR(&wlan_urn_obj) },
+ { MP_ROM_QSTR(MP_QSTR_print_ver), MP_ROM_PTR(&wlan_print_ver_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_STA), MP_OBJ_NEW_SMALL_INT(ROLE_STA) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_AP), MP_OBJ_NEW_SMALL_INT(ROLE_AP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WEP), MP_OBJ_NEW_SMALL_INT(SL_SEC_TYPE_WEP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WPA), MP_OBJ_NEW_SMALL_INT(SL_SEC_TYPE_WPA_WPA2) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_WPA2), MP_OBJ_NEW_SMALL_INT(SL_SEC_TYPE_WPA_WPA2) },
+ { MP_ROM_QSTR(MP_QSTR_STA), MP_ROM_INT(ROLE_STA) },
+ { MP_ROM_QSTR(MP_QSTR_AP), MP_ROM_INT(ROLE_AP) },
+ { MP_ROM_QSTR(MP_QSTR_WEP), MP_ROM_INT(SL_SEC_TYPE_WEP) },
+ { MP_ROM_QSTR(MP_QSTR_WPA), MP_ROM_INT(SL_SEC_TYPE_WPA_WPA2) },
+ { MP_ROM_QSTR(MP_QSTR_WPA2), MP_ROM_INT(SL_SEC_TYPE_WPA_WPA2) },
#if MICROPY_HW_ANTENNA_DIVERSITY
- { MP_OBJ_NEW_QSTR(MP_QSTR_INT_ANT), MP_OBJ_NEW_SMALL_INT(ANTENNA_TYPE_INTERNAL) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_EXT_ANT), MP_OBJ_NEW_SMALL_INT(ANTENNA_TYPE_EXTERNAL) },
+ { MP_ROM_QSTR(MP_QSTR_INT_ANT), MP_ROM_INT(ANTENNA_TYPE_INTERNAL) },
+ { MP_ROM_QSTR(MP_QSTR_EXT_ANT), MP_ROM_INT(ANTENNA_TYPE_EXTERNAL) },
#endif
- { MP_OBJ_NEW_QSTR(MP_QSTR_ANY_EVENT), MP_OBJ_NEW_SMALL_INT(MODWLAN_WIFI_EVENT_ANY) },
+ { MP_ROM_QSTR(MP_QSTR_ANY_EVENT), MP_ROM_INT(MODWLAN_WIFI_EVENT_ANY) },
};
STATIC MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table);
diff --git a/cc3200/mods/pybadc.c b/cc3200/mods/pybadc.c
index 0b4f0ba68c..1fca2da33a 100644
--- a/cc3200/mods/pybadc.c
+++ b/cc3200/mods/pybadc.c
@@ -228,10 +228,10 @@ STATIC mp_obj_t adc_channel(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adc_channel_obj, 1, adc_channel);
-STATIC const mp_map_elem_t adc_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&adc_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&adc_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_channel), (mp_obj_t)&adc_channel_obj },
+STATIC const mp_rom_map_elem_t adc_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&adc_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&adc_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&adc_channel_obj) },
};
STATIC MP_DEFINE_CONST_DICT(adc_locals_dict, adc_locals_dict_table);
@@ -295,10 +295,10 @@ STATIC mp_obj_t adc_channel_call(mp_obj_t self_in, size_t n_args, size_t n_kw, c
return adc_channel_value (self_in);
}
-STATIC const mp_map_elem_t adc_channel_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&adc_channel_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&adc_channel_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_value), (mp_obj_t)&adc_channel_value_obj },
+STATIC const mp_rom_map_elem_t adc_channel_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&adc_channel_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&adc_channel_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&adc_channel_value_obj) },
};
STATIC MP_DEFINE_CONST_DICT(adc_channel_locals_dict, adc_channel_locals_dict_table);
diff --git a/cc3200/mods/pybflash.c b/cc3200/mods/pybflash.c
index f5af79dbf6..51f4cb5172 100644
--- a/cc3200/mods/pybflash.c
+++ b/cc3200/mods/pybflash.c
@@ -79,10 +79,10 @@ STATIC mp_obj_t pyb_flash_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_flash_ioctl_obj, pyb_flash_ioctl);
-STATIC const mp_map_elem_t pyb_flash_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_readblocks), (mp_obj_t)&pyb_flash_readblocks_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_writeblocks), (mp_obj_t)&pyb_flash_writeblocks_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ioctl), (mp_obj_t)&pyb_flash_ioctl_obj },
+STATIC const mp_rom_map_elem_t pyb_flash_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&pyb_flash_readblocks_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&pyb_flash_writeblocks_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_flash_ioctl_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_flash_locals_dict, pyb_flash_locals_dict_table);
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index 9c62ffdc4c..370806121f 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -508,17 +508,17 @@ STATIC mp_obj_t pyb_i2c_writeto_mem(mp_uint_t n_args, const mp_obj_t *pos_args,
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_writeto_mem_obj, 1, pyb_i2c_writeto_mem);
-STATIC const mp_map_elem_t pyb_i2c_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_i2c_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_i2c_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_i2c_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_scan), (mp_obj_t)&pyb_i2c_scan_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readfrom), (mp_obj_t)&pyb_i2c_readfrom_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readfrom_into), (mp_obj_t)&pyb_i2c_readfrom_into_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_writeto), (mp_obj_t)&pyb_i2c_writeto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readfrom_mem), (mp_obj_t)&pyb_i2c_readfrom_mem_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readfrom_mem_into), (mp_obj_t)&pyb_i2c_readfrom_mem_into_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_writeto_mem), (mp_obj_t)&pyb_i2c_writeto_mem_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_i2c_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_i2c_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&pyb_i2c_scan_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readfrom), MP_ROM_PTR(&pyb_i2c_readfrom_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readfrom_into), MP_ROM_PTR(&pyb_i2c_readfrom_into_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writeto), MP_ROM_PTR(&pyb_i2c_writeto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readfrom_mem), MP_ROM_PTR(&pyb_i2c_readfrom_mem_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readfrom_mem_into), MP_ROM_PTR(&pyb_i2c_readfrom_mem_into_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writeto_mem), MP_ROM_PTR(&pyb_i2c_writeto_mem_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_i2c_locals_dict, pyb_i2c_locals_dict_table);
diff --git a/cc3200/mods/pybpin.c b/cc3200/mods/pybpin.c
index d59f113eb5..43a0306362 100644
--- a/cc3200/mods/pybpin.c
+++ b/cc3200/mods/pybpin.c
@@ -902,35 +902,35 @@ invalid_args:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pin_irq_obj, 1, pin_irq);
-STATIC const mp_map_elem_t pin_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pin_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pin_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_value), (mp_obj_t)&pin_value_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_id), (mp_obj_t)&pin_id_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_mode), (mp_obj_t)&pin_mode_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_pull), (mp_obj_t)&pin_pull_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_drive), (mp_obj_t)&pin_drive_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_alt_list), (mp_obj_t)&pin_alt_list_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pin_irq_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pin_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pin_value_obj) },
+ { MP_ROM_QSTR(MP_QSTR_id), MP_ROM_PTR(&pin_id_obj) },
+ { MP_ROM_QSTR(MP_QSTR_mode), MP_ROM_PTR(&pin_mode_obj) },
+ { MP_ROM_QSTR(MP_QSTR_pull), MP_ROM_PTR(&pin_pull_obj) },
+ { MP_ROM_QSTR(MP_QSTR_drive), MP_ROM_PTR(&pin_drive_obj) },
+ { MP_ROM_QSTR(MP_QSTR_alt_list), MP_ROM_PTR(&pin_alt_list_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pin_irq_obj) },
// class attributes
- { MP_OBJ_NEW_QSTR(MP_QSTR_board), (mp_obj_t)&pin_board_pins_obj_type },
+ { MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&pin_board_pins_obj_type) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_IN), MP_OBJ_NEW_SMALL_INT(GPIO_DIR_MODE_IN) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_OUT), MP_OBJ_NEW_SMALL_INT(GPIO_DIR_MODE_OUT) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_OPEN_DRAIN), MP_OBJ_NEW_SMALL_INT(PIN_TYPE_OD) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ALT), MP_OBJ_NEW_SMALL_INT(GPIO_DIR_MODE_ALT) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ALT_OPEN_DRAIN), MP_OBJ_NEW_SMALL_INT(GPIO_DIR_MODE_ALT_OD) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_UP), MP_OBJ_NEW_SMALL_INT(PIN_TYPE_STD_PU) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_DOWN), MP_OBJ_NEW_SMALL_INT(PIN_TYPE_STD_PD) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_LOW_POWER), MP_OBJ_NEW_SMALL_INT(PIN_STRENGTH_2MA) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_MED_POWER), MP_OBJ_NEW_SMALL_INT(PIN_STRENGTH_4MA) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_HIGH_POWER), MP_OBJ_NEW_SMALL_INT(PIN_STRENGTH_6MA) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_FALLING), MP_OBJ_NEW_SMALL_INT(PYB_PIN_FALLING_EDGE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_RISING), MP_OBJ_NEW_SMALL_INT(PYB_PIN_RISING_EDGE) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_LOW_LEVEL), MP_OBJ_NEW_SMALL_INT(PYB_PIN_LOW_LEVEL) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_IRQ_HIGH_LEVEL), MP_OBJ_NEW_SMALL_INT(PYB_PIN_HIGH_LEVEL) },
+ { MP_ROM_QSTR(MP_QSTR_IN), MP_ROM_INT(GPIO_DIR_MODE_IN) },
+ { MP_ROM_QSTR(MP_QSTR_OUT), MP_ROM_INT(GPIO_DIR_MODE_OUT) },
+ { MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_INT(PIN_TYPE_OD) },
+ { MP_ROM_QSTR(MP_QSTR_ALT), MP_ROM_INT(GPIO_DIR_MODE_ALT) },
+ { MP_ROM_QSTR(MP_QSTR_ALT_OPEN_DRAIN), MP_ROM_INT(GPIO_DIR_MODE_ALT_OD) },
+ { MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(PIN_TYPE_STD_PU) },
+ { MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(PIN_TYPE_STD_PD) },
+ { MP_ROM_QSTR(MP_QSTR_LOW_POWER), MP_ROM_INT(PIN_STRENGTH_2MA) },
+ { MP_ROM_QSTR(MP_QSTR_MED_POWER), MP_ROM_INT(PIN_STRENGTH_4MA) },
+ { MP_ROM_QSTR(MP_QSTR_HIGH_POWER), MP_ROM_INT(PIN_STRENGTH_6MA) },
+ { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(PYB_PIN_FALLING_EDGE) },
+ { MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(PYB_PIN_RISING_EDGE) },
+ { MP_ROM_QSTR(MP_QSTR_IRQ_LOW_LEVEL), MP_ROM_INT(PYB_PIN_LOW_LEVEL) },
+ { MP_ROM_QSTR(MP_QSTR_IRQ_HIGH_LEVEL), MP_ROM_INT(PYB_PIN_HIGH_LEVEL) },
};
STATIC MP_DEFINE_CONST_DICT(pin_locals_dict, pin_locals_dict_table);
diff --git a/cc3200/mods/pybrtc.c b/cc3200/mods/pybrtc.c
index 14c4cd4199..8a29c930e2 100644
--- a/cc3200/mods/pybrtc.c
+++ b/cc3200/mods/pybrtc.c
@@ -456,17 +456,17 @@ invalid_args:
}
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_init), (mp_obj_t)&pyb_rtc_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_rtc_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_now), (mp_obj_t)&pyb_rtc_now_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_alarm_cancel), (mp_obj_t)&pyb_rtc_alarm_cancel_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pyb_rtc_irq_obj },
+STATIC const mp_rom_map_elem_t pyb_rtc_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_rtc_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_rtc_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_now), MP_ROM_PTR(&pyb_rtc_now_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_alarm_cancel), MP_ROM_PTR(&pyb_rtc_alarm_cancel_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_rtc_irq_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_ALARM0), MP_OBJ_NEW_SMALL_INT(PYB_RTC_ALARM0) },
+ { MP_ROM_QSTR(MP_QSTR_ALARM0), MP_ROM_INT(PYB_RTC_ALARM0) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_rtc_locals_dict, pyb_rtc_locals_dict_table);
diff --git a/cc3200/mods/pybsd.c b/cc3200/mods/pybsd.c
index 5ba6119b29..34294f88e2 100644
--- a/cc3200/mods/pybsd.c
+++ b/cc3200/mods/pybsd.c
@@ -202,13 +202,13 @@ STATIC mp_obj_t pyb_sd_ioctl(mp_obj_t self, mp_obj_t cmd_in, mp_obj_t arg_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_sd_ioctl_obj, pyb_sd_ioctl);
-STATIC const mp_map_elem_t pyb_sd_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_sd_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_sd_deinit_obj },
+STATIC const mp_rom_map_elem_t pyb_sd_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_sd_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_sd_deinit_obj) },
// block device protocol
- { MP_OBJ_NEW_QSTR(MP_QSTR_readblocks), (mp_obj_t)&pyb_sd_readblocks_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_writeblocks), (mp_obj_t)&pyb_sd_writeblocks_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ioctl), (mp_obj_t)&pyb_sd_ioctl_obj },
+ { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&pyb_sd_readblocks_obj) },
+ { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&pyb_sd_writeblocks_obj) },
+ { MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&pyb_sd_ioctl_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_sd_locals_dict, pyb_sd_locals_dict_table);
diff --git a/cc3200/mods/pybspi.c b/cc3200/mods/pybspi.c
index 9edad579a3..acd1e25366 100644
--- a/cc3200/mods/pybspi.c
+++ b/cc3200/mods/pybspi.c
@@ -364,17 +364,17 @@ STATIC mp_obj_t pyb_spi_write_readinto (mp_obj_t self, mp_obj_t writebuf, mp_obj
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(pyb_spi_write_readinto_obj, pyb_spi_write_readinto);
-STATIC const mp_map_elem_t pyb_spi_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_spi_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_spi_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_spi_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&pyb_spi_write_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&pyb_spi_read_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&pyb_spi_readinto_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_write_readinto), (mp_obj_t)&pyb_spi_write_readinto_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_spi_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_spi_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&pyb_spi_write_obj) },
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&pyb_spi_read_obj) },
+ { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&pyb_spi_readinto_obj) },
+ { MP_ROM_QSTR(MP_QSTR_write_readinto), MP_ROM_PTR(&pyb_spi_write_readinto_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_MSB), MP_OBJ_NEW_SMALL_INT(PYBSPI_FIRST_BIT_MSB) },
+ { MP_ROM_QSTR(MP_QSTR_MSB), MP_ROM_INT(PYBSPI_FIRST_BIT_MSB) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_spi_locals_dict, pyb_spi_locals_dict_table);
diff --git a/cc3200/mods/pybtimer.c b/cc3200/mods/pybtimer.c
index 1ef9a4a440..d6ed1b14b1 100644
--- a/cc3200/mods/pybtimer.c
+++ b/cc3200/mods/pybtimer.c
@@ -445,22 +445,22 @@ error:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_obj, 2, pyb_timer_channel);
-STATIC const mp_map_elem_t pyb_timer_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_timer_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_timer_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_channel), (mp_obj_t)&pyb_timer_channel_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_timer_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_timer_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&pyb_timer_channel_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_A), MP_OBJ_NEW_SMALL_INT(TIMER_A) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_B), MP_OBJ_NEW_SMALL_INT(TIMER_B) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_ONE_SHOT), MP_OBJ_NEW_SMALL_INT(TIMER_CFG_A_ONE_SHOT_UP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PERIODIC), MP_OBJ_NEW_SMALL_INT(TIMER_CFG_A_PERIODIC_UP) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_PWM), MP_OBJ_NEW_SMALL_INT(TIMER_CFG_A_PWM) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_POSITIVE), MP_OBJ_NEW_SMALL_INT(PYBTIMER_POLARITY_POS) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_NEGATIVE), MP_OBJ_NEW_SMALL_INT(PYBTIMER_POLARITY_NEG) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_TIMEOUT), MP_OBJ_NEW_SMALL_INT(PYBTIMER_TIMEOUT_TRIGGER) },
- { MP_OBJ_NEW_QSTR(MP_QSTR_MATCH), MP_OBJ_NEW_SMALL_INT(PYBTIMER_MATCH_TRIGGER) },
+ { MP_ROM_QSTR(MP_QSTR_A), MP_ROM_INT(TIMER_A) },
+ { MP_ROM_QSTR(MP_QSTR_B), MP_ROM_INT(TIMER_B) },
+ { MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(TIMER_CFG_A_ONE_SHOT_UP) },
+ { MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(TIMER_CFG_A_PERIODIC_UP) },
+ { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_INT(TIMER_CFG_A_PWM) },
+ { MP_ROM_QSTR(MP_QSTR_POSITIVE), MP_ROM_INT(PYBTIMER_POLARITY_POS) },
+ { MP_ROM_QSTR(MP_QSTR_NEGATIVE), MP_ROM_INT(PYBTIMER_POLARITY_NEG) },
+ { MP_ROM_QSTR(MP_QSTR_TIMEOUT), MP_ROM_INT(PYBTIMER_TIMEOUT_TRIGGER) },
+ { MP_ROM_QSTR(MP_QSTR_MATCH), MP_ROM_INT(PYBTIMER_MATCH_TRIGGER) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
@@ -717,12 +717,12 @@ invalid_args:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_timer_channel_irq_obj, 1, pyb_timer_channel_irq);
-STATIC const mp_map_elem_t pyb_timer_channel_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&pyb_timer_channel_freq_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_period), (mp_obj_t)&pyb_timer_channel_period_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_duty_cycle), (mp_obj_t)&pyb_timer_channel_duty_cycle_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pyb_timer_channel_irq_obj },
+ { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&pyb_timer_channel_freq_obj) },
+ { MP_ROM_QSTR(MP_QSTR_period), MP_ROM_PTR(&pyb_timer_channel_period_obj) },
+ { MP_ROM_QSTR(MP_QSTR_duty_cycle), MP_ROM_PTR(&pyb_timer_channel_duty_cycle_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_timer_channel_irq_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index 626357179b..77ebbbf182 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -561,25 +561,25 @@ invalid_args:
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_uart_irq_obj, 1, pyb_uart_irq);
-STATIC const mp_map_elem_t pyb_uart_locals_dict_table[] = {
+STATIC const mp_rom_map_elem_t pyb_uart_locals_dict_table[] = {
// instance methods
- { MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&pyb_uart_init_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&pyb_uart_deinit_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_any), (mp_obj_t)&pyb_uart_any_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_sendbreak), (mp_obj_t)&pyb_uart_sendbreak_obj },
- { MP_OBJ_NEW_QSTR(MP_QSTR_irq), (mp_obj_t)&pyb_uart_irq_obj },
+ { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_uart_init_obj) },
+ { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_uart_deinit_obj) },
+ { MP_ROM_QSTR(MP_QSTR_any), MP_ROM_PTR(&pyb_uart_any_obj) },
+ { MP_ROM_QSTR(MP_QSTR_sendbreak), MP_ROM_PTR(&pyb_uart_sendbreak_obj) },
+ { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&pyb_uart_irq_obj) },
/// \method read([nbytes])
- { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj },
+ { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
/// \method readline()
- { MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
+ { MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
/// \method readinto(buf[, nbytes])
- { MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj },
+ { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
/// \method write(buf)
- { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
+ { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
// class constants
- { MP_OBJ_NEW_QSTR(MP_QSTR_RX_ANY), MP_OBJ_NEW_SMALL_INT(UART_TRIGGER_RX_ANY) },
+ { MP_ROM_QSTR(MP_QSTR_RX_ANY), MP_ROM_INT(UART_TRIGGER_RX_ANY) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_uart_locals_dict, pyb_uart_locals_dict_table);
diff --git a/cc3200/mods/pybwdt.c b/cc3200/mods/pybwdt.c
index 114e7ac96a..4a9fafc4a9 100644
--- a/cc3200/mods/pybwdt.c
+++ b/cc3200/mods/pybwdt.c
@@ -146,8 +146,8 @@ STATIC mp_obj_t pyb_wdt_feed(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_wdt_feed_obj, pyb_wdt_feed);
-STATIC const mp_map_elem_t pybwdt_locals_dict_table[] = {
- { MP_OBJ_NEW_QSTR(MP_QSTR_feed), (mp_obj_t)&pyb_wdt_feed_obj },
+STATIC const mp_rom_map_elem_t pybwdt_locals_dict_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_feed), MP_ROM_PTR(&pyb_wdt_feed_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pybwdt_locals_dict, pybwdt_locals_dict_table);
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index dcde9aae09..a5b007daf6 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -140,7 +140,7 @@
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, \
+ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \
// extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t machine_module;
@@ -156,32 +156,32 @@ extern const struct _mp_obj_module_t mp_module_ubinascii;
extern const struct _mp_obj_module_t mp_module_ussl;
#define MICROPY_PORT_BUILTIN_MODULES \
- { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_wipy), (mp_obj_t)&wipy_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_uos }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&mp_module_utime }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_uselect), (mp_obj_t)&mp_module_uselect }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_ubinascii), (mp_obj_t)&mp_module_ubinascii }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_ussl), (mp_obj_t)&mp_module_ussl }, \
+ { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_wipy), MP_ROM_PTR(&wipy_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \
+ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \
+ { MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) }, \
+ { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) }, \
+ { MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&mp_module_network) }, \
+ { MP_ROM_QSTR(MP_QSTR_ubinascii), MP_ROM_PTR(&mp_module_ubinascii) }, \
+ { MP_ROM_QSTR(MP_QSTR_ussl), MP_ROM_PTR(&mp_module_ussl) }, \
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_errno), (mp_obj_t)&mp_module_uerrno }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_struct), (mp_obj_t)&mp_module_ustruct }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&mp_module_uos }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_utime }, \
- { 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_usocket }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_binascii), (mp_obj_t)&mp_module_ubinascii }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_ssl), (mp_obj_t)&mp_module_ussl }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&machine_module }, \
+ { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, \
+ { MP_ROM_QSTR(MP_QSTR_struct), MP_ROM_PTR(&mp_module_ustruct) }, \
+ { MP_ROM_QSTR(MP_QSTR_re), MP_ROM_PTR(&mp_module_ure) }, \
+ { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, \
+ { MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&mp_module_uos) }, \
+ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_utime) }, \
+ { MP_ROM_QSTR(MP_QSTR_select), MP_ROM_PTR(&mp_module_uselect) }, \
+ { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_usocket) }, \
+ { MP_ROM_QSTR(MP_QSTR_binascii), MP_ROM_PTR(&mp_module_ubinascii) }, \
+ { MP_ROM_QSTR(MP_QSTR_ssl), MP_ROM_PTR(&mp_module_ussl) }, \
+ { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \
// extra constants
#define MICROPY_PORT_CONSTANTS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_umachine), (mp_obj_t)&machine_module }, \
+ { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \
// vm state and root pointers for the gc
#define MP_STATE_PORT MP_STATE_VM
diff --git a/esp8266/mpconfigport.h b/esp8266/mpconfigport.h
index bbded43f4b..c45ed92c73 100644
--- a/esp8266/mpconfigport.h
+++ b/esp8266/mpconfigport.h
@@ -149,7 +149,7 @@ void *esp_native_code_commit(void*, size_t);
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
+ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
// extra built in modules to add to the list of known ones
extern const struct _mp_obj_module_t esp_module;
@@ -161,21 +161,21 @@ extern const struct _mp_obj_module_t mp_module_machine;
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_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 }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \
+ { MP_ROM_QSTR(MP_QSTR_esp), MP_ROM_PTR(&esp_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_lwip) }, \
+ { MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&network_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&utime_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&uos_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \
+ { MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \
#define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&utime_module }, \
- { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&uos_module }, \
- { 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 }, \
+ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&utime_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&uos_module) }, \
+ { MP_ROM_QSTR(MP_QSTR_json), MP_ROM_PTR(&mp_module_ujson) }, \
+ { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_module_uerrno) }, \
+ { MP_ROM_QSTR(MP_QSTR_select), MP_ROM_PTR(&mp_module_uselect) }, \
+ { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&mp_module_lwip) }, \
#define MP_STATE_PORT MP_STATE_VM
diff --git a/examples/embedding/mpconfigport_minimal.h b/examples/embedding/mpconfigport_minimal.h
index 5b96aa4b01..fa52be4ad7 100644
--- a/examples/embedding/mpconfigport_minimal.h
+++ b/examples/embedding/mpconfigport_minimal.h
@@ -89,7 +89,7 @@
extern const struct _mp_obj_module_t mp_module_os;
#define MICROPY_PORT_BUILTIN_MODULES \
- { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&mp_module_os }, \
+ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \
#define MICROPY_PORT_ROOT_POINTERS \
diff --git a/minimal/mpconfigport.h b/minimal/mpconfigport.h
index ce4f8f2404..8744ca9508 100644
--- a/minimal/mpconfigport.h
+++ b/minimal/mpconfigport.h
@@ -74,7 +74,7 @@ typedef long mp_off_t;
// extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \
- { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
+ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) },
// We need to provide a declaration/definition of alloca()
#include |