Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build option #174

Merged
merged 2 commits into from
Dec 19, 2017
Merged

Build option #174

merged 2 commits into from
Dec 19, 2017

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Dec 11, 2017

It is now possible to customize some core definitions
or gcc options thanks a file named "build_opt.h"
in the sketch directory. (using @file gcc option)

User can add it thanks the Arduino IDE in a tab to easily customize the core options.
That's why '.h' extension is used as IDE allows only those one: ino, h, hpp, c, cpp, pde.
Note: file is automatically copied in the {build.path}/sketch/ directory

Example of file content to change F_CPU value:
-UF_CPU -DF_CPU=72000000UL

If the file does not exist an empty one is created in the {build.path}/sketch/ directory.

Fix #41

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm fpistm added the enhancement New feature or request label Dec 11, 2017
@fpistm fpistm added this to the Next release milestone Dec 11, 2017
@fpistm fpistm self-assigned this Dec 11, 2017
@fpistm fpistm requested a review from a user December 11, 2017 16:36
@fpistm
Copy link
Member Author

fpistm commented Dec 12, 2017

One example using the STM32Ethernet and LwIP libraries:
Adding in build_opt.h:
-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.

It is now possible to customize some core definitions
or gcc options thanks a file named "build_opt.h"
in the sketch directory. (using @file gcc option)

Example of file content to change F_CPU value:
-UF_CPU -DF_CPU=72000000UL

If the file does not exist an empty one is created.

Fix stm32duino#41

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistm fpistm merged commit 4ac494c into stm32duino:master Dec 19, 2017
@fpistm fpistm deleted the build_option branch December 19, 2017 10:08
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this pull request Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant