Commit Graph

755 Commits

Author SHA1 Message Date
dherrada 49cd9ac36e
Made extract_types return a more useful output 2020-05-15 13:29:41 -04:00
Scott Shawcroft 8ac3e7977f
Remove debug prints 2020-05-14 18:48:07 -07:00
Scott Shawcroft afc84c2fd1
Fix ulab, math and template. 2020-05-14 15:58:36 -07:00
dherrada 9613cdd184
First fully working version 2020-05-14 18:58:28 -04:00
dherrada a16edbc45c
First semi-functional version of extract_types.py 2020-05-14 18:22:07 -04:00
Scott Shawcroft 4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada c534a872a2
Merge branch 'master' into master 2020-05-12 12:26:02 -04:00
Scott Shawcroft 8c77252adf
Better handle //| and do __init__.c first. 2020-04-29 10:29:12 -07:00
Scott Shawcroft 46713482f4
Add verification script 2020-04-27 14:36:14 -07:00
Jeff Epler 1efa7076b0 build_memory_info: Report used, free, and total memory
.. intead of just free and total as before.
2020-04-27 15:43:13 -05:00
Jeff Epler 85a4dd939f build_memory_info: Drop support for old FLASH region name
This led to incorrect results about free memory in the stm and i.mx ports
2020-04-27 09:12:45 -05:00
Mike Weiblen 8afa9878fd tools: upload .bin and .uf2 for Itaca uChip boards
uChip boards are shipped with an Arduino bootloader.  The .bin files
can be installed without first installing a .uf2 bootloader.

See https://github.com/adafruit/circuitpython/issues/2798
2020-04-22 23:50:14 -06:00
stijn 84fa3312cf all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of
'force' in order not to alter the comments which use extra spaces after //
as a means of indenting text for clarity.
2020-04-23 11:24:25 +10:00
Damien George 6e2871df59 tools/check_code_size.sh: Remove unused script.
It's now replaced by tools/metrics.py.
2020-04-22 14:07:56 +10:00
Damien George 17dc86369f tools/metrics.py: Use OrderedDict when reading build log.
So that the output (eg of the diff command) always has the lines in the
same order.
2020-04-22 14:03:26 +10:00
Damien George 1cc24cd39a tools/metrics.py: Don't build mpy-cross if not needed by any ports.
To save build time.
2020-04-22 14:03:07 +10:00
Damien George a4423570e2 tools/metrics.py: Add option to diff to error if delta above threshold.
Useful for things like CI where the size check is automated.
2020-04-22 14:02:14 +10:00
stijn bcf01d1686 all: Fix implicit conversion from double to float.
These are found when building with -Wfloat-conversion.
2020-04-18 22:42:24 +10:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Lars Kellogg-Stedman 8797e3347f Fix maximum keycode in keyboard HID descriptor
The HID descriptor reported by circuitpython erroneously limited the
maximum keycode to 101, which prevented circuitpython from sending a
number of otherwise valid keycodes.

Closes #274
2020-04-11 10:02:18 -04:00
Jim Mussared 85858e72df py/objexcept: Allow compression of exception message text.
The decompression of error-strings is only done if the string is accessed
via printing or via er.args.  Tests are added for this feature to ensure
the decompression works.
2020-04-05 15:02:06 +10:00
Sean Cross 7959544322 tools: add dfu extension and mark litex as dfu
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 14:08:14 +08:00
Sean Cross e8db880e7f tools: rename dfu-suffix.py to dfu.py
dfu.py is unused in circuitpython, so rename dfu-suffix.py to replace it.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 13:03:53 +08:00
Sean Cross c91d364a58 tools: add dfu-suffix.py
This reproduces `dfu-suffix` from the `dfu-tools` package.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 11:36:57 +08:00
Sean Cross 56ef51d392 workflow: add litex_fomu to ci
This adds fomu and litex and fomu to build on ci.  It requires downloading
a riscv toolchain.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-31 10:21:00 +08:00
David Lechner 3dc324d3f1 tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py.  The basics/ subdirectory is excluded for now so we
aren't changing too much at once.

In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
2020-03-30 13:21:58 +11:00
Lars Kellogg-Stedman 3a0f64fc7a tools/pyboard.py: Add -d as an alias for --device. 2020-03-30 11:37:32 +11:00
Lars Kellogg-Stedman 1cf994c48b tools/pyboard.py: Support setting device/baudrate from shell env vars.
Allow defaults for --device and --baudrate to be set in the environment
using PYBOARD_DEVICE and PYBOARD_BAUDRATE.
2020-03-30 11:37:32 +11:00
Damien George 1a3e386c67 all: Remove spaces inside and around parenthesis.
Using new options enabled in the uncrustify configuration.
2020-03-28 23:36:44 +11:00
Damien George feb2577585 all: Remove spaces between nested paren and inside function arg paren.
Using new options enabled in the uncrustify configuration.
2020-03-25 00:39:46 +11:00
stijn 1b3e0e10b9 tools/codeformat.py: Include all msvc C code in auto-format. 2020-03-25 00:36:42 +11:00
Andrew Leech 38ccb4c643 tools/pydfu.py: Display any error strings from device/mboot. 2020-03-22 15:24:57 +11:00
Andrew Leech 2966d83a65 tools/pydfu.py: Add args for VID/PID & exit with cleaner error handling. 2020-03-22 13:33:04 +11:00
Lucian Copeland f81e2c0487 change CI target 2020-03-11 19:00:49 -04:00
David Lechner 8a4ce6b79a tools/codeformat.py: Eliminate need for sizeof fixup.
This eliminates the need for the sizeof regex fixup by rearranging things a
bit.  All other bitfields already use the parentheses around expressions
with sizeof, so one case is fixed by following this convention.

VM_MAX_STATE_ON_STACK is the only remaining problem and it can be worked
around by changing the order of the operands.
2020-03-11 14:34:40 +11:00
Damien George 554c01fc25 tools/metrics.py: Use check_call instead of run to error out on error. 2020-03-11 14:23:39 +11:00
MikeTeachman 8db5d2d1f1 tools/makemanifest.py: Fix build on Windows by adding .exe to mpy-cross.
When using a manifest on Windows the reference to mpy-cross compiler was
missing the .exe file extension, so add it when appropriate.

Also allow the default path to mpy-cross to be overridden by the (optional)
MICROPY_MPYCROSS environment variable, to allow full flexibility on any OS.
2020-03-05 10:26:31 +11:00
Dan Halbert 98a03fc935 upload bin and uf2 for arduino boards; remove unneeded build steps 2020-02-28 21:18:48 -05:00
Dan Halbert c24a4f7d66 change download prefix to https://downloads.circuitpython.org 2020-02-28 16:25:12 -05:00
Dan Halbert 1b8a4791f5 Download links now point to S3 via CloudFront 2020-02-28 14:57:32 -05:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 4b23e98fb0 tools/codeformat.py: Add formatter using uncrustify for C, black for Py.
This commit adds a tool, codeformat.py, which will reformat C and Python
code to fit a certain style.  By default the tool will reformat (almost)
all the original (ie not 3rd-party) .c, .h and .py files in this
repository.  Passing filenames on the command-line to codeformat.py will
reformat only those.  Reformatting is done in-place.

uncrustify is used for C reformatting, which is available for many
platforms and can be easily built from source, see
https://github.com/uncrustify/uncrustify.  The configuration for uncrustify
is also added in this commit and values are chosen to best match the
existing code style.  A small post-processing stage on .c and .h files is
done by codeformat.py (after running uncrustify) to fix up some minor
items:
- space inserted after * when used as multiplication with sizeof
- #if/ifdef/ifndef/elif/else/endif are dedented by one level when they are
  configuring if-blocks and case-blocks.

