8000 Merge pull request #208 from adafruit/merge-v1.9.2 · boneskull/circuitpython@447a4b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 447a4b1

Browse files
authored
Merge pull request adafruit#208 from adafruit/merge-v1.9.2
Merge MicroPython v1.9.2
2 parents 4e63d55 + c679c80 commit 447a4b1

File tree

886 files changed

+10148
-5064
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

886 files changed

+10148
-5064
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ before_script:
3838
# For teensy build
3939
- sudo apt-get install realpath
4040
# For coverage testing
41-
- sudo pip install cpp-coveralls
41+
# cpp-coveralls 0.4 conflicts with urllib3 preinstalled in Travis VM
42+
- sudo pip install cpp-coveralls==0.3.12
4243
- gcc --version
4344
- arm-none-eabi-gcc --version
4445
- python3 --version

CODECONVENTIONS.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,27 @@ require such detailed description.
2626
To get good practical examples of good commits and their messages, browse
2727
the `git log` of the project.
2828

29+
MicroPython doesn't require explicit sign-off for patches ("Signed-off-by"
30+
lines and similar). Instead, the commit message, and your name and email
31+
address on it construes your sign-off of the following:
32+
33+
* That you wrote the change yourself, or took it from a project with
34+
a compatible license (in the latter case the commit message, and possibly
35+
source code should provide reference where the implementation was taken
36+
from and give credit to the original author, as required by the license).
37+
* That you are allowed to release these changes to an open-source project
38+
(for example, changes done during paid work for a third party may require
39+
explicit approval from that third party).
40+
* That you (or your employer) agree to release the changes under
41+
MicroPython's license, which is the MIT license. Note that you retain
42+
copyright for your changes (for smaller changes, the commit message
43+
conveys your copyright; if you make significant changes to a particular
44+
source module, you're welcome to add your name to the file header).
45+
* Your signature for all of the above, which is the 'Author' line in
46+
the commit message, and which should include your full real name and
47+
a valid and active email address by which you can be contacted in the
48+
foreseeable future.
49+
2950
Python code conventions
3051
=======================
3152

@@ -114,3 +135,76 @@ Type declarations:
114135
int member;
115136
void *data;
116137
} my_struct_t;
138+
139+
Documentation conventions
140+
=========================
141+
142+
MicroPython generally follows CPython in documentation process and
143+
conventions. reStructuredText syntax is used for the documention.
144+
145+
Specific conventions/suggestions:
146+
147+
* Use `*` markup to refer to arguments of a function, e.g.:
148+
149+
```
150+
.. method:: poll.unregister(obj)
151+
152+
Unregister *obj* from polling.
153+
```
154+
155+
* Use following syntax for cross-references/cross-links:
156+
157+
```
158+
:func:`foo` - function foo in current module
159+
:func:`module1.foo` - function foo in module "module1"
160+
(similarly for other referent types)
161+
:class:`Foo` - class Foo
162+
:meth:`Class.method1` - method1 in Class
163+
:meth:`~Class.method1` - method1 in Class, but rendered just as "method1()",
164+
not "Class.method1()"
165+
:meth:`title <method1>` - reference method1, but render as "title" (use only
166+
if really needed)
167+
:mod:`module1` - module module1
168+
169+
`symbol` - generic xref syntax which can replace any of the above in case
170+
the xref is unambiguous. If there's ambiguity, there will be a warning
171+
during docs generation, which need to be fixed using one of the syntaxes
172+
above
173+
```
174+
175+
* Cross-referencing arbitrary locations
176+
~~~
177+
.. _xref_target:
178+
179+
Normal non-indented text.
180+
181+
This is :ref:`reference <xref_target>`.
182+
183+
(If xref target is followed by section title, can be just
184+
:ref:`xref_target`).
185+
~~~
186+
187+
* Linking to external URL:
188+
```
189+
`link text <http://foo.com/...>`_
190+
```
191+
192+
* Referencing builtin singleton objects:
193+
```
194+
``None``, ``True``, ``False``
195+
```
196+
197+
* Use following syntax to create common description for more than one element:
198+
~~~
199+
.. function:: foo(x)
200+
bar(y)
201+
202+
Description common to foo() and bar().
203+
~~~
204+
205+
206+
More detailed guides and quickrefs:
207+
208+
* http://www.sphinx-doc.org/en/stable/rest.html
209+
* http://www.sphinx-doc.org/en/stable/markup/inline.html
210+
* http://docutils.sourceforge.net/docs/user/rst/quickref.html

atmel-samd/Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include boards/$(BOARD)/mpconfigboard.mk
1919
QSTR_DEFS = qstrdefsport.h
2020

2121
# include py core make definitions
22-
include ../py/py.mk
22+
include $(TOP)/py/py.mk
2323

2424
CROSS_COMPILE = arm-none-eabi-
2525

@@ -28,9 +28,9 @@ BOSSAC := tools/bossac_osx
2828
HAL_DIR=hal/$(MCU_SERIES)
2929

3030
INC += -I.
31-
INC += -I..
32-
INC += -I../lib/mp-readline
33-
INC += -I../lib/timeutils
31+
INC += -I$(TOP)
32+
INC += -I$(TOP)/lib/mp-readline
33+
INC += -I$(TOP)/lib/timeutils
3434
INC += -Iasf_conf/
3535
INC += -Iasf/common/boards/
3636
INC += -Iasf/common/services/sleepmgr/
@@ -227,13 +227,10 @@ SRC_C = \
227227
lib/utils/interrupt_char.c \
228228
lib/utils/pyexec.c \
229229
lib/utils/stdout_helpers.c \
230+
lib/utils/sys_stdio_mphal.c \
230231
lib/libc/string0.c \
231232
lib/mp-readline/readline.c
232233

233-
STM_SRC_C = $(addprefix stmhal/,\
234-
pybstdio.c \
235-
)
236-
237234
SRC_COMMON_HAL = \
238235
analogio/__init__.c \
239236
analogio/AnalogIn.c \
@@ -295,7 +292,6 @@ SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE))
295292

296293
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
297294
OBJ += $(addprefix $(BUILD)/, $(SRC_ASF:.c=.o))
298-
OBJ += $(addprefix $(BUILD)/, $(STM_SRC_C:.c=.o))
299295
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
300296
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
301297

@@ -306,15 +302,15 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
306302
$(BUILD)/firmware.elf: $(OBJ)
307303
$(STEPECHO) "LINK $@"
308304
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
309-
$(Q)$(SIZE) $@ | python3 ../tools/build_memory_info.py $(LD_FILE)
305+
$(Q)$(SIZE) $@ | python3 $(TOP)/tools/build_memory_info.py $(LD_FILE)
310306

311307
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
312308
$(ECHO) "Create $@"
313309
$(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
314310

315311
$(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
316312
$(ECHO) "Create $@"
317-
python2 ../tools/uf2/utils/uf2conv.py -c -o $@ $^
313+
python2 $(TOP)/tools/uf2/utils/uf2conv.py -c -o $@ $^
318314

319315
deploy: $(BUILD)/firmware.bin
320316
$(ECHO) "Writing $< to the board"
@@ -332,4 +328,4 @@ run:
332328
test: $(BUILD)/firmware.elf
333329
$(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"
334330

335-
include ../py/mkrules.mk
331+
include $(TOP)/py/mkrules.mk

atmel-samd/access_vfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

atmel-samd/access_vfs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*
@@ -27,8 +27,8 @@
2727
// This adapts the ASF access API to MicroPython's VFS API so we can expose all
2828
// VFS block devices as Lun's over USB mass storage control.
2929

30-
#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H__
31-
#define __MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H__
30+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H
31+
#define MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H
3232

3333
#include "asf/common/services/storage/ctrl_access/ctrl_access.h"
3434

@@ -39,4 +39,4 @@ bool vfs_removal(void);
3939
Ctrl_status vfs_usb_read_10(uint32_t addr, uint16_t nb_sector);
4040
Ctrl_status vfs_usb_write_10(uint32_t addr, uint16_t nb_sector);
4141

42-
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H__
42+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_ROM_FS_H

atmel-samd/autoreload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

atmel-samd/autoreload.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*
@@ -24,8 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
28-
#define __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
27+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H
28+
#define MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H
2929

3030
#include <stdbool.h>
3131

@@ -39,4 +39,4 @@ void autoreload_enable(void);
3939
void autoreload_disable(void);
4040
bool autoreload_is_enabled(void);
4141

42-
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H__
42+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_AUTORELOAD_H

atmel-samd/background.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

atmel-samd/background.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*
@@ -24,9 +24,9 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H__
28-
#define __MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H__
27+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H
28+
#define MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H
2929

3030
void run_background_tasks(void);
3131

32-
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H__
32+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BACKGROUND_H

atmel-samd/bindings/samd/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

atmel-samd/boards/arduino_zero/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

atmel-samd/boards/arduino_zero/pins.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22

33
#include "samd21_pins.h"
44

5-
STATIC const mp_map_elem_t board_global_dict_table[] = {
6-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), (mp_obj_t)&pin_PA02 },
7-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), (mp_obj_t)&pin_PB08 },
8-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), (mp_obj_t)&pin_PB09 },
9-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), (mp_obj_t)&pin_PA04 },
10-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), (mp_obj_t)&pin_PA05 },
11-
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), (mp_obj_t)&pin_PB02 },
12-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), (mp_obj_t)&pin_PA11 },
13-
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), (mp_obj_t)&pin_PA11 },
14-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), (mp_obj_t)&pin_PA10 },
15-
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), (mp_obj_t)&pin_PA10 },
16-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), (mp_obj_t)&pin_PA14 },
17-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), (mp_obj_t)&pin_PA09 },
18-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), (mp_obj_t)&pin_PA08 },
19-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), (mp_obj_t)&pin_PA15 },
20-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), (mp_obj_t)&pin_PA20 },
21-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), (mp_obj_t)&pin_PA21 },
22-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D8), (mp_obj_t)&pin_PA06 },
23-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), (mp_obj_t)&pin_PA07 },
24-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), (mp_obj_t)&pin_PA18 },
25-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), (mp_obj_t)&pin_PA16 },
26-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), (mp_obj_t)&pin_PA19 },
27-
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), (mp_obj_t)&pin_PA17 },
28-
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), (mp_obj_t)&pin_PA22 },
29-
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), (mp_obj_t)&pin_PA23 },
30-
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK), (mp_obj_t)&pin_PB11 },
31-
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), (mp_obj_t)&pin_PB10 },
32-
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO), (mp_obj_t)&pin_PA12 },
5+
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
6+
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
7+
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
8+
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
9+
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
10+
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
11+
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) },
12+
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
13+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
14+
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
15+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
16+
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) },
17+
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) },
18+
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) },
19+
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
20+
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
21+
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) },
22+
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
23+
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
24+
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
25+
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
26+
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
27+
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
28+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
29+
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
30+
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
31+
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
32+
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
3333
};
3434
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

atmel-samd/boards/board.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*
@@ -26,8 +26,8 @@
2626

2727
// This file defines board specific functions.
2828

29-
#ifndef __MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H__
30-
#define __MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H__
29+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H
30+
#define MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H
3131

3232
#include <stdbool.h>
3333

@@ -42,4 +42,4 @@ bool board_requests_safe_mode(void);
4242
// Reset the state of off MCU components such as neopixels.
4343
void reset_board(void);
4444

45-
#endif // __MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H__
45+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_BOARDS_BOARD_H

atmel-samd/boards/circuitplayground_express/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is part of the Micro Python project, http://micropython.org/
2+
* This file is part of the MicroPython project, http://micropython.org/
33
*
44
* The MIT License (MIT)
55
*

0 commit comments

Comments
 (0)
0