diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-10-24 22:31:16 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-10-24 22:31:16 -0700 |
| commit | 73c15dcf8b1b927757a595a867334b38355ddb8f (patch) | |
| tree | b1727518e47219b995611aa7e5c9da66e3df5075 /extmod | |
| parent | d43564f854a6a1202dfff550986b9343952d5d32 (diff) | |
| parent | f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c (diff) | |
Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge
This is prep for merging in the NRF5 pull request.
Diffstat (limited to 'extmod')
| -rw-r--r-- | extmod/machine_i2c.c | 2 | ||||
| -rw-r--r-- | extmod/machine_mem.c | 2 | ||||
| -rw-r--r-- | extmod/machine_pinbase.c | 7 | ||||
| -rw-r--r-- | extmod/modbtree.c | 4 | ||||
| -rw-r--r-- | extmod/modframebuf.c | 4 | ||||
| -rw-r--r-- | extmod/modlwip.c | 5 | ||||
| -rw-r--r-- | extmod/modubinascii.c | 5 | ||||
| -rw-r--r-- | extmod/moductypes.c | 1 | ||||
| -rw-r--r-- | extmod/moduhashlib.c | 1 | ||||
| -rw-r--r-- | extmod/moduheapq.c | 2 | ||||
| -rw-r--r-- | extmod/modujson.c | 1 | ||||
| -rw-r--r-- | extmod/modurandom.c | 1 | ||||
| -rw-r--r-- | extmod/modure.c | 4 | ||||
| -rw-r--r-- | extmod/modussl_axtls.c | 1 | ||||
| -rw-r--r-- | extmod/modussl_mbedtls.c | 8 | ||||
| -rw-r--r-- | extmod/modutimeq.c | 4 | ||||
| -rw-r--r-- | extmod/moduzlib.c | 1 | ||||
| -rw-r--r-- | extmod/modwebrepl.c | 2 | ||||
| -rw-r--r-- | extmod/modwebsocket.c | 2 | ||||
| -rw-r--r-- | extmod/re1.5/compilecode.c | 2 | ||||
| -rw-r--r-- | extmod/re1.5/re1.5.h | 3 | ||||
| -rw-r--r-- | extmod/re1.5/recursiveloop.c | 4 | ||||
| -rw-r--r-- | extmod/uos_dupterm.c | 3 | ||||
| -rw-r--r-- | extmod/vfs.c | 1 | ||||
| -rw-r--r-- | extmod/vfs_fat.c | 1 | ||||
| -rw-r--r-- | extmod/vfs_fat_file.c | 1 | ||||
| -rw-r--r-- | extmod/vfs_fat_misc.c | 1 |
27 files changed, 28 insertions, 45 deletions
diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c index c0a51a6e7..5d441b1ba 100644 --- a/extmod/machine_i2c.c +++ b/extmod/machine_i2c.c @@ -269,7 +269,7 @@ int mp_machine_soft_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t /******************************************************************************/ // MicroPython bindings for I2C -STATIC void machine_i2c_obj_init_helper(machine_i2c_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC void machine_i2c_obj_init_helper(machine_i2c_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_scl, ARG_sda, ARG_freq, ARG_timeout }; static const mp_arg_t allowed_args[] = { { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c index af987cb7f..b9f16507c 100644 --- a/extmod/machine_mem.c +++ b/extmod/machine_mem.c @@ -24,8 +24,8 @@ * THE SOFTWARE. */ +#include "py/runtime.h" #include "extmod/machine_mem.h" -#include "py/nlr.h" #if MICROPY_PY_MACHINE diff --git a/extmod/machine_pinbase.c b/extmod/machine_pinbase.c index 3c1f09483..070c5cde9 100644 --- a/extmod/machine_pinbase.c +++ b/extmod/machine_pinbase.c @@ -30,6 +30,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "extmod/virtpin.h" +#include "extmod/machine_pinbase.h" // PinBase class @@ -40,10 +41,8 @@ typedef struct _mp_pinbase_t { mp_obj_base_t base; } mp_pinbase_t; -STATIC const mp_obj_type_t pinbase_type; - -STATIC mp_pinbase_t pinbase_singleton = { - .base = { &pinbase_type }, +STATIC const mp_pinbase_t pinbase_singleton = { + .base = { &machine_pinbase_type }, }; STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { diff --git a/extmod/modbtree.c b/extmod/modbtree.c index 229daaf0f..5c1311532 100644 --- a/extmod/modbtree.c +++ b/extmod/modbtree.c @@ -29,9 +29,7 @@ #include <errno.h> // for declaration of global errno variable #include <fcntl.h> -#include "py/nlr.h" #include "py/runtime.h" -#include "py/runtime0.h" #include "py/stream.h" #if MICROPY_PY_BTREE @@ -281,7 +279,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { } } -STATIC mp_obj_t btree_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { +STATIC mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { mp_obj_btree_t *self = MP_OBJ_TO_PTR(lhs_in); switch (op) { case MP_BINARY_OP_IN: { diff --git a/extmod/modframebuf.c b/extmod/modframebuf.c index f4e857129..20e40d579 100644 --- a/extmod/modframebuf.c +++ b/extmod/modframebuf.c @@ -27,13 +27,11 @@ #include <stdio.h> #include <string.h> -#include "py/nlr.h" -#include "py/obj.h" #include "py/runtime.h" #if MICROPY_PY_FRAMEBUF -#include "stmhal/font_petme128_8x8.h" +#include "ports/stm32/font_petme128_8x8.h" typedef struct _mp_obj_framebuf_t { mp_obj_base_t base; diff --git a/extmod/modlwip.c b/extmod/modlwip.c index cc10523e5..f7e776af9 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -29,7 +29,6 @@ #include <string.h> #include <stdio.h> -#include "py/nlr.h" #include "py/objlist.h" #include "py/runtime.h" #include "py/stream.h" @@ -1070,7 +1069,7 @@ STATIC mp_obj_t lwip_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_setblocking_obj, lwip_socket_setblocking); -STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) { (void)n_args; // always 4 lwip_socket_obj_t *socket = args[0]; @@ -1120,7 +1119,7 @@ STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_setsockopt_obj, 4, 4, lwip_socket_setsockopt); -STATIC mp_obj_t lwip_socket_makefile(mp_uint_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t lwip_socket_makefile(size_t n_args, const mp_obj_t *args) { (void)n_args; return args[0]; } diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 25fc8852a..8256a50cf 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -28,13 +28,10 @@ #include <assert.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/binary.h" #include "extmod/modubinascii.h" -#include "uzlib/tinf.h" - mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) { // Second argument is for an extension to allow a separator to be used // between values. @@ -221,6 +218,8 @@ mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) { MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj, mod_binascii_b2a_base64); #if MICROPY_PY_UBINASCII_CRC32 +#include "uzlib/tinf.h" + mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_READ); diff --git a/extmod/moductypes.c b/extmod/moductypes.c index ffa974f63..b0f28331e 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -28,7 +28,6 @@ #include <string.h> #include <stdint.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/objtuple.h" #include "py/binary.h" diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index f3beb3939..3fad69247 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -27,7 +27,6 @@ #include <assert.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #if MICROPY_PY_UHASHLIB diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index 4a620bad8..71c15368b 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -24,9 +24,7 @@ * THE SOFTWARE. */ -#include "py/nlr.h" #include "py/objlist.h" -#include "py/runtime0.h" #include "py/runtime.h" #if MICROPY_PY_UHEAPQ diff --git a/extmod/modujson.c b/extmod/modujson.c index 6c4aa1611..f14682d26 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -26,7 +26,6 @@ #include <stdio.h> -#include "py/nlr.h" #include "py/objlist.h" #include "py/objstringio.h" #include "py/parsenum.h" diff --git a/extmod/modurandom.c b/extmod/modurandom.c index 4b63dace4..1512a3fd4 100644 --- a/extmod/modurandom.c +++ b/extmod/modurandom.c @@ -27,7 +27,6 @@ #include <assert.h> #include <string.h> -//#include "py/nlr.h" #include "py/runtime.h" #if MICROPY_PY_URANDOM diff --git a/extmod/modure.c b/extmod/modure.c index 2baebdecc..78de4706d 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -28,13 +28,15 @@ #include <assert.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/binary.h" #include "py/objstr.h" +#include "py/stackctrl.h" #if MICROPY_PY_URE +#define re1_5_stack_chk() MP_STACK_CHECK() + #include "re1.5/re1.5.h" #define FLAG_DEBUG 0x1000 diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c index b5d2412d2..88a89a23d 100644 --- a/extmod/modussl_axtls.c +++ b/extmod/modussl_axtls.c @@ -27,7 +27,6 @@ #include <stdio.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" diff --git a/extmod/modussl_mbedtls.c b/extmod/modussl_mbedtls.c index 12ec60a75..d7316cb4a 100644 --- a/extmod/modussl_mbedtls.c +++ b/extmod/modussl_mbedtls.c @@ -31,10 +31,8 @@ #include <string.h> #include <errno.h> // needed because mp_is_nonblocking_error uses system error codes -#include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" -#include "py/obj.h" // mbedtls_time_t #include "mbedtls/platform.h" @@ -67,7 +65,7 @@ struct ssl_args { STATIC const mp_obj_type_t ussl_socket_type; -static void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { +void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { printf("DBG:%s:%04d: %s\n", file, line, str); } @@ -123,8 +121,10 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) { mbedtls_x509_crt_init(&o->cert); mbedtls_pk_init(&o->pkey); mbedtls_ctr_drbg_init(&o->ctr_drbg); + #ifdef MBEDTLS_DEBUG_C // Debug level (0-4) mbedtls_debug_set_threshold(0); + #endif mbedtls_entropy_init(&o->entropy); const byte seed[] = "upy"; @@ -144,7 +144,9 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) { mbedtls_ssl_conf_authmode(&o->conf, MBEDTLS_SSL_VERIFY_NONE); mbedtls_ssl_conf_rng(&o->conf, mbedtls_ctr_drbg_random, &o->ctr_drbg); + #ifdef MBEDTLS_DEBUG_C mbedtls_ssl_conf_dbg(&o->conf, mbedtls_debug, NULL); + #endif ret = mbedtls_ssl_setup(&o->ssl, &o->conf); if (ret != 0) { diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c index e54415b28..0a836c7cc 100644 --- a/extmod/modutimeq.c +++ b/extmod/modutimeq.c @@ -27,9 +27,7 @@ #include <string.h> -#include "py/nlr.h" #include "py/objlist.h" -#include "py/runtime0.h" #include "py/runtime.h" #include "py/smallint.h" @@ -189,7 +187,7 @@ STATIC mp_obj_t mod_utimeq_dump(mp_obj_t heap_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_utimeq_dump_obj, mod_utimeq_dump); #endif -STATIC mp_obj_t utimeq_unary_op(mp_uint_t op, mp_obj_t self_in) { +STATIC mp_obj_t utimeq_unary_op(mp_unary_op_t op, mp_obj_t self_in) { mp_obj_utimeq_t *self = MP_OBJ_TO_PTR(self_in); switch (op) { case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->len != 0); diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index b446dba73..e9af07370 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -27,7 +27,6 @@ #include <stdio.h> #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" #include "py/mperrno.h" diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c index b0d146c23..c5087ac29 100644 --- a/extmod/modwebrepl.c +++ b/extmod/modwebrepl.c @@ -28,8 +28,6 @@ #include <stdint.h> #include <string.h> -#include "py/nlr.h" -#include "py/obj.h" #include "py/runtime.h" #include "py/stream.h" #include "py/builtin.h" diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 6c6e32c1a..a651164b2 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -28,8 +28,6 @@ #include <stdint.h> #include <string.h> -#include "py/nlr.h" -#include "py/obj.h" #include "py/runtime.h" #include "py/stream.h" #include "extmod/modwebsocket.h" diff --git a/extmod/re1.5/compilecode.c b/extmod/re1.5/compilecode.c index e4635f034..3267a4190 100644 --- a/extmod/re1.5/compilecode.c +++ b/extmod/re1.5/compilecode.c @@ -55,7 +55,7 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode) for (cnt = 0; *re != ']'; re++, cnt++) { if (!*re) return NULL; EMIT(PC++, *re); - if (re[1] == '-') { + if (re[1] == '-' && re[2] != ']') { re += 2; } EMIT(PC++, *re); diff --git a/extmod/re1.5/re1.5.h b/extmod/re1.5/re1.5.h index 815c5d33d..ba6f97b74 100644 --- a/extmod/re1.5/re1.5.h +++ b/extmod/re1.5/re1.5.h @@ -48,6 +48,9 @@ void printre(Regexp*); #ifndef re1_5_fatal void re1_5_fatal(char*); #endif +#ifndef re1_5_stack_chk +#define re1_5_stack_chk() +#endif void *mal(int); struct Prog diff --git a/extmod/re1.5/recursiveloop.c b/extmod/re1.5/recursiveloop.c index e8fef0304..bb337decf 100644 --- a/extmod/re1.5/recursiveloop.c +++ b/extmod/re1.5/recursiveloop.c @@ -9,7 +9,9 @@ recursiveloop(char *pc, const char *sp, Subject *input, const char **subp, int n { const char *old; int off; - + + re1_5_stack_chk(); + for(;;) { if(inst_is_consumer(*pc)) { // If we need to match a character, but there's none left, it's fail diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c index 16d1d5451..54fb23a79 100644 --- a/extmod/uos_dupterm.c +++ b/extmod/uos_dupterm.c @@ -27,7 +27,6 @@ #include <string.h> #include "py/mpconfig.h" -#include "py/nlr.h" #include "py/runtime.h" #include "py/objtuple.h" #include "py/objarray.h" @@ -68,7 +67,7 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) { } } -STATIC mp_obj_t mp_uos_dupterm(mp_uint_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t mp_uos_dupterm(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { if (MP_STATE_PORT(term_obj) == MP_OBJ_NULL) { return mp_const_none; diff --git a/extmod/vfs.c b/extmod/vfs.c index 3aa1d7744..586bb4b01 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -27,7 +27,6 @@ #include <stdint.h> #include <string.h> -#include "py/runtime0.h" #include "py/runtime.h" #include "py/objstr.h" #include "py/mperrno.h" diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index b27054111..22346bdf1 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -33,7 +33,6 @@ #endif #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/mperrno.h" #include "lib/oofatfs/ff.h" diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index 3894b2cae..f580184a7 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -31,7 +31,6 @@ #include <stdio.h> -#include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" #include "py/mperrno.h" diff --git a/extmod/vfs_fat_misc.c b/extmod/vfs_fat_misc.c index 7c16db7e5..9a26b4a2f 100644 --- a/extmod/vfs_fat_misc.c +++ b/extmod/vfs_fat_misc.c @@ -28,7 +28,6 @@ #if MICROPY_VFS_FAT #include <string.h> -#include "py/nlr.h" #include "py/runtime.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs_fat.h" |
