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
+5
@@ -27,6 +27,7 @@
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
|
||||
#include "usb_conf.h"
|
||||
#include "usbd_core.h"
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
@@ -111,7 +112,11 @@ MSC_BOT_CSW_TypeDef;
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(BOOT)
|
||||
extern uint8_t MSC_BOT_Data[];
|
||||
#else
|
||||
extern uint8_t* MSC_BOT_Data;
|
||||
#endif
|
||||
extern uint16_t MSC_BOT_DataLen;
|
||||
extern uint8_t MSC_BOT_State;
|
||||
extern uint8_t MSC_BOT_BurstMode;
|
||||
|
||||
+3
-1
@@ -80,7 +80,9 @@ uint8_t MSC_BOT_Status;
|
||||
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
|
||||
|
||||
#include "definitions.h"
|
||||
uint8_t MSC_BOT_Data[MSC_MEDIA_PACKET] __DMA; // modified by OpenTX
|
||||
#if defined(BOOT)
|
||||
uint8_t MSC_BOT_Data[MSC_MEDIA_PACKET] __DMA; // modified by OpenTX
|
||||
#endif
|
||||
|
||||
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
|
||||
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
|
||||
|
||||
Reference in New Issue
Block a user