nigelb / platform-apollo3blue

AmbiqMicro Apollo 3 Blue: development platform for PlatformIO
Apache License 2.0
30 stars 12 forks source link

The solution to the lack of ‘tool-jlink’ after the Manual installation of Sparkfun/Arduino_Apollo3 on MacOS 10.12.6. #38

Closed nigelb closed 2 years ago

nigelb commented 2 years ago

Discussed in https://github.com/nigelb/platform-apollo3blue/discussions/37

Originally posted by **Sailor-Chenyang** April 18, 2022 ### Situation: In the [OpenMetBuoy project](https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/main/development_environment/setup_platformio_environment/Instructions.md#installing-the-sparkfun-ambiq-apollo3-core-v1-platformio-core), It needs to use the [nigelb](https://github.com/nigelb)/[platform-apollo3blue](https://github.com/nigelb/platform-apollo3blue). After installing Sparkfun/Arduino_Apollo3 on MacOS 10.12.6, there was a problem when creating a new project through Platformio. ### Error: I tried to install Apollo3 based on Platformio on both VS Code and CLion, but I encountered the same error when creating a new project: > TypeError: expected str, bytes or os.PathLike object, not NoneType:   File "/Users/yaochenyang/.platformio/penv/lib/python3.6/site-packages/platformio/builder/main.py", line 181:     env.SConscript("$BUILD_SCRIPT")   File "/Users/yaochenyang/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 597:     return _SConscript(self.fs, *files, **subst_kw)   File "/Users/yaochenyang/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 285:     exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)   File "/Users/yaochenyang/.platformio/platforms/apollo3blue/builder/main.py", line 125:     env.SConscript(join("helpers", "targets.py"), exports="env")   File "/Users/yaochenyang/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 597:     return _SConscript(self.fs, *files, **subst_kw)   File "/Users/yaochenyang/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 285:     exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)   File "/Users/yaochenyang/.platformio/platforms/apollo3blue/builder/helpers/targets.py", line 89:     add_jlink_swo(env)   File "/Users/yaochenyang/.platformio/platforms/apollo3blue/builder/helpers/targets.py", line 50:     program = join(platform_apollo3blue.get_package_dir("tool-jlink"), program)   File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/posixpath.py", line 80:     a = os.fspath(a) ========================== [FAILED] Took 0.59 seconds ========================== ### The reason for this error: The tool-Jlink was missing in the ~/.platformio/packages. I have to install the nigelb/platform-apollo3blue at first. Otherwise, there is no ‘Sparkfun RedBoard Artemis’ in the board options when I create a new project. The Manual installation of Apollo3 wouldn’t install the tool-Jlink automatically. ### Solutions: **1.** create an optional board that uses tool-jlink Because that PlatformIO can automatically install the [tool-jlink](https://registry.platformio.org/tools/platformio/tool-jlink/installation). This information can be obtained from ['Used by']( https://registry.platformio.org/tools/platformio/tool-jlink/insights/dependents) For instance, It’s feasible to create a project based on SiFive https://registry.platformio.org/platforms/platformio/sifive,then, [tool-jlink](https://registry.platformio.org/tools/platformio/tool-jlink/installation) can be automatically installed in the packages. **2.** Manual install of Jlink **2.1** We can Manually install the Jlink from the [segger’s website](https://www.segger.com/downloads/jlink/). The file path installed on the macOS is ~/applications/segger, where you can find the folder of JLINK. Then, JLINK_v686a is copied or linked to ~/platformio/packages/tool-jlink. **2.2** write a package.json to describe this package ` ~/.platformio/packages/tool-jlink$ vim package.json` The details are as follows: > { "description": "Software and Documentation Pack for SEGGER J-Link debug probes", "homepage": "https://www.segger.com/downloads/jlink/", "keywords": [ "tools", "debugger", "debug server", "uploader" ], "name": "tool-jlink", "system": [ "darwin_x86_64", "darwin_arm64" ], "version": "1.75001.0" } TADA! The problem has been solved.
nigelb commented 2 years ago

Hi @Sailor-Chenyang, this is actually a bug.

Thanks for finding it. It is caused by a couple of extra targets that I added that inadvertently assumed that the tools-jlink package is installed. I have fixed it and will push it shortly.