Code with alot of text has me confused

Status
Not open for further replies.

grease_lighting

Well-known member
First off I am running Arduino 1.6.5-r2 with Teensyduino 1.24 on a windows 7 machine. I am using a Teensy 3.1.

Basically my project talks to a device over the Ethernet using UDP messages and I compare the results to an expected character array. As I started adding more detail to my character strings I crossed a line where Ethernet begin(mac, ip) would hang at about 63K bytes of program storage space. My global variables use is 5,396 bytes. As a test I hacked out a bunch of code untill it was about 56K in size and it worked again (did not hang).

I am using a knock off Arduino W5100 shield.

I am not using an SD Card in this project. I have read about the dangers using combo SD and Ethernet shields.

I was under the impression that I had 256k available, but am only 25% there. Are there some caveats to creating large programs? Is this related to the level of Arduino I am using? Is the .h file usage included in the program storage space?

I searched 'max sketch size' but no joy.
 
Arduino IDE 1.65r2 had some bugs.

Current Arduino IDE is 1.6.6, but I'd recommend trying 1.6.5r5: it is tried&tested, fully compatibile with 1.6.5 (while 1.6.6 is a big jump forward, despite the .0.1 difference).
Works well with Teensyduino 1.2.6b1 (while b2 is developed with Arduino IDE 1.6.6 in mind).
I'm developing a sketch which is now using 68 MB of flash space, so definitely no 64KB barrier with 1.6.5r5 + 1.2.6b1
 
Last edited:
I was working on a tutorial example today that nearly fills all 256K. Worked fine. Admittedly about half was a big array of data. It used the FFT object in the audio library,which includes a lot of code.
 
Per XFer's suggestion I tried 1.6.5 with 1.26 b1 but no joy.

I found out that server does not like to play with udp for some reason when large character arrays get transferred.

I disabled the server stuff and the code came back to life and continues to grow.

Thanks for all your suggestions.
 
I found out that server does not like to play with udp for some reason when large character arrays get transferred.
How large do you consider to be large? There is something called the MTU, which is dependent on the hardware in the communication path. Packages larger than the MTU will be dropped, it is usually 1500 bytes.
 
The messages I am sending via UDP are about 40 characters max. Basically my UDP routine is the same as the example from arduino. There is an expected answer char array that was initially only expecting about 30 characters. I had about 80 message exchanges working. Then I added more detail (50-80 characters) to those expect char arrays. When the compiled (?) program size approached about 56k or so, the <server begin> never completed. When I removed those lines of code <server begin> the program began working again. I allowed for 1023 characters in the expect char array and was using <strcpy(expect, "expected text")> to fill the arrays.

I've never really got a handle on passing variable lists and context so my program style leans more to use of global variables. Previously I wrote test control programs in HP Rocky Mountain Basic and Trans Era HTB which is similar. I have read on line that this has 'ruined' my ability to write programs, but I try anyway.
 
Status
Not open for further replies.
Back
Top