Commit Graph

7370 Commits

Author SHA1 Message Date
Damien George e83f140463 py/mpz: Remove unreachable code in mpn_or_neg functions. 2016-12-14 10:39:41 +11:00
Rami Ali 9112b0b62b tests/extmod: Improve modframebuf test coverage. 2016-12-13 16:29:21 +11:00
Damien George 0f408bc1ff stmhal: Move PY_SYS_PLATFORM config from board to general config file.
It can be overridden by a board if needed.
2016-12-13 16:26:45 +11:00
Rami Ali 8001918a89 stmhal: Add STM32F769DISC board files.
With minor changes to adc.c and storage.c to support the F769.
2016-12-13 16:26:13 +11:00
Rami Ali 3dd04dee3e stmhal/cmsis: Add CMSIS file stm32f769xx.h, V1.1.2. 2016-12-13 16:25:56 +11:00
Rami Ali e9fbc555fc stmhal: Add NUCLEO_F767ZI board, with openocd config for stm32f7. 2016-12-13 16:25:31 +11:00
Rami Ali 517f347f6f stmhal/cmsis: Add CMSIS file stm32f767xx.h, V1.1.2. 2016-12-13 16:24:24 +11:00
Damien George d9047d3c8a py/builtinimport: Support importing packages from compiled .mpy files.
This patch ensures that __init__.mpy files are imported if their
containing directory is imported as a package.
2016-12-13 15:09:48 +11:00
Scott Shawcroft 9ad0da6134 esp8266: Fix pyexec calls. 2016-12-12 17:11:07 -08:00
Scott Shawcroft 52f8e1cbf3 atmel-samd: Use bootloader again on the Metro M0 2016-12-12 17:09:42 -08:00
Scott Shawcroft 3972bc19c7 atmel-samd: Basic capacitive touch button support.
Currently only works on a single channel and is only enabled for boards with
SPI flash. Only really designed for hardware testing at this point.
2016-12-12 15:11:25 -08:00
Rami Ali d22762017e tests/extmod: Improve moductypes test coverage. 2016-12-12 17:09:14 +11:00
Damien George a3c61004c2 py/binary: Do zero extension when storing a value larger than word size. 2016-12-12 15:00:06 +11:00
Scott Shawcroft cd09726904 Fix pyexec_file calls. 2016-12-09 22:49:44 -08:00
Scott Shawcroft b6f1eebab3 atmel-samd: Add APA102 support and flash more advanced status.
The new sequence is as follows:
* Solid blue during the boot/settings script.
* Solid green during the main/code script.
* After main while waiting to enter repl or reset:
  * Fading green once main is done successfully.
  * On error produce a series of flashes:
    * Long flash color of script.
    * Long flash color of error:
      * Green = IndentationError
      * Cyan = SyntaxError
      * White = NameError
      * Orange = OSError
      * Yellow = Other error
    * Line number of the exception by digit. Number of flashes represents value.
      * Thousands = White
      * Hundreds = Blue
      * Tens = Yellow
      * Ones = Cyan
    * Off for a period and then repeats.

At any point a write to the flash storage will flicker red.

