Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PlatformIO build support #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

maxgerhardt
Copy link

@maxgerhardt maxgerhardt commented Mar 17, 2021

Adds a board definition file, a platformio.ini and one minor modification to the code to make it work with GCC. Should still work with Keil.

The build system PlatformIO is a Python tool and a VSCode extension that can build firmwares for tons of devices (STM32, ESP32, ESP8266, AVR, nRF52, ...) in a cross-platform and automatic way.

Now one can do just

> pio run 
Processing GD32F130C8T6 (platform: ststm32; board: gd32f130c8; framework: spl)
------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/gd32f130c8.html
PLATFORM: ST STM32 (12.0.0) > Generic GD32F130C8T6
HARDWARE: GD32F130C8T6 72MHz, 8.00KB RAM, 64KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:
 - framework-spl 2.10301.0 (1.3.1)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Warning! Cannot find a linker script for the required board! Firmware will be linked with a default linker script!
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 1 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\GD32F130C8T6\src\bldc.o
Compiling .pio\build\GD32F130C8T6\src\comms.o
Compiling .pio\build\GD32F130C8T6\src\commsBluetooth.o
Compiling .pio\build\GD32F130C8T6\src\commsMasterSlave.o
Compiling .pio\build\GD32F130C8T6\src\commsSteering.o
Compiling .pio\build\GD32F130C8T6\src\it.o
Compiling .pio\build\GD32F130C8T6\src\led.o
Compiling .pio\build\GD32F130C8T6\src\main.o
Compiling .pio\build\GD32F130C8T6\src\setup.o
Compiling .pio\build\GD32F130C8T6\FrameworkCMSISVariant\startup_gd32f1x0.o
Compiling .pio\build\GD32F130C8T6\FrameworkCMSISVariant\system_gd32f1x0.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_adc.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_can.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_cec.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_cmp.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_crc.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_dac.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_dbg.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_dma.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_exti.o
Archiving .pio\build\GD32F130C8T6\libFrameworkCMSISVariant.a
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_fmc.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_fwdgt.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_gpio.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_i2c.o
Indexing .pio\build\GD32F130C8T6\libFrameworkCMSISVariant.a
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_ivref.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_misc.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_opa.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_pmu.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_rcu.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_rtc.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_slcd.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_spi.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_syscfg.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_timer.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_tsi.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_usart.o
Compiling .pio\build\GD32F130C8T6\FrameworkSPL\gd32f1x0_wwdgt.o
Archiving .pio\build\GD32F130C8T6\libFrameworkSPL.a
Indexing .pio\build\GD32F130C8T6\libFrameworkSPL.a
Linking .pio\build\GD32F130C8T6\firmware.elf
Building .pio\build\GD32F130C8T6\firmware.bin
Checking size .pio\build\GD32F130C8T6\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.3% (used 272 bytes from 8196 bytes)
Flash: [==        ]  21.4% (used 14032 bytes from 65536 bytes)
=========== [SUCCESS] Took 2.34 seconds ===========

and the firmware is built :)

@szepnorbee
Copy link

Hi maxgerhardt! Have you tried this firmware? I tried Pro Mini and ESP8266, but no response. I try to access it on MASTER using the example code.(PPMDevice) The controller sends the data, the arduino sends the response, but nothing. The board is good because I can start the motors at a fixed speed by modifying the code (board firmware). Can you help me? Thank you.

@maxgerhardt
Copy link
Author

I indeed got feedback that the compiled firmware wasn't quite working, but it's incredibly hard to do remote diagnosis when you don't have the hardware. There are macros for MASTER and.. slave mode that this platformio.ini doesn't yet incorporate, have ou tried setting those? (build_flags = -D MASTER, for example).

@Derkades
Copy link

Derkades commented Dec 2, 2022

I had to set

platform_packages = maxgerhardt/[email protected], toolchain-gccarmnoneeabi@~1.90301.0

For it to compile on a raspberry pi (aarch64). The older gccarmnoneeabi toolchain used by default supports x86 only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants