Skip to content

STM32_Programmer.sh not found in Ubuntu 18.04. Edited PATH, and still can't find it. #64

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
Diatrix opened this issue May 15, 2020 · 11 comments

Comments

@Diatrix
Copy link

Diatrix commented May 15, 2020

Hello,
I'm having issues uploading code to my STM32F103C8 board. When I try to upload the file, it throws out this error:

STM32_Programmer.sh not found.
An error occurred while uploading the sketch
Please install it or add '/bin' to your PATH environment:
https://www.st.com/en/development-tools/stm32cubeprog.html
Aborting!

I installed the STM32CubeProgrammer, to it's default location, which ended up being:
/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin

Then I tried editing my .bashrc file, and added the following line to the end of the file:
export PATH="/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin:$PATH"

I updated the .bashrc by using the following command:

$source ~/.bashrc

It still gives me the same error when I'm uploading the code.

Am I doing something wrong? I could use some help.

Thank you.

@fpistm
Copy link
Member

fpistm commented May 15, 2020

Hi @Diatrix
I think you have this issue:
#63

I installed the STM32CubeProgrammer, to it's default location, which ended up being:
/usr/local/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin

As I've mentionned this is not the default location.

@Diatrix
Copy link
Author

Diatrix commented May 15, 2020

I have exactly this issue. usr/local/STMicroelectronics.... is the default installation location when installing the software. For some reason (maybe it's outdated) stm32duino uses $HOME/STM.... as the default location, which is not.

What's curious is that the correct directory IS in the PATH variable, but the Arduino IDE can't find it.

I think the first issue is a bug, as it's looking somewhere that it's not on the default location of installation. The second issue seems to be an issue with the Arduino IDE, and should be addressed in the wiki.

Now I have to find out how to uninstall the damn program, as the uninstaller does nothing, so I can install it in the proper location ($HOME/...).

Do you think there's a way to change the location from $HOME/... to the proper /usr/local/...?

@fpistm
Copy link
Member

fpistm commented May 15, 2020

For some reason (maybe it's outdated) stm32duino uses $HOME/STM.... as the default location, which is not.

I've retested and /usr/... is not the default... so, how did you install it? I guess there is a reason whivh can explain why we don't have the same default path.

@Diatrix
Copy link
Author

Diatrix commented May 15, 2020

Ok, so I deleted the installation of the STM32CubeProgrammer, and installed it again, and now it installed it automatically on the $HOME directory. So something went wrong on the original installation. I had a directory path named STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin before installation on the $HOME directory so maybe that had something to do with it.

Regardless, I reinstalled it in the proper default directory, and I keep having the same issue. Any ideas?

@fpistm
Copy link
Member

fpistm commented May 15, 2020

Same issue, I guess Arduino IDE was installed using snap then env is not the same anyway I don't know why it does not find it if it is in your HOME as expected. Your best bet is to debug by adsing some test in the shell script.

@fpistm fpistm transferred this issue from stm32duino/Arduino_Core_STM32 May 18, 2020
@fpistm
Copy link
Member

fpistm commented May 18, 2020

Well, as mentioned in #63 could you try to install Arduino IDE following official recommendations:
#63 (comment)

@Diatrix
Copy link
Author

Diatrix commented May 20, 2020

Ok, I reinstalled the Arduino IDE not from the store, but from the file on the arduino.cc website and it works.

For people having this sort of issue in the future: Make sure that the STM32CubeProgrammer is installed in the right spot. Sometimes it doesn't pick the correct default path.
If it's installed on the right place, make sure that you didn't install the Arduino IDE from the store. Install it from the instructions as mentioned here.

It should work fine after that!

Thanks @fpistm for the help! :)

@Diatrix Diatrix closed this as completed May 20, 2020
@Tomaszu97
Copy link

Tomaszu97 commented Jun 7, 2020

Ok, I reinstalled the Arduino IDE not from the store, but from the file on the arduino.cc website and it works.

For people having this sort of issue in the future: Make sure that the STM32CubeProgrammer is installed in the right spot. Sometimes it doesn't pick the correct default path.
If it's installed on the right place, make sure that you didn't install the Arduino IDE from the store. Install it from the instructions as mentioned here.

It should work fine after that!

Thanks @fpistm for the help! :)

STM32CubeProgrammer picks /usr/local/ path when installed as root (or with sudo). Just run script without sudo.

@fpistm
Copy link
Member

fpistm commented Jun 8, 2020

STM32CubeProgrammer picks /usr/local/ path when installed as root (or with sudo). Just run script without sudo.

Ah this can explain several thing. So, I guess I could add this path in the script.

@Anyeos
Copy link

Anyeos commented Jan 3, 2021

If someone can improve the script to support both locations ($HOME and /usr/local and /opt maybe too) it will be great because I don't want to install everything on my $HOME.

For now I tried with a symlink and it is working. So, another workaround can be make a symlink.

cd
ln -s /usr/local/STMicroelectronics STMicroelectronics

@soheilpaper
Copy link

soheilpaper commented Jun 14, 2021

I guess the path you have is not the default path for STMCube as you can see form this part of this document:
image

So, if you installed it on the default path the below code could help you

export PATH="$HOME/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants