Go Down

Topic: Adjusting serial buffer size in IDE, mk2 (Read 2851 times) previous topic - next topic

Coding Badly


Which version of the Arduino IDE are you using?


Leonas


NoManCode

Do this...

• Ensure the Arduino IDE is not running

• Locate boards.txt

• Make a backup copy

• Open boards.txt using your favourite Linux friendly text editor.  I use Visual Studio or Delphi.

• Locate an entry of interest.  I used the one for the Uno.

• Select the entire entry

• Copy the entire entry

• Navigate to the bottom of boards.txt

• Paste the entry

• Carefully change all of the tags in the new entry to something unique.  I changed "uno." to "unox."

• Change the entry name.  I changed my entry name to this...

unox.name=Arduino Uno - Custom Build

• Add this one option to the entry...

unox.build.extra_flags=-include "{build.path}/build_options.h"

• Save boards.txt

• Close the text editor

• Open the Arduino IDE

• Create a new sketch

• Add a tab named "build_options.h"

• Add whatever you want to "build_options.h".  This is what I used...

Code: [Select]

#ifndef build_options_h
#define build_options_h

#define SERIAL_TX_BUFFER_SIZE 16
#define SERIAL_RX_BUFFER_SIZE 16

#endif


• Verify

• Enjoy

Note: When you upgrade the IDE boards.txt is removed.  Make a backup before upgrading.




Complete example...

Code: [Select]
##############################################################

unox.name=Arduino Uno - Custom Build

unox.vid.0=0x2341
unox.pid.0=0x0043
unox.vid.1=0x2341
unox.pid.1=0x0001
unox.vid.2=0x2A03
unox.pid.2=0x0043

unox.upload.tool=avrdude
unox.upload.protocol=arduino
unox.upload.maximum_size=32256
unox.upload.maximum_data_size=2048
unox.upload.speed=1000000

unox.bootloader.tool=avrdude
unox.bootloader.low_fuses=0xFF
unox.bootloader.high_fuses=0xDE
unox.bootloader.extended_fuses=0x05
unox.bootloader.unlock_bits=0x3F
unox.bootloader.lock_bits=0x0F
unox.bootloader.file=optiboot/optiboot_atmega328.hex

unox.build.mcu=atmega328p
unox.build.f_cpu=16000000L
unox.build.board=AVR_UNO
unox.build.core=arduino
unox.build.variant=standard

unox.build.extra_flags=-include "{build.path}/build_options.h"

##############################################################





A big thank you to foraidt...
http://stackoverflow.com/a/3387518

Thanks for explaining this Coding Badly. This was exactly what I wanted to do: set the serial buffer on a per sketch basis instead of as a global option.

The only issue I ran into was that with the last line unox.build.extra_flags=-include "{build.path}/build_options.h" I would get an error 1 while verifying that the file build_option.h could not be created or found. I checked the temp file path in the output log and build_option.h was in there with the values I had entered.

I infinitely checked the code for errors and could not find any. The IDE I am using is 1.6.9. It wasn't until after A LOT of digging around that I found someone with this error. They said that by changing -include to -l  solved their problem.  I did so and my sketch compiled without any errors! Strange since the post with that solution was from a year before yours.
 
Did the IDE commands change in the newer releases?

Coding Badly


NoManCode

Sorry but I'm a complete noob to Arduino programming, as in I still have pieces of shrink wrap to take off so I have little idea about how to interpret the links you posted.

I have included my boards and verify logs for both -l and -include if you would like see what the output is for each one. I don't expect you to go through all of it but I did want you to see how I have my files configured in case it is some stupid mistake on my part (most likely).

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy