Skip to content

Commit 62397e7

Browse files
committed
add: 添加platform.txt
1 parent 2c05580 commit 62397e7

File tree

1 file changed

+217
-0
lines changed

1 file changed

+217
-0
lines changed

platform.txt

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
name=PY32Duino
2+
version=0.0.1
3+
4+
## compiler variables 编译器的路径
5+
compiler.path={runtime.tools.xpack-arm-none-eabi-gcc.path}/bin/
6+
7+
##All the command 编译各种文件的命令
8+
compiler.S.cmd=arm-none-eabi-gcc
9+
compiler.c.cmd=arm-none-eabi-gcc
10+
compiler.cpp.cmd=arm-none-eabi-g++
11+
compiler.ar.cmd=arm-none-eabi-ar
12+
compiler.elf.cmd=arm-none-eabi-g++
13+
14+
compiler.c.elf.cmd=arm-none-eabi-g++
15+
compiler.objcopy.cmd=arm-none-eabi-objcopy
16+
compiler.elf2hex.cmd=arm-none-eabi-objcopy
17+
compiler.libraries.ldflags=
18+
19+
# 需要额外引入的头文件的路径
20+
compiler.py.extra_include="-I{build.source.path}" "-I{build.core.path}/avr" "-I{build.core.path}/py" "-I{build.core.path}/py/LL" "-I{build.core.path}/py/usb" "-I{build.core.path}/py/usb/hid" "-I{build.core.path}/py/usb/cdc" {build.virtio_extra_include} {build.drivers_include}
21+
22+
# 编译器警告的参数
23+
compiler.warning_flags=-w
24+
compiler.warning_flags.none=-w
25+
compiler.warning_flags.default=
26+
compiler.warning_flags.more=-Wall
27+
compiler.warning_flags.all=-Wall -Wextra
28+
29+
compiler.extra_flags=-mcpu={build.mcu} {build.fpu} {build.float-abi} -DUSE_FULL_LL_DRIVER -mthumb "@{build.opt.path}"
30+
31+
# 汇编编译器参数
32+
compiler.S.flags={compiler.extra_flags} -c -x assembler-with-cpp {compiler.py.extra_include}
33+
34+
compiler.c.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.c.std} -ffreestanding -fsingle-precision-constant -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -MMD {compiler.py.extra_include}
35+
36+
compiler.cpp.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.cpp.std} -ffreestanding -fsingle-precision-constant -ffunction-sections -fdata-sections -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.py.extra_include}
37+
38+
compiler.ar.flags=rcs
39+
40+
compiler.c.elf.flags=-mcpu={build.mcu} {build.fpu} {build.float-abi} -mthumb {build.flags.optimize} {build.flags.debug} {build.flags.ldspecs} -Wl,--defsym=LD_FLASH_OFFSET={build.flash_offset} -Wl,--defsym=LD_MAX_SIZE={upload.maximum_size} -Wl,--defsym=LD_MAX_DATA_SIZE={upload.maximum_data_size} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common
41+
42+
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
43+
44+
compiler.elf2bin.flags=-O binary
45+
compiler.elf2hex.flags=-O ihex
46+
47+
# 编译器的链接参数compiler.ldflags
48+
49+
## 消除链接时候的`LOAD segment with RWX permissions`警告
50+
compiler.ldflags=-Wl,--no-warn-rwx-segments
51+
compiler.size.cmd=arm-none-eabi-size
52+
compiler.define=-DARDUINO=
53+
54+
# These can be overridden in boards.txt 在board.txt中选择的参数会覆盖下面这些
55+
build.board=
56+
build.py_extra_flags=
57+
build.extra_flags=
58+
build.bootloader_flags=
59+
build.ldscript=ldscript.ld
60+
build.variant_h=variant_generic.h
61+
62+
# These can be overridden in platform.local.txt 在platform.local.txt中选择的参数会覆盖下面这些
63+
compiler.c.py_extra_flags={build.peripheral_pins}
64+
compiler.c.extra_flags=
65+
compiler.c.std=gnu17
66+
compiler.c.elf.extra_flags=
67+
compiler.cpp.extra_flags=
68+
compiler.cpp.std=gnu++17
69+
compiler.S.py_extra_flags={build.startup_file}
70+
compiler.S.extra_flags=
71+
compiler.ar.extra_flags=
72+
compiler.elf2bin.extra_flags=
73+
compiler.elf2hex.extra_flags=
74+
75+
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/PrivateInclude"
76+
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -l{build.cmsis_lib_gcc}
77+
78+
# USB Flags USB相关内容,暂时先不写,也许以后有了再说
79+
# ---------
80+
build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} -DUSBD_PID={build.pid} -DHAL_PCD_MODULE_ENABLED
81+
82+
# Specify defaults for vid/pid, since an empty value is impossible to
83+
# detect in the preprocessor, but a 0 can be checked for.
84+
# Boards should specify either both, or neither of these.
85+
build.vid=0
86+
build.pid=0
87+
88+
# To customize the USB manufacturer or product string, must add defines
89+
# for them, e.g.:
90+
# some_board.build.extra_flags='-DUSB_MANUFACTURER_STRING="My Company"' '-DUSB_PRODUCT_STRING="My Product"'
91+
# This cannot be done using build variables and specifying the -D
92+
# options here, since then the default would be a defined, but empty macro
93+
# that the preprocessor cannot detect.
94+
95+
# VirtIO RPMsg Serial Flags
96+
# build.virtio_flags=-DVIRTIOCON -DNO_ATOMIC_64_SUPPORT -DMETAL_INTERNAL -DMETAL_MAX_DEVICE_REGIONS=2 -DVIRTIO_SLAVE_ONLY -DVIRTIO_LOG
97+
# build.virtio_extra_include="-I{build.system.path}/Middlewares/OpenAMP" "-I{build.system.path}/Middlewares/OpenAMP/open-amp/lib/include" "-I{build.system.path}/Middlewares/OpenAMP/libmetal/lib/include" "-I{build.system.path}/Middlewares/OpenAMP/virtual_driver"
98+
build.virtio_extra_include=""
99+
100+
# Build information's 编译的时候打印的日志信息
101+
build.info.flags=-D{build.series} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DBOARD_NAME="{build.board}" -DVARIANT_H="{build.variant_h}"
102+
103+
# Defaults config 默认的配置
104+
build.xSerial=-DHAL_UART_MODULE_ENABLED
105+
build.enable_usb=
106+
build.usb_speed=
107+
build.enable_virtio=
108+
build.peripheral_pins=
109+
build.startup_file=
110+
build.fpu=
111+
build.float-abi=
112+
build.flags.optimize=-Os
113+
build.flags.debug=-DNDEBUG
114+
build.flags.ldspecs=--specs=nano.specs
115+
build.flash_offset=0
116+
117+
# Pre and post build hooks
118+
build.opt.name=build.opt
119+
build.opt.path={build.path}/sketch/{build.opt.name}
120+
121+
extras.path={build.system.path}
122+
123+
# Create {build.opt} if not exists in the output sketch dir and force include of SrcWrapper library
124+
125+
recipe.hooks.prebuild.1.pattern=bash "{extras.path}/extras/prebuild.sh" "{build.path}" "{build.source.path}" "{runtime.platform.path}"
126+
recipe.hooks.prebuild.1.pattern.windows="{extras.path}\extras\prebuild.bat" "{build.path}" "{build.source.path}" "{runtime.platform.path}"
127+
128+
# compile patterns
129+
# ---------------------
130+
131+
## Compile c files
132+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.info.flags} {compiler.c.py_extra_flags} {compiler.c.extra_flags} {build.py_extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
133+
134+
## Compile c++ files
135+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {build.info.flags} {compiler.cpp.extra_flags} {build.py_extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
136+
137+
## Compile S files
138+
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.info.flags} {compiler.S.py_extra_flags} {compiler.S.extra_flags} {build.py_extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
139+
140+
## Create archives
141+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
142+
143+
## Combine gc-sections, archives, and objects
144+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} "-Wl,--default-script={build.variant.path}/{build.ldscript}" "-Wl,--script={build.system.path}/ldscript.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} {compiler.ldflags} {compiler.arm.cmsis.ldflags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -Wl,--start-group {object_files} {compiler.libraries.ldflags} "{archive_file_path}" -lc -Wl,--end-group -lm -lgcc -lstdc++
145+
146+
## Create output (.bin file)
147+
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"
148+
149+
## Create output (.hex file)
150+
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"
151+
152+
build.preferred_out_format=bin
153+
154+
## Save binary
155+
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
156+
recipe.output.save_file={build.project_name}.{build.board}.{build.preferred_out_format}
157+
158+
## Compute size
159+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
160+
recipe.size.regex=^(?:\.text|\.data|\.rodata)\s+([0-9]+).*
161+
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
162+
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
163+
164+
165+
# Uploader tool
166+
# -------------------
167+
##
168+
## AirISP
169+
##
170+
tools.AirISP.path={runtime.tools.AirISP.path}
171+
tools.AirISP.cmd=AirISP
172+
tools.AirISP.cmd.windows=AirISP.exe
173+
174+
## Upload Sketch
175+
## -------------
176+
tools.AirISP.upload.protocol=serial
177+
tools.AirISP.upload.params.verbose=
178+
tools.AirISP.upload.params.quiet=
179+
tools.AirISP.upload.pattern_args=--chip "auto" --port "{serial.port}" --baud {upload.speed} --before {upload.boot} --after hard_reset write_flash -e -p 0x08000000 "{build.path}/{build.project_name}.bin"
180+
tools.AirISP.upload.pattern="{path}/{cmd}" {upload.pattern_args}
181+
182+
## Program Application
183+
## -------------------
184+
tools.AirISP.program.params.verbose=
185+
tools.AirISP.program.params.quiet=
186+
tools.AirISP.program.pattern_args=--chip "auto" --port "{serial.port}" --baud {upload.speed} --before {upload.boot} --after hard_reset write_flash -e -p 0x08000000 "{build.path}/{build.project_name}.bin"
187+
tools.AirISP.program.pattern="{path}/{cmd}" {program.pattern_args}
188+
189+
## Erase Chip (before burning the bootloader)
190+
## ------------------------------------------
191+
tools.AirISP.erase.protocol=serial
192+
tools.AirISP.erase.params.verbose=
193+
tools.AirISP.erase.params.quiet=
194+
tools.AirISP.erase.pattern_args=---chip "auto" --port "{serial.port}" --baud {upload.speed} --before {upload.boot} --after hard_reset erase_flash
195+
tools.AirISP.erase.pattern="{path}/{cmd}" {erase.pattern_args}
196+
197+
## Burn Bootloader
198+
## ---------------
199+
tools.AirISP.bootloader.protocol=serial
200+
tools.AirISP.bootloader.params.verbose=
201+
tools.AirISP.bootloader.params.quiet=
202+
tools.AirISP.bootloader.pattern=
203+
204+
# Debugger configuration (general options)
205+
# ----------------------------------------
206+
# EXPERIMENTAL feature:
207+
# - this is alpha and may be subject to change without notice
208+
# debug.executable={build.path}/{build.project_name}.elf
209+
# debug.toolchain=gcc
210+
# debug.toolchain.path={compiler.path}
211+
# debug.toolchain.prefix=arm-none-eabi-
212+
# debug.server=pyocd
213+
# debug.server.pyocd.path=
214+
# debug.server.pyocd.scripts_dir=
215+
# debug.server.pyocd.script=
216+
# debug.server.pyocd.cmsisPack="D:\\GitHub\\luatos-soc-air001\\PACK\\Keil.AIR001_DFP.1.1.0.pack"
217+
# debug.server.pyocd.targetId="Air001Dev"

0 commit comments

Comments
 (0)