-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Micropython 25ae98f merge #1068
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 10000 terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Micropython 25ae98f merge #1068
Conversation
This makes ADCAll work correctly on L4 MCUs.
The problem is the existing code which tries to optimise the reinitialisation of the DMA breaks the abstraction of the HAL. For the STM32L4 the HAL's DMA setup code maintains two private vars (ChannelIndex, DmaBaseAddress) and updates a hardware register (CCR). In HAL_DMA_Init(), the CCR is updated to set the direction of the DMA. This is a problem because, when using the SD Card interface, the same DMA channel is used in both directions, so the direction bit in the CCR must follow that. A quick and effective fix for the L4 is to simply call HAL_DMA_DeInit() and HAL_DMA_Init() every time.
For a given IRQn (eg UART) there's no need to carry around both a PRI and SUBPRI value (eg IRQ_PRI_UART, IRQ_SUBPRI_UART). Instead, the IRQ_PRI_UART value has been changed in this patch to be the encoded hardware value, using NVIC_EncodePriority. This way the NVIC_SetPriority function can be used directly, instead of going through HAL_NVIC_SetPriority which must do extra processing to encode the PRI+SUBPRI. For a priority grouping of 4 (4 bits for preempt priority, 0 bits for the sub-priority), which is used in the stm32 port, the IRQ_PRI_xxx constants remain unchanged in their value. This patch also "fixes" the use of raise_irq_pri() which should be passed the encoded value (but as mentioned above the unencoded value is the same as the encoded value for priority grouping 4, so there was no bug from this error).
In adcall.py the pyb module may not be imported, so use ADCAll directly. In dac.py the DAC object now prints more info, so update .exp file. In spi.py the SPI should be deinitialised upon exit, so the test can run a second time correctly.
Disabling this saves around 6000 bytes of code space and gets the 512k build fitting in the available flash again (it increased lately due to an increase in the size of the ESP8266 SDK).
Add --init to the submodule update example, thus, all submodules get initialised including the nested (--recursive) ones. Without it there might not be a submodule init.
If a socket is cleanly shut down by the peer then reads on this socket should continue to return zero bytes. The lwIP socket API does not have this behaviour (it only returns zero once, then blocks on subsequent calls) so this patch adds explicit checks and logic for peer closed sockets.
The order of function calls in an arithmetic expression is undefined and so they must be written out as sequential statements. Thanks to @dv-extrarius for reporting this issue, see issue adafruit#3690.
Using MP_STREAM_POLL_HUP for ERR_RST state follows how *nix handles this case.
On this 32-bit arch there's no need to use the long version of the format specifier. It's only there to appease the compiler which checks the type of the args passed to printf. Removing the "l" saves a bit of code space.
Commit 1e70fda fixes this difference.
Commit 68c2817 implemented checking for valid utf-8 data.
Commit e269cab added a check that the first argument to the to_bytes() method is an integer, and now uPy follows CPython behaviour and raises a TypeError for this test. Note: CPython checks the argument types before checking the number of arguments, but uPy does it the other way around, so they give different exception messages for this test, but still the same type, a TypeError.
This was accidentally added in 6abede2
Prior to this patch the QSPI driver assumed that the length of all data reads and writes was a multiple of 4. This patch allows any length. Reads are optimised for speed by using 32-bit transfers when possible, but writes always use a byte transfer because they only use a single data IO line and are relatively slow.
This patch adds support to mboot for programming external SPI flash. It allows SPI flash to be programmed via a USB DFU utility in the same way that internal MCU flash is programmed.
Segments are separated by / and begin with the memory address. This follows how the ST DFU tool works.
These files can also be used for F723, F732 and F733 MCUs.
This and the previous 4 commits combined have change in code size of: bare-arm: -92 minimal x86: -544 unix x64: -544 unix nanbox: -712 stm32: -116 cc3200: -128 esp8266: -348 esp32: -232
I pulled this PR and loaded it on to a few boards for test: It's possible I had some mismatch between bootladers and CP builds - but it works now! ampy work for ls, put , rm - get does not work, but that is a known issue Also note that instructions for loading the bootloader to the feather52832 are out-dated on the command is shown as
but it should be
here is how I ran it (on Linux)
|
Removed qemu build because it does only minimal testing and is building for Cortex-M3 architecture. Travis is finally happy, so this is ready for review. Thanks! |
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.
Thank you so much for taking this on! I really appreciate it. One comment and then it'll be good to merge.
- ([[ -z "$TRAVIS_BOARD" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) | ||
- ([[ $TRAVIS_TEST != "qemu" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) |
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.
Remove this whole line. This has it always download it when the line above covers the other cases.
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.
Roger. Missed that overlap.
This merges from micropython@25ae98f.
I did some REPL testing, and it passes the Unix tests (that took some work), but some hidden issues may show up. Atmel, esp8266, and nrf all compile and bring up the REPL.
Some notes:
extmod/vfs*
: some files removed, some renamings. We exposed some statics for our use elsewhere, which means it was not a simple merge.#ifdef
->#if
, but without necessarily defining the variables, so I added `#define``s so they won't make warningsdupterm
and used it to create even the initial UART. Had to undo this becausemultiterminal
doesn't work like that.drivers/bus
after we deleted it because some code was using it.