-
Notifications
You must be signed in to change notification settings - Fork 46
/
platform.txt
195 lines (144 loc) · 8.99 KB
/
platform.txt
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# CH32 Core and platform.
# ------------------------------
#
# For more info at:
# https://arduino.github.io/arduino-cli/latest/platform-specification/
name=CH32V EVT Boards Support
version=1.0.0
# Compile variables
# ----------------------
compiler.ch.extra_include="-I{build.source.path}" "-I{build.core.path}" "-I{build.core.path}/avr/" "-I{build.core.path}/ch32/" "-I{build.core.path}/ch32/lib/" "-I{build.system.path}/{build.series}/USER/" "-I{build.system.path}/{build.series}/SRC/Core/" "-I{build.system.path}/{build.series}/SRC/Debug/" "-I{build.system.path}/{build.series}/SRC/Startup/" "-I{build.system.path}/{build.series}/SRC/Peripheral/inc/" "-I{build.system.path}/{build.series}/SRC/Peripheral/src/"
#---warning flags
compiler.warning_flags=-Wunused -Wuninitialized
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
#---compiler.cmd
compiler.path={runtime.tools.riscv-none-embed-gcc-8.2.0.path}/bin/
compiler.S.cmd=riscv-none-embed-gcc
compiler.c.cmd=riscv-none-embed-gcc
compiler.cpp.cmd=riscv-none-embed-g++
compiler.ar.cmd=riscv-none-embed-ar
compiler.c.elf.cmd=riscv-none-embed-g++
compiler.objcopy.cmd=riscv-none-embed-objcopy
compiler.elf2hex.cmd=riscv-none-embed-objcopy
compiler.objdump.cmd=riscv-none-embed-objdump
compiler.libraries.ldflags=
#"@{build.opt.path}" {build.flags.optimize} {compiler.warning_flags} {build.flags.debug} -MP -MF
compiler.extra_flags=-march={build.march} -mabi={build.mabi} -msmall-data-limit=8 -msave-restore -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common
compiler.S.flags={compiler.extra_flags} -x assembler-with-cpp {build.flags.clock} "-I{build.system.path}/{build.series}/SRC/Startup/" "-I{build.core.path}/ch32/"
compiler.c.flags={build.flags.clock} {compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std=gnu99 -MMD {compiler.ch.extra_include}
compiler.cpp.flags={build.flags.clock} {compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.cpp.std} -fno-threadsafe-statics -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.ch.extra_include} -fpermissive
compiler.ar.flags=rcs
compiler.c.elf.flags=
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2bin.flags=-O binary
compiler.elf2hex.flags=-O ihex
compiler.objdump.flags=--all-headers --demangle --disassemble -M xw
compiler.ldflags=
compiler.size.cmd=riscv-none-embed-size
compiler.define=-DARDUINO=
# These can be overridden in boards.txt
build.extra_flags=
build.bootloader_flags=
build.ldscript=Link.ld
build.variant_h=
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=-Wl,--defsym=__FLASH_SIZE={upload.maximum_size} -Wl,--defsym=__RAM_SIZE={upload.maximum_data_size}
compiler.cpp.extra_flags=
compiler.cpp.std=gnu++14
compiler.S.extra_flags=
##{build.startup_file} {build.peripheral_pins}
compiler.ar.extra_flags=
compiler.elf2bin.extra_flags=
compiler.elf2hex.extra_flags=
compiler.elf2lst.extra_flags=
#compiler.arm.cmsis.c.flags="-I{build.system.path}/{build.series}/SRC/Core/" "-I{build.system.path}/{build.series}/SRC/Peripheral/inc/" "-I{build.system.path}/{build.series}/SRC/" "-I{build.system.path}/{build.series}/SRC/Startup/" "-I{build.system.path}/{build.series}/SRC/Debug/" "-I{build.system.path}/{build.series}/USER/" "-I{build.variants.path}/{build.series}/" "-I{build.variants.path}/{build.series}/{build.board}/"
# USB Flags
# ---------
#build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} -DUSBD_PID={build.pid} -DHAL_PCD_MODULE_ENABLED
build.usb_flags=
# Specify defaults for vid/pid, since an empty value is impossible to
# detect in the preprocessor, but a 0 can be checked for.
# Boards should specify either both, or neither of these.
build.vid=0
build.pid=0
# Build information's
#####################-D{build.board} -DARDUINO_ARCH_{build.arch} -DBOARD_NAME="{build.board}" -DVARIANT_H="{build.variant_h}"
build.info.flags=-DARDUINO_ARCH_CH32 -D{build.series} -DARDUINO={runtime.ide.version} -D{build.chip} -DVARIANT_H="{build.variant_h}" {build.usb_flags}
# Defaults config
build.xSerial=
build.enable_usb=
build.usb_speed=
build.enable_virtio=
build.peripheral_pins=
build.startup_file=
build.flags.fp=
build.flags.clock=
build.flags.optimize=
build.flags.debug=
build.flags.ldspecs=
build.flash_offset=0
# Pre and post build hooks
##build.opt.name=build_opt.h
##build.opt.sourcepath={build.source.path}/{build.opt.name}
##build.opt.path={build.path}/sketch/{build.opt.name}
# Create empty {build.opt} if not exists in the sketch dir
##recipe.hooks.prebuild.1.pattern.windows=cmd /c if not exist "{build.opt.sourcepath}" mkdir "{build.path}\sketch" & type NUL > "{build.opt.path}"
##recipe.hooks.prebuild.1.pattern.linux=bash -c "[ -f {build.opt.sourcepath} ] || (mkdir -p {build.path}/sketch && touch {build.opt.path})"
##recipe.hooks.prebuild.1.pattern.macosx=bash -c "[ -f {build.opt.sourcepath} ] || (mkdir -p {build.path}/sketch && touch {build.opt.path})"
# compile patterns
# ---------------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.info.flags} {compiler.c.extra_flags} {build.extra_flags} {includes} -o "{object_file}" -c "{source_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {build.info.flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} -o "{object_file}" -c "{source_file}"
## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.info.flags} -o "{object_file}" -c "{source_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.extra_flags} -T "{build.system.path}/{build.series}/SRC/Ld/{build.ldscript}" -nostartfiles -Xlinker --gc-sections "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} {build.flags.ldflags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group {object_files} {build.ch_extra_lib} -Wl,--whole-archive "{archive_file_path}" -Wl,--no-whole-archive -lc -Wl,--end-group
## Create output (.bin file)
recipe.objcopy.bin.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
## Create output (.hex file)
recipe.objcopy.hex.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
##Create output (.lst file)
#recipe.objcopy.lst.pattern="{compiler.path}{compiler.objdump.cmd}" {compiler.objdump.flags} {compiler.elf2lst.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.lst"
build.preferred_out_format=bin
## Save binary
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
recipe.output.save_file={build.project_name}.{build.board}.{build.preferred_out_format}
## Compute size recipe.advanced_size.pattern
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.rodata)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
# Uploader tool
## WCH-LinkE
tools.WCH_linkE.path={runtime.tools.openocd-1.0.0.path}/bin/
tools.WCH_linkE.cmd=openocd
tools.WCH_linkE.upload.params.verbose=
tools.WCH_linkE.upload.params.quiet=
tools.WCH_linkE.upload.config={runtime.tools.openocd.path}/bin/wch-riscv.cfg
tools.WCH_linkE.upload.pattern="{path}{cmd}" -f "{upload.config}" -c init -c halt -c "program {{build.path}/{build.project_name}.elf} verify; wlink_reset_resume; exit;"
#tools.WCH_linkE.upload.pattern="{path}{cmd}" -f {upload.config} -c init -c halt -c "program {{build.path}/{build.project_name}.elf}; verify_image {{build.path}/{build.project_name}.elf}; wlink_reset_resume; exit;"
## WCH-ISP
tools.wchisp.path={runtime.tools.wchisp.path}/
tools.wchisp.cmd=wchisp
tools.wchisp.upload.params.verbose=
tools.wchisp.upload.params.quiet=
tools.wchisp.upload.pattern="{path}{cmd}" {upload.verbose} flash "{build.path}/{build.project_name}.elf"
# Debugger configuration (general options)
# ----------------------------------------
# EXPERIMENTAL feature:
# - this is alpha and may be subject to change without notice
debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.prefix=riscv-none-embed
debug.toolchain.path={compiler.path}
debug.server=openocd
debug.server.openocd.path={runtime.tools.openocd-1.0.0.path}/bin/openocd
debug.server.openocd.scripts_dir={debug.toolchain.path}/scripts
debug.server.openocd.script={runtime.tools.openocd.path}/bin/wch-riscv.cfg