-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
92 lines (78 loc) · 2.79 KB
/
build.py
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
from os.path import isdir, join
Import("env")
#print(env.Dump())
board = env.BoardConfig()
PROJ_DIR = env.get("PROJECT_DIR")
BUILD_DIR = env.get("PROJECT_BUILD_DIR")
PIOENV = env.get("PIOENV")
SRC_DIR = "src"
FREERUN_TIMER_DIR = join(SRC_DIR, "freerun_timer")
SHELL_DIR = join(SRC_DIR, "shell")
SOUND_DIR = join(SRC_DIR, "sound")
SOUND_APP_DIR = join(SOUND_DIR, "app")
SOUND_MIDI_DIR = join(SOUND_DIR, "midi")
SOUND_COMPONENT_DIR = join(SOUND_DIR, "components")
USBD_DIR = join(SRC_DIR, "usbd")
USBD_APP_DIR = join(USBD_DIR, "app")
USBD_CORE_DIR = join(USBD_DIR, "usbd_core")
PERIPH_DRIV_DIR = join(SRC_DIR, "GD32VF103_Firmware_Library_V1.0.1", "Firmware", "GD32VF103_standard_peripheral")
USBFS_DRIV_DIR = join(SRC_DIR, "GD32VF103_Firmware_Library_V1.0.1", "Firmware", "GD32VF103_usbfs_driver")
RISCV_DRIV_DIR = join(SRC_DIR, "GD32VF103_Firmware_Library_V1.0.1", "Firmware", "RISCV", "drivers")
env.Append(
CPPPATH = [
join(PROJ_DIR, SRC_DIR),
join(PROJ_DIR, FREERUN_TIMER_DIR),
join(PROJ_DIR, SHELL_DIR),
join(PROJ_DIR, SOUND_DIR),
join(PROJ_DIR, SOUND_APP_DIR),
join(PROJ_DIR, SOUND_APP_DIR, "single_ymf825"),
join(PROJ_DIR, SOUND_APP_DIR, "single_ymz294"),
join(PROJ_DIR, SOUND_MIDI_DIR),
join(PROJ_DIR, SOUND_COMPONENT_DIR),
join(PROJ_DIR, SOUND_COMPONENT_DIR, "ymf825"),
join(PROJ_DIR, SOUND_COMPONENT_DIR, "ymz294"),
join(PROJ_DIR, USBD_DIR),
join(PROJ_DIR, USBD_APP_DIR),
join(PROJ_DIR, USBD_CORE_DIR),
join(PROJ_DIR, PERIPH_DRIV_DIR),
join(PROJ_DIR, PERIPH_DRIV_DIR, "Include"),
join(PROJ_DIR, USBFS_DRIV_DIR),
join(PROJ_DIR, USBFS_DRIV_DIR, "Include"),
join(PROJ_DIR, RISCV_DRIV_DIR),
]
)
env.Replace(
ASFLAGS = ["-x", "assembler-with-cpp"],
CCFLAGS=[
"-Og",
"-g",
"-Wall",
"-march=%s" % board.get("build.march"),
"-mabi=%s" % board.get("build.mabi"),
#"-mcmodel=%s" % board.get("build.mcmodel"),
"-fshort-wchar",
"-ffunction-sections",
"-fdata-sections",
"-fstack-usage",
"-msmall-data-limit=8",
],
LINKFLAGS=[
"-march=%s" % board.get("build.march"),
"-mabi=%s" % board.get("build.mabi"),
#"-mcmodel=%s" % board.get("build.mcmodel"),
"-msmall-data-limit=8",
"-nostartfiles",
"-Wl,--gc-sections",
#"-specs=nano.specs"
#"-Wl,-Map=firmware.map",
],
LIBS=[
"c_nano",
"m" # libm
],
LDSCRIPT_PATH = [
join(PROJ_DIR, "GD32VF103xB.lds")
]
)
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])