Commit Graph

301 Commits

Author SHA1 Message Date
Scott Shawcroft
597777e80b atmel-samd: Update internal pins for Feather M0 Express Rev B 2017-02-02 12:12:05 -08:00
Scott Shawcroft
1da14b0eec atmel-samd: Switch Metro back to including bootloader space. 2017-02-01 13:16:48 -08:00
Scott Shawcroft
8569395b5d atmel-samd: Turn down the brightness of the status colors. 2017-02-01 13:15:46 -08:00
Scott Shawcroft
e3f9ee839a Add frequency changing support to PWMOut.
You can either set it once up front, or set variable_frequency on custruction to
indicate that the frequency must be able to change. This informs whether a timer
can be shared amongst pins.

This also adds persistent clock calibration on atmel-samd. Once the device has
synced its clock frequency over USB it will remember that config value until USB
is used again. This helps ensure the clock frequency is similar on and off USB.

Lastly, this also corrects time.sleep() when on USB by correcting the tick counter.
2017-01-30 15:02:01 -08:00
Scott Shawcroft
749d22b5e6 atmel-samd: stop overwriting the flash FS. 2017-01-19 14:26:57 -08:00
Scott Shawcroft
79024f3fb9 atmel-samd: Change new flash FS name to CIRCUITPY
Fixes #79
2017-01-19 11:47:06 -08:00
Scott Shawcroft
dad33e6ad0 atmel-samd: Reset the DAC on soft reset. Fixes #80. 2017-01-19 11:42:33 -08:00
Scott Shawcroft
f74e477966 atmel-samd: Fully reset the ADC state on reset to prevent a crash. 2017-01-19 11:26:41 -08:00
Scott Shawcroft
d29915ca3d atmel-samd: Fix two more SERCOM configs, PA07 and PA06. 2017-01-18 15:04:35 -08:00
Scott Shawcroft
76a2178bd7 atmel-samd: Fix PA00 and PA01 sercoms. New CircuitPlayground prototype pinout. 2017-01-18 14:51:36 -08:00
Scott Shawcroft
1a86968912 atmel-samd: Fix neopixel timing by forcing the NVM cache to be deterministicly timed. Otherwise, bit order changes code timing. Fixes #74 2017-01-17 19:27:48 -08:00
Scott Shawcroft
42926c6159 atmel-samd: Fix whitespace. 2017-01-17 19:26:28 -08:00
Scott Shawcroft
179413aec2 atmel-samd: Support multiple ADC channels at once.
Fixes #61
2017-01-17 14:40:43 -08:00
Scott Shawcroft
d239dbdc28 More fixes to pin pull thanks to jerryn:
* Correct atmel-samd pin pull state.
* Correct conversion from python pull objects to C enum.
2017-01-16 15:32:23 -08:00
Scott Shawcroft
35a5d44399 atmel-samd: Ensure pin state for first script run because we don't
know the post-bootloader state.

Also, color the status LED purple for ValueErrors which are used to
indicate a pin in use.
2017-01-13 15:39:50 -08:00
Scott Shawcroft
f6cf8ae208 atmel-samd: Split UART pin names into two so that all names start
with a letter and are therefore valid Python.

Fixes #73.
2017-01-12 13:53:47 -08:00
Scott Shawcroft
9ece7c907d Add persistent VFS shares so that the devices can be used with USB
that is present across soft-reset.
2017-01-12 12:46:44 -08:00
Scott Shawcroft
0d408488c5 atmel-samd: Turn off FRAMEBUF because it takes a lot of space. 2017-01-12 12:46:43 -08:00
Scott Shawcroft
cea5503ca0 Fixup warnings from merge about undefined macro values, switch to
VM keyboard exception and switch to FATFS reader.
2017-01-12 12:46:18 -08:00
Scott Shawcroft
24765929ea atmel-samd: Update pinouts for prototypes. 2017-01-08 22:11:27 -08:00
Scott Shawcroft
7c302c395e Improve docs and update to CircuitPython. 2017-01-05 16:20:46 -08:00
Scott Shawcroft
89f4a5597b atmel-samd: New revs which isolate the SPI for the external flash. 2017-01-05 14:36:33 -08:00
Scott Shawcroft
a9087fbaa2 atmel-samd: Change cplay pins to rev B. 2016-12-21 15:29:25 -08:00
Scott Shawcroft
7ce69959f9 atmel-samd: Tweaks for rev B of the prototype circuit playground. 2016-12-21 14:07:50 -08:00
Scott Shawcroft
f48d2df634 atmel-samd: Improve TouchIn to allow for multiple simultaneous touch pads. 2016-12-20 16:39:32 -08:00
Scott Shawcroft
427d33c706 atmel-samd: Add help() and remove mem_info functions from smallest builds to make room. 2016-12-19 16:38:35 -08:00
Scott Shawcroft
576373552a atmel-samd: Run the VM hook while waiting for the UART read to timeout in case nothing is received. 2016-12-19 16:36:32 -08:00
Scott Shawcroft
f2bfbab6a0 atmel-samd: Save space by not creating default files on the FS and by only keeping LED flashing code when LEDs are present. 2016-12-19 13:03:50 -08:00
Sebastian Plamauer
1598e44231 atmel-samd: Add preliminary support for UART 2016-12-19 13:03:50 -08:00
Scott Shawcroft
af17b64a58 atmel-samd: Add samd module for atmel-samd specific configuration.
Fixes #49
2016-12-13 18:04:50 -08:00
Scott Shawcroft
78a807cc26 atmel-samd: Commit QTouch library. Missed because .a files are usually ignored. 2016-12-13 16:11:19 -08:00
Scott Shawcroft
18c1210e87 atmel-samd: Remove debug output. 2016-12-13 16:10:42 -08:00
Scott Shawcroft
781633c716 Fix up Analog classes: unify them at 16 bits and adds reference_voltage member
to make for easy conversion. Fixes #14.
2016-12-13 16:09:00 -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
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
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
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
Scott Shawcroft
0ba9aee428 atmel-samd: Update Trinket and Gemma boards for rev B. 2016-12-05 11:14:36 -08:00
Scott Shawcroft
26229efe78 Add try_lock and unlock to I2C and SPI classes to make sure things
are shared well between threads and underlying MicroPython (SPI Flash
for example.)

It is recommended to use the bus device classes to manage the locks
and other transaction state.

https://github.com/adafruit/Adafruit_MicroPython_BusDevice

Fixed #58
Fixed #59
Fixed #60
2016-12-02 15:46:12 -08:00
Scott Shawcroft
03f49f8209 atmel-samd: Slim down the pin struct to save ~1200 bytes. 2016-12-01 13:47:18 -08:00
Scott Shawcroft
f4a1da4be9 atmel-samd: Only include bitbangio on boards with flash. 2016-12-01 13:46:44 -08:00
Scott Shawcroft
915e1e5603 atmel-samd: Move the README text out of ROM to save space. We can still ship with it on flash. 2016-11-30 09:50:19 -08:00
Scott Shawcroft
3628a1ae48 atmel-samd: Fix FLASH_ROOT_POINTERS for internal flash builds. 2016-11-30 09:49:39 -08:00
Scott Shawcroft
9b3afc7b37 shared-bindings: Make MOSI and MISO optional for SPI. 2016-11-29 16:54:20 -08:00
Scott Shawcroft
4933fa1c27 shared-bindings: Ensure pin objects are actually pins.
Fixes #12
2016-11-29 15:50:01 -08:00
Scott Shawcroft
72455e441f atmel-samd: Use MICROPY_VM_HOOK_LOOP to make sure the mass storage handling code is called even in tight Python loops. Fixes #51 2016-11-29 14:58:37 -08:00
Scott Shawcroft
ddfa7595b0 Slim down Arduino Zero build by turning off mass storage LEDs. 2016-11-29 14:32:04 -08:00
Scott Shawcroft
2d9a0c76c5 atmel-samd: Switch to MICROPY_PORT_ROOT_POINTERS for the flash cache. 2016-11-29 14:29:33 -08:00
Scott Shawcroft
888efa54e2 Only include uheap in debug builds. 2016-11-29 10:46:47 -08:00
Scott Shawcroft
55c8c91e07 atmel-samd: Hook in bitbangio 2016-11-28 19:48:17 -08:00
Scott Shawcroft
b8bf15de16 atmel-samd: Add Circuit Playground M0 board. Its experimental. 2016-11-28 19:21:40 -08:00
Scott Shawcroft
ea1320bee7 Add uheap for debugging the size of objects. Still not perfect though. 2016-11-22 17:32:28 -08:00
Scott Shawcroft
cc412a80ad atmel-samd: Support Trinket and Gemma M0 prototypes. 2016-11-22 12:03:42 -08:00
Scott Shawcroft
575d2e7998 atmel-samd: Default to code.txt instead of main.py (main.py will still work on its own.) 2016-11-21 14:32:11 -08:00
Scott Shawcroft
ccbb5e84f9 This introduces an alternative hardware API called nativeio structured around different functions that are typically accelerated by native hardware. Its not meant to reflect the structure of the hardware.
Docs are here: http://tannewt-micropython.readthedocs.io/en/microcontroller/

