Save memory (move usb mass storage buffer to reusableBuffer) (#5579)

* Save 128 byte by moving variable to stack

* Make usb mass storage buffer smaller on F2 processors and put into reuseablebuffer

- Lower USB mass storage buffer to 512 bytes per default on F2
  targets, makes usb speed slightly slower ~600 kB/s instead ~700 KB/s
  in my tests, saving 3584 bytes
- Save another ~300 bytes by putting that buffer into reusableBuffer

* Don't put id into reusuableBuffer

All uses of id can be on the stack as well. Makes no difference for ram usage but makes it safer to reuse reusableBuffer

* Only link cdc serial when needed

We always linked usb cdc even in non debug builds. CDC uses about ~600 byte of RAM for its buffers and structures.
This commit is contained in:
Arne Schwabe
2018-01-26 19:00:47 +01:00
committed by Bertrand Songis
parent 95df593c2f
commit 4925e756a6
15 changed files with 53 additions and 24 deletions
+3 -2
View File
@@ -22,6 +22,7 @@
bool menuRadioVersion(event_t event)
{
char id[27];
#if 0
if (warningResult) {
warningResult = 0;
@@ -32,7 +33,7 @@ bool menuRadioVersion(event_t event)
#endif
if (event == EVT_ENTRY) {
getCPUUniqueID(reusableBuffer.version.id);
getCPUUniqueID(id);
}
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0);
@@ -42,7 +43,7 @@ bool menuRadioVersion(event_t event)
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 3*FH, time_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, eeprom_stamp);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 5*FH, "UID:");
lcdDrawText(MENUS_MARGIN_LEFT + 64, MENU_CONTENT_TOP + 5*FH, reusableBuffer.version.id);
lcdDrawText(MENUS_MARGIN_LEFT + 64, MENU_CONTENT_TOP + 5*FH, id);
#if 0
if (event == EVT_KEY_LONG(KEY_ENTER)) {