Add initial MIMXRT10XX port

crypto-aes
arturo182 3 years ago
parent 776c9b011c
commit 13e0cba6f1
  1. 3
      .github/workflows/build.yml
  2. 3
      .gitmodules
  3. 2
      conf.py
  4. 2
      docs/shared_bindings_matrix.py
  5. 1
      docs/supported_ports.rst
  6. 1
      ports/mimxrt10xx/.gitignore
  7. 253
      ports/mimxrt10xx/Makefile
  8. 3
      ports/mimxrt10xx/README.md
  9. 82
      ports/mimxrt10xx/background.c
  10. 38
      ports/mimxrt10xx/background.h
  11. 48
      ports/mimxrt10xx/boards/board.h
  12. 55
      ports/mimxrt10xx/boards/feather_mimxrt1011/board.c
  13. 31
      ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.h
  14. 21
      ports/mimxrt10xx/boards/feather_mimxrt1011/mpconfigboard.mk
  15. 52
      ports/mimxrt10xx/boards/feather_mimxrt1011/pins.c
  16. 55
      ports/mimxrt10xx/boards/feather_mimxrt1062/board.c
  17. 31
      ports/mimxrt10xx/boards/feather_mimxrt1062/mpconfigboard.h
  18. 21
      ports/mimxrt10xx/boards/feather_mimxrt1062/mpconfigboard.mk
  19. 45
      ports/mimxrt10xx/boards/feather_mimxrt1062/pins.c
  20. 55
      ports/mimxrt10xx/boards/imxrt1010_evk/board.c
  21. 31
      ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.h
  22. 22
      ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.mk
  23. 37
      ports/mimxrt10xx/boards/imxrt1010_evk/pins.c
  24. 106
      ports/mimxrt10xx/boards/mimxrt1011-bootloader-external-flash.ld
  25. 123
      ports/mimxrt10xx/boards/mimxrt1011-external-flash.ld
  26. 106
      ports/mimxrt10xx/boards/mimxrt1062-bootloader-external-flash.ld
  27. 88
      ports/mimxrt10xx/common-hal/analogio/AnalogIn.c
  28. 40
      ports/mimxrt10xx/common-hal/analogio/AnalogIn.h
  29. 46
      ports/mimxrt10xx/common-hal/analogio/AnalogOut.c
  30. 37
      ports/mimxrt10xx/common-hal/analogio/AnalogOut.h
  31. 1
      ports/mimxrt10xx/common-hal/analogio/__init__.c
  32. 35
      ports/mimxrt10xx/common-hal/board/__init__.c
  33. 192
      ports/mimxrt10xx/common-hal/busio/I2C.c
  34. 44
      ports/mimxrt10xx/common-hal/busio/I2C.h
  35. 33
      ports/mimxrt10xx/common-hal/busio/OneWire.h
  36. 318
      ports/mimxrt10xx/common-hal/busio/SPI.c
  37. 46
      ports/mimxrt10xx/common-hal/busio/SPI.h
  38. 252
      ports/mimxrt10xx/common-hal/busio/UART.c
  39. 54
      ports/mimxrt10xx/common-hal/busio/UART.h
  40. 1
      ports/mimxrt10xx/common-hal/busio/__init__.c
  41. 170
      ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c
  42. 43
      ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.h
  43. 1
      ports/mimxrt10xx/common-hal/digitalio/__init__.c
  44. 226
      ports/mimxrt10xx/common-hal/microcontroller/Pin.c
  45. 51
      ports/mimxrt10xx/common-hal/microcontroller/Pin.h
  46. 65
      ports/mimxrt10xx/common-hal/microcontroller/Processor.c
  47. 40
      ports/mimxrt10xx/common-hal/microcontroller/Processor.h
  48. 284
      ports/mimxrt10xx/common-hal/microcontroller/__init__.c
  49. 106
      ports/mimxrt10xx/common-hal/neopixel_write/__init__.c
  50. 72
      ports/mimxrt10xx/common-hal/os/__init__.c
  51. 551
      ports/mimxrt10xx/common-hal/pulseio/PWMOut.c
  52. 44
      ports/mimxrt10xx/common-hal/pulseio/PWMOut.h
  53. 248
      ports/mimxrt10xx/common-hal/pulseio/PulseIn.c
  54. 55
      ports/mimxrt10xx/common-hal/pulseio/PulseIn.h
  55. 207
      ports/mimxrt10xx/common-hal/pulseio/PulseOut.c
  56. 45
      ports/mimxrt10xx/common-hal/pulseio/PulseOut.h
  57. 1
      ports/mimxrt10xx/common-hal/pulseio/__init__.c
  58. 76
      ports/mimxrt10xx/common-hal/rtc/RTC.c
  59. 34
      ports/mimxrt10xx/common-hal/rtc/RTC.h
  60. 0
      ports/mimxrt10xx/common-hal/rtc/__init__.c
  61. 37
      ports/mimxrt10xx/common-hal/supervisor/Runtime.c
  62. 37
      ports/mimxrt10xx/common-hal/supervisor/Runtime.h
  63. 40
      ports/mimxrt10xx/common-hal/supervisor/__init__.c
  64. 39
      ports/mimxrt10xx/common-hal/time/__init__.c
  65. 48
      ports/mimxrt10xx/fatfs_port.c
  66. 51
      ports/mimxrt10xx/mpconfigport.h
  67. 20
      ports/mimxrt10xx/mpconfigport.mk
  68. 65
      ports/mimxrt10xx/mphalport.c
  69. 52
      ports/mimxrt10xx/mphalport.h
  70. 293
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c
  71. 148
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c
  72. 42
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h
  73. 77
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c
  74. 77
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h
  75. 366
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c
  76. 270
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c
  77. 42
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h
  78. 161
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c
  79. 161
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h
  80. 29
      ports/mimxrt10xx/peripherals/mimxrt10xx/clocks.h
  81. 77
      ports/mimxrt10xx/peripherals/mimxrt10xx/periph.h
  82. 75
      ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h
  83. 1
      ports/mimxrt10xx/qstrdefsport.h
  84. 39
      ports/mimxrt10xx/reset.c
  85. 43
      ports/mimxrt10xx/reset.h
  86. 1
      ports/mimxrt10xx/sdk
  87. 27
      ports/mimxrt10xx/supervisor/cpu.S
  88. 347
      ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c
  89. 255
      ports/mimxrt10xx/supervisor/internal_flash.c
  90. 53
      ports/mimxrt10xx/supervisor/internal_flash.h
  91. 31
      ports/mimxrt10xx/supervisor/internal_flash_root_pointers.h
  92. 168
      ports/mimxrt10xx/supervisor/port.c
  93. 93
      ports/mimxrt10xx/supervisor/serial.c
  94. 56
      ports/mimxrt10xx/supervisor/usb.c
  95. 92
      ports/mimxrt10xx/tick.c
  96. 43
      ports/mimxrt10xx/tick.h
  97. 2
      tools/uf2

