Skip to content

Correcting parameters '-o' and '--app-config' #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ The arguments for *compile* are:
* `-t <TOOLCHAIN>` to select a toolchain (of those defined in `mbed_settings.py`, see above). The value can be either `ARM` (ARM Compiler 5), `GCC_ARM` (GNU ARM Embedded), or `IAR` (IAR Embedded Workbench for ARM).
* `--source <SOURCE>` to select the source directory. The default is `.` (the current directorty). You can specify multiple source locations, even outside the program tree.
* `--build <BUILD>` to select the build directory. Default: `BUILD/` inside your program.
* `--options <OPTIONS>` to select compile options. Examples: "debug-info": will generate debugging information; "small-build" will use microlib/nanolib, but limit RTOS to single thread; "save-asm": will save the asm generated by the compiler
* `--profile <PATH_TO_BUILD_PROFILE>` to select a path to a build profile configuration file. Example: mbed-os/tools/profiles/debug.json
* `--library` to compile the code as a [static .a/.ar library](#compiling-static-libraries).
* `--config` to inspect the run-time compile configuration (see below).
* `-S` or `--supported` shows a matrix of the supported targets and toolchains.
Expand Down Expand Up @@ -430,13 +430,13 @@ $ mbed compile -t GCC_ARM -m K64F -c -DUVISOR_PRESENT

___Compiling in debug mode___

To compile in debug mode (as opposed to the default *release* mode) use `-o debug-info` in the compile command line:
To compile in debug mode (as opposed to the default *release* mode) use `--profile mbed-os/tools/profiles/debug.json` in the compile command line:

```
$ mbed compile -t GCC_ARM -m K64F -o debug-info
$ mbed compile -t GCC_ARM -m K64F --profile mbed-os/tools/profiles/debug.json
```

<span class="tips">**Tip:** If you have files that you want to compile only in release mode, put them in a directory called `TARGET_RELEASE` at any level of your tree. If you have files that you want to compile only in debug mode, put them in a directory called `TARGET_DEBUG` at any level of your tree (then use `-o debug-info` as explained above).
<span class="tips">**Tip:** If you have files that you want to compile only in release mode, put them in a directory called `TARGET_RELEASE` at any level of your tree. If you have files that you want to compile only in debug mode, put them in a directory called `TARGET_DEBUG` at any level of your tree (then use `--profile` as explained above).
</span>

### Automating toolchain and target selection
Expand Down Expand Up @@ -510,7 +510,7 @@ The arguments to `test` are:
* `-n <TESTS_BY_NAME>` to limit the tests built or ran to a comma separated list (ex. test1,test2,test3)
* `--source <SOURCE>` to select the source directory. Default is `.` (the current dir). You can specify multiple source locations, even outside the program tree.
* `--build <BUILD>` to select the build directory. Default: `BUILD/` inside your program.
* `--options <OPTIONS>` to select compile options. Examples: "debug-info": will generate debugging information; "small-build" will use microlib/nanolib, but limit RTOS to single thread; "save-asm": will save the asm generated by the compiler
* `--profile <PATH_TO_BUILD_PROFILE>` to select a path to a build profile configuration file. Example: mbed-os/tools/profiles/debug.json
* `-c or --clean` to clean the build directory before compiling,
* `--test-spec <TEST_SPEC>` to set the path for the test spec file used when building and running tests (the default path is the build directory).
* `-v` or `--verbose` for verbose diagnostic output.
Expand Down
20 changes: 9 additions & 11 deletions mbed/mbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,7 @@ def status_(ignore=False):
@subcommand('compile',
dict(name=['-t', '--toolchain'], help='Compile toolchain. Example: ARM, GCC_ARM, IAR'),
dict(name=['-m', '--target'], help='Compile target MCU. Example: K64F, NUCLEO_F401RE, NRF51822...'),
dict(name=['-o', '--options'], action='append', help='Compile options. Examples: "debug-info": generate debugging information; "small-build" to use microlib/nanolib, but limit RTOS to single thread; "save-asm": save the asm generated by the compiler'),
dict(name=['--profile'], action='append', help='Path of a build profile configuration file. Example: mbed-os/tools/profiles/debug.json'),
dict(name='--library', dest='compile_library', action='store_true', help='Compile the current program or library as a static library.'),
dict(name='--config', dest='compile_config', action='store_true', help='Show run-time compile configuration'),
dict(name='--prefix', dest='config_prefix', action='append', help='Restrict listing to parameters that have this prefix'),
Expand All @@ -2026,7 +2026,7 @@ def status_(ignore=False):
dict(name='--app-config', dest="app_config", help="Path of an app configuration file (Default is to look for 'mbed_app.json')"),
help='Compile code using the mbed build tools',
description=("Compile this program using the mbed build tools."))
def compile_(toolchain=None, target=None, options=False, compile_library=False, compile_config=False, config_prefix=None, source=False, build=False, clean=False, artifact_name=None, supported=False, app_config=None):
def compile_(toolchain=None, target=None, profile=False, compile_library=False, compile_config=False, config_prefix=None, source=False, build=False, clean=False, artifact_name=None, supported=False, app_config=None):
# Gather remaining arguments
args = remainder
# Find the root of the program
Expand Down Expand Up @@ -2061,7 +2061,7 @@ def compile_(toolchain=None, target=None, options=False, compile_library=False,
# Compile configuration
popen(['python', os.path.join(tools_dir, 'get_config.py')]
+ ['-t', tchain, '-m', target]
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
+ list(chain.from_iterable(izip(repeat('--source'), source)))
+ (['-v'] if verbose else [])
+ (list(chain.from_iterable(izip(repeat('--prefix'), config_prefix))) if config_prefix else []),
Expand All @@ -2074,7 +2074,7 @@ def compile_(toolchain=None, target=None, options=False, compile_library=False,
popen(['python', '-u', os.path.join(tools_dir, 'build.py')]
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
+ ['-t', tchain, '-m', target]
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
+ list(chain.from_iterable(izip(repeat('--source'), source)))
+ ['--build', build]
+ (['-c'] if clean else [])
Expand All @@ -2090,7 +2090,7 @@ def compile_(toolchain=None, target=None, options=False, compile_library=False,
popen(['python', '-u', os.path.join(tools_dir, 'make.py')]
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
+ ['-t', tchain, '-m', target]
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
+ list(chain.from_iterable(izip(repeat('--source'), source)))
+ ['--build', build]
+ (['-c'] if clean else [])
Expand All @@ -2114,13 +2114,13 @@ def compile_(toolchain=None, target=None, options=False, compile_library=False,
dict(name=['-n', '--tests-by-name'], dest='tests_by_name', help='Limit the tests to a list (ex. test1,test2,test3)'),
dict(name='--source', action='append', help='Source directory. Default: . (current dir)'),
dict(name='--build', help='Build directory. Default: build/'),
dict(name=['-o', '--options'], action='append', help='Compile options. Examples: "debug-info": generate debugging information; "small-build" to use microlib/nanolib, but limit RTOS to single thread; "save-asm": save the asm generated by the compiler'),
dict(name=['--profile'], action='append', help='Path of a build profile configuration file. Example: mbed-os/tools/profiles/debug.json'),
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory before compiling'),
dict(name='--test-spec', dest="test_spec", help="Path used for the test spec file used when building and running tests (the default path is the build directory)"),
dict(name='--app-config', dest="app_config", help="Path of an app configuration file (Default is to look for 'mbed_app.json')"),
help='Find, build and run tests',
description=("Find, build, and run tests in a program and libraries"))
def test_(toolchain=None, target=None, compile_list=False, run_list=False, compile_only=False, run_only=False, tests_by_name=None, source=False, options=False, build=False, clean=False, test_spec=None, app_config=None):
def test_(toolchain=None, target=None, compile_list=False, run_list=False, compile_only=False, run_only=False, tests_by_name=None, source=False, profile=False, build=False, clean=False, test_spec=None, app_config=None):
# Gather remaining arguments
args = remainder
# Find the root of the program
Expand Down Expand Up @@ -2158,7 +2158,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi

if compile_list:
popen(['python', '-u', os.path.join(tools_dir, 'test.py'), '--list']
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
+ ['-t', tchain, '-m', target]
+ list(chain.from_iterable(izip(repeat('--source'), source)))
+ (['-n', tests_by_name] if tests_by_name else [])
Expand All @@ -2170,7 +2170,7 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
if compile_only or build_and_run_tests:
popen(['python', '-u', os.path.join(tools_dir, 'test.py')]
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
+ list(chain.from_iterable(izip(repeat('--profile'), profile or [])))
+ ['-t', tchain, '-m', target]
+ (['-c'] if clean else [])
+ list(chain.from_iterable(izip(repeat('--source'), source)))
Expand All @@ -2186,15 +2186,13 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
popen(['mbedgt', '--test-spec', test_spec, '--list']
+ (['-n', tests_by_name] if tests_by_name else [])
+ (['-V'] if verbose else [])
+ (['--app-config', app_config] if app_config else [])
+ args,
env=env)

if run_only or build_and_run_tests:
popen(['mbedgt', '--test-spec', test_spec]
+ (['-n', tests_by_name] if tests_by_name else [])
+ (['-V'] if verbose else [])
+ (['--app-config', app_config] if app_config else [])
+ args,
env=env)

Expand Down