Skip to content

Commit 465788f

Browse files
committed
Merge branch 'release/v4.4.0'
2 parents ac54dd9 + c957067 commit 465788f

File tree

15 files changed

+444
-19
lines changed

15 files changed

+444
-19
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
- PLATFORMIO_PROJECT_DIR=examples/mbed-events
1010
- PLATFORMIO_PROJECT_DIR=examples/mbed-rtos
1111
- PLATFORMIO_PROJECT_DIR=examples/mbed-serial
12+
- PLATFORMIO_PROJECT_DIR=examples/mbed-custom-target
1213

1314
install:
1415
- pip install -U https://github.com/platformio/platformio/archive/develop.zip

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ environment:
77
- PLATFORMIO_PROJECT_DIR: "examples/mbed-events"
88
- PLATFORMIO_PROJECT_DIR: "examples/mbed-rtos"
99
- PLATFORMIO_PROJECT_DIR: "examples/mbed-serial"
10+
- PLATFORMIO_PROJECT_DIR: "examples/mbed-custom-target"
1011

1112
install:
1213
- cmd: git submodule update --init --recursive

builder/main.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
from os import makedirs
1818
from os.path import isdir, join
1919

20-
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
21-
DefaultEnvironment)
20+
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild,
21+
Builder, Default, DefaultEnvironment)
2222

2323
env = DefaultEnvironment()
2424
platform = env.PioPlatform()
25+
board = env.BoardConfig()
2526

2627
env.Replace(
2728
AR="arm-none-eabi-ar",
@@ -83,6 +84,7 @@
8384

8485
target_elf = None
8586
if "nobuild" in COMMAND_LINE_TARGETS:
87+
target_elf = join("$BUILD_DIR", "${PROGNAME}.elf")
8688
target_firm = join("$BUILD_DIR", "${PROGNAME}.bin")
8789
else:
8890
target_elf = env.BuildProgram()
@@ -122,7 +124,7 @@ def _jlink_cmd_script(env, source):
122124
script_path = join(build_dir, "upload.jlink")
123125
commands = [
124126
"h",
125-
"loadbin %s, %s" % (source, env.BoardConfig().get(
127+
"loadbin %s, %s" % (source, board.get(
126128
"upload.offset_address", "0x0")),
127129
"r",
128130
"q"
@@ -135,7 +137,7 @@ def _jlink_cmd_script(env, source):
135137
__jlink_cmd_script=_jlink_cmd_script,
136138
UPLOADER="JLink.exe" if system() == "Windows" else "JLinkExe",
137139
UPLOADERFLAGS=[
138-
"-device", env.BoardConfig().get("debug", {}).get("jlink_device"),
140+
"-device", board.get("debug", {}).get("jlink_device"),
139141
"-speed", "4000",
140142
"-if", ("jtag" if upload_protocol == "jlink-jtag" else "swd"),
141143
"-autoconnect", "1"
@@ -166,7 +168,7 @@ def _jlink_cmd_script(env, source):
166168
]
167169

168170
elif upload_protocol == "cmsis-dap":
169-
debug_server = env.BoardConfig().get("debug.tools", {}).get(
171+
debug_server = board.get("debug.tools", {}).get(
170172
upload_protocol, {}).get("server")
171173
assert debug_server
172174

@@ -178,16 +180,23 @@ def _jlink_cmd_script(env, source):
178180
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE'
179181
)
180182
elif debug_server.get("package") == "tool-openocd":
183+
openocd_args = [
184+
"-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)
185+
]
186+
openocd_args.extend(debug_server.get("arguments", []))
187+
openocd_args.extend([
188+
"-c", "program {$SOURCE} %s verify reset; shutdown;" %
189+
board.get("upload.offset_address", "")
190+
])
191+
openocd_args = [
192+
f.replace("$PACKAGE_DIR",
193+
platform.get_package_dir("tool-openocd") or "")
194+
for f in openocd_args
195+
]
181196
env.Replace(
182197
UPLOADER="openocd",
183-
UPLOADERFLAGS=["-s", platform.get_package_dir("tool-openocd") or ""] +
184-
debug_tools.get(upload_protocol).get("server").get("arguments", []) + [
185-
"-c",
186-
"program {$SOURCE} verify reset %s; shutdown;" %
187-
env.BoardConfig().get("upload.offset_address", "")
188-
],
189-
UPLOADCMD="$UPLOADER $UPLOADERFLAGS"
190-
)
198+
UPLOADERFLAGS=openocd_args,
199+
UPLOADCMD="$UPLOADER $UPLOADERFLAGS")
191200
upload_actions = [
192201
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")
193202
]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. Copyright 2014-present PlatformIO <[email protected]>
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-nordicnrf51/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-nxplpc/examples/mbed-custom-target
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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"build": {
3+
"cpu": "cortex-m3",
4+
"f_cpu": "96000000L",
5+
"mcu": "lpc1768"
6+
},
7+
"connectivity": [
8+
"can",
9+
"ethernet"
10+
],
11+
"debug": {
12+
"jlink_device": "LPC1768",
13+
"pyocd_target": "lpc1768",
14+
"svd_path": "LPC176x5x_v0.2.svd"
15+
},
16+
"frameworks": [
17+
"mbed"
18+
],
19+
"name": "Custom board based on NXP LPC1768",
20+
"upload": {
21+
"maximum_ram_size": 65536,
22+
"maximum_size": 524288,
23+
"protocol": "mbed",
24+
"protocols": [
25+
"jlink",
26+
"blackmagic",
27+
"cmsis-dap",
28+
"mbed"
29+
]
30+
},
31+
"url": "http://developer.mbed.org/platforms/mbed-LPC1768/",
32+
"vendor": "NXP"
33+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"MY_CUSTOM_BOARD": {
3+
"inherits": ["LPCTarget"],
4+
"core": "Cortex-M3",
5+
"extra_labels": ["NXP", "LPC176X", "MBED_LPC1768", "NXP_EMAC"],
6+
"supported_toolchains": ["ARM", "uARM", "GCC_ARM", "IAR"],
7+
"detect_code": ["1010"],
8+
"device_has": [
9+
"RTC",
10+
"USTICKER",
11+
"ANALOGIN",
12+
"ANALOGOUT",
13+
"CAN",
14+
"DEBUG_AWARENESS",
15+
"EMAC",
16+
"ETHERNET",
17+
"I2C",
18+
"I2CSLAVE",
19+
"INTERRUPTIN",
20+
"LOCALFILESYSTEM",
21+
"PORTIN",
22+
"PORTINOUT",
23+
"PORTOUT",
24+
"PWMOUT",
25+
"SEMIHOST",
26+
"SERIAL",
27+
"SERIAL_FC",
28+
"SLEEP",
29+
"SPI",
30+
"SPISLAVE",
31+
"STDIO_MESSAGES",
32+
"FLASH",
33+
"MPU",
34+
"USBDEVICE"
35+
],
36+
"release_versions": ["2", "5"],
37+
"device_name": "LPC1768",
38+
"bootloader_supported": true,
39+
"config": {
40+
"us-ticker-timer": {
41+
"help": "Chooses which timer (0-3) to use for us_ticker.c",
42+
"value": 3
43+
}
44+
},
45+
"overrides": {
46+
"network-default-interface-type": "ETHERNET"
47+
}
48+
}
49+
}
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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:my_custom_board]
11+
platform = nxplpc
12+
framework = mbed
13+
board = my_custom_board
14+
build_flags = -I$PROJECTSRC_DIR/MY_CUSTOM_BOARD_TARGET

0 commit comments

Comments
 (0)