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:
committed by
Bertrand Songis
parent
95df593c2f
commit
4925e756a6
@@ -23,7 +23,7 @@
|
||||
#define _USBD_CONF_H_
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usb_conf.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
#define USBD_CFG_MAX_NUM 1
|
||||
#define USBD_ITF_MAX_NUM 1
|
||||
@@ -37,7 +37,12 @@
|
||||
#define MSC_OUT_EP 0x01
|
||||
#define MSC_MAX_PACKET 64
|
||||
|
||||
// Save some RAM on smaller STM32 processors. Slightly lowers USB mass storage speed
|
||||
#if defined(STM32F2) && !defined(BOOT)
|
||||
#define MSC_MEDIA_PACKET 512
|
||||
#else
|
||||
#define MSC_MEDIA_PACKET 4096
|
||||
#endif
|
||||
|
||||
#define HID_IN_EP 0x81
|
||||
#define HID_OUT_EP 0x01
|
||||
|
||||
Reference in New Issue
Block a user