ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.67k stars 2.98k forks source link

Support for USB slave functions on smaller micro's (e.g. LPC11U23) #68

Closed pbrier closed 6 years ago

pbrier commented 11 years ago

When using smaller microcontrollers, like the LPC11U23, some USB functions take up a considerable amount of memory, and do fit or leave too little memory for useful work (depending on compiler and std. libraries used; KEIL performing better than GCC). One solution is not to include the Stream class, and remove this from the USB classes. Now it does fit (of course you loose the standard Stream functionality on the interface):

For example: modify line 92 of USBKeyboard.h from:

class USBKeyboard: public USBHID, public Stream {

to

class USBKeyboard: public USBHID {

Note: A similar issue is occurs with the Serial() class, you can remove the Stream or access the C-api directly to conserve memory.

Question: Can a build option be provided for compilation without Stream classes? (e.g. NOCPPSTREAM?)

emilmont commented 11 years ago

Hi Peter, did you collect some numbers about how much memory it would save?

Thanks, Emilio

mbednotifications commented 11 years ago

On Monday, September 16, 2013 1:13:56 PM UTC-4, Peter Brier wrote:

When using smaller microcontrollers, like the LPC11U23, some USB functions take up a considerable amount of memory

NXP LPC11Uxx, LPC18xx and LPC43xx MCUs include a USB device stack in ROM that can reduce code and memory size requirements for implementing USB devices. It supports CDC, DFU, HID, MSC and custom classes, including composites. Documentation is somewhat weak, so a solid implementation usually takes some iteration. We have used it with our LPC43xx boards and it works well. May consider adding support for it in the mbed LPC43xx port later this year.

http://docs.lpcware.com/usbromlib/v1.0/

Regards, Jesus Alvarez

mbednotifications commented 11 years ago

You could also consider to disable DEVICE_STDIO_MESSAGES. Those take up quite some memory as well.

On Monday, September 16, 2013 10:13:56 AM UTC-7, Peter Brier wrote:

When using smaller microcontrollers, like the LPC11U23, some USB functions take up a considerable amount of memory, and do fit or leave too little memory for useful work (depending on compiler and std. libraries used; KEIL performing better than GCC). One solution is not to include the Stream class, and remove this from the USB classes. Now it does fit (of course you loose the standard Stream functionality on the interface):

For example: modify line 92 of USBKeyboard.h from:

class USBKeyboard: public USBHID, public Stream {

to

class USBKeyboard: public USBHID {

Note: A similar issue is occurs with the Serial() class, you can remove the Stream or access the C-api directly to conserve memory.

Question: Can a build option be provided for compilation without Stream classes? (e.g. NOCPPSTREAM?)

— Reply to this email directly or view it on GitHubhttps://github.com/mbedmicro/mbed/issues/68 .

ciarmcom commented 8 years ago

ARM Internal Ref: IOTMORF-330

ghost commented 6 years ago

GitHib issue review: Closed due to inactivity. Please re-file if critical issues found.