Skip to content

Commit b3a50f0

Browse files
committed
Merge branch 'master' into unicode
Conflicts: py/mpconfig.h
2 parents ed07d03 + 8993fb6 commit b3a50f0

19 files changed

Lines changed: 50 additions & 6 deletions

File tree

bare-arm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ else
2222
CFLAGS += -Os -DNDEBUG
2323
endif
2424

25-
LDFLAGS = -nostdlib -T stm32f405.ld
25+
LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref
2626
LIBS =
2727

2828
SRC_C = \

bare-arm/mpconfigport.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
#define MICROPY_HELPER_REPL (0)
1313
#define MICROPY_HELPER_LEXER_UNIX (0)
1414
#define MICROPY_ENABLE_SOURCE_LINE (0)
15+
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
1516
#define MICROPY_PY_BUILTINS_FROZENSET (0)
1617
#define MICROPY_PY_BUILTINS_SET (0)
1718
#define MICROPY_PY_BUILTINS_SLICE (0)
1819
#define MICROPY_PY_BUILTINS_PROPERTY (0)
20+
#define MICROPY_PY_ARRAY (0)
1921
#define MICROPY_PY_COLLECTIONS (0)
2022
#define MICROPY_PY_MATH (0)
2123
#define MICROPY_PY_CMATH (0)
@@ -26,6 +28,8 @@
2628
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_NONE)
2729
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_NONE)
2830

31+
//#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
32+
2933
// type definitions for the specific machine
3034

3135
#define BYTES_PER_WORD (4)

py/builtintables.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
4343
// built-in types
4444
{ MP_OBJ_NEW_QSTR(MP_QSTR_bool), (mp_obj_t)&mp_type_bool },
4545
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytes), (mp_obj_t)&mp_type_bytes },
46+
#if MICROPY_PY_BUILTINS_BYTEARRAY
4647
{ MP_OBJ_NEW_QSTR(MP_QSTR_bytearray), (mp_obj_t)&mp_type_bytearray },
48+
#endif
4749
#if MICROPY_PY_BUILTINS_COMPLEX
4850
{ MP_OBJ_NEW_QSTR(MP_QSTR_complex), (mp_obj_t)&mp_type_complex },
4951
#endif
@@ -160,7 +162,9 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
160162
{ MP_OBJ_NEW_QSTR(MP_QSTR___main__), (mp_obj_t)&mp_module___main__ },
161163
{ MP_OBJ_NEW_QSTR(MP_QSTR_micropython), (mp_obj_t)&mp_module_micropython },
162164

165+
#if MICROPY_PY_ARRAY
163166
{ MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mp_module_array },
167+
#endif
164168
#if MICROPY_PY_IO
165169
{ MP_OBJ_NEW_QSTR(MP_QSTR__io), (mp_obj_t)&mp_module_io },
166170
#endif

py/modarray.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "obj.h"
3131
#include "builtin.h"
3232

33+
#if MICROPY_PY_ARRAY
34+
3335
STATIC const mp_map_elem_t mp_module_array_globals_table[] = {
3436
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_array) },
3537
{ MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mp_type_array },
@@ -51,3 +53,5 @@ const mp_obj_module_t mp_module_array = {
5153
.name = MP_QSTR_array,
5254
.globals = (mp_obj_dict_t*)&mp_module_array_globals,
5355
};
56+
57+
#endif

py/mpconfig.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ typedef double mp_float_t;
252252
// Whether str object is proper unicode
253253
#ifndef MICROPY_PY_BUILTINS_STR_UNICODE
254254
#define MICROPY_PY_BUILTINS_STR_UNICODE (0)
255+
256+
// Whether to support bytearray object
257+
#ifndef MICROPY_PY_BUILTINS_BYTEARRAY
258+
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
255259
#endif
256260

257261
// Whether to support set object
@@ -274,6 +278,13 @@ typedef double mp_float_t;
274278
#define MICROPY_PY_BUILTINS_PROPERTY (1)
275279
#endif
276280

281+
// Whether to provide "array" module. Note that large chunk of the
282+
// underlying code is shared with "bytearray" builtin type, so to
283+
// get real savings, it should be disabled too.
284+
#ifndef MICROPY_PY_ARRAY
285+
#define MICROPY_PY_ARRAY (1)
286+
#endif
287+
277288
// Whether to provide "collections" module
278289
#ifndef MICROPY_PY_COLLECTIONS
279290
#define MICROPY_PY_COLLECTIONS (1)

py/obj.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "obj.h"
3636
#include "runtime0.h"
3737
#include "runtime.h"
38+
#include "stackctrl.h"
3839

3940
mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in) {
4041
if (MP_OBJ_IS_SMALL_INT(o_in)) {
@@ -59,6 +60,8 @@ void printf_wrapper(void *env, const char *fmt, ...) {
5960
}
6061

6162
void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
63+
// There can be data structures nested too deep, or just recursive
64+
STACK_CHECK();
6265
#if !NDEBUG
6366
if (o_in == NULL) {
6467
print(env, "(nil)");

py/objarray.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
#include "runtime.h"
3838
#include "binary.h"
3939

40+
#if MICROPY_PY_ARRAY || MICROPY_PY_BUILTINS_BYTEARRAY
41+
4042
typedef struct _mp_obj_array_t {
4143
mp_obj_base_t base;
4244
machine_uint_t typecode : 8;
@@ -310,3 +312,5 @@ STATIC mp_obj_t array_iterator_new(mp_obj_t array_in) {
310312
o->cur = 0;
311313
return o;
312314
}
315+
316+
#endif // MICROPY_PY_ARRAY || MICROPY_PY_BUILTINS_BYTEARRAY

py/runtime.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "smallint.h"
4646
#include "objgenerator.h"
4747
#include "lexer.h"
48+
#include "stackctrl.h"
4849

4950
#if 0 // print debugging info
5051
#define DEBUG_PRINT (1)
@@ -69,6 +70,8 @@ const mp_obj_module_t mp_module___main__ = {
6970
};
7071

7172
void mp_init(void) {
73+
stack_ctrl_init();
74+
7275
// call port specific initialization if any
7376
#ifdef MICROPY_PORT_INIT_FUNC
7477
MICROPY_PORT_INIT_FUNC;

stmhal/boards/HYDRABUS/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define HYDRABUSV10
22

33
#define MICROPY_HW_BOARD_NAME "HydraBus1.0"
4+
#define MICROPY_HW_MCU_NAME "STM32F4"
45

56
#define MICROPY_HW_HAS_SWITCH (1)
67
#define MICROPY_HW_HAS_SDCARD (1)

stmhal/boards/NETDUINO_PLUS_2/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define NETDUINO_PLUS_2
22

33
#define MICROPY_HW_BOARD_NAME "NetduinoPlus2"
4+
#define MICROPY_HW_MCU_NAME "STM32F405RG"
45

56
#define MICROPY_HW_HAS_SWITCH (1)
67

0 commit comments

Comments
 (0)