# http://docs.platformio.org/page/projectconf.html
[platformio]
core_dir = ./.platformio/

[env]
framework = arduino
platform = ststm32
board = genericSTM32F103C8
board_build.core = maple
extra_scripts =
	post:patch.py

[_common]
lib_deps =
	git+https://github.com/ZulNs/STM32F1_RTC#v1.1.0
	git+https://github.com/arpruss/USBComposite_stm32f1#3c58f97eb006ee9cd1fb4fd55ac4faeeaead0974
	drivers-stm32
build_flags =
# ----- The default config with dynamic switching -----
	-DHID_DYNAMIC
	-DHID_WITH_USB
	-DHID_SET_USB_KBD
	-DHID_SET_USB_MOUSE_ABS

[_serial]
extends =
	_common
build_flags =
	${_common.build_flags}
	-DCMD_SERIAL=Serial1
	-DCMD_SERIAL_SPEED=115200
	-DCMD_SERIAL_TIMEOUT=100000
# ===== Serial =====
[env:serial]
extends =
	_serial
upload_flags = -c set CPUTAPID 0x2ba01477
debug_tool= stlink
debug_build_flags = -Og -ggdb3 -g3
debug_server = 
	.platformio/packages/tool-openocd/bin/openocd
	-s .platformio/packages/tool-openocd/scripts
	-f interface/stlink.cfg
	-c "transport select hla_swd"
	-c "set CPUTAPID 0x2ba01477"
	-f target/stm32f1x.cfg
	-c "reset_config none" 
; build_type = debug
[env:patch]
; platformio-stm32f1-no-serial-usb.patch requires to running build again
; fake target was added to avoid error during first build
src_filter = -<src/>