@ -102,6 +102,8 @@ jobs:
- "feather_m0_rfm9x"
- "feather_m0_supersized"
- "feather_m4_express"
- "feather_mimxrt1011"
- "feather_mimxrt1062"
- "feather_nrf52840_express"
- "feather_radiofruit_zigbee"
- "feather_stm32f405_express"
@ -109,6 +111,7 @@ jobs:
- "grandcentral_m4_express"
- "hallowing_m0_express"
- "hallowing_m4_express"
- "imxrt1010_evk"
- "itsybitsy_m0_express"
- "itsybitsy_m4_express"
- "itsybitsy_nrf52840_express"

3
.gitmodules vendored

@ -108,3 +108,6 @@
[submodule "lib/mp3"]
path = lib/mp3
url = https://github.com/adafruit/Adafruit_MP3
[submodule "ports/mimxrt10xx/sdk"]
path = ports/mimxrt10xx/sdk
url = https://github.com/arturo182/MIMXRT10xx_SDK

@ -131,6 +131,8 @@ exclude_patterns = ["**/build*",
"ports/esp8266/common-hal",
"ports/esp8266/modules",
"ports/minimal",
"ports/mimxrt10xx/peripherals",
"ports/mimxrt10xx/sdk",
"ports/nrf/device",
"ports/nrf/bluetooth",
"ports/nrf/modules",

@ -26,7 +26,7 @@ import os
import re
SUPPORTED_PORTS = ["atmel-samd", "nrf"]
SUPPORTED_PORTS = ["atmel-samd", "nrf", "mimxrt10xx"]
def parse_port_config(contents, chip_keyword=None):

@ -8,6 +8,7 @@ and ESP8266.
:maxdepth: 2
../ports/atmel-samd/README
../ports/mimxrt10xx/README
../ports/nrf/README
../ports/stm32f4/README
../ports/cxd56/README

@ -0,0 +1 @@
build-*/

@ -0,0 +1,253 @@
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
# Copyright (c) 2019 Artur Pacholec
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Select the board to build for.
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi-
INC += \
-I. \
-I../.. \
-I../lib/mp-readline \
-I../lib/timeutils \
-I../../lib/tinyusb/src \
-I../../supervisor/shared/usb \
-I$(BUILD) \
-Iboards/ \
-Iboards/$(BOARD) \
-Iperipherals/ \
-Iperipherals/mimxrt10xx/ \
-Isdk/CMSIS/Include \
-Isdk/devices/$(CHIP_FAMILY) \
-Isdk/devices/$(CHIP_FAMILY)/drivers \
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
CFLAGS += -Os -DNDEBUG
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
#Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
# You may want to disable -flto if it interferes with debugging.
#CFLAGS += -flto -flto-partition=none
# You may want to enable these flags to make setting breakpoints easier.
CFLAGS += -fno-inline -fno-ipa-sra
else
# -finline-limit can shrink the image size.
# -finline-limit=80 or so is similar to not having it on.
# There is no simple default value, though.
# Do a default shrink for small builds.
ifndef CFLAGS_INLINE_LIMIT
ifeq ($(CIRCUITPY_SMALL_BUILD),1)
CFLAGS_INLINE_LIMIT = 50
endif
endif
ifdef CFLAGS_INLINE_LIMIT
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
endif
#CFLAGS += -flto -flto-partition=none
endif
CFLAGS += $(INC) -Wall -Wno-cast-align -std=gnu11 -nostdlib $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)
CFLAGS += \
-mthumb \
-mapcs \
-mcpu=cortex-m7 \
-mfloat-abi=hard \
-mfpu=fpv5-sp-d16 \
-DCPU_$(CHIP_VARIANT) \
-DDEBUG \
-DXIP_EXTERNAL_FLASH=1 \
-DXIP_BOOT_HEADER_ENABLE=1 \
-D__START=main \
-Os -g3 -Wno-unused-parameter \
-ffunction-sections -fdata-sections -fstack-usage \
-D__STARTUP_CLEAR_BSS
LDFLAGS = $(CFLAGS) -nostartfiles -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
LIBS := -lgcc -lc -lnosys -lm
# Use toolchain libm if we're not using our own.
ifndef INTERNAL_LIBM
LIBS += -lm
endif
LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb -mapcs
BOOTLOADER_SIZE := 0x6000C000
SRC_SDK := \
drivers/fsl_adc.c \
drivers/fsl_cache.c \
drivers/fsl_clock.c \
drivers/fsl_common.c \
drivers/fsl_flexspi.c \
drivers/fsl_gpio.c \
drivers/fsl_lpi2c.c \
drivers/fsl_lpspi.c \
drivers/fsl_lpuart.c \
drivers/fsl_ocotp.c \
drivers/fsl_pwm.c \
drivers/fsl_snvs_hp.c \
drivers/fsl_tempmon.c \
drivers/fsl_trng.c \
system_$(CHIP_FAMILY).c \
SRC_SDK := $(addprefix sdk/devices/$(CHIP_FAMILY)/, $(SRC_SDK))
SRC_C = \
background.c \
boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \
fatfs_port.c \
lib/mp-readline/readline.c \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
lib/utils/buffer_helper.c \
lib/utils/context_manager_helpers.c \
lib/utils/interrupt_char.c \
lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
lib/tinyusb/src/portable/nxp/transdimension/dcd_transdimension.c \
mphalport.c \
peripherals/mimxrt10xx/$(CHIP_FAMILY)/clocks.c \
peripherals/mimxrt10xx/$(CHIP_FAMILY)/periph.c \
peripherals/mimxrt10xx/$(CHIP_FAMILY)/pins.c \
reset.c \
supervisor/flexspi_nor_flash_ops.c \
supervisor/shared/memory.c \
tick.c
ifeq ($(CIRCUITPY_NETWORK),1)
CFLAGS += -DMICROPY_PY_NETWORK=1
SRC_MOD += lib/netutils/netutils.c
ifneq ($(MICROPY_PY_WIZNET5K),0)
WIZNET5K_DIR=drivers/wiznet5k
INC += -I$(TOP)/$(WIZNET5K_DIR)
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=$(MICROPY_PY_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_WIZNET5K)
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).c \
ethernet/wizchip_conf.c \
ethernet/socket.c \
internet/dns/dns.c \
internet/dhcp/dhcp.c \
)
endif # MICROPY_PY_WIZNET5K
endif # CIRCUITPY_NETWORK
ifeq ($(CIRCUITPY_NETWORK),1)
ifneq ($(MICROPY_PY_WIZNET5K),0)
SRC_SHARED_MODULE += wiznet/__init__.c wiznet/wiznet5k.c
endif
endif
# TODO
#ifeq ($(CIRCUITPY_AUDIOBUSIO),1)
#SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
#endif
#
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
$(addprefix common-hal/, $(SRC_COMMON_HAL))
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
$(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
$(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
SRC_S = \
sdk/devices/$(CHIP_FAMILY)/gcc/startup_$(CHIP_FAMILY).S \
supervisor/cpu.S
OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_SDK:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
ifeq ($(INTERNAL_LIBM),1)
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
endif
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.S=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
$(BUILD)/firmware.elf: $(LD_FILE) $(OBJ)
$(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $(filter-out $<,$^) -Wl,--start-group $(LIBS) -Wl,--end-group
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
$(STEPECHO) "Create $@"
$(Q)$(OBJCOPY) -O binary -j .interrupts -j .text -j .ARM.exidx -j .data $^ $@
$(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
$(STEPECHO) "Create $@"
$(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $^
include $(TOP)/py/mkrules.mk
# Print out the value of a make variable.
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
print-%:
@echo $* = $($*)

@ -0,0 +1,3 @@
# CircuitPython Port To The NXP i.MX RT10xx Series
This is a port of CircuitPython to the i.MX RT10xx series of chips.

@ -0,0 +1,82 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "background.h"
//#include "audio_dma.h"
#include "tick.h"
#include "supervisor/filesystem.h"
#include "supervisor/shared/tick.h"
#include "supervisor/usb.h"
#include "py/runtime.h"
#include "shared-module/network/__init__.h"
#include "supervisor/shared/stack.h"
// TODO
#ifdef CIRCUITPY_DISPLAYIO
//#include "shared-module/displayio/__init__.h"
#endif
volatile uint64_t last_finished_tick = 0;
bool stack_ok_so_far = true;
static bool running_background_tasks = false;
void background_tasks_reset(void) {
running_background_tasks = false;
}
void run_background_tasks(void) {
// Don't call ourselves recursively.
if (running_background_tasks) {
return;
}
assert_heap_ok();
running_background_tasks = true;
#if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
audio_dma_background();
#endif
#if CIRCUITPY_DISPLAYIO
displayio_background();
#endif
#if CIRCUITPY_NETWORK
network_module_background();
#endif
filesystem_background();
usb_background();
running_background_tasks = false;
assert_heap_ok();
last_finished_tick = supervisor_ticks_ms64();
}
bool background_tasks_ok(void) {
return supervisor_ticks_ms64() - last_finished_tick < 1000;
}

@ -0,0 +1,38 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H
#define MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H
#include <stdbool.h>
void background_tasks_reset(void);
void run_background_tasks(void);
void run_background_vm_tasks(void);
bool background_tasks_ok(void);
#endif // MICROPY_INCLUDED_MIMXRT10XX_BACKGROUND_H

@ -0,0 +1,48 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// This file defines board specific functions.
#ifndef MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H
#define MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H
#include <stdbool.h>
#include "py/mpconfig.h"
#include "fsl_common.h"
// Initializes board related state once on start up.
void board_init(void);
// Returns true if the user initiates safe mode in a board specific way.
// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific
// way.
bool board_requests_safe_mode(void);
// Reset the state of off MCU components such as neopixels.
void reset_board(void);
#endif // MICROPY_INCLUDED_MIMXRT10XX_BOARDS_BOARD_H

@ -0,0 +1,55 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "fsl_iomuxc.h"
void board_init(void) {
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_06_FLEXSPI_A_SS0_B, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_07_FLEXSPI_A_DATA1,1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_08_FLEXSPI_A_DATA2, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_09_FLEXSPI_A_DATA0, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_10_FLEXSPI_A_SCLK, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_11_FLEXSPI_A_DATA3, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_12_FLEXSPI_A_DQS, 1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_06_FLEXSPI_A_SS0_B,0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_07_FLEXSPI_A_DATA1, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_08_FLEXSPI_A_DATA2, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_09_FLEXSPI_A_DATA0, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_10_FLEXSPI_A_SCLK, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_11_FLEXSPI_A_DATA3, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_12_FLEXSPI_A_DQS, 0x10E1U);
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

@ -0,0 +1,31 @@
#define MICROPY_HW_BOARD_NAME "Feather MIMXRT1011"
#define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A"
//TODO
//#define MICROPY_HW_LED_STATUS (&pin_PA27)
#define MICROPY_HW_NEOPIXEL (&pin_GPIO_SD_05)
// These are pins not to reset.
// QSPI Data pins
//#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 )
// QSPI CS, and QSPI SCK
//#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 )
//#define MICROPY_PORT_C ( 0 )
//#define MICROPY_PORT_D ( 0 )
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (8 * 1024 * 1024)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_10)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_09)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_06)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_04)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_03)
#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_01)
#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_02)

@ -0,0 +1,21 @@
LD_FILE = boards/mimxrt1011-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8074
USB_PRODUCT = "Feather MIMXRT1011"
USB_MANUFACTURER = "arturo182"
USB_DEVICES = "CDC,MSC,HID"
CHIP_VARIANT = MIMXRT1011DAE5A
CHIP_FAMILY = MIMXRT1011
INTERNAL_FLASH_FILESYSTEM = 1
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_ROTARYIO = 0
LONGINT_IMPL = MPZ

@ -0,0 +1,52 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Analog
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_07) },
// Digital
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_05) },
// SPI
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_AD_06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_AD_03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_AD_04) },
// UART
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_AD_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_AD_01) },
// I2C
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_10) },
// ESP control
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_GPIO_13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_GPIO0), MP_ROM_PTR(&pin_GPIO_07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_BUSY), MP_ROM_PTR(&pin_GPIO_08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RESET), MP_ROM_PTR(&pin_GPIO_AD_00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_GPIO_12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_GPIO_11) },
//{ MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RTS), MP_ROM_PTR(&pin_) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO_SD_05) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

@ -0,0 +1,55 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "fsl_iomuxc.h"
void board_init(void) {
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_06_FLEXSPIA_SS0_B, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_07_FLEXSPIA_SCLK,1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_08_FLEXSPIA_DATA00, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_09_FLEXSPIA_DATA01, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_10_FLEXSPIA_DATA02, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_11_FLEXSPIA_DATA03, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_B1_05_FLEXSPIA_DQS, 1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_06_FLEXSPIA_SS0_B,0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_09_FLEXSPIA_DATA01, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_10_FLEXSPIA_DATA02, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_08_FLEXSPIA_DATA00, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_07_FLEXSPIA_SCLK, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_11_FLEXSPIA_DATA03, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_B1_05_FLEXSPIA_DQS, 0x10E1U);
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