It differs from upstream's machine in the following ways:

* Python API is identical across ports due to code structure. (Lives in shared-bindings)
* Focuses on abstracting common functionality (AnalogIn) and not representing structure (ADC).
* Documentation lives with code making it easy to ensure they match.
* Pin is split into references (board.D13 and microcontroller.pin.PA17) and functionality (DigitalInOut).
* All nativeio classes claim underlying hardware resources when inited on construction, support Context Managers (aka with statements) and have deinit methods which release the claimed hardware.
* All constructors take pin references rather than peripheral ids. Its up to the implementation to find hardware or throw and exception.
2016-11-21 14:11:52 -08:00
Scott Shawcroft
ceeac4791e atmel-samd: Add Feather M0 with flash 2016-11-18 16:18:13 -08:00
Scott Shawcroft
fe9c28538c atmel-samd: Turn off using the red LED to show mass storage writes. 2016-11-18 16:18:13 -08:00
Scott Shawcroft
6e30b8ea92 atmel-samd: Move neopixel out of internal flash. 2016-11-18 16:17:56 -08:00
Scott Shawcroft
bd36873362 Merge tag 'v1.8.6'
ESP8266 port uses SDK 2.0, has more heap, has support for 512k devices

This release brings some code size reductions to the core as well as
more tests and improved coverage which is now at 94.3%.

The time.ticks_diff(a, b) function has changed: the order of the arguments
has been swapped so that it behaves like "a - b", and it can now return a
negative number if "a" came before "b" (modulo the period of the ticks
functions).

For the ESP8266 port the Espressif SDK has been updated to 2.0.0, the
heap has been increased from 28k to 36k, and there is support for 512k
devices via "make 512k".  upip is included by default as frozen bytecode.
The network module now allows access-point reconnection without WiFi
credentials, and exposes configuration for the station DHCP hostname.  The
DS18B20 driver now handles negative temperatures, and NeoPixel and APA102
drivers handle 4 bytes-per-pixel LEDs.

For the CC3200 port there is now support for loading of precompiled .mpy
files and threading now works properly with interrupts.

A detailed list of changes follows.

py core:
- py.mk: automatically add frozen.c to source list if FROZEN_DIR is defined
- be more specific with MP_DECLARE_CONST_FUN_OBJ macros
- specialise builtin funcs to use separate type for fixed arg count
- {modbuiltins,obj}: use MP_PYTHON_PRINTER where possible
- modbuiltins: add builtin "slice", pointing to existing slice type
- add "delattr" builtin, conditional on MICROPY_CPYTHON_COMPAT
- sequence: fix reverse slicing of lists
- fix null pointer dereference in mpz.c, fix missing va_end in warning.c
- remove asserts that are always true in emitbc.c
- fix wrong assumption that m_renew will not move if shrinking
- change config default so m_malloc0 uses memset if GC not enabled
- add MICROPY_FLOAT_CONST macro for defining float constants
- move frozen bytecode Makefile rules from ports to common mk files
- strip leading dirs from frozen mpy files, so any path can be used

extmod:
- vfs_fat_file: check fatfs f_sync() and f_close() returns for errors
- vfs_fat_file: make file.close() a no-op if file already closed
- utime_mphal: ticks_diff(): switch arg order, return signed value
- utime_mphal: add MP_THREAD_GIL_EXIT/ENTER warppers for sleep functions
- utime_mphal: implement ticks_add(), add to all maintained ports
- utime_mphal: allow ticks functions period be configurable by a port

lib:
- utils/pyhelp.c: use mp_printf() instead of printf()
- utils/pyexec: add mp_hal_set_interrupt_char() prototype
- libm: move Thumb-specific sqrtf function to separate file

drivers:
- add "from micropython import const" when const is used

tools:
- upgrade upip to 1.1.4: fix error on unix when installing to non-existing
  absolute path
- pip-micropython: remove deprecated wrapper tool
- check_code_size.sh: code size validation script for CI
- replace upip tarball with just source file, to make its inclusion as
  frozen modules in multiple ports less magic

