Skip to content

Commit e5f6c2e

Browse files
ivankravetsme-no-dev
authored andcommitted
Initial version of build script for @platformio; CI integration for Linux, macOS and Windows (espressif#153)
* Initial version of build script for @platformio; CI integration for Linux, macOS and Windows * Remove CI badges
1 parent 7316168 commit e5f6c2e

File tree

4 files changed

+167
-2
lines changed

4 files changed

+167
-2
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
+ [Decoding Exceptions](#decoding-exceptions)
1414
+ [Using PlatformIO](#using-platformio)
1515
+ [Using as ESP-IDF component](#using-as-esp-idf-component)
16-
- [ESP32Dev Board PINMAP](#esp32dev-board-pinmap)
16+
- [ESP32Dev Board PINMAP](#esp32dev-board-pinmap)
1717

1818
## Development Status
1919
Most of the framework is implemented. Most noticable is the missing analogWrite. While analogWrite is on it's way, there are a few other options that you can use:
@@ -72,6 +72,7 @@ Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
7272
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) -
7373
Cloud9, Codeanywehre, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
7474
- [Project Examples](https://github.com/platformio/platform-espressif32/tree/develop/examples)
75+
- [Using "Stage" (Git) version of Arduino Core](http://docs.platformio.org/page/platforms/espressif32.html#using-arduino-framework-with-staging-version)
7576

7677
### Using as ESP-IDF component
7778
- Download and install [esp-idf](https://github.com/espressif/esp-idf)
@@ -102,7 +103,7 @@ Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
102103
delay(1000);
103104
}
104105
```
105-
106+
106107
- Else you need to implement ```app_main()``` and call ```initArduino();``` in it.
107108

108109
Keep in mind that setup() and loop() will not be called in this case.

appveyor.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
build: off
2+
environment:
3+
4+
matrix:
5+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiClient"
6+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiClientBasic"
7+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiClientEvents"
8+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiIPv6"
9+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiScan"
10+
- PLATFORMIO_CI_SRC: "libraries/WiFi/examples/WiFiSmartConfig"
11+
12+
install:
13+
- cmd: git submodule update --init --recursive
14+
- cmd: SET PATH=%PATH%;C:\Python27\Scripts
15+
- cmd: pip install -U https://github.com/platformio/platformio/archive/develop.zip
16+
- cmd: platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage
17+
18+
test_script:
19+
- cmd: platformio ci -b esp32dev -b nano32 -b node32s

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "framework-arduinoespressif32",
3+
"description": "Arduino Wiring-based Framework (ESP32 Core)",
4+
"version": "0.0.0",
5+
"url": "https://github.com/espressif/arduino-esp32"
6+
}

tools/platformio-build.py

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
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 isdir, join
26+
27+
from SCons.Script import DefaultEnvironment
28+
29+
env = DefaultEnvironment()
30+
platform = env.PioPlatform()
31+
32+
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
33+
assert isdir(FRAMEWORK_DIR)
34+
35+
env.Prepend(
36+
CPPDEFINES=[
37+
("ARDUINO", 10610),
38+
"ARDUINO_ARCH_ESP32"
39+
],
40+
41+
CFLAGS=["-Wno-old-style-declaration"],
42+
43+
CCFLAGS=[
44+
"-Wno-error=deprecated-declarations",
45+
"-Wno-unused-parameter",
46+
"-Wno-sign-compare"
47+
],
48+
49+
CPPPATH=[
50+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"),
51+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bt"),
52+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "driver"),
53+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp32"),
54+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ethernet"),
55+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "fatfs"),
56+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "freertos"),
57+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "log"),
58+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mdns"),
59+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "vfs"),
60+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ulp"),
61+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "newlib"),
62+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nvs_flash"),
63+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spi_flash"),
64+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "sdmmc"),
65+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "openssl"),
66+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_update"),
67+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcpip_adapter"),
68+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "xtensa-debug-module"),
69+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "coap"),
70+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "wpa_supplicant"),
71+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "expat"),
72+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "json"),
73+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mbedtls"),
74+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nghttp"),
75+
join(FRAMEWORK_DIR, "tools", "sdk", "include", "lwip"),
76+
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
77+
],
78+
LIBPATH=[
79+
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
80+
join(FRAMEWORK_DIR, "tools", "sdk", "ld"),
81+
],
82+
LIBS=[
83+
"app_update", "bootloader_support", "bt", "btdm_app", "c",
84+
"c_nano", "coap", "coexist", "core", "cxx", "driver", "esp32",
85+
"ethernet", "expat", "fatfs", "freertos", "hal", "json", "log",
86+
"lwip", "m", "mbedtls", "mdns", "micro-ecc", "net80211", "newlib",
87+
"nghttp", "nvs_flash", "openssl", "phy", "pp", "rtc", "sdmmc",
88+
"smartconfig", "spi_flash", "tcpip_adapter", "ulp", "vfs", "wpa",
89+
"wpa2", "wpa_supplicant", "wps", "xtensa-debug-module", "gcc", "stdc++"
90+
]
91+
)
92+
93+
env.Append(
94+
LIBSOURCE_DIRS=[
95+
join(FRAMEWORK_DIR, "libraries")
96+
],
97+
98+
LINKFLAGS=[
99+
"-Wl,-EL",
100+
"-T", "esp32.common.ld",
101+
"-T", "esp32.rom.ld",
102+
"-T", "esp32.peripherals.ld"
103+
],
104+
105+
UPLOADERFLAGS=[
106+
"0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools",
107+
"sdk", "bin", "bootloader.bin"),
108+
"0x8000", '"%s"' % join(FRAMEWORK_DIR, "tools",
109+
"sdk", "bin", "partitions_singleapp.bin"),
110+
"0x10000"
111+
]
112+
)
113+
114+
#
115+
# Target: Build Core Library
116+
#
117+
118+
libs = []
119+
120+
if "build.variant" in env.BoardConfig():
121+
env.Append(
122+
CPPPATH=[
123+
join(FRAMEWORK_DIR, "variants",
124+
env.BoardConfig().get("build.variant"))
125+
]
126+
)
127+
libs.append(env.BuildLibrary(
128+
join("$BUILD_DIR", "FrameworkArduinoVariant"),
129+
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
130+
))
131+
132+
envsafe = env.Clone()
133+
134+
libs.append(envsafe.BuildLibrary(
135+
join("$BUILD_DIR", "FrameworkArduino"),
136+
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
137+
))
138+
139+
env.Prepend(LIBS=libs)

0 commit comments

Comments
 (0)