Skip to content

Commit b8e591b

Browse files
committed
text corrections
1 parent 1c1236b commit b8e591b

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

doc/faq/a06-global-build-options.rst

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
How to specify global build defines and options
22
===============================================
33

4-
To create global defines for a Sketch, create a file with a name based
5-
on your sketch’s file name followed by ``.globals.h`` in the Sketch
6-
folder. For example, if the main Sketch file is named
7-
``LowWatermark.ino``, its global defines file would be
4+
To create globally usable macro definitions for a Sketch, create a file
5+
with a name based on your Sketch’s file name followed by ``.globals.h``
6+
in the Sketch folder. For example, if the main Sketch file is named
7+
``LowWatermark.ino``, its global ``.h`` file would be
88
``LowWatermark.ino.globals.h``. This file will be implicitly included
99
with every module built for your Sketch. Do not directly include it in
1010
any of your sketch files or in any other source files. There is no need
1111
to create empty/dummy files, when not used.
1212

13-
This global define ``.h`` also supports embedding compiler command-line
14-
options in a unique “C” block comment. Compiler options are placed in a
15-
“C” block comment starting with ``/*@create-file:build.opt@``. This
13+
This global ``.h`` also supports embedding compiler command-line options
14+
in a unique “C” block comment. Compiler options are placed in a “C”
15+
block comment starting with ``/*@create-file:build.opt@``. This
1616
signature line must be alone on a single line. The block comment ending
1717
``*/`` should also be alone on a single line. In between, place your
1818
compiler command-line options just as you would have for the GCC @file
@@ -113,13 +113,15 @@ When you switch between Sketch windows, core will be recompiled and the
113113
cache updated. The workaround logic is reset when Arduino IDE is
114114
completely shutdown and restarted. Some operating systems are better at
115115
cleaning up their temp space than others at reboot after a crash. At
116-
least for Windows you may need to manually delete the Arduino temp files
117-
and directories after a crash. Otherwise the workaround logic may be
118-
left on.
116+
least for Windows®, you may need to manually delete the Arduino temp
117+
files and directories after a crash. Otherwise, the workaround logic may
118+
be left on.
119119

120-
For some Windows systems the temp directory can be found near
120+
For some Windows® systems the temp directory can be found near
121121
``C:\Users\<user id>\AppData\Local\Temp\arduino*``. Note ``AppData`` is
122-
a hidden directory.
122+
a hidden directory. For help with this do an Internet search on
123+
``windows disk cleanup``. Or, type ``disk cleanup`` in the Windows®
124+
taskbar search box.
123125

124126
If you think your workflow performance would benefit from keeping a per
125127
Sketch copy of ``core.a``, you can turn off the “Aggressively cache

doc/faq/readme.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ Please read `flash layout <../filesystem.rst>`__ documentation entry.
195195
How to specify global build defines and options?
196196
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
197197
198-
Using a unique named `.h` file a `#define` value can be globally accessed.
199-
Additionally, compiler command-line options can be embedded in this file as a
200-
unique block comment.
198+
By using a uniquely named `.h` file, macro definitions can be created and
199+
globally used. Additionally, compiler command-line options can be embedded in
200+
this file as a unique block comment.
201201
202202
`Read more <a06-global-build-options.rst>`__.