@ -0,0 +1,31 @@
#define MICROPY_HW_BOARD_NAME "Feather MIMXRT1062"
#define MICROPY_HW_MCU_NAME "IMXRT1062DVJ6A"
//TODO
//#define MICROPY_HW_LED_STATUS (&pin_PA27)
//#define MICROPY_HW_NEOPIXEL (&pin_PB22)
// These are pins not to reset.
// QSPI Data pins
//#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 )
// QSPI CS, and QSPI SCK
//#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 )
//#define MICROPY_PORT_C ( 0 )
//#define MICROPY_PORT_D ( 0 )
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (8 * 1024 * 1024)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_EMC_22)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_EMC_21)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_B1_07)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_B1_06)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_B1_05)
#define DEFAULT_UART_BUS_RX (&pin_GPIO_B1_03)
#define DEFAULT_UART_BUS_TX (&pin_GPIO_B1_02)

@ -0,0 +1,21 @@
LD_FILE = boards/mimxrt1062-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8076
USB_PRODUCT = "Feather MIMXRT1062"
USB_MANUFACTURER = "arturo182"
USB_DEVICES = "CDC,MSC,HID"
CHIP_VARIANT = MIMXRT1062DVJ6A
CHIP_FAMILY = MIMXRT1062
INTERNAL_FLASH_FILESYSTEM = 1
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_ROTARYIO = 0
LONGINT_IMPL = MPZ

