Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 32 of 32

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

  1. #26
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Nice to see you too

  2. #27
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Platform.txt for Arduino 1.8.7
    Attached Files Attached Files

  3. #28
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Platform.txt for Arduino 1.8.8
    Attached Files Attached Files

  4. #29
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,947
    Just posted this here Overriding-Core-defines with an updated platform.txt below that worked for two of us.

    Confirmed '-Ucatfood' versus '-Dcatfood' in defs.h triggers this or not in the sketch:
    Code:
    void setup() {
      Serial.begin(9600);
      while ( !Serial && millis()<3000 );
    #ifdef catfood
          Serial.println("Found catfood");
    #endif
    }
    >> That is -U to Undefine or -D to Define the 'catfood'


    Also looking at : ...\hardware\teensy\avr\cores\teensy4\HardwareSeri al1.cpp::
    Code:
    #ifndef SERIAL1_TX_BUFFER_SIZE
    #define SERIAL1_TX_BUFFER_SIZE     64 // number of outgoing bytes to buffer
    #endif
    #ifndef SERIAL1_RX_BUFFER_SIZE
    #define SERIAL1_RX_BUFFER_SIZE     64 // number of incoming bytes to buffer
    #endif
    #define IRQ_PRIORITY  64  // 0 = highest priority, 255 = lowest
    >> With code like this the -U to undefine isn't needed - other values that are defined need a -U before a new -D

    And here is the file in use: Frank B : hope you see this and it looks right

  5. #30
    Member
    Join Date
    Oct 2018
    Location
    London
    Posts
    55
    Just to clarify, I tested it on Mac. This is for version 1.8.9 of the IDE. Not yet tested on T4. Just starting to solder pins and SPI2 for underside of T4 board.

  6. #31
    Member
    Join Date
    Oct 2018
    Location
    London
    Posts
    55
    My tests involved using the following settings in defs.h:
    Code:
    -DSERIAL1_RX_BUFFER_SIZE=345
    -DSERIAL1_TX_BUFFER_SIZE=123
    -DF_CPU=144000000
    The test code was simply:
    Code:
    void setup() {
      Serial.begin(115200);
      elapsedMillis waiting;
      while (!Serial && waiting < 1000) {} // Wait for output //
      Serial.print("*** init ***");
      
      #ifdef SERIAL1_RX_BUFFER_SIZE
        Serial.print("SERIAL1_RX_BUFFER_SIZE: " + String(SERIAL1_RX_BUFFER_SIZE));
      #endif
      #ifdef SERIAL1_TX_BUFFER_SIZE
        Serial.print("SERIAL1_TX_BUFFER_SIZE: " + String(SERIAL1_TX_BUFFER_SIZE));
      #endif
      #ifdef F_CPU
        Serial.print("F_CPU: " + String(F_CPU));
      #endif
    }
    Tested on Mac platform using T3.6 and T4. Both responded with the correct values output.

    Next, I tried to verify a different project, not using the defs.h key-value file and got errors. It made me think that the bash script was not working, it's function being to create the file if not present. I checked the platform.txt file above and found the macosx line was commented out! Removing the # comment fixed it, and now projects can be build whether or not they have an associated defs.h file or not. Yay! See attached:platform.txt

    I think this solution is amazing and I'm surprised it has so few takers. I can only think that folks don't realise how simple-to-use and powerful it really is.

    Many thanks @Frank B for building a project-level override for system settings.

  7. #32
    Member
    Join Date
    Oct 2018
    Location
    London
    Posts
    55
    For the record, on the Mac, the platform.txt file is the one that lives at: Arduino.app/Contents/Java/hardware/teensy/avr/platform.txt

Posting Permissions

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