Adding SPL framework to Nucleo F411RE

Hello,

I have a project written using SPL with Keil and I would like to export it to work with platformIO. I know that I have to create custom board. Using this example and F401RE file as a reference I tried to create that board. However I have no idea what to do with "extra_flags", "ldscript" and "variant". Any help would be appreciated.

Hi, your board .json file should be something like this:

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32F4 -DSTM32F411xE",
    "f_cpu": "100000000L",
    "ldscript": "stm32f411re_flash.ld",
    "mcu": "stm32f411re",
    "variant": "stm32f411xx"
  },
  "frameworks": [
    "spl"
  ],
  "name": "STM32F411-SPL",
  "upload": {
    "maximum_ram_size": 131072, 
    "maximum_size": 524288
    "protocol": "stlink"
  },
  "url": "https://developer.mbed.org/platforms/ST-Nucleo-F411RE/",
  "vendor": "ST"
}

The “stm32f411re_flash.ld” file, you can download from my dropbox:

This file should be added to .platformio/platforms/ststm32/ldscripts.

Hope it helps.

PD: English is not my mother tongue; please excuse any errors on my part.

ld file seems to be working, but I can’t get the board file right. Currently I use this and it compiles just fine:

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m4",
    "extra_flags": "-DSTM32F4 -DSTM32F401xE -DSTM32F40_41xxx", 
    "f_cpu": "100000000L",
    "ldscript": "stm32f411reSPL.ld", 
    "mcu": "stm32f411ret6",
    "variant": "stm32f411xe"
  }, 
  "frameworks": [
    "spl"
  ], 
  "name": "ST Nucleo F411RE SPL", 
  "upload": {
    "maximum_ram_size": 131072, 
    "maximum_size": 524288,
    "protocol": "stlink"
  }, 
  "url": "https://developer.mbed.org/platforms/ST-Nucleo-F411RE/", 
  "vendor": "ST"
}

If I change -DSTM32F401xE to -DSTM32F411xE, I get a some errors for redefinition. I compiles without -DSTM32F401xE.