@ -0,0 +1,45 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// Analog
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_B0_13) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_B1_10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_B0_12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_B1_15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_B1_11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_B0_14) },
// Digital
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_EMC_15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_EMC_28) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_EMC_29) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_EMC_04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_EMC_10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_EMC_23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_EMC_12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_B1_08) },
// SPI
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_B1_07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_B1_05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_B1_06) },
// UART
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_B1_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_B1_03) },
// I2C
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_EMC_21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_EMC_22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO_SD_B1_01) },
// TODO: Big connector
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

@ -0,0 +1,55 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "fsl_iomuxc.h"
void board_init(void) {
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_06_FLEXSPI_A_SS0_B, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_07_FLEXSPI_A_DATA1,1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_08_FLEXSPI_A_DATA2, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_09_FLEXSPI_A_DATA0, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_10_FLEXSPI_A_SCLK, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_11_FLEXSPI_A_DATA3, 1U);
IOMUXC_SetPinMux(IOMUXC_GPIO_SD_12_FLEXSPI_A_DQS, 1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_06_FLEXSPI_A_SS0_B,0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_07_FLEXSPI_A_DATA1, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_08_FLEXSPI_A_DATA2, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_09_FLEXSPI_A_DATA0, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_10_FLEXSPI_A_SCLK, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_11_FLEXSPI_A_DATA3, 0x10E1U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_SD_12_FLEXSPI_A_DQS, 0x10E1U);
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

