-
Notifications
You must be signed in to change notification settings - Fork 21
/
platform.txt
110 lines (75 loc) · 5.18 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
name=gd32vduino
version=0.1.1
# Compile variables
## GCC tools path
compiler.path={runtime.tools.riscv-nuclei-elf-gcc.path}/bin/
compiler.c.cmd=riscv-nuclei-elf-gcc
compiler.cpp.cmd=riscv-nuclei-elf-g++
compiler.ld.cmd=riscv-nuclei-elf-ld
compiler.ar.cmd=riscv-nuclei-elf-gcc-ar
compiler.objcopy.cmd=riscv-nuclei-elf-objcopy
compiler.elf2hex.cmd=riscv-nuclei-elf-objcopy
compiler.size.cmd=riscv-nuclei-elf-size
## C CODE path
compiler.sdk.path={runtime.platform.path}/cores/arduino/GD32VF103_Firmware_Library
compiler.cores.path={runtime.platform.path}/cores/arduino
## Compile flags
compiler.preproc.flags="-I{build.system.path}/include" "-I{compiler.cores.path}" "-I{compiler.cores.path}/deprecated-avr-comp" "-I{compiler.sdk.path}/GD32VF103_standard_peripheral" "-I{compiler.cores.path}/avr" "-I{compiler.sdk.path}/GD32VF103_standard_peripheral/Include" "-I{compiler.cores.path}/avr" "-I{compiler.sdk.path}/RISCV/drivers" "-I{compiler.sdk.path}/RISCV/env_Eclipse" "-I{compiler.sdk.path}/RISCV/stubs" "-I{compiler.sdk.path}/Utilities" "-I{compiler.sdk.path}/Utilities/LCD_common"
compiler.both.flags= -Os -Wall -march=rv32imac -mabi=ilp32 -mcmodel=medlow -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common
compiler.debug.flags=
compiler.c.flags=-c {compiler.debug.flags} {compiler.both.flags} {compiler.preproc.flags} -std=gnu11
compiler.cpp.flags=-c {compiler.debug.flags} {compiler.both.flags} {compiler.preproc.flags} -std=gnu++17 -fpermissive
compiler.ld.flags=-march=rv32imac -mabi=ilp32 -mcmodel=medlow -nostartfiles -Xlinker --gc-sections --specs=nano.specs -Os -T {build.ldscript} -Wl,--wrap=puts
compiler.S.flags=-c {compiler.debug.flags} {compiler.both.flags} {compiler.preproc.flags} -x assembler-with-cpp
compiler.ar.flags=rc
compiler.objcopy.eep.flags=
compiler.elf2hex.flags=-R .rel.dyn
compiler.define=-DARDUINO=
compiler.c.extra_flags=-DF_CPU={build.f_cpu} -D{build.board} -DUSE_STDPERIPH_DRIVER -DHXTAL_VALUE={build.hxtal_value}
compiler.c.elf.extra_flags=
compiler.cpp.extra_flags=-DF_CPU={build.f_cpu} -D{build.board} -DUSE_STDPERIPH_DRIVER -DHXTAL_VALUE={build.hxtal_value}
compiler.S.extra_flags=-DF_CPU={build.f_cpu} -D{build.board} -DUSE_STDPERIPH_DRIVER -DHXTAL_VALUE={build.hxtal_value}
compiler.ar.extra_flags=
compiler.elf2hex.extra_flags=
# Can be overridden in boards.txt
build.extra_flags=
# USB Flags
# ---------
build.usb_flags=
build.openocdcfg=
# Compile patterns
# ---------------------
## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -DARDUINO={runtime.ide.version} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DARDUINO={runtime.ide.version} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DARDUINO={runtime.ide.version} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Link gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.ld.flags} {build.extra_flags} {object_files} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group -lc -Wl,--end-group -Wl,--start-group -lc "{archive_file_path}" -Wl,--end-group
## Create binary
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} --output-format=binary "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
## Create hex
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} -O ihex "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -B "{build.path}/{build.project_name}.elf"
recipe.size.regex=\s*[0-9]+\s+[0-9]+\s+[0-9]+\s+([0-9]+).*
## Save hex
recipe.output.tmp_file={build.project_name}.bin
recipe.output.save_file={build.project_name}.{build.variant}.bin
# Uploader tools
## Openocd (Debug tools)
tools.openocd.cmd=openocd
tools.openocd.path={runtime.tools.openocd.path}/bin/
tools.openocd.program.config={program.params.config}
tools.openocd.program.pattern="{path}{cmd}" -s {runtime.tools.openocd.path}/share/openocd/scripts -f interface/{program.config} -c "transport select jtag" -f target/gd32vf103.cfg -c "adapter_khz 1000" -c "init; halt;" -c "flash protect 0 0 last off; program {{build.path}/{build.project_name}.elf} verify; mww 0xe004200c 0x4b5a6978; mww 0xe0042008 0x01; resume; exit 0;"
## Serial
tools.serial.cmd=stm32flash
tools.serial.path={runtime.tools.gd32vflash.path}/
tools.serial.program.pattern="{path}{cmd}" -g 0x08000000 -b {build.burn_baudrate} -w {build.path}/{build.project_name}.bin {serial.port}
## DFU
tools.dfu.cmd=dfu-util
tools.dfu.path={runtime.tools.gd32vflash.path}/
tools.dfu.program.pattern="{path}{cmd}" -d {build.vid}:{build.pid} -a 0 --dfuse-address 0x08000000:leave -D "{build.path}/{build.project_name}.bin"