Interesting pull request to add build options

What could be included in further releases, or for the forum.
User avatar
RogerClark
Posts: 7539
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Interesting pull request to add build options

Post by RogerClark » Tue Dec 12, 2017 5:19 am

Frederic

Thanks

I have a Mac, so I will try to test it later

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Interesting pull request to add build options

Post by fpiSTM » Tue Dec 12, 2017 8:31 am

fpiSTM wrote:
Tue Dec 12, 2017 5:17 am

RogerClark wrote:
Mon Dec 11, 2017 7:43 pm
Do you know if libraries can supply this file or whether it’s only the main sketch ? ( because I know the IDE does strange things like copying various files to a temp directory to compile them, I wonder if this file put inside a library could end up in the temp build directory
I will check that Roger.
So, no it's not possible as the library file are copied in {build.path}/libraries/<name of the lib>
It should be possible by adding the same mechanism with the recipe.hooks.libraries.prebuild.NUMBER.pattern (called before libraries compilation)
But I think it will add too much issue (different file name, what about having several libraries....).

Currently, I advise to use only one build options file at sketch level to avoid any confusion.

User avatar
RogerClark
Posts: 7539
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Interesting pull request to add build options

Post by RogerClark » Tue Dec 12, 2017 9:23 am

Frederic

I agree. It is not worth the effort etc to have this for libraries at the moment

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Interesting pull request to add build options

Post by fpiSTM » Tue Dec 12, 2017 9:36 am

I've made some test and succeed to enable some options for libs.

One example using the STM32Ethernet and LwIP libraries:
Adding in build_opt.h:

Code: Select all

-DLWIP_DEBUG=1 -DLWIP_DBG_TYPES_ON=LWIP_DBG_ON -DIP_DEBUG=LWIP_DBG_ON "-DAPI_LIB_DEBUG LWIP_DBG_ON"
Allow to enable some debug without need to edit core or libraries files. Only at sketch level.

But there is a limitation. Even if the "Aggressively cache compiled core" is disabled.
When project has been built one time, changing build option in the file will not be taken into account as build see no change on source file (Using previously compiled file)
Only way to take it into account is to reopen IDE or clean the tmp build dir. :x :x :x :x

User avatar
RogerClark
Posts: 7539
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Interesting pull request to add build options

Post by RogerClark » Tue Dec 12, 2017 10:01 am

OK

Normally I find I can edit the source in a library, using an external editor (Notepad++) and I don't need to reopen the IDE etc

The only time I need to close and open the IDE is when I make changes to platform.txt or boards.txt

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Interesting pull request to add build options

Post by fpiSTM » Wed Dec 13, 2017 5:49 am

Yes when you edit the source it is rebuilt but in this case it is not part of the source that's why it is not rebuilt as it do not see any change.
with Arduino 1.8.x, change in the platform.txt do not require restart of the IDE. only the boards.txt requires a restart or at least open the boards manager.

User avatar
RogerClark
Posts: 7539
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Interesting pull request to add build options

Post by RogerClark » Wed Dec 13, 2017 6:27 am

Frederic

I didn't realise Arduino 1.8.x didnt need to restart for changes to platform.txt, that's useful to know.

User avatar
mrburnette
Posts: 2013
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Interesting pull request to add build options

Post by mrburnette » Wed Dec 13, 2017 3:15 pm

Oh my, my, my ...

I really have mixed emotions about this implementation; In My Experience, work-arounds are rarely completely thought-out. Which is to say that they become fragile since the implementation is often implemented without a full team vote.

In any event, the need for programmer override of the runline has been needed for a long time. There is only one correct place to put such a feature and that is in the JAVA IDE ... be it a menu driven option or be it in a "fixed" tab. Personally, when the IDE loads a boards file, that file and any other pertinent files should be parsed and loaded into the IDE for observation/modification in building a NEW project and then written out into the project folder to be re-read and used in the future. Arduino makes it crazy difficult to 'snap' a project for delivering to a larger audience. In this regard, it needs to work like the Cypress IDE where a new project copies into the project all named libraries and configurable options such that a project can be easily backed-up.

Ray

User avatar
Rick Kimball
Posts: 1066
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Interesting pull request to add build options

Post by Rick Kimball » Wed Dec 13, 2017 5:09 pm

Even though I proposed this, I'm only half excited about it. I really wasn't advocating for its immediate implementation. I agree with mrburnette that it would be better implemented in the Arduino IDE. Sadly, it seems change happens on the IDE at a glacial pace with little regard for things that benefit Non-Arduino boards.

I think Fred has done a nice job implementing it. Maybe his stm32 core can be a guinea pig and we can see what issues appear. For the libmaple core, I think we should take a wait and see approach.
-rick

fpiSTM
Posts: 270
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: Interesting pull request to add build options

Post by fpiSTM » Wed Dec 13, 2017 9:04 pm

Yes you're right. It definitely have to be in the IDE.
Anyway, instead of adding several custom menus or modifying boards.txt, I think hooks feature could help to make those customization easier for the end user.
I will extend it to rebuild all if the build options file is changed.

Post Reply