Merge remote-tracking branch 'upstream/master' into stm32x7-setup

This commit is contained in:
Lucian Copeland 2020-04-13 12:03:56 -04:00
commit 6227e63cc5
30 changed files with 271 additions and 42 deletions

View File

@ -16,15 +16,15 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.5
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.5
python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y eatmydata
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
pip install requests sh click setuptools cpp-coveralls Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml
- name: Versions
run: |
gcc --version
@ -42,7 +42,7 @@ jobs:
make -C ports/unix -j2
make -C ports/unix coverage -j2
- name: Test all
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
working-directory: tests
- name: Print failure info
run: |
@ -54,10 +54,10 @@ jobs:
working-directory: tests
if: failure()
- name: Native Tests
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
working-directory: tests
- name: mpy Tests
run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
working-directory: tests
- name: Docs
run: sphinx-build -E -W -b html . _build/html
@ -189,6 +189,7 @@ jobs:
- "mini_sam_m4"
- "monster_m4sk"
- "ndgarage_ndbit6"
- "nfc_copy_cat"
- "nucleo_f767zi"
- "nucleo_h743zi_2"
- "ohs2020_badge"
@ -246,10 +247,10 @@ jobs:
- "xinabox_cs11"
steps:
- name: Set up Python 3.5
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.5
python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y gettext
@ -292,10 +293,10 @@ jobs:
- "fomu"
steps:
- name: Set up Python 3.5
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.5
python-version: 3.8
- name: Install deps
run: |
sudo apt-get install -y gettext

View File

@ -12,10 +12,10 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set up Python 3.5
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.5
python-version: 3.8
- name: Install deps
run: |
pip install requests sh click

2
.gitmodules vendored
View File

@ -109,7 +109,7 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
[submodule "extmod/ulab"]
path = extmod/ulab
url = https://github.com/v923z/micropython-ulab/
url = https://github.com/v923z/micropython-ulab
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
path = frozen/Adafruit_CircuitPython_ESP32SPI
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI

14
conf.py
View File

@ -17,7 +17,7 @@ import json
import sys
import os
from recommonmark.parser import CommonMarkParser
import recommonmark
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -55,16 +55,20 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.coverage',
'rstjinja',
'c2rst'
'c2rst',
'recommonmark',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['templates']
# The suffix of source filenames.
source_suffix = ['.rst', '.md', '.c', '.h']
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
'.c': ''
}
source_parsers = {'.md': CommonMarkParser}
# The encoding of source files.
#source_encoding = 'utf-8-sig'
@ -358,4 +362,4 @@ intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None),
"register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)}
def setup(app):
app.add_stylesheet("customstyle.css")
app.add_css_file("customstyle.css")

View File

@ -247,7 +247,7 @@ Methods
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
.. method:: wlan.config('param')
.. method:: wlan.config(param=value, ...)
wlan.config(param=value, ...)
Get or set general network interface parameters. These methods allow to work
with additional parameters beyond standard IP configuration (as dealt with by

View File

@ -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
*
* 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"
void board_init(void)
{
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,51 @@
#define MICROPY_HW_BOARD_NAME "Electronic Cats NFC Copy Cat"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_LED_STATUS (&pin_PA14)
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define SPI_FLASH_MOSI_PIN &pin_PA08
#define SPI_FLASH_MISO_PIN &pin_PA11
#define SPI_FLASH_SCK_PIN &pin_PA09
#define SPI_FLASH_CS_PIN &pin_PA10
// No microcontroller.nvm
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define DEFAULT_SPI_BUS_SCK (&pin_PA17)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA16)
#define DEFAULT_SPI_BUS_MISO (&pin_PA19)
#define IGNORE_PIN_PA03 1
#define IGNORE_PIN_PA20 1
#define IGNORE_PIN_PA21 1
// USB is always used.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1
#define IGNORE_PIN_PB01 1
#define IGNORE_PIN_PB02 1
#define IGNORE_PIN_PB03 1
#define IGNORE_PIN_PB04 1
#define IGNORE_PIN_PB05 1
#define IGNORE_PIN_PB06 1
#define IGNORE_PIN_PB07 1
#define IGNORE_PIN_PB08 1
#define IGNORE_PIN_PB09 1
#define IGNORE_PIN_PB10 1
#define IGNORE_PIN_PB11 1
#define IGNORE_PIN_PB12 1
#define IGNORE_PIN_PB13 1
#define IGNORE_PIN_PB14 1
#define IGNORE_PIN_PB15 1
#define IGNORE_PIN_PB16 1
#define IGNORE_PIN_PB17 1
#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1
#define IGNORE_PIN_PB30 1
#define IGNORE_PIN_PB31 1
#define IGNORE_PIN_PB00 1

View File

@ -0,0 +1,14 @@
USB_VID = 0x1209
USB_PID = 0xBAB8
USB_PRODUCT = "NFC Copy Cat"
USB_MANUFACTURER = "Electronic Cats"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "GD25Q16C"
LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1

View File

@ -0,0 +1,20 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA02) }, // IRQ
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) }, // IN_A
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) }, // IN_B
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA05) }, // LED
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA04) }, // LED
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA14) }, // LED
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PA27) }, // Switch
{ MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_PA28) }, // Switch
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA18) }, // CS
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -26,8 +26,42 @@ SECTIONS
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
*(.itcm.*) /* Instruction Tightly Coupled Memory */
*(.dtcm_data.*) /* Data Tightly Coupled Memory */
*(.itcm.*) /* Instruction Tightly Coupled Memory */
*(.dtcm_data.*) /* Data Tightly Coupled Memory */
*(.text.cmp_lfn)
*(.text.qstr_find_strn)
*(.text.dcd_edpt_xfer)
*(.text.pop_rule)
*(.text.ff_wtoupper)
*(.text.dir_find)
*(.text.push_rule)
*(.text.csr_writel)
*(.text.csr_readl)
*(.text.timer0_ev_pending_write)
*(.text.autoreload_tick)
*(.text.filesystem_tick)
*(.text.usb_background)
*(.text.dcd_*)
*(.text.tud_control_*)
*(.text.tud_cdc_n_write_flush)
*(.text.tud_task)
*(.text.tu_edpt_dir)
*(.text.tu_fifo_empty)
*(.text.usbd_edpt_busy)
*(.text.irq_getmask)
*(.text.irq_setmask)
*(.text.irq_pending)
*(.text._osal_q_lock)
*(.text.osal_queue_receive)
*(.text.mp_obj_get_type)
*(.text.mp_parse)
*(.text.parse_compile_execute)
*(.text.mp_map_lookup)
*(.text.mp_execute_bytecode) /* Note: this function is 7kb */
*(.ramtext) /* .text* sections (code) */
*(.ramtext*) /* .text* sections (code) */
*(.data) /* .data sections */
@ -63,7 +97,7 @@ SECTIONS
_sbss = .; /* define a global symbol at bss start; used by startup code */
*(.bss)
*(.bss*)
*(.dtcm_bss.*) /* Data Tightly Coupled Memory */
*(.dtcm_bss.*) /* Data Tightly Coupled Memory */
*(.sbss)
*(.sbss*)
*(COMMON)

View File

@ -210,6 +210,18 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
LPSPI_Enable(self->spi, false);
uint32_t tcrPrescaleValue;
self->baudrate = LPSPI_MasterSetBaudRate(self->spi, baudrate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue);
LPSPI_Enable(self->spi, true);
if ((polarity == common_hal_busio_spi_get_polarity(self)) &&
(phase == common_hal_busio_spi_get_phase(self)) &&
(bits == ((self->spi->TCR & LPSPI_TCR_FRAMESZ_MASK) >> LPSPI_TCR_FRAMESZ_SHIFT)) + 1) {
return true;
}
lpspi_master_config_t config = { 0 };
LPSPI_MasterGetDefaultConfig(&config);
@ -221,11 +233,6 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
LPSPI_Deinit(self->spi);
LPSPI_MasterInit(self->spi, &config, LPSPI_MASTER_CLK_FREQ);
LPSPI_Enable(self->spi, false);
uint32_t tcrPrescaleValue;
self->baudrate = LPSPI_MasterSetBaudRate(self->spi, config.baudRate, LPSPI_MASTER_CLK_FREQ, &tcrPrescaleValue);
LPSPI_Enable(self->spi, true);
return true;
}

View File

@ -126,7 +126,7 @@ Array type codes
Type code for unsigned integers in the range 0 .. 255 inclusive, like the 'H' typecode of `array.array`
.. attribute:: uint8
.. attribute:: uint16
Type code for unsigned integers in the range 0 .. 65535 inclusive, like the 'h' typecode of `array.array`

View File

