6 years, 7 months ago.

Cannot export to IDE from mbed-cli

I'm unable to export a project to an offline IDE from mbed-cli. What am I doing wrong, or how can I fix the exporter?

Also, where can I see a list of the parameters that can be passed to the -i argument of mbed export for the IDE?

Details

On earlier attempts, upon issuing this command, Python complained about missing packages, so I did pip install beautifulsoup4 and pip install fuzzywuzzy. Now I get what's shown below.

C:\dev\external\new2\lpc4088_ebb_ptp>mbed export -i mcuxpresso -m LPC4088 -vv
[mbed] Working path "C:\dev\external\new2\lpc4088_ebb_ptp" (program)
[mbed] Exec "C:\Python27\python.exe -u C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\project.py -i mcuxpresso -m LPC4088 --source ." in C:\dev\external\new2\lpc4088_ebb_ptp
Using targets from C:\dev\external\new2\lpc4088_ebb_ptp\.temp\legacy_targets.json
Error parsing 'C:\dev\external\new2\lpc4088_ebb_ptp\.temp\legacy_targets.json':
Traceback (most recent call last):
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\project.py", line 297,
in <module>
    main()
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\project.py", line 293,
in main
    build_profile=profile, app_config=options.app_config)
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\project.py", line 111,
in export
    set_targets_json_location(targets_json)
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\targets\__init__.py", line 576, in set_targets_json_location
    update_target_data()
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\targets\__init__.py", line 542, in update_target_data
    in Target.get_json_target_data().items()
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\targets\__init__.py", line 69, in wrapper
    CACHES[(func.__name__, args)] = func(*args, **kwargs)
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\targets\__init__.py", line 141, in get_json_target_data
    Target.__targets_json_location_default)
  File "C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\utils.py", line 362, in json_file_to_dict
    with open(fname, "r") as file_obj:
IOError: [Errno 2] No such file or directory: 'C:\\dev\\external\\new2\\lpc4088_ebb_ptp\\.temp\\legacy_targets.json'
[mbed] ERROR: "C:\Python27\python.exe" returned error code 1.
[mbed] ERROR: Command "C:\Python27\python.exe -u C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\project.py -i mcuxpresso -m LPC4088 --source ." in "C:\dev\external\new2\lpc4088_ebb_ptp"
---
posted by mbed official 11 Oct 2017

2 Answers

6 years, 7 months ago.

Hi,

As Sarah mentioned, the Mbed library version is very old (Rev.9 Oct, 2014). Note that mbed --version command shows version of Mbed CLI (command line tool), not Mbed library itself.

You can update the Mbed library as below.

delete .temp

cd mbed
mbed update
cd ..
mbed deploy

If you have particular reason not to update the library, my dirty hack is below:

Copy legacy_targets.json file from: C:\dev\external\new2\lpc4088_ebb_ptp\.temp\tools\legacy_targets.json

to: C:\dev\external\new2\lpc4088_ebb_ptp\.temp\legacy_targets.json

Accepted Answer

mbed update failed, as shown below. Where do I go from here?

C:\dev\external\new2\lpc4088_ebb_ptp\mbed>mbed update
[mbed] Updating library "mbed" to latest revision in the current branch
[mbed] Downloading library build "b484a57bc302" (might take a minute)
[mbed] ERROR: OS Error: The directory is not empty
---

I'm not sure which directory it's complaining about not being empty, but here's a directory listing of the mbed subdir:

C:\dev\external\new2\lpc4088_ebb_ptp\mbed>dir
 Volume in drive C is OSDisk

 Directory of C:\dev\external\new2\lpc4088_ebb_ptp\mbed

10/11/2017  12:53 PM    <DIR>          .
10/11/2017  12:53 PM    <DIR>          ..
10/12/2017  08:52 AM    <DIR>          .bld
10/12/2017  08:54 AM    <DIR>          552587b429a1
               0 File(s)              0 bytes
               4 Dir(s)  254,644,830,208 bytes free

C:\dev\external\new2\lpc4088_ebb_ptp\mbed>
posted by Brendan McDonnell 12 Oct 2017
$ mbed import https://os.mbed.com/users/embeddedartists/code/lpc4088_ebb_ptp/
$ cd lpc4088_ebb_ptp
$ cd EALib\FATFileSystem
$ mbed sync
$ cd ..\..
$ mbed deploy
$ cd mbed
$ mbed update
$ cd ..
$ mbed export -m LPC4088 -i mcuxpresso
posted by Toyomasa Watarai 13 Oct 2017
6 years, 7 months ago.

I imported mbed_blinky and ran your export command , and I did not receive this error.

It looks like you might have pulled a newer version of mbed into an old repo, which would have updated the tools, and some major changes were made between the revisions.

My suggestion:

  1. delete .tmp
  2. run mbed deploy

I had done mbed deploy before. Still, I tried your suggestion (deleting .temp/, and running mbed deploy). The problem persists.

I think someone has now deleted a comment which asked for the results of mbed --version. It says 1.1.1 - before and after I tried mbed deploy.

Here are the commands I had run before (without their output). Obviously I'm not using mbed_blinky...

mbed import https://os.mbed.com/users/embeddedartists/code/lpc4088_ebb_ptp/
cd lpc4088_ebb_ptp
cd EALib\FATFileSystem
mbed sync
cd ../..
mbed deploy
posted by Brendan McDonnell 11 Oct 2017