@@ -25,9 +25,9 @@ Actions taken in processing comment block to create ``build.opt``
25
25
- for each line, white space is trimmed
26
26
- blank lines are skipped
27
27
- lines starting with ``* ``, ``// ``, or ``# `` are skipped
28
- - the remaining results are written to build tree \ `` /core/build.opt ``
29
- - multiple ``/*@create-file:build.opt@ `` ``*/ `` comment blocks are not
30
- allowed
28
+ - the remaining results are written to arduino-cli build cache directory
29
+ - multiple ``/*@create-file:build.opt@ `` ``*/ `` comment blocks are
30
+ allowed and would be merged in order they are written in the file
31
31
- ``build.opt `` is finished with a ``-include ... `` command, which
32
32
references the global .h its contents were extracted from.
33
33
@@ -160,137 +160,6 @@ Updated Global ``.h`` file: ``LowWatermark.ino.globals.h``
160
160
161
161
#endif
162
162
163
- Aggressively cache compiled core
164
- ================================
165
-
166
- This feature appeared with the release of Arduino IDE 1.8.2. The feature
167
- “Aggressively Cache Compiled core” refers to sharing a single copy of
168
- ``core.a `` across all Arduino IDE Sketch windows. This feature is on by
169
- default. ``core.a `` is an archive file containing the compiled objects
170
- of ``./core/esp8266/* ``. Created after your 1ST successful compilation.
171
- All other open sketch builds use this shared file. When you close all
172
- Arduino IDE windows, the core archive file is deleted.
173
-
174
- This feature is not compatible with using global defines or compiler
175
- command-line options. Without mediation, bad builds could result, when
176
- left enabled. When ``#define `` changes require rebuilding ``core.a `` and
177
- multiple Sketches are open, they can no longer reliably share one cached
178
- ``core.a ``. In a simple case: The 1st Sketch to be built has its version
179
- of ``core.a `` cached. Other sketches will use this cached version for
180
- their builds.
181
-
182
- There are two solutions to this issue:
183
-
184
- 1. Do nothing, and rely on aggressive cache workaround built into the
185
- script.
186
- 2. Turn off the “Aggressively Cache Compiled core” feature, by setting
187
- ``compiler.cache_core=false ``.
188
-
189
- Using “compiler.cache_core=false”
190
- ---------------------------------
191
-
192
- There are two ways to turn off the “Aggressively Cache Compiled core”
193
- feature: This can be done with the Arduino IDE command-line or a text
194
- editor.
195
-
196
- Using the Arduino IDE command-line from a system command line, enter the
197
- following:
198
-
199
- ::
200
-
201
- arduino --pref compiler.cache_core=false --save-prefs
202
-
203
- For the text editor, you need to find the location of
204
- ``preferences.txt ``. From the Arduino IDE, go to *File->Preferences *.
205
- Make note of the path to ``prefereces.txt ``. You *cannot * edit the file
206
- while the Arduino IDE is running. Close all Arduino IDE windows and edit
207
- the file ``preferences.txt ``. Change ``compiler.cache_core=true `` to
208
- ``compiler.cache_core=false `` and save. Then each sketch will maintain
209
- its *own * copy of ``core.a `` built with the customization expressed by
210
- their respective ``build.opt `` file.
211
-
212
- The “workaround”
213
- ----------------
214
-
215
- When the “Aggressively Cache Compiled core” feature is enabled and the
216
- global define file is detected, a workaround will turn on and stay on.
217
- When you switch between Sketch windows, core will be recompiled and the
218
- cache updated. The workaround logic is reset when Arduino IDE is
219
- completely shutdown and restarted.
220
-
221
- The workaround is not perfect. These issues may be of concern:
222
-
223
- 1. Dirty temp space. Arduino build cache files left over from a previous
224
- run or boot.
225
- 2. Arduino command-line options:
226
-
227
- - override default preferences.txt file.
228
- - override a preference, specifically ``compiler.cache_core ``.
229
-
230
- 3. Multiple versions of the Arduino IDE running
231
-
232
- **Dirty temp space **
233
-
234
- A minor concern, the workaround is always on. Not an issue for build
235
- accuracy, but ``core.a `` maybe rebuild more often than necessary.
236
-
237
- Some operating systems are better at cleaning up their temp space than
238
- others at reboot after a crash. At least for Windows®, you may need to
239
- manually delete the Arduino temp files and directories after a crash.
240
- Otherwise, the workaround logic may be left on. There is no harm in the
241
- workaround being stuck on, the build will be correct; however, the core
242
- files will occasionally be recompiled when not needed.
243
-
244
- For some Windows® systems the temp directory can be found near
245
- ``C:\Users\<user id>\AppData\Local\Temp\arduino* ``. Note ``AppData `` is
246
- a hidden directory. For help with this do an Internet search on
247
- ``windows disk cleanup ``. Or, type ``disk cleanup `` in the Windows®
248
- taskbar search box.
249
-
250
- With Linux, this problem could occur after an Arduino IDE crash. The
251
- problem would be cleared after a reboot. Or you can manually cleanup the
252
- ``/tmp/ `` directory before restarting the Arduino IDE.
253
-
254
- **Arduino command-line option overrides **
255
-
256
- If you are building with ``compiler.cache_core=true `` no action is
257
- needed. If ``false `` the script would benefit by knowing that.
258
-
259
- When using either of these two command-line options:
260
-
261
- ::
262
-
263
- ./arduino --preferences-file other-preferences.txt
264
- ./arduino --pref compiler.cache_core=false
265
-
266
- Hints for discovering the value of ``compiler.cache_core ``, can be
267
- provided by specifying ``mkbuildoptglobals.extra_flags=... `` in
268
- ``platform.local.txt ``.
269
-
270
- Examples of hints:
271
-
272
- ::
273
-
274
- mkbuildoptglobals.extra_flags=--preferences_sketch # assume file preferences.txt in the sketch folder
275
- mkbuildoptglobals.extra_flags=--preferences_sketch "pref.txt" # is relative to the sketch folder
276
- mkbuildoptglobals.extra_flags=--no_cache_core
277
- mkbuildoptglobals.extra_flags=--cache_core
278
- mkbuildoptglobals.extra_flags=--preferences_file "other-preferences.txt" # relative to IDE or full path
279
-
280
- If required, remember to quote file or file paths.
281
-
282
- **Multiple versions of the Arduino IDE running **
283
-
284
- You can run multiple Arduino IDE windows as long as you run one version
285
- of the Arduino IDE at a time. When testing different versions,
286
- completely exit one before starting the next version. For example,
287
- Arduino IDE 1.8.19 and Arduino IDE 2.0 work with different temp and
288
- build paths. With this combination, the workaround logic sometimes fails
289
- to enable.
290
-
291
- At the time of this writing, when Arduino IDE 2.0 rc5 exits, it leaves
292
- the temp space dirty. This keeps the workaround active the next time the
293
- IDE is started. If this is an issue, manually delete the temp files.
294
163
295
164
Custom build environments
296
165
=========================
@@ -301,11 +170,12 @@ require this feature and would like to turn it off, you can add the
301
170
following lines to the ``platform.local.txt `` used in your build
302
171
environment:
303
172
304
- ::
173
+ .. code-block :: ini
305
174
306
175
recipe.hooks.prebuild.2.pattern =
307
176
build.opt.flags =
308
177
178
+
309
179
Other build confusion
310
180
=====================
311
181
@@ -315,12 +185,6 @@ Other build confusion
315
185
name ``LowWatermark.ino.globals.h ``. You need to touch (update
316
186
timestamp) the file so a “rebuild all” is performed.
317
187
318
- 2. When a ``.h `` file is renamed in the sketch folder, a copy of the old
319
- file remains in the build sketch folder. This can create confusion if
320
- you missed an edit in updating an ``#include `` in one or more of your
321
- modules. That module will continue to use the stale version of the
322
- ``.h `` until you restart the IDE or other major changes that would
323
- cause the IDE to delete and recopy the contents from the source
324
- Sketch directory. Changes on the IDE Tools board settings may cause a
325
- complete rebuild, clearing the problem. This may be the culprit for
326
- “What! It built fine last night!”
188
+ 2. Original script relied on IDE 1.x core & sketch caching behaviour.
189
+ Since 3.2.x, we no longer assume aggressive caching can be disabled.
190
+ `Read more <a07-mkbuildoptglobals-aggressive-caching.rst >`__.
0 commit comments