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
+6 -1
View File
@@ -49,7 +49,12 @@ uint8_t heartbeat;
safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
#endif
union ReusableBuffer reusableBuffer;
// __DMA for the MSC_BOT_Data member
union ReusableBuffer reusableBuffer __DMA;
#if defined(STM32)
uint8_t* MSC_BOT_Data = reusableBuffer.MSC_BOT_Data;
#endif
const pm_uint8_t bchout_ar[] PROGMEM = {
0x1B, 0x1E, 0x27, 0x2D, 0x36, 0x39,