-
Notifications
You must be signed in to change notification settings - Fork 0
/
stm32.qbs
138 lines (116 loc) · 3.94 KB
/
stm32.qbs
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import qbs
Project {
minimumQbsVersion: "1.6.0"
Product
{
property string optimization: "fast"
type: ["application", "flash"]
Depends
{
name: "cpp"
}
cpp.defines: ["STM32F10X_LD_VL"]
cpp.positionIndependentCode: false
cpp.enableExceptions: false
cpp.executableSuffix: ".elf"
cpp.cxxFlags: ["-std=c++11"]
cpp.cFlags: ["-std=gnu99"]
Properties
{
condition: qbs.buildVariant === "debug"
cpp.defines: outer.concat(["DEBUG=1"])
cpp.debugInformation: true
cpp.optimization: "none"
}
Properties
{
condition: qbs.buildVariant === "release"
cpp.debugInformation: false
cpp.optimization: optimization
}
files:
[
"src/system/cmsis/*.h",
"src/system/cmsis/*.h",
"src/system/cmsis_boot/*.h",
"src/system/cmsis_boot/*.c",
"src/system/cmsis_boot/startup/*.c",
"src/main.cpp"
]
cpp.driverFlags:
[
"-mthumb",
"-mcpu=cortex-m3",
"-mfloat-abi=soft",
"-fno-strict-aliasing",
"-g3",
"-Wall",
"-mfpu=vfp",
"-flto"
]
cpp.commonCompilerFlags:
[
"-fdata-sections",
"-ffunction-sections",
"-fno-inline",
"-flto"
]
cpp.linkerFlags:
[
//"--specs=nano.specs",
"--start-group",
"--gc-sections",
"-T" + path + "/src/system/linker/stm32f10x_flash.ld",
"-lnosys",
"-lgcc",
"-lc",
"-lstdc++",
"-lm"
]
cpp.includePaths:
[
"src/system/cmsis",
"src/system/cmsis_boot",
"src/system/cmsis_boot/statup"
]
Rule
{
inputs: ["application"]
Artifact
{
filePath: project.buildDirectory + product.name + ".hex"
fileTags: "flash"
}
prepare:
{
var GCCPath = "c:/development/gcc-arm/bin"
var OpenOCDPath = "c:/development/openocd_0_10_0"
var OpenOCDInterface = "stlink-v2.cfg"
var OpenOCDTarget = "stm32f1x.cfg"
// var OpenOCDTarget = "stm32f0x.cfg"
var argsSize = [input.filePath]
var argsObjcopy = ["-O", "ihex", input.filePath, output.filePath]
var argsFlashing =
[
"-f", OpenOCDPath + "/scripts/interface/" + OpenOCDInterface,
"-f", OpenOCDPath + "/scripts/target/" + OpenOCDTarget,
"-c", "init",
"-c", "halt",
"-c", "flash write_image erase " + input.filePath,
"-c", "reset",
"-c", "shutdown"
]
var cmdSize = new Command(GCCPath + "/arm-none-eabi-size.exe", argsSize)
var cmdObjcopy = new Command(GCCPath + "/arm-none-eabi-objcopy.exe", argsObjcopy)
var cmdFlash = new Command(OpenOCDPath + "/bin/openocd.exe", argsFlashing);
cmdSize.description = "Size of sections:"
cmdSize.highlight = "linker"
cmdObjcopy.description = "convert to bin..."
cmdObjcopy.highlight = "linker"
cmdFlash.description = "download firmware to uC..."
cmdFlash.highlight = "linker"
return [cmdSize, cmdObjcopy, cmdFlash]
}
}
}
}