@ -0,0 +1,31 @@
#define MICROPY_HW_BOARD_NAME "IMXRT1010-EVK"
#define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A"
//TODO
//#define MICROPY_HW_LED_STATUS (&pin_PA27)
//#define MICROPY_HW_NEOPIXEL (&pin_PB22)
// These are pins not to reset.
// QSPI Data pins
//#define MICROPY_PORT_A ( PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11 )
// QSPI CS, and QSPI SCK
//#define MICROPY_PORT_B ( PORT_PB10 | PORT_PB11 | PORT_PB22 )
//#define MICROPY_PORT_C ( 0 )
//#define MICROPY_PORT_D ( 0 )
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (16 * 1024 * 1024)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_02)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_01)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_06)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_04)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_03)
#define DEFAULT_UART_BUS_RX (&pin_GPIO_09)
#define DEFAULT_UART_BUS_TX (&pin_GPIO_10)

@ -0,0 +1,22 @@
LD_FILE = boards/mimxrt1011-bootloader-external-flash.ld
USB_VID = 0x239A
USB_PID = 0x8078
USB_PRODUCT = "IMXRT1010-EVK"
USB_MANUFACTURER = "NXP"
USB_DEVICES = "CDC,MSC,HID"
CHIP_VARIANT = MIMXRT1011DAE5A
CHIP_FAMILY = MIMXRT1011
INTERNAL_FLASH_FILESYSTEM = 1
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_NVM = 0
CIRCUITPY_ROTARYIO = 0
LONGINT_IMPL = MPZ

@ -0,0 +1,37 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_AD_05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_AD_06) },
//{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_08) }, // Connected to audio codec
//{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_01) }, // Connected to audio codec
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_AD_01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_AD_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_SD_02) },
//{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_03) }, // Connected to audio codec
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_AD_05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_AD_04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_AD_03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_AD_06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_USR_LED), MP_ROM_PTR(&pin_GPIO_11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_USR_SW), MP_ROM_PTR(&pin_GPIO_SD_05) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