tests:
- extmod/vfs_fat: improve VFS test coverage
- basics/builtin_slice: add test for "slice" builtin name
- basics: add test for builtin "delattr"
- extmod/vfs_fat_fsusermount: improve fsusermount test coverage
- extmod/vfs_fat_oldproto: test old block device protocol
- basics/gc1: garbage collector threshold() coverage
- extmod/uhashlib_sha1: coverage for SHA1 algorithm
- extmod/uhashlib_sha256: rename sha256.py test
- btree1: fix out of memory error running on esp8266
- extmod/ticks_diff: test for new semantics of ticks_diff()
- extmod/framebuf1: test framebuffer pixel clear, and text function

minimal port:
- Makefile: split rule for firmware.bin generation

unix port:
- Makefile: remove references to deprecated pip-micropython
- modtime: use ticks_diff() implementation from extmod/utime_mphal.c
- mphalport.h: add warning of mp_hal_delay_ms() implementation
- modtime: switch ticks/sleep_ms/us() to utime_mphal
- fix symbol references for x86 Mac
- replace upip tarball with just source file

windows port:
- enable utime_mphal following unix, define mp_hal_ticks_*
- fix utime_mphal compilation for msvc
- implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter

qemu-arm port:
- exclude ticks_diff test for qemu-arm port
- exclude extmod/vfs_fat_fileio.py test
- exclude new vfs_fat tests
- enable software floating point support, and float tests

stmhal port:
- modutime: refactor to use extmod's version of ticks_cpu
- refactor pin usage to use mp_hal_pin API
- led: refactor LED to use mp_hal_pin_output() init function
- Makefile: use standard rules for frozen module generation
- modutime: consistently convert to MP_ROM_QSTR/MP_ROM_PTR
- enable SD power save (disable CLK on idle)

cc3200 port:
- use mp_raise_XXX helper functions to reduce code size
- mods/pybspi: allow "write" arg of read/readinto to be positional
- enable loading of precompiled .mpy files
- fix thread mutex's so threading works with interrupts

teensy port:
- update to provide new mp_hal_pin_XXX functions following stmhal

esp8266 port:
- Makefile: use latest esptool.py flash size auto-detection
- esp_init_data: auto-initialize system params with vendor SDK 2.0.0
- esp8266.ld: move help.o to iROM
- esp8266.ld: move modmachine.o to iROM
- esp8266.ld: move main.o to iROM
- add MP_FASTCODE modifier to put a function to iRAM
- main: mark nlr_jump_fail() as MP_FASTCODE
- modules/webrepl: enforce only one concurrent WebREPL connection
- etshal.h: add few more ESP8266 vendor lib prototypes
- modesp: add flash_user_start() function
- add support for building firmware version for 512K modules
- scripts: make neopixel/apa102 handle 4bpp LEDs with common code
- modutime: consistently convert to MP_ROM_QSTR/MP_ROM_PTR
- modnetwork: config(): fix copy-paste error in setting "mac"
- scripts/port_diag: add descriptions for esf_buf types
- modnetwork.c: allows AP reconnection without WiFi credentials
- main: bump heap size to 36K
- etshal.h: add prototypes for SPIRead/SPIWrite/SPIEraseSector
- etshal.h: adjust size of MD5_CTX structure
- modules: fix negative temperature in ds18x20 driver
- rename "machine" module implementation to use contemporary naming
- rework webrepl_setup to run over wired REPL
- espneopixel.c: solve glitching LED issues with cpu at 80MHz
- include upip as a standard frozen bytecode module
- update docs for esptool 1.2.1/SDK 2.0 (--flash_size=detect)
- modnetwork.c: expose configuration for station DHCP hostname

zephyr port:
- implement utime module
- use board/SoC values for startup banner based on Zephyr config
- initial implementation of machine.Pin
- zephyr_getchar: update for recent Zephyr refactor of console hooks
- support time -> utime module "weaklink"
- README: update for the current featureset, add more info
- mpconfigport.h: move less important params to the bottom
- Makefile: allow to adjust heap size from make command line
- Makefile: update comments to the current state of affairs
- Makefile: allow to override Zephyr config from make command line
- Makefile: add minimal port
- Makefile: add -fomit-frame-pointer to reduce code size
- mphalport.h: update for new "unified" kernal API (sleep functions)

docs:
- machine.SPI: bring up to date with Hardware API, make vendor-neutral
- machine.SPI: improve descriptions of xfer methods
- library/builtins: add docs for delattr and slice
- library/network: reword intro paragraph
- library/network: typo fixes, consistent acronym capitalization
- library/index: update TOCs so builtins sorted before modules
- utime: document ticks_cpu() in more detail
- utime: describe new semantics of ticks_diff() (signed ring arithmetics)
- utime: add docs for ticks_add(), improvements for other ticks_*()
- esp8266: update for new WebREPL setup procedure
- */quickref.rst: use new semantics of ticks_diff()
- library/machine.Pin: update Pin docs to align with new HW API

travis:
- integrate tools/check_code_size.sh
- minimal: Use CROSS=1, for binary size check

examples:
- http_server_simplistic: add "not suitable for real use" note
- hwapi: example showing best practices for HW API usage in apps
- hwapi: add hwconfig for DragonBoard 410c
2016-11-14 11:10:07 -08:00
Scott Shawcroft
acc4fe4d7d atmel-samd: Stop relying on an external crystal. 2016-11-07 12:37:38 -08:00
Scott Shawcroft
23112a6434 atmel-samd: Merge init into the constructor and check all available
SERCOMs during initialization.

Fixes #16. It was broken because the MISO pin used the second SERCOM.
2016-11-01 17:30:01 -07:00
Scott Shawcroft
674f3d46e8 atmel-samd: Reset all SERCOMs except the SPI flash one if used. #29 2016-11-01 11:03:12 -07:00
Scott Shawcroft
19e5f1fef2 atmel-samd: Break out of delays with CTRL-C.
This means you can CTRL from within time.sleep() and that autoreset
will work from within a long sleep too. Fixes #45.
2016-10-31 11:31:52 -07:00
Scott Shawcroft
f42b41e1e9 atmel-samd: Increase autoreset delay to reduce duplicate resets. 2016-10-31 11:31:33 -07:00
Scott Shawcroft
5b3a143ffe atmel-samd: Rework tick timer to use TC5 and support neopixel status LED.
The tick timer needed to be reworked because the ASF delay functions also
use the SysTick timer. Now, it uses TC5 and calls out to the autoreset
logic every tick. Fixes #43.