For Python code, the formatter used is black, which can be pip-installed;
see https://github.com/psf/black.  The defaults are used, except for line-
length which is set at 99 characters to match the "about 100" line-length
limit used in C code.

The formatting tools used and their configuration were chosen to strike a
balance between keeping existing style and not changing too many lines of
code, and enforcing a relatively strict style (especially for Python code).
This should help to keep the code consistent across everything, and reduce
cognitive load when writing new code to match the style.
2020-02-28 10:14:28 +11:00
Damien George a636837987 tools/makemanifest.py: Support freezing with empty list of mpy files.
Fixes issue #5655.
2020-02-20 10:41:50 +11:00
Scott Shawcroft a4d197a6ef
Update gc tracking instructions and gdb commands. 2020-02-11 17:05:43 -08:00
Michael Buesch 1604606238 tools/pyboard.py: Change shebang to use python3.
This script still works with Python 2 but Python 3 is recommended.
2020-02-01 00:06:26 +11:00
Michael Buesch 1cadb12d1c tools/pyboard.py: Use slice del instead of list.clear() for Py2 compat.
Python 2 does not have list.clear().
2020-02-01 00:05:29 +11:00
Michael Buesch 83afd48ad9 tools/pyboard.py: Add option --no-follow to detach after sending script.
This option makes pyboard.py exit as soon as the script/command is
successfully sent to the device, ie it does not wait for any output.  This
can help to avoid hangs if the board is being rebooted with --comman (for
example).

Example usage:

    $ python3 ./tools/pyboard.py --device /dev/ttyUSB0 --no-follow \
        --command 'import machine; machine.reset()'
2020-02-01 00:03:37 +11:00
Scott Shawcroft ac55143c64
Merge pull request #2556 from jepler/update-tools-uf2
tools/uf2: take new upstream commits
2020-01-29 11:43:40 -08:00
Jeff Epler 03cdc5ef76 tools/uf2: take new upstream commits 2020-01-28 13:48:40 -06:00
c0rejump 6db5cede06 tools/pydfu.py: Clean up syntax, update comments and docstrings.
Some parts of code have been aligned to increase readability.  In general
'' instead of "" were used wherever possible to keep the same convention
for entire file.  Import inspect line has been moved to the top according
to hints reported by pep8 tools.  A few extra spaces were removed, a few
missing spaces were added.  Comments have been updated, mostly in
"read_dfu_file" function.  Some other comments have been capitalized and/or
slightly updated.  A few docstrings were fixed as well.  No real code
changes intended.
2020-01-23 13:23:12 +11:00
Damien George a11e306227 tools: Add metrics.py script to build and compute port sizes/metrics. 2020-01-23 12:48:52 +11:00
Scott Shawcroft 7d8dac9211
Refine iMX RT memory layout and add three boards
Introduces a way to place CircuitPython code and data into
tightly coupled memory (TCM) which is accessible by the CPU in a
single cycle. It also frees up room in the corresponding cache for
intermittent data. Loading from external flash is slow!

The data cache is also now enabled.

Adds support for the iMX RT 1021 chip. Adds three new boards:
* iMX RT 1020 EVK
* iMX RT 1060 EVK
* Teensy 4.0

Related to #2492, #2472 and #2477. Fixes #2475.
2020-01-17 17:36:08 -08:00
arturo182 0068bafbb6 Add MIMXRT10XX port to release build 2020-01-06 21:33:44 +01:00
arturo182 13e0cba6f1 Add initial MIMXRT10XX port 2020-01-06 21:08:49 +01:00
Jason Neal de78a9e317 tools/gen-cpydiff.py: Adjust subsections to sentence case. 2020-01-06 22:16:18 +11:00
Jeff Epler a93475707e gen_display_resources: speed it up
It was intended that the `f.load_glyphs` line was fast and did most of
the work.  However, it actually didn't, because it's necessary to pass
in a code point by number, not by string.

Additionally, a little light layer violation is needed to make the check
for missing characters fast.  This used to be less important, as no
fonts had missing characters.  However, it would take an appreciable
length of time on the Korean translation when failing to find hundreds
of different code points.

Testing performed: built
build-circuitplayground_express_displayio/autogen_display_resources.c with ko
translation before and after change.  verified the file content was identical.
Time went from about 7s on my machine to way under 1 second.
2019-12-19 16:26:01 -06: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
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
Scott Shawcroft e9cb47ffbd
Merge pull request #2393 from dhalbert/increase-cpx-stack
Increase CPX stack size slightly
2019-12-17 14:35:37 -08:00
Jeff Epler 6a8efa6ef1 preprocess_frozen_modules: exclude subdirs of examples, docs, tests
.. this reclaims several kB on CPX, where we really need it.
2019-12-17 10:06:44 -06:00
Damien George 0bd7d1f7f0 py/persistentcode: Move loading of rodata/bss to before obj/raw-code.
This makes the loading of viper-code-with-relocations a bit neater and
easier to understand, by treating the rodata/bss like a special object to
be loaded into the constant table (which is how it behaves).
2019-12-17 13:22:11 +11:00
Dan Halbert 81581b345c Increase CPX stack size slightly 2019-12-16 17:25:22 -05:00
Damien George fc97d6d1b5 tools/mpy-tool.py: Raise exception if trying to freeze relocatable mpy. 2019-12-12 20:15:28 +11:00
Damien George abc642973d py/dynruntime: Add support for float API to make/get floats.
We don't want to add a feature flag to .mpy files that indicate float
support because it will get complex and difficult to use.  Instead the .mpy
is built using whatever precision it chooses (float or double) and the
native glue API will convert between this choice and what the host runtime
actually uses.
2019-12-12 20:15:28 +11:00
Damien George aad79adab7 tools/mpy_ld.py: Add new mpy_ld.py tool and associated build files.
This commit adds a new tool called mpy_ld.py which is essentially a linker
that builds .mpy files directly from .o files.  A new header file
(dynruntime.h) and makefile fragment (dynruntime.mk) are also included
which allow building .mpy files from C source code.  Such .mpy files can
then be dynamically imported as though they were a normal Python module,
even though they are implemented in C.

Converting .o files directly (rather than pre-linked .elf files) allows the
resulting .mpy to be more efficient because it has more control over the
relocations; for example it can skip PLT indirection.  Doing it this way
also allows supporting more architectures, such as Xtensa which has
specific needs for position-independent code and the GOT.

The tool supports targets of x86, x86-64, ARM Thumb and Xtensa (windowed
and non-windowed).  BSS, text and rodata sections are supported, with
relocations to all internal sections and symbols, as well as relocations to
some external symbols (defined by dynruntime.h), and linking of qstrs.
2019-12-12 20:15:28 +11:00
Damien George 27879844d2 tools/mpy-tool.py: Add ability to merge multiple .mpy files into one.
Usage:

    mpy-tool.py -o merged.mpy --merge mod1.mpy mod2.mpy

