-
Notifications
You must be signed in to change notification settings - Fork 8
/
SCan_boot.qbs
129 lines (110 loc) · 3.16 KB
/
SCan_boot.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
import qbs
CppApplication {
name: "SCan-boot"
// defines
cpp.defines: [
"STM32F10X_CL",
"STM32F105xC",
"BOARD_SIGMA=1", // Sigma 10 module
"BOARD_2CAN=2", // Ancient 2CAN board
"BOARD_CSAT=3", // Custom CS device
"BOARD_2CAN30=4", // 2CAN 30 module
"BOARD_2CAN2LIN=5" // 2CAN-2LIN board
// build for various boards
"BOARD=1",
]
files: [
"system/startup.c",
"system/sysinit.cpp",
"system/vectable.c",
"Rtt/SEGGER_RTT.c",
"Rtt/SEGGER_RTT_printf.c",
"USB/dfu_descriptors.c",
"USB/usb.c",
"USB/usb_control.c",
"USB/usb_f107.c",
"USB/usb_standard.c",
"USB/usb_dwc_common.c",
"USB/*.h",
"boot_main.cpp",
]
cpp.includePaths: [
".",
"system",
"system/CMSIS",
"USB",
"Rtt",
"stm32tpl",
]
Group {
name: "Linker Script"
fileTags: ["linkerscript"]
files: [ "system/stm32F105xC_boot.ld" ]
}
cpp.libraryPaths: [ "system" ]
type: ["hex", "size"] // The filetags to generate
cpp.cLanguageVersion: "c11"
cpp.cxxLanguageVersion: "c++17"
cpp.positionIndependentCode: false
cpp.generateLinkerMapFile: true
cpp.enableExceptions: false
cpp.executableSuffix: ".elf"
cpp.enableRtti: false
cpp.driverFlags: [
"-mcpu=cortex-m3",
"-mfloat-abi=soft",
"-specs=nosys.specs",
"-fdata-sections",
"-ffunction-sections",
]
cpp.cxxFlags: [
"-fno-use-cxa-atexit",
"-fno-exceptions",
"-fno-rtti",
]
cpp.driverLinkerFlags: [
"-nostartfiles",
"-specs=nano.specs",
"-Wl,--gc-sections",
]
// make hex-file
Rule {
inputs: "application"
Artifact {
fileTags: ["hex"]
filePath: product.name + ".hex"
}
prepare: {
var args = ["-O", "ihex", input.filePath, output.filePath];
var cmd = new Command(product.cpp.objcopyPath, args);
cmd.description = "converting to hex";
return cmd;
}
}
// print size
Rule {
inputs: "application"
outputFileTags: [ "size" ]
prepare: {
var args = [input.filePath];
var sizePath = product.cpp.toolchainInstallPath + "/" + product.cpp.toolchainPrefix + "size";
var cmd = new Command(sizePath, args);
cmd.description = "print size";
return cmd;
}
}
Properties {
condition: qbs.buildVariant === "debug"
cpp.debugInformation: true
cpp.defines: outer.concat("DEBUG")
//cpp.optimization: "none"
cpp.driverFlags: outer.concat("-Og")
}
Properties {
condition: qbs.buildVariant === "release"
cpp.debugInformation: false
//cpp.optimization: "small"
cpp.driverFlags: outer.concat("-Os")
cpp.driverLinkerFlags: outer.concat("-flto")
}
}