Skip to content

Commit 890fd7c

Browse files
committed
Initial upload
1 parent 7fa1b75 commit 890fd7c

File tree

543 files changed

+113189
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

543 files changed

+113189
-0
lines changed

boards/deneyapkart.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32_out.ld",
5+
"partitions": "huge_app.csv"
6+
},
7+
"core": "esp32",
8+
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue",
9+
"f_cpu": "240000000L",
10+
"f_flash": "40000000L",
11+
"flash_mode": "dio",
12+
"mcu": "esp32",
13+
"variant": "esp32"
14+
},
15+
"connectivity": [
16+
"wifi",
17+
"bluetooth",
18+
"ethernet",
19+
"can",
20+
"uart",
21+
"i2c",
22+
"spi"
23+
],
24+
"debug": {
25+
"openocd_board": "esp32-wrover.cfg"
26+
},
27+
"frameworks": [
28+
"arduino",
29+
"espidf"
30+
],
31+
"name": "Deneyap Kart",
32+
"upload": {
33+
"flash_size": "4MB",
34+
"maximum_ram_size": 8937472,
35+
"maximum_size": 4194304,
36+
"require_upload_port": true,
37+
"speed": 460800
38+
},
39+
"url": "https://docs.deneyapkart.org/",
40+
"vendor": "T3 Vakfi"
41+
}

builder/compat.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2014-present PlatformIO <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from SCons.Script import AlwaysBuild, Import
16+
17+
18+
Import("env")
19+
20+
21+
# Added in PIO Core 4.4.0
22+
if not hasattr(env, "AddPlatformTarget"):
23+
24+
def AddPlatformTarget(
25+
env,
26+
name,
27+
dependencies,
28+
actions,
29+
title=None,
30+
description=None,
31+
always_build=True,
32+
):
33+
target = env.Alias(name, dependencies, actions)
34+
if always_build:
35+
AlwaysBuild(target)
36+
return target
37+
38+
env.AddMethod(AddPlatformTarget)

builder/frameworks/_bare.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2014-present PlatformIO <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#
16+
# Default flags for bare-metal programming (without any framework layers)
17+
#
18+
19+
from SCons.Script import Import
20+
21+
Import("env")
22+
23+
env.Append(
24+
ASFLAGS=["-x", "assembler-with-cpp"],
25+
26+
CFLAGS=["-std=gnu99"],
27+
28+
CCFLAGS=[
29+
"-Os",
30+
"-Wall",
31+
"-nostdlib",
32+
"-Wpointer-arith",
33+
"-Wno-error=unused-but-set-variable",
34+
"-Wno-error=unused-variable",
35+
"-mlongcalls",
36+
"-ffunction-sections",
37+
"-fdata-sections",
38+
"-fstrict-volatile-bitfields"
39+
],
40+
41+
CXXFLAGS=[
42+
"-fno-rtti",
43+
"-fno-exceptions",
44+
"-std=gnu++11"
45+
],
46+
47+
CPPDEFINES=[
48+
"ESP32",
49+
"ESP_PLATFORM",
50+
("F_CPU", "$BOARD_F_CPU"),
51+
"HAVE_CONFIG_H",
52+
("MBEDTLS_CONFIG_FILE", '\\"mbedtls/esp_config.h\\"')
53+
],
54+
55+
LINKFLAGS=[
56+
"-nostdlib",
57+
"-Wl,-static",
58+
"-u", "call_user_start_cpu0",
59+
"-Wl,--undefined=uxTopUsedPriority",
60+
"-Wl,--gc-sections"
61+
]
62+
)
63+
64+
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
65+
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

