Cache clear option

This is incorrect. bodmer mentioned one option already:

I'll provide detailed instructions:

  1. Change a custom board option under the Tools menu to an arbitrary selection.
  2. Select Sketch > Verify/Compile from the Arduino IDE menus.
  3. Wait for the compilation to finish.
  4. Change the custom board option back to its previous selection.

The cache is cleared when you compile after changing the option. So this provides one option for clearing the cache via the Arduino IDE UI.

Another option is to manually delete the cache:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Check the box next to "Show verbose output during: ☐ compilation".
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE menus.
  5. Wait for the compilation to finish.
  6. Examine the contents of the black "Output" panel at the bottom of the Arduino IDE window. You will see some lines that show the path of the caches. These are in two locations:
    The cached libraries are in the temporary build folder of the sketch:
    Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino-sketch-97534792491BE5D1DEA89A9B820D7A08\libraries\SrcWrapper\HAL\stm32yyxx_hal_comp_ex.c.o
    
    The cached core is in a separate folder (so it can be shared between multiple sketches):
    Using precompiled core: C:\Users\per\AppData\Local\Temp\arduino-core-cache\core_ad5517dca5ea73b9e745dae1d6eed866.a
    
  7. Delete the temporary build folder.
    In the sample output I shared above, it is here:
    C:\Users\per\AppData\Local\Temp\arduino-sketch-97534792491BE5D1DEA89A9B820D7A08
    
  8. Delete the core cache file.
    In the sample output I shared above, it is here:
    C:\Users\per\AppData\Local\Temp\arduino-core-cache\core_ad5517dca5ea73b9e745dae1d6eed866.a
    

The next time you compile the sketch, it will compile the libraries and core from source. Any changes you made to build_opt.h should take effect during that compilation.

If you know for certain the changes are only relevant to one specific cache, you can delete only that one in order to reduce the compilation time.

I'm strongly against adding any code for handling build_opt.h specifically. This is the sort of thing that accumulates over time making a codebase increasingly difficult to understand and maintain and prone to regressions. The deficiency should be solved in a generalized manner, not specific to a hack implemented by a 3rd party.

1 Like