Add Renesas RA support - #579
Conversation
|
Done! I also ordered a board to start testing with in the next few weeks |
added Renesas RA targets: FPB-RA4E1, FPB-RA6E2 and FPB-RA8E1
remove r_usb_basic.c from CMakeLists fix repeated creation of semaphores in spi_api.c fix compliation erros in serial_api.c when console-uart is not used remove dave2d files for now
add missing license headers
allow FPB-RA8E1 to retain RTC clock after reset
|
Also sent you this on the discord, if you didn't see it: |
|
Also I am still working on part 2 of the RTT MR which adds support for CPU caches. Do any of the targets being added have a data cache? (e.g. the |
FPB-RA8E1. All RA8 MCUs are based on the Cortex-M85 core and have a data cache of 16KB. |
| #ifndef TARGET_MCU_RA | ||
| __libc_init_array(); | ||
| #else | ||
| // workaround: __libc_init_array() crashes on Renesas RA MCUs |
There was a problem hiding this comment.
Do we know why it's crashing?
There was a problem hiding this comment.
The exact reason is unknown yet. But RASC generated code uses __init_array_start/__init_array_end instead of __libc_init_array. The difference between the two is that __libc_init_array also calls __preinit_array_start/__preinit_array_end and _init(), before calling __init_array_start/__init_array_end.
|
|
||
| MEMORY | ||
| { | ||
| RAM (rwx) : ORIGIN = RAM_START, LENGTH = RAM_LENGTH |
There was a problem hiding this comment.
Linker scripts should use the Mbed-provided memory bank definitions. Example: https://github.com/mbed-ce/mbed-os/pull/582/changes#diff-4d129ac0d0f7a20e71afa0af70d319ae43c4165895368e2e56eeeb4004c89c2fR52
There was a problem hiding this comment.
OK, but Mbed does not provide memory bank definition for the DataFlash (no MBED_CONFIGURED_ROM_BANK_DataFlash_START/MBED_CONFIGURED_ROM_BANK_DataFlash_SIZE).
|
You should add your new targets here: https://github.com/mbed-ce/mbed-os/blob/main/.github/workflows/greentea_cmake.yml#L103 |
* Start adding RTT support for MCUs with CPU cache. Working on STM32H747 and MIMXRT106x * Improve MIMRT105x configs, add ncache for MIMXRT1170 * Update ARMv8m MPU code too * Oops, accidental change * Fix build error, fix missing linker script entries * More linker script updates
|
Also @wdx04 I sent you an invite to the Mbed CE organization! You should be able to accept it here https://github.com/mbed-ce |
* Updated ESP32 driver documentation Added tested working ESP32 modules and their firmware versions, also added note to increase buffer size under some scenarios. * Enhance CHANGELOG with recent updates and fixes Updated changelog with improvements and fixes for ESP32 Wi-Fi driver
* Updated ESP32 driver documentation Added tested working ESP32 modules and their firmware versions, also added note to increase buffer size under some scenarios. * Enhance CHANGELOG with recent updates and fixes Updated changelog with improvements and fixes for ESP32 Wi-Fi driver * Updated command to get RSSI RSSI is now only queried from ESP32 if it is connected to an AP. Old way to get SSID and BSSID first then use AT+CWLAP to get RSSI is superfluous and no longer works anyway per the latest ESP AT firmware.
Updated code to retrieve RSSI from ESP32 module per the latest firmware
added Renesas RA targets: FPB-RA4E1, FPB-RA6E2 and FPB-RA8E1
remove r_usb_basic.c from CMakeLists fix repeated creation of semaphores in spi_api.c fix compliation erros in serial_api.c when console-uart is not used remove dave2d files for now
add missing license headers
allow FPB-RA8E1 to retain RTC clock after reset
added Greentea targets added 'noncached' section in RA8E1.ld
…o add-renesas-ra # Conflicts: # targets/TARGET_RENESAS/TARGET_RA/ra/fsp/src/bsp/mcu/ra4e1/RA4E1.ld # targets/TARGET_RENESAS/TARGET_RA/ra/fsp/src/bsp/mcu/ra6e2/RA6E2.ld # targets/TARGET_RENESAS/TARGET_RA/ra/fsp/src/bsp/mcu/ra8e1/RA8E1.ld
|
Tried to compile the CI shield test project and got some linker errors. Looks like there are some HAL functions that are missing implementations |
Yes, there are some missing symbols in the code. I ran the test on the FPB-RA8E1 and am working on fixing the issues I found. |
|
Any idea what could be going on here? |
14 tests are still failing: Watchdog 49 - test-mbed-hal-watchdog-timing (Only 'timeout accuracy' test failed) FlashIAP 6 - test-mbed-drivers-flashiap (Failed) 29 - test-mbed-hal-flash-functional-tests (Failed) Tickers 25 - test-mbed-hal-common-tickers (Failed) RTC 36 - test-mbed-hal-rtc (Failed) 37 - test-mbed-hal-rtc-reset (Failed) 38 - test-mbed-hal-rtc-time (Failed) Storage 91 - test-mbed-storage-blockdevice-general_block_device (Failed) 96 - test-mbed-storage-kvstore-general_tests_phase_1 (Failed) 97 - test-mbed-storage-kvstore-general_tests_phase_2 (Failed) 98 - test-mbed-storage-kvstore-static_tests (Failed) 99 - test-mbed-storage-kvstore-filesystemstore (Failed) 100 - test-mbed-storage-kvstore-direct-access-devicekey (Failed) Others 119 - test-mbed-device_key-functionality (Failed)
|
Huh, tried that, no dice. Still get illegal instruction on that line. |
That's really weird. Anyway, MOV.W is obviously not an illegal instruction. Also, please try temporarily modifying these two pieces of code:: #define BSP_CFG_PLODIVP (BSP_CLOCKS_PLL_DIV_4) /* PLL1P Div /4 */
#define BSP_CFG_PLL1P_FREQUENCY_HZ (180000000) /* PLL1P 180000000Hz */
#define BSP_CFG_PLODIVQ (BSP_CLOCKS_PLL_DIV_4) /* PLL1Q Div /4 */
#define BSP_CFG_PLL1Q_FREQUENCY_HZ (180000000) /* PLL1Q 180000000Hz */
#define BSP_CFG_PLODIVR (BSP_CLOCKS_PLL_DIV_4) /* PLL1R Div /4 */
#define BSP_CFG_PLL1R_FREQUENCY_HZ (180000000) /* PLL1R 180000000Hz */2.Comment out the 'noncached' region in the MPU settings(mbed_mpu_v8m.c). It seems the Cortex-v8m MPU doesn't allow overlapping regions. |
|
OK, making some progress here! Changing those lines in the clock config file allows it to run stably. I still do not get working communications on the J-Link VCOM UART and can't run greentea tests (is that expected to work out of the box? Do I need to make any mods to the dev kit?), but the code does run without crashing. This sort of makes sense, it reminds me of what happens on MIMXRT when something is messed up with the XIP flash chip. The core reads an instruction wrong and just goes bananas. Regarding the MPU settings, this is fixed in main branch (caught that issue on RP2350). However, I tried rebasing your branch on main, and I... can't. Something is really messed up with the git history, it looks like somehow you merged together two of your own branches plus some commits from main. Couldn't even use my old standby of squashing and merging. I ended up using this trick to make a squashed branch and then rebase it on main: https://github.com/mbed-ce/mbed-os/tree/add-renesas-ra-squashed Also, we need to face the fact that this branch has a huge diff. I am thinking that we need to split this up into many different PRs. At minimum, the first PR would add all of the SDK files that don't need detailed review, then the second PR would add all the code needed to run to main(). If you don't have time for this that's OK, I can work on it, it will make the review way easier. |
You may need to upgrade the J-Link firmware and enable Virtual COM Port in J-Link Configurator.
OK, but before that, I want to fix most of the Greentea test failures first. |
changed OUTPUT_EXT to hex
|
@multiplemonomials By including the option settings in the linker script, you should be able to run apps at 360MHz on FPB-RA8E1. It looks like the factory default option settings can't support the CPU clock at 360MHz. |
|
All right! With your latest commit, and no clock changes, I can run greentea tests now! Nice find! |
remaining failed tests: 25 - test-mbed-hal-common-tickers (Failed) 49 - test-mbed-hal-watchdog-timing (Failed)
|
Hi! I believe I have found and fixed an issue in the serial code. I was trying to run CI shield tests, but noticed that about half the tests were failing to start due to, apparently, UART not working. I did some further debugging and noticed:
After some debugging, I narrowed it down to this code: void serial_baud(serial_t *obj, int baudrate)
{
MBED_ASSERT(obj);
baud_setting_t setting;
fsp_err_t err = R_SCI_UART_BaudCalculate(baudrate, true, 500, &setting);
if (err == FSP_SUCCESS) {
obj->p_api->baudSet(obj->p_ctrl, &setting);
}
}The problem is that R_SCI_UART_BaudCalculate does not fully overwrite The fix appears to be to change it to work like in void serial_baud(serial_t *obj, int baudrate)
{
MBED_ASSERT(obj);
fsp_err_t err = R_SCI_UART_BaudCalculate(baudrate, true, 500, obj->ext.p_baud_setting);
if (err == FSP_SUCCESS) {
obj->p_api->baudSet(obj->p_ctrl, obj->ext.p_baud_setting);
}
}This way, it is not subject to this issue and it retains any other bits that were set during the init process. |
|
OK, now I was able to get a good run with the FPB-RA8E1 and the CI shield.
Produced the following test results: ctest.log Looks like SPI has a few failures, including some with 16-bit words. I2C also has a few failures -- maybe you need to define the I2C capabilities structure to indicate if there are limitations of the hardware (e.g. no zero length transactions). The test suite will obey the capabilities. The InterruptIn test is failing due to a pinmap issue -- looks like P1_13 does not support InterruptIn which is annoying -- might need to tweak the test setup to work around this. Test cases are here for reference: https://github.com/mbed-ce/mbed-ce-test-tools/tree/master/CI-Shield-Tests |




This PR adds three Renesas RA targets: FPB-RA4E1, FPB-RA6E2 and FPB-RA8E1
Summary of changes
Added basic support for Cortex-M85 MCUs
Added support for Renesas FPB-RA4E1, FPB-RA6E2 and FPB-RA8E1 targets.
Impact of changes
FPB-RA4E1, FPB-RA6E2 and FPB-RA8E1 are supported by Mbed CE.
Migration actions required
Documentation
The following Mbed components/drivers are implemented for the supported Renesas RA targets:
Some notes on the port:
Pull request type
Test results
Greentea tests are not run yet, to be updated