@ -69,6 +69,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
self->auto_brightness = auto_brightness;
self->first_manual_refresh = !auto_refresh;
self->data_as_commands = data_as_commands;
self->backlight_on_high = backlight_on_high;
self->native_frames_per_second = native_frames_per_second;
self->native_ms_per_frame = 1000 / native_frames_per_second;

View File

@ -27,7 +27,7 @@ print({1:1} == {2:1})
try:
{}[0]
except KeyError as er:
print('KeyError', er, repr(er), er.args)
print('KeyError', er, er.args)
# unsupported unary op
try:

View File

@ -1,7 +1,6 @@
print(repr(IndexError()))
print(str(IndexError()))
print(repr(IndexError("foo")))
print(str(IndexError("foo")))
a = IndexError(1, "test", [100, 200])

View File

@ -0,0 +1,14 @@
here1
3
here2
[1, 2]
here1
None
here2
[1, 2]
here1
123
here2
[1, 2]
444
[0, 1, 2]

View File

@ -0,0 +1,20 @@
-1
1
StopIteration
-1
1
2
leaf caught GeneratorExit and swallowed it
delegating caught GeneratorExit
StopIteration
-1
1
2
leaf caught GeneratorExit and raised StopIteration instead
delegating caught GeneratorExit
StopIteration
123
RuntimeError
0
1
close

View File

@ -0,0 +1,6 @@
1
got ValueError from upstream!
str1
got TypeError from downstream!
123
got StopIteration from downstream!

View File

@ -0,0 +1,10 @@
None
StopIteration
1
None
StopIteration
[1, 2]
None
StopIteration
None
ValueError

View File

@ -7,4 +7,4 @@ print(next(g))
try:
print(next(g))
except StopIteration as e:
print(repr(e))
print(type(e), e.args)

View File

@ -17,9 +17,9 @@ try:
except TypeError:
print("TypeError")
# overflow because rhs of >> is being converted to machine int
# overflow because arg of bytearray is being converted to machine int
try:
1 >> i
bytearray(i)
except OverflowError:
print('OverflowError')

View File

@ -0,0 +1,3 @@
SyntaxError
SyntaxError
SyntaxError

View File

@ -1,4 +1,4 @@
# tests that differ when running under Python 3.4 vs 3.5/3.6
# tests that differ when running under Python 3.4 vs 3.5/3.6/3.7
try:
exec
@ -36,3 +36,7 @@ test_syntax("del ()") # can't delete empty tuple (in 3.6 we can)
import sys
print(sys.version[:3])
print(sys.version_info[0], sys.version_info[1])
# from basics/exception1.py
# in 3.7 no comma is printed if there is only 1 arg (in 3.4-3.6 one is printed)
print(repr(IndexError("foo")))

View File

@ -11,3 +11,4 @@ SyntaxError
SyntaxError
3.4
3 4
IndexError('foo',)

View File

@ -15,4 +15,4 @@ while s:
print(s.pop()) # last pop() should trigger the optimisation
for i in range(N):
s.add(i) # check that we can add the numbers back to the set
print(list(s))
print(sorted(s))

View File

@ -7,12 +7,12 @@ print(repr(e))
print(e.args)
try:
raise MyExc("Some error")
raise MyExc("Some error", 1)
except MyExc as e:
print("Caught exception:", repr(e))
try:
raise MyExc("Some error2")
raise MyExc("Some error2", 2)
except Exception as e:
print("Caught exception:", repr(e))

View File

@ -1,7 +1,7 @@
try:
raise ValueError(534)
except ValueError as e:
print(repr(e))
print(type(e), e.args)
# Var bound in except block is automatically deleted
try:

View File

@ -0,0 +1,2 @@
import import1b None 0
456

View File

@ -9,7 +9,7 @@ def f():
print(sys.exc_info()[0:2])
try:
1/0
raise ValueError('value', 123)
except:
print(sys.exc_info()[0:2])
f()

View File

@ -68,9 +68,9 @@ def keyboard_hid_descriptor(report_id):
0x81, 0x02, # Input (Data, Variable, Absolute)
0x81, 0x01, # Input (Constant)
0x19, 0x00, # Usage Minimum (0)
0x29, 101, # Usage Maximum (101)
0x29, 0xDD, # Usage Maximum (221)
0x15, 0x00, # Logical Minimum (0)
0x25, 101, # Logical Maximum (101)
0x25, 0xDD, # Logical Maximum (221)
0x75, 0x08, # Report Size (8)
0x95, 0x06, # Report Count (6)
0x81, 0x00, # Input (Data, Array)