Closed gudnimg closed 3 years ago
Memory usage change @ 68ac2aed3c5db856020dbcb15e39dc803f674ff6
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:avr:leonardo | :green_heart: -134 - 0 | -0.47 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:mega | :green_heart: -134 - 0 | -0.05 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:nano | :green_heart: -134 - 0 | -0.44 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:nona4809 | :green_heart: -132 - 0 | -0.27 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:uno2018 | :green_heart: -132 - 0 | -0.27 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:sam:arduino_due_x_dbg | :green_heart: -88 - 0 | -0.02 - 0.0 | N/A | N/A |
arduino:samd:arduino_zero_edbg | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkr1000 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrfox1200 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrgsm1400 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrnb1500 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1300 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1310 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrzero | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:nano_33_iot | :green_heart: -64 - 0 | -0.02 - 0.0 | 0 - 0 | 0.0 - 0.0 |
@aentinger @cmaglie @per1234 I see from the commit history you were the last to commit to this repo. Would a review be possible? I'm not sure who to ask.
and you say you tested DNS and DHCP with this? because it can't work with the numbers in host order of Arduinos. the macros swap the endianness between host and network order.
#include <Ethernet.h>
void setup() {
Serial.begin(115200);
uint32_t n32 = 0x01020304;
Serial.print("0x0");
Serial.println(n32, HEX);
n32 = htonl(n32);
Serial.print("0x0");
Serial.println(n32, HEX);
uint16_t n16 = 0x0102;
Serial.print("0x0");
Serial.println(n16, HEX);
n16 = htons(n16);
Serial.print("0x0");
Serial.println(n16, HEX);
}
void loop() {
}
output
0x01020304
0x04030201
0x0102
0x0201
@jandrassy Very good point. Thank you. I think it's best for me to focus on fixing the compiler warning 😅 . I reverted most of the changes but added comments above the macros.
Memory usage change @ 550940306c2d1ead18eb7f788224592acd1c4f12
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
arduino:avr:leonardo | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:mega | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:nano | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:nona4809 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:megaavr:uno2018 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:sam:arduino_due_x_dbg | 0 - 0 | 0.0 - 0.0 | N/A | N/A |
arduino:samd:arduino_zero_edbg | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkr1000 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrfox1200 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrgsm1400 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrnb1500 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrvidor4000 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1300 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwan1310 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrwifi1010 | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:mkrzero | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:nano_33_iot | 0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
any updates on this?
and you say you tested DNS and DHCP with this? because it can't work with the numbers in host order of Arduinos. the macros swap the endianness between host and network order.
Btw is this still an issue in the merged changes?
and you say you tested DNS and DHCP with this? because it can't work with the numbers in host order of Arduinos. the macros swap the endianness between host and network order.
Btw is this still an issue in the merged changes?
it is not. @gudnimg removed from this PR all problematic changes except of a super simple change to avoid the warning.
Fixes #151 Fixes #122
The macros are completely redundant. Using for examplehtons()
on auint16_t
just wastes cycles if the compiler doesn't optimise it out.htons()
converts a variable to 16 bits (which does nothing for a 16 bit variable). Same goes forhtonl()
for 32-bit variables.Building these changes in a project of mine shows the memory footprint is reduced by 32 bytes. This will also fix two issues related to overflow compiler warnings withhtons()
.Edit: This PR will only fix the compiler warning in the linked issues.