rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

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

Closed danieltr3s closed 10 months ago

danieltr3s commented 4 years ago

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

stevstrong commented 4 years ago

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

fpistm commented 4 years ago

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 commented 4 years ago

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.

stevstrong commented 4 years ago

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.

fpistm commented 4 years ago

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...

stevstrong commented 4 years ago

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?

fpistm commented 4 years ago

?

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.

danieltr3s commented 4 years ago

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]

stevstrong commented 4 years ago

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:

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?

danieltr3s commented 4 years ago
  • .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?

stevstrong commented 4 years ago

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 commented 10 months ago

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.