9 years, 8 months ago.

USBSerial on Nucleo F302

Hi,

I am trying to use USBSerial on an ST Micro Nucleo F302R8 but the file USBEndPoints.h is looking for a define of the form TARGET_STM32F4XX in order to include the correct endpoint definition file. The F302 has, unsurprisingly, an STM32F302 MCU, which is not one of the supported architectures. I can figure out how to build the correct file, but I am using the online compiler and cannot figure out how to set the define. I would deeply appreciate any advice on how to proceed.

Thanks!

After Erik's, comment I decided to add the code snippet that fails to compile.

  1. if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088)
  2. include "USBEndpoints_LPC17_LPC23.h"
  3. elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347) || defined (TARGET_LPC11U6X) || defined (TARGET_LPC1549)
  4. include "USBEndpoints_LPC11U.h"
  5. elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
  6. include "USBEndpoints_KL25Z.h"
  7. elif defined (TARGET_F302R8)
  8. include "USBEndpoints_STM32F4.h"
  9. elif defined (TARGET_STM32F3XX)
  10. include "USBEndpoints_STM32F4.h"
  11. else
  12. error "Unknown target type"
  13. endif

How do you mean set the define? The F302 has TARGET_F302R8 set.

posted by Erik - 31 Jul 2014

Thanks for the response, Eric, but that define is also not set. By 'set the define' I mean either the preprocessor define or the environment variable that will allow USBEndPoints.h to compile. I tried TARGET_F302R8 but it didn't work. Is there a way to grep the code base using the online compiler? Can you tell me which file (source?, makefile?, project file?) where TARGET_F302R8 is set?

Thanks!

posted by Duane Hooton 31 Jul 2014

1 Answer

9 years, 8 months ago.

My bad, had the wrong name:

The complete mbed code base is here: https://github.com/mbedmicro/mbed

I don't know exactly what all python scripts do, but targets are defined here: https://github.com/mbedmicro/mbed/blob/master/workspace_tools/targets.py. And every label is normally added as define in the form of TARGET_[label]. So you can use for example: TARGET_NUCLEO_F302R8. It is the same as the names in the mbed folder structure, so for STM targets: https://mbed.org/users/mbed_official/code/mbed-src/file/402bcc0c870b/targets/hal/TARGET_STM