HardwareSerial core library

Hello,

I have reached the point where I filled up my atmega32u4 with 99.99% of the flash size.

That is after optimizing everything I could think of. My sketch includes:

4K bootloader 2 softwareSerial ports, 1 for WIFI module, 1 for GPRS module Serial0 port enabled for terminal communication with PC Serial1 port enabled for GPS module WDT enabled EEPROM in use PROGRAMMEM in use TinyGPS++ library in use GPS module in use Sim900 in use for GPRS communication Accelerometer ADC input in use I2C for LCD screen in use

All those features are bundled in a complex state-machine algorithm that fits perfectly onto the 28Kbyte available FLASH mem (4K is used by the bootloader - Needed for updating, JTAG not available)

And now I'm requested to a Bluetooth module :@

After some trail and error (commenting out chunks of code) I have found that the only possible place I have left to reduce some size is the Serial1 usage.

Enabling Serial1.read()/Serial1.available() in my code, add 6500bytes. I was wondering how is this library so big if its only the Hardware RX\TX serial com, some interrrupts and bitbanging?

I will be thankfull if someone can shed some light on what's happening in this library that it takes 1/4 of the FLASH mem size.

PS: My mega32u4-RC is on a custom clone circuit of arduino-micro, It runs on its' internal 1Mhz RC so I have modiefied the bootloader and USBCore to make it work. If it can be usefull I can post the edited files.

Roman

Post your code, I'm sure there are places where things can be optimized and hopefully make room for what you need.

NeoGPS could save you quite a bit of flash and RAM, compared toTinyGPS++: somewhere between 200 and 1200 bytes of RAM. It can be configured to parse and save only the messages and fields that you actually use.

Cosa is a stunning masterpiece, if you are comfortable with true Object-Oriented C++. Very lean.

Cheers, /dev