Skip to content

Commit 3547367

Browse files
committed
Merge branch 'release/v4.2.0'
2 parents f38c9fc + c256c9f commit 3547367

40 files changed

+1597
-22
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ env:
2727
- PLATFORMIO_PROJECT_DIR=examples/mbed-serial
2828
- PLATFORMIO_PROJECT_DIR=examples/zephyr-ble-beacon
2929
- PLATFORMIO_PROJECT_DIR=examples/zephyr-blink
30+
- PLATFORMIO_PROJECT_DIR=examples/zephyr-net-echo-client
3031
- PLATFORMIO_PROJECT_DIR=examples/zephyr-subsys-nvs
3132

3233
# Zephyr framework doesn't support python 2
@@ -36,6 +37,8 @@ jobs:
3637
env: PLATFORMIO_PROJECT_DIR=examples/zephyr-ble-beacon
3738
- python: "2.7"
3839
env: PLATFORMIO_PROJECT_DIR=examples/zephyr-blink
40+
- python: "2.7"
41+
env: PLATFORMIO_PROJECT_DIR=examples/zephyr-net-echo-client
3942
- python: "2.7"
4043
env: PLATFORMIO_PROJECT_DIR=examples/zephyr-subsys-nvs
4144

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ environment:
1515
- PLATFORMIO_PROJECT_DIR: "examples/mbed-serial"
1616
- PLATFORMIO_PROJECT_DIR: "examples/zephyr-ble-beacon"
1717
- PLATFORMIO_PROJECT_DIR: "examples/zephyr-blink"
18+
- PLATFORMIO_PROJECT_DIR: "examples/zephyr-net-echo-client"
1819
- PLATFORMIO_PROJECT_DIR: "examples/zephyr-subsys-nvs"
1920

2021
install:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.pio
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Continuous Integration (CI) is the practice, in software
2+
# engineering, of merging all developer working copies with a shared mainline
3+
# several times a day < https://docs.platformio.org/page/ci/index.html >
4+
#
5+
# Documentation:
6+
#
7+
# * Travis CI Embedded Builds with PlatformIO
8+
# < https://docs.travis-ci.com/user/integration/platformio/ >
9+
#
10+
# * PlatformIO integration with Travis CI
11+
# < https://docs.platformio.org/page/ci/travis.html >
12+
#
13+
# * User Guide for `platformio ci` command
14+
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
15+
#
16+
#
17+
# Please choose one of the following templates (proposed below) and uncomment
18+
# it (remove "# " before each line) or use own configuration according to the
19+
# Travis CI documentation (see above).
20+
#
21+
22+
23+
#
24+
# Template #1: General project. Test it using existing `platformio.ini`.
25+
#
26+
27+
# language: python
28+
# python:
29+
# - "2.7"
30+
#
31+
# sudo: false
32+
# cache:
33+
# directories:
34+
# - "~/.platformio"
35+
#
36+
# install:
37+
# - pip install -U platformio
38+
# - platformio update
39+
#
40+
# script:
41+
# - platformio run
42+
43+
44+
#
45+
# Template #2: The project is intended to be used as a library with examples.
46+
#
47+
48+
# language: python
49+
# python:
50+
# - "2.7"
51+
#
52+
# sudo: false
53+
# cache:
54+
# directories:
55+
# - "~/.platformio"
56+
#
57+
# env:
58+
# - PLATFORMIO_CI_SRC=path/to/test/file.c
59+
# - PLATFORMIO_CI_SRC=examples/file.ino
60+
# - PLATFORMIO_CI_SRC=path/to/test/directory
61+
#
62+
# install:
63+
# - pip install -U platformio
64+
# - platformio update
65+
#
66+
# script:
67+
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
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 Core <http://docs.platformio.org/page/core.html>`_
16+
2. Download `development platform with examples <https://github.com/platformio/platform-nordicnrf52/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 platform-nordicnrf52/examples/zephyr-net-echo-client
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
This directory is intended for project header files.
3+
4+
A header file is a file containing C declarations and macro definitions
5+
to be shared between several project source files. You request the use of a
6+
header file in your project source file (C, C++, etc) located in `src` folder
7+
by including it, with the C preprocessing directive `#include'.
8+
9+
```src/main.c
10+
11+
#include "header.h"
12+
13+
int main (void)
14+
{
15+
...
16+
}
17+
```
18+
19+
Including a header file produces the same results as copying the header file
20+
into each source file that needs it. Such copying would be time-consuming
21+
and error-prone. With a header file, the related declarations appear
22+
in only one place. If they need to be changed, they can be changed in one
23+
place, and programs that include the header file will automatically use the
24+
new version when next recompiled. The header file eliminates the labor of
25+
finding and changing all the copies as well as the risk that a failure to
26+
find one copy will result in inconsistencies within a program.
27+
28+
In C, the usual convention is to give header files names that end with `.h'.
29+
It is most portable to use only letters, digits, dashes, and underscores in
30+
header file names, and at most one dot.
31+
32+
Read more about using header files in official GCC documentation:
33+
34+
* Include Syntax
35+
* Include Operation
36+
* Once-Only Headers
37+
* Computed Includes
38+
39+
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
This directory is intended for project specific (private) libraries.
3+
PlatformIO will compile them to static libraries and link into executable file.
4+
5+
The source code of each library should be placed in a an own separate directory
6+
("lib/your_library_name/[here are source files]").
7+
8+
For example, see a structure of the following two libraries `Foo` and `Bar`:
9+
10+
|--lib
11+
| |
12+
| |--Bar
13+
| | |--docs
14+
| | |--examples
15+
| | |--src
16+
| | |- Bar.c
17+
| | |- Bar.h
18+
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
19+
| |
20+
| |--Foo
21+
| | |- Foo.c
22+
| | |- Foo.h
23+
| |
24+
| |- README --> THIS FILE
25+
|
26+
|- platformio.ini
27+
|--src
28+
|- main.c
29+
30+
and a contents of `src/main.c`:
31+
```
32+
#include <Foo.h>
33+
#include <Bar.h>
34+
35+
int main (void)
36+
{
37+
...
38+
}
39+
40+
```
41+
42+
PlatformIO Library Dependency Finder will find automatically dependent
43+
libraries scanning project source files.
44+
45+
More information about PlatformIO Library Dependency Finder
46+
- https://docs.platformio.org/page/librarymanager/ldf.html
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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/page/projectconf.html
9+
10+
[env:nrf52840_dk]
11+
platform = nordicnrf52
12+
framework = zephyr
13+
board = nrf52840_dk
14+
build_type = debug
15+
board_build.embed_files =
16+
src/echo-apps-cert.der
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2018 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __CA_CERTIFICATE_H__
8+
#define __CA_CERTIFICATE_H__
9+
10+
#define CA_CERTIFICATE_TAG 1
11+
#define PSK_TAG 2
12+
13+
#define TLS_PEER_HOSTNAME "localhost"
14+
15+
/* This is the same cert as what is found in net-tools/echo-apps-cert.pem file
16+
*/
17+
static const unsigned char ca_certificate[] = {
18+
#include "echo-apps-cert.der.inc"
19+
};
20+
21+
#if defined(CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
22+
#include CONFIG_NET_SAMPLE_PSK_HEADER_FILE
23+
#endif
24+
25+
#endif /* __CA_CERTIFICATE_H__ */
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2017 Intel Corporation.
3+
* Copyright (c) 2018 Nordic Semiconductor ASA.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/* Value of 0 will cause the IP stack to select next free port */
9+
#define MY_PORT 0
10+
11+
#define PEER_PORT 4242
12+
13+
struct data {
14+
const char *proto;
15+
16+
struct {
17+
int sock;
18+
/* Work controlling udp data sending */
19+
struct k_delayed_work recv;
20+
struct k_delayed_work transmit;
21+
u32_t expecting;
22+
u32_t counter;
23+
u32_t mtu;
24+
} udp;
25+
26+
struct {
27+
int sock;
28+
u32_t expecting;
29+
u32_t received;
30+
u32_t counter;
31+
} tcp;
32+
};
33+
34+
struct configs {
35+
struct data ipv4;
36+
struct data ipv6;
37+
};
38+
39+
#if !defined(CONFIG_NET_CONFIG_PEER_IPV4_ADDR)
40+
#define CONFIG_NET_CONFIG_PEER_IPV4_ADDR ""
41+
#endif
42+
43+
#if !defined(CONFIG_NET_CONFIG_PEER_IPV6_ADDR)
44+
#define CONFIG_NET_CONFIG_PEER_IPV6_ADDR ""
45+
#endif
46+
47+
extern const char lorem_ipsum[];
48+
extern const int ipsum_len;
49+
extern struct configs conf;
50+
51+
int start_udp(void);
52+
int process_udp(void);
53+
void stop_udp(void);
54+
55+
int start_tcp(void);
56+
int process_tcp(void);
57+
void stop_tcp(void);
58+
59+
#if defined(CONFIG_NET_VLAN)
60+
int init_vlan(void);
61+
#else
62+
static inline int init_vlan(void)
63+
{
64+
return 0;
65+
}
66+
#endif
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2019 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __DUMMY_PSK_H__
8+
#define __DUMMY_PSK_H__
9+
10+
static const unsigned char psk[] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
11+
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
12+
static const char psk_id[] = "PSK_identity";
13+
14+
#endif /* __DUMMY_PSK_H__ */
Binary file not shown.

0 commit comments

Comments
 (0)