-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Description
The issue arises when using a *.cbuild.yml file. In CMSIS-Toolbox, the IAR compiler's elf file extension is fixed to ".out" which is not a supported extension for pyOCD.
I would like to contribute but I have thought about two ways of doing this and I would like more insight about which approach to go for:
- Add "out" directly in the FileProgrammer class's _format_handler member
- Modify the output property of CbuildRun class to include the file's type, and then in the LoadSubcommand's invoke method, we pass the acquired value to the programmer. The code would look something like this :
@property
def output(self) -> Dict[str, Dict[str, Union[str, Optional[int]]]]:
"""@brief Set of loadable output files (file, offset)."""
"""same code above"""
load_files = {}
for f in loadable_files:
# Get load offset (None if not specified)
offset = f.get('load-offset')
fileType = f.get('type')
# Add filename and its offset and file type to return value
load_files[f['file']] = {
"offset" : offset,
"type" : fileType,
}
LOG.debug("Loadable file: %s", f['file'])
return load_filesAnd for the load command :
# Look for a base address suffix. If the supplied argument including an address suffix
# references an existing file, then the address suffix is not extracted.
if "@" in filename and not file_path.exists():
filename, suffix = filename.rsplit("@", 1)
try:
base_address = int_base_0(suffix)
except ValueError:
LOG.error(f'Base address suffix "{suffix}" on file "{filename}" is not a valid integer address')
return 1
else:
base_address = self._args.base_address
if base_address is None and self._args.cbuild_run:
base_address = cbuild_files[filename]["offset"]
if self._args.cbuild_run:
self._args.format = cbuild_files[filename]["type"]The first method is enough to solve the problem because the file extensions are hard coded in CMSIS-Toolbox and do not yet allow for custom file extensions, see the link.
However the second method feels more universal, regardless of the compiler and could be more flexible in the future if they decided to go with allowing users to customize file extensions.
Metadata
Metadata
Assignees
Labels
No labels