Arduino to ATSAM3X4EA-AU

Hi everyone,

What changes do I have to do in order to build and upload a code that was written for an Arduino DUE (ATSAM3X8EA-AU) to a ATSAM3X4EA-AU (the same one with half flash memory) ? As I understand it, the two chips are exactly the same, the only thing changing being the quantity of flash memory. What impact does it have on the build and upload processes considering I have created a board like the Arduino DUE but equiped with an ATSAM3X4EA-AU microcontroller ?

Thank you for your help and sorry if the question was already answered, I didn't find it.

It sounds like a weird decision to swap from Sam3x8e to an ersatz with less memory to creat a DUE like board ??

I guess the linker script will be different ...

Hi, thank you for your quick reply.

I'm quite forced to do it actually...

I want to know if the process will be time consuming. It would help a lot if someone could point out what I would have to change in the build and upload process.

Thank you for your help !

No one ? :slight_smile:

I'm not surprised. Due was relatively unpopular, and while there was occasional talk of moving onto smaller chips, I don't recall any interest in moving it to the same large chip with less memory.

At a guess, the main thing you'd need to change would be the linker script in
.../packages/arduino/hardware/sam/1.6.11/variants/arduino_due_x/linker_scripts/gcc/flash.ld
flash should be OK (if you don't overrun), but you probably have to update "ram" to make the two smaller SRAM regions map into a single contiguous chunk.

/* Memory Spaces Definitions */
MEMORY
{
    rom (rx)    : ORIGIN = 0x00080000, LENGTH = 0x00080000 /* Flash, 512K */
    sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00010000 /* sram0, 64K */
    sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 0x00008000 /* sram1, 32K */
    ram (rwx)   : ORIGIN = 0x20070000, LENGTH = 0x00018000 /* sram, 96K */
}

Would become something like

MEMORY
{
    rom (rx)    : ORIGIN = 0x00080000, LENGTH = 0x00040000 /* Flash, 256K */
    sram0 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 /* sram0, 32K */
    sram1 (rwx) : ORIGIN = 0x20080000, LENGTH = 0x00008000 /* sram1, 32K */
    ram (rwx)   : ORIGIN = 0x20078000, LENGTH = 0x00010000 /* sram, 64K */
}

I'm not quite sure how that would get included in the boards.txt file.

Hi all,

Thank you westfw for your time and your help. Unfortunately I won't have the opportunity to test it right now, but if I do I will post what kind of modifications were to be done.