-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge in MicroPython v1.10 #4646
Conversation
Default is enabled, disabled for minimal builds. Saves 1296 bytes on x86, 976 bytes on ARM.
…DULO Instead of redirecting to str.__mod__(), use str.format() in this case.
This part is functionally similar to STM32F767xx (they share a datasheet) so support is generally comparable. When adding board support the stm32f767_af.csv and stm32f767.ld should be used.
This commit implements PEP479 which disallows raising StopIteration inside a generator to signal that it should be finished. Instead, the generator should simply return when it is complete. See https://www.python.org/dev/peps/pep-0479/ for details.
And thus be buildable again.
Changes made: - make use of MP_OBJ_TO_PTR and MP_OBJ_FROM_PTR where necessary - fix shadowing of index variable i, renamed to j - fix type of above variable to size_t to prevent comparison warning - fix shadowing of res variable - use "(void)" instead of "()" for functions that take no arguments
pyb.umount(None, mountpoint) no longer works.
pyb.mount(None, mountpoint) functionality is also removed and replaced by uos.umount.
This provides a double variant of the float copysignf from libm/math.c which is required for DEBUG=1 builds when MICROPY_FLOAT_IMPL=double
This is required for DEBUG=1 builds when MICROPY_FLOAT_IMPL=double. Thanks to Andrew Leech.
This patches avoids multiplying with negative powers-of-10 when parsing floating-point values, when those powers-of-10 can be exactly represented as a positive power. When represented as a positive power and used to divide, the resulting float will not have any rounding errors. The issue is that mp_parse_num_decimal will sometimes not give the closest floating representation of the input string. Eg for "0.3", which can't be represented exactly in floating point, mp_parse_num_decimal gives a slightly high (by 1LSB) result. This is because it computes the answer as 3 * 0.1, and since 0.1 also can't be represented exactly, multiplying by 3 multiplies up the rounding error in the 0.1. Computing it as 3 / 10, as now done by the change in this commit, gives an answer which is as close to the true value of "0.3" as possible.
They need time (around 4us for VREFINT) to obtain accurate results. Fixes issue micropython#4022.
There appears to be an issue on Windows with CPython >= 3.6, sys.stdout.flush() raises an exception: OSError: [WinError 87] The parameter is incorrect It works fine to just catch and ignore the error on the flush line. Tested on Windows 10 x64 1803 (Build 17134.228), Python 3.6.4 amd64.
On F7s PLLSAI is used as a 48MHz clock source if the main PLL cannot provide such a frequency, and on L4s PLLSAI1 is always used as a clock source for the peripherals. This commit makes sure these PLLs are re-enabled upon waking from stop mode so the peripherals work. See issues micropython#4022 and micropython#4178 (L4 specific).
Power and clock control is low-level functionality and it makes sense to have it in a dedicated file, at least so it can be reused by other parts of the code.
APB1/APB2 are derived from AHB, so if the user sets AHB!=SYSCLK then the APB1/APB2 dividers must be computed from the new AHB.
This ensures that on first boot the most optimal settings are used for the voltage scaling and flash latency (for F7 MCUs). This commit also provides more fine-grained control for the flash latency settings.
Configuring clocks is a critical operation and is best to avoid when possible. If the clocks really need to be reset to the same values then one can pass in a slightly higher value, eg 168000001 Hz to get 168MHz.
The location for a returned exception was changed to state[0] in d95947b
Otherwise, if multiple threads are active, printing data to the REPL may be very slow because in some cases only one character is output per call to mp_hal_stdout_tx_strn.
If there are many short reads to a socket in a row (eg by readline) then releasing and acquiring the GIL each time will give very poor throughput. So first poll the socket to see if it has data, and if it does then don't release the GIL.
Without the static qualifier these objects will be kept by the linker even if they are unused. So this patch saves some RAM when these features are unused by a board.
So that the user can explicitly deactivate UART(0) if needed. See issue micropython#4314. This introduces some risk to "brick" the device, if the user disables the REPL without providing an alternative REPL (eg WebREPL), or any way to reenable it. In such a case the device needs to be erased and reprogrammed. This seems unavoidable, given the desire to have the option to use the UART for something other than the REPL.
The ESP IDF system already provides a math library, and that one is likely to be better tuned to the Xtensa architecture. The IDF components are also tested against its own math library, so best not to override it. Using the system provided library also allows to easily switch to double-precision floating point by changing MICROPY_FLOAT_IMPL to MICROPY_FLOAT_IMPL_DOUBLE.
Some ports (eg esp8266) need to have specific behaviour for driving a DHT reliably.
The original behaviour of open-drain-high was to use the open-drain mode of the GPIO pin, and this seems to make driving a DHT more reliable. See issue micropython#4233.
In order to suit the more common 800KHz by default (instead of 400KHz), and also have the same behaviour as the esp8266 port. Resolves micropython#4396. Note! This is a breaking change. Anyone that has previously used the NeoPixel class on an ESP32 board may be affected.
Otherwise only one of HSPI or VSPI can be used at a time. Fixes issue micropython#4068.
This aligns more closely with the hardware, that there are two, fixed HW SPI peripherals. And it allows to recreate the HW SPI objects without error, as well as create them again after a soft reset. Fixes issue micropython#4103.
With contributions from Oliver Robson (@HowManyOliversAreThere), Sean Lanigan (@seanlano) and @rprr.
For architectures where size_t is less than 32 bits (eg 16 bits) the args must be casted to uint32_t so the left shift will work. For architectures where size_t is greater than 32 bits (eg 64 bits) this new casting will not lose any bits because the end result must anyway fit in a uint32_t.
This port has been verified to work with these latest changes.
Otherwise MICROPY_VERSION_STRING includes these parentheses in the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Thanks for starting this!!
MP_OBJ_FUN_MAKE_SIG
and related signature checking functions look interesting; not sure how they are used yet.
As a random test, I tested busio.UART
on Metro ESP32-S2 in the REPL, and also wrote the same code to a test file and copied it to CIRCUITPY and ran it.
First part for #2999