Commit Graph

86 Commits

Author SHA1 Message Date
iabdalkader 9d5d2e8cf7 renesas-ra: Tune lwip buffers and timing to improve network performance.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-03 10:17:51 +11:00
iabdalkader 5c8099003c renesas-ra/boards/ARDUINO_PORTENTA_C33: Update WiFi config.
Changes are:
- Enable IRQ on WiFi data ready pin.
- Fix WiFi SPI clock (an exact 30MHz is not possible).
- Update WiFi pins.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-03 10:17:28 +11:00
iabdalkader da193c42f6 ports: Rename Arduino board LED pins to be consistent.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-10-02 11:57:46 +11:00
Jim Mussared cf32c2feb5 ports: Restrict board.json to standard features.
Applies to newly-added ARDUINO_PORTENTA_C33 and UM_NANOS3.

Makes the list match the standard features defined in
24a6e951ec.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-29 14:15:02 +10:00
iabdalkader 7802eed14b renesas-ra/boards/ARDUINO_PORTENTA_C33: Add support for Portenta C33.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-15 00:10:47 +10:00
iabdalkader abd9bed667 renesas-ra/fsp_cfg: Add common FSP config files.
Add DAC, SCE and USB FSP config files.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:51:30 +10:00
iabdalkader 31ff3ff3aa renesas-ra: Add mbedTLS support.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:51:20 +10:00
iabdalkader 62e650f2c2 renesas-ra: Add networking support using lwIP.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:51:18 +10:00
iabdalkader 142e8b70e2 renesas-ra: Add RNG driver.
It needs to be enabled explicitly by a board.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:50:47 +10:00
iabdalkader 5b774517dc renesas-ra: Add Bluetooth support using NimBLE.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:50:47 +10:00
iabdalkader d89a0606e0 renesas-ra: Add TinyUSB support.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:50:45 +10:00
iabdalkader 09a2ee8e7f renesas-ra/Makefile: Generate binary firmware output.
This patch generates a binary firmware image (*.bin) and removes the split
TEXT1/0_ADDR/SECTIONS because it's not configured for this port so it
generates broken binaries.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-09-14 23:34:18 +10:00
David Lechner ffb43b2dd3 py/modthread: Return thread id from start_new_thread().
In CPython, `_thread.start_new_thread()` returns an ID that is the same ID
that is returned by `_thread.get_ident()`.  The current MicroPython
implementation of `_thread.start_new_thread()` always returns `None`.

This modifies the required functions to return a value. The native thread
id is returned since this can be used for interop with other functions, for
example, `pthread_kill()` on *nix. `_thread.get_ident()` is also modified
to return the native thread id so that the values match and avoids the need
for a separate `native_id` attribute.

Fixes issue #12153.

Signed-off-by: David Lechner <david@pybricks.com>
2023-09-03 18:49:18 +10:00
Jim Mussared 1a99f74063 ports/*/boards/*/board.json: Remove "id" field.
This was used to override the firmware filename generated by the build
server (to match the historical name before board definitions existed).

Now we're making everything use the board definition name (i.e. the
directory name).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-08-23 13:54:37 +10:00
Angus Gratton 974f99482c renesas-ra/boards: Remove unreachable code in make-pins.py.
Looks like copy-paste from the stm32 make-pins.py, references a function
that is not present in the renesas-ra version.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-16 16:16:40 +10:00
Jim Mussared 24a6e951ec ports: Simplify board feature tags in board.json.
This commit:
- Finds a common set of board feature tags and maps existing features to
  that reduced set.
- Removes some less-useful board feature tags.
- Ensures all MCUs are specified correctly.
- Ensures all boards have a vendor (and fixes some vendor names).

This is to make the downloads page show a less intimidating set of filters.

Work done in conjunction with Matt Trentini <matt.trentini@gmail.com>.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-08-10 14:54:03 +10:00
Jim Mussared 975a687447 py/mpconfig: Add MICROPY_PY_PLATFORM, enabled at extra features level.
Previously this was explicitly enabled on esp32/stm32/renesas/mimxrt/samd,
but didn't get a default feature level because it wasn't in py/mpconfig.h.

With this commit it's now enabled at the "extra features" level, which adds
rp2, unix-standard, windows, esp8266, webassembly, and some nrf boards.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-24 23:53:20 +10:00
robert-hh 51c2d26f15 renesas-ra/machine_spi: Consistently use machine_pin_find to get pin.
Sometimes mp_hal_get_pin_obj() was used.  machine_pin_find() is the
internal name, and the external interface is mp_hal_get_pin_obj().

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-07-20 17:36:18 +10:00
Damien George 88771c1500 renesas-ra,stm32: Remove duplicate machine module from constants list.
In the u-module renaming done in 30628d1bb7,
these duplicate lines were accidentally left.

Signed-off-by: Damien George <damien@micropython.org>
2023-07-13 13:18:09 +10:00
mbedNoobNinja 761d86ae56 renesas-ra/boards/VK_RA6M5: Add new board definition.
Signed-off-by: mbedNoobNinja <novoltage@gmail.com>
2023-06-27 12:35:39 +10:00
mbedNoobNinja fae96b17a7 renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard.
This commit adds support for a new processor RA6M5.  It also adds the
following classes to the machine module: PWM, DAC, SDCard.

