ussserrr / stm32pio

Automate managing of STM32CubeMX + PlatformIO projects
https://pypi.org/project/stm32pio
Other
230 stars 24 forks source link

WARNING STM32 PlatformIO board is not specified, it will be needed on PlatformIO project creation #8

Closed svenikea closed 4 years ago

svenikea commented 4 years ago

Hi friend I was having trouble when following your guide and I can't find any solution to this I follow your example section and when I type

python3 app.py new -d /home/john/STM32Cube/STM32F103C8/testing -b genericSTM32F103C8 --start-editor=code --with-build

It return me with this error

WARNING  [Errno 2] No such file or directory: 'platformio'

I created my platformio project in vscode with stm32cube framework and I put app.py inside the project and run the command again and it still give me this error Can you help me with this?

ussserrr commented 4 years ago

Hello, seems like you don't have platformio command in your PATH, so stm32pio cannot start it. Please see this and this.

svenikea commented 4 years ago

Okay I installed platformio and its in my PATH but I'm getting this error hope you could help me with

ERROR    code generation error (CubeMX return code is 1).
Enable a verbose output or try to generate a code from the CubeMX itself.
ERROR    code generation error
ussserrr commented 4 years ago

Run the app with -v argument to get the verbose output about the problem. Like this:

python stm32pio/app.py -v ...

Where you had installed STM32CubeMX? Because it looks like the default path specified in settings.py is not correct for your system. You can run init command first and then specify the correct path to the CubeMX in the created stm32pio.ini file or set it directly in the settings.py mentioned above so every new project will be using this path by default.

svenikea commented 4 years ago

Okay so first of all I'm running Manjaro which is Arch base system and I install STM32CubeMX through what is called AUR and the command was in

/usr/bin/stm32cubemx

I do what you told me to correct the path to CubeMX created stm32pio.ini which is

[app]
java_cmd = java
platformio_cmd = platformio
cubemx_cmd = /usr/bin/stm32cubemx

[project]
cubemx_script_content = config load /home/john/STM32Cube/STM32F103C8/testing/testing.ioc
    generate code /home/john/STM32Cube/STM32F103C8/testing
    exit
platformio_ini_patch_content = [platformio]
    include_dir = Inc
    src_dir = Src
ioc_file = /home/john/STM32Cube/STM32F103C8/testing/testing.ioc
board = genericSTM32F103C8

And it gave me this

Error: Invalid or corrupt jarfile /usr/bin/stm32cubemx

And why need jarfile because all it doing was open STM32CubeMX from a command line

opo2000tw commented 4 years ago
  1. Run test code

  2. Re-check java and stm32 installed path. python3 -m stm32pio.tests.test -b -v

  3. This complex command will execute, generate, & ... to default path on platformio by stm32cubemx. All of stm32cubemx command will be found in stm32 public "UM1718 User manual" with this line

cubemx_script_content': "config load $cubemx_ioc_full_filename\ngenerate code $project_path\nexit",
opo2000tw commented 4 years ago

The other way to slove this is 1. Import Middleware & update default framework 2. Import Library to external lib by json

ussserrr commented 4 years ago

@kynguyen98 OK, so I've been able to replicate your set-up. /usr/bin/stm32cubemx file isn't actually the jar file – that's why it's unable to start. This is just a script starting the actual CubeMX application. Don't remember exactly why I chose to invoke CubeMX as java -jar ..., probably for a portability's sake. Actually, if you look inside /usr/bin/stm32cubemx file you see that what it's doing is exactly running java -jar ... command.

So the solution would be to locate the actual JAR file and specify it in stm32pio.ini config.

Also, you gave me a good idea of how to implement the CI finally (at least try to). Didn't know that it is somewhere possible to get CubeMX in "headless" mode, great that Arch providing such a feature. I've already tested the whole stm32pio application on Manjaro but installing CubeMX manually, downloading by hands.

svenikea commented 4 years ago

Oh my god this actually worked!, thanks mate, your'e awesome.