Skip to content

Commit db090e2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into esp32
2 parents 75ead22 + 4a93801 commit db090e2

File tree

1,077 files changed

+916
-439246
lines changed

Some content is hidden

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

1,077 files changed

+916
-439246
lines changed

.gitattributes

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
# These should also not be modified by git.
1616
tests/basics/string_cr_conversion.py -text
1717
tests/basics/string_crlf_conversion.py -text
18-
stmhal/pybcdc.inf_template -text
19-
stmhal/usbd_* -text
20-
stmhal/boards/*/stm32f4xx_hal_conf.h -text
21-
stmhal/cmsis/** -text
22-
stmhal/hal/** -text
23-
stmhal/usbdev/** -text
24-
stmhal/usbhost/** -text
25-
cc3200/hal/aes.c -text
26-
cc3200/hal/aes.h -text
27-
cc3200/hal/des.c -text
28-
cc3200/hal/i2s.c -text
29-
cc3200/hal/i2s.h -text
30-
cc3200/version.h -text
18+
ports/stm32/pybcdc.inf_template -text
19+
ports/stm32/usbd_* -text
20+
ports/stm32/boards/*/stm32f4xx_hal_conf.h -text
21+
ports/stm32/usbdev/** -text
22+
ports/stm32/usbhost/** -text
23+
ports/cc3200/hal/aes.c -text
24+
ports/cc3200/hal/aes.h -text
25+
ports/cc3200/hal/des.c -text
26+
ports/cc3200/hal/i2s.c -text
27+
ports/cc3200/hal/i2s.h -text
28+
ports/cc3200/version.h -text

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@
1111
[submodule "lib/berkeley-db-1.xx"]
1212
path = lib/berkeley-db-1.xx
1313
url = https://github.com/pfalcon/berkeley-db-1.xx
14+
[submodule "lib/stm32lib"]
15+
path = lib/stm32lib
16+
url = https://github.com/micropython/stm32lib
17+
branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0

.travis.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,40 @@ before_script:
2828

2929
script:
3030
- make -C mpy-cross
31-
- make -C minimal CROSS=1 build/firmware.bin
32-
- ls -l minimal/build/firmware.bin
31+
- make -C ports/minimal CROSS=1 build/firmware.bin
32+
- ls -l ports/minimal/build/firmware.bin
3333
- tools/check_code_size.sh
3434
- mkdir -p ${HOME}/persist
3535
# Save new firmware for reference, but only if building a main branch, not a pull request
36-
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp minimal/build/firmware.bin ${HOME}/persist/; fi'
37-
- make -C unix deplibs
38-
- make -C unix
39-
- make -C unix nanbox
40-
- make -C bare-arm
41-
- make -C qemu-arm test
42-
- make -C stmhal
43-
- make -C stmhal BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
44-
- make -C stmhal BOARD=STM32F769DISC
45-
- make -C stmhal BOARD=STM32L476DISC
46-
- make -C teensy
47-
- make -C cc3200 BTARGET=application BTYPE=release
48-
- make -C cc3200 BTARGET=bootloader BTYPE=release
49-
- make -C windows CROSS_COMPILE=i686-w64-mingw32-
36+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then cp ports/minimal/build/firmware.bin ${HOME}/persist/; fi'
37+
- make -C ports/unix deplibs
38+
- make -C ports/unix
39+
- make -C ports/unix nanbox
40+
- make -C ports/bare-arm
41+
- make -C ports/qemu-arm test
42+
- make -C ports/stm32
43+
- make -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
44+
- make -C ports/stm32 BOARD=STM32F769DISC
45+
- make -C ports/stm32 BOARD=STM32L476DISC
46+
- make -C ports/teensy
47+
- make -C ports/cc3200 BTARGET=application BTYPE=release
48+
- make -C ports/cc3200 BTARGET=bootloader BTYPE=release
49+
- make -C ports/windows CROSS_COMPILE=i686-w64-mingw32-
5050

5151
# run tests without coverage info
5252
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
5353
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
5454

5555
# run tests with coverage info
56-
- make -C unix coverage
57-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests)
58-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests -d thread)
59-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native)
60-
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --via-mpy -d basics float)
56+
- make -C ports/unix coverage
57+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests)
58+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -d thread)
59+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --emit native)
60+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests --via-mpy -d basics float)
6161

6262
# run coveralls coverage analysis (try to, even if some builds/tests failed)
63-
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
63+
- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
6464

6565
after_failure:
6666
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
67-
- (grep "FAIL" qemu-arm/build/console.out)
67+
- (grep "FAIL" ports/qemu-arm/build/console.out)

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,24 @@ Major components in this repository:
5959
core library.
6060
- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
6161
into precompiled bytecode.
62-
- unix/ -- a version of MicroPython that runs on Unix.
63-
- stmhal/ -- a version of MicroPython that runs on the PyBoard and similar
62+
- ports/unix/ -- a version of MicroPython that runs on Unix.
63+
- ports/stm32/ -- a version of MicroPython that runs on the PyBoard and similar
6464
STM32 boards (using ST's Cube HAL drivers).
65-
- minimal/ -- a minimal MicroPython port. Start with this if you want
65+
- ports/minimal/ -- a minimal MicroPython port. Start with this if you want
6666
to port MicroPython to another microcontroller.
6767
- tests/ -- test framework and test scripts.
6868
- docs/ -- user documentation in Sphinx reStructuredText format. Rendered
6969
HTML documentation is available at http://docs.micropython.org (be sure
7070
to select needed board/port at the bottom left corner).
7171

7272
Additional components:
73-
- bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
73+
- ports/bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
7474
mostly to control code size.
75-
- teensy/ -- a version of MicroPython that runs on the Teensy 3.1
75+
- ports/teensy/ -- a version of MicroPython that runs on the Teensy 3.1
7676
(preliminary but functional).
77-
- pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
78-
- cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
79-
- esp8266/ -- an experimental port for ESP8266 WiFi modules.
77+
- ports/pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
78+
- ports/cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
79+
- ports/esp8266/ -- an experimental port for ESP8266 WiFi modules.
8080
- extmod/ -- additional (non-core) modules implemented in C.
8181
- tools/ -- various tools, including the pyboard.py module.
8282
- examples/ -- a few example Python scripts.
@@ -97,7 +97,7 @@ Alternatively, fallback implementation based on setjmp/longjmp can be used.
9797

9898
To build (see section below for required dependencies):
9999

100-
$ cd unix
100+
$ cd ports/unix
101101
$ make axtls
102102
$ make
103103

@@ -140,33 +140,33 @@ these additional dependencies, first fetch git submodules for them:
140140
$ git submodule update --init
141141

142142
Use this same command to get the latest versions of dependencies, as
143-
they are updated from time to time. After that, in `unix/` dir, execute:
143+
they are updated from time to time. After that, in `ports/unix/` dir, execute:
144144

145145
$ make deplibs
146146

147147
This will build all available dependencies (regardless whether they
148148
are used or not). If you intend to build MicroPython with additional
149149
options (like cross-compiling), the same set of options should be passed
150150
to `make deplibs`. To actually enabled use of dependencies, edit
151-
`unix/mpconfigport.mk` file, which has inline descriptions of the options.
151+
`ports/unix/mpconfigport.mk` file, which has inline descriptions of the options.
152152
For example, to build SSL module (required for `upip` tool described above),
153153
set `MICROPY_PY_USSL` to 1.
154154

155-
In `unix/mpconfigport.mk`, you can also disable some dependencies enabled
155+
In `ports/unix/mpconfigport.mk`, you can also disable some dependencies enabled
156156
by default, like FFI support, which requires libffi development files to
157157
be installed.
158158

159-
The STM version
160-
---------------
159+
The STM32 version
160+
-----------------
161161

162-
The "stmhal" port requires an ARM compiler, arm-none-eabi-gcc, and associated
162+
The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated
163163
bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and
164164
arm-none-eabi-gcc packages. Otherwise, try here:
165165
https://launchpad.net/gcc-arm-embedded
166166

167167
To build:
168168

169-
$ cd stmhal
169+
$ cd ports/stm32
170170
$ make
171171

172172
You then need to get your board into DFU mode. On the pyboard, connect the
@@ -180,4 +180,4 @@ Then to flash the code via USB DFU to your device:
180180
This will use the included `tools/pydfu.py` script. If flashing the firmware
181181
does not work it may be because you don't have the correct permissions, and
182182
need to use `sudo make deploy`.
183-
See the README.md file in the stmhal/ directory for further details.
183+
See the README.md file in the ports/stm32/ directory for further details.

cc3200/misc/mpexception.c

Lines changed: 0 additions & 91 deletions
This file was deleted.

docs/library/micropython.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Functions
4646

4747
.. function:: mem_info([verbose])
4848

49-
Print information about currently used memory. If the *verbose`* argument
49+
Print information about currently used memory. If the *verbose* argument
5050
is given then extra information is printed.
5151

5252
The information that is printed is implementation dependent, but currently

docs/library/uos.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,22 @@ Functions
8989
Return a bytes object with n random bytes. Whenever possible, it is
9090
generated by the hardware random number generator.
9191

92-
.. function:: dupterm(stream_object)
92+
.. function:: dupterm(stream_object, index=0)
9393

94-
Duplicate or switch MicroPython terminal (the REPL) on the passed stream-like
95-
object. The given object must implement the ``readinto()`` and ``write()``
96-
methods. If ``None`` is passed, previously set redirection is cancelled.
94+
Duplicate or switch the MicroPython terminal (the REPL) on the given stream-like
95+
object. The *stream_object* argument must implement the ``readinto()`` and
96+
``write()`` methods. The stream should be in non-blocking mode and
97+
``readinto()`` should return ``None`` if there is no data available for reading.
98+
99+
After calling this function all terminal output is repeated on this stream,
100+
and any input that is available on the stream is passed on to the terminal input.
101+
102+
The *index* parameter should be a non-negative integer and specifies which
103+
duplication slot is set. A given port may implement more than one slot (slot 0
104+
will always be available) and in that case terminal input and output is
105+
duplicated on all the slots that are set.
106+
107+
If ``None`` is passed as the *stream_object* then duplication is cancelled on
108+
the slot given by *index*.
109+
110+
The function returns the previous stream-like object in the given slot.

docs/reference/constrained.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ After importing the modules, execute:
279279
280280
Then copy and paste all the Q(xxx) lines into a text editor. Check for and
281281
remove lines which are obviously invalid. Open the file qstrdefsport.h which
282-
will be found in stmhal (or the equivalent directory for the architecture in
282+
will be found in ports/stm32 (or the equivalent directory for the architecture in
283283
use). Copy and paste the corrected lines at the end of the file. Save the file,
284284
rebuild and flash the firmware. The outcome can be checked by importing the
285285
modules and again issuing:

esp8266/modules/ds18x20.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

esp8266/modules/onewire.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

esp8266/modules/upip.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

esp8266/modules/upip_utarfile.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/pins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Print a nice list of pins, their current settings, and available afs.
2-
# Requires pins_af.py from stmhal/build-PYBV10/ directory.
2+
# Requires pins_af.py from ports/stm32/build-PYBV10/ directory.
33

44
import pyb
55
import pins_af

extmod/machine_i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ int mp_machine_soft_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t
269269
/******************************************************************************/
270270
// MicroPython bindings for I2C
271271

272-
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) {
272+
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) {
273273
enum { ARG_scl, ARG_sda, ARG_freq, ARG_timeout };
274274
static const mp_arg_t allowed_args[] = {
275275
{ MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ },

extmod/modbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
281281
}
282282
}
283283

284-
STATIC mp_obj_t btree_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
284+
STATIC mp_obj_t btree_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
285285
mp_obj_btree_t *self = MP_OBJ_TO_PTR(lhs_in);
286286
switch (op) {
287287
case MP_BINARY_OP_IN: {

extmod/modframebuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#if MICROPY_PY_FRAMEBUF
3535

36-
#include "stmhal/font_petme128_8x8.h"
36+
#include "ports/stm32/font_petme128_8x8.h"
3737

3838
typedef struct _mp_obj_framebuf_t {
3939
mp_obj_base_t base;

extmod/modlwip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ STATIC mp_obj_t lwip_socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
10701070
}
10711071
STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_setblocking_obj, lwip_socket_setblocking);
10721072

1073-
STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
1073+
STATIC mp_obj_t lwip_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
10741074
(void)n_args; // always 4
10751075
lwip_socket_obj_t *socket = args[0];
10761076

@@ -1120,7 +1120,7 @@ STATIC mp_obj_t lwip_socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
11201120
}
11211121
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_socket_setsockopt_obj, 4, 4, lwip_socket_setsockopt);
11221122

1123-
STATIC mp_obj_t lwip_socket_makefile(mp_uint_t n_args, const mp_obj_t *args) {
1123+
STATIC mp_obj_t lwip_socket_makefile(size_t n_args, const mp_obj_t *args) {
11241124
(void)n_args;
11251125
return args[0];
11261126
}

0 commit comments

Comments
 (0)