PlatformIO Community

STM32F100RET support

Hi
I am wondering if anyone can guide me in the right direction. I have a custom board fitted with a STM32F100RET6 chip. I really want to use VS Code, PlatformIO and Arduino as the development setup, however I am unable to get it up and running.
I have tried using the STM32VL Discovery board as a jumping off point as this is using the STM32F100RB, however no luck via VS Code.
This puzzles me a bit as code generated for the F100RB should run on F100RE, and this is also the case if I use STM32CubeIDE - however when doing it from VS Code this does not work.

Anyone that can assist in getting a generic board working for STM32F100RET?

Yeah, just create a new folder called boards in your project and put the file genericSTM32F100RE.json there with the contents:

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m3",
    "extra_flags": "-DSTM32F100xE",
    "f_cpu": "24000000L",
    "mcu": "stm32f100ret6"
  },
  "connectivity": [
  ],
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "jlink_device": "STM32F100RE",
    "onboard_tools": [
      "stlink"
    ],
    "openocd_target": "stm32f1x",
    "svd_path": "STM32F10x.svd"
  },
  "frameworks": [
    "stm32cube"
  ],
  "name": "Generic STM32F100RE",
  "upload": {
    "maximum_ram_size": 32768,
    "maximum_size": 524288,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "stlink",
      "blackmagic",
      "mbed"
    ]
  },
  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f100re.html",
  "vendor": "ST"
}

then give it some simple src\main.c

#include "stm32f1xx_hal.h"

#define LED_PIN                                GPIO_PIN_5
#define LED_GPIO_PORT                          GPIOA
#define LED_GPIO_CLK_ENABLE()                  __HAL_RCC_GPIOA_CLK_ENABLE()

int main(void)
{
  HAL_Init();

  LED_GPIO_CLK_ENABLE();

  GPIO_InitTypeDef GPIO_InitStruct;

  GPIO_InitStruct.Pin = LED_PIN;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
  HAL_GPIO_Init(LED_GPIO_PORT, &GPIO_InitStruct);

  while (1)
  {
    HAL_GPIO_TogglePin(LED_GPIO_PORT, LED_PIN);

    HAL_Delay(1000);
  }
}

void SysTick_Handler(void)
{
  HAL_IncTick();
}

void NMI_Handler(void)
{
}

void HardFault_Handler(void)
{
  while (1) {}
}


void MemManage_Handler(void)
{
  while (1) {}
}

void BusFault_Handler(void)
{
  while (1) {}
}

void UsageFault_Handler(void)
{
  while (1) {}
}

void SVC_Handler(void)
{
}


void DebugMon_Handler(void)
{
}

void PendSV_Handler(void)
{
}

and finally the platformio.ini to

[env:stm32F100]
platform = ststm32
board = genericSTM32F100RE
framework = stm32cube

Does that run?