tools/mkbuildoptglobals.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# This script manages the use of a file with a unique name, like
44
# `Sketch.ino.globals.h`, in the Sketch source directory to provide compiler
5-
# command-line options (build options) and sketch global defines. The build
5+
# command-line options (build options) and sketch global macros. The build
66
# option data is encapsulated in a unique "C" comment block and extracted into
77
# the build tree during prebuild.
88
#
@@ -60,7 +60,8 @@
6060
"""
6161
Arduino `preferences.txt` changes
6262
63-
"Aggressively cache compiled core" must be turned off for a reliable build process.
63+
"Aggressively cache compiled core" ideally should be turned off; however,
64+
a workaround has been implimented.
6465
In ~/.arduino15/preferences.txt, to disable the feature:
6566
compiler.cache_core=false
6667
@@ -341,6 +342,7 @@ def discover_1st_time_run(build_path):
341342
# Arduino IDE 2.0 RC5 does not cleanup on exist like 1.6.19. Probably for
342343
# debugging like the irregular version number 10607. For RC5 this indicator
343344
# will be true after a reboot instead of a 1ST compile of the IDE starting.
345+
# Another issue for this technique, Windows does not clear the Temp directory. :(
344346
tmp_path, build = os.path.split(build_path)
345347
ide_2_0 = 'arduino-sketch-'
346348
if ide_2_0 == build[:len(ide_2_0)]:
@@ -380,10 +382,8 @@ def find_preferences_txt(runtime_ide_path):
380382
# The downloaded Windows 7 (and up version) will put "preferences.txt"
381383
# in a different location. When both are present due to various possible
382384
# scenarios, use the more modern.
383-
# Note, I am ignoring any permutations you might get into with storing
384-
# and running applications off Network servers.
385385
fqfn = os.path.expanduser("~\Documents\ArduinoData\preferences.txt")
386-
# Path for "Windows app" - verified on Windows 10 with Arduino IDE 1.8.19
386+
# Path for "Windows app" - verified on Windows 10 with Arduino IDE 1.8.19 from APP store
387387
fqfn2 = os.path.expanduser("~\AppData\local\Arduino15\preferences.txt")
388388
# Path for Windows 7 and up - verified on Windows 10 with Arduino IDE 1.8.19
389389
if os.path.exists(fqfn):
@@ -422,9 +422,10 @@ def get_preferences_txt(file_fqfn, key):
422422

423423

424424
def check_preferences_txt(runtime_ide_path):
425+
# return the state of "compiler.cache_core" in preferences.txt
425426
file_fqfn = find_preferences_txt(runtime_ide_path)
426427
if file_fqfn == "":
427-
return True # cannot find file assume enabled
428+
return True # cannot find file - assume enabled
428429
print_msg("Using preferences from " + file_fqfn)
429430
return get_preferences_txt(file_fqfn, "compiler.cache_core")
430431

@@ -435,6 +436,7 @@ def touch(fname, times=None):
435436

436437

437438
def synchronous_touch(globals_h_fqfn, commonhfile_fqfn):
439+
# touch both files with the same timestamp
438440
with open(globals_h_fqfn, 'a'):
439441
os.utime(globals_h_fqfn)
440442
ts = os.stat(globals_h_fqfn)
@@ -481,9 +483,9 @@ def main():
481483
embedded_options = extract_create_build_opt_file(globals_h_fqfn, globals_name, build_opt_fqfn)
482484

483485
if use_aggressive_caching_workaround:
484-
# When a Sketch owns a "Sketch.ino.globals.h" file in the build tree
485-
# that exactly matches the timestamp of "CommonHFile.h" in the
486-
# platform source tree, it owns the core cache. If not, or
486+
# When the sketch build has a "Sketch.ino.globals.h" file in the
487+
# build tree that exactly matches the timestamp of "CommonHFile.h"
488+
# in the platform source tree, it owns the core cache. If not, or
487489
# "Sketch.ino.globals.h" has changed, rebuild core.
488490
# A non-zero file size for commonhfile_fqfn, means we have seen a
489491
# globals.h file before and workaround is active.
@@ -516,7 +518,7 @@ def main():
516518

517519
else:
518520
print_err("Too few arguments. Add arguments:")
519-
print_err(" Source FQFN Sketch.ino.globals.h, Build FQFN Sketch.ino.globals.h, Build FQFN build.opt")
521+
print_err(" Runtime IDE path, Build path, Build FQFN build.opt, Source FQFN Sketch.ino.globals.h, Core Source FQFN CommonHFile.h")
520522

521523
if __name__ == '__main__':
522524
sys.exit(main())

0 commit comments

Comments
 (0)