cancel
Showing results for 
Search instead for 
Did you mean: 

How to not compile USB device ?

SA.17
Associate III

Hi ,

I have added usb functionality in my code using stm32cubemx.

Now i don't want to compile it using #if or #ifdef

How to do it ?

I tried following:

I used #if to remove usb initializing function and not used usb in any code , but when i saw .map file still following files are getting compiled

usbd_conf.o

usbd_core.o

usbd_ctlreq.o

usbd_ioreq.o

1 REPLY 1
Paul1
Lead

You would need to remove the files from linking,

exclude them in the project's file list.

Easier:

  • Copy ioc file (backup in case you want USB later, rename backup as ***_WithUSB.ioc)
  • Open in MX, disable/remove USB features, save project, regenerate code.
  • Build and check map file