Signed-off-by: mbedNoobNinja <novoltage@gmail.com>
2023-06-27 12:30:25 +10:00
Takeo Takahashi 92c7532d8e renesas-ra: Support changing baudrate for UART.
* Use R_SCI_UART_BaudCalculate() of fsp/src/r_sci_uart/r_sci_uart.c
* Support UART.init(baudrate)

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-06-26 22:04:39 +10:00
Damien George c2ea8b2f98 renesas-ra: Consolidate all fsp_cfg header files to one location.
The config header files with the same name have the same contents, so they
don't need to be repeated for each board in the board's source directory.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-25 16:14:28 +10:00
Jim Mussared 2fbc08c462 extmod/asyncio: Rename uasyncio to asyncio.
The asyncio module now has much better CPython compatibility and
deserves to be just called "asyncio".

This will avoid people having to write `from uasyncio import asyncio`.

Renames all files, and updates port manifests to use the new path. Also
renames the built-in _uasyncio to _asyncio.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 17:33:03 +10:00
Damien George f01d5fb657 py/mkrules.mk: Automatically configure frozen options when manifest set.
Following how mkrules.cmake works.  This makes it easy for a port to enable
frozen code, by defining FROZEN_MANIFEST in its Makefile.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-08 23:12:56 +10:00
Jim Mussared a1fbb1980c extmod/modtimeq: Remove timeq module.
This is a MicroPython-specific module that existed to support the old
version of uasyncio.  It's undocumented and not enabled on all ports and
takes up code size unnecessarily.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:28 +10:00
Jim Mussared 2eba98f1e0 all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:21 +10:00
Jim Mussared 45ac651d1a all: Rename *umodule*.c to remove the "u" prefix.
Updates any includes, and references from Makefiles/CMake.

This essentially reverts what was done long ago in commit
136b5cbd76

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:17 +10:00
Jim Mussared f5f9edf645 all: Rename UMODULE to MODULE in preprocessor/Makefile vars.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:11 +10:00
Jim Mussared 7f5d5c7271 all: Rename mod_umodule*, ^umodule* to remove the "u" prefix.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:07 +10:00
Jim Mussared 1bf2dcb15e all: Rename mp_umodule*, mp_module_umodule* to remove the "u" prefix.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:04 +10:00
Jim Mussared 30628d1bb7 all: Rename MP_QSTR_umodule to MP_QSTR_module everywhere.
This renames the builtin-modules, such that help('modules') and printing
the module object will show "module" rather than "umodule".

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:53:57 +10:00
Jim Mussared 1d4b4f0ce2 ports: Standardise docs link in help text.
Updates all `help()` output to use the phrase:
`For online docs please visit http://docs.micropython.org/`

Some ports previously used different wording, some pointed to the wrong
link.  Also make all ports use `help.c` for consistency.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-02 11:48:46 +10:00
Takeo Takahashi 1f60841123 renesas-ra/boards/make-pins.py: Fix PA/PB pins support.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-06-01 13:00:24 +10:00
robert-hh 1c53bda27f ports: Remove os.sync() implementation from stm32 and renesas-ra.
Now that this code was moved to extmod/moduos.c.

Signed-off-by: robert-hh <robert@hammelrath.com>
2023-06-01 11:39:01 +10:00
Damien George 324d01eb52 renesas-ra: Consolidate hal_entry.c code and remove hal_entry() func.
The hal_entry.c code is duplicated across all boards, so consolidate it to
a common ra_hal.c file.  And remove the hal_entry() function because it
simply calls main().

