Hello,
Hi, I'm closing a project based on Arduino R4 Minima (RA4m1), written with the Arduino IDE. How can I easily read/copy protect my code?Thanks. Giorgio
The RA4M1 device has an ID code protection function so that the MCU can determine whether to permit the connection to the programmer/on-chip debugger. Only if the correct ID code is given to the device will the connection be allowed.
However I am not sure how and if Arduino IDE can support this function . Do you even use an on-chip debugger via the SWD connector or just the USB connector to program the device ?
Thanks for the very quick response. I use the USB port
I talked with Arduino dev team about this. ID code is not directly supported from Arduino environment.
You would need to use e2studio/RFP to program the device so that an ID code is enabled to RA4M1.
If not, an unwanted read operation of code flash is still possible by someone who knows how to do it.
Regards
In the meantime, thank you for your interest. So I have to use E2Studio, which I know very little about. Then the programming takes place via USB or do I have to use an external programmer? If so, can you recommend one? This might work? https://www.az-delivery.de/it/products/st-link-v2-mini-simulator-download-programmer-stm8-6-stm32And then some tips on how to pass the program from the Arduino IDE to E2Studio, and finally how to program the microcontroller with E2Studio.
Thanks again
To start with I have no previous experience of setting up an ID code on Arduino board but what you would need to do is create a new e2studio project that will program an ID code on the device.
You can see more information on ID code at:
https://en-support.renesas.com/knowledgeBase/20980154
and section 6.2.6 of RA4M1 UM:
https://www.renesas.com/us/en/document/mah/renesas-ra4m1-group-users-manual-hardware?r=1054146
After you create the program file that can enable ID protection on the device, you would need to find a way to program it on RA4M1. This is normally done via e2studio or Renesas Flash Programmer using a J-Link debugger or E2/E2 Lite emulator which would be connected on the 10-pin SWD connector of Arduino board.
To avoid using a J-Link debugger or emulator you can use Renesas Flash Programmer to program the program file on the device in boot mode via serial programming. For this operation you would need to control the MD pin (which is exposed on Arduino board) by setting it low at the moment of reset. This will put the device into boot mode but you still need an interface to talk to the device. This interface can be SCI9 or USB:
So a UART-to-USB converter connected to SCI9 pins with your PC would be able to program the device in boot mode. And of course while doing this the device should be powered up properly.
Now to avoid having to migrate your Arduino code to FSP you can select on Renesas Flash Programmer to program only the area where the ID code is programmed (config area).
The process is a long shot but I think it is feasible.
Hi,
What would you recommend for a read out protection of the flash on a RA6M5 ?
RA6M5 does not support the ID code protection. To restrict the connection of debugger or serial programmer you can change the Device Lifecycle Management state of the device:
For further information please create a new post as we try to keep one issue per post.
At first glance it doesn't seem very simple, but I'll try. Thank you very much