Fixes #63
2016-12-09 19:35:56 -08:00
Paul Sokolovsky aee13ef3f2 tests: Update for required byteorder arg for int.from_bytes()/to_bytes(). 2016-12-09 22:53:30 +03:00
Paul Sokolovsky 9d787de2a1 py/objint: from_bytes, to_bytes: Require byteorder arg, require "little".
CPython requires byteorder arg, make uPy compatible. As we support only
"little", error out on anything else.
2016-12-09 21:15:16 +03:00
Damien George 93ee6603b1 py/asm: Fix x86 and ARM assemblers due to recent code refactoring. 2016-12-09 22:54:45 +11:00
Damien George 155fdc74d5 py/asm: Remove need for dummy_data when doing initial assembler passes.
For all but the last pass the assembler only needs to count how much space
is needed for the machine code, it doesn't actually need to emit anything.
The dummy_data just uses unnecessary RAM and without it the code is not
any more complex (and code size does not increase for Thumb and Xtensa
archs).
2016-12-09 22:50:58 +11:00
Damien George e920bab976 py/emitinline: Move common code for end of final pass to compiler.
This patch moves some common code from the individual inline assemblers to
the compiler, the code that calls the emit-glue to assign the machine code
to the functions scope.
2016-12-09 21:23:17 +11:00
Damien George dd53b12193 py/emitinline: Move inline-asm align and data methods to compiler.
These are generic methods that don't depend on the architecture and so
can be handled directly by the compiler.
2016-12-09 20:54:54 +11:00
Damien George a7fd786a1f py/emitinline: Embed entire asm struct instead of a pointer to it.
This reduces fragmentation, and memory use by 1 word.  But more
importantly it means the emit_inline_asm_t struct now "derives" from
mp_asm_base.
2016-12-09 20:35:21 +11:00
Damien George 3a4ebf5768 esp8266: Enable inline Xtensa assembler.
With this patch, @micropython.asm_xtensa can be used on the esp8266 port.
2016-12-09 17:13:00 +11:00
Damien George f76b1bfa9f py: Add inline Xtensa assembler.
This patch adds the MICROPY_EMIT_INLINE_XTENSA option, which, when
enabled, allows the @micropython.asm_xtensa decorator to be used.

The following opcodes are currently supported (ax is a register, a0-a15):

    ret_n()
    callx0(ax)
    j(label)
    jx(ax)

    beqz(ax, label)
    bnez(ax, label)
    mov(ax, ay)
    movi(ax, imm) # imm can be full 32-bit, uses l32r if needed

    and_(ax, ay, az)
    or_(ax, ay, az)
    xor(ax, ay, az)
    add(ax, ay, az)
    sub(ax, ay, az)
    mull(ax, ay, az)

    l8ui(ax, ay, imm)
    l16ui(ax, ay, imm)
    l32i(ax, ay, imm)
    s8i(ax, ay, imm)
    s16i(ax, ay, imm)
    s32i(ax, ay, imm)
    l16si(ax, ay, imm)
    addi(ax, ay, imm)

    ball(ax, ay, label)
    bany(ax, ay, label)
    bbc(ax, ay, label)
    bbs(ax, ay, label)
    beq(ax, ay, label)
    bge(ax, ay, label)
    bgeu(ax, ay, label)
    blt(ax, ay, label)
    bnall(ax, ay, label)
    bne(ax, ay, label)
    bnone(ax, ay, label)

Upon entry to the assembly function the registers a0, a12, a13, a14 are
pushed to the stack and the stack pointer (a1) decreased by 16.  Upon
exit, these registers and the stack pointer are restored, and ret.n is
executed to return to the caller (caller address is in a0).