Signed-off-by: Damien George <damien@micropython.org>
2023-05-24 11:44:17 +10:00
iabdalkader 70b60fe24e renesas-ra/irq: Fix typo in comment about IRQ priorities.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2023-05-19 22:23:10 +10:00
Takeo Takahashi 3229791b60 renesas-ra: Add a macro definition to avoid compile error of FSP v4.4.0.
FSP v4.4.0 refers to CMSIS V5.4.1, and __COMPILER_BARRIER() is used in bsp.
On the other hand, lib/cmsis is V5.1.0 and the macro is not defined.
Therefore, compile error happens.
As the workaround, the macro definition is added.
If lib/cmsis is updated in the future, this addition can be removed.

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11 16:18:39 +10:00
Takeo Takahashi b4834e5cba renesas-ra: Update boards and ra directory files to support FSP v4.4.0.
* Update boards and ra files
* Remove unreferenced files, board_init.c and board_leds.c, from Makefile
* Remove unreferenced FSP instances from ra_gen/*.[ch]
* Remove unreferenced FSP config files ra_cfg/*.h
* e2 studio generates FSP instances but renesas-ra uses only followings:
  lpm, flash, ioport

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-05-11 16:18:39 +10:00
Damien George 322c53bbc9 renesas-ra/modutime: Use extmod version of time module.
No API or functional change.

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 15:11:51 +10:00
Damien George 9955553001 extmod/modutime: Provide a generic time module.
Based on extmod/utime_mphal.c, with:
- a globals dict added
- time.localtime wrapper added
- time.time wrapper added
- time.time_ns function added

New configuration options are added for this module:
- MICROPY_PY_UTIME (enabled at basic features level)
- MICROPY_PY_UTIME_GMTIME_LOCALTIME_MKTIME
- MICROPY_PY_UTIME_TIME_TIME_NS

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 15:09:56 +10:00
Damien George 083dc1f082 ports: Use extmod version of mktime instead of port-specific one.
Apart from slight differences in the error message, the functionality of
all ports is unchanged.

Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 14:55:07 +10:00
Takeo Takahashi dc7de6ed83 renesas-ra: Change MICROPY_HW_BOARD_NAME definition to product name.
Changes in this commit:
- Change MICROPY_HW_BOARD_NAME definition to match the product name.
- Rename board folder's name to match the product name style.
- Change related files like Makefile, document descriptions, test cases, CI
  and tools.

Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2023-04-27 14:12:53 +10:00
David Grayson c046b23ea2 shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code.
Helps prevent the filesystem from getting formatted by mistake, among other
things.  For example, on a Pico board, entering Ctrl+D and Ctrl+C fast many
times will eventually wipe the filesystem (without warning or notice).

Further rationale: Ctrl+C is used a lot by automation scripts (eg mpremote)
and UI's (eg Mu, Thonny) to get the board into a known state.  If the board
is not responding for a short time then it's not possible to know if it's
just a slow start up (eg in _boot.py), or an infinite loop in the main
application.  The former should not be interrupted, but the latter should.
The only way to distinguish these two cases would be to wait "long enough",
and if there's nothing on the serial after "long enough" then assume it's
running the application and Ctrl+C should break out of it.  But defining
"long enough" is impossible for all the different boards and their possible
behaviour.  The solution in this commit is to make it so that frozen
start-up code cannot be interrupted by Ctrl+C.  That code then effectively
acts like normal C start-up code, which also cannot be interrupted.

Note: on the stm32 port this was never seen as an issue because all
start-up code is in C.  But now other ports start to put more things in
_boot.py and so this problem crops up.

Signed-off-by: David Grayson <davidegrayson@gmail.com>
2023-04-05 10:38:50 +10:00
Damien George b3c8ab37ec py/gc: Make gc_dump_info/gc_dump_alloc_table take a printer as argument.
So that callers can redirect the output if needed.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-10 10:58:10 +11:00
Jim Mussared 69b93527d5 ports: Make BOARD default from BOARD_DIR in Makefile's.
This allows:

    $ make BOARD_DIR=path/to/board

to infer BOARD=board, rather than the previous behavior that required
additionally setting BOARD explicitly.

Also makes the same change for VARIANT_DIR -> VARIANT on Unix.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2023-02-23 09:47:08 +11:00
robert-hh de1f1dd164 shared/runtime/softtimer: Use consistently the same clock source.
Before, both uwTick and mp_hal_ticks_ms() were used as clock source.  That
assumes, that these two are synchronous and start with the same value,
which may be not the case for all ports.  If the lag between uwTick and
mp_hal_ticks_ms() is larger than the timer interval, the timer would either
rush up until the times are synchronous, or not start until uwTick wraps
over.

As suggested by @dpgeorge, MICROPY_SOFT_TIMER_TICKS_MS is now used in
softtimer.c, which has to be defined in a port's mpconfigport.h with
the variable that holds the SysTick counter.

Note that it's not possible to switch everything in softtimer.c to use
mp_hal_ticks_ms() because the logic in SysTick_Handler that schedules
soft_timer_handler() uses (eg on mimxrt) the uwTick variable directly
(named systick_ms there), and mp_hal_ticks_ms() uses a different source
timer.  Thus it is made fully configurable.
2023-02-16 12:59:48 +11:00
David Lechner 3446d440f6 shared/runtime/gchelper: Drop cpu directive from ARM asm helpers.
This drops the `.cpu` directive from the ARM gchelper_*.s files.  Having
this directive breaks the linker when targeting older CPUs (e.g. `-mthumb
-mthumb-interwork` for `-mcpu=arm7tdmi`).  The actual target CPU should be
determined by the compiler options.

The exact CPU doesn't actually matter, but rather the supported assembly
instruction set.  So the files are renamed to *_thumb1.s and *thumb2.s to
indicate the instruction set support instead of the CPU support.

Signed-off-by: David Lechner <david@pybricks.com>
2023-01-28 15:51:38 +11:00
robert-hh 988b6e2dae renesas-ra: Add the UART methods uart.txdone() and uart.flush().
This required to add two functions down the stack to uart.c and ra.sci.c.

- One for telling, whther the transmission is busy.
- One for reporting the size of the TX buffer.

Tested with a EK-RA6M2 board.
2022-12-15 12:09:34 +01:00
Takeo Takahashi 5228f4067d renesas-ra: Change file system size to 64KB for RA6M1.
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>
2022-11-15 10:01:36 +11:00