Merge remote-tracking branch 'upstream/main' into stm32-timer-allocator

This commit is contained in:
Lucian Copeland 2020-07-08 16:03:12 -04:00
commit 9c38f5dcb1
25 changed files with 2047 additions and 405 deletions

View File

@ -236,6 +236,7 @@ jobs:
- "pyportal"
- "pyportal_titano"
- "pyruler"
- "raytac_mdbt50q-db-40"
- "robohatmm1_m4"
- "sam32"
- "same54_xplained"

View File

@ -70,7 +70,7 @@ CircuitPython/MicroPython-specific libraries
Functionality specific to the CircuitPython/MicroPython implementation is available in
the following libraries. These libraries may change signficantly or be removed in future
versions of CircuitPtyon.
versions of CircuitPython.
.. toctree::
:maxdepth: 1

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-02 15:29+0200\n"
"POT-Creation-Date: 2020-07-07 14:38-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1092,6 +1092,10 @@ msgstr ""
msgid "Must provide MISO or MOSI pin"
msgstr ""
#: ports/stm/common-hal/busio/SPI.c
msgid "Must provide SCK pin"
msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "Must use a multiple of 6 rgb pins, not %d"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-02 15:29+0200\n"
"PO-Revision-Date: 2020-06-29 13:13+0000\n"
"PO-Revision-Date: 2020-07-07 15:59+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
"Language: es\n"
@ -69,7 +69,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q failure: %d"
msgstr ""
msgstr "%q fallo: %d"
#: shared-bindings/microcontroller/Pin.c
msgid "%q in use"
@ -100,7 +100,7 @@ msgstr "%q debe ser una tupla de longitud 2"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
msgid "%q pin invalid"
msgstr ""
msgstr "pin inválido %q"
#: shared-bindings/fontio/BuiltinFont.c
msgid "%q should be an int"
@ -220,7 +220,7 @@ msgstr "'align' requiere 1 argumento"
#: py/compile.c
msgid "'async for' or 'async with' outside async function"
msgstr ""
msgstr "'async for' o 'async with' fuera de la función async"
#: py/compile.c
msgid "'await' outside function"
@ -364,6 +364,8 @@ msgstr "Como máximo %d %q se puede especificar (no %d)"
#: supervisor/shared/safe_mode.c
msgid "Attempted heap allocation when MicroPython VM not running."
msgstr ""
"Se intentó asignación del montículo, sin que la VM de MicroPython esté "
"ejecutando."
#: main.c
msgid "Auto-reload is off.\n"
@ -416,7 +418,7 @@ msgstr "El brillo no se puede ajustar"
#: shared-bindings/_bleio/UUID.c
#, c-format
msgid "Buffer + offset too small %d %d %d"
msgstr ""
msgstr "Búfer + compensado muy pequeños %d %d %d"
#: shared-module/usb_hid/Device.c
#, c-format
@ -441,7 +443,7 @@ msgstr "La longitud del buffer %d es muy grande. Debe ser menor a %d"
#: ports/atmel-samd/common-hal/sdioio/SDCard.c
#: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c
msgid "Buffer length must be a multiple of 512"
msgstr ""
msgstr "El tamaño del búfer debe ser múltiplo de 512"
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
@ -464,7 +466,7 @@ msgstr "Bus pin %d ya está siendo utilizado"
#: shared-bindings/_bleio/UUID.c
msgid "Byte buffer must be 16 bytes."
msgstr "Byte buffer debe de ser 16 bytes"
msgstr "Búfer Byte debe de ser 16 bytes."
#: shared-bindings/nvm/ByteArray.c
msgid "Bytes must be between 0 and 255."
@ -480,7 +482,7 @@ msgstr "Llame a super().__ init __() antes de acceder al objeto nativo."
#: ports/nrf/common-hal/_bleio/Characteristic.c
msgid "Can't set CCCD on local Characteristic"
msgstr ""
msgstr "No se puede configurar CCCD en la característica local"
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
msgid "Cannot delete values"
@ -494,11 +496,13 @@ msgstr "No puede ser pull mientras este en modo de salida"
#: ports/nrf/common-hal/microcontroller/Processor.c
msgid "Cannot get temperature"
msgstr "No se puede obtener la temperatura."
msgstr "No se puede obtener la temperatura"
#: shared-bindings/_bleio/Adapter.c
msgid "Cannot have scan responses for extended, connectable advertisements."
msgstr ""
"No se pueden obtener respuestas de exploración para anuncios extendidos y "
"conectables."
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "Cannot output both channels on the same pin"
@ -568,7 +572,7 @@ msgstr ""
#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
msgstr "Clock pin init fallido"
msgstr "Iniciado de pin de reloj fallido."
#: shared-module/bitbangio/I2C.c
msgid "Clock stretch too long"
@ -585,7 +589,7 @@ msgstr "Entrada de columna debe ser digitalio.DigitalInOut"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Command debe estar entre 0 y 255."
msgstr "Command debe ser un int entre 0 y 255"
#: shared-bindings/_bleio/Connection.c
msgid ""
@ -609,7 +613,7 @@ msgstr "No se pudo inicializar el GNSS"
#: ports/cxd56/common-hal/sdioio/SDCard.c
msgid "Could not initialize SDCard"
msgstr ""
msgstr "No se pudo inicializar SDCard"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
msgid "Could not initialize UART"
@ -663,7 +667,7 @@ msgstr "No se pudo asignar el segundo buffer"
#: supervisor/shared/safe_mode.c
msgid "Crash into the HardFault_Handler."
msgstr ""
msgstr "Choque contra el HardFault_Handler."
#: ports/stm/common-hal/analogio/AnalogOut.c
msgid "DAC Channel Init Error"
@ -768,16 +772,16 @@ msgstr "No se admiten anuncios extendidos con respuesta de escaneo."
#: extmod/ulab/code/fft.c
msgid "FFT is defined for ndarrays only"
msgstr ""
msgstr "FFT se define solo para ndarrays"
#: shared-bindings/ps2io/Ps2.c
msgid "Failed sending command."
msgstr "Fallo enviando comando"
#: ports/nrf/sd_mutex.c
#, fuzzy, c-format
#, c-format
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "No se puede adquirir el mutex, status: 0x%08lX"
msgstr "No se puede adquirir el mutex, error 0x%04x"
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
@ -889,7 +893,7 @@ msgstr "Cifrado insuficiente"
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
msgstr "Error interno de definición"
#: shared-module/rgbmatrix/RGBMatrix.c
#, c-format
@ -898,7 +902,7 @@ msgstr "Error interno #%d"
#: shared-bindings/sdioio/SDCard.c
msgid "Invalid %q"
msgstr ""
msgstr "%q inválido"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
@ -1033,7 +1037,7 @@ msgstr "Modo de ejecución inválido."
#: shared-module/_bleio/Attribute.c
msgid "Invalid security_mode"
msgstr ""
msgstr "Modo de seguridad no válido"
#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
@ -1090,7 +1094,7 @@ msgstr "Valor máximo de x cuando se refleja es %d"
#: supervisor/shared/safe_mode.c
msgid "MicroPython NLR jump failed. Likely memory corruption."
msgstr ""
msgstr "MicroPython NLR jump falló. Probable corrupción de la memoria."
#: supervisor/shared/safe_mode.c
msgid "MicroPython fatal error."
@ -1115,7 +1119,7 @@ msgstr "Debe proporcionar un pin MISO o MOSI"
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "Must use a multiple of 6 rgb pins, not %d"
msgstr ""
msgstr "Debe usar un múltiplo de 6 pines rgb, no %d"
#: py/parse.c
msgid "Name too long"
@ -1123,7 +1127,7 @@ msgstr "Nombre muy largo"
#: ports/nrf/common-hal/_bleio/Characteristic.c
msgid "No CCCD for this Characteristic"
msgstr ""
msgstr "No hay CCCD para esta característica"
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
#: ports/stm/common-hal/analogio/AnalogOut.c
@ -1214,7 +1218,7 @@ msgstr "No hay temporizador disponible"
#: supervisor/shared/safe_mode.c
msgid "Nordic Soft Device failure assertion."
msgstr ""
msgstr "fallo de aserción de dispositivo Nordic Soft."
#: ports/nrf/common-hal/_bleio/__init__.c
#: shared-bindings/_bleio/CharacteristicBuffer.c
@ -1255,6 +1259,8 @@ msgid ""
"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: "
"%d bpp given"
msgstr ""
"Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o "
"más: %d bpp proporcionados"
#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
@ -1325,7 +1331,7 @@ msgstr "Pop de un buffer Ps2 vacio"
#: shared-bindings/_bleio/Adapter.c
msgid "Prefix buffer must be on the heap"
msgstr ""
msgstr "El búfer de prefijo debe estar en el montículo"
#: main.c
msgid "Press any key to enter the REPL. Use CTRL-D to reload."
@ -1412,7 +1418,7 @@ msgstr "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n"
#: shared-module/sdcardio/SDCard.c
msgid "SD card CSD format not supported"
msgstr ""
msgstr "Sin capacidad para formato CSD para tarjeta SD"
#: ports/atmel-samd/common-hal/busio/I2C.c
#: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c
@ -1484,7 +1490,7 @@ msgstr "Suministre al menos un pin UART"
#: shared-bindings/gnss/GNSS.c
msgid "System entry must be gnss.SatelliteSystem"
msgstr ""
msgstr "La entrada del sistema debe ser gnss.SatelliteSystem"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Temperature read timed out"
@ -1495,6 +1501,8 @@ msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
"Please increase the stack size if you know how, or if not:"
msgstr ""
"El montículo de CircuitPython se dañó porque la pila era demasiado pequeña.\n"
"Aumente el tamaño de la pila si sabe cómo, o si no:"
#: supervisor/shared/safe_mode.c
msgid ""
@ -1654,7 +1662,7 @@ msgstr "Tipo de uuid nrfx inesperado"
#: ports/nrf/common-hal/_bleio/__init__.c
#, c-format
msgid "Unknown gatt error: 0x%04x"
msgstr ""
msgstr "Error de gatt desconocido: 0x%04x"
#: supervisor/shared/safe_mode.c
msgid "Unknown reason."
@ -1729,22 +1737,25 @@ msgstr "ADVERTENCIA: El nombre de archivo de tu código tiene dos extensiones\n"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET"
msgstr ""
"WatchDogTimer no se puede desinicializar luego de definirse en modo RESET"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "WatchDogTimer is not currently running"
msgstr ""
msgstr "WatchDogTimer no se está ejecutando en este momento"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET"
msgstr ""
"WatchDogTimer.mode no se puede modificar luego de configurar WatchDogMode."
"RESET"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "WatchDogTimer.timeout must be greater than 0"
msgstr ""
msgstr "WatchDogTimer.timeout debe ser mayor a 0"
#: supervisor/shared/safe_mode.c
msgid "Watchdog timer expired."
msgstr ""
msgstr "Temporizador de perro guardián expirado."
#: py/builtinhelp.c
#, c-format
@ -1764,7 +1775,7 @@ msgstr ""
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Writes not supported on Characteristic"
msgstr ""
msgstr "Escrituras no admitidas en la característica"
#: supervisor/shared/safe_mode.c
msgid "You are in safe mode: something unanticipated happened.\n"
@ -2056,7 +2067,7 @@ msgstr ""
#: shared-module/sdcardio/SDCard.c
msgid "can't set 512 block size"
msgstr ""
msgstr "no se puede definir un tamaño de bloque de 512"
#: py/objnamedtuple.c
msgid "can't set attribute"
@ -2110,7 +2121,7 @@ msgstr "no se puede reformar el arreglo (forma de entrada/salida incompatible)"
#: py/emitnative.c
msgid "casting"
msgstr ""
msgstr "convirtiendo tipo"
#: shared-bindings/_stage/Text.c
msgid "chars buffer too small"
@ -2170,27 +2181,27 @@ msgstr "conversión a objeto"
#: extmod/ulab/code/filter.c
msgid "convolve arguments must be linear arrays"
msgstr ""
msgstr "los argumentos para convolve deben ser arreglos lineares"
#: extmod/ulab/code/filter.c
msgid "convolve arguments must be ndarrays"
msgstr ""
msgstr "los argumentos para convolve deben ser ndarrays"
#: extmod/ulab/code/filter.c
msgid "convolve arguments must not be empty"
msgstr ""
msgstr "los argumentos para convolve no deben estar vacíos"
#: extmod/ulab/code/ndarray.c
msgid "could not broadast input array from shape"
msgstr ""
msgstr "no se pudo anunciar la matriz de entrada desde la forma"
#: extmod/ulab/code/poly.c
msgid "could not invert Vandermonde matrix"
msgstr ""
msgstr "no se pudo invertir la matriz de Vandermonde"
#: shared-module/sdcardio/SDCard.c
msgid "couldn't determine SD card version"
msgstr ""
msgstr "no se pudo determinar la versión de la tarjeta SD"
#: extmod/ulab/code/approx.c
msgid "data must be iterable"
@ -2202,7 +2213,7 @@ msgstr "los datos deben ser de igual tamaño"
#: extmod/ulab/code/numerical.c
msgid "ddof must be smaller than length of data set"
msgstr ""
msgstr "ddof debe ser menor que la longitud del conjunto de datos"
#: py/parsenum.c
msgid "decimal numbers not supported"
@ -2233,7 +2244,7 @@ msgstr "la secuencia de actualizacion del dict tiene una longitud incorrecta"
#: extmod/ulab/code/numerical.c
msgid "diff argument must be an ndarray"
msgstr ""
msgstr "El argumento diff debe ser un ndarray"
#: py/modmath.c py/objfloat.c py/objint_longlong.c py/objint_mpz.c py/runtime.c
#: shared-bindings/math/__init__.c
@ -2307,23 +2318,23 @@ msgstr "argumento posicional adicional dado"
#: py/parse.c
msgid "f-string expression part cannot include a '#'"
msgstr ""
msgstr "La parte de expresión f-string no puede incluir un '#'"
#: py/parse.c
msgid "f-string expression part cannot include a backslash"
msgstr ""
msgstr "La parte de expresión f-string no puede incluir una barra invertida"
#: py/parse.c
msgid "f-string: empty expression not allowed"
msgstr ""
msgstr "cadena-f: expresión vacía no permitida"
#: py/parse.c
msgid "f-string: expecting '}'"
msgstr ""
msgstr "f-string: esperando '}'"
#: py/parse.c
msgid "f-string: single '}' is not allowed"
msgstr ""
msgstr "cadena-f: solo '}' no está permitido"
#: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c
#: shared-bindings/displayio/OnDiskBitmap.c
@ -2356,11 +2367,11 @@ msgstr "primer argumento para super() debe ser de tipo"
#: extmod/ulab/code/ndarray.c
msgid "flattening order must be either 'C', or 'F'"
msgstr ""
msgstr "el orden de aplanamiento debe ser 'C' o 'F'"
#: extmod/ulab/code/numerical.c
msgid "flip argument must be an ndarray"
msgstr ""
msgstr "el argumento invertido debe ser un ndarray"
#: py/objint.c
msgid "float too big"
@ -2393,7 +2404,7 @@ msgstr "la función tiene múltiples valores para el argumento '%q'"
#: extmod/ulab/code/approx.c
msgid "function has the same sign at the ends of interval"
msgstr ""
msgstr "la función tiene el mismo signo a extremos del intervalo"
#: extmod/ulab/code/compare.c
msgid "function is implemented for scalars and ndarrays only"
@ -2531,7 +2542,7 @@ msgstr "Entero requerido"
#: extmod/ulab/code/approx.c
msgid "interp is defined for 1D arrays of equal length"
msgstr ""
msgstr "interp está definido para arreglos de 1D del mismo tamaño"
#: shared-bindings/_bleio/Adapter.c
#, c-format
@ -2656,7 +2667,7 @@ msgstr "long int no soportado en esta compilación"
#: py/parse.c
msgid "malformed f-string"
msgstr ""
msgstr "cadena-f mal formada"
#: shared-bindings/_stage/Layer.c
msgid "map buffer too small"
@ -2668,17 +2679,17 @@ msgstr "error de dominio matemático"
#: extmod/ulab/code/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
msgstr "las dimensiones de la matriz no coinciden"
#: extmod/ulab/code/linalg.c
msgid "matrix is not positive definite"
msgstr ""
msgstr "matrix no es definida positiva"
#: ports/nrf/common-hal/_bleio/Characteristic.c
#: ports/nrf/common-hal/_bleio/Descriptor.c
#, c-format
msgid "max_length must be 0-%d when fixed_length is %s"
msgstr ""
msgstr "max_length debe ser 0-%d cuando fixed_length es %s"
#: py/runtime.c
msgid "maximum recursion depth exceeded"
@ -2699,7 +2710,7 @@ msgstr "módulo no encontrado"
#: extmod/ulab/code/poly.c
msgid "more degrees of freedom than data points"
msgstr ""
msgstr "más grados de libertad que los puntos de datos"
#: py/compile.c
msgid "multiple *x in assignment"
@ -2723,7 +2734,7 @@ msgstr "debe utilizar argumento de palabra clave para la función clave"
#: extmod/ulab/code/numerical.c
msgid "n must be between 0, and 9"
msgstr ""
msgstr "n debe estar entre 0 y 9"
#: py/runtime.c
msgid "name '%q' is not defined"
@ -2756,7 +2767,7 @@ msgstr "cuenta de corrimientos negativo"
#: shared-module/sdcardio/SDCard.c
msgid "no SD card"
msgstr ""
msgstr "no hay tarjeta SD"
#: py/vm.c
msgid "no active exception to reraise"
@ -2777,11 +2788,11 @@ msgstr "ningún módulo se llama '%q'"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "no reset pin available"
msgstr ""
msgstr "no hay pin de reinicio disponible"
#: shared-module/sdcardio/SDCard.c
msgid "no response from SD card"
msgstr ""
msgstr "no hay respuesta de la tarjeta SD"
#: py/runtime.c
msgid "no such attribute"
@ -2789,7 +2800,7 @@ msgstr "no hay tal atributo"
#: ports/nrf/common-hal/_bleio/Connection.c
msgid "non-UUID found in service_uuids_whitelist"
msgstr ""
msgstr "no UUID encontrado en service_uuids_whitelist"
#: py/compile.c
msgid "non-default argument follows default argument"
@ -2824,11 +2835,11 @@ msgstr "no suficientes argumentos para format string"
#: extmod/ulab/code/poly.c
msgid "number of arguments must be 2, or 3"
msgstr ""
msgstr "el número de argumentos debe ser 2 o 3"
#: extmod/ulab/code/create.c
msgid "number of points must be at least 2"
msgstr ""
msgstr "el número de puntos debe ser al menos 2"
#: py/obj.c
#, c-format
@ -2881,17 +2892,16 @@ msgid "odd-length string"
msgstr "string de longitud impar"
#: py/objstr.c py/objstrunicode.c
#, fuzzy
msgid "offset out of bounds"
msgstr "address fuera de límites"
msgstr "offset fuera de límites"
#: ports/nrf/common-hal/audiobusio/PDMIn.c
msgid "only bit_depth=16 is supported"
msgstr ""
msgstr "solo se admite bit_depth=16"
#: ports/nrf/common-hal/audiobusio/PDMIn.c
msgid "only sample_rate=16000 is supported"
msgstr ""
msgstr "solo se admite sample_rate=16000"
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
@ -2901,15 +2911,15 @@ msgstr "solo se admiten segmentos con step=1 (alias None)"
#: extmod/ulab/code/compare.c extmod/ulab/code/ndarray.c
#: extmod/ulab/code/vectorise.c
msgid "operands could not be broadcast together"
msgstr ""
msgstr "los operandos no se pueden transmitir juntos"
#: extmod/ulab/code/numerical.c
msgid "operation is not implemented on ndarrays"
msgstr ""
msgstr "la operación no está implementada para ndarrays"
#: extmod/ulab/code/ndarray.c
msgid "operation is not supported for given type"
msgstr ""
msgstr "la operación no es compatible para un tipo dado"
#: py/modbuiltins.c
msgid "ord expects a character"
@ -2958,7 +2968,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter"
#: shared-module/vectorio/Polygon.c
msgid "polygon can only be registered in one parent"
msgstr ""
msgstr "el polígono solo se puede registrar en uno de los padres"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
@ -2993,11 +3003,11 @@ msgstr "desbordamiento de cola(queue)"
#: py/parse.c
msgid "raw f-strings are not implemented"
msgstr ""
msgstr "no está implementado cadenas-f sin procesar"
#: extmod/ulab/code/fft.c
msgid "real and imaginary parts must be of equal length"
msgstr ""
msgstr "las partes reales e imaginarias deben ser de igual longitud"
#: py/builtinimport.c
msgid "relative import"
@ -3019,16 +3029,16 @@ msgstr "retorno esperado '%q' pero se obtuvo '%q'"
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "rgb_pins[%d] duplicates another pin assignment"
msgstr ""
msgstr "rgb_pins[%d] duplica otra asignación de pin"
#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid "rgb_pins[%d] is not on the same port as clock"
msgstr ""
msgstr "rgb_pins[%d] no está en el mismo puerto que el reloj"
#: extmod/ulab/code/ndarray.c
msgid "right hand side must be an ndarray, or a scalar"
msgstr ""
msgstr "el lado derecho debe ser un ndarray o escalar"
#: py/objstr.c
msgid "rsplit(None,n)"
@ -3048,7 +3058,7 @@ msgstr "frecuencia de muestreo fuera de rango"
#: py/modmicropython.c
msgid "schedule stack full"
msgstr ""
msgstr "pila de horario llena"
#: lib/utils/pyexec.c py/builtinimport.c
msgid "script compilation not supported"
@ -3056,7 +3066,7 @@ msgstr "script de compilación no soportado"
#: extmod/ulab/code/ndarray.c
msgid "shape must be a 2-tuple"
msgstr ""
msgstr "la forma debe ser una tupla de 2"
#: py/objstr.c
msgid "sign not allowed in string format specifier"
@ -3072,7 +3082,7 @@ msgstr "un solo '}' encontrado en format string"
#: extmod/ulab/code/linalg.c
msgid "size is defined for ndarrays only"
msgstr ""
msgstr "el tamaño se define solo para ndarrays"
#: shared-bindings/time/__init__.c
msgid "sleep length must be non-negative"
@ -3080,7 +3090,7 @@ msgstr "la longitud de sleep no puede ser negativa"
#: extmod/ulab/code/ndarray.c
msgid "slice step can't be zero"
msgstr ""
msgstr "el tamaño de la división no puede ser cero"
#: py/objslice.c py/sequence.c
msgid "slice step cannot be zero"
@ -3096,28 +3106,27 @@ msgstr "reinicio suave\n"
#: extmod/ulab/code/numerical.c
msgid "sort argument must be an ndarray"
msgstr ""
msgstr "argumento de ordenado debe ser un ndarray"
#: extmod/ulab/code/filter.c
msgid "sos array must be of shape (n_section, 6)"
msgstr ""
msgstr "el arreglo sos debe de forma (n_section, 6)"
#: extmod/ulab/code/filter.c
msgid "sos[:, 3] should be all ones"
msgstr ""
msgstr "sos[:, 3] deberían ser todos unos"
#: extmod/ulab/code/filter.c
msgid "sosfilt requires iterable arguments"
msgstr ""
msgstr "sosfilt requiere argumentos iterables"
#: py/objstr.c
msgid "start/end indices"
msgstr "índices inicio/final"
#: shared-bindings/displayio/Shape.c
#, fuzzy
msgid "start_x should be an int"
msgstr "y deberia ser un int"
msgstr "start_x deberia ser un int"
#: shared-bindings/random/__init__.c
msgid "step must be non-zero"
@ -3187,10 +3196,11 @@ msgstr "time.struct_time() toma un sequencio 9"
#: ports/nrf/common-hal/watchdog/WatchDogTimer.c
msgid "timeout duration exceeded the maximum supported value"
msgstr ""
"la duración de tiempo de espera ha excedido la capacidad máxima del valor"
#: shared-bindings/busio/UART.c
msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
msgstr "el tiempo de espera debe ser 0.0-100.0 segundos"
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@ -3198,11 +3208,11 @@ msgstr "tiempo muerto debe ser >= 0.0"
#: shared-module/sdcardio/SDCard.c
msgid "timeout waiting for v1 card"
msgstr ""
msgstr "tiempo de espera agotado esperando por tarjeta v1"
#: shared-module/sdcardio/SDCard.c
msgid "timeout waiting for v2 card"
msgstr ""
msgstr "tiempo de espera agotado esperando a tarjeta v2"
#: shared-bindings/time/__init__.c
msgid "timestamp out of range for platform time_t"
@ -3214,7 +3224,7 @@ msgstr "demasiados argumentos provistos con el formato dado"
#: extmod/ulab/code/ndarray.c
msgid "too many indices"
msgstr ""
msgstr "demasiados índices"
#: py/runtime.c
#, c-format
@ -3343,31 +3353,31 @@ msgstr "tipos no soportados para %q: '%s', '%s'"
#: py/objint.c
#, c-format
msgid "value must fit in %d byte(s)"
msgstr ""
msgstr "el valor debe caber en %d byte(s)"
#: shared-bindings/displayio/Bitmap.c
msgid "value_count must be > 0"
msgstr ""
msgstr "value_count debe ser > 0"
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "watchdog timeout must be greater than 0"
msgstr ""
msgstr "el tiempo de espera del perro guardián debe ser mayor a 0"
#: shared-bindings/_bleio/Adapter.c
msgid "window must be <= interval"
msgstr ""
msgstr "la ventana debe ser <= intervalo"
#: extmod/ulab/code/linalg.c
msgid "wrong argument type"
msgstr ""
msgstr "tipo de argumento incorrecto"
#: extmod/ulab/code/ndarray.c
msgid "wrong index type"
msgstr ""
msgstr "tipo de índice incorrecto"
#: extmod/ulab/code/vectorise.c
msgid "wrong input type"
msgstr ""
msgstr "tipo de entrada incorrecta"
#: py/objstr.c
msgid "wrong number of arguments"
@ -3379,25 +3389,23 @@ msgstr "numero erroneo de valores a descomprimir"
#: extmod/ulab/code/ndarray.c
msgid "wrong operand type"
msgstr ""
msgstr "tipo de operando incorrecto"
#: extmod/ulab/code/vectorise.c
msgid "wrong output type"
msgstr ""
msgstr "tipo de salida incorrecta"
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "x value out of bounds"
msgstr "address fuera de límites"
msgstr "valor x fuera de límites"
#: shared-bindings/displayio/Shape.c
msgid "y should be an int"
msgstr "y deberia ser un int"
#: shared-module/displayio/Shape.c
#, fuzzy
msgid "y value out of bounds"
msgstr "address fuera de límites"
msgstr "valor y fuera de límites"
#: py/objrange.c
msgid "zero step"
@ -3405,15 +3413,15 @@ msgstr "paso cero"
#: extmod/ulab/code/filter.c
msgid "zi must be an ndarray"
msgstr ""
msgstr "zi debe ser un ndarray"
#: extmod/ulab/code/filter.c
msgid "zi must be of float type"
msgstr ""
msgstr "zi debe ser de tipo flotante"
#: extmod/ulab/code/filter.c
msgid "zi must be of shape (n_section, 2)"
msgstr ""
msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "AP required"
#~ msgstr "AP requerido"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-02 15:29+0200\n"
"PO-Revision-Date: 2020-07-02 13:32+0000\n"
"PO-Revision-Date: 2020-07-03 22:53+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -615,7 +615,7 @@ msgstr "Não foi possível inicializar o GNSS"
#: ports/cxd56/common-hal/sdioio/SDCard.c
msgid "Could not initialize SDCard"
msgstr ""
msgstr "Não foi possível inicializar o SDCard"
#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c
msgid "Could not initialize UART"

View File

@ -27,8 +27,85 @@
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
displayio_fourwire_obj_t board_display_obj;
uint8_t display_init_sequence[] = {
0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms)
0xEF, 0x03, 0x03, 0x80, 0x02,
0xCF, 0x03, 0x00, 0xC1, 0x30,
0xED, 0x04, 0x64, 0x03, 0x12, 0x81,
0xE8, 0x03, 0x85, 0x00, 0x78,
0xCB, 0x05, 0x39, 0x2C, 0x00, 0x34, 0x02,
0xF7, 0x01, 0x20,
0xEA, 0x02, 0x00, 0x00,
0xc0, 0x01, 0x23, // Power control VRH[5:0]
0xc1, 0x01, 0x10, // Power control SAP[2:0];BT[3:0]
0xc5, 0x02, 0x3e, 0x28, // VCM control
0xc7, 0x01, 0x86, // VCM control2
0x36, 0x01, 0x38, // Memory Access Control
0x37, 0x01, 0x00, // Vertical scroll zero
0x3a, 0x01, 0x55, // COLMOD: Pixel Format Set
0xb1, 0x02, 0x00, 0x18, // Frame Rate Control (In Normal Mode/Full Colors)
0xb6, 0x03, 0x08, 0x82, 0x27, // Display Function Control
0xF2, 0x01, 0x00, // 3Gamma Function Disable
0x26, 0x01, 0x01, // Gamma curve selected
0xe0, 0x0f, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, // Set Gamma
0xe1, 0x0f, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, // Set Gamma
0x11, 0x80, 0x78, // Exit Sleep then delay 0x78 (120ms)
0x29, 0x80, 0x78, // Display on then delay 0x78 (120ms)
};
void board_init(void) {
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus;
common_hal_busio_spi_construct(spi, &pin_PB20, &pin_PB19, NULL);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
bus->base.type = &displayio_fourwire_type;
common_hal_displayio_fourwire_construct(bus,
spi,
&pin_PC06, // TFT_DC Command or data
&pin_PB21, // TFT_CS Chip select
&pin_PC07, // TFT_RST Reset
60000000, // Baudrate
0, // Polarity
0); // Phase
displayio_display_obj_t* display = &displays[0].display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(display,
bus,
320, // Width
240, // Height
0, // column start
0, // row start
180, // rotation
16, // Color depth
false, // Grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
&pin_PC05, // backlight pin
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
60, // native_frames_per_second
true); // backlight_on_high
}
bool board_requests_safe_mode(void) {

View File

@ -33,9 +33,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB27) },
// SPI pins
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PB01) },
// I2C pins
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) },
@ -44,6 +45,43 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// LED pins
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA15) }, // status
// LCD Display
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MISO), MP_ROM_PTR(&pin_PB18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PB19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PB20) },
{ MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PB21) },
{ MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PC06) },
{ MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_PC05) },
{ MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_PC07) },
// SD Card
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_PC18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_PC16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_PC17) },
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PC19) },
{ MP_ROM_QSTR(MP_QSTR_SD_DET), MP_ROM_PTR(&pin_PC21) },
// Switch
{ MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_UP), MP_ROM_PTR(&pin_PD20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_LEFT), MP_ROM_PTR(&pin_PD12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_RIGHT), MP_ROM_PTR(&pin_PD09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_DOWN), MP_ROM_PTR(&pin_PD08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SWITCH_PRESS), MP_ROM_PTR(&pin_PD10) },
// Button
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_1), MP_ROM_PTR(&pin_PC26) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_2), MP_ROM_PTR(&pin_PC27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_3), MP_ROM_PTR(&pin_PC28) },
// Special named pins
{ MP_OBJ_NEW_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PD01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_PD11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_IR), MP_ROM_PTR(&pin_PB31) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MIC), MP_ROM_PTR(&pin_PC30) },
{ MP_ROM_QSTR(MP_QSTR_GYROSCOPE_SCL), MP_ROM_PTR(&pin_PA12) },
{ MP_ROM_QSTR(MP_QSTR_GYROSCOPE_SDA), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_GYROSCOPE_INT), MP_ROM_PTR(&pin_PC21) },
// Comm objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },

View File

@ -125,6 +125,9 @@ void pulsein_interrupt_handler(uint8_t channel) {
}
void pulsein_reset() {
#ifdef SAMD21
rtc_end_pulsein();
#endif
refcount = 0;
pulsein_tc_index = 0xff;
overflow_count = 0;
@ -221,6 +224,10 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
// Set config will enable the EIC.
pulsein_set_config(self, true);
#ifdef SAMD21
rtc_start_pulsein();
#endif
}
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
@ -231,6 +238,9 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
if (common_hal_pulseio_pulsein_deinited(self)) {
return;
}
#ifdef SAMD21
rtc_end_pulsein();
#endif
set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT);
turn_off_eic_channel(self->channel);
reset_pin_number(self->pin);

View File

@ -50,5 +50,11 @@ void pulsein_reset(void);
void pulsein_interrupt_handler(uint8_t channel);
void pulsein_timer_interrupt_handler(uint8_t index);
#ifdef SAMD21
void rtc_set_continuous(void);
void rtc_start_pulsein(void);
void rtc_end_pulsein(void);
#endif
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PULSEIN_H

View File

@ -91,6 +91,23 @@
#if CIRCUITPY_PEW
#include "common-hal/_pew/PewPew.h"
#endif
volatile bool hold_interrupt = false;
#ifdef SAMD21
void rtc_start_pulsein(void) {
rtc_set_continuous();
hold_interrupt = true;
}
void rtc_end_pulsein(void) {
hold_interrupt = false;
}
void rtc_set_continuous(void) {
while (RTC->MODE0.STATUS.bit.SYNCBUSY);
RTC->MODE0.READREQ.reg = RTC_READREQ_RREQ | RTC_READREQ_RCONT | 0x0010;
while (RTC->MODE0.STATUS.bit.SYNCBUSY);
}
#endif
extern volatile bool mp_msc_enabled;
@ -489,6 +506,11 @@ void port_interrupt_after_ticks(uint32_t ticks) {
// We'll interrupt sooner with an overflow.
return;
}
#ifdef SAMD21
if (hold_interrupt) {
return;
}
#endif
RTC->MODE0.COMP[0].reg = current_ticks + (ticks << 4);
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0;
@ -503,7 +525,7 @@ void port_sleep_until_interrupt(void) {
}
#endif
common_hal_mcu_disable_interrupts();
if (!tud_task_event_ready()) {
if (!tud_task_event_ready() && !hold_interrupt) {
__DSB();
__WFI();
}

View File

@ -62,6 +62,13 @@ SPRESENSE_SDK = spresense-exported-sdk
FIRMWARE = $(SPRESENSE_SDK)/firmware
BOOTLOADER_FILES += \
$(FIRMWARE)/AESM.espk \
$(FIRMWARE)/dnnrt-mp.espk \
$(FIRMWARE)/gnssfw.espk \
$(FIRMWARE)/loader.espk \
$(FIRMWARE)/sysutil.spk \
# Platforms are: Linux, Darwin, MSYS, CYGWIN
PLATFORM := $(firstword $(subst _, ,$(shell uname -s 2>/dev/null)))
@ -91,8 +98,7 @@ INC += \
-I$(SPRESENSE_SDK)/nuttx/arch \
-I$(SPRESENSE_SDK)/nuttx/arch/chip \
-I$(SPRESENSE_SDK)/nuttx/arch/os \
-I$(SPRESENSE_SDK)/sdk/bsp/include \
-I$(SPRESENSE_SDK)/sdk/bsp/include/sdk \
-I$(SPRESENSE_SDK)/sdk/include \
CFLAGS += \
$(INC) \
@ -125,7 +131,7 @@ LDFLAGS = \
--entry=__start \
-nostartfiles \
-nodefaultlibs \
-T$(SPRESENSE_SDK)/nuttx/build/ramconfig.ld \
-T$(SPRESENSE_SDK)/nuttx/scripts/ramconfig.ld \
--gc-sections \
-Map=$(BUILD)/output.map \
-o $(BUILD)/firmware.elf \
@ -133,8 +139,8 @@ LDFLAGS = \
-u spresense_main \
-u board_timerhook \
$(BUILD)/libmpy.a \
$(SPRESENSE_SDK)/sdk/libs/libapps.a \
$(SPRESENSE_SDK)/sdk/libs/libsdk.a \
$(SPRESENSE_SDK)/nuttx/libs/libapps.a \
$(SPRESENSE_SDK)/nuttx/libs/libnuttx.a \
$(LIBM) \
$(LIBGCC) \
--end-group \
@ -213,11 +219,11 @@ $(BUILD)/firmware.spk: $(BUILD)/firmware.elf $(MKSPK)
flash: $(BUILD)/firmware.spk
$(ECHO) "Writing $< to the board"
$(SPRESENSE_SDK)/sdk/tools/flash.sh -c $(SERIAL) $(BUILD)/firmware.spk
tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $(BUILD)/firmware.spk
flash-bootloader: $(SPRESENSE_SDK) $(FIRMWARE)
$(ECHO) "Writing loader to the board"
$(SPRESENSE_SDK)/sdk/tools/flash.sh -l $(FIRMWARE) -c $(SERIAL)
tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $(BOOTLOADER_FILES)
include $(TOP)/py/mkrules.mk

View File

@ -16,7 +16,7 @@ Board features:
* Spresense is powered by Sony's CXD5602 microcontroller (ARM® Cortex®-M4F × 6
cores), with a clock speed of 156 MHz.
Currently, Spresense port does not support GNSS, Audio and Multicore.
Currently, Spresense port does not support Audio and Multicore.
Refer to [developer.sony.com/develop/spresense/](https://developer.sony.com/develop/spresense/)
for further information about this board.
@ -75,7 +75,7 @@ Bootloader information:
* You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary.
Download the spresense binaries zip archive from: [Spresense firmware v1-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v1-4-000)
Download the spresense binaries zip archive from: [Spresense firmware v2-0-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-0-000)
Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/

View File

@ -27,7 +27,7 @@
#ifndef MICROPY_INCLUDED_CXD56_COMMON_HAL_PULSEIO_PWMOUT_H
#define MICROPY_INCLUDED_CXD56_COMMON_HAL_PULSEIO_PWMOUT_H
#include <nuttx/drivers/pwm.h>
#include <nuttx/timers/pwm.h>
#include "common-hal/microcontroller/Pin.h"

View File

@ -0,0 +1,171 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_CXD56_I2C0_SCUSEQ is not set
# CONFIG_CXD56_SFC is not set
# CONFIG_CXD56_SPI3_SCUSEQ is not set
# CONFIG_MMCSD_MMCSUPPORT is not set
# CONFIG_MMCSD_SPI is not set
# CONFIG_MTD_SMART_WEAR_LEVEL is not set
# CONFIG_NET_IPv4 is not set
# CONFIG_NXFONTS_PACKEDMSFIRST is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="spresense"
CONFIG_ARCH_BOARD_SPRESENSE=y
CONFIG_ARCH_CHIP="cxd56xx"
CONFIG_ARCH_CHIP_CXD56XX=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_MATH_H=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_ASMP=y
CONFIG_AUDIO=y
CONFIG_AUDIOUTILS_DSP_MOUNTPT="/mnt/sd0/BIN"
CONFIG_AUDIOUTILS_MANAGER=y
CONFIG_AUDIOUTILS_PLAYER=y
CONFIG_AUDIOUTILS_PLAYLIST=y
CONFIG_AUDIOUTILS_RECORDER=y
CONFIG_BOARDCTL_IOCTL=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARDCTL_UNIQUEID=y
CONFIG_BOARDCTL_UNIQUEID_SIZE=5
CONFIG_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_CRASHDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=5434
CONFIG_BOOT_RUNFROMISRAM=y
CONFIG_BUILTIN=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_CXD56_ADC=y
CONFIG_CXD56_AUDIO=y
CONFIG_CXD56_BINARY=y
CONFIG_CXD56_CHARGER=y
CONFIG_CXD56_CISIF=y
CONFIG_CXD56_GAUGE=y
CONFIG_CXD56_GNSS=y
CONFIG_CXD56_HPADC0=y
CONFIG_CXD56_HPADC1=y
CONFIG_CXD56_I2C0=y
CONFIG_CXD56_I2C2=y
CONFIG_CXD56_I2C=y
CONFIG_CXD56_I2C_DRIVER=y
CONFIG_CXD56_IMAGEPROC=y
CONFIG_CXD56_LPADC=y
CONFIG_CXD56_PWM0=y
CONFIG_CXD56_PWM1=y
CONFIG_CXD56_PWM2=y
CONFIG_CXD56_PWM3=y
CONFIG_CXD56_PWM=y
CONFIG_CXD56_SDIO=y
CONFIG_CXD56_SPI3=y
CONFIG_CXD56_SPI5=y
CONFIG_CXD56_SPI=y
CONFIG_CXD56_UART2=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DNN_RT=y
CONFIG_DNN_RT_MP=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXTERNALS_CMSIS=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FAT_MAXFNAME=64
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_ROMFS=y
CONFIG_FS_SMARTFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_LCD=y
CONFIG_LCD_NOGETRUN=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_IPv4_ADDRCONV=y
CONFIG_LIBC_IPv6_ADDRCONV=y
CONFIG_LIB_KBDCODEC=y
CONFIG_MAX_WDOGPARMS=2
CONFIG_MEMUTILS=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_BYTE_WRITE=y
CONFIG_MTD_SMART=y
CONFIG_MTD_SMART_ENABLE_CRC=y
CONFIG_MTD_SMART_FSCK=y
CONFIG_MTD_SMART_SECTOR_SIZE=4096
CONFIG_NAME_MAX=64
CONFIG_NET=y
CONFIG_NETDEVICES=y
CONFIG_NETDEV_LATEINIT=y
CONFIG_NET_SOCKOPTS=y
CONFIG_NET_TCP_NO_STACK=y
CONFIG_NET_UDP_NO_STACK=y
CONFIG_NET_USRSOCK=y
CONFIG_NET_USRSOCK_TCP=y
CONFIG_NET_USRSOCK_UDP=y
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_LOSMART=y
CONFIG_NSH_LINELEN=160
CONFIG_NSH_MAXARGUMENTS=14
CONFIG_NSH_READLINE=y
CONFIG_PIPES=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_PREALLOC_WDOGS=16
CONFIG_PWM=y
CONFIG_RAM_SIZE=1572864
CONFIG_RAM_START=0x0d000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_CMD_HISTORY_LINELEN=160
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RR_INTERVAL=200
CONFIG_RTC=y
CONFIG_RTC_ALARM=y
CONFIG_RTC_DRIVER=y
CONFIG_RTC_FREQUENCY=32768
CONFIG_RTC_HIRES=y
CONFIG_SCHED_CHILD_STATUS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPNTHREADS=3
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_SDIO_MUXBUS=y
CONFIG_SDK_AUDIO=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_SMARTFS_ALIGNED_ACCESS=y
CONFIG_SMARTFS_MAXNAMLEN=30
CONFIG_SMARTFS_MULTI_ROOT_DIRS=y
CONFIG_SPECIFIC_DRIVERS=y
CONFIG_SPI=y
CONFIG_SPRESENSE_EXTENSION=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSTEMTICK_HOOK=y
CONFIG_SYSTEM_CLE=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_NSH_CXXINITIALIZE=y
CONFIG_UART1_RXBUFSIZE=1024
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART1_TXBUFSIZE=1024
CONFIG_UART2_IFLOWCONTROL=y
CONFIG_UART2_OFLOWCONTROL=y
CONFIG_USBDEV=y
CONFIG_USBDEV_DMA=y
CONFIG_USBDEV_DUALSPEED=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERMAIN_STACKSIZE=1064960
CONFIG_USER_ENTRYPOINT="spresense_main"
CONFIG_VIDEO_ISX012=y
CONFIG_VIDEO_STREAM=y

@ -1 +1 @@
Subproject commit 7f6568c7f4898cdb24a2f06040784a836050686e
Subproject commit c991d439fac9c23cfcac0da16fe8055f818d40a4

580
ports/cxd56/tools/flash_writer.py Executable file
View File

@ -0,0 +1,580 @@
#! /usr/bin/env python3
# Copyright (C) 2018 Sony Semiconductor Solutions Corp.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
import time
import sys
import os
import struct
import glob
import fnmatch
import errno
import telnetlib
import argparse
import shutil
import subprocess
import re
import xmodem
import_serial_module = True
# When SDK release, plase set SDK_RELEASE as True.
SDK_RELEASE = False
if SDK_RELEASE :
PRINT_RAW_COMMAND = False
REBOOT_AT_END = True
else :
PRINT_RAW_COMMAND = True
REBOOT_AT_END = True
try:
import serial
except:
import_serial_module = False
# supported environment various
# CXD56_PORT
# CXD56_TELNETSRV_PORT
# CXD56_TELNETSRV_IP
PROTOCOL_SERIAL = 0
PROTOCOL_TELNET = 1
MAX_DOT_COUNT = 70
# configure parameters and default value
class ConfigArgs:
PROTOCOL_TYPE = None
SERIAL_PORT = "COM1"
SERVER_PORT = 4569
SERVER_IP = "localhost"
EOL = bytes([10])
WAIT_RESET = True
AUTO_RESET = False
DTR_RESET = False
XMODEM_BAUD = 0
NO_SET_BOOTABLE = False
PACKAGE_NAME = []
FILE_NAME = []
ERASE_NAME = []
PKGSYS_NAME = []
PKGAPP_NAME = []
PKGUPD_NAME = []
ROM_MSG = [b"Welcome to nash"]
XMDM_MSG = "Waiting for XMODEM (CRC or 1K) transfer. Ctrl-X to cancel."
class ConfigArgsLoader():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
self.parser.add_argument("package_name", help="the name of the package to install", nargs='*')
self.parser.add_argument("-f", "--file", dest="file_name", help="save file", action='append')
self.parser.add_argument("-e", "--erase", dest="erase_name", help="erase file", action='append')
self.parser.add_argument("-S", "--sys", dest="pkgsys_name", help="the name of the system package to install", action='append')
self.parser.add_argument("-A", "--app", dest="pkgapp_name", help="the name of the application package to install", action='append')
self.parser.add_argument("-U", "--upd", dest="pkgupd_name", help="the name of the updater package to install", action='append')
self.parser.add_argument("-a", "--auto-reset", dest="auto_reset",
action="store_true", default=None,
help="try to auto reset develop board if possible")
self.parser.add_argument("-d", "--dtr-reset", dest="dtr_reset",
action="store_true", default=None,
help="try to auto reset develop board if possible")
self.parser.add_argument("-n", "--no-set-bootable", dest="no_set_bootable",
action="store_true", default=None,
help="not to set bootable")
group = self.parser.add_argument_group()
group.add_argument("-i", "--server-ip", dest="server_ip",
help="the ip address connected to the telnet server")
group.add_argument("-p", "--server-port", dest="server_port", type=int,
help="the port connected to the telnet server")
group = self.parser.add_argument_group()
group.add_argument("-c", "--serial-port", dest="serial_port", help="the serial port")
group.add_argument("-b", "--xmodem-baudrate", dest="xmodem_baud", help="Use the faster baudrate in xmodem")
mutually_group = self.parser.add_mutually_exclusive_group()
mutually_group.add_argument("-t", "--telnet-protocol", dest="telnet_protocol",
action="store_true", default=None,
help="use the telnet protocol for binary transmission")
mutually_group.add_argument("-s", "--serial-protocol", dest="serial_protocol",
action="store_true", default=None,
help="use the serial port for binary transmission, default options")
mutually_group2 = self.parser.add_mutually_exclusive_group()
mutually_group2.add_argument("-F", "--force-wait-reset", dest="wait_reset",
action="store_true", default=None,
help="force wait for pressing RESET button")
mutually_group2.add_argument("-N", "--no-wait-reset", dest="wait_reset",
action="store_false", default=None,
help="if possible, skip to wait for pressing RESET button")
def update_config(self):
args = self.parser.parse_args()
ConfigArgs.PACKAGE_NAME = args.package_name
ConfigArgs.FILE_NAME = args.file_name
ConfigArgs.ERASE_NAME = args.erase_name
ConfigArgs.PKGSYS_NAME = args.pkgsys_name
ConfigArgs.PKGAPP_NAME = args.pkgapp_name
ConfigArgs.PKGUPD_NAME = args.pkgupd_name
# Get serial port or telnet server ip etc
if args.serial_protocol == True:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL
elif args.telnet_protocol == True:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET
if ConfigArgs.PROTOCOL_TYPE == None:
proto = os.environ.get("CXD56_PROTOCOL")
if proto is not None:
if 's' in proto:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL
elif 't' in proto:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET
if ConfigArgs.PROTOCOL_TYPE == None:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_SERIAL
if ConfigArgs.PROTOCOL_TYPE == PROTOCOL_SERIAL:
if args.serial_port is not None:
ConfigArgs.SERIAL_PORT = args.serial_port
else:
# Get serial port from the environment
port = os.environ.get("CXD56_PORT")
if port is not None:
ConfigArgs.SERIAL_PORT = port
else:
print("CXD56_PORT is not set, Use " + ConfigArgs.SERIAL_PORT + ".")
else:
ConfigArgs.PROTOCOL_TYPE = PROTOCOL_TELNET
if args.server_port is not None:
ConfigArgs.SERVER_PORT = args.server_port
else:
port = os.environ.get("CXD56_TELNETSRV_PORT")
if port is not None:
ConfigArgs.SERVER_PORT = port
else:
print("CXD56_TELNETSRV_PORT is not set, Use " + str(ConfigArgs.SERVER_PORT) + ".")
if args.server_ip is not None:
ConfigArgs.SERVER_IP = args.server_ip
else:
ip = os.environ.get("CXD56_TELNETSRV_IP")
if ip is not None:
ConfigArgs.SERVER_IP = ip
else:
print("CXD56_TELNETSRV_IP is not set, Use " + ConfigArgs.SERVER_IP + ".")
if args.xmodem_baud is not None:
ConfigArgs.XMODEM_BAUD = args.xmodem_baud
if args.auto_reset is not None:
ConfigArgs.AUTO_RESET = args.auto_reset
if args.dtr_reset is not None:
ConfigArgs.DTR_RESET = args.dtr_reset
if args.no_set_bootable is not None:
ConfigArgs.NO_SET_BOOTABLE = args.no_set_bootable
if args.wait_reset is not None:
ConfigArgs.WAIT_RESET = args.wait_reset
class TelnetDev:
def __init__(self):
srv_ipaddr = ConfigArgs.SERVER_IP
srv_port = ConfigArgs.SERVER_PORT
self.recvbuf = b'';
try:
self.telnet = telnetlib.Telnet(host=srv_ipaddr, port=srv_port, timeout=10)
# There is a ack to be sent after connecting to the telnet server.
self.telnet.write(b"\xff")
except Exception as e:
print("Cannot connect to the server %s:%d" % (srv_ipaddr, srv_port))
sys.exit(e.args[0])
def readline(self, size=None):
res = b''
ch = b''
while ch != ConfigArgs.EOL:
ch = self.getc_raw(1, timeout=0.1)
if ch == b'':
return res
res += ch
return res
def getc_raw(self, size, timeout=1):
res = b''
tm = time.monotonic()
while size > 0:
while self.recvbuf == b'':
self.recvbuf = self.telnet.read_eager()
if self.recvbuf == b'':
if (time.monotonic() - tm) > timeout:
return res
time.sleep(0.1)
res += self.recvbuf[0:1]
self.recvbuf = self.recvbuf[1:]
size -= 1
return res
def write(self, buffer):
self.telnet.write(buffer)
def discard_inputs(self, timeout=1.0):
while True:
ch = self.getc_raw(1, timeout=timeout)
if ch == b'':
break
def getc(self, size, timeout=1):
c = self.getc_raw(size, timeout)
return c
def putc(self, buffer, timeout=1):
self.telnet.write(buffer)
self.show_progress(len(buffer))
def reboot(self):
# no-op
pass
def set_file_size(self, filesize):
self.bytes_transfered = 0
self.filesize = filesize
self.count = 0
def show_progress(self, sendsize):
if PRINT_RAW_COMMAND:
if self.count < MAX_DOT_COUNT:
self.bytes_transfered = self.bytes_transfered + sendsize
cur_count = int(self.bytes_transfered * MAX_DOT_COUNT / self.filesize)
if MAX_DOT_COUNT < cur_count:
cur_count = MAX_DOT_COUNT
for idx in range(cur_count - self.count):
print('#',end='')
sys.stdout.flush()
self.count = cur_count
if self.count == MAX_DOT_COUNT:
print("\n")
class SerialDev:
def __init__(self):
if import_serial_module is False:
print("Cannot import serial module, maybe it's not install yet.")
print("\n", end="")
print("Please install python-setuptool by Cygwin installer.")
print("After that use easy_intall command to install serial module")
print(" $ cd tool/")
print(" $ python3 -m easy_install pyserial-2.7.tar.gz")
quit()
else:
port = ConfigArgs.SERIAL_PORT
try:
self.serial = serial.Serial(port, baudrate=115200,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS, timeout=0.1)
except Exception as e:
print("Cannot open port : " + port)
sys.exit(e.args[0])
def readline(self, size=None):
return self.serial.readline(size)
def write(self, buffer):
self.serial.write(buffer)
self.serial.flush()
def discard_inputs(self, timeout=1.0):
time.sleep(timeout)
self.serial.flushInput()
def getc(self, size, timeout=1):
self.serial.timeout = timeout
c = self.serial.read(size)
self.serial.timeout = 0.1
return c
def putc(self, buffer, timeout=1):
self.serial.timeout = timeout
self.serial.write(buffer)
self.serial.flush()
self.serial.timeout = 0.1
self.show_progress(len(buffer))
# Note: windows platform dependent code
def putc_win(self, buffer, timeout=1):
self.serial.write(buffer)
self.show_progress(len(buffer))
while True:
if self.serial.out_waiting == 0:
break
def setBaudrate(self, baudrate):
# self.serial.setBaudrate(baudrate)
self.serial.baudrate = baudrate
def reboot(self):
# Target Reset by DTR
self.serial.setDTR(False)
self.serial.setDTR(True)
self.serial.setDTR(False)
def set_file_size(self, filesize):
self.bytes_transfered = 0
self.filesize = filesize
self.count = 0
def show_progress(self, sendsize):
if PRINT_RAW_COMMAND:
if self.count < MAX_DOT_COUNT:
self.bytes_transfered = self.bytes_transfered + sendsize
cur_count = int(self.bytes_transfered * MAX_DOT_COUNT / self.filesize)
if MAX_DOT_COUNT < cur_count:
cur_count = MAX_DOT_COUNT
for idx in range(cur_count - self.count):
print('#',end='')
sys.stdout.flush()
self.count = cur_count
if self.count == MAX_DOT_COUNT:
print("\n")
class FlashWriter:
def __init__(self, protocol_sel=PROTOCOL_SERIAL):
if protocol_sel == PROTOCOL_TELNET:
self.serial = TelnetDev()
else:
self.serial = SerialDev()
def cancel_autoboot(self) :
boot_msg = ''
self.serial.reboot() # Target reboot before send 'r'
while boot_msg == '' :
rx = self.serial.readline().strip()
self.serial.write(b"r") # Send "r" key to avoid auto boot
for msg in ROM_MSG :
if msg in rx :
boot_msg = msg
break
while True :
rx = self.serial.readline().decode(errors="replace").strip()
if "updater" in rx :
# Workaround : Sometime first character is dropped.
# Send line feed as air shot before actual command.
self.serial.write(b"\n") # Send line feed
self.serial.discard_inputs()# Clear input buffer to sync
return boot_msg.decode(errors="ignore")
def recv(self):
rx = self.serial.readline()
if PRINT_RAW_COMMAND :
serial_line = rx.decode(errors="replace")
if serial_line.strip() != "" and not serial_line.startswith(XMDM_MSG):
print(serial_line, end="")
return rx
def wait(self, string):
while True:
rx = self.recv()
if string.encode() in rx:
time.sleep(0.1)
break
def wait_for_prompt(self):
prompt_pat = re.compile(b"updater")
while True:
rx = self.recv()
if prompt_pat.search(rx):
time.sleep(0.1)
break
def send(self, string):
self.serial.write(str(string).encode() + b"\n")
rx = self.serial.readline()
if PRINT_RAW_COMMAND :
print(rx.decode(errors="replace"), end="")
def read_output(self, prompt_text) :
output = []
while True :
rx = self.serial.readline()
if prompt_text.encode() in rx :
time.sleep(0.1)
break
if rx != "" :
output.append(rx.decode(errors="ignore").rstrip())
return output
def install_files(self, files, command) :
if ConfigArgs.XMODEM_BAUD:
command += " -b " + ConfigArgs.XMODEM_BAUD
if os.name == 'nt':
modem = xmodem.XMODEM(self.serial.getc, self.serial.putc_win, 'xmodem1k')
else:
modem = xmodem.XMODEM(self.serial.getc, self.serial.putc, 'xmodem1k')
for file in files:
with open(file, "rb") as bin :
self.send(command)
print("Install " + file)
self.wait(XMDM_MSG)
print("|0%" +
"-" * (int(MAX_DOT_COUNT / 2) - 6) +
"50%" +
"-" * (MAX_DOT_COUNT - int(MAX_DOT_COUNT / 2) - 5) +
"100%|")
if ConfigArgs.XMODEM_BAUD:
self.serial.setBaudrate(ConfigArgs.XMODEM_BAUD)
self.serial.discard_inputs() # Clear input buffer to sync
self.serial.set_file_size(os.path.getsize(file))
modem.send(bin)
if ConfigArgs.XMODEM_BAUD:
self.serial.setBaudrate(115200)
self.wait_for_prompt()
def save_files(self, files) :
if ConfigArgs.XMODEM_BAUD:
command = "save_file -b " + ConfigArgs.XMODEM_BAUD + " -x "
else:
command = "save_file -x "
if os.name == 'nt':
modem = xmodem.XMODEM(self.serial.getc, self.serial.putc_win, 'xmodem1k')
else:
modem = xmodem.XMODEM(self.serial.getc, self.serial.putc, 'xmodem1k')
for file in files:
with open(file, "rb") as bin :
self.send(command + os.path.basename(file))
print("Save " + file)
self.wait(XMDM_MSG)
if ConfigArgs.XMODEM_BAUD:
self.serial.setBaudrate(ConfigArgs.XMODEM_BAUD)
self.serial.discard_inputs() # Clear input buffer to sync
self.serial.set_file_size(os.path.getsize(file))
modem.send(bin)
if ConfigArgs.XMODEM_BAUD:
self.serial.setBaudrate(115200)
self.wait_for_prompt()
self.send("chmod d+rw " + os.path.basename(file))
self.wait_for_prompt()
def delete_files(self, files) :
for file in files :
self.delete_binary(file)
def delete_binary(self, bin_name) :
self.send("rm " + bin_name)
self.wait_for_prompt()
def main():
try:
config_loader = ConfigArgsLoader()
config_loader.update_config()
except:
return errno.EINVAL
# Wait to reset the board
writer = FlashWriter(ConfigArgs.PROTOCOL_TYPE)
do_wait_reset = True
if ConfigArgs.AUTO_RESET:
if subprocess.call("cd " + sys.path[0] + "; ./reset_board.sh", shell=True) == 0:
print("auto reset board sucess!!")
do_wait_reset = False
bootrom_msg = writer.cancel_autoboot()
if ConfigArgs.DTR_RESET:
do_wait_reset = False
bootrom_msg = writer.cancel_autoboot()
if ConfigArgs.WAIT_RESET == False and do_wait_reset == True:
rx = writer.recv()
time.sleep(1)
for i in range(3):
writer.send("")
rx = writer.recv()
if "updater".encode() in rx:
# No need to wait for reset
do_wait_reset = False
break
time.sleep(1)
if do_wait_reset:
# Wait to reset the board
print('Please press RESET button on target board')
sys.stdout.flush()
bootrom_msg = writer.cancel_autoboot()
# Remove files
if ConfigArgs.ERASE_NAME :
print(">>> Remove exisiting files ...")
writer.delete_files(ConfigArgs.ERASE_NAME)
# Install files
if ConfigArgs.PACKAGE_NAME or ConfigArgs.PKGSYS_NAME or ConfigArgs.PKGAPP_NAME or ConfigArgs.PKGUPD_NAME:
print(">>> Install files ...")
if ConfigArgs.PACKAGE_NAME :
writer.install_files(ConfigArgs.PACKAGE_NAME, "install")
if ConfigArgs.PKGSYS_NAME :
writer.install_files(ConfigArgs.PKGSYS_NAME, "install")
if ConfigArgs.PKGAPP_NAME :
writer.install_files(ConfigArgs.PKGAPP_NAME, "install")
if ConfigArgs.PKGUPD_NAME :
writer.install_files(ConfigArgs.PKGUPD_NAME, "install -k updater.key")
# Save files
if ConfigArgs.FILE_NAME :
print(">>> Save files ...")
writer.save_files(ConfigArgs.FILE_NAME)
# Set auto boot
if not ConfigArgs.NO_SET_BOOTABLE:
print(">>> Save Configuration to FlashROM ...")
writer.send("set bootable M0P")
writer.wait_for_prompt()
# Sync all cached data to flash
writer.send("sync")
writer.wait_for_prompt()
if REBOOT_AT_END :
print("Restarting the board ...")
writer.send("reboot")
return 0
if __name__ == "__main__":
try:
sys.exit(main())
except KeyboardInterrupt:
print("Canceled by keyboard interrupt.")
pass

590
ports/cxd56/tools/xmodem.py Normal file
View File

@ -0,0 +1,590 @@
'''
===============================
XMODEM file transfer protocol
===============================
.. $Id$
This is a literal implementation of XMODEM.TXT_, XMODEM1K.TXT_ and
XMODMCRC.TXT_, support for YMODEM and ZMODEM is pending. YMODEM should
be fairly easy to implement as it is a hack on top of the XMODEM
protocol using sequence bytes ``0x00`` for sending file names (and some
meta data).
.. _XMODEM.TXT: doc/XMODEM.TXT
.. _XMODEM1K.TXT: doc/XMODEM1K.TXT
.. _XMODMCRC.TXT: doc/XMODMCRC.TXT
Data flow example including error recovery
==========================================
Here is a sample of the data flow, sending a 3-block message.
It includes the two most common line hits - a garbaged block,
and an ``ACK`` reply getting garbaged. ``CRC`` or ``CSUM`` represents
the checksum bytes.
XMODEM 128 byte blocks
----------------------
::
SENDER RECEIVER
<-- NAK
SOH 01 FE Data[128] CSUM -->
<-- ACK
SOH 02 FD Data[128] CSUM -->
<-- ACK
SOH 03 FC Data[128] CSUM -->
<-- ACK
SOH 04 FB Data[128] CSUM -->
<-- ACK
SOH 05 FA Data[100] CPMEOF[28] CSUM -->
<-- ACK
EOT -->
<-- ACK
XMODEM-1k blocks, CRC mode
--------------------------
::
SENDER RECEIVER
<-- C
STX 01 FE Data[1024] CRC CRC -->
<-- ACK
STX 02 FD Data[1024] CRC CRC -->
<-- ACK
STX 03 FC Data[1000] CPMEOF[24] CRC CRC -->
<-- ACK
EOT -->
<-- ACK
Mixed 1024 and 128 byte Blocks
------------------------------
::
SENDER RECEIVER
<-- C
STX 01 FE Data[1024] CRC CRC -->
<-- ACK
STX 02 FD Data[1024] CRC CRC -->
<-- ACK
SOH 03 FC Data[128] CRC CRC -->
<-- ACK
SOH 04 FB Data[100] CPMEOF[28] CRC CRC -->
<-- ACK
EOT -->
<-- ACK
YMODEM Batch Transmission Session (1 file)
------------------------------------------
::
SENDER RECEIVER
<-- C (command:rb)
SOH 00 FF foo.c NUL[123] CRC CRC -->
<-- ACK
<-- C
SOH 01 FE Data[128] CRC CRC -->
<-- ACK
SOH 02 FC Data[128] CRC CRC -->
<-- ACK
SOH 03 FB Data[100] CPMEOF[28] CRC CRC -->
<-- ACK
EOT -->
<-- NAK
EOT -->
<-- ACK
<-- C
SOH 00 FF NUL[128] CRC CRC -->
<-- ACK
'''
__author__ = 'Wijnand Modderman <maze@pyth0n.org>'
__copyright__ = ['Copyright (c) 2010 Wijnand Modderman',
'Copyright (c) 1981 Chuck Forsberg']
__license__ = 'MIT'
__version__ = '0.3.2'
import logging
import time
import sys
from functools import partial
import collections
# Loggerr
log = logging.getLogger('xmodem')
# Protocol bytes
SOH = bytes([0x01])
STX = bytes([0x02])
EOT = bytes([0x04])
ACK = bytes([0x06])
DLE = bytes([0x10])
NAK = bytes([0x15])
CAN = bytes([0x18])
CRC = bytes([0x43]) # C
class XMODEM(object):
'''
XMODEM Protocol handler, expects an object to read from and an object to
write to.
>>> def getc(size, timeout=1):
... return data or None
...
>>> def putc(data, timeout=1):
... return size or None
...
>>> modem = XMODEM(getc, putc)
:param getc: Function to retreive bytes from a stream
:type getc: callable
:param putc: Function to transmit bytes to a stream
:type putc: callable
:param mode: XMODEM protocol mode
:type mode: string
:param pad: Padding character to make the packets match the packet size
:type pad: char
'''
# crctab calculated by Mark G. Mendel, Network Systems Corporation
crctable = [
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0,
]
def __init__(self, getc, putc, mode='xmodem', pad=b'\x1a'):
self.getc = getc
self.putc = putc
self.mode = mode
self.pad = pad
def abort(self, count=2, timeout=60):
'''
Send an abort sequence using CAN bytes.
'''
for counter in range(0, count):
self.putc(CAN, timeout)
def send(self, stream, retry=32, timeout=360, quiet=0, callback=None):
'''
Send a stream via the XMODEM protocol.
>>> stream = file('/etc/issue', 'rb')
>>> print modem.send(stream)
True
Returns ``True`` upon succesful transmission or ``False`` in case of
failure.
:param stream: The stream object to send data from.
:type stream: stream (file, etc.)
:param retry: The maximum number of times to try to resend a failed
packet before failing.
:type retry: int
:param timeout: The number of seconds to wait for a response before
timing out.
:type timeout: int
:param quiet: If 0, it prints info to stderr. If 1, it does not print any info.
:type quiet: int
:param callback: Reference to a callback function that has the
following signature. This is useful for
getting status updates while a xmodem
transfer is underway.
Expected callback signature:
def callback(total_packets, success_count, error_count)
:type callback: callable
'''
# initialize protocol
try:
packet_size = dict(
xmodem = 128,
xmodem1k = 1024,
)[self.mode]
except AttributeError:
raise ValueError("An invalid mode was supplied")
error_count = 0
crc_mode = 0
cancel = 0
while True:
char = self.getc(1)
if char:
if char == NAK:
crc_mode = 0
break
elif char == CRC:
crc_mode = 1
break
elif char == CAN:
if not quiet:
print('received CAN', file=sys.stderr)
if cancel:
return False
else:
cancel = 1
else:
log.error('send ERROR expected NAK/CRC, got %s' % \
(ord(char),))
error_count += 1
if error_count >= retry:
self.abort(timeout=timeout)
return False
# send data
error_count = 0
success_count = 0
total_packets = 0
sequence = 1
while True:
data = stream.read(packet_size)
if not data:
log.info('sending EOT')
# end of stream
break
total_packets += 1
data = data.ljust(packet_size, self.pad)
if crc_mode:
crc = self.calc_crc(data)
else:
crc = self.calc_checksum(data)
# emit packet
while True:
if packet_size == 128:
self.putc(SOH)
else: # packet_size == 1024
self.putc(STX)
self.putc(bytes([sequence]))
self.putc(bytes([0xff - sequence]))
self.putc(data)
if crc_mode:
self.putc(bytes([crc >> 8]))
self.putc(bytes([crc & 0xff]))
else:
self.putc(bytes([crc]))
char = self.getc(1, timeout)
if char == ACK:
success_count += 1
if isinstance(callback, collections.Callable):
callback(total_packets, success_count, error_count)
break
if char == NAK:
error_count += 1
if isinstance(callback, collections.Callable):
callback(total_packets, success_count, error_count)
if error_count >= retry:
# excessive amounts of retransmissions requested,
# abort transfer
self.abort(timeout=timeout)
log.warning('excessive NAKs, transfer aborted')
return False
# return to loop and resend
continue
else:
log.error('Not ACK, Not NAK')
error_count += 1
if isinstance(callback, collections.Callable):
callback(total_packets, success_count, error_count)
if error_count >= retry:
# excessive amounts of retransmissions requested,
# abort transfer
self.abort(timeout=timeout)
log.warning('excessive protocol errors, transfer aborted')
return False
# return to loop and resend
continue
# protocol error
self.abort(timeout=timeout)
log.error('protocol error')
return False
# keep track of sequence
sequence = (sequence + 1) % 0x100
while True:
# end of transmission
self.putc(EOT)
#An ACK should be returned
char = self.getc(1, timeout)
if char == ACK:
break
else:
error_count += 1
if error_count >= retry:
self.abort(timeout=timeout)
log.warning('EOT was not ACKd, transfer aborted')
return False
return True
def recv(self, stream, crc_mode=1, retry=16, timeout=60, delay=1, quiet=0):
'''
Receive a stream via the XMODEM protocol.
>>> stream = file('/etc/issue', 'wb')
>>> print modem.recv(stream)
2342
Returns the number of bytes received on success or ``None`` in case of
failure.
'''
# initiate protocol
error_count = 0
char = 0
cancel = 0
while True:
# first try CRC mode, if this fails,
# fall back to checksum mode
if error_count >= retry:
self.abort(timeout=timeout)
return None
elif crc_mode and error_count < (retry / 2):
if not self.putc(CRC):
time.sleep(delay)
error_count += 1
else:
crc_mode = 0
if not self.putc(NAK):
time.sleep(delay)
error_count += 1
char = self.getc(1, timeout)
if not char:
error_count += 1
continue
elif char == SOH:
#crc_mode = 0
break
elif char == STX:
break
elif char == CAN:
if cancel:
return None
else:
cancel = 1
else:
error_count += 1
# read data
error_count = 0
income_size = 0
packet_size = 128
sequence = 1
cancel = 0
while True:
while True:
if char == SOH:
packet_size = 128
break
elif char == STX:
packet_size = 1024
break
elif char == EOT:
# We received an EOT, so send an ACK and return the received
# data length
self.putc(ACK)
return income_size
elif char == CAN:
# cancel at two consecutive cancels
if cancel:
return None
else:
cancel = 1
else:
if not quiet:
print('recv ERROR expected SOH/EOT, got', ord(char), file=sys.stderr)
error_count += 1
if error_count >= retry:
self.abort()
return None
# read sequence
error_count = 0
cancel = 0
seq1 = ord(self.getc(1))
seq2 = 0xff - ord(self.getc(1))
if seq1 == sequence and seq2 == sequence:
# sequence is ok, read packet
# packet_size + checksum
data = self.getc(packet_size + 1 + crc_mode, timeout)
if crc_mode:
csum = (ord(data[-2]) << 8) + ord(data[-1])
data = data[:-2]
log.debug('CRC (%04x <> %04x)' % \
(csum, self.calc_crc(data)))
valid = csum == self.calc_crc(data)
else:
csum = data[-1]
data = data[:-1]
log.debug('checksum (checksum(%02x <> %02x)' % \
(ord(csum), self.calc_checksum(data)))
valid = ord(csum) == self.calc_checksum(data)
# valid data, append chunk
if valid:
income_size += len(data)
stream.write(data)
self.putc(ACK)
sequence = (sequence + 1) % 0x100
char = self.getc(1, timeout)
continue
else:
# consume data
self.getc(packet_size + 1 + crc_mode)
self.debug('expecting sequence %d, got %d/%d' % \
(sequence, seq1, seq2))
# something went wrong, request retransmission
self.putc(NAK)
def calc_checksum(self, data, checksum=0):
'''
Calculate the checksum for a given block of data, can also be used to
update a checksum.
>>> csum = modem.calc_checksum('hello')
>>> csum = modem.calc_checksum('world', csum)
>>> hex(csum)
'0x3c'
'''
return (sum(map(ord, data)) + checksum) % 256
def calc_crc(self, data, crc=0):
'''
Calculate the Cyclic Redundancy Check for a given block of data, can
also be used to update a CRC.
>>> crc = modem.calc_crc('hello')
>>> crc = modem.calc_crc('world', crc)
>>> hex(crc)
'0xd5e3'
'''
for char in data:
crc = (crc << 8) ^ self.crctable[((crc >> 8) ^ int(char)) & 0xff]
return crc & 0xffff
XMODEM1k = partial(XMODEM, mode='xmodem1k')
def run():
import optparse
import subprocess
parser = optparse.OptionParser(usage='%prog [<options>] <send|recv> filename filename')
parser.add_option('-m', '--mode', default='xmodem',
help='XMODEM mode (xmodem, xmodem1k)')
options, args = parser.parse_args()
if len(args) != 3:
parser.error('invalid arguments')
return 1
elif args[0] not in ('send', 'recv'):
parser.error('invalid mode')
return 1
def _func(so, si):
import select
import subprocess
print('si', si)
print('so', so)
def getc(size, timeout=3):
w,t,f = select.select([so], [], [], timeout)
if w:
data = so.read(size)
else:
data = None
print('getc(', repr(data), ')')
return data
def putc(data, timeout=3):
w,t,f = select.select([], [si], [], timeout)
if t:
si.write(data)
si.flush()
size = len(data)
else:
size = None
print('putc(', repr(data), repr(size), ')')
return size
return getc, putc
def _pipe(*command):
pipe = subprocess.Popen(command,
stdout=subprocess.PIPE, stdin=subprocess.PIPE)
return pipe.stdout, pipe.stdin
if args[0] == 'recv':
import io
getc, putc = _func(*_pipe('sz', '--xmodem', args[2]))
stream = open(args[1], 'wb')
xmodem = XMODEM(getc, putc, mode=options.mode)
status = xmodem.recv(stream, retry=8)
stream.close()
elif args[0] == 'send':
getc, putc = _func(*_pipe('rz', '--xmodem', args[2]))
stream = open(args[1], 'rb')
xmodem = XMODEM(getc, putc, mode=options.mode)
status = xmodem.send(stream, retry=8)
stream.close()
if __name__ == '__main__':
sys.exit(run())

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,30 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
*
* 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.
*/
#define MICROPY_HW_BOARD_NAME "MDBT50Q-DB-40"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_HW_LED_STATUS (&pin_P0_13)

View File

@ -0,0 +1,8 @@
USB_VID = 0x239A
USB_PID = 0x80BC
USB_PRODUCT = "MDBT50Q-DB-40"
USB_MANUFACTURER = "Raytac Corporation"
MCU_CHIP = nrf52840
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -0,0 +1,80 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_P0_03), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_P0_05), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) },
{ MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) },
{ MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) },
{ MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) },
{ MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) },
{ MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) },
{ MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) },
{ MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) },
{ MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) },
{ MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) },
{ MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
{ MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) },
{ MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) },
{ MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) },
{ MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
{ MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) },
{ MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) },
{ MP_ROM_QSTR(MP_QSTR_P1_10), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_P1_12), MP_ROM_PTR(&pin_P1_12) },
{ MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) },
{ MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
{ MP_ROM_QSTR(MP_QSTR_AIN_0), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_AIN_1), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_AIN_2), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_AIN_3), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_AIN_4), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_AIN_5), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_AIN_6), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_AIN_7), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_NFC_1), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_NFC_2), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_14) },
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_LED_4), MP_ROM_PTR(&pin_P0_16) },
{ MP_ROM_QSTR(MP_QSTR_SW1), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_SW2), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_SW3), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_SW4), MP_ROM_PTR(&pin_P0_25) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -107,98 +107,65 @@ void spi_reset(void) {
spi_clock_disable(ALL_CLOCKS & ~(never_reset_mask));
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
const mcu_pin_obj_t * sck, const mcu_pin_obj_t * mosi,
const mcu_pin_obj_t * miso) {
STATIC const mcu_periph_obj_t *find_pin_function(const mcu_periph_obj_t *table, size_t sz, const mcu_pin_obj_t *pin, int periph_index) {
for(size_t i = 0; i<sz; i++, table++) {
if(periph_index == table->periph_index && pin == table->pin ) {
return table;
}
}
return NULL;
}
//match pins to SPI objects
SPI_TypeDef * SPIx;
STATIC int check_pins(busio_spi_obj_t *self,
const mcu_pin_obj_t * sck, const mcu_pin_obj_t * mosi,
const mcu_pin_obj_t * miso) {
bool spi_taken = false;
uint8_t sck_len = MP_ARRAY_SIZE(mcu_spi_sck_list);
uint8_t mosi_len = MP_ARRAY_SIZE(mcu_spi_mosi_list);
uint8_t miso_len = MP_ARRAY_SIZE(mcu_spi_miso_list);
bool spi_taken = false;
//SCK is not optional. MOSI and MISO are
for (uint i = 0; i < sck_len; i++) {
if (mcu_spi_sck_list[i].pin == sck) {
//if both MOSI and MISO exist, loop search normally
if ((mosi != NULL) && (miso != NULL)) {
//MOSI
for (uint j = 0; j < mosi_len; j++) {
if (mcu_spi_mosi_list[j].pin == mosi) {
//MISO
for (uint k = 0; k < miso_len; k++) {
if ((mcu_spi_miso_list[k].pin == miso) //everything needs the same index
&& (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index)
&& (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[k].periph_index)) {
//keep looking if the SPI is taken, edge case
if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
//store pins if not
self->sck = &mcu_spi_sck_list[i];
self->mosi = &mcu_spi_mosi_list[j];
self->miso = &mcu_spi_miso_list[k];
break;
}
}
if (self->sck != NULL) {
break; // Multi-level break to pick lowest peripheral
}
}
}
if (self->sck != NULL) {
break;
}
// if just MISO, reduce search
} else if (miso != NULL) {
for (uint j = 0; j < miso_len; j++) {
if ((mcu_spi_miso_list[j].pin == miso) //only SCK and MISO need the same index
&& (mcu_spi_sck_list[i].periph_index == mcu_spi_miso_list[j].periph_index)) {
if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
self->sck = &mcu_spi_sck_list[i];
self->mosi = NULL;
self->miso = &mcu_spi_miso_list[j];
break;
}
}
if (self->sck != NULL) {
break;
}
// if just MOSI, reduce search
} else if (mosi != NULL) {
for (uint j = 0; j < mosi_len; j++) {
if ((mcu_spi_mosi_list[j].pin == mosi) //only SCK and MOSI need the same index
&& (mcu_spi_sck_list[i].periph_index == mcu_spi_mosi_list[j].periph_index)) {
if (reserved_spi[mcu_spi_sck_list[i].periph_index - 1]) {
spi_taken = true;
continue;
}
self->sck = &mcu_spi_sck_list[i];
self->mosi = &mcu_spi_mosi_list[j];
self->miso = NULL;
break;
}
}
if (self->sck != NULL) {
break;
}
} else {
//throw an error immediately
mp_raise_ValueError(translate("Must provide MISO or MOSI pin"));
}
}
if (!sck) {
mp_raise_ValueError(translate("Must provide SCK pin"));
}
if (!miso && !mosi) {
mp_raise_ValueError(translate("Must provide MISO or MOSI pin"));
}
// Loop over each possibility for SCK. Check whether MISO and/or MOSI can be used on the same peripheral
for (uint i = 0; i < sck_len; i++) {
const mcu_periph_obj_t *mcu_spi_sck = &mcu_spi_sck_list[i];
if (mcu_spi_sck->pin != sck) {
continue;
}
int periph_index = mcu_spi_sck->periph_index;
const mcu_periph_obj_t *mcu_spi_miso = NULL;
if (miso && !(mcu_spi_miso = find_pin_function(mcu_spi_miso_list, miso_len, miso, periph_index))) {
continue;
}
const mcu_periph_obj_t *mcu_spi_mosi = NULL;
if (mosi && !(mcu_spi_mosi = find_pin_function(mcu_spi_mosi_list, mosi_len, mosi, periph_index))) {
continue;
}
if (reserved_spi[periph_index-1]) {
spi_taken = true;
continue;
}
self->sck = mcu_spi_sck;
self->mosi = mcu_spi_mosi;
self->miso = mcu_spi_miso;
return periph_index;
}
//handle typedef selection, errors
if (self->sck != NULL && (self->mosi != NULL || self->miso != NULL)) {
SPIx = mcu_spi_banks[self->sck->periph_index - 1];
} else {
if (spi_taken) {
mp_raise_ValueError(translate("Hardware busy, try alternative pins"));
} else {
@ -206,6 +173,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
}
}
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
const mcu_pin_obj_t * sck, const mcu_pin_obj_t * mosi,
const mcu_pin_obj_t * miso) {
int periph_index = check_pins(self, sck, mosi, miso);
SPI_TypeDef * SPIx = mcu_spi_banks[periph_index - 1];
//Start GPIO for each pin
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = pin_mask(sck->number);

View File

@ -153,7 +153,7 @@ def create_pr(changes, updated, git_info, user):
info["id"] = id
updated_list.append(info)
updated = json.dumps(updated_list, sort_keys=True, indent=4).encode("utf-8") + b"\n"
updated = json.dumps(updated_list, sort_keys=True, indent=1).encode("utf-8") + b"\n"
#print(updated.decode("utf-8"))
pr_title = "Automated website update for release {}".format(changes["new_release"])
boards = ""
@ -205,19 +205,6 @@ def create_pr(changes, updated, git_info, user):
print(changes)
print(pr_info)
def update_downloads(boards, release):
response = github.get("/repos/adafruit/circuitpython/releases/tags/{}".format(release))
if not response.ok:
print(response.text)
raise RuntimeError("cannot get previous release info")
assets = response.json()["assets"]
for asset in assets:
board_name = asset["name"].split("-")[2]
if board_name not in boards:
continue
boards[board_name]["download_count"] += asset["download_count"]
def print_active_user():
response = github.get("/user")
@ -269,9 +256,6 @@ def generate_download_info():
board_mapping = get_board_mapping()
for release in previous_releases:
update_downloads(board_mapping, release)
for port in SUPPORTED_PORTS:
board_path = os.path.join("../ports", port, "boards")
for board_path in os.scandir(board_path):
@ -291,7 +275,9 @@ def generate_download_info():
"stable": new_stable,
"version": new_tag,
"modules": support_matrix.get(alias, "[]"),
"files": {}
"files": {},
"languages": languages,
"extensions": board_info["extensions"]
}
for language in languages:
files = []