builder/frameworks/_embed_files.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# Copyright 2014-present PlatformIO <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import shutil
16+
from os import SEEK_CUR, SEEK_END
17+
from os.path import basename, isfile, join
18+
19+
from SCons.Script import Builder
20+
21+
Import("env")
22+
23+
board = env.BoardConfig()
24+
25+
#
26+
# Embedded files helpers
27+
#
28+
29+
30+
def extract_files(cppdefines, files_type):
31+
files = []
32+
if "build." + files_type in board:
33+
files.extend(
34+
[
35+
join("$PROJECT_DIR", f)
36+
for f in board.get("build." + files_type, "").split()
37+
if f
38+
]
39+
)
40+
else:
41+
files_define = "COMPONENT_" + files_type.upper()
42+
for define in cppdefines:
43+
if files_define not in define:
44+
continue
45+
46+
value = define[1]
47+
if not isinstance(define, tuple):
48+
print("Warning! %s macro cannot be empty!" % files_define)
49+
return []
50+
51+
if not isinstance(value, str):
52+
print(
53+
"Warning! %s macro must contain "
54+
"a list of files separated by ':'" % files_define
55+
)
56+
return []
57+
58+
for f in value.split(":"):
59+
if not f:
60+
continue
61+
files.append(join("$PROJECT_DIR", f))
62+
63+
for f in files:
64+
if not isfile(env.subst(f)):
65+
print('Warning! Could not find file "%s"' % basename(f))
66+
67+
return files
68+
69+
70+
def remove_config_define(cppdefines, files_type):
71+
for define in cppdefines:
72+
if files_type in define:
73+
env.ProcessUnFlags("-D%s" % "=".join(str(d) for d in define))
74+
return
75+
76+
77+
def prepare_file(source, target, env):
78+
filepath = source[0].get_abspath()
79+
shutil.copy(filepath, filepath + ".piobkp")
80+
81+
with open(filepath, "rb+") as fp:
82+
fp.seek(-1, SEEK_END)
83+
if fp.read(1) != "\0":
84+
fp.seek(0, SEEK_CUR)
85+
fp.write(b"\0")
86+
87+
88+
def revert_original_file(source, target, env):
89+
filepath = source[0].get_abspath()
90+
if isfile(filepath + ".piobkp"):
91+
shutil.move(filepath + ".piobkp", filepath)
92+
93+
94+
def embed_files(files, files_type):
95+
for f in files:
96+
filename = basename(f) + ".txt.o"
97+
file_target = env.TxtToBin(join("$BUILD_DIR", filename), f)
98+
env.Depends("$PIOMAINPROG", file_target)
99+
if files_type == "embed_txtfiles":
100+
env.AddPreAction(file_target, prepare_file)
101+
env.AddPostAction(file_target, revert_original_file)
102+
env.AppendUnique(PIOBUILDFILES=[env.File(join("$BUILD_DIR", filename))])
103+
104+
105+
def transform_to_asm(target, source, env):
106+
files = [join("$BUILD_DIR", s.name + ".S") for s in source]
107+
return files, source
108+
109+
110+
env.Append(
111+
BUILDERS=dict(
112+
TxtToBin=Builder(
113+
action=env.VerboseAction(
114+
" ".join(
115+
[
116+
"xtensa-esp32-elf-objcopy",
117+
"--input-target",
118+
"binary",
119+
"--output-target",
120+
"elf32-xtensa-le",
121+
"--binary-architecture",
122+
"xtensa",
123+
"--rename-section",
124+
".data=.rodata.embedded",
125+
"$SOURCE",
126+
"$TARGET",
127+
]
128+
),
129+
"Converting $TARGET",
130+
),
131+
suffix=".txt.o",
132+
),
133+
TxtToAsm=Builder(
134+
action=env.VerboseAction(
135+
" ".join(
136+
[
137+
join(
138+
env.PioPlatform().get_package_dir("tool-cmake") or "",
139+
"bin",
140+
"cmake",
141+
),
142+
"-DDATA_FILE=$SOURCE",
143+
"-DSOURCE_FILE=$TARGET",
144+
"-DFILE_TYPE=TEXT",
145+
"-P",
146+
join(
147+
env.PioPlatform().get_package_dir("framework-espidf") or "",
148+
"tools",
149+
"cmake",
150+
"scripts",
151+
"data_file_embed_asm.cmake",
152+
),
153+
]
154+
),
155+
"Generating assembly for $TARGET",
156+
),
157+
emitter=transform_to_asm,
158+
single_source=True,
159+
),
160+
)
161+
)
162+
163+
164+
flags = env.get("CPPDEFINES")
165+
for files_type in ("embed_txtfiles", "embed_files"):
166+
if (
167+
"COMPONENT_" + files_type.upper() not in env.Flatten(flags)
168+
and "build." + files_type not in board
169+
):
170+
continue
171+
172+
files = extract_files(flags, files_type)
173+
if "espidf" in env.subst("$PIOFRAMEWORK"):
174+
env.Requires(join("$BUILD_DIR", "${PROGNAME}.elf"), env.TxtToAsm(files))
175+
else:
176+
embed_files(files, files_type)
177+
remove_config_define(flags, files_type)

builder/frameworks/arduino.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2014-present PlatformIO <[email protected]>
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""
16+
Arduino
17+
18+
Arduino Wiring-based Framework allows writing cross-platform software to
19+
control devices attached to a wide range of Arduino boards to create all
20+
kinds of creative coding, interactive objects, spaces or physical experiences.
21+
22+
http://arduino.cc/en/Reference/HomePage
23+
"""
24+
25+
from os.path import join
26+
27+
from SCons.Script import DefaultEnvironment, SConscript
28+
29+
env = DefaultEnvironment()
30+
board = env.BoardConfig()
31+
build_core = board.get("build.core", "").lower()
32+
33+
SConscript("_embed_files.py", exports="env")
34+
35+
if build_core == "mbcwb":
36+
SConscript(
37+
join(DefaultEnvironment().PioPlatform().get_package_dir(
38+
"framework-arduino-mbcwb"), "tools", "platformio-esp-build.py"))
39+
40+
elif "espidf" not in env.subst("$PIOFRAMEWORK"):
41+
SConscript(
42+
join(DefaultEnvironment().PioPlatform().get_package_dir(
43+
"framework-arduinoespressif32"), "tools", "platformio-build.py"))

0 commit comments

Comments
 (0)