Note that the ABI for the Xtensa emitters is non-windowing.
2016-12-09 17:07:38 +11:00
Damien George ad297a1950 py: Allow inline-assembler emitter to be generic.
This patch refactors some code so that it is easier to integrate new
inline assemblers for different architectures other than ARM Thumb.
2016-12-09 17:06:21 +11:00
Damien George 45a6156dfd esp8266: Enable native emitter for Xtensa arch.
This patch allows esp8266 to use @micropython.native and
@micropython.viper function decorators.  By default the executable machine
code is written to the space at the end of the iram1 region.  The user can
call esp.set_native_code_location() to make the code go to flash instead.
2016-12-09 16:51:49 +11:00
Damien George 8e5aced1fd py: Integrate Xtensa assembler into native emitter.
The config option MICROPY_EMIT_XTENSA can now be enabled to target the
Xtensa architecture with @micropython.native and @micropython.viper
decorators.
2016-12-09 16:51:49 +11:00
Damien George fcac4b07f1 py/asmxtensa: Add low-level Xtensa assembler. 2016-12-09 16:51:49 +11:00
Damien George 81316fa411 py/asmbase: Add MP_PLAT_COMMIT_EXEC option for handling exec code.
If a port defines MP_PLAT_COMMIT_EXEC then this function is used to turn
RAM data into executable code.  For example a port may want to write the
data to flash for execution.  The function must return a pointer to the
executable data.
2016-12-09 16:51:49 +11:00
Damien George c8746e1e72 py: Move arch-specific assembler macros from emitnative to asmXXX.h. 2016-12-09 16:51:49 +11:00
Damien George c2713592bc py/emit.h: Remove long-obsolete declarations for cpython emitter. 2016-12-09 13:28:25 +11:00
Damien George adf3cb5081 extmod/modframebuf: Store underlying buffer object to prevent GC free. 2016-12-09 12:58:45 +11:00
Damien George 5e393007b9 esp8266/mpconfigport_512k: Disable framebuf module for 512k build.
The 512k build recently overflowed because of the newly-enabled uselect
module.  uselect is arguable more important than framebuf for small
devices so we disable framebuf to keep the 512k build within its limit.
2016-12-08 17:31:21 +11:00
Damien George 898d4c1217 extmod/modframebuf: Make framebuf implement the buffer protocol.
So that one can easily access the underlying data of the frame buffer, eg
to write the data out to a display.
2016-12-08 15:17:47 +11:00
Damien George ad166857bc esp8266: Refactor to use extmod implementation of software SPI class. 2016-12-08 14:41:58 +11:00
Damien George 1b6d94bccd stmhal: Refactor to use extmod implementation of software SPI class.
This is a pure refactoring (and simplification) of code so that stmhal
uses the software SPI class provided in extmod, for the machine.SPI
implementation.
2016-12-08 13:58:10 +11:00
Damien George 1eb3c66e91 extmod/machine_spi: Provide reusable software SPI class.
So long as a port defines relevant mp_hal_pin_xxx functions (and delay) it
can make use of this software SPI class without the need for additional
code.
2016-12-08 13:47:01 +11:00
Scott Shawcroft 6225b89c76 atmel-samd: Stop dumping gc info on collect.
Fixes #27.
2016-12-07 17:51:10 -08:00
Scott Shawcroft 1b819c6816 atmel-samd: Enable enumerate() adds 184 bytes.
Fixes #32.
2016-12-07 17:18:12 -08:00
Scott Shawcroft 0ae344841f atmel-samd & esp8266: Make sure pins are not already in use.
This prevents corrupting previous functional objects by stealing their pins
out from under them. It prevents this by ensuring that pins are in default
state before claiming them. It also verifies pins are released correctly and
reset on soft reset.

Fixes #4, instantiating a second class will fail.
Fixes #29, pins are now reset too.
2016-12-07 15:21:14 -08:00
Damien George d9c839742f stmhal/hal: Update HALCOMMITS due to change in f7 hal files. 2016-12-07 17:36:42 +11:00
Rami Ali db5a4e8f3c stmhal/boards/STM32F7DISC: Define LSE_STARTUP_TIMEOUT.
So it compiles with the latest F7 hal.
2016-12-07 17:31:21 +11:00
Rami Ali 6901649f54 stmhal: Declare and initialise PrescTables for F7 MCUs. 2016-12-07 17:31:09 +11:00
Rami Ali 44cb2ff7ab stmhal: Port of f4 hal commit 1d7fb82 to updated f7 hal. 2016-12-07 17:31:07 +11:00
Rami Ali 821863751f stmhal: Port of f4 hal commit 09de030 to updated f7 hal. 2016-12-07 17:31:05 +11:00
Rami Ali e1c6ed634f stmhal: Port of f4 hal commit c568a2b to updated f7 hal. 2016-12-07 17:30:44 +11:00
Rami Ali b9741cd8f8 stmhal/hal: Update ST32CubeF7 HAL files to V1.1.2.
These files originate from the STM32Cube_FW_F7_V1.5.0 software package
from ST.  Newlines are unixified and trailing whitespace is removed.
2016-12-07 17:28:33 +11:00
Rami Ali d9677f4098 stmhal/cmsis: Update STM32F7 CMSIS device include files to V1.1.2. 2016-12-07 17:27:40 +11:00
Damien George 080a78b15e py/compile: Simplify configuration of native emitter. 2016-12-07 11:17:17 +11:00
Scott Shawcroft bb9c751b50 atmel-samd: Correct fake date for FAT. Hopefully it'll be in 2016 now. 2016-12-05 11:15:46 -08:00