Skip to content

STM32_Programmer.sh not found #63

Closed

Description

@bsamadi

STM32_Programmer.sh is in /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin and this folder is added to the path. I can run STM32_Programmer.sh in the terminal with no issues.

However, Arduino IDE complains that STM32_Programmer.sh was not found.

When I checked, the PATH inside stm32CubeProg.sh was different from the one in the terminal.

I even changed $HOME to /usr/local in stm32CubeProg.sh but the error is still the same.

Activity

  1. fpistm commented on May 2, 2020

    @fpistm
    Member

    Seems strange.
    Which version of Arduino IDE you used?
    Coud you echo the $PATH in the stm32CubeProg.sh

  2. bsamadi commented on May 2, 2020

    @bsamadi
    Author

    version: 1.8.12
    PATH in stm32CubeProg.sh:
    /snap/arduino/14/java/bin:/snap/arduino/14/usr/sbin:/snap/arduino/14/usr/bin:/snap/arduino/14/sbin:/snap/arduino/14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

  3. fpistm commented on May 2, 2020

    @fpistm
    Member

    So STM32cubeprogrammer is not in the path.
    How you launch the IDE?

  4. bsamadi commented on May 2, 2020

    @bsamadi
    Author

    The PATH that I showed is at the beginning of stm32CubeProg.sh, coming from the echo $PATH command in this picture:

    One issue is that this PATH is different from the PATH in the user environment.
    The other issue is that I modified stm32CubeProg.sh (see the above picture) and added the installation folder of STM32_Programmer.sh to the PATH. However, I still get this error:

    I have installed Arduino IDE through "Software" in Ubuntu and I run it from the start menu. I also tried running it from the terminal. In both cases, the PATH in stm32CubeProg.sh is different from the PATH defined in the user environment. I am wondering where stm32CubeProg.sh gets its PATH.

    The command -v STM32_Programmer.sh command works fine in the terminal:

  5. fpistm commented on May 2, 2020

    @fpistm
    Member

    Try to launch arduino from the terminal.

  6. fpistm commented on May 2, 2020

    @fpistm
    Member

    From:
    https://help.ubuntu.com/community/EnvironmentVariables

    Launching desktop application with an environment variable
    You can add an environment variable to an application by editing its .desktop file. For example, to run "digiKam" with the environment variable APPMENU_DISPLAY_BOTH=1, find the corresponding digikam.desktop file and add the setting of the variable, via the env command, to the entry "Exec":

    Exec=env APPMENU_DISPLAY_BOTH=1 digikam -caption "%c" %i

    Lauching from desktop application has a different env.
    That's why it's not work. So add it as explained.

  7. bsamadi commented on May 2, 2020

    @bsamadi
    Author

    It seems that the issue originates from the fact that Ubuntu installs Arduino IDE using snap. This is how PATH is defined in snap (https://snapcraft.io/docs/environment-variables):

    If you want to use STM32duino, do not install Arduino IDE through Software in Ubuntu or snap.

    Thank you @fpistm for your time!

  8. fpistm commented on May 2, 2020

    @fpistm
    Member

    Ok , anyway you need to have the cube programmer in the path. There is no bug. This works as expected and warn user that it cannot be found.

  9. bsamadi commented on May 2, 2020

    @bsamadi
    Author

    It would be great if a new user could follow these steps to use STM32duino:

    • install Arduino IDE through Software in Ubuntu
    • install STM32CubeProg in its default location (/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer)
    • follow the instructions in Getting Started

    Currently, there are two issues with this workflow:

    1. Ubuntu uses snap to install Arduino IDE and snap does not use the default user PATH
    2. If stm32CubeProg.sh doesn't find STM32_Programmer.sh in PATH, it looks for it in $HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin not the default installation path, which is: /usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin.
  10. fpistm commented on May 4, 2020

    @fpistm
    Member

    @bsamadi

    * install [STM32CubeProg](https://www.st.com/en/development-tools/stm32cubeprog.html) in its default location (`/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer`)
    

    As far as I can tell is this is not the default location.

    Ubuntu uses snap to install Arduino IDE and snap does not use the default user PATH

    Yes, so up to end user to provide the correct environment.

    2\. If `stm32CubeProg.sh` doesn't find `STM32_Programmer.sh` in PATH, it looks for it in `$HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin` not the default installation path, which is: `/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin`.
    

    Yes, as it is the default path as far as I can tell.

    How did you install the CubeProgrammer?

  11. bsamadi commented on May 4, 2020

    @bsamadi
    Author

    @fpistm, I checked again. You are absolutely right. I had changed the default installation folder. STM32duino works just fine. My main problem was the Arduino IDE installed by snap.

    Thank you!

  12. fpistm commented on May 4, 2020

    @fpistm
    Member

    Welcome.
    Thanks to have checked again.
    About snap it is fine to be aware of this issue.

  13. Diatrix commented on May 15, 2020

    @Diatrix

    @bsamadi What was your solution then? Uninstall the Arduino IDE and reinstall it though command line?

  14. bsamadi commented on May 16, 2020

    @bsamadi
    Author

    Yes, I followed the instructions here.

  15. ggatis commented on Aug 17, 2021

    @ggatis

    Or change file stm32CubeProg.sh:
    line
    export PATH="$HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin":$PATH
    to
    export PATH="/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin":$PATH

  16. blaisegassend commented on Feb 11, 2024

    @blaisegassend

    I noticed that when running from arduino in a snap, HOME is set to:
    /home/my_user_name/snap/arduino/85

    By installing STMicroelectronics into /home/my_user_name/snap/arduino/85 instead of /home/my_user_name, the snap version of arduino was able to find it just fine.

    You can probably do this automatically by running
    snap run --shell arduino
    and running SetupSTM32CubeProgrammer-2.15.0.linux from there. Or you can just install normally and copy/move.

  17. rtek1000 commented on Jan 27, 2025

    @rtek1000

    The problem is caused when installing SetupSTM32CubeProgrammer-x.xx.x.linux using sudo or root. If installed without elevation, it will be installed in the user's home.

    Wrong:

    sudo ./SetupSTM32CubeProgrammer-2.13.0.linux

    Path: /usr/local/STMicroelectronics/STM32Cube/

    Correct:

    ./SetupSTM32CubeProgrammer-2.13.0.linux

    Path: /home/user/STMicroelectronics/STM32Cube/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions