Commit Graph

11127 Commits

Author SHA1 Message Date
Damien George
b23bd6433c py: Clean up commented-out code and comments about exception hierarchy.
In CPython, EnvironmentError and IOError are now aliases of OSError so no
need to have them listed in the code.  OverflowError inherits from
ArithmeticError because it's intended to be raised "when the result of an
arithmetic operation is too large to be represented" (per CPython docs),
and MicroPython aims to match the CPython exception hierarchy.
2019-12-28 01:01:36 +11:00
Yonatan Goldschmidt
b2e4a57289 nrf/main: Remove unnecessary repl_info(0) call.
It's statically initialized to 0.
2019-12-28 00:08:31 +11:00
Yonatan Goldschmidt
61d2b40ad5 lib/utils/pyexec: Introduce MICROPY_REPL_INFO, wrap debug prints in it.
For the 3 ports that already make use of this feature (stm32, nrf and
teensy) this doesn't make any difference, it just allows to disable it from
now on.

For other ports that use pyexec, this decreases code size because the debug
printing code is dead (it can't be enabled) but the compiler can't deduce
that, so code is still emitted.
2019-12-28 00:05:39 +11:00
Yonatan Goldschmidt
aca8873bb8 extmod/modbluetooth: Fix func prototype, empty args should be (void).
This fixes a -Wstrict-prototypes error.
2019-12-27 23:57:46 +11:00
David Lechner
e79424d672 ports: Allow overriding CROSS_COMPILE in a custom makefile.
Many ports already allow overriding CROSS_COMPILE.  This modifies the
remaining ports to allow it as well.
2019-12-27 23:53:16 +11:00
Damien George
d56bc6e03d py/obj.h: Use 32-bit shift in MP_OBJ_NEW_QSTR calc for obj-repr D.
The qst value is always small enough to fit in 31-bits (even less) and
using a 32-bit shift rather than a 64-bit shift reduces code size by about
300 bytes.
2019-12-27 23:33:34 +11:00
Damien George
4c0176d13f py/objstr: Don't use inline GET_STR_DATA_LEN for object-repr D.
Changing to use the helper function mp_obj_str_get_data_no_check() reduces
code size of nan-boxing builds by about 1000 bytes.
2019-12-27 23:15:52 +11:00
Damien George
e83ab7374b travis: Add stm32 build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
93509ac8c7 stm32: Add configuration to build in nanbox mode.
Most stm32 boards can now be built in nan-boxing mode via:

    $ make NANBOX=1

Note that if float is enabled then it will be forced to double-precision.
Also, native emitters will be disabled.
2019-12-27 22:54:53 +11:00
Damien George
d980d51807 stm32: Fix to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
e83fc3260e drivers/cyw43: Fix to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
6f872f81d6 extmod: Fix modbluetooth and modwebrepl to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
1f499ad2fe py/objobject: Fix __setattr__/__delattr__ to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
d97b40bdaa py: Introduce MP_ROM_FALSE/MP_ROM_TRUE for ROM to refer to bool objects.
This helps to prevent mistakes, and allows easily changing the ROM value of
False/True if needed.
2019-12-27 22:54:20 +11:00
Damien George
09376f0e47 py: Introduce MP_ROM_NONE macro for ROM to refer to None object.
This helps to prevent mistakes, and allows easily changing the ROM value of
None if needed.
2019-12-27 22:51:17 +11:00
Damien George
f5eec903fa py/objsingleton: Use mp_generic_unary_op for singleton objects.
So these types more closely match NoneType, eg they can be hashed, like in
CPython.
2019-12-27 12:53:36 +11:00
Damien George
de8c04317b tests/micropython: Add test for yield-from while heap is locked. 2019-12-27 12:34:22 +11:00
Damien George
aacd618939 py/runtime: Don't allocate iter buf for user-defined types.
A user-defined type that defines __iter__ doesn't need any memory to be
pre-allocated for its iterator (because it can't use such memory).  So
optimise for this case by not allocating the iter-buf.
2019-12-27 12:34:22 +11:00
Damien George
11b4524b39 travis: Add new job to build and test unix coverage in 32-bit mode. 2019-12-27 12:30:51 +11:00
Damien George
99a04b8060 tests/extmod: Split out VfsFat finaliser tests to separate test file.
It tests independent functionality and may need to be skipped for a given
port.
2019-12-27 12:30:51 +11:00
Damien George
865827ed8e tests/run-tests: Add "--mpy-cross-flags" arg to specify mpy-cross flags. 2019-12-27 12:30:51 +11:00
Damien George
ab75210e33 py/asmx86: Remove unused 5th argument facility.
In commit 71a3d6ec3b mp_setup_code_state was
changed from a 5-arg function to a 4-arg function, and at that point 5-arg
calls in native code were no longer needed.  See also commit
4f9842ad80.
2019-12-27 12:30:51 +11:00
Damien George
b97fb683d0 py/asmx86: Fix stack to be 16-byte aligned for entry and sub-call. 2019-12-27 12:30:51 +11:00
Damien George
ed2be79b49 extmod/uzlib: Explicitly cast ptr-diff-expr to unsigned.
The struct member "dest" should never be less than "destStart", so their
difference is never negative.  Cast as such to make the comparison
explicitly unsigned, ensuring the compiler produces the correct comparison
instruction, and avoiding any compiler warnings.
2019-12-23 00:07:03 +11:00
Damien George
300eb65ae7 py/nlrx86: Silence possible warnings about unused nlr argument. 2019-12-23 00:07:03 +11:00
Yonatan Goldschmidt
42e45bd694 py/objobject: Add object.__delattr__ function.
Similar to object.__setattr__.
2019-12-21 00:14:22 +11:00
Yonatan Goldschmidt
07ccb5588c py/objobject: Add object.__setattr__ function.
Allows assigning attributes on class instances that implement their own
__setattr__.  Both object.__setattr__ and super(A, b).__setattr__ will work
with this commit.
2019-12-21 00:12:08 +11:00
Jim Mussared
90f286465b stm32/mbedtls: Resize mbedtls output buffer from 16 down to 4 kiB.
To reduce the size of the SSL context on the heap.  See issue #5303.
2019-12-21 00:02:24 +11:00
Damien George
5e431188db py/obj.h: Remove comments about additional mp_buffer_info_t entries.
These entries are unlikely to be needed, so remove them to clean up the
struct definition.
2019-12-20 23:36:17 +11:00
Damien George
035180ca01 py: Remove commented-out debug printf's from emitbc and objlist.
Any debugging prints should use a macro like DEBUG_printf.
2019-12-20 23:34:46 +11:00
Damien George
1f37194730 all: Bump version to 1.12. 2019-12-20 16:58:17 +11:00
Damien George
39bc430e44 tests/pyb: Adjust UART and Timer tests to work on PYBD_SF6. 2019-12-20 16:42:38 +11:00
Damien George
073c5f3a40 py/profile: Fix debug opcode decoding of MP_BC_RAISE_xxx opcodes. 2019-12-20 14:57:44 +11:00
Damien George
95473980ef py/vm: Fix comment to refer to MP_BC_RAISE_OBJ instead of RAISE_VARARGS. 2019-12-20 14:57:06 +11:00
Damien George
7ac326c424 stm32/boards/PYBD: Include webrepl helper scripts in frozen manifest. 2019-12-20 13:20:20 +11:00
Jim Mussared
7ce1e0b1dc extmod/webrepl: Move webrepl scripts to common place and use manifest.
Move webrepl support code from ports/esp8266/modules into extmod/webrepl
(to be alongside extmod/modwebrepl.c), and use frozen manifests to include
it in the build on esp8266 and esp32.

A small modification is made to webrepl.py to make it work on non-ESP
ports, i.e. don't call dupterm_notify if not available.
2019-12-20 12:59:13 +11:00
Matt Trentini
7f235cbee9 docs/esp32: Add quickref and full docs for esp32.RMT class. 2019-12-20 12:25:38 +11:00
Matt Trentini
0e0e6132fd esp32/esp32_rmt: Add initial support for RMT peripheral.
This is an ESP32-specific peripheral so lives in the esp32 module.
2019-12-20 12:24:51 +11:00
David Lechner
882533ad92 qemu-arm/Makefile: Allow overriding CROSS_COMPILE from another makefile. 2019-12-19 17:59:32 +11:00
David Lechner
fd0ba7be07 tools/tinytest-codegen.py: Add extra newline and result message.
This is an alternative to f4ed2df that adds a newline so that the output of
the test starts on a new line and the result of the test is prefixed with
"result: " to distinguish it from the test output.

Suggested-by: @dpgeorge
2019-12-19 17:55:50 +11:00
David Lechner
1605c7e584 Revert "lib/tinytest: Clean up test reporting in the presence of std..."
This reverts commit f4ed2dfa94.

This lets tinytest work as it was originally designed.  An alternate
solution for the reverted commit will be implemented in a future commit.
2019-12-19 17:53:46 +11:00
iabdalkader
3078a4b2e2 stm32/timer: Add missing TIM 1/15/16/17 IRQ handlers for H7 MCUs. 2019-12-19 17:19:53 +11:00
Damien George
8449e41818 docs/develop: Add documentation on how to build native .mpy modules. 2019-12-19 17:07:53 +11:00
Damien George
e58c7ce3d6 docs/reference: Add documentation describing use of .mpy files.
Including information about .mpy versioning and how to debug failed imports
of .mpy files.
2019-12-19 17:06:27 +11:00
Damien George
a3df152fef examples/natmod: Add very simple features0 example to compute factorial. 2019-12-19 17:06:27 +11:00
Damien George
b3b9b11596 tools/pyboard.py: Support executing .mpy files directly.
This patch allows executing .mpy files (including native ones) directly on
a target, eg a board over a serial connection.  So there's no need to copy
the file to its filesystem to test it.

For example:

    $ mpy-cross foo.py
    $ pyboard.py foo.mpy
2019-12-19 17:00:52 +11:00
roland van straten
43b576d88d stm32/boards/NUCLEO_H743ZI: Add extra pins and peripheral definitions.
- Corrected pin assignments and checked with CubeMX.
- Added additional I2C and UARTs.
- Added Ethernet interface definitions with lwIP and SSL support (but
  Ethernet is currently unsupported on H7 MCUs so not fully enabled).
2019-12-19 16:54:33 +11:00
roland van straten
26a78edb49 stm32/boards/NUCLEO_F767ZI: Update pins, peripherals and total flash.
- Removed remarks on DFU/OCD in mpconfigboard.h because deploy-stlink works
  fine too.
- Added more UARTs, I2C, corrected SPI, CAN, etc; verified against CubeMX.
- Adapted pins.csv to remove errors, add omissions, etc. according to
  NUCLEO-144 User Manual.
- Changed linker file stm32f767.ld to reflect correct size of the Flash.
- Tested with LAN and SD card.
2019-12-19 11:43:19 +11:00
roland van straten
8af139e8a4 stm32/boards/NUCLEO_F767ZI: Add pins and config for using an SD card.
The Nucleo board does not have an SD card slot but does have the requisite
pins next to each other and labelled, so provide the configuration for
convenience.
2019-12-19 11:28:47 +11:00
Seon Rozenblum
0d82f5d8c8 esp32/boards/TINYPICO: Add tinypico.py, dotstar.py with custom manifest. 2019-12-19 10:05:01 +11:00