The constituent .mpy files are executed sequentially when the merged file
is imported, and they all use the same global namespace.
2019-12-12 20:15:28 +11:00
Damien George 360d972c16 py/nativeglue: Add new header file with native function table typedef. 2019-12-12 20:15:28 +11:00
Dan Halbert 8176325130 Merge remote-tracking branch 'adafruit/master' into ld-cleanup 2019-12-11 22:52:59 -05:00
Melissa LeBlanc-Williams d67a9a8271 Added PyPortal Pynt alias 2019-12-11 11:41:10 -08:00
Dan Halbert d9ca4c9a60 fix build failures 2019-12-10 22:39:44 -05:00
Dan Halbert 013c840862 working on all ports 2019-12-10 20:27:30 -05:00
Dan Halbert d628d2a261 atmel-samd working 2019-12-06 15:18:20 -05:00
Dan Halbert 40434d6919 wip 2019-12-05 22:45:53 -05:00
Damien George 7f24c29778 tools/mpy-tool.py: Support qstr linking when freezing Xtensa native mpy. 2019-11-28 13:11:51 +11:00
Melissa LeBlanc-Williams fe6ec9a7d4 Added Edgebadge alias for Pybadge 2019-11-19 14:53:58 -08:00
Yonatan Goldschmidt b2dd443d92 tools/makemanifest.py: Use sys.executable when invoking Python scripts.
So the version of Python used to run makemanifest.py is also used for the
sub-scripts.
2019-11-13 13:44:19 +11:00
Thea Flowers 67ff1c92f0
Allow boards to change the "CircuitPython" text in their USB interface description.
In cases where more than one board is connected to a single computer it can become pretty hard to figure out which board you're actually talking to. For example, if you have several MIDI-compatible boards they all show up as "CircuitPython MIDI". This change allows boards to replace the "CircuitPython" part of their USB descriptors with more specific text, for example, "CircuitPython Feather" or just "Feather". This will let folks more easily tell boards apart.

The new option is named `USB_INTERFACE_NAME` and is available in `mkconfigboard.mk`. For example:

