Sparkfun SAMD21G18 target

Hi

I just managed to get my Adafruit Feather M0 Basic Proto blinking with mbed OS.
With the first attempts I had the same issue that my board was unresponsive after the upload.

To actually make it blink I had to change the linker script (yotta_targets/atmel-samd21g18a-gcc/ld/samd21g18a.ld) that comes with the atmel-samd21g18a-gcc target since the bootloader on the Adafruit Feather M0 and probably also on your Sparkfun SAMD mini board also needs some space.

So I change Memory Spaces Definitions in the linker script from

/* Memory Spaces Definitions */
MEMORY
{
  rom (rx)  : ORIGIN = 0x000000000, LENGTH = 0x00040000
  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

to

/* Memory Spaces Definitions */
MEMORY
{
  rom (rx)  : ORIGIN = 0x000000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

And the board happily blinks :grinning: with this code

#include "mbed-drivers/mbed.h"

static void blinky(void) {
    static DigitalOut led(PA17);
    led = !led;
    //printf("LED = %d \r\n",led.read());
}

void app_start(int, char**) {
    minar::Scheduler::postCallback(blinky).period(minar::milliseconds(250));
}

I took the Memory Spaces Definitions from the Arduino Linker Script

It now works locally with a patched atmel-samd21g18a-gcc target.

2 Likes