@ -0,0 +1,106 @@
ENTRY(Reset_Handler)
_minimum_stack_size = 64K;
_minimum_heap_size = 0;
MEMORY
{
FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 8M
FLASH_BOOTLOADER (rx) : ORIGIN = 0x60000000, LENGTH = 48K
FLASH_ISR (rx) : ORIGIN = 0x6000C000, LENGTH = 1K
FLASH_TEXT (rx) : ORIGIN = 0x6000C400, LENGTH = 975K
FLASH_FATFS (r) : ORIGIN = 0x60100000, LENGTH = 7M
RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 32K
OCRAM (rwx) : ORIGIN = 0x20200000, LENGTH = 64K
}
_estack = ORIGIN(OCRAM) + LENGTH(OCRAM);
_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4;
__fatfs_flash_start_addr = ORIGIN(FLASH_FATFS);
__fatfs_flash_length = LENGTH(FLASH_FATFS);
__RAM_VECTOR_TABLE_SIZE_BYTES = 0;
SECTIONS
{
.interrupts :
{
__VECTOR_TABLE = .;
__VECTOR_RAM = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > FLASH_ISR
.text :
{
. = ALIGN(4);
*(EXCLUDE_FILE(
*flexspi_nor_flash_ops.o
*fsl_flexspi.o
) .text*) /* .text* sections (code) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} > FLASH_TEXT
.ARM.exidx :
{
*(.ARM.exidx*)
*(.gnu.linkonce.armexidx.*)
_etext = .; /* define a global symbol at end of code */
__etext = .; /* define a global symbol at end of code */
} > FLASH_TEXT
/* used by the startup to initialize data */
_sidata = .;
.data : AT (_sidata)
{
. = ALIGN(4);
__data_start__ = .; /* create a global symbol at data start */
*(.data*) /* .data* sections */
*flexspi_nor_flash_ops.o(.text*)
*fsl_flexspi.o(.text*)
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > RAM
/* Uninitialized data section */
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
PROVIDE(end = .);
} > RAM
.heap :
{
. = ALIGN(8);
_heap_start = .; /* define a global symbol at heap start */
. += _minimum_heap_size;
__HeapLimit = .;
} > OCRAM
.stack :
{
. = ALIGN(8);
. += _minimum_stack_size;
} > OCRAM
.ARM.attributes 0 : { *(.ARM.attributes) }
}
ASSERT(__data_end__ <= ORIGIN(FLASH_TEXT) + LENGTH(FLASH_TEXT), "region FLASH_TEXT overflowed with text and data")
ASSERT(_estack - _minimum_stack_size >= __HeapLimit, "region OCRAM overflowed with stack and heap")

@ -0,0 +1,123 @@
ENTRY(Reset_Handler)
_minimum_stack_size = 64K;
_minimum_heap_size = 0;
MEMORY
{
FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 8M
FLASH_CONFIG (rx) : ORIGIN = 0x60000400, LENGTH = 3K
FLASH_IVT (rx) : ORIGIN = 0x60001000, LENGTH = 4K
FLASH_ISR (rx) : ORIGIN = 0x60002000, LENGTH = 1K
FLASH_TEXT (rx) : ORIGIN = 0x60002400, LENGTH = 1015K
FLASH_FATFS (r) : ORIGIN = 0x60100000, LENGTH = 7M
RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 32K
OCRAM (rwx) : ORIGIN = 0x20200000, LENGTH = 64K
}
_estack = ORIGIN(OCRAM) + LENGTH(OCRAM);
_bootloader_dbl_tap = 0;
__fatfs_flash_start_addr = ORIGIN(FLASH_FATFS);
__fatfs_flash_length = LENGTH(FLASH_FATFS);
__RAM_VECTOR_TABLE_SIZE_BYTES = 0;
SECTIONS
{
.flash_config :
{
. = ALIGN(4);
KEEP(* (.boot_hdr.conf))
. = ALIGN(4);
} > FLASH_CONFIG
.ivt :
{
. = ALIGN(4);
KEEP(* (.boot_hdr.ivt))
KEEP(* (.boot_hdr.boot_data))
KEEP(* (.boot_hdr.dcd_data))
. = ALIGN(4);
} > FLASH_IVT
.interrupts :
{
__VECTOR_TABLE = .;
__VECTOR_RAM = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > FLASH_ISR
.text :
{
. = ALIGN(4);
*(EXCLUDE_FILE(
*flexspi_nor_flash_ops.o
*fsl_flexspi.o
) .text*) /* .text* sections (code) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} > FLASH_TEXT
.ARM.exidx :
{
*(.ARM.exidx*)
*(.gnu.linkonce.armexidx.*)
_etext = .; /* define a global symbol at end of code */
__etext = .; /* define a global symbol at end of code */
} > FLASH_TEXT
/* used by the startup to initialize data */
_sidata = .;
.data : AT (_sidata)
{
. = ALIGN(4);
__data_start__ = .; /* create a global symbol at data start */
*(.data*) /* .data* sections */
*flexspi_nor_flash_ops.o(.text*)
*fsl_flexspi.o(.text*)
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > RAM
/* Uninitialized data section */
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
PROVIDE(end = .);
} > RAM
.heap :
{
. = ALIGN(8);
_heap_start = .; /* define a global symbol at heap start */
. += _minimum_heap_size;
__HeapLimit = .;
} > OCRAM
.stack :
{
. = ALIGN(8);
. += _minimum_stack_size;
} > OCRAM
.ARM.attributes 0 : { *(.ARM.attributes) }
}
ASSERT(__data_end__ <= ORIGIN(FLASH_TEXT) + LENGTH(FLASH_TEXT), "region FLASH_TEXT overflowed with text and data")
ASSERT(_estack - _minimum_stack_size >= __HeapLimit, "region OCRAM overflowed with stack and heap")

@ -0,0 +1,106 @@
ENTRY(Reset_Handler)
_minimum_stack_size = 64K;
_minimum_heap_size = 0;
MEMORY
{
FLASH (rx) : ORIGIN = 0x60000000, LENGTH = 8M
FLASH_BOOTLOADER (rx) : ORIGIN = 0x60000000, LENGTH = 48K
FLASH_ISR (rx) : ORIGIN = 0x6000C000, LENGTH = 1K
FLASH_TEXT (rx) : ORIGIN = 0x6000C400, LENGTH = 975K
FLASH_FATFS (r) : ORIGIN = 0x60100000, LENGTH = 7M
RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 128K
OCRAM (rwx) : ORIGIN = 0x20200000, LENGTH = 768K
}
_estack = ORIGIN(OCRAM) + LENGTH(OCRAM);
_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4;
__fatfs_flash_start_addr = ORIGIN(FLASH_FATFS);
__fatfs_flash_length = LENGTH(FLASH_FATFS);
__RAM_VECTOR_TABLE_SIZE_BYTES = 0;
SECTIONS
{
.interrupts :
{
__VECTOR_TABLE = .;
__VECTOR_RAM = .;
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > FLASH_ISR
.text :
{
. = ALIGN(4);
*(EXCLUDE_FILE(
*flexspi_nor_flash_ops.o
*fsl_flexspi.o
) .text*) /* .text* sections (code) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} > FLASH_TEXT
.ARM.exidx :
{
*(.ARM.exidx*)
*(.gnu.linkonce.armexidx.*)
_etext = .; /* define a global symbol at end of code */
__etext = .; /* define a global symbol at end of code */
} > FLASH_TEXT
/* used by the startup to initialize data */
_sidata = .;
.data : AT (_sidata)
{
. = ALIGN(4);
__data_start__ = .; /* create a global symbol at data start */
*(.data*) /* .data* sections */
*flexspi_nor_flash_ops.o(.text*)
*fsl_flexspi.o(.text*)
. = ALIGN(4);
__data_end__ = .; /* define a global symbol at data end */
} > RAM
/* Uninitialized data section */
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
PROVIDE(end = .);
} > RAM
.heap :
{
. = ALIGN(8);
_heap_start = .; /* define a global symbol at heap start */
. += _minimum_heap_size;
__HeapLimit = .;
} > OCRAM
.stack :
{
. = ALIGN(8);
. += _minimum_stack_size;
} > OCRAM
.ARM.attributes 0 : { *(.ARM.attributes) }
}
ASSERT(__data_end__ <= ORIGIN(FLASH_TEXT) + LENGTH(FLASH_TEXT), "region FLASH_TEXT overflowed with text and data")
ASSERT(_estack - _minimum_stack_size >= __HeapLimit, "region OCRAM overflowed with stack and heap")

@ -0,0 +1,88 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2019 Artur Pacholec
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "common-hal/analogio/AnalogIn.h"
#include <string.h>
#include "py/runtime.h"
#include "fsl_adc.h"
#define ADC_CHANNEL_GROUP 0
void common_hal_analogio_analogin_construct(analogio_analogin_obj_t* self,
const mcu_pin_obj_t *pin) {
adc_config_t config = {0};
if (pin->adc == NULL) {
mp_raise_ValueError(translate("Pin does not have ADC capabilities"));
}
ADC_GetDefaultConfig(&config);
config.enableLongSample = true;
config.samplePeriodMode = kADC_SamplePeriod8or24Clocks;
ADC_Init(pin->adc, &config);
ADC_SetHardwareAverageConfig(pin->adc, kADC_HardwareAverageCount32);
ADC_DoAutoCalibration(pin->adc);
claim_pin(pin);
self->pin = pin;
}
bool common_hal_analogio_analogin_deinited(analogio_analogin_obj_t *self) {
return self->pin == mp_const_none;
}
void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t