This shows how ports can add their own custom types/classes.
It is part of the unix coverage build, so we can use it for tests too.
Signed-off-by: Laurens Valk <laurens@pybricks.com>
Follow up to 8a91c719 to no longer explicitly disable BLE in
mpconfigport.h.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
If a CMake-build is run with `make BUILD=/outside/path` then
makeversionheader.py is run with the CWD set to the build directory, which
means the git version lookup will fail and silently fall back to the
mpconfig.h mode (giving the wrong result).
This commit:
- Uses the location of makeversionheader.py to find the repo path.
- Allows overriding this path via --repo-path.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
`_WIN64` is defined for all 64-bit targets, including Arm, so it doesn't
work for detecting `x86_64`. We can use `_M_X64` instead.
Signed-off-by: David Lechner <david@pybricks.com>
Since _M_IX86 is already being checked in the x86 case, it will never
be true in the xtensa case and can be removed.
Signed-off-by: David Lechner <david@pybricks.com>
For STM32L4, hardware I2C can be implemented by using TIMINGR.
This commit enables:
- Use of hardware I2C in machine.I2C.
- Specifying a frequency greater than or equal to 400KHz with pyb.I2C.
For STM32L4 series, the internal sensors are connected to:
- ADC1_IN0: Internal voltage reference
- ADC1_IN17: Temperature sensor
- ADC1_IN18: VBAT battery voltage monitoring
but ADC_CHANNEL_VREFINT, ADC_CHANNEL_VBAT, ADC_CHANNEL_TEMPSENSOR are not
defined as 0, 17, 18.
This commit converts channel 0, 17, 18 to ADC_CHANNEL_x in
adc_get_internal_channel().
Prior to this commit, the actual I2C frequency can be faster than specified
one and it may exceed the I2C's specification for Fast Mode. The frequency
of SCL should be less than or equal to 400KHz in Fast Mode.
This commit fixes this issue for F4 MCUs by rounding up the division in the
frequency calculation.
Excuting the code:
i2c = I2C(1, I2C.CONTROLLER, dma=True)
tmp = i2c.recv(1, i2c_addr)
recv_data = bytearray(56)
i2c.recv(recv_data, i2c_addr)
The second i2c.recv() fails with OSError: [Errno 110] ETIMEDOUT. When
receiving greater than or equal to 2 bytes at first i2c.recv(), the second
i2c.recv() succeeds. This issue does not occur without DMA.
Details of change: when executing I2C with DMA:
- Bit 11 of I2Cx_CR2 (DMA Request Enable) should be 1 to indicate that DMA
transfer is enabled. This bit is set after I2C event interrupt is
enabled in HAL_I2C_Master_Transmit_DMA()/HAL_I2C_Master_Receive_DMA(), so
DMA Request Enable bit might be 0 in IRQHandler.
- In case of data receive:
- When only 1 byte receiption, clear I2Cx_CR1's bit 10 (ACK).
- When only 2 byte receiption, clear I2Cx_CR1's bit 10 (ACK) and set
bit 11 (POS).
- When greater than or equal to 2 byte receiption, bit 12 of I2Cx_CR2
(DMA Last Transfer) should set to generate NACK when DMA transfer
completed.
Otherwise, the I2C bus may be busy after received data from peripheral.
Instead of defining `MICROPY_PY_BTREE` in `mpconfigport.h` we can define
it via CMake similar to how other ports that use Makefiles define it in
`mpconfigport.mk`.
Signed-off-by: David Lechner <david@pybricks.com>
This will make mpy-cross auto-detect. Allow overriding for non-default
configurations (e.g. using 32-bit build of the unix port).
Also use armv7m by default for qemu-arm (the default qemu target is
Cortex-M3).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
If `-march` isn't set then it means the user hasn't thought about it, or in
the case of freezing, MPY_CROSS_FLAGS isn't set. It's almost certainly
going to lead to problems, as there's no reason why the host architecture
is likely to be the right choice.
Compiling regular Python code is unaffected, but if `@native`/`@viper` is
used, the compiler will raise `SyntaxError: invalid arch`.
For situations where you explicitly want to use the host architecture (e.g.
for running tests on the unix port), added -march=host that keeps the old
behavior.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The RT1176 has two cores, but the actual firmware supports only the CM7.
There are currently no good plans on how to use the CM4.
The actual MIMXRT1170_EVK board is on par with the existing MIMXRT boards,
with the following extensions:
- Use 64 MB RAM for the heap.
- Support both LAN interfaces as LAN(0) and LAN(1), with LAN(1)
being the 1GB interface.
The dual LAN port interface can eventually be adapted as well for the
RT1062 MCU.
This work was done in collaboration with @alphaFred.
The zephyr CI takes the most time out of all CI jobs, so remove the
standard qemu_x86 build to speed it up. The remaining builds should still
cover enough cases to catch errors.
Signed-off-by: Damien George <damien@micropython.org>
Before this patch, WiFi connection was blocking, and could raise exceptions
if the connection failed for any reason (including timeouts). This doesn't
match the behavior of other WiFi modules, which connect asynchronously, and
requires handling of exceptions on connect. This change makes `connect()`
work asynchronously by scheduling code to poll connection status, and
handle reconnects (if needed), and return immediately without blocking.
This used to be used to generate .rst docs from inline comments in the C
code (specifically for APIs) but is now unused.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This can be tested using ports/minimal and qemu:
make CC=mips-linux-gnu-gcc-8
Then run with qemu-mips:
stty raw opost -echo;
QEMU_LD_PREFIX=/usr/mips-linux-gnu/ qemu-mips build/firmware.elf;
sleep 1; reset
Signed-off-by: Jan Willeke <willeke@smartmote.de>
Avoids the 'warning: Wildcards in project items are not supported'
message from the C++ project system in Visual Studio, while otherwise
remaining completely functional.
A board can now name the CDC ports, eg:
#define MICROPY_HW_USB_CDC_NUM (3)
#define MICROPY_HW_USB_INTERFACE_CDC0_STRING "REPL"
#define MICROPY_HW_USB_INTERFACE_CDC1_STRING "GDB Server"
#define MICROPY_HW_USB_INTERFACE_CDC2_STRING "UART Port"
Signed-off-by: Damien George <damien@micropython.org>
The PWM module now detects if the pin is open drain and if so switches it
to hardware open drain before starting the PWM.
The code that was explicitly turning off the open drain output during PWM
is also removed.
Together these changes allow driving external transistor high-current
switches with PWM.
Signed-off-by: Trammell hudson <hudson@trmm.net>
Changes in this commit:
- Change file system size from 128KB to 64KB in ra6m1_ek.ld.
- Change EK-RA6M1's file system size in renesas-ra port document.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
Changes in this commit:
- Add FLASH_FS region to linker script.
- Add flash storage start & end symbols to linker script.
- Use flash storage start & end symbols in flashbdev.c
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>