arduinoWebSockets
arduinoWebSockets copied to clipboard
AVR program memory use too high
I'm using an UNO and get the following:
AVR Memory Usage
----------------
Device: atmega328p
Program: 47702 bytes (145.6% Full)
(.text + .data + .bootloader)
Data: 1199 bytes (58.5% Full)
(.data + .bss + .noinit)
It compiles to 145.6% and won't fit in memory so it can't be uploaded.
can confirm this, looks like the core is getting bigger may some optimization has been changed. short fix use a atmega2560 board.
first analyses with:
avr-nm --size-sort --print-size -r -td
00000676 00024100 T SHA1Transform
00034604 00000934 T _ZN9DhcpClass17parseDHCPResponseEmRm
00029076 00000918 T _ZN16WebSocketsClient12handleHeaderEP10WSclient_t
00035538 00000774 T _ZN9DhcpClass18request_DHCP_leaseEv
00036966 00000710 T _ZN9DNSClient15ProcessResponseEjR9IPAddress
00027190 00000608 T _ZN10WebSockets15handleWebsocketEP10WSclient_t
00034042 00000562 T _ZN9DhcpClass17send_DHCP_MESSAGEEhj
00025572 00000424 T base64_encode_block
00046946 00000404 T realloc
00026072 00000382 T _ZN10WebSockets9sendFrameEP10WSclient_t10WSopcode_tPhjbbb
00028722 00000354 T _ZN16WebSocketsClient10sendHeaderEP10WSclient_t
00024876 00000342 T SHA1Update
00036628 00000338 T _ZN9DNSClient12BuildRequestEPKc
00025218 00000316 T SHA1Final
00038012 00000310 T _ZN13EthernetClass5beginEPh
00046170 00000304 T malloc
00031412 00000302 T _Z4sendhPKhj
00037676 00000294 T _ZN9DNSClient13getHostByNameEPKcR9IPAddress
00046474 00000286 T free
00038472 00000234 T _ZN13EthernetClass5beginEPh9IPAddressS1_S1_
00033198 00000222 T _ZN10W5100Class27send_data_processing_offsetEhjPKhj
00026602 00000214 T _ZN10WebSockets13base64_encodeEPhj
00032624 00000208 T _ZN10W5100Class4initEv
00041234 00000202 T _ZN14HardwareSerial5writeEh
00026988 00000202 T _ZN10WebSockets8readWaitEP10WSclient_tPhj
00041436 00000196 T _ZN14HardwareSerial5beginEmh
00030104 00000194 T _ZN16WebSocketsClient4loopEv
00045788 00000194 T __mulsf3x
00031714 00000192 T _Z4recvhPhi
00045226 00000192 T __addsf3x
00044192 00000190 T _ZN6String4trimEv
00039384 00000188 T _ZN14EthernetClient7connectEPKcj
00040772 00000188 T _ZN11EthernetUDP11beginPacketEPKcj
00039624 00000186 T _ZN14EthernetClient7connectE9IPAddressj
00042348 00000178 T _ZN5Print11printNumberEmh
00031160 00000176 T _Z7connecthPhj
00027918 00000174 T _ZN16WebSocketsClient16clientDisconnectEP10WSclient_t
00038706 00000174 T _ZN13EthernetClass5beginEPh9IPAddressS1_
00026816 00000172 T _ZN10WebSockets9acceptKeyE6String
00030992 00000168 T _Z6sockethhjh
00032370 00000164 T _Z7sendUDPh
00000294 00000162 T _Z14webSocketEvent8WStype_tPhj
00000456 00000160 T setup
00040570 00000160 T _ZN11EthernetUDP11parsePacketEv
00033682 00000160 T _ZN10W5100Class20recv_data_processingEhPhjh
08389901 00000157 B Serial
00046760 00000152 t do_random
00038322 00000150 T _ZN13EthernetClass5beginEPh9IPAddressS1_S1_S1_
00026454 00000148 T _ZN10WebSockets16clientDisconnectEP10WSclient_tjPcj
00044446 00000148 T __vector_16
00033538 00000144 T _ZN10W5100Class9read_dataEhjPVhj
00032088 00000142 T _Z10bufferDatahjPKhj
00032230 00000140 T _Z8startUDPhPhj
00044054 00000138 T _ZNK6String9substringEjj
00036312 00000138 T _ZN9DhcpClass13beginWithDHCPEPhmm
00041828 00000134 t _GLOBAL__sub_I___vector_18
00036476 00000130 T _ZN9DNSClient9inet_atonEPKcR9IPAddress
00028302 00000130 T _ZN16WebSocketsClient5beginEPKcjS1_
00028440 00000128 T _ZN16WebSocketsClient7sendTXTEPhjb
00038880 00000124 T _ZN13EthernetClass5beginEPh9IPAddress
00045480 00000122 T __floatunsisf
00044768 00000118 T init
00041962 00000116 T _ZNK9IPAddress7printToER5Print
00039810 00000116 T _ZN14EthernetClient4stopEv
00044968 00000114 T pinMode
00043710 00000114 T _ZNK6String16equalsIgnoreCaseERKS_
00028092 00000112 T _ZN16WebSocketsClient17clientIsConnectedEP10WSclient_t
00029994 00000110 T _ZN16WebSocketsClient16handleClientDataEv
00045082 00000108 T digitalWrite
00030386 00000108 T _ZN8SPIClass5beginEv
00024776 00000100 T SHA1Init
00030494 00000100 W _ZN11SPISettingsC2Emhh
00030494 00000100 W _ZN11SPISettingsC1Emhh
00041632 00000100 T __vector_18
...............
looks like the SHA1 needs the most space.
This issue is still present:
this is when i compile the WebSocketClientAVR example file from the ATmega branch:
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"
Sketch uses 43594 bytes (135%) of program storage space. Maximum is 32256 bytes.
Global variables use 1286 bytes (62%) of dynamic memory, leaving 762 bytes for local variables. Maximum is 2048 bytes.
This issue is still present:
this is when i compile the WebSocketClientAVR example file from the ATmega branch:
Sketch uses 36670 bytes (113%) of program storage space. Maximum is 32256 bytes.text section exceeds available space in board
Global variables use 776 bytes (37%) of dynamic memory, leaving 1272 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board Arduino Uno.