Skip to content

Commit a677598

Browse files
committed
Merge branch 'release/v1.4.1'
2 parents 9e3633d + fa89137 commit a677598

File tree

22 files changed

+1044
-99
lines changed

22 files changed

+1044
-99
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.pioenvs
2+
.clang_complete
3+
.gcc-flags.json
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. Copyright 2014-present PlatformIO <contact@platformio.org>
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
Unless required by applicable law or agreed to in writing, software
7+
distributed under the License is distributed on an "AS IS" BASIS,
8+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
See the License for the specific language governing permissions and
10+
limitations under the License.
11+
12+
How to build PlatformIO based project
13+
=====================================
14+
15+
1. `Install PlatformIO <http://docs.platformio.org/en/stable/installation.html>`_
16+
2. Download `examples source code <https://github.com/platformio/platformio-examples/archive/develop.zip>`_
17+
3. Extract ZIP archive
18+
4. Run these commands:
19+
20+
.. code-block:: bash
21+
22+
# Change directory to example
23+
> cd platformio-examples/atmelavr-and-arduino/atmelavr-assember-blink
24+
25+
# Build project
26+
> platformio run
27+
28+
# Upload firmware
29+
> platformio run --target upload
30+
31+
# Clean build files
32+
> platformio run --target clean
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Import("env")
2+
env.Replace(LINKFLAGS=["-mmcu=$BOARD_MCU", "-nostartfiles"])
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
This directory is intended for the project specific (private) libraries.
3+
PlatformIO will compile them to static libraries and link to executable file.
4+
5+
The source code of each library should be placed in separate directory, like
6+
"lib/private_lib/[here are source files]".
7+
8+
For example, see how can be organized `Foo` and `Bar` libraries:
9+
10+
|--lib
11+
| |--Bar
12+
| | |--docs
13+
| | |--examples
14+
| | |--src
15+
| | |- Bar.c
16+
| | |- Bar.h
17+
| |--Foo
18+
| | |- Foo.c
19+
| | |- Foo.h
20+
| |- readme.txt --> THIS FILE
21+
|- platformio.ini
22+
|--src
23+
|- main.c
24+
25+
Then in `src/main.c` you should use:
26+
27+
#include <Foo.h>
28+
#include <Bar.h>
29+
30+
// rest H/C/CPP code
31+
32+
PlatformIO will find your libraries automatically, configure preprocessor's
33+
include paths and build them.
34+
35+
More information about PlatformIO Library Dependency Finder
36+
- http://docs.platformio.org/en/stable/librarymanager/ldf.html
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter, extra scripting
4+
; Upload options: custom port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
;
7+
; Please visit documentation for the other options and examples
8+
; http://docs.platformio.org/en/stable/projectconf.html
9+
10+
[env:uno]
11+
platform = atmelavr
12+
board = uno
13+
extra_script = extra_script.py
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.equ RAMEND, 0x8ff
2+
.equ SREG, 0x3f
3+
.equ SPL, 0x3d
4+
.equ SPH, 0x3e
5+
.equ PORTB, 0x05
6+
.equ DDRB, 0x04
7+
.equ PINB, 0x03
8+
9+
.org 0
10+
rjmp main
11+
12+
main:
13+
ldi r16,0 ; reset system status
14+
out SREG,r16 ; init stack pointer
15+
ldi r16,lo8(RAMEND)
16+
out SPL,r16
17+
ldi r16,hi8(RAMEND)
18+
out SPH,r16
19+
20+
ldi r16,0x20 ; set port bits to output mode
21+
out DDRB,r16
22+
23+
clr r17
24+
mainloop:
25+
eor r17,r16 ; invert output bit
26+
out PORTB,r17 ; write to port
27+
call wait ; wait some time
28+
rjmp mainloop ; loop forever
29+
30+
wait:
31+
push r16
32+
push r17
33+
push r18
34+
35+
ldi r16,0x40 ; loop 0x400000 times
36+
ldi r17,0x00 ; ~12 million cycles
37+
ldi r18,0x00 ; ~0.7s at 16Mhz
38+
_w0:
39+
dec r18
40+
brne _w0
41+
dec r17
42+
brne _w0
43+
dec r16
44+
brne _w0
45+
46+
pop r18
47+
pop r17
48+
pop r16
49+
ret
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
# Arduino OTA
3+
4+
## About
5+
6+
OTA (Over the Air) update is the process of loading the firmware to ESP module using Wi-Fi connection rather that a serial port.
7+
8+
This example is adapted from https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/readme.md
9+
10+
## Execute the example
11+
12+
Change directory to the example and edit src/main.cpp to set the SSID and password of your WiFi network.
13+
14+
const char* ssid = "WIFI_SSID";
15+
const char* password = "WIFI_PASS";
16+
17+
Compile and upload to your esp8266:
18+
19+
pio run -e esp8266 -t upload
20+
21+
## Test OTA
22+
23+
Use another example ([blink is good option](https://github.com/platformio/platformio-examples/tree/develop/wiring-blink)) to generate the firmware and upload:
24+
25+
pio run -e nodemcu -t upload --upload-port IP_ADDRESS
26+
27+
IP address of board is printed on the serial interface (115200 bps):
28+
29+
```
30+
$ pio device monitor -b 115200
31+
--- Miniterm on /dev/ttyUSB0 115200,8,N,1 ---
32+
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
33+
Ready
34+
IP address: 192.168.10.190
35+
```
36+
37+
This is a demo of OTA uploading:
38+
39+
```
40+
$ pio run -e nodemcu -t upload --upload-port 192.168.10.190
41+
42+
[Mon Dec 19 21:35:48 2016] Processing nodemcu (platform: espressif8266, board:
43+
nodemcu, framework: arduino)
44+
------------------------------------------------------------------------------
45+
Verbose mode can be enabled via `-v, --verbose` option
46+
Collected 23 compatible libraries
47+
Looking for dependencies...
48+
Project does not have dependencies
49+
Looking for upload port...
50+
Use manually specified: 192.168.10.190
51+
Uploading .pioenvs/nodemcu/firmware.bin
52+
21:35:49 [DEBUG]: Options: {'esp_ip': '192.168.10.190', 'host_port': 31639,
53+
'image': '.pioenvs/nodemcu/firmware.bin', 'host_ip': '0.0.0.0', 'auth': '',
54+
'esp_port': 8266, 'spiffs': False, 'debug': True, 'progress': True}
55+
21:35:49 [INFO]: Starting on 0.0.0.0:31639
56+
21:35:49 [INFO]: Upload size: 226272
57+
21:35:49 [INFO]: Sending invitation to: 192.168.10.190
58+
21:35:49 [INFO]: Waiting for device...
59+
Uploading: [============================================================] 100%
60+
Done...
61+
62+
21:35:53 [INFO]: Waiting for result...
63+
21:35:53 [INFO]: Result: OK
64+
===================== [SUCCESS] Took 4.67 seconds ==========================
65+
66+
============================= [SUMMARY] ====================================
67+
Environment uno [SKIP]
68+
Environment nodemcu [SUCCESS]
69+
Environment teensy31 [SKIP]
70+
Environment lpmsp430g2553[SKIP]
71+
===================== [SUCCESS] Took 4.67 seconds ==========================
72+
```
73+
74+
75+

0 commit comments

Comments
 (0)