circuitpython/ports/renesas-ra
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
..
boards ports/*/boards/*/board.json: Remove "id" field. 2023-08-23 13:54:37 +10:00
fsp_cfg renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
ra renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
boardctrl.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
boardctrl.h renesas-ra/modmachine: Allow boards to provide custom bootloader code. 2022-06-17 13:38:55 +10:00
build_all_boards.sh renesas-ra: Change MICROPY_HW_BOARD_NAME definition to product name. 2023-04-27 14:12:53 +10:00
extint.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
extint.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
factoryreset.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
factoryreset.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
fatfs_port.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
flash.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
flash.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
flashbdev.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
gccollect.c renesas-ra/softtimer: Switch to use softtimer code from shared/runtime. 2022-07-19 13:46:28 +10:00
gccollect.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
help.c ports: Standardise docs link in help text. 2023-06-02 11:48:46 +10:00
irq.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
irq.h renesas-ra/irq: Fix typo in comment about IRQ priorities. 2023-05-19 22:23:10 +10:00
led.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
led.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
machine_adc.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
machine_dac.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
machine_i2c.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
machine_pin.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
machine_pwm.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
machine_rtc.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
machine_sdcard.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
machine_spi.c renesas-ra/machine_spi: Consistently use machine_pin_find to get pin. 2023-07-20 17:36:18 +10:00
machine_uart.c renesas-ra: Add the UART methods uart.txdone() and uart.flush(). 2022-12-15 12:09:34 +01:00
main.c renesas-ra: Consolidate hal_entry.c code and remove hal_entry() func. 2023-05-24 11:44:17 +10:00
Makefile renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
modmachine.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
modmachine.h renesas-ra: Rename machine SPI type consistently across ports. 2022-10-22 12:57:58 +11:00
modos.c all: Rename *umodule*.c to remove the "u" prefix. 2023-06-08 17:54:17 +10:00
modtime.c all: Rename *umodule*.c to remove the "u" prefix. 2023-06-08 17:54:17 +10:00
mpconfigboard_common.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
mpconfigport.h py/mpconfig: Add MICROPY_PY_PLATFORM, enabled at extra features level. 2023-07-24 23:53:20 +10:00
mpconfigport.mk renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
mphalport.c all: Rename mp_umodule*, mp_module_umodule* to remove the "u" prefix. 2023-06-08 17:54:04 +10:00
mphalport.h renesas-ra/machine_pin: Support drive keyword and fix GPIO setting. 2022-08-31 11:59:49 +10:00
mpthreadport.c py/modthread: Return thread id from start_new_thread(). 2023-09-03 18:49:18 +10:00
mpthreadport.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
pendsv.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
pendsv.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
pin.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
powerctrl.c renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
powerctrl.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
powerctrlboot.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
pybthread.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
pybthread.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
qstrdefsport.h all: Rename mod_umodule*, ^umodule* to remove the "u" prefix. 2023-06-08 17:54:07 +10:00
RA4M1_hal.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
RA4W1_hal.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
RA6M1_hal.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
RA6M2_hal.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
RA6M5_hal.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
ra_hal.c renesas-ra: Consolidate hal_entry.c code and remove hal_entry() func. 2023-05-24 11:44:17 +10:00
ra_it.c renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
ra_it.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
README.md renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
rtc.h renesas-ra: Rename pyb_rtc_ to machine_rtc_. 2022-05-04 19:45:16 +09:00
spi.h renesas-ra: Add support for RA6M5, and add machine PWM, DAC, SDCard. 2023-06-27 12:30:25 +10:00
storage.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
storage.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
systick.c renesas-ra/softtimer: Switch to use softtimer code from shared/runtime. 2022-07-19 13:46:28 +10:00
systick.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
timer.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
timer.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00
uart.c renesas-ra: Add the UART methods uart.txdone() and uart.flush(). 2022-12-15 12:09:34 +01:00
uart.h renesas-ra: Add the UART methods uart.txdone() and uart.flush(). 2022-12-15 12:09:34 +01:00
usrsw.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
usrsw.h renesas-ra: Add new port to Renesas RA. 2022-04-29 12:29:06 +09:00

The Renesas RA port

This is a port of MicroPython to the Renesas RA family of microcontrollers. Currently supported features are:

  • Filesystem on the internal flash using FatFs.
  • time module with sleep, time, and ticks functions.
  • os module with VFS support.
  • machine module with the following classes: Pin, ADC, PWM, DAC, I2C, SPI, SoftI2C, SoftSPI, UART, RTC, SDCard.
  • sdcard module for MCUs without native machine.SDCard support.

Currently supported board product names are:

  • EK-RA6M2
  • RA4M1 CLICKER
  • EK-RA6M1
  • EK-RA4M1
  • EK-RA4W1

Please refer to the quick reference of renesas-ra port for more information about the boards.

Build instructions

  • MicroPython cross-compier The MicroPython cross-compiler must be built first, which will be used to pre-compile (freeze) built-in Python code. THis cross-compiler is built and run on the host machine, using:

    $ make -C mpy-cross
    

    This command should be executed from the root directory of this repository. All other commands below should be executed from the ports/renesas-ra/ directory.

  • Arm compiler An Arm compiler is required for the build, along with the associated binary utilities. The default compiler is arm-none-eabi-gcc, which is available for Linux, Mac and Windows hosts via https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads. The compiler can be changed using the CROSS_COMPILE variable when invoking make.

  • Obtain submodules First the submodules must be obtained using:

    $ make submodules
    
  • Build binary image .hex Then to build for a given board subdirectory name, run:

    $ make BOARD=EK_RA6M2 clean
    $ make BOARD=EK_RA6M2
    

    The default board subdirectory name is EK_RA6M2 (which is for EK-RA6M2 board) but any of the names of the subdirectories in the boards/ directory can be passed as the argument to BOARD=; for example RA4M1_CLICKER, EK_RA4M1, EK_RA4W1 and EK_RA6M1. The above command should produce binary images firmware.hex in the build-EK_RA6M2/` subdirectory (or the equivalent directory for the board specified).

Supported/Unsupprted funtions

Please refer to the renesas-ra quick reference.

Known issues

all boards

  • machine.lightsleep(time_ms) and machine.deepsleep(time_ms) raise uncaught exceptions.

    machine.deepsleep(1000) Uncaught exception in ExtInt interrupt handler line 16 TypeError:

RA4M1-CLICKER

  • mpremote: mount command is not available due to limited memory resources.

EK-RA4M1

  • mpremote: mount command is not available due to limited memory resources.

EK-RA4W1

  • mpremote: "Execution: timeout waiting for remote" error happens when importing a file on /remote.