Skip to content

config: failure to override target attributes #109

@hugueskamba

Description

@hugueskamba

Description

mbed-tools fails to parse mbed_app.json when target attributes are overridden.

Steps to reproduce:

  1. Clone https://github.com/ARMmbed/mbed-os-example-blinky-baremetal/tree/feature-cmake
  2. Ensure the example project uses the master branch of Mbed OS (https://github.com/ARMmbed/mbed-os)
  3. Run mbedtools build -t <TOOLCHAIN> -m <MBED_TARGET> -c

Expect result:
The application is successfully built.

Actual result:

Configuring project and generating build system...
Traceback (most recent call last):
  File "/usr/local/bin/mbedtools", line 33, in <module>
    sys.exit(load_entry_point('mbed-tools', 'console_scripts', 'mbedtools')())
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/cli/main.py", line 37, in invoke
    super().invoke(context)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/cli/build.py", line 57, in build
    generate_config(mbed_target.upper(), toolchain, program)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/build/config.py", line 27, in generate_config
    config = assemble_config(target_build_attributes, program.root, program.files.app_config_file)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/build/_internal/config/assemble_build_config.py", line 23, in assemble_config
    return _assemble_config_from_sources_and_lib_files(target_attributes, mbed_lib_files, mbed_app_file)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/build/_internal/config/assemble_build_config.py", line 47, in _assemble_config_from_sources_and_lib_files
    return Config.from_sources(all_sources)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/build/_internal/config/config.py", line 119, in from_sources
    _update_config_option(config, key, value, source)
  File "/path/to/mbed/mbed-tools/src/mbed_tools/build/_internal/config/config.py", line 134, in _update_config_option
    f"Can't update option which does not exist."
ValueError: Can't update option which does not exist. Attempting to set 'target.c_lib' to 'small' in 'File: /path/to/mbed/examples/mbed-os-example-blinky-baremetal/mbed_app.json'.

If target.c_lib is removed from mbed)app.json but target.printf_lib is still there:

Configuring project and generating build system...
Traceback (most recent call last):
  File "/usr/local/bin/mbedtools", line 33, in <module>
    sys.exit(load_entry_point('mbed-tools', 'console_scripts', 'mbedtools')())
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/path/to/mbed-tools/src/mbed_tools/cli/main.py", line 37, in invoke
    super().invoke(context)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/path/to/user/Library/Python/3.7/lib/python/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/path/to/mbed-tools/src/mbed_tools/cli/build.py", line 57, in build
    generate_config(mbed_target.upper(), toolchain, program)
  File "/path/to/mbed-tools/src/mbed_tools/build/config.py", line 27, in generate_config
    config = assemble_config(target_build_attributes, program.root, program.files.app_config_file)
  File "/path/to/mbed-tools/src/mbed_tools/build/_internal/config/assemble_build_config.py", line 23, in assemble_config
    return _assemble_config_from_sources_and_lib_files(target_attributes, mbed_lib_files, mbed_app_file)
  File "/path/to/mbed-tools/src/mbed_tools/build/_internal/config/assemble_build_config.py", line 47, in _assemble_config_from_sources_and_lib_files
    return Config.from_sources(all_sources)
  File "/path/to/mbed-tools/src/mbed_tools/build/_internal/config/config.py", line 119, in from_sources
    _update_config_option(config, key, value, source)
  File "/path/to/mbed-tools/src/mbed_tools/build/_internal/config/config.py", line 134, in _update_config_option
    f"Can't update option which does not exist."
ValueError: Can't update option which does not exist. Attempting to set 'target.printf_lib' to 'minimal-printf' in 'File: /path/to/mbed-os-example-blinky-baremetal/mbed_app.json'.

Issue request type

  • Enhancement
  • Bug

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions