Arduino_STM32 icon indicating copy to clipboard operation
Arduino_STM32 copied to clipboard

New toolchain: Updated "platform.txt" to use the xpack gcc 9…

Open danieltr3s opened this issue 4 years ago • 11 comments

New toolchain: Updated "platform.txt" to use the xpack gcc 9 toolchain; Added an extra option to choose between different runtime libraries in "boards.txt".

Issue: https://github.com/rogerclarkmelbourne/Arduino_STM32/issues/786

danieltr3s avatar May 25 '20 11:05 danieltr3s

If you add --specs=nano.specs to the platform.txt, then you can remove it from boards.txt, I think.

stevstrong avatar May 25 '20 13:05 stevstrong

If you add --specs=nano.specs to the platform.txt, then you can remove it from boards.txt, I think.

No, in platform.txt this is the default value

fpistm avatar May 25 '20 14:05 fpistm

it is not repeated , it is the value for build.flags.ldspecs Depending of the selected menu then build.flags.ldspecs is set to the proper value. There is no concatenation, it is simply overidden.

fpistm avatar May 25 '20 15:05 fpistm

If the default value is anyway overwritten by the boards.txt options, then it makes no sense to make a default value, just define it for each option in part in boards.txt.

stevstrong avatar May 25 '20 15:05 stevstrong

No for default option this is the one used and avoid to set it in the boards.txt: discovery_f407.menu.rtlib.nano=Newlib Nano (default)

if you remove the one from platform.txt, then you will have to add discovery_f407.menu.rtlib.nano.build.flags.ldspecs=--specs=nano.specs

for each entry...

fpistm avatar May 25 '20 16:05 fpistm

As far as I can see, there are 5 new entries. The nano-specs is already there for 3 entries, the first entry being the default, it should contain the same, and the last ld.specs entry then can be removed, if you do not add it into platform.txt. Or am I missing something?

stevstrong avatar May 26 '20 07:05 stevstrong

?

Well I don't really understand what you would mean, anyway there is several other possibilities, This one is the one I use because it is the default option so it make sense to have it in the platform.txt for better readability.

fpistm avatar May 26 '20 07:05 fpistm

If you add --specs=nano.specs to the platform.txt, then you can remove it from boards.txt, I think.

No, because that will force that option for all compilations and you wouldn't be able to not use it.

If the default value is anyway overwritten by the boards.txt options, then it makes no sense to make a default value, just define it for each option in part in boards.txt.

No. That's incorrect. The default value set in "platforms.txt" is only overridden in "boards.txt" on the options other than the default. If you notice, all the defaults in "boards.txt" do not set any compilation option. And as so, IDE will use what is defined in "platforms.txt".

In order to not use the nano.specs option (or any other for that matter) you have a menu entry definition that clears the compiler option. As @fpistm already said, the IDE does not do any concatenation, it simple overrides any value if one is provided in "boards.txt" or "platform.local.txt".

The menu option definitions in "boards.txt" are read the following way: [BoardName].menu.[menu option name].[option name] = [Display Text] -> This starts a new Option entry in the menu. [BoardName].menu.[menu option name].[option name].build.flags.[name of the compile flag desired] = [value for the flag] -> This sets a compile flag .... (repeat for any other compile flag)

The scope of the option ends when another "Option Name" is defined. If you don't have any lines below that "Start of a new option", then no changes will be made to the build definitions in "platforms.txt".

To add new menus you have to add them at the beginning of the file:

menu.[name of menu] = [Display Text]

danieltr3s avatar May 26 '20 17:05 danieltr3s

Thank you for the explanation, I already knew how the txt files work.

I just wanted to point out that you added 5 new RTL options for each board: rtlib.nano, rtlib.nanofp, rtlib.nanofs, rtlib.nanofps and rtlib.full.

4 of these options overrid the default flags.ldspecs as newly specified in platform.txt, the first having the default value (no overriding ldspecs).

I think this can be done in the following way:

  • revert the added build.flags.ldspecs=--specs=nano.specs in platform.txt
  • add .rtlib.nano.build.flags.ldspecs=--specs=nano.specs for each board in boards.txt - this will explicitly set the ldspecs for the first option Newlib Nano (default)
  • remove .rtlib.full.build.flags.ldspecs= for each board in boards.txt - this will keep the default old ldspecs option.

This way you leave the default value of ldspecs for Newlib standard and explicitly set it for .rtlib.nano.

Do you now understand what I mean?

stevstrong avatar May 26 '20 18:05 stevstrong

  • .rtlib.nano.build.flags.ldspecs=--specs=nano.specs

Perfectly, @stevstrong . I just fail to see the benefits of such approach. In fact, that would mean that the default options of the menus in boards.txt wouldn't match with the defaults declared in platform.txt which can lead to painful hours of cross checking between files (talking with experience :D).

What do you think?

danieltr3s avatar May 26 '20 22:05 danieltr3s

In fact, that would mean that the default options of the menus in boards.txt wouldn't match with the defaults declared in platform.txt which can lead to painful hours of cross checking between files (talking with experience :D).

AFAIK, there is no default option in boards.txt. The options in boards.txt are used to override the default option in platform.txt.

stevstrong avatar Jun 11 '20 10:06 stevstrong

I will close this and not merge, as there is no or very small benefit when applying it.

Fell free to re-open it if there is some considerable change in the information posted above so far.

stevstrong avatar Nov 06 '23 14:11 stevstrong