Skip to content

F103 USB CDC won't build with Sloeber #486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cdrose opened this issue Mar 28, 2019 · 5 comments
Closed

F103 USB CDC won't build with Sloeber #486

cdrose opened this issue Mar 28, 2019 · 5 comments
Labels
invalid This doesn't seem right

Comments

@cdrose
Copy link

cdrose commented Mar 28, 2019

STM32F103C8T6 BluePill
Eclipse with Sloeber plugin
Arduino Core STM32 1.5.0 latest
Windows 10

I'm getting a string of errors if I try to include USB CDC into my project. It looks a bit like there's a missing #define and then a bunch of other macros don't expand properly, but I don't know enough about how this is all meant to work to spot the problem. I see from other comments people are using CDC so it must have been working before, or my build environment isn't set up correctly.

Any ideas?

In file included from C:\eclipse\arduinoPlugin\packages\STM32\hardware\stm32\1.5.0\cores\arduino\stm32\usb\usbd_desc.c:23:0:
C:\eclipse\arduinoPlugin\packages\STM32\hardware\stm32\1.5.0\cores\arduino\stm32\usb\usbd_desc.c: In function 'USBD_CDC_ProductStrDescriptor':
:0:13: error: 'BLUEPILL_F103C8' undeclared (first use in this function)
C:\eclipse\arduinoPlugin\packages\STM32\hardware\stm32\1.5.0\cores\arduino/utils.h:7:26: note: in definition of macro 'CONCATS'
#define CONCATS(s1, s2) (s1" " s2)
^~
C:\eclipse\arduinoPlugin\packages\STM32\hardware\stm32\1.5.0\cores\arduino\stm32\usb\usbd_desc.c:53:51: note: in expansion of macro 'USB_PRODUCT'
#define USBD_CDC_PRODUCT_HS_STRING CONCATS(USB_PRODUCT, "CDC in HS Mode")
^~~~~~~~~~~
C:\eclipse\arduinoPlugin\packages\STM32\hardware\stm32\1.5.0\cores\arduino\stm32\usb\usbd_desc.c:230:31: note: in expansion of macro 'USBD_CDC_PRODUCT_HS_STRING'
USBD_GetString((uint8_t *)USBD_CDC_PRODUCT_HS_STRING, USBD_StrDesc, length);
^~~~~~~~~~~~~~~~~~~~~~~~~~

eclipse errors.txt

@fpistm
Copy link
Member

fpistm commented Mar 28, 2019

Hi @cdrose
right some people already raised this issue.
I never met him.
Anyway, with Arduino IDE (on Windows and Linux), USB_PRODUCT is well defined:
"-DUSB_PRODUCT=\"BLUEPILL_F103C8\""
With Eclipse + Sloeber on Linux, it works also:
'-DUSB_PRODUCT="BLUEPILL_F103C8"'

I could not test under windows as I get a proxy issue to install Sloeber.
Anyway on you log we see that:
"-DUSB_PRODUCT="BLUEPILL_F103C8""

This is why you get this error. Don't know how Sloeber parse the platform.txt but it is linked to that. I advise you to submit an issue on Sloeber.
In platform.txt this is how it is defined:
'-DUSB_PRODUCT="{build.board}"'

build.usb_flags=-DUSBCON {build.usb_speed} -DUSBD_VID={build.vid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT="{build.board}"' -DHAL_PCD_MODULE_ENABLED

One workaround could be to edit the properties of your project, then go to "C/C++ Build" -> "Environment" and search "A.BUILD.USB_FLAGS"
Then you can edit it to fix the USB_PRODUCT definition with Sloeber.
On Linux I get:
-DUSBCON ${A.BUILD.USB_SPEED} -DUSBD_VID=${A.BUILD.VID} '-DUSB_MANUFACTURER=${A.BUILD.USB_MANUFACTURER}' '-DUSB_PRODUCT="${A.BUILD.BOARD}"' -DHAL_PCD_MODULE_ENABLED

@fpistm fpistm changed the title F103 USB CDC won't build F103 USB CDC won't build with Sloeber Mar 28, 2019
@fpistm fpistm added invalid This doesn't seem right waiting feedback Further information is required labels Mar 28, 2019
@fpistm
Copy link
Member

fpistm commented Mar 29, 2019

Any feedback ?

@cdrose
Copy link
Author

cdrose commented Mar 29, 2019

Sorry haven't been able to look into this further yet. Ill see if anyone has mentioned it on the Sloeber page. Hopefully I have some time to work on it early next week.

@cdrose
Copy link
Author

cdrose commented Mar 31, 2019

It looks like this has been raised previously with Sloeber and the fix is non-trivial:
Sloeber/arduino-eclipse-plugin#1047 (comment)

@fpistm
Copy link
Member

fpistm commented Apr 3, 2019

Thanks @cdrose
I close this one as linked to how Sloeber handle/parse the platform.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants