Mbed/STM32 Custom Board Problems

Hi,
I am running Platformio 4.1 with mbed ST STM32 5.7.0 on a custom board derived from NUCLEO F303RE
I’ve developing on it fine, but now I would like to customize a bit my project, without hardcoding pin functions etc.

So I decided to follow the guidelines provided by platformio and did the following:

  • Created in my project dir a custom_targets.json (derived from targets,json in the section regarding STM32F303RE)
  • Created in my project dir a board directory, and added inside a json file with my board name (derived from .platformio/platforms/stsm32…NUCLEO F303RE)
  • created a directory inside /src with my board name with the relevant files to alter (pinnames ecc).
    -added a new env to my platform.ini using my new board and adding reference to new directory

When building I get the following error:


Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/CORSa_board.html
PLATFORM: ST STM32 5.7.0 > ArSilicii CORSa Board
HARDWARE: STM32F303RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1), framework-mbed 5.51401.191023 (5.14.1)
Collecting mbed sources…
Detected custom target file
mbed build API internal error
write() takes exactly 2 arguments (3 given)
======================================================== [FAILED]

custom_targets.json

{
“CORSa_board”: {
“inherits”: [
“FAMILY_STM32”
],
“supported_form_factors”: [
“ARDUINO”,
“MORPHO”
],
“core”: “Cortex-M4F”,
“extra_labels_add”: [
“STM32F3”,
“STM32F303xE”,
“STM32F303RE”
],
“config”: {
“clock_source”: {
“help”: “Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI”,
“value”: “USE_PLL_HSE_EXTC|USE_PLL_HSI”,
“macro_name”: “CLOCK_SOURCE”
}
},
“detect_code”: [
“0745”
],
“device_has_add”: [
“ANALOGOUT”,
“CAN”,
“CRC”,
“SERIAL_ASYNCH”,
“FLASH”,
“MPU”
],
“release_versions”: [
“2”,
“5”
],
“bootloader_supported”: true,
“device_name”: “STM32F303RE”
}
}

CORSa_board.json

{
“build”: {
“cpu”: “cortex-m4”,
“extra_flags”: “-DSTM32F303xE”,
“f_cpu”: “72000000L”,
“mcu”: “stm32f303ret6”,
“variant”: “NUCLEO_F303RE”
},
“debug”: {
“default_tools”: [
“stlink”
],
“jlink_device”: “STM32F303RE”,
“onboard_tools”: [
“stlink”
],
“openocd_board”: “st_nucleo_f3”,
“svd_path”: “STM32F303xE.svd”
},
“frameworks”: [
“mbed”
],
“name”: “ArSilicii CORSa Board”,
“upload”: {
“maximum_ram_size”: 65536,
“maximum_size”: 524288,
“protocol”: “mbed”,
“protocols”: [
“jlink”,
“stlink”,
“blackmagic”,
“mbed”
]
},
“url”: “NUCLEO-F303RE | Mbed”,
“vendor”: “ArSilicii”
}

platform.ini
[env:CORSa_board]
;platform = ststm32@~5.3.0
platform = ststm32
board = CORSa_board
framework = mbed
build_flags = -D PIO_FRAMEWORK_MBED_RTOS_PRESENT, -I$PROJECT_SRC_DIR/CORSA_BOARD_TARGET
debug_tool = stlink

Can anyone Help? please!

Try to specify the build_flags like so, i.e. use separate lines and no commas:

 build_flags =
    -D PIO_FRAMEWORK_MBED_RTOS_PRESENT
    -I$PROJECT_SRC_DIR/CORSA_BOARD_TARGET

Hi Manuel,
thank you, but I still get the same error:

Processing CORSa_board (platform: ststm32; board: CORSa_board; framework: mbed)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/CORSa_board.html
PLATFORM: ST STM32 5.7.0 > ArSilicii CORSa Board
HARDWARE: STM32F303RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: toolchain-gccarmnoneeabi 1.70201.0 (7.2.1), framework-mbed 5.51401.191023 (5.14.1)
Collecting mbed sources...
Detected custom target file
mbed build API internal error
write() takes exactly 2 arguments (3 given)

The problem is discussed in this issue:

You probably need to create and specify a linker script for your board…