Is there a way for an Arduino to flash another one without a computer?

I am going to create a game console. The games will be in an SD card and an Arduino (or an Atmega chip) will read a hex file's contents to RAM and will flash it to another one. Something like Arduino sketch that can program other boards - YouTube but here, the guy says that this only works for atmega328, and I am planning to use a ATSAM3X8E chip and also I am worried about the power levels (5v - 3v3).

Is there any way for me to use an Atmega chip like Atmega16u2 and use that to flash something like an ATSAM3X8E? If so, what protocol should I use and how may I implement it in my code?

The short answer is "Yes."

Perehama:
The short answer is "Yes."

Is there a longer one?

The ATSAM3X8E data sheet would be a must read for this. So you might as well start there.

kahve:
Is there a longer one?

No one is going to do all the work for you. If you want a left-handed whojimawhatsit, you have to forge the path alone. The forum can help along the way. Did you read the link I sent? Did you read the applications notes from Atmel or Microchip? What is your experience with programming ARM? Have you completed the blink sketch and other basic tutorials sketches? What have you done to answer your own question?

Perehama:
No one is going to do all the work for you. If you want a left-handed whojimawhatsit, you have to forge the path alone. The forum can help along the way. Did you read the link I sent? Did you read the applications notes from Atmel or Microchip? What is your experience with programming ARM? Have you completed the blink sketch and other basic tutorials sketches? What have you done to answer your own question?

I am not expecting one to do all the work for me. I am just looking for someone who can point me to the right way of doing this. I am not dumb, I have created many arduino projects before I even thought of that idea. I looked it up in Google and found that link that I gave in the first post. And yes, I have read that link you sent.

The processor on the Due, like the ones on most/all Arduinos, has a firmware bootloader. To program a new application into the FLASH, you need to "talk" to that bootloader, using it's unique protocol. You will need to find a specification for that protocol, and write code to implement the protocol on the Uno or whatever device will be actually providing the new application code. You will then be able to program whatever you want into the chip.

This will NOT be a trivial undertaking, and will require reading, studying, coding, and debugging...

Regards,
Ray L.

for SAMD21 there is a bunch of libraries to load the binary from different sources

but for Due nothing.

kahve:
I am not expecting one to do all the work for me. I am just looking for someone who can point me to the right way of doing this.

I thought I did. Any MCU has to be programmed somehow for the first time. For that reason, the hardware bootloader and methods for using it are always covered in the data sheet. Sometimes sample code is even provided. I’m not just preaching - the data sheet is the first thing you should look at.

kahve:
I am just looking for someone who can point me to the right way of doing this.

While the link I gave you is for a product, there are technical details, including some source code to start with. Of course, it's all for the AVR, but you can possibly port it, or at least follow it as a template for your own ARM code.

Perehama:
While the link I gave you is for a product, there are technical details, including some source code to start with. Of course, it's all for the AVR, but you can possibly port it, or at least follow it as a template for your own ARM code.

sorry, no. it is a different world.

Perehama:
While the link I gave you is for a product, there are technical details, including some source code to start with. Of course, it's all for the AVR, but you can possibly port it, or at least follow it as a template for your own ARM code.

The code required for a Due is COMPLETELY different from that for an AVR. They use completely different programming protocols.

Regards,
Ray L.

for SAMD21 there is a bunch of libraries to load the binary from different sources
ArduinoCore-samd/libraries at master · arduino/ArduinoCore-samd · GitHub
but for Due nothing.

The Due actually uses the same bootloading protocol ("SAM-BA") as the SAMD21. It's a mostly-standard Atmel standard thing that is loaded into the SAMD21 boards, but is present in ROM on the SAM3X chips (The Arduino adds some additional bits to allow auto-reset.)
For SAM3X, SAM-BA is described in Section 20 of The Datasheet

It looks like it uses the XMODEM protocol for the actual data transfer protocol, and there should be LOTS of examples for that in various places...

Unfortunately, I don't think any of the libraries mentioned above are for updating the Core processor sketch code - they seem to be mostly for updating the code in "extra" chips, like the WiFi/BLE modules...

westfw:
Unfortunately, I don't think any of the libraries mentioned above are for updating the Core processor sketch code - they seem to be mostly for updating the code in "extra" chips, like the WiFi/BLE modules...

this libraries? SDU, SFU, ...?
SDU updates from SD card,
SFU from external flash on MKR MEM shield.
both can be used in combination with ArduinoOTA (WiFi101OTA) library for SAMD21. (but the best option in the library is update over upper half of the internal flash)

SNU loads the binary from flash of attached NINA esp32. (planed for OTA update)
etc

kahve:
...also I am worried about the power levels (5v - 3v3)...

ATmega processor will quite happily run over a wide range of voltages. There are voltage steps at which the processor's clock will have to be lowered to be reliable.