```
USB_INTERFACE_NAME = "Feather"
```
2019-11-12 13:29:35 -08:00
Andrew Leech d2e6cfd8fd tools/makemanifest.py: Skip freezing unsupported files with warning. 2019-11-07 12:34:57 +11:00
Mirko Vogt 2f71d66ef7 tools/makemanifest.py: Follow symlinks when freezing linked directories.
While the new manifest.py style got introduced for freezing python code
into the resulting binary, the old way - where files and modules within
ports/*/modules where baked into the resulting binary - was still
supported via `freeze('$(PORT_DIR)/modules')` within manifest.py.

However behaviour changed for symlinked directories (=modules), as those
links weren't followed anymore.

This commit restores the original behaviour by explicitly following
symlinks within a modules/ directory
2019-11-06 11:41:06 +11:00
Damien George 36c9be6f60 tools/mpy-tool.py: Use "@progbits #" attribute for native xtensa code. 2019-11-04 15:31:42 +11:00
Jim Mussared 8ba963cfa3 tools/makemanifest.py: Eval relative paths w.r.t. current manifest file.
When loading a manifest file, e.g. by include(), it will chdir first to the
directory of that manifest.  This means that all file operations within a
manifest are relative to that manifest's location.

As a consequence of this, additional environment variables are needed to
find absolute paths, so the following are added: $(MPY_LIB_DIR),
$(PORT_DIR), $(BOARD_DIR).  And rename $(MPY) to $(MPY_DIR) to be
consistent.

Existing manifests are updated to match.
2019-10-21 23:01:41 +11:00
Dan Halbert 7b79ac3739 Parameterize linker script 2019-10-20 23:50:12 -04:00
Damien George e81f538e25 tools: Add mechanism to provide a manifest of frozen files.
This introduces a new build variable FROZEN_MANIFEST which can be set to a
manifest listing (written in Python) that describes the set of files to be
frozen in to the firmware.
2019-10-15 21:34:23 +11:00
Damien George 8e8cfa6f53 tools/make-frozen.py: Allow to run with no directory passed in.
In which case it will just emit empty frozen C definitions.
2019-10-15 21:33:49 +11:00
Damien George 23f0691fdd py/persistentcode: Make .mpy more compact with qstr directly in prelude.
Instead of encoding 4 zero bytes as placeholders for the simple_name and
source_file qstrs, and storing the qstrs after the bytecode, store the
qstrs at the location of these 4 bytes.  This saves 4 bytes per bytecode
function stored in a .mpy file (for example lcd160cr.mpy drops by 232
bytes, 4x 58 functions).  And resulting code size is slightly reduced on
ports that use this feature.
2019-10-15 16:56:27 +11:00
Kamil Tomaszewski 5cf66dfec2 Add cxd56 to build_board_info 2019-10-11 12:09:51 +02:00
Kamil Tomaszewski 810d802ca8 Fix invalid syntax error 2019-10-08 09:52:00 +02:00
kamtom480 f6e553f89f
Merge branch 'master' into circuitpython-number-endpoint 2019-10-08 09:41:29 +02:00
Kamil Tomaszewski 79096dbacd Add the specific endpoint names 2019-10-08 09:35:04 +02:00
Kamil Tomaszewski 29844db332 Use boolean type for renumber_endpoints 2019-10-08 09:26:02 +02:00
Kamil Tomaszewski a020f203dc Update usb_descriptor submodule 2019-10-07 13:44:05 +02:00
Kamil Tomaszewski badf32e88d Add HID OUT 2019-10-07 13:40:44 +02:00
Kamil Tomaszewski 1205d3e305 Add validation 2019-10-07 12:31:42 +02:00
Kamil Tomaszewski 7aefcc449a Add an alternative way to number the USB endpoints
Two options available:
- relative numbering (USB_RELATIVE_EP_NUM = 1) - default
- absolute numbering (USB_RELATIVE_EP_NUM = 0) - new!
2019-10-07 12:31:42 +02:00
Damien George 9adedce42e py: Add new Xtensa-Windowed arch for native emitter.
Enabled via the configuration MICROPY_EMIT_XTENSAWIN.
2019-10-05 13:44:53 +10:00
Kamil Tomaszewski ef42abb818 Add a way to change max packet size for MSC 2019-10-04 13:49:33 +02:00
Dan Halbert 05038ea1e5 Update tinyusb to fix gamepad;add HID OUT interface descriptor 2019-10-01 15:57:16 -04:00
Damien George c8c0fd4ca3 py: Rework and compress second part of bytecode prelude.
This patch compresses the second part of the bytecode prelude which
contains the source file name, function name, source-line-number mapping
and cell closure information.  This part of the prelude now begins with a
single varible length unsigned integer which encodes 2 numbers, being the
byte-size of the following 2 sections in the header: the "source info
section" and the "closure section".  After decoding this variable unsigned
integer it's possible to skip over one or both of these sections very
easily.

This scheme saves about 2 bytes for most functions compared to the original
format: one in the case that there are no closure cells, and one because
padding was eliminated.
2019-10-01 12:26:22 +10:00
Damien George b5ebfadbd6 py: Compress first part of bytecode prelude.
The start of the bytecode prelude contains 6 numbers telling the amount of
stack needed for the Python values and exceptions, and the signature of the
function.  Prior to this patch these numbers were all encoded one after the
other (2x variable unsigned integers, then 4x bytes), but using so many
bytes is unnecessary.

An entropy analysis of around 150,000 bytecode functions from the CPython
standard library showed that the optimal Shannon coding would need about
7.1 bits on average to encode these 6 numbers, compared to the existing 48
bits.

This patch attempts to get close to this optimal value by packing the 6
numbers into a single, varible-length unsigned integer via bit-wise
interleaving.  The interleaving scheme is chosen to minimise the average
number of bytes needed, and at the same time keep the scheme simple enough
so it can be implemented without too much overhead in code size or speed.
The scheme requires about 10.5 bits on average to store the 6 numbers.

As a result most functions which originally took 6 bytes to encode these 6
numbers now need only 1 byte (in 80% of cases).
2019-10-01 12:26:22 +10:00
Scott Shawcroft 3ff53a64cb
Merge pull request #2181 from tannewt/update_frozen
Update frozen modules.
2019-09-30 14:23:05 -07:00
Scott Shawcroft c12c837abd
Improve frozen prep to skip example subdirectories 2019-09-30 13:37:58 -07:00
Scott Shawcroft 060e81ded0
Fail when boards are missing too 2019-09-30 12:09:29 -07:00
Damien George 5716c5cf65 py/persistentcode: Bump .mpy version to 5.
The bytecode opcodes have changed (there are more, and they have been
reordered).
2019-09-26 16:39:37 +10:00
Josh Lloyd 7d58a197cf py: Rename MP_QSTR_NULL to MP_QSTRnull to avoid intern collisions.
Fixes #5140.
2019-09-26 16:04:56 +10:00
Damien George 1f7202d122 py/bc: Replace big opcode format table with simple macro. 2019-09-26 15:27:11 +10:00
Damien George 5889cf58db py/bc0: Order opcodes into groups based on their size and format. 2019-09-26 15:27:10 +10:00
Scott Shawcroft 54b03a7476
When uploading release assets, ignore those already uploaded. 2019-09-14 13:05:52 -07:00
Dan Halbert 8f6267115c Renumber only chosen USB interfaces; fix HID report ids 2019-09-09 15:12:06 -04:00
Damien George c69f58e6b9 tools/mpy-tool.py: Fix freezing of non-bytecode funcs with settrace.
Only bytecode functions can be profiled at this stage.  Native functions
(eg inline assembler) may not even have a valid prelude.

Fixes issue #5075.
2019-09-06 23:55:15 +10:00
Scott Shawcroft 5e754f1694
Merge pull request #2121 from tannewt/markdown_autolink
Add support for converting autolinks to BBCode
2019-09-05 11:28:24 -07:00
Hierophect 96d1711296 Merge remote-tracking branch 'upstream/master' into stm32-ci-workflow 2019-09-05 13:36:23 -04:00
Dan Halbert f3af2a6fb7 Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac 2019-09-04 21:56:13 -04:00
Dan Halbert 195de97c67 use only one endpoint pair for MSC except on SAMD21 2019-09-04 21:45:16 -04:00
Scott Shawcroft dab345ce58
Add support for converting autolinks to BBCode 2019-09-04 17:15:30 -07:00
Scott Shawcroft ff3d04f4d1
Fix website updater for other users.
It broke with adafruit-blinka but works now.
2019-09-04 16:50:13 -07:00
Hierophect e92a21cb0a minor text fixes 2019-09-04 18:40:44 -04:00
Hierophect 0cd5f4c12b remove redundant exclusion inclusion 2019-09-04 18:28:27 -04:00
Hierophect e6f8ad65c1 add stm32 port to workflow 2019-09-04 18:10:37 -04:00
Dan Halbert 95a5a57f94 Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac 2019-09-04 00:12:09 -04:00
Dan Halbert 94ba027544 simpler generation of HID device tables 2019-09-03 21:16:14 -04:00
Scott Shawcroft 949f8761b8
Add .hidden to TileGrid and Group
This allows for one to preserve ordering within a Group while
hiding something temporarily.

Fixes #1688
2019-09-03 16:15:27 -07:00
Dan Halbert 42f5edbd33 WIP 2019-09-03 14:44:46 -04:00
Damien George b29fae0c56 py/bc: Fix size calculation of UNWIND_JUMP opcode in mp_opcode_format.
Prior to this patch mp_opcode_format would calculate the incorrect size of
the MP_BC_UNWIND_JUMP opcode, missing the additional byte.  But, because
opcodes below 0x10 are unused and treated as bytes in the .mpy load/save
and freezing code, this bug did not show any symptoms, since nested unwind
jumps would rarely (if ever) reach a depth of 16 (so the extra byte of this
opcode would be between 0x01 and 0x0f and be correctly loaded/saved/frozen
simply as an undefined opcode).

This patch fixes this bug by correctly accounting for the additional byte.
        .
2019-09-02 13:30:16 +10:00
Damien George 4691b43c8a tools/mpy-tool.py: Add initial support for frozen with settrace. 2019-08-30 16:49:13 +10:00
Milan Rossa 498e35219e tests: Add tests for sys.settrace feature. 2019-08-30 16:48:22 +10:00
Scott Shawcroft 6106909c10
Swap the CI to GitHub Actions from Travis 2019-08-27 19:53:54 -07:00
Scott Shawcroft 70680d5b22
EPaper displays work mostly. 2019-08-22 14:08:33 -07:00
Jim Mussared 0bd1eb80ff qemu-arm: Add testing of frozen native modules.
- Split 'qemu-arm' from 'unix' for generating tests.
- Add frozen module to the qemu-arm test build.
- Add test that reproduces the requirement to half-word align native
  function data.
2019-08-20 15:14:08 +10:00
Jim Mussared 4ab5156c01 tools/mpy-tool.py: Force native func alignment to halfword/word on ARM.
This is necessary for ARMV6 and V7.  Without this change, calling a frozen
native/viper function that is misaligned will crash.
2019-08-20 15:13:17 +10:00
Dan Halbert 1a818c60cb make translate again; make check-translate passes 2019-08-19 10:25:36 -04:00
Scott Shawcroft 26f64dd8ec
Merge remote-tracking branch 'adafruit/4.1.x' into merge_in_410 2019-08-05 17:53:08 -07:00
sommersoft 8eab946c5b
Merge pull request #2003 from C47D/travis_check_new_boards
Add check to travis to make sure new boards are built, fix #1886
2019-07-28 22:41:59 -05:00
C47D 7e4d7a5373 [travis check new boards] Fail in case of any missing boards 2019-07-25 16:11:45 -05:00
Damien George 4d94fae833 tools/pyboard.py: Add filesystem commands to ls/cat/cp/rm remote files.
Use "-f" to select filesystem mode, followed by the command to execute.
Optionally put ":" at the start of a filename to indicate that it's on the
remote device, if it would otherwise be ambiguous.

Examples:

    $ pyboard.py -f ls
    $ pyboard.py -f cat main.py
    $ pyboard.py -f cp :main.py .   # get from device
    $ pyboard.py -f cp main.py :    # put to device
    $ pyboard.py -f rm main.py
2019-07-25 15:56:01 +10:00
C47D 8864cefba6 [travis check new boards] missing_boards as set 2019-07-23 13:03:29 -05:00
C47D c316231dd2 [travis check new boards] Do not end test if there are missing boards 2019-07-23 13:02:07 -05:00
sommersoft b630e561a7
exclude aliased boards from 'get_board_mapping()' 2019-07-21 12:13:13 -05:00
Carlos d1fecf5025 Fix missing module sh and remove unused module re 2019-07-20 01:08:22 -05:00
Scott Shawcroft 6797ec6ed3
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors.

Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly
useful for the SSD1306.

Fixes #1828. Fixes #1956
2019-07-19 16:06:11 -07:00
C47D 22c265b170 [travis check new boards] Reduce code logic to exit with failure 2019-07-19 16:54:42 -05:00
C47D fc1594104b [travis new boards check] Exit with failure if a board in info isn't in travis 2019-07-19 12:59:04 -05:00
C47D ae41bb369f [travis new boards check] sort both lists of boards 2019-07-19 12:36:13 -05:00
C47D b279d6b335 [travis new boards check] We now have two lists that contain the boards based on board_info and TRAVIS_BOARDS 2019-07-19 12:11:16 -05:00
C47D a1db6c4379 [Draft] Add check to travis to make sure new boards are built, fix #1886 2019-07-19 10:01:35 -05:00
Scott Shawcroft 4a6bdb6fe4
Track a dirty area for in-memory bitmaps
This fixes the bug that bitmap changes do not cause screen updates
and optimizes the refresh when the bitmap is simply shown on the
screen. If the bitmap is used in tiles, then changing it will
cause all TileGrids using it to do a full refresh.

Fixes #1981
2019-07-18 16:47:28 -07:00
Tavish Naruka 7f97cc1940 Generate .hex for Blip. 2019-07-08 14:16:31 +05:30
Damien George f073f2b543 tools: Add uf2conv.py from Microsoft/uf2 repository.
Repository https://github.com/Microsoft/uf2 commit
19615407727073e36d81bf239c52108ba92e7660
2019-07-01 17:18:44 +10:00
Radomir Dopieralski 7c908b08ee Use FONTBOUNDINGBOX for font metrics
Instead of iterating over all the glyphs and calculating the maximum
width and height, use the FONTBOUNDINGBOX to determine the size of a
tile for terminalio.

This works better with fonts such as generated by FontForge, that don't
include the empty space in the glyph bitmap itself. It also lets the
font author specify vertical spacing they want.

I only tested this with the default font and with one I generated with
FontForge.
2019-06-30 01:10:47 +02:00
Jun Wu b152bbddd1 py: Define EMIT_MACHINE_CODE as EMIT_NATIVE || EMIT_INLINE_ASM.
The combination MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM is used in
many places, so define a new macro for it.
2019-06-28 13:54:45 +10:00
Scott Shawcroft eb21fc3e31
Add partial display update support.
Different operations to the display tree have different costs. Be
aware of these costs when optimizing your code.
* Changing tiles indices in a TileGrid will update an area
covering them all.
* Changing a palette will refresh every object that references it.
* Moving a TileGrid will update both where it was and where it moved to.
* Adding something to a Group will refresh each individual area it
covers.
* Removing things from a Group will refresh one area that covers all
previous locations. (Not separate areas like add.)
* Setting a new top level Group will refresh the entire display.

Only TileGrid moves are optimized for overlap. All other overlaps
cause sending of duplicate pixels.

This also adds flip_x, flip_y and transpose_xy to TileGrid. They
change the direction of the pixels but not the location.

Fixes #1169. Fixes #1705. Fixes #1923.
2019-06-12 11:32:39 -07:00
Dan Halbert 4fc189b60c Merge latest 4.0.x fixes into master 2019-06-11 16:16:29 -04:00
Dan Halbert 5164a6eb26 forgot tools/git-checkout-latest-tag.sh in PR #1909 2019-06-11 15:22:32 -04:00
Damien George 9d3031cc9d tools/mpy-tool.py: Fix linking of qstr objects in native ARM Thumb code.
Previously, when linking qstr objects in native code for ARM Thumb, the
index into the machine code was being incremented by 4, not 8.  It should
be 8 to account for the size of the two machine instructions movw and movt.
This patch makes sure the index into the machine code is incremented by the
correct amount for all variations of qstr linking.

See issue #4829.
2019-06-11 11:36:39 +10:00
Damien George faf3d3e9e9 tools/mpy-tool.py: Fix linking qstrs in native code, and multiple files.
Fixes errors in the tool when 1) linking qstrs in native ARM-M code; 2)
freezing multiple files some of which use native code and some which don't.

Fixes issue #4829.
2019-06-04 22:21:01 +10:00
Dan Halbert 4e85c1ef91 Implement forced clean builds for boards so designated.
Mark boards that set CFLAGS_INLINE_LIMIT for particular langauges as needing clean builds.

Fixes #1910.
2019-05-24 15:32:24 -04:00
Scott Shawcroft 3fad7de8db
Rework the pixel computation to use areas
This changes the displayio pixel computation from per-pixel to
per-area. This is precursor work to updating portions of the screen
(#1169). It should provide mild speedups because bounds checks are
done once per area rather than once per pixel. Filling by area also
allows TileGrid to maintain a row-associative fill pattern even when
the display's refresh is orthogonal to it.
2019-05-21 17:41:06 -07:00
Damien George 993ca572ca tools/upip.py: Add support for multiple index URLs with custom default.
The user can now select their own package index by either passing the "-i"
command line option, or setting the upip.index_urls variable (before doing
an install).

The https://micropython.org/pi package index hosts packages from
micropython-lib and will be searched first when installing a package.  If a
package is not found here then it will fallback to PyPI.
2019-05-15 15:46:16 +10:00
Damien George 56f6ceba7f tools/pyboard.py: Don't accumulate output data if data_consumer used.
Prior to this patch, when a lot of data was output by a running script
pyboard.py would try to capture all of this output into the "data"
variable, which would gradually slow down pyboard.py to the point where it
would have large CPU and memory usage (on the host) and potentially lose
data.

This patch fixes this problem by not accumulating the data in the case that
the data is not needed, which is when "data_consumer" is used.
2019-04-25 13:24:32 +10:00
Scott Shawcroft 796fc3f5ab
Update font location and shrink a bunch of builds 2019-04-12 15:25:48 -07:00
hexthat f36572f322
Rename tools/new-ter-u12n.bdf to tools/default-font/new-ter-u12n.bdf 2019-04-12 12:55:13 -07:00
hexthat b4509362ef
Add files via upload 2019-04-12 12:55:13 -07:00
Scott Shawcroft 1eb1430d82
Add alias support for unique board revs
This way we can list different board styles and track their
downloads without a completely new binary.

Fixes #1673
2019-04-11 11:25:04 -07:00
Damien George 74ed06828f tools/mpy-tool.py: Fix init of QStrWindow, and remove unused variable.
The qstr window size is not log-2 encoded, it's just the actual number (but
in mpy-tool.py this didn't lead to an error because the size is just used
to truncate the window so it doesn't grow arbitrarily large in memory).

Addresses issue #4635.
2019-04-08 15:24:24 +10:00
Damien George 643d2a0e86 tools/mpy-tool.py: Adjust use of super() to make it work with Python 2.
Fixes the regression introduced in ea3c80a514
2019-04-08 11:21:18 +10:00
Dan Halbert 7798eb983d updated usb_descriptor submodule per @hathach 2019-04-05 11:52:38 -04:00
Scott Shawcroft 6fcda1dec4
Support multi-byte values with Bitmap
It also corrects the behavior of single byte values.

Fixes #1744
2019-04-04 12:50:35 -07:00
Scott Shawcroft bbed7b813b
Add script to convert release notes from Markdown 2019-03-30 23:31:11 -07:00
rhubarbdog 869a8b70ce tools/pyboard.py: Add missing line from example usage comments. 2019-03-26 16:52:41 +11:00
Scott Shawcroft 5e2fec714c
Move Glyph and BuiltinFont into fontio
It was confusing in displayio.

Fixes #1662
2019-03-19 16:22:09 -07:00
Scott Shawcroft cac9da37f9
Update board info build to handle top level list. 2019-03-11 17:07:15 -07:00
Andrew Leech 89ff506513 py: Update and rework build system for including external C modules.
How to use this feature is documented in docs/develop/cmodules.rst.
2019-03-08 22:58:42 +11:00
Ayke van Laethem 2e516074da py: Implement a module system for external, user C modules.
This system makes it a lot easier to include external libraries as static,
native modules in MicroPython.  Simply pass USER_C_MODULES (like
FROZEN_MPY_DIR) as a make parameter.
2019-03-08 22:49:00 +11:00
Damien George 6e11d86318 tools/upip.py: Use "raise arg" instead of no-arg raise form, for native. 2019-03-08 16:51:09 +11:00
Damien George 9a5f92ea72 py/persistentcode: Bump .mpy version to 4. 2019-03-08 15:53:05 +11:00
Damien George ea3c80a514 tools/mpy-tool.py: Add support for freezing native code.
This adds support to freeze .mpy files that contain native code blocks.
2019-03-08 15:53:05 +11:00
Damien George 636ed0ff8d py/emitglue: Remove union in mp_raw_code_t to combine bytecode & native. 2019-03-08 15:53:04 +11:00
Dan Halbert b1d194505e Build both BIN and UF2 for RFM boards 2019-03-05 13:11:10 -05:00
Damien George 4f0931b21f py/persistentcode: Define static qstr set to reduce size of mpy files.
When encoded in the mpy file, if qstr <= QSTR_LAST_STATIC then store two
bytes: 0, static_qstr_id.  Otherwise encode the qstr as usual (either with
string data or a reference into the qstr window).

Reduces mpy file size by about 5%.
2019-03-05 16:32:05 +11:00
Damien George 992a6e1dea py/persistentcode: Pack qstrs directly in bytecode to reduce mpy size.
Instead of emitting two bytes in the bytecode for where the linked qstr
should be written to, it is now replaced by the actual qstr data, or a
reference into the qstr window.

Reduces mpy file size by about 10%.
2019-03-05 16:27:34 +11:00
Damien George 5996eeb48f py/persistentcode: Add a qstr window to save mpy files more efficiently.
This is an implementation of a sliding qstr window used to reduce the
number of qstrs stored in a .mpy file.  The window size is configured to 32
entries which takes a fixed 64 bytes (16-bits each) on the C stack when
loading/saving a .mpy file.  It allows to remember the most recent 32 qstrs
so they don't need to be stored again in the .mpy file.  The qstr window
uses a simple least-recently-used mechanism to discard the least recently
used qstr when the window overflows (similar to dictionary compression).
This scheme only needs a single pass to save/load the .mpy file.

Reduces mpy file size by about 25% with a window size of 32.
2019-03-05 16:25:07 +11:00
Damien George 5a2599d962 py: Replace POP_BLOCK and POP_EXCEPT opcodes with POP_EXCEPT_JUMP.
POP_BLOCK and POP_EXCEPT are now the same, and are always followed by a
JUMP.  So this optimisation reduces code size, and RAM usage of bytecode by
two bytes for each try-except handler.
2019-03-05 16:09:58 +11:00
Scott Shawcroft 785edf719e
Update translations based on git history 2019-02-22 15:28:29 -08:00
Scott Shawcroft 2a5a735d94
Add utility to remerge translations 2019-02-22 13:06:40 -08:00
Scott Shawcroft c17f147be9
A variety of displayio improvements
This changes a number of things in displayio:
* Introduces BuiltinFont and Glyph so the built in font can be used by libraries. For boards with
  a font it is available as board.TERMINAL_FONT. Fixes #1172
* Remove _load_row from Bitmap in favor of bitmap[] access. Index can be x/y tuple or overall index. Fixes #1191
* Add width and height properties to Bitmap.
* Add insert and [] access to Group. Fixes #1518
* Add index param to pop on Group.
* Terminal no longer takes unicode character info. It takes a BuiltinFont instead.
* Fix Terminal's handling of [###D vt100 commands used when up arrowing into repl history.
* Add x and y positions to Group plus scale as well.
* Add bitmap accessor for BuiltinFont
2019-02-11 20:55:05 -08:00
Scott Shawcroft 3af57f3e92
Fix up heap analysis for dynamic heap location 2019-02-01 16:03:37 -08:00
Scott Shawcroft ec03887040
Fix hallowing and nrf builds 2019-01-31 11:42:15 -08:00
Scott Shawcroft 1a1dbef992
Hook up the terminal based on the first display. 2019-01-31 11:42:14 -08:00
Scott Shawcroft 590e029198
Begin font parsing and packing for terminal 2019-01-31 11:42:13 -08:00
Scott Shawcroft d30bdd4cb3
Fix board info script to skip removed boards. 2019-01-24 10:22:14 -08:00
Gregory P. Smith 7296b647ef Add MDK nRF52840 MDK USB Dongle support.
Adds support for https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/.

A cheap nRF52840 USB stick with optional headers, very Trinket and Itsy like.
2019-01-15 01:37:22 -08:00
vgoodwinv c1cfe5f5f0
Update build_release_files.py 2019-01-14 21:35:21 -05:00
vgoodwinv d1204c7cf3
Update build_release_files.py 2019-01-14 21:27:14 -05:00
vgoodwinv 6962c04f66
Update build_release_files.py
added language directories under exist board directories for #1441
2019-01-14 21:21:48 -05:00
Scott Shawcroft b5f35b82e1
Remove from build info too 2019-01-14 13:30:09 -08:00
Dan Halbert 50ee5ef24c merge translations; add bleio comments; fix minor sphinx issues in midi 2019-01-10 21:12:17 -05:00
Dan Halbert 516d7da641
Merge pull request #1449 from tannewt/midi
Add USB MIDI support for SAMD and nRF.
2019-01-10 19:49:33 -05:00
Scott Shawcroft 3dd59c3d5f
Polish thanks to Dan's feedback 2019-01-10 11:00:40 -08:00
Scott Shawcroft b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00
Dan Halbert d41ed768dc Fix sphinx build issues; add better travis fold reporting; update author info 2019-01-09 16:22:19 -05:00
Dan Halbert e47decbdc5 improve travis fold status reporting; fix sphinx build; fix sphinx errors 2019-01-09 13:32:45 -05:00
Dan Halbert b6b5ed9c89 Remove nRF52832 support 2018-12-30 22:49:20 -05:00
Dave Hylands c932639063 tools/pydfu.py: Fix regression so tool runs under Python 2 again.
Under python3 (tested with 3.6.7) bytes with a list of integers as an
argument returns a different result than under python 2.7 (tested with
2.7.15rc1) which causes pydfu.py to fail when run under 2.7.  Changing
bytes to bytearray makes pydfu work properly under both Python 2.7 and
Python 3.6.
2018-12-30 01:20:48 +11:00
Carl Karsten 5f3a259827 Sync with micropython. closes #1414 2018-12-20 18:44:39 -06:00
Dave Hylands 39eef27083 tools/mpy-tool.py: Fix build error when no qstrs present in frozen mpy.
If you happen to only have a really simple frozen file that doesn't contain
any new qstrs then the generated frozen_mpy.c file contains an empty
enumeration which causes a C compile time error.
2018-12-15 14:36:08 +11:00
Damien George 814d580a15 tools/mpy-tool.py: Fix calc of opcode size for opcodes with map caching.
Following an equivalent fix to py/bc.c.  The reason the incorrect values
for the opcode constants were not previously causing a bug is because they
were never being used: these opcodes always have qstr arguments so the part
of the code that was comparing them would never be reached.

Thanks to @malinah for finding the problem and providing the initial patch.
2018-12-13 01:26:55 +11:00
Scott Shawcroft b1c882a26b
Default nrf boards to UF2 2018-12-11 11:51:07 -08:00
Scott Shawcroft 96e65fa641
Fix build board info for python3.5 2018-12-10 13:17:05 -08:00
Scott Shawcroft 7da85f5a4f
Strip a newline from the version tag. 2018-12-10 10:13:09 -08:00
Scott Shawcroft 06c4938120
Build UF2s for the particle boards 2018-12-07 17:37:25 -08:00
Dan Halbert 58f230d632 make sure travis sees some output in time 2018-12-05 15:01:58 -05:00
Scott Shawcroft b0da9ac780
Don't capture output 2018-12-04 18:20:51 -08:00
Scott Shawcroft 15c1fc873c
Add particle boards, fix cp32 and try to speed up atmel build 2018-12-04 18:20:48 -08:00
Scott Shawcroft df18d22a93
Capture stderr as well and work on nRF build 2018-11-30 12:59:05 -08:00
Scott Shawcroft cf70dc4f1c
Fix BLE build 2018-11-30 11:53:33 -08:00
Scott Shawcroft 56345ff997
A few tweaks based on review feedback 2018-11-30 10:58:27 -08:00
Scott Shawcroft 9d07e95351
Add support for adding release info into adafruit/circuitpython-org
This also changes the build script to python with better output.
2018-11-30 00:30:57 -08:00
Scott Shawcroft 913b513929
Merge pull request #1357 from ElectronicCats/add-electroniccats-catwan-usbstick
Added board Electronic Cats CatWAN USB Stick
2018-11-27 11:58:26 -08:00
Damien George 4f25a8b6a4 tools/pydfu.py: Improve DFU reset, and auto-detect USB transfer size.
A DFU device must be in the idle state before it can be programmed, and
this requires either clearing the status or aborting, depending on its
current state.  Code is added to do this.  And the USB transfer size is now
automatically detected so devices with a size less than 2048 bytes work
correctly.
2018-11-27 16:19:27 +11:00
sabas1080 a053eb2205 auto-built and documentation 2018-11-26 14:51:04 -06:00
Scott Shawcroft 0c55ddf0fc
Update to Xenial on Travis 2018-11-26 11:53:03 -08:00
Scott Shawcroft 43f7ca7985
Incorporate feedback:
* Clean up board defines.
* Add flush on eject and stay ejected.
* Swith back to NONE protocol for CDC.
2018-11-09 11:33:56 -08:00
Scott Shawcroft 9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert bd79c0c0de
Merge pull request #1295 from ElectronicCats/mkr1300
Add board MKR1300 by Arduino
2018-10-26 20:15:20 -04:00
sabas1080 ba98d4ce9c minor changes in auto-built 2018-10-25 16:11:49 -05:00
Dan Halbert 09c44743b0
Merge pull request #1282 from tannewt/frozen_debug
Add debug info to the generated frozen_mpy.c
2018-10-23 12:32:45 -04:00
Scott Shawcroft 554f82fe9b
Merge pull request #1286 from klardotsh/topic-nrf52840-mdk
Add support for MakerDiary nRF52840 MDK board
2018-10-22 17:47:14 -07:00
sabas1080 37d784bcdc add auto-built by Travis mkr1300 2018-10-22 19:42:40 -05:00
Josh Klar 4a40919228
Make sure port is built as an NRF hex correctly 2018-10-20 03:36:55 -07:00
Martin Dybdal 7795b2e5c3 tools/pyboard.py: In TelnetToSerial.close replace try/except with if.
Some Python linters don't like unconditional except clauses because they
catch SystemExit and KeyboardInterrupt, which usually is not the intended
behaviour.
2018-10-19 23:46:10 +11:00
Scott Shawcroft b4dcbb79b2
Add back printing out code info. Whoops! 2018-10-18 14:23:17 -07:00
Scott Shawcroft 4f9c8b7361
Add debug info to the generated frozen_mpy.c
It adds size info and uses macros for byte code to make it more
readable.
2018-10-17 17:45:47 -07:00
sabas1080 6a1a2c7c7b add auto-built by Travis 2018-10-16 13:51:37 -05:00
Scott Shawcroft 623f8d3b8c
Don't freeze the tests directory 2018-10-05 15:14:34 -07:00
Andrew Leech a2703649ea tools/pydfu: Workaround stdio flush error on Windows with Python 3.6.
There appears to be an issue on Windows with CPython >= 3.6,
sys.stdout.flush() raises an exception:

    OSError: [WinError 87] The parameter is incorrect

It works fine to just catch and ignore the error on the flush line.  Tested
on Windows 10 x64 1803 (Build 17134.228), Python 3.6.4 amd64.
2018-09-21 11:57:24 +10:00
Dan Halbert cf3b40207e add pca10059 properly to build_adafruit_bins.sh; modernize that script; update translations (again) 2018-09-18 22:21:29 -04:00
Dan Halbert bc510e714f merge 3.0.2 to master 2018-09-18 15:38:12 -04:00
ladyada 14ad7d31db automate builds 2018-09-14 10:38:06 -04:00
Scott Shawcroft e29cbf694b
Auto-build grandcentral 2018-09-07 10:52:30 -07:00
Dan Halbert de9f9e8504 upload .uf2 for nrf52840 boards 2018-08-29 15:38:33 -04:00
Dan Halbert 85df32907f rename nrf boards to feather_nrf52832 and feather_nrf52840_express 2018-08-21 18:45:37 -04:00
Dan Halbert 1768057e87
add HalloWing 2018-08-20 10:52:24 -07:00
Scott Shawcroft de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Martin Dybdal 5ed8226e02 tools/pyboard.py: Change base class of PyboardError to Exception.
Following standard practice for defining custom exceptions.
2018-08-10 16:23:38 +10:00
Scott Shawcroft 94c5ceab36
Initial SAMR board revision. 2018-08-09 05:36:46 -07:00
Scott Shawcroft 933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Ayke van Laethem 0d7a088039 tools/pyboard: Run exec: command as a string.
The Python documentation recommends to pass the command as a string when
using Popen(..., shell=True).  This is because "sh -c <string>" is used to
execute the command and additional arguments after the command string are
passed to the shell itself (not the executing command).

https://docs.python.org/3.5/library/subprocess.html#subprocess.Popen
2018-08-04 15:45:23 +10:00
Rich Barlow 6e5a40cf3c tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen mods
The first dynamic qstr pool is double the size of the 'alloc' field of
the last const qstr pool. The built in const qstr pool
(mp_qstr_const_pool) has a hardcoded alloc size of 10, meaning that the
first dynamic pool is allocated space for 20 entries. The alloc size
must be less than or equal to the actual number of qstrs in the pool
(the 'len' field) to ensure that the first dynamically created qstr
triggers the creation of a new pool.

When modules are frozen a second const pool is created (generally
mp_qstr_frozen_const_pool) and linked to the built in pool. However,
this second const pool had its 'alloc' field set to the number of qstrs
in the pool. When freezing a large quantity of modules this can result
in thousands of qstrs being in the pool. This means that the first
dynamically created qstr results in a massive allocation. This commit
sets the alloc size of the frozen qstr pool to 10 or less (if the number
of qstrs in the pool is less than 10). The result of this is that the
allocation behaviour when a dynamic qstr is created is identical with an
without frozen code.

Note that there is the potential for a slight memory inefficiency if the
frozen modules have less than 10 qstrs, as the first few dynamic
allocations will have quite a large overhead, but the geometric growth
soon deals with this.
2018-08-01 18:59:31 +10:00
Scott Shawcroft a6d94b6845
Merge pull request #1068 from dhalbert/micropython-25ae98f-merge
Micropython 25ae98f merge
2018-07-30 12:33:44 -07:00
Dan Halbert fbe98ff9a9
Merge pull request #1071 from dhalbert/3.x-hallowing
add HalloWing
2018-07-29 20:24:47 -04:00
Dan Halbert 680597547c add HalloWing 2018-07-29 19:22:16 -04:00
Dan Halbert 2e260a0eab Merge remote-tracking branch 'adafruit/master' into micropython-25ae98f-merge 2018-07-28 14:13:54 -04:00
roland 11a38d5dc5 tools/pydfu.py: Make the DFU tool work again with Python 2.
This patch will work for both Python 2 and 3.
2018-07-27 16:53:50 +10:00
Scott Shawcroft 70df242f72
Update uf2 tools to support python3. 2018-07-25 09:39:46 -07:00
roland feec0a6909 tools/pydfu.py: Use getfullargspec instead of getargspec for newer pyusb
pyusb v1.0.2 warns about `getargspec` as being deprecated.
2018-07-20 14:28:17 +10:00
roland 6e50df4e21 tools/dfu.py: Pad image data to 8 byte alignment to support L476.
Thanks to @dhylands for this patch to pad the image to 8-byte boundaries.
2018-07-20 14:23:11 +10:00
Dan Halbert 2809b4f9dd Merge branch 'master' into micropython-25ae98f-merge 2018-07-16 19:36:40 -04:00
Dan Halbert 7c219600a2 WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
hathach 0e819599e7 Merge branch 'master' into nrf52840_usbboot 2018-07-10 02:02:52 +07:00
Damien George 44fc92ea7c tools/mpy-tool.py: Put frozen bignum digit data in ROM, not in RAM. 2018-07-09 13:43:34 +10:00
Damien George 929d10acf7 tools/mpy-tool.py: Support freezing of floats in obj representation D. 2018-07-09 12:22:40 +10:00
Scott Shawcroft f3f8e13b88
analyze everything 2018-07-03 05:45:51 -07:00
Scott Shawcroft 252aacdddf
Analysis fixes and long lived tweaks. 2018-07-03 05:45:50 -07:00
hathach 36e2f38933 update tools/uf2 to have family support 2018-07-03 17:49:59 +07:00
hathach 4d45565663 update tools/uf2 to support hex input for uf2conv.py 2018-06-25 23:27:37 +07:00
Damien George 92667dc2e5 tools/pydfu.py: Add support for multiple memory segments.
Segments are separated by / and begin with the memory address.  This
follows how the ST DFU tool works.
2018-06-22 15:32:32 +10:00
Scott Shawcroft 724bd7c17f Correct the tool build 2018-06-18 14:07:21 -07:00
Scott Shawcroft 05547b72ac Switch to Feather52s full name to avoid confusion with the nrf52840 later.
Fixes #940
2018-06-18 10:51:04 -07:00
Scott Shawcroft b4338921de Add auto-build for nrf52840 development kit, PCA10056 2018-06-15 16:34:26 -07:00
Jeff Epler bbba3e505f build_adafruit_bins: feather_huzzah need not be a special case 2018-06-10 14:56:55 -05:00
Scott Shawcroft 66b79723b6 Add code size analysis tool and shrink samd.clock a smidge. 2018-06-08 12:56:32 -07:00
Damien George 8fb95d6520 tools/pydfu.py: Increase download packet size to full 2048 bytes.
The ST DFU bootloader supports a transfer size up to 2048 bytes, so send
that much data on each download (to device) packet.  This almost halves
total download time.
2018-06-08 15:32:49 +10:00
Dan Halbert 9ba6990228 Feather M0 Express build with Crickit libraries 2018-06-05 18:21:47 -04:00
Noralf Trønnes e37d5622fe tools: Add cpboard.py
This is a variant of pyboard.py aimed at Circuit Python boards.
It can emulate pyboard.py enough so it works with tests/run-tests.
2018-06-02 19:09:44 +02:00
Dan Halbert 5680933483 refactor longint settings; make crickit cpx build 2018-05-21 23:58:03 -04:00
Keith Wiley 3ea0862a6e tools/pydfu.py: Fix typo in comments. 2018-05-18 23:33:19 +10:00
Karin Hawley f9ae1ee172 Cleaning up and fixing the docs generation Makefile and README instructions
- moving Makefile to parent folder.  This resolves some of the weird path/build issues
- remove trace references to cpydiff and original file (no longer used anywhere)
- converting SOURCEDIR to a changeable variable, passed through all sphinx-build calls
- adding path to conf.py, in case it moves again
- making `-v` default with VERBOSE
- making `-E` default with FORCE
- creating BASEOPTS to store all the dirs, paths, and settings, passing them to sphinx-build in one long chain, instead of individually
- updating README to use the make command as default.  Also added text explaining some of the customization you can add into a make command
2018-05-14 11:02:25 -07:00
Dan Halbert 9daa1a68d8 HID gamepad support 2018-04-23 23:51:23 -04:00
Damien George f7be5f9bfa tools/upip: Upgrade upip to 1.2.4.
Uses new pypi.org URL, and now creates a socket with the address parameters
returned by getaddrinfo().
2018-04-23 16:11:27 +10:00
Scott Shawcroft 2a26dac2bc Add initial ItsyBitsy M4 support 2018-04-12 11:16:52 -07:00
Scott Shawcroft 619b0ec164 Fix rom qstr pool length. 2018-04-09 15:59:52 -07:00
Dan Halbert e7305ce15f update usb_descriptor again 2018-04-08 10:15:47 -04:00
Dan Halbert a159b85340 Reorder composite device interfaces; fix report length bug 2018-04-08 09:33:02 -04:00
Dan Halbert beb6ad2e40 Add USB HID support, including Consumer Control 2018-04-02 21:37:44 -04:00
Dan Halbert 435e894fa0 Merge branch 'master' into 3.0_hid 2018-04-02 19:19:43 -04:00
Dan Halbert d005b12326 WIP: seems to be done 2018-04-02 19:08:18 -04:00
Dan Halbert df91878d2e WIP: works with just keyboard but not complex report descriptor 2018-03-30 23:24:00 -04:00
Scott Shawcroft fd7dcff4e9 Add Feather M4 Express support.
* Also fixed detection of SPI flash chip to correct look in the 2+
spots.
* Added support for using QSPI in dual read mode.
2018-03-23 00:00:13 -07:00
Scott Shawcroft bf05183158 Merge remote-tracking branch 'adafruit/2.x' into merge_2x 2018-02-27 15:24:16 -08:00
Dan Halbert b001c0711b Correct _etext location; clean up .ld files
1. Make _extext and _sidata coincide. Old _etext location did not include
.ARM.exidx sections, which were usually absent but not always. So flash
data was copied to RAM in wrong place.
2. Use decimal constants with "K" and "M" suffixes in .ld files instead
of hex constants, to make them easier to read and check for accuracy.
2018-02-09 11:31:18 -05:00
Scott Shawcroft 737178e0d2 Ignore docs directory when freezing as well.
conf.py for Sphinx will be moved here.
2018-01-31 11:10:50 -08:00
Scott Shawcroft da330f0cab Polish up the heap analysis script and make it more CLI friendly.
It can now render the heap layout over a sequence of ram dumps.

The mpy analysis is also better at parsing mpy files.
2018-01-24 10:33:46 -08:00
Tony DiCola 3b946f667e Add missing Feather M0 RadioFruit boards: RFM69, RFM9x. (#538) 2018-01-19 11:55:39 -08:00
Tony DiCola 4bd1d09d74 Add missing Feather M0 RadioFruit boards: RFM69, RFM9x (#539) 2018-01-19 11:53:47 -08:00
Scott Shawcroft d16af1fbb2 Heap analysis tool (#529)
* random heap stuff

* Fix dicts

* Less hand coding. Now reads .map file for memory locations of stuff.

* Display qstr chunk contents.
2018-01-18 18:53:52 -08:00
Kevin Townsend 17ff1b2b46 Fixed build folder for travis 2018-01-18 11:32:47 -08:00
Dan Halbert 065e82015f merge from 2.2.0 + fix up board defs 2018-01-02 21:25:41 -05:00
microbuilder 5da455e398 Added feather52 to travis build list 2017-12-28 22:35:03 +01:00
microbuilder f1e1699c9f Added feather52 to travis build 2017-12-27 13:54:16 +01:00
Dan Halbert 31be20744d preprocess_frozen_modules.py: yet more Python 3.4 compatibility changes 2017-12-24 14:29:03 -05:00
Dan Halbert 644ad74ea1 preprocess_frozen_modules.py: make compatible with Python 3.4. 2017-12-24 13:49:58 -05:00