Wykres commitów

14 Commity (bbdc98f72e019ef1370add51a3ad9ec991bfbc40)

Autor SHA1 Wiadomość Data
robert-hh bbdc98f72e mimxrt: Enable many Python and some extmod features.
Besides Python features this includes the extmod modules which make use of
the Pin module, especially machine.softSPI, machine.SoftI2C and onewire.
2021-06-04 00:38:18 +10:00
robert-hh a40e1473dc mimxrt: Add floating point support.
Since not all boards support double fp, all board specific .mk files are
affected too.
2021-06-04 00:37:22 +10:00
robert-hh 2f365d234e mimxrt/machine_rtc: Add the RTC class to the machine module.
Initial version, using the LP RTC clock.  It provides setting the date and
time with rtc.init() or rtc.datetime(), and reading the date and time with
rtc.datetime() or rtc.now().  The method weekday() reports the weekday of
the current date.  It starts with 0 for Monday.

The tuple order for datetime() and now() matches the CPython sequence:
(year, month, day, hour, minute, second, microsecond, TZ).  TZ is ignored
and reported as None.  Microsecond is provided at a best effort.

If a battery is not supplied, the default boot date/time is 1970/1/1 0:0:0.
With a battery, the clock continues to run even when the board is not
powered.  The clock is quite precise.  If not, using rtc.calibration() may
help.
2021-06-03 15:24:04 +10:00
robert-hh 4c407c790f mimxrt: Add the Timer class to the machine module.
It supports three hardware timer channels based on the PIT timers of the
MIMXRT MCU.  The timer id's are 0, 1 and 2.  On soft reboot all active
timers will be stopped via finalisers.
2021-06-02 00:33:13 +10:00
robert-hh 745b4319a2 mimxrt/boards/TEENSY40: Re-create the flash FS after deploy.
This is required since the Teensy Halfkay loader attempts to erase all of
the flash but fails to do so, at least in my tests.  Formatting brings it
back to a known state.
2021-06-01 23:52:45 +10:00
robert-hh dfd4324eb1 mimxrt: Add flash storage support with VFS and littlefs filesystem.
This commit adds full support for a filesystem on all boards, with a block
device object mimxrt.Flash() and uos.VfsLfs2 enabled.

Main changes are:
- Refactoring of linker scripts to accomodate reserved area for VFS.  VFS
  will take up most of the available flash. 1M is reserved for code.  9K is
  reserved for flash configuration, interrupts, etc.
- Addition of _boot.py with filesystem init code, called from main.c.
- Definition of the mimxrt module with a Flash class in modmimxrt.[ch].
- Implementation of a flash driver class in mimxrt_flash.c.  All flashing
  related functions are stored in ITCM RAM.
- Addition of the uos module with filesystem functions.
- Implementation of uos.urandom() for the sake of completeness of the uos
  module.

It uses sample code from CircuitPython supplied under MIT license, which
uses the NXP SDK example code.

Done in collaboration with Philipp Ebensberger aka @alphaFred who
contributed the essential part to enable writing to flash while code is
executing, among other things.
2021-06-01 23:42:57 +10:00
robert-hh c303b15f10 mimxrt: Enable frozen modules. 2021-06-01 22:57:09 +10:00
Philipp Ebensberger ff5d39529c mimxrt: Implement machine.Pin class.
- modified pin type from pin_obj_t to machine_pin_obj_t
- created machine_pin.c
- implemented basic version of make-pins.py to genertate pins.c/.h files
  automatically; the only alternate function currently supported is GPIO
- added af.csv files for all supported MCUs
- replaced pins.c/pins.h files with pin.csv for all boards
- implemented on/off/high/low/value/init methods
- Implemented IN/OUT/OPEN_DRAIN modes
- modified LDFLAGS for DEBUG build to get usefull .elf file for debugging

Signed-off-by: Philipp Ebensberger
2021-05-26 00:12:42 +10:00
Damien George 7408ca1d78 mimxrt: Improve ticks and sleep functions using GPT.
SysTick cannot wake the CPU from WFI/WFE so a hardware timer is needed to
keep track of ticks/delay (similar to the nrf port).

Fixes issue #7234.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-18 22:36:32 +10:00
Albort Xue 5f50568b1f mimxrt/boards: Add MIMXRT1064_EVK board. 2020-09-09 00:06:33 +10:00
Philipp Ebensberger 02cc4462b7 mimxrt: Add initial impl of machine.LED class, and basic pin support.
This commit implements an LED class with rudimentary parts of a pin C API
to support it.  The LED class does not yet support setting an intensity.

This LED class is put in the machine module for the time being, until a
better place is found.

One LED is supported on TEENSY40 and MIMXRT1010_EVK boards.
2020-06-05 11:47:48 +10:00
Jim Mussared 710426024a all: Factor gchelper code to one place and use it for unix & ARM ports.
No functionality change is intended with this commit, it just consolidates
the separate implementations of GC helper code to the lib/utils/ directory
as a general set of helper functions useful for any port.  This reduces
duplication of code, and makes it easier for future ports or embedders to
get the GC implementation correct.

Ports should now link against gchelper_native.c and either gchelper_m0.s or
gchelper_m3.s (currently only Cortex-M is supported but other architectures
can follow), or use the fallback gchelper_generic.c which will work on
x86/x64/ARM.

The gc_helper_get_sp function from gchelper_m3.s is not really GC related
and was only used by cc3200, so it has been moved to that port and renamed
to cortex_m3_get_sp.
2020-04-29 23:45:19 +10:00
stijn 30840ebc99 all: Enable extra conversion warnings where applicable.
Add -Wdouble-promotion and -Wfloat-conversion for most ports to ban out
implicit floating point conversions, and add extra Travis builds using
MICROPY_FLOAT_IMPL_FLOAT to uncover warnings which weren't found
previously.  For the unix port -Wsign-comparison is added as well but only
there since only clang supports this but gcc doesn't.
2020-04-18 22:42:28 +10:00
Jim Mussared f46782dde9 mimxrt: Add new, minimal port to NXP i.MX RT series CPUs.
This is an extremely minimal port to the NXP i.MX RT, in the style of the
SAMD port  It's largely based on the TinyUSB mimxrt implementation, using
the NXP SDK.  It currently supports the Teensy 4.0 board with a REPL over
the USB-VCP interface.

This commit also adds the NXP SDK submodule (also from TinyUSB) to
lib/nxp_driver.

Note: if you already have the tinyusb submodule initialized recursively you
will need to run the following as the tinyusb sub-submodules have been
rearranged (upstream):

    git submodule deinit lib/tinyusb
    rm -rf .git/modules/lib/tinyusb
    git submodule update --init lib/tinyusb
2020-03-11 15:34:13 +11:00