Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 25 of 32

Thread: HOWTO: Store Projects settings (like F_CPU, USB, Keyboard-layout)

Threaded View

  1. #1
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Germany NRW

    HOWTO: Store Project Settings

    - Advanced users only -

    I found a way to store project-settings.
    Why ?
    I often need different setting for projects, and often I forget to select the correct options in the IDE.

    The following shows a way to store them on a per-project-basis.
    For example: A Sketch needs - or works best - with F_CPU=144Mhz

    Copy the attached platform.txt to Arduino\hardware\teensy\avr\platform.txt (overwrite the existing, but make a backup before)

    - It adds the following command to the commandline of GCC:"@{build.path}\sketch\defs.h"
    - If the file does not exist, it writes an empty defs.h to prevent error-msgs during compilation

    Create a file "defs.h" in your project-directory (where the .ino file is)
    Example file: (overrides the F_CPU setting)
    - The first line undefines the existing definition
    - The second line defines a new F_CPU (144MHz in this case)

    You're done.
    void setup() {
    void loop() {}
    1. Create the mentioned defs.h file above in the same directory.
    2. Compile the sketch with - for example 24MHz - and watch the output.

    The file-extension ".h" is not the best - i tried an other one, but it did not work (the file was not copied to the build-directory)

    In the attached platform.txt is a line: /c if not exist "{build.path}\sketch\defs.h" "echo.>{build.path}\sketch\defs.h"
    [edit]We need one more line for MAC:

    Would be great if someone can test this and says "Yes, works!"

    EDIT: Replaced platform.txt with a non-TYQT-version

    EDIT: Find platform.txt for Arduino 1.8.5 in this post:

    EDIT: Find platform.txt for Arduino 1.8.7 in this post:

    Attached Files Attached Files
    Last edited by Frank B; 09-19-2018 at 06:05 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts