Commit Graph

14639 Commits

Author SHA1 Message Date
Hierophect 4a25c2344e implement os urandom 2019-11-18 18:27:25 -05:00
Hierophect 256abf5505 Add board folders 2019-11-18 16:13:27 -05:00
Ayan Pahwa a0ef667a14 Supervisor: create code.py file with sample code 2019-11-19 01:59:29 +05:30
Hierophect a4797327cd add microcontroller toggles for status LED 2019-11-18 13:51:59 -05:00
Dan Halbert 2da1b68956
Merge pull request #2296 from jepler/github-actions-forks
workflows: Don't try to upload when running in someone's fork
2019-11-18 13:49:24 -05:00
Jeff Epler 568636d562 run_background_tasks: Do nothing unless there has been a tick
This improves performance of running python code by 34%, based
on the "pystone" benchmark on metro m4 express at 5000 passes
(1127.65 -> 1521.6 passes/second).

In addition, by instrumenting the tick function and monitoring on an
oscilloscope, the time actually spent in run_background_tasks() on
the metro m4 decreases from average 43% to 0.5%. (however, there's
some additional overhead that is moved around and not accounted for
in that "0.5%" figure, each time supervisor_run_background_tasks_if_tick
is called but no tick has occurred)

On the CPB, it increases pystone from 633 to 769, a smaller percentage
increase of 21%.  I did not measure the time actually spent in
run_background_tasks() on CPB.

Testing performed: on metro m4 and cpb, run pystone adapted from python3.4
(change time.time to time.monotonic for sub-second resolution)

Besides running a 5000 pass test, I also ran a 50-pass test while
scoping how long an output pin was set.  Average: 34.59ms or 1445/s on m4,
67.61ms or 739/s on cbp, both matching the other pystone result reasonably
well.

import pystone
import board
import digitalio
import time

d = digitalio.DigitalInOut(board.D13)
d.direction = digitalio.Direction.OUTPUT

while True:
    d.value = 0
    time.sleep(.01)
    d.value = 1
    pystone.main(50)