Added neopixel status colors and corrected the latch time from ms to us.
Fixes #42.
2016-10-28 20:16:39 -07:00
Scott Shawcroft
9008b93962 atmel-samd: Fix typo in ASF. 2016-10-28 20:12:24 -07:00
Scott Shawcroft
fc78f6950f atmel-samd: Add D13 as flash write indicator on Arduino Zero. 2016-10-27 17:49:52 -07:00
Scott Shawcroft
86a1d1db30 atmel-samd: Fix autoreset when no repl is present and keep running mss storage code during a sleep. 2016-10-27 17:48:42 -07:00
Scott Shawcroft
3a9cb1ac49 atmel-samd: Fix Arduino SPI pin. Datasheet net name is wrong. :-( 2016-10-26 20:16:53 -07:00
Scott Shawcroft
85e4d3572d atmel-samd: Add named pins for Arduino Zero SPI. Fixes #11. 2016-10-26 18:02:34 -07:00
Scott Shawcroft
2098515f6a atmel-samd: Rework pin definitions to share most of the data structures and included based on ASF defines. 2016-10-26 17:57:47 -07:00
Scott Shawcroft
73848f4cd0 atmel-samd: Stop aliasing os to uos and time to utime. They expose different APIs. Fixes #23. 2016-10-26 13:33:50 -07:00
Scott Shawcroft
34fa81eaf3 atmel-samd: Hook in DTR for more ports and make the serial TX more resiliant to long strings. 2016-10-26 13:32:41 -07:00
Scott Shawcroft
d189a3f3cf atmel-samd: Support auto-reset based on USB write activity.
It will soft-reboot micropython after a burst of writes to the
file system. This means that after you save files on your computer
they will be automatically rerun.

This can be disabled in the build by unsetting AUTORESET_TIMER in
mpconfigboard.h.

Using the REPL will also prevent the soft resets until you reset
with CTRL-D manually.
2016-10-25 18:36:37 -07:00
Scott Shawcroft
614c1fdba2 atmel-samd: Only output to USB after DTR and don't send anything larger than the room left in the USB TX buffer. 2016-10-25 18:29:04 -07:00
Scott Shawcroft
b7768a74a7 atmel-samd: Fix file system init.
Adding the USB write protection prevented file system reset from
working. Since it happens before USB start we temporarily set the
volume to writeable and then set it back to read-only before USB is
started.
2016-10-25 15:13:43 -07:00
Scott Shawcroft
d05299f57a atmel-samd: Add D13 led as mass storage write indicator. 2016-10-25 15:06:05 -07:00
Scott Shawcroft
3a5aad516a atmel-samd: Remove unused header. 2016-10-25 15:04:20 -07:00
Scott Shawcroft
fff96a0ce6 atmel-samd: Fix include guard. 2016-10-25 15:03:22 -07:00
Scott Shawcroft
16584dfee6 atmel-samd: Fix the Feather builds by switching to the VFS mass storage implementation. 2016-10-24 12:42:09 -07:00
Scott Shawcroft
f5ca66805b atmel-samd: Tweak DAC logic for clarity. Thanks @bcr for the suggestion. 2016-10-21 17:08:14 -07:00
Scott Shawcroft
b2834c30a6 atmel-samd: Support reading from the flash cache. 2016-10-21 16:04:18 -07:00
Scott Shawcroft
98c8f2f6a3 atmel-samd: Update the FatFs sector cache on USB mass storage write
to the same sector.

This fixes #20, the issue where a listdir or import won't work
without a reset when it was run before the file was copied.
2016-10-21 15:44:10 -07:00
Scott Shawcroft
b8ef783052 extmod: Fix getting sector size when the max and min sizes are the
same.

Also switch the max size back to 512 for atmel-samd to save ram.
2016-10-21 15:44:10 -07:00
Scott Shawcroft
9eb86e8015 Add support for USB writeable, MicroPython read-only volumes.
This prevents file system corruption due to two systems mutating
it at once.
2016-10-21 15:44:09 -07:00
Scott Shawcroft
eb62d03e33 atmel-samd: Add flash write activity LED. 2016-10-21 15:44:09 -07:00
Scott Shawcroft
8b1526e95e atmel-samd: Add a heap based cache for writing to flash.
The code will fallback to the flash scratch space when the GC
cannot allocate us enough memory.
2016-10-21 15:44:09 -07:00
Scott Shawcroft
bb1822faea atmel-samd: Support external flash on the Metro M0 w/Flash.
This uses a scratch flash sector to save data before writing a full sector.
2016-10-21 15:44:09 -07:00
Scott Shawcroft
46f6f9f899 atmel-samd: Start USB at the end so storage is initialized. 2016-10-21 15:44:09 -07:00
Scott Shawcroft
aacb1adcd1 atmel-samd: Add linker file for bootloaderless board with external flash. 2016-10-21 15:44:08 -07:00
Scott Shawcroft
853e5fc652 atmel-samd: Ensure at least 2k is left for the stack. 2016-10-21 15:43:24 -07:00
Scott Shawcroft
306c921ed1 atmel-samd: Rework mass storage interaction with underlying block
storage to use micropython's VFS interface.

This makes mass storage work with any VFS implementation rather
than a single one.
2016-10-21 15:36:59 -07:00
Tony DiCola
f539312af3 atmel-samd: Enable framebuffer for SSD1306 and other displays. 2016-10-20 23:10:28 +00:00
Tony DiCola
5333f5f987 atmel-samd: Enable full urandom module from extmod. 2016-10-20 06:41:21 +00:00
Sebastian Plamauer
9b1170a65d [atmel-samd] add adalogger board definitions 2016-10-19 10:02:01 +02:00
Scott Shawcroft
cb99ae5032 atmel-samd: Rename Feather M0 Bluefruit files to Feather M0 Basic because there isn't anything Bluefruit specific yet. 2016-10-14 13:10:17 -07:00
Scott Shawcroft
343ff4faed atmel-samd: Make the Arduino Zero build use a bootloader. 2016-10-14 13:10:16 -07:00
Scott Shawcroft
005b4505f5 Rework the READMEs to clarify that this is a MicroPython derivative and
not MicroPython proper.
2016-10-14 12:25:55 -07:00
Tony DiCola
fffc6d1a17 atmel-samd: Add modules directory with frozen bytecode support (like ESP8266 port), and NeoPixel python wrapper module. 2016-10-14 11:39:42 +00:00
Tony DiCola
2ee52c4fde atmel-samd: Minor fixes to SysTick handler, enable all interrupts function. 2016-10-13 18:36:00 +00:00
Tony DiCola
f77113c04f atmel-samd: Add time.ticks_diff function from esp port. 2016-10-13 05:18:18 +00:00
Tony DiCola
903bc8d04e atmel-samd: Implement time.ticks_ms function using SysTick timer, add global interrupt enable/disable functions. 2016-10-13 04:59:43 +00:00
Scott Shawcroft
011056af15 atmel-samd: Add support for SPI.
Also separate out the ASF config headers that are shared across all boards.
2016-10-11 15:48:43 -07:00
Scott Shawcroft
6986aa9aa2 atmel-samd: Change the FAT label so the board shows up as MICROPYTHON. 2016-10-10 12:17:11 -07:00
Scott Shawcroft
14f25337e7 atmel-samd: Fix FAT by giving the option of 4k sectors.
This causes the FATFS struct to have the ssize member because
sector size can be anywhere between 512 bytes and 4k bytes.
2016-10-10 12:16:02 -07:00
Scott Shawcroft
a6254f4344 atmel-samd: Add basic support for experimental Metro M0 with an external flash chip. 2016-10-07 15:09:01 -07:00
Scott Shawcroft
5d6c4109e9 atmel-samd: Change USB Manufacturer from Adafruit to Adafruit Industries. 2016-10-07 15:06:42 -07:00
Scott Shawcroft
284d3414e1 atmel-samd: Make UART REPL Arduino Zero specific. Most will use USB REPL. 2016-10-07 15:06:07 -07:00
Scott Shawcroft
67372b369e atmel-samd: Fix A1 and A2 analog inputs.
Fixes #3.
2016-10-07 15:01:26 -07:00
Scott Shawcroft
afedba5c2f atmel-samd: Support with statements for I2C class.
Also add init/deinit if you want to init/deinit manually.
2016-10-05 18:44:55 -07:00
Scott Shawcroft
42f6ba04a2 atmel-samd: Update the Micro Trace Buffer to have better defines.
Same as README.md here: https://github.com/adafruit/gdb-micro-trace-buffer
2016-10-05 18:42:02 -07:00
Scott Shawcroft
90bf13efd5 atmel-samd: Correct USB PIDs.
Arduino and Adafruit convention is for user programs to have PIDs
starting with 8 and bootloaders starting with 0.
2016-10-05 12:55:48 -07:00
Tony DiCola
9c67605233 atmel-samd: Add low level neopixel_write module & function for WS281x/neopixel RGB LEDs. 2016-10-05 12:35:23 -07:00
Scott Shawcroft
7e08347d5c atmel-samd: Support composite CDC and mass storage USB device.
Be careful to not use the flash file system while using mass storage
because both pieces of code attempting to change the fs can corrupt it.
2016-10-05 11:07:29 -07:00
Scott Shawcroft
1fa4c20c27 atmel-samd: Add Micro Trace Buffer support to the debug build.
The Micro Trace Buffer records the history of the pc and can be used
to debug hard faults even when the stack trace is useless.
2016-10-04 16:13:33 -07:00
Scott Shawcroft
98458c56cc atmel-samd: Remove debug flashes and comments. 2016-10-04 16:01:14 -07:00
Scott Shawcroft
0a10d17c28 atmel-samd: Update bossac_osx with one that works.
Add info to the README on how to get into bootloader on feathers. Fixes #6.
2016-10-03 12:57:06 -04:00
Scott Shawcroft
ed34c35509 atmel-samd21: Support loading mpy files. 2016-09-26 15:43:52 -07:00
Scott Shawcroft
b1be9f50ab atmel-samd: Remove module name from struct. 2016-09-26 15:02:16 -07:00
Scott Shawcroft
eda33385e6 atmel-samd: Correct the stack_top pointer used in garbage collection.
Without this fix the gc will consider a large, random section of memory
and it may never finish.
2016-09-22 18:24:06 -07:00
Scott Shawcroft
ffdc3f81df atmel-samd: Note a potential REPL ram savings. 2016-09-22 18:23:27 -07:00
Scott Shawcroft
bbeed82378 atmel-samd: Run boot.py and main.py at startup and soft reboot. 2016-09-22 13:56:26 -07:00
Scott Shawcroft
e56948650f atmel-samd: Enable mem_info display. 2016-09-22 13:16:13 -07:00
Scott Shawcroft
0e1fd9a12c atmel-samd: Support ampy get and fix USB dropping characters.
Fixes #2.
2016-09-21 15:13:37 -07:00
Scott Shawcroft
dbbb2a5ca4 atmel-samd: Turn off normal errors but turn on source code line reporting. 2016-09-20 15:16:52 -07:00
Scott Shawcroft
005122e581 atmel-samd: Remove path specific to me. 2016-09-20 15:16:12 -07:00
Scott Shawcroft
0cae6b8e68 atmel-samd: Support const(). 2016-09-19 17:30:28 -07:00
Scott Shawcroft
0f4f4c7544 atmel-samd: Add sys, fix import and increase the size of the heap. 2016-09-19 16:56:42 -07:00
Scott Shawcroft
7fd84e93f4 atmel-samd: Support raw repl and soft reset to support ampy.
Closes #1. Also adds TX and RX led support on the Arduino Zero.
2016-09-15 17:01:19 -07:00
Scott Shawcroft
7d8929c470 atmel-samd: Add I2C support.
This commit also introduces a new shared-bindings directory which is used to store the common Python -> C binding code. By having a shared directory we can ensure that the Python API across ports is the same. Each port will have a corresponding common-hal directory which provides definitions for the C api used in the shared-bindings code. That way the compiler can enforce the C api.

To migrate to this new shared API create a common-hal directory within your port and change the Makefile to compile both the shared-bindings and common-hal files. See atmel-samd/Makefile SRC_BINDINGS for an example.
2016-09-13 11:46:22 -07:00
Scott Shawcroft
05368d2c58 Include the precompiled math library from ASF. 2016-09-07 14:35:40 -07:00
Scott Shawcroft
09be96a6aa atmel/samd: Add filesystem support. 64k is stored in flash. 2016-09-02 17:00:30 -07:00
Scott Shawcroft
559434afca atmel-samd: Support floats. 2016-08-31 13:37:43 -07:00
ladyada
594ff413f4 trifecta tools 2016-08-31 13:38:13 -04:00
Scott Shawcroft
1725710feb atmel-samd: Rename the Feather M0 BLE to Feather M0 Bluefruit LE. 2016-08-31 09:56:06 -07:00
Scott Shawcroft
a6bc701917 atmel-samd: Re-enable -Os (size) optimizations. 2016-08-31 00:16:39 -07:00
Scott Shawcroft
eff137a5f5 atmel/samd: Support CTRL-C on USB. This won't escape native code but it will cause Python code to stop. 2016-08-31 00:11:56 -07:00
Scott Shawcroft
ccb309bd5c atmel/samd: Add basic PWM support which only allows for changing the duty. 2016-08-30 13:10:52 -07:00
Scott Shawcroft
b883a15d82 atmel-samd: Rename module classes so they don't conflict with names from ASF. 2016-08-28 00:02:05 -07:00
Scott Shawcroft
16fc045509 atmel-samd: Add direct write access to the DAC output. 2016-08-27 15:04:34 -07:00
Scott Shawcroft
259ae8a39d atmel-samd: Initial ADC support. 2016-08-26 17:01:38 -07:00
Scott Shawcroft
3cb4938c63 atmel-samd: Support Digital IO pins.
Also bumps up the heap size.
2016-08-24 17:38:08 -07:00
Scott Shawcroft
258804ab16 atmel-samd: Add limited time module support. 2016-08-24 13:17:55 -07:00
Scott Shawcroft
0c4f9b878a Enable REPL over USB.
All of the code was there except the linker was failing to clear the bss section because I added too many .zeros. The should have only been the exported globals that start with _ like _szero = .. Fixing that and turn on the usb transmit fixed everything.
2016-08-24 00:14:11 -07:00
Scott Shawcroft
386ab580cd Change the board information used in the header to be board specific. 2016-08-23 17:36:29 -07:00
Scott Shawcroft
9485634d41 Add support for REPL on Arduino Zero through EDBG via UART. 2016-08-23 16:47:53 -07:00
Scott Shawcroft
8f26d181c3 Blinking the LED works. Clocks should be set up correctly.
Everything works fine without USB being plugged in but faults (I think) when USB is plugged in. This is switched away from the USB code from the bootloader onto the USB code thats generated by Atmel Studio using the high level classes from ASF.
2016-08-22 23:53:11 -07:00
Scott Shawcroft
a5f6cb3c57 Compiled and linked SAMD21x18 version successfully. 2016-08-22 23:53:10 -07:00