Skip to content

Variable {runtime.hardware.path} not evaluated on board in sketchbook #1971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
grzybsonssg opened this issue Nov 10, 2022 · 2 comments · Fixed by #1978
Closed
3 tasks done

Variable {runtime.hardware.path} not evaluated on board in sketchbook #1971

grzybsonssg opened this issue Nov 10, 2022 · 2 comments · Fixed by #1978
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@grzybsonssg
Copy link

Describe the problem

Hi
I have issue with 3rd party board installed through the sketchbook (user folder).
Variable {runtime.hardware.path} is not properly evaluated, whereas other variables are replaced with proper values.
{runtime.hardware.path} is global variable that should by evaluated always, right?

To reproduce

Just try to install Roger Clark's STM32 board following his instruction.
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Installation

Compilation of sketch goes without any problem, but it fails on upload due to inability to evaluate variable.
obraz

Of course I can replace the variable placeholder with absolute path in platform.txt and then it runs flawlessly. But that's a hack.

Full verbose output of compile and upload in attachment.

arduino_stm32_output.txt

Expected behavior

{runtime.hardware.path} is properly evaluated to c:\users\grzybson\Documents\Arduino\hardware\Arduino_STM32\

Arduino IDE version

2.01

Operating system

Windows

Operating system version

10 Pro 22H2

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@grzybsonssg grzybsonssg added the type: imperfection Perceived defect in any part of project label Nov 10, 2022
@grzybsonssg
Copy link
Author

Less nasty hack. I replaced all occurrences of {runtime.hardware.path} with {runtime.platform.path}/...
{runtime.hardware.path} evaluates correctly and by adding .. I point where I want to.

@per1234 per1234 transferred this issue from arduino/arduino-ide Nov 11, 2022
@per1234
Copy link
Contributor

per1234 commented Nov 11, 2022

Thanks for your report @grzybsonssg. In case it will be useful for the preparation and validation of a fix, I'll provide a minimal demonstration of the bug:

I created a minimal boards platform that uses a build hook to print {runtime.platform.path} to the verbose console output during the compilation action, and the upload pattern to print it during the upload action: foo.zip

$ arduino-cli version

arduino-cli  Version: nightly-20221111 Commit: 79e6484 Date: 2022-11-11T01:35:52Z

$ export ARDUINO_DIRECTORIES_USER="/tmp/arduino-cli-directories/user"

$ mkdir --parents "$ARDUINO_DIRECTORIES_USER/hardware"

$ wget --output-document="$ARDUINO_DIRECTORIES_USER/hardware/foo.zip" https://github.com/arduino/arduino-cli/files/9987156/foo.zip

[...]

$ unzip "$ARDUINO_DIRECTORIES_USER/hardware/foo.zip" -d "$ARDUINO_DIRECTORIES_USER/hardware"  # Install the demo platform

Archive:  /tmp/arduino-cli-directories/user/hardware/foo.zip
   creating: /tmp/arduino-cli-directories/user/hardware/foo/
   creating: /tmp/arduino-cli-directories/user/hardware/foo/avr/
  inflating: /tmp/arduino-cli-directories/user/hardware/foo/avr/boards.txt  
  inflating: /tmp/arduino-cli-directories/user/hardware/foo/avr/platform.txt  

$ arduino-cli core update-index

Downloading index: package_index.tar.bz2 downloaded 

$ arduino-cli core install arduino:avr  # Install dependency of the demo platform

[...]

$ arduino-cli sketch new "$ARDUINO_DIRECTORIES_USER/Qux"

$ arduino-cli compile --fqbn foo:avr:bar --upload --verbose "$ARDUINO_DIRECTORIES_USER/Qux"

[...]
echo /tmp/arduino-cli-directories/user/hardware/foo
/tmp/arduino-cli-directories/user/hardware/foo
[...]
echo {runtime.hardware.path}
{runtime.hardware.path}
[...]

🐛 The {runtime.hardware.path} property reference was not expanded in the upload pattern.

The property reference is expanded as expected in the upload pattern when using Arduino IDE 1.8.19:

echo /tmp/arduino-cli-directories/user/hardware/foo
/tmp/arduino-cli-directories/user/hardware/foo

@per1234 per1234 added the topic: code Related to content of the project itself label Nov 11, 2022
@cmaglie cmaglie added this to the Arduino CLI 1.0 milestone Nov 16, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants