Skip to content

Commit 52e93ae

Browse files
authored
Merge pull request #1893 from screamerbg/tools-improvements
mbed Tools features and improvements
2 parents 0b3556d + f6acb1f commit 52e93ae

File tree

335 files changed

+2740
-683
lines changed

Some content is hidden

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

335 files changed

+2740
-683
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dist
77
MANIFEST
88

99
# Private settings
10-
private_settings.py
10+
mbed_settings.py
1111

1212
# Default Build Directory
1313
.build/

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
python:
22
- "2.7"
33

4-
script: "python workspace_tools/build_travis.py"
4+
script: "python tools/build_travis.py"
55
before_install:
66
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
77
- sudo apt-get update -qq

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
graft workspace_tools
2-
recursive-exclude workspace_tools *.pyc
1+
graft tools
2+
recursive-exclude tools *.pyc
33
include LICENSE

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Develop
157157
```
158158
> "venv/Scripts/activate"
159159
> pip install -r requirements.txt
160-
> cd workspace_tools
160+
> cd tools
161161
> ... do things ...
162162
> "venv/Scripts/deactivate"
163163
```

docs/BUILDING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ Checking out files: 100% (3994/3994), done.
130130
```
131131
$ cd mbed
132132
$ ls
133-
LICENSE MANIFEST.in README.md libraries setup.py travis workspace_tools
133+
LICENSE MANIFEST.in README.md libraries setup.py travis tools
134134
```
135135
Directory structure we are interested in:
136136
```
137-
mbed/workspace_tools/ - test suite scripts, build scripts etc.
137+
mbed/tools/ - test suite scripts, build scripts etc.
138138
mbed/libraries/tests/ - mbed SDK tests,
139139
mbed/libraries/tests/mbed/ - tests for mbed SDK and peripherals tests,
140140
mbed/libraries/tests/net/echo/ - tests for Ethernet interface,
@@ -153,9 +153,9 @@ Workspace tools are set of Python scripts used off-line by Mbed SDK team to:
153153
Before we can run our first test we need to configure our test environment a little!
154154
Now we need to tell workspace tools where our compilers are.
155155

156-
* Please to go ```mbed/workspace_tools/``` directory and create empty file called ```private_settings.py```.
156+
* Please to go ```mbed``` directory and create empty file called ```mbed_settings.py```.
157157
```
158-
$ touch private_settings.py
158+
$ touch mbed_settings.py
159159
```
160160
* Populate this file the Python code below:
161161
```python
@@ -203,13 +203,13 @@ GCC_CR_PATH = "C:/Work/toolchains/LPCXpresso_6.1.4_194/lpcxpresso/tools/bin"
203203
IAR_PATH = "C:/Work/toolchains/iar_6_5/arm"
204204
```
205205

206-
Note: Settings in ```private_settings.py``` will overwrite variables with default values in ```mbed/workspace_tools/settings.py``` file.
206+
Note: Settings in ```mbed_settings.py``` will overwrite variables with default values in ```mbed/default_settings.py``` file.
207207

208208
## Build Mbed SDK library from sources
209-
Let's build mbed SDK library off-line from sources using your compiler. We've already cloned mbed SDK sources, we've also installed compilers and added their paths to ```private_settings.py```.
209+
Let's build mbed SDK library off-line from sources using your compiler. We've already cloned mbed SDK sources, we've also installed compilers and added their paths to ```mbed_settings.py```.
210210
We now should be ready to use workspace tools script ```build.py``` to compile and build mbed SDK from sources.
211211

212-
We are still using console. You should be already in ```mbed/workspace_tools/``` directory if not go to ```mbed/workspace_tools/``` and type below command:
212+
We are still using console. You should be already in ```mbed/tools/``` directory if not go to ```mbed/tools/``` and type below command:
213213
```
214214
$ python build.py -m LPC1768 -t ARM
215215
```
@@ -276,7 +276,7 @@ Build successes:
276276

277277
### build.py script
278278

279-
Build script located in mbed/workspace_tools/ is our core script solution to drive compilation, linking and building process for:
279+
Build script located in mbed/tools/ is our core script solution to drive compilation, linking and building process for:
280280

281281
* mbed SDK (with libs like Ethernet, RTOS, USB, USB host).
282282
* Tests which also can be linked with libraries like RTOS or Ethernet.
@@ -426,7 +426,7 @@ $ python build.py -t uARM -m NUCLEO_F334R8 --cppcheck
426426
```
427427

428428
# make.py script
429-
```make.py``` is a ```mbed/workspace_tools/``` script used to build tests (we call them sometimes 'programs') one by one manually. This script allows you to flash board, execute and test it. However, this script is deprecated and will not be described here. Instead please use ```singletest.py``` file to build mbed SDK, tests and run automation for test cases included in ```mbedmicro/mbed```.
429+
```make.py``` is a ```mbed/tools/``` script used to build tests (we call them sometimes 'programs') one by one manually. This script allows you to flash board, execute and test it. However, this script is deprecated and will not be described here. Instead please use ```singletest.py``` file to build mbed SDK, tests and run automation for test cases included in ```mbedmicro/mbed```.
430430
Note: ```make.py``` script depends on existing already built mbed SDK and library sources so you need to pre-build mbed SDK and other libraries (such as RTOS library) to link 'program' (test) with mbed SDK and RTOS library. To pre-build mbed SDK please use ```build.py``` script.
431431

432432
Just for sake of example please see few ways to use ```make.py``` together with Freedom K64F board.

docs/COMMITTERS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ $ astyle.exe --style=kr --indent=spaces=4 --indent-switches $(FULL_CURRENT_PATH)
198198
```
199199
200200
## Python coding rules & coding guidelines
201-
Some of our tools in workspace_tools are written in ```Python 2.7```. In case of developing tools for python we prefer to keep similar code styles across all Python source code. Please note that not all rules must be enforced. For example we do not limit you to 80 characters per line, just be sure your code can fit to widescreen display.
201+
Some of our tools in tools are written in ```Python 2.7```. In case of developing tools for python we prefer to keep similar code styles across all Python source code. Please note that not all rules must be enforced. For example we do not limit you to 80 characters per line, just be sure your code can fit to widescreen display.
202202
203203
Please stay compatible with ```Python 2.7``` but nothing stops you to write your code so in the future it will by Python 3 friendly.
204204
@@ -211,7 +211,7 @@ Some general guidelines:
211211
* Please document your code, write comments and ```doc``` sections for each function or class you implement.
212212
213213
### Static Code Analizers for Python
214-
If you are old-school developer for sure you remember tools like lint. "lint was the name originally given to a particular program that flagged some suspicious and non-portable constructs (likely to be bugs) in C language source code." Now lint-like programs are used to check similar code issues for multiple languages, also for Python. Please do use them if you want to commit new code to workspace_tools and other mbed SDK Python tooling.
214+
If you are old-school developer for sure you remember tools like lint. "lint was the name originally given to a particular program that flagged some suspicious and non-portable constructs (likely to be bugs) in C language source code." Now lint-like programs are used to check similar code issues for multiple languages, also for Python. Please do use them if you want to commit new code to tools and other mbed SDK Python tooling.
215215
216216
Below is the list Python lint tools you may want to use:
217217
@@ -254,7 +254,7 @@ class HostRegistry:
254254
```
255255

256256
## Testing
257-
Please refer to TESTING.md document for detais regarding mbed SDK test suite and build scripts included in ```mbed/workspace_tools/```.
257+
Please refer to TESTING.md document for detais regarding mbed SDK test suite and build scripts included in ```mbed/tools/```.
258258

259259
## Before pull request checklist
260260
* Your pull request description section contains:

docs/TESTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Test suit allows users to run locally on their machines Mbed SDK’s tests inclu
66
Each test is supervised by python script called “host test” which will at least Test suite is using build script API to compile and build test source together with required by test libraries like CMSIS, Mbed, Ethernet, USB etc.
77

88
## What is host test?
9-
Test suite supports test supervisor concept. This concept is realized by separate Python script called ```host test```. Host tests can be found in ```mbed/workspace_tools/host_tests/``` directory. Note: In newer mbed versions (mbed OS) host tests will be separate library.
9+
Test suite supports test supervisor concept. This concept is realized by separate Python script called ```host test```. Host tests can be found in ```mbed/tools/host_tests/``` directory. Note: In newer mbed versions (mbed OS) host tests will be separate library.
1010

1111
Host test script is executed in parallel with test runner to monitor test execution. Basic host test just monitors device's default serial port for test results returned by test runner. Simple tests will print test result on serial port. In other cases host tests can for example judge by test results returned by test runner if test passed or failed. It all depends on test itself.
1212

1313
In some cases host test can be TCP server echoing packets from test runner and judging packet loss. In other cases it can just check if values returned from accelerometer are actually valid (sane).
1414

1515
## Test suite core: singletest.py script
1616

17-
```singletest.py``` script located in ```mbed/workspace_tools/``` is a test suite script which allows users to compile, build tests and test runners (also supports CppUTest unit test library). Script also is responsible for test execution on devices selected by configuration files.
17+
```singletest.py``` script located in ```mbed/tools/``` is a test suite script which allows users to compile, build tests and test runners (also supports CppUTest unit test library). Script also is responsible for test execution on devices selected by configuration files.
1818

1919
### Parameters of singletest.py
2020

@@ -37,7 +37,7 @@ After connecting boards to our host machine (PC) we can check which serial ports
3737
* ```NUCLEO_F103RB``` serial port is on ```COM11``` and disk drive is ```I:```.
3838
If you are working under Linux your port and disk could look like /dev/ttyACM5 and /media/usb5.
3939

40-
This information is needed to create ```muts_all.json``` configuration file. You can create it in ```mbed/workspace_tools/``` directory:
40+
This information is needed to create ```muts_all.json``` configuration file. You can create it in ```mbed/tools/``` directory:
4141
```
4242
$ touch muts_all.json
4343
```
@@ -67,8 +67,8 @@ Its name will be passed to ```singletest.py``` script after ```-M``` (MUTs speci
6767

6868
Note: We will leave field ```peripherals``` empty for the sake of this example. We will explain it later. All you need to do now is to properly fill fields ```mcu```, ```port``` and ```disk```.
6969

70-
Note: Please make sure files muts_all.json and test_spec.json are in workspace_tools/ directory. We will assume in this example they are.
71-
Where to find ```mcu``` names? You can use option ```-S``` of ```build.py``` script (in ```mbed/workspace_tools/``` directory) to check all supported off-line MCUs names.
70+
Note: Please make sure files muts_all.json and test_spec.json are in tools/ directory. We will assume in this example they are.
71+
Where to find ```mcu``` names? You can use option ```-S``` of ```build.py``` script (in ```mbed/tools/``` directory) to check all supported off-line MCUs names.
7272

7373
Note: If you update mbed device firmware or even disconnect / reconnect mbed device you may find that serial port / disk configuration changed. You need to update configuration file accordingly or you will face connection problems and obviously tests will not run.
7474

@@ -172,9 +172,9 @@ For our example purposes let's assume we only have Keil ARM compiler, so let's c
172172
```
173173
#### Run your tests
174174

175-
After you configure all your MUTs and compilers you are ready to run tests. Make sure your devices are connected and your configuration files reflect your current configuration (serial ports, devices). Go to workspace_tools directory in your mbed location.
175+
After you configure all your MUTs and compilers you are ready to run tests. Make sure your devices are connected and your configuration files reflect your current configuration (serial ports, devices). Go to tools directory in your mbed location.
176176
```
177-
$ cd workspace_tools/
177+
$ cd tools/
178178
```
179179
and execute test suite script.
180180
```
@@ -244,7 +244,7 @@ In below example we would like to have all test binaries called ```firmware.bin`
244244
```
245245
$ python singletest.py -i test_spec.json -M muts_all.json --firmware-name firmware
246246
```
247-
* Where to find test list? Tests are defined in file ```tests.py``` in ```mbed/workspace_tools/``` directory. ```singletest.py``` uses test metadata in ```tests.py``` to resolve libraries dependencies and build tests for proper platforms and peripherals. Option ```-R``` can be used to get test names and direct path and test configuration.
247+
* Where to find test list? Tests are defined in file ```tests.py``` in ```mbed/tools/``` directory. ```singletest.py``` uses test metadata in ```tests.py``` to resolve libraries dependencies and build tests for proper platforms and peripherals. Option ```-R``` can be used to get test names and direct path and test configuration.
248248
```
249249
$ python singletest.py -R
250250
+-------------+-----------+---------------------------------------+--------------+-------------------+----------+--------------------------------------------------------+
@@ -344,7 +344,7 @@ test_spec.json:
344344
```
345345
Note:
346346
* Please make sure device is connected before we will start running tests.
347-
* Please make sure files ```muts_all.json``` and ```test_spec.json``` are in ```mbed/workspace_tools/``` directory.
347+
* Please make sure files ```muts_all.json``` and ```test_spec.json``` are in ```mbed/tools/``` directory.
348348
Now you can call test suite and execute tests:
349349
```
350350
$ python singletest.py -i test_spec.json -M muts_all.json
@@ -451,7 +451,7 @@ We want to create directory structure similar to one below:
451451
└───mbed
452452
├───libraries
453453
├───travis
454-
└───workspace_tools
454+
└───tools
455455
```
456456

457457
Please go to directory with your project. For example it could be c:\Projects\Project.
@@ -492,7 +492,7 @@ $ git clone https://github.com/mbedmicro/mbed.git
492492
$ hg clone https://mbed.org/users/rgrover1/code/cpputest/
493493
```
494494

495-
After above three steps you should have proper directory structure. All you need to do now is to configure your ```private_settings.py``` in ```mbed/workspace_tools/``` directory. Please refer to mbed SDK build script documentation for details.
495+
After above three steps you should have proper directory structure. All you need to do now is to configure your ```mbed_settings.py``` in ```mbed``` directory. Please refer to mbed SDK build script documentation for details.
496496

497497
## CppUTest with mbed port
498498
To make sure you actualy have CppUTest library with mbed SDK port you can go to CppUTest ```armcc``` platform directory:
@@ -577,7 +577,7 @@ utest
577577
```
578578

579579
## Define unit tests in mbed SDK test suite structure
580-
All tests defined in test suite are described in ```mbed/workspace_tools/tests.py``` file. This file stores data structure ```TESTS``` which is a list of simple structures describing each test. Below you can find example of ```TESTS``` structure which is configuring one of the unit tests.
580+
All tests defined in test suite are described in ```mbed/tools/tests.py``` file. This file stores data structure ```TESTS``` which is a list of simple structures describing each test. Below you can find example of ```TESTS``` structure which is configuring one of the unit tests.
581581
```
582582
.
583583
.

docs/mbed_targets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Adding and configuring mbed targets
22

3-
mbed uses JSON as a description language for its build targets. The JSON description of mbed targets can be found in `workspace_tools/targets.json`. To better understand how a target is defined, we'll use this example (taken from `targets.json`):
3+
mbed uses JSON as a description language for its build targets. The JSON description of mbed targets can be found in `tools/targets.json`. To better understand how a target is defined, we'll use this example (taken from `targets.json`):
44

55
```
66
"TEENSY3_1": {
@@ -173,4 +173,4 @@ This property is used to pass additional data to the project generator (used to
173173
```
174174

175175
The `target` property of `progen` specifies the target name that must be used for the exporter (if different than the mbed target name).
176-
For each exporter, a template for exporting can also be specified. In this example, the template used for generating a uVision project file is in a file called `uvision_microlib.uvproj.tmpl`. It is assumed that all the templates are located in `workspace_tools/export`.
176+
For each exporter, a template for exporting can also be specified. In this example, the template used for generating a uVision project file is in a file called `uvision_microlib.uvproj.tmpl`. It is assumed that all the templates are located in `tools/export`.

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
OWNER_NAMES = 'emilmont, bogdanm'
1717
1818

19-
# If private_settings.py exists in workspace_tools, read it in a temporary file
19+
# If mbed_settings.py exists in tools, read it in a temporary file
2020
# so it can be restored later
21-
private_settings = join('workspace_tools', 'private_settings.py')
21+
mbed_settings = join('mbed_settings.py')
2222
backup = None
23-
if isfile(private_settings):
23+
if isfile(mbed_settings):
2424
backup = TemporaryFile()
25-
with open(private_settings, "rb") as f:
25+
with open(mbed_settings, "rb") as f:
2626
copyfileobj(f, backup)
2727

28-
# Create the correct private_settings.py for the distribution
29-
with open(private_settings, "wt") as f:
28+
# Create the correct mbed_settings.py for the distribution
29+
with open(mbed_settings, "wt") as f:
3030
f.write("from mbed_settings import *\n")
3131

3232
setup(name='mbed-tools',
@@ -42,8 +42,8 @@
4242
license=LICENSE,
4343
install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.8.11,<0.9.0", "junit-xml", "requests", "pyYAML"])
4444

45-
# Restore previous private_settings if needed
45+
# Restore previous mbed_settings if needed
4646
if backup:
4747
backup.seek(0)
48-
with open(private_settings, "wb") as f:
48+
with open(mbed_settings, "wb") as f:
4949
copyfileobj(backup, f)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)