Json file for stm32g030c6t6

How can I create json file for Stm32G030C6T6. I tried editing it myself. However, I was not successful.

{
  "build": {
    "core": "stm32",
    "cpu": "cortex-m0plus",
    "extra_flags": "-DSTM32G030x6",
    "f_cpu": "64000000L",
    "hwids": [
      [
        "0x0466",
        "0x0003"
      ],
      [
        "0x0466",
        "0x0004"
      ]
    ],    
    "framework_extra_flags": {
      "arduino": "-D__CORTEX_SC=0"
    },
    "mcu": "stm32g030c6t6",
    "product_line": "STM32G0x0",
    "variant": "STM32G0xx/G030C6T"
  },
  "debug": {
    "jlink_device": "STM32G030C6",
    "openocd_target": "stm32G0x",
    "svd_path": "STM32G0x0.svd"
  
  },
  "frameworks": [
    "arduino",
    "cmsis",
    "libopencm3",
    "stm32cube"
  ],
  "name": "STM32G030C6T6 (8k RAM. 32k Flash)",
  "upload": {
    "maximum_ram_size": 6144,
    "maximum_size": 16384,
    "protocol": "serial",
    "protocols": [
      "blackmagic",
      "dfu",
      "jlink",
      "serial",
      "stlink"
    ]
  },
  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f103c4.html",
  "vendor": "Generic"
}

Here you will find a description of how you can use custom board files: Custom Embedded Boards — PlatformIO v6.1 documentation

In addition, you can also create a boards folder within the project folder (same level as the platformio.ini file) and store your board file there. This is then only valid for the current project and can only be used there.

1 Like

I edited the JSON file again. When I want to compile the project, I get a lot of warnings. Where is the my mistake?

Thanks.

[env:genericSTM32G030C6]

platform = ststm32

board = genericSTM32G030C6

framework = arduino

{
  "build": {
    "core": "stm32", 
    "cpu": "cortex-m0plus",
    "f_cpu": "64000000L", 
    "mcu": "stm32g030c6t6",
    "product_line": "STM32G030xx",
    "variant": "STM32G0xx/G030C(6-8)T"
  },
  "debug": {
    "jlink_device": "STM32G030C6",
    "openocd_target": "stm32g0x",
    "svd_path": "STM32G030.svd"
  },
  "frameworks": [
    "arduino",
    "cmsis",
    "stm32cube",
    "libopencm3"
  ],
  "name": "STM32G030C6 (8k RAM. 32k Flash)",
  "upload": {
    "maximum_ram_size": 8192,
    "maximum_size": 32768,
    "protocol": "serial",
    "protocols": [
      "blackmagic",
      "cmsis-dap",
      "dfu",
      "jlink",
      "serial",
      "stlink"
    ]
  },
  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f103c6.html",
  "vendor": "Generic"
}

2920 | hadc->DMA_Handle->XferErrorCallback(hdma);
| ^~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c: In function ‘ADC_DMAHalfConvCplt’:
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c:2933:77: error: ‘DMA_HandleTypeDef’ {aka ‘struct __DMA_HandleTypeDef’} has no member named ‘Parent’
2933 | ADC_HandleTypeDef *hadc = (ADC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
| ^~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c: In function ‘ADC_DMAError’:
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c:2951:77: error: ‘DMA_HandleTypeDef’ {aka ‘struct __DMA_HandleTypeDef’} has no member named ‘Parent’
2951 | ADC_HandleTypeDef *hadc = (ADC_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
| ^~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c:2954:15: error: ‘ADC_HandleTypeDef’ has no member named ‘State’
2954 | SET_BIT(hadc->State, HAL_ADC_STATE_ERROR_DMA);
| ^~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\CMSIS\Device\ST\STM32G0xx\Include/stm32g0xx.h:170:33: note: in definition of macro ‘SET_BIT’
170 | #define SET_BIT(REG, BIT) ((REG) |= (BIT))
| ^~~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\STM32G0xx_HAL_Driver\Src/stm32g0xx_hal_adc.c:2957:15: error: ‘ADC_HandleTypeDef’ has no member named ‘ErrorCode’
2957 | SET_BIT(hadc->ErrorCode, HAL_ADC_ERROR_DMA);
| ^~
C:\Users\Discovery.platformio\packages\framework-arduinoststm32\system\Drivers\CMSIS\Device\ST\STM32G0xx\Include/stm32g0xx.h:170:33: note: in definition of macro ‘SET_BIT’
170 | #define SET_BIT(REG, BIT) ((REG) |= (BIT))
| ^~~
*** [.pio\build\genericSTM32G030C6\SrcWrapper\src\HAL\stm32yyxx_hal_adc.c.o] Error 1
=================================================================================== [FAILED] Took 10.84 seconds ===================================================================================

  • The terminal process “C:\Users\Discovery.platformio\penv\Scripts\platformio.exe ‘run’, ‘–target’, ‘upload’” terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

I think I succeeded. It looks like there’s no problem. Here is the json file,

{
  "build": {
    "core": "stm32", 
    "cpu": "cortex-m0plus",
    "extra_flags": "-DSTM32G0xx -DSTM32G030xx",
    "f_cpu": "64000000L", 
    "framework_extra_flags": {
      "arduino": "-D__CORTEX_SC=0"
    },
    "mcu": "stm32g030c6t6",
    "product_line": "STM32G030xx",
    "variant": "STM32G0xx/G030C(6-8)T"
  },
  
  "debug": {
    "jlink_device": "STM32G030C6",
    "openocd_target": "stm32g0x",
    "svd_path": "STM32G030.svd"
  },
  "frameworks": [
    "arduino",
    "cmsis",
    "stm32cube",
    "libopencm3"
  ],
  "name": "STM32G030C6 (8k RAM. 32k Flash)",
  "upload": {
    "maximum_ram_size": 8192,
    "maximum_size": 32768,
    "protocol": "serial",
    "protocols": [
      "blackmagic",
      "cmsis-dap",
      "dfu",
      "jlink",
      "serial",
      "stlink"
    ]
  },
  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f103c6.html",
  "vendor": "Generic"
}

1 Like