Arduino 2 Beta 12 STLink Programmer Error

Not sure if should be posted here.
Using IDE 1.8.16 all compiles and uploads fine.
Using IDE 2 Beta 12 i get the following error when trying to upload to STM32F4 via STlink
I have defined Generic STM32F4 series at COM5 which is the STLink port.
Tools Upload Method STMCubeProgrammer (SWD)

Upload error: Error: 9 FAILED_PRECONDITION: Property 'upload.tool.serial' is undefined

Environment Win 10 Pro 64bit, Genuine STLink 3, Black Pill STM32F411CE
Any ideas please imk
PS Upload code size is 106116 IDE 1.8.16 and 36168 for IDE 2 Beta 12. With same Compile Option

@imk123, your topic has been moved to the dedicated IDE 2.0 beta section of the forum.

1 Like

Hi @imk123. This is caused by a known bug in the Arduino CLI tool used by the Arduino IDE to handle the non-GUI tasks. Arduino CLI is actually used by both Arduino IDE 1.8.16 and 2.x, but Arduino IDE 1.8.16 is using an older version of Arduino CLI from before the bug was introduced:

The real fix will need to be made inside the Arduino CLI code base. However, there is a workaround for the bug. It's a bit advanced, but if you are interested I'll be happy to provide instructions.

hello sterretje sorry for posting wrong place i thought it might be and thanks for moving.

ptillisch, many thanks for the reply, i though it maybe a bug in v2 as 1.8.16 was fine and v2 still being beta i am happy to make this minor contribution toward perfection :slight_smile:
As for the fix i would be most interest in having a look at as i like V2 also would be interesting to see if the smaller code generated by V2 works
Again many thanks all imk

OK, here you are:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Check the box next to "Show verbose output during: [] compilation".
  3. Click the OK button.
  4. Select your board from the Arduino IDE's Tools > Board menu (e.g., "Generic STM32F4 series"").
  5. Compile any sketch.
  6. Wait for the compilation to finish.
  7. Scroll the black console pane at the bottom of the Arduino IDE window all the way up to the top.
    You will see a line that looks something like this:
    Using board 'GenF4' from platform in folder: C:\Users\<user name>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0
  8. Using any text editor, open the file named boards.txt that you will find under the path in that line of the output.
    In my example above, it would be located at:
    C:\Users\<user name>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0\boards.txt
  9. Add the following line anywhere in the boards.txt file:
  10. Save the file.
  11. Close all Arduino IDE windows.
  12. Start the Arduino IDE.
  13. Try uploading again.
1 Like

hello ptillisch and many thanks for the info, sorry for late replay but plumber here and now big clean up job. I'll try to find time to test it this evening, but more likely be tomorrow as this place needs lot of sorting to return life to normal.
Will let you know how i get on and many thanks, lots of little steps get big jobs done. imk

Can you generalize the steps for the fix? I am using a third party board and I am seeing the same issue. For my board the uploader would not be the one specified in your suggested fix.

Hi @trevers. The only part of the instructions that are board and upload method-specific is step 9:

  1. Add the following line anywhere in the boards.txt file:

The first component of that property name ("GenF4" in the example) is the board ID, which is shown in this part of the verbose compilation output:

Using board 'GenF4' from platform in folder: C:\Users\<user name>\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.1.0

Once you have determined the board ID of the board you are using, find its definition in the boards.txt file. That will be the set of property=key format lines that are prefixed with the board ID.

Now you need to add an upload.tool.default property that matches the equivalent upload.tool property. You could do this by determining the option ID ("swdMethod" in the example) of the Tools > Upload Method IDE setting you are using, or you can just add equivalent upload.tool.default properties for every upload.tool property.

I'll provide a hypothetical scenario:

If your board ID was foo and your Upload Method option ID was bar, you would need to find a property in boards.txt that looks like this:

(where baz is the name of the upload tool this hypothetical board is using)

You would then add a new line to the file based on that property, which would look like this:

The steps you provided worked just fine many thanks imk

You are welcome. I'm glad to hear it is working now. Enjoy!

Is there a similar solution for the Maple Mini (with STM32F1xx)?
The upload with the old IDE (1.8.16) takes ...
... \ AppData \ Local \ Arduino15 \ packages \ STMicroelectronics \ tools \ STM32Tools \ 2.1.0 / win / maple_upload.bat COM12 1 1EAF: 0003
with the bin file as an additional parameter.
The upload with the new IDE does not work.

The workaround described above works for any board affected by this bug.

Hello ptillisch,
I have interpreted your statement like this and inserted the following line in board.txt:
It doesn't work! the error message is still
"Compilation complete.
Upload error: Error: 9 FAILED_PRECONDITION: Property 'upload.tool.' is undefined"

You must preserve the same value of the upload.tool property when defining the upload.tool.default property.

The upload.tool property for that board and upload method:

So the new property you would need to add for that board and upload method:

Don't mess with any other part of the property definition. Copy it exactly and add ".default". That is all.

Did you remember to do these steps?

The platform configuration is only loaded on the startup of the Arduino IDE, so any changes you make to boards.txt while the IDE is running will not be recognized by the IDE until after you restart the IDE.

hello ptillisch,

Just installed IDE2 RC3, it is getting better every release, I really like it :slight_smile:
But had to apply this fix again, not a worry now i know what to do.
To Boards.Txt

Compiler seems a little slower than IDE 1.8.16 but IDE 2 is work in progress so not worried as think then benefits are WONDERFUL. Big Thanks To The IDE Two Team :slight_smile:

Best of season wishes to all, a Wonderful Christmas and let us all hope for better times ahead in the New Year. Ian Knight

Thanks so much for your kind words @imk123. Best to you from the Arduino Tooling Team as well.

The reports of the slow operations often turn out to be caused by a severe throughput bottleneck in the Arduino IDE's "Output" view. The text is printed very slowly, so when you have a lot of output you will find that the compilation and upload finish long before the IDE finally gets through printing it all to the Output view. That gives the impression that the compilation/upload process is going slowly.

The Serial Monitor also had this problem in earlier IDE versions but the developers have improved the performance. So I hope they will do the same for the Output as well in an upcoming release.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.