forked from mmoskal/uf2-stm32f103
-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathplatformio.ini
95 lines (91 loc) · 4.52 KB
/
platformio.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
; PlatformIO Project Configuration File: Build, Upload, Library and Advanced Options
; http://docs.platformio.org/page/projectconf.html
[platformio]
; Uncomment to build STM32 Blue Pill Bootloader, which exposes a USB drive that will flash a UF2 file to the Blue Pill ROM.
env_default = bluepill_f103c8_bootloader
; Uncomment to build STM32 Blue Pill Firmware, which is a sample UF2 program that can be flashed by the Bootloader.
; env_default = bluepill_f103c8_firmware
; Common build settings. Inject these options into [env:] sections using ${common_env_data.***}
[common_env_data]
platform = ststm32
board = bluepill_f103c8
framework = libopencm3
; Find dependencies
lib_ldf_mode = chain+
; Source files
src_filter =
+<stm32f103/*.c>
+<stm32f103/*.h>
; Path to platform-specific libraries.
lib_extra_dirs = stm32
; Extended options for build. Removed -Wl,-wrap,main.
; From src/targets.mk: HAVE_LED, LED_GPIO_PORT, LED_GPIO_PIN, LED_OPEN_DRAIN, USES_GPIOC.
; UF2_FAMILY: Needed to fix compilation.
; LIBOPENCM3_RCC_LEGACY: In stm32/bluepill/timer.cpp, setting LIBOPENCM3_RCC_LEGACY will select the older HSE (PlatformIO) instead of newer RCC_HSE (Codal).
; TOOLCHAIN_GCC_ARM, TOOLCHAIN_GCC: needed to avoid demangler: https://os.mbed.com/forum/platform-32-ST-Nucleo-L152RE-community/topic/4802/?page=2#comment-25593
; The other build settings are from codal-libopencm3
build_flags =
-I src/stm32f103
-I src/stm32f103/generic
-D UF2_FAMILY=0x5ee21072
-D HAVE_LED=1 -D LED_GPIO_PORT=GPIOC -D LED_GPIO_PIN=GPIO13 -D LED_OPEN_DRAIN=1 -D USES_GPIOC=1
-D LIBOPENCM3_RCC_LEGACY
-D TOOLCHAIN_GCC_ARM -D TOOLCHAIN_GCC
-D DEVICE_I2C_ASYNCH=1 -D DEVICE_I2CSLAVE=1 -D DEVICE_PORTOUT=1 -D DEVICE_PORTINOUT=1 -D TARGET_STM32F1
-D DEVICE_RTC=1 -D TOOLCHAIN_object -D DEVICE_SERIAL_ASYNCH=1 -D __CMSIS_RTOS -D TOOLCHAIN_GCC
-D DEVICE_CAN=1 -D TARGET_LIKE_CORTEX_M3 -D TARGET_GENERIC_F103RE -D ARM_MATH_CM3 -D TARGET_UVISOR_UNSUPPORTED
-D TARGET_M3 -D DEVICE_SERIAL=1 -D DEVICE_SPI_ASYNCH=1 -D DEVICE_INTERRUPTIN=1 -D TARGET_CORTEX
-D DEVICE_I2C=1 -D TRANSACTION_QUEUE_SIZE_SPI=2 -D __CORTEX_M3 -D DEVICE_STDIO_MESSAGES=1
-D TARGET_FAMILY_STM32 -D TARGET_RELEASE -D TARGET_STM -D DEVICE_SERIAL_FC=1 -D DEVICE_PORTIN=1
-D DEVICE_SLEEP=1 -D TOOLCHAIN_GCC_ARM -D DEVICE_SPI=1 -D DEVICE_SPISLAVE=1 -D DEVICE_ANALOGIN=1
-D DEVICE_PWMOUT=1 -D DEVICE_FLASH=1 -D TARGET_STM32F103C8 -D TARGET_CORTEX_M
-std=c++11 -fwrapv -fno-rtti -fno-threadsafe-statics -fno-exceptions -fno-unwind-tables
-Wl,--print-memory-usage
-Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment -Wno-array-bounds
-Wl,--no-wchar-size-warning -Wl,--gc-sections -Wl,--wrap,exit -Wl,--wrap,atexit
-mcpu=cortex-m3 -mthumb
; --verbose -Wl,--verbose
; Build settings for STM32 Blue Pill Bootloader.
[env:bluepill_f103c8_bootloader]
platform = ${common_env_data.platform}
board = ${common_env_data.board}
framework = ${common_env_data.framework}
lib_ldf_mode = ${common_env_data.lib_ldf_mode}
lib_extra_dirs = ${common_env_data.lib_extra_dirs}
; Source files
src_filter =
+<*.c>
+<*.h>
+<stm32f103/generic/*.c>
+<stm32f103/generic/*.h>
${common_env_data.src_filter}
; Generate linker map in bootloader.map.
build_flags =
-Wl,-Map,bootloader.map
${common_env_data.build_flags}
; Build settings for STM32 Blue Pill Firmware.
[env:bluepill_f103c8_firmware]
platform = ${common_env_data.platform}
board = ${common_env_data.board}
framework = ${common_env_data.framework}
lib_ldf_mode = ${common_env_data.lib_ldf_mode}
lib_extra_dirs = ${common_env_data.lib_extra_dirs}
; Source files
src_filter =
+<blink/*.c>
+<blink/*.h>
+<blink/*.ld>
${common_env_data.src_filter}
; stm32f103x8.ld: Linker map for Blue Pill Firmware, with ROM starting at 0x0800 4000 (instead of default 0x0800 0000).
; libopencm3/lib/stm32/f1: Location of libopencm3_stm32f1.ld, which is included by stm32f103x8.ld
; Generate linker map in firmware.map.
build_flags =
-Wl,-Tsrc/blink/stm32f103x8.ld
-L $PIOHOME_DIR/packages/framework-libopencm3/lib/stm32/f1
-Wl,-Map,firmware.map
${common_env_data.build_flags}
; Convert the built executable in .bin format into UF2 format for flashing via bootloader.
; e.g. python uf2conv.py --convert --base 0x08004000 --output firmware.uf2 firmware.bin
; For verification, extract the executable in .bin format from the UF2 file.
; e.g. python2 uf2conv.py --convert --output firmware.bin --base 0x08004000 firmware.uf2
extra_scripts = scripts/build_script.py