4 years, 2 months ago.

Python error exporting from mbed CLI to LPC1768 MCUXpresso

I have an mbed project that compiles and flashes fine using mbed CLI. I build with this command:

mbed compile --target lpc1768 --toolchain GCC_ARM

And I can then flash it using the MCUXpresso command line tools. Now I'd like to bring the project into MCUXpresso so I can use the debugger. When I do that I get an python error:

$ mbed export -i mcuxpresso -m lpc1768 -v
[mbed] Working path "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0" (program)
[mbed] Exec "/Applications/MBEDCLI.app/Contents/Resources/miniconda/bin/python -u /Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/project.py -i mcuxpresso -m lpc1768 --source ." in "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0"
Scan: xyzzy_1.0
Traceback (most recent call last):
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/project.py", line 379, in <module>
    main()
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/project.py", line 371, in main
    ignore=options.ignore
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/project.py", line 152, in export
    ignore=ignore
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/export/__init__.py", line 285, in export_project
    macros=macros)
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/export/__init__.py", line 161, in generate_project_files
    exporter.generate()
  File "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/export/mcuxpresso/__init__.py", line 85, in generate
    self.libraries = libraries
AttributeError: can't set attribute
[mbed] ERROR: "/Applications/MBEDCLI.app/Contents/Resources/miniconda/bin/python" returned error.
       Code: 1
       Path: "/Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0"
       Command: "/Applications/MBEDCLI.app/Contents/Resources/miniconda/bin/python -u /Users/sravet/Documents/MCUXpressoIDE_10.2.1/workspace/xyzzy_1.0/mbed-os/tools/project.py -i mcuxpresso -m lpc1768 --source ."
       Tip: You could retry the last command with "-v" flag for verbose output

I'm using the CLI on macOS, and I installed it using the macOS installer. I've done all of this just today, so everything should be up-to-date. Python version in the CLI shell is Python 2.7.14 :: Anaconda, Inc.

any help would be appreciated, thanks steve

1 Answer

4 years, 2 months ago.

If it fit to your project try to use Python 3.7 it seems to appear because of lack of library attributes. At https://www.python.org/downloads/ you can download necessary version totally free for any OS from this official site. If this won't help you can ask for assignment help in any time from support

I don't know how to put a new python version into the mbed CLI. And, I think it should work as a package (CLI environment and the bundled python). However I did fix the problem by changing:

self.libraries = libraries

to

self.libraries.append(libraries)

at the referenced line 85.

Both self.libraries and libraries are empty lists, so it doesn't really matter.

posted by Steve Ravet 05 Oct 2018