2019-11-18 11:26:48 -06:00
Jeff Epler 40a47d41df samd: background: Allow monitoring time taken in background task
If you define MONITOR_BACKGROUND_TASK, then a physical output pin
(Metro M4 Express's "SCL" pin by default) will be set HIGH while in
the background task and LOW at other times
2019-11-18 11:01:24 -06:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Jeff Epler 45d1b290ee circuitpy_mpconfig.h: Express HOOKS in terms of RUN_BACKGROUND_TASKS
.. this means that when we want to modify RUN_BACKGROUND_TASKS, only one
change is needed instead of 3
2019-11-18 11:00:24 -06:00
Jeff Epler acde22a436 circuitpy_mpconfig.h: Move includes after include-guard
To benefit from gcc's "once-only headers" implementation, the
"wrapper-#ifndef" must be the first non-comment part of the file,
according to the manual for various gcc/cpp versions.
2019-11-18 11:00:24 -06:00
Dan Halbert 9000c88965
Merge pull request #2295 from jepler/make-translate-xargs
Makefile: Fix a problem where `xargs` invoked `xgettext` 2x
2019-11-18 11:04:02 -05:00
Jeff Epler 37fd08e637 workflows: Don't try to upload when running in someone's fork
.. which we can tell by whether the environment variable is non-empty
2019-11-17 21:21:30 -06:00
Jeff Epler 8e9ac59396 Makefile: Fix a problem where `xargs` invoked `xgettext` 2x
On a Debian 10 system, the number of arguments to xargs was such that
it would not fit in a single invocation (xargs --show-limits prints
"bytes: Size of command buffer we are actually using: 131072").

In this situation, the output from the second invocation of xgettext
would replace the output of the first one, so messages that appeared only
in files early in the list would be lost.  Strings in "extmod" were most
frequently the victim, including "incorrect padding" from modubinascii.c.

Unfortunately, when the github environment was similar enough to the
environment where "make translate" was invoked, the problem was not
found by "check-translate", because the same (incorrect, truncated)
potfile would be generated on both systems.  Apparently Ubuntu and Debian
were different enough that the problem could become visible.

xgettext has a mode where it reads files from stdin ('-f-'), but this does
not have a zero-delimited variant documented.  Still, we will assume
that files with adversarial names are not committed to circuitpython
or created by the build process, and print newline-delimited filenames
from `find` to be processed by `xgettext -f-`.
2019-11-17 21:00:07 -06:00
Jeff Epler 900e365f93 locale: Re-run "make translate" subsequent to the xargs/xgettext fix
I manually inspected the changes relative to 5.0.0-alpha.5-93-g8778f367e
and believe they are innocuous; Besides restoring some translations
that had become fuzzy, "c-format" was removed from many (all?) fuzzy
messages, and the word-wrapping of one message was changed.
2019-11-17 20:59:14 -06:00
Jeff Epler 6700a58a17 Makefile: Fix a problem where `xargs` invoked `xgettext` 2x
On a Debian 10 system, the number of arguments to xargs was such that
it would not fit in a single invocation (xargs --show-limits prints
"bytes: Size of command buffer we are actually using: 131072").

In this situation, the output from the second invocation of xgettext
would replace the output of the first one, so messages that appeared only
in files early in the list would be lost.  Strings in "extmod" were most
frequently the victim, including "incorrect padding" from modubinascii.c.

Unfortunately, when the github environment was similar enough to the
environment where "make translate" was invoked, the problem was not
found by "check-translate", because the same (incorrect, truncated)
potfile would be generated on both systems.  Apparently Ubuntu and Debian
were different enough that the problem could become visible.

xgettext has a mode where it reads files from stdin ('-f-'), but this does
not have a zero-delimited variant documented.  Still, we will assume
that files with adversarial names are not committed to circuitpython
or created by the build process, and print newline-delimited filenames
from `find` to be processed by `xgettext -f-`.
2019-11-17 20:54:21 -06:00
Jeff Epler c449748663 locale: commit results of running "make translate" 2019-11-17 20:21:18 -06:00
Jeff Epler 25273f9e87 Merge remote-tracking branch 'origin/master' into korean_trans 2019-11-17 20:10:50 -06:00
Limor "Ladyada" Fried 8778f367e8
Merge pull request #2293 from CedarGroveStudios/patch-1
Add a USB interface description for StringCar M0 Express
2019-11-16 22:21:07 -05:00
Cedar Grove Maker Studios e7df288a34
add USB interface description
... to "StringCarM0Ex"
2019-11-16 16:40:40 -08:00
Hierophect 51078cc38f timing tweaks with testing 2019-11-15 17:17:05 -05:00
Dan Halbert 5d9ac8b1d9
Merge pull request #2290 from hierophect/pin-commonhal-additions
Add pin reset and never reset to common-hal
2019-11-15 16:49:07 -05:00
Hierophect 98fd372d5b Add missing define 2019-11-15 13:19:37 -05:00
Hierophect ee1559b921 Merge branch 'pin-commonhal-additions' into stm32-neopixel 2019-11-15 13:09:59 -05:00
Hierophect 81223c76bd revert error 2019-11-15 13:04:25 -05:00
Hierophect 5f290d091e Merge branch 'pin-commonhal-additions' into stm32-neopixel 2019-11-15 13:00:11 -05:00
Hierophect 2c6781f74d move neopixel_in_use flag to shared-bindings 2019-11-15 12:59:52 -05:00
Hierophect 8a58af3e96 Merge branch 'pin-commonhal-additions' into stm32-neopixel 2019-11-15 12:50:02 -05:00
Hierophect 8ff1bc0132 add missing include 2019-11-15 12:49:47 -05:00
Hierophect e1579a1cc5 Merge branch 'pin-commonhal-additions' into stm32-neopixel 2019-11-15 12:47:23 -05:00
Hierophect de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Hierophect 6cce2d6d14 Implement Neopixel write, add defaults to f405 2019-11-15 12:28:16 -05:00
Dan Halbert f3038e53d1
Merge pull request #2286 from hierophect/stm32-speedy-405
STM32: Raise clock speed of F405
2019-11-15 11:25:29 -05:00
KalbeAbbas 8134ceec83
Update pins.c 2019-11-14 23:16:55 +05:00
KalbeAbbas 799770926b
Update pins.c 2019-11-14 18:51:01 +05:00
KalbeAbbas 949f87fd25
Update pins.c 2019-11-14 18:50:26 +05:00
KalbeAbbas 3db7f2798f updated 2019-11-14 16:34:08 +05:00
Scott Shawcroft 4c55431bb3
Merge pull request #2287 from dhalbert/testing-fixes
Fix start_scan timeout default value
2019-11-13 22:09:58 -08:00
Dan Halbert 8584c1e824 Fix start_scan timeout default value 2019-11-13 21:34:20 -05:00
Jeff Epler 66148ee7f0
Merge pull request #2283 from theacodes/allow-changing-usb-interface-names
Allow boards to change the "CircuitPython" text in their USB interface description.
2019-11-13 14:58:58 -06:00
Hierophect 6e96b1945e Raise clock speed, adjust divisors 2019-11-13 13:18:43 -05:00
KalbeAbbas 9ce2087a75 change 2019-11-13 17:18:00 +05:00
KalbeAbbas 99952c0df0 Removed SD card folder 2019-11-13 16:07:52 +05:00
KalbeAbbas 040f201fab added SD card module 2019-11-13 15:44:59 +05:00
KalbeAbbas f6577fc9f7 SD card folder removed 2019-11-13 15:11:03 +05:00
KalbeAbbas 5493dd5dba Added SD card submodule 2019-11-13 15:06:53 +05:00
KalbeAbbas b269fb4bfa deleted SD card folder 2019-11-13 14:58:57 +05:00
Dan Halbert 166518fc9b
Merge pull request #2272 from hierophect/stm32-microcontroller-fillout
STM32: add us delay
2019-11-12 18:03:55 -05:00
Thea Flowers 67ff1c92f0
Allow boards to change the "CircuitPython" text in their USB interface description.
In cases where more than one board is connected to a single computer it can become pretty hard to figure out which board you're actually talking to. For example, if you have several MIDI-compatible boards they all show up as "CircuitPython MIDI". This change allows boards to replace the "CircuitPython" part of their USB descriptors with more specific text, for example, "CircuitPython Feather" or just "Feather". This will let folks more easily tell boards apart.

The new option is named `USB_INTERFACE_NAME` and is available in `mkconfigboard.mk`. For example:

```
USB_INTERFACE_NAME = "Feather"
```
2019-11-12 13:29:35 -08:00
Dan Halbert 356aa2ea28
Merge pull request #2211 from hierophect/stm32-uart
STM32: UART support
2019-11-12 15:20:34 -05:00
Hierophect e40bd07fcf fix conflicting definitions on discovery boards 2019-11-12 13:03:13 -05:00