Problem in building micropython ( error in usbd_def.h)

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Problem in building micropython ( error in usbd_def.h)

Post by nikhiledutech » Thu Mar 01, 2018 5:59 am

Hey,

I am currently trying to build and flash micropython on STM32F4DISC board. After first few steps of building,
In micropython/ports/stm32/
when i execute the make and make BOARD=STM32F4DISC i get the following error.
> > In file included from usbdev/core/inc/usbd_core.h:34:0,
> from usbd_conf.c:33:
> usbdev/core/inc/usbd_def.h:147:5: error: unknown type name 'uint8_t'
> uint8_t bmRequest;
> ^
> usbdev/core/inc/usbd_def.h:148:5: error: unknown type name 'uint8_t'
> uint8_t bRequest;
> ^
> usbdev/core/inc/usbd_def.h:149:5: error: unknown type name 'uint16_t'
> uint16_t wValue;
> ^
> usbdev/core/inc/usbd_def.h:150:5: error: unknown type name 'uint16_t'
> uint16_t wIndex;
> ^
> usbdev/core/inc/usbd_def.h:151:5: error: unknown type name 'uint16_t'
> uint16_t wLength;
> ^
> usbdev/core/inc/usbd_def.h:158:3: error: expected specifier-qualifier-list before 'uint8_t'
> uint8_t (*Init) (struct _USBD_HandleTypeDef *pdev , uint8_t cfgidx);
> ^
> usbdev/core/inc/usbd_def.h:198:3: error: unknown type name 'uint8_t'
> uint8_t *(*GetDeviceDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
> ^
> usbdev/core/inc/usbd_def.h:198:69: error: unknown type name 'uint16_t'
> uint8_t *(*GetDeviceDescriptor)(struct _USBD_HandleTypeDef *pdev, uint16_t *length);
> ^
> usbdev/core/inc/usbd_def.h:199:3: error: expected ';' before 'uint8_t'
> uint8_t *(*GetStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint8_t idx, uint16_t *length);
> ^
> usbdev/core/inc/usbd_def.h:205:3: error: unknown type name 'uint32_t'
> uint32_t status;
> ^
> usbdev/core/inc/usbd_def.h:206:3: error: unknown type name 'uint32_t'
> uint32_t total_length;
> ^
> usbdev/core/inc/usbd_def.h:207:3: error: unknown type name 'uint32_t'
> uint32_t rem_length;
> ^
> usbdev/core/inc/usbd_def.h:208:3: error: unknown type name 'uint32_t'
> uint32_t maxpacket;
> ^
> usbdev/core/inc/usbd_def.h:214:3: error: unknown type name 'uint8_t'
> uint8_t id;
> ^
> usbdev/core/inc/usbd_def.h:215:3: error: unknown type name 'uint32_t'
> uint32_t dev_config;
> ^
the error goes on.
So how to remove this error ?
This type of problem didn't happened when i build the micropython few months before.

nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Re: Problem in building micropython ( error in usbd_def.h)

Post by nikhiledutech » Thu Mar 01, 2018 7:05 am

If anyone face same problem add the following files in usbd_conf.h file
#include "stm32f4xx.h"
#include "stm32f4xx_hal.h"
and save. And build again . It will successfully build micropython.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Problem in building micropython ( error in usbd_def.h)

Post by Roberthh » Thu Mar 01, 2018 8:54 am

For the cited error messages, the following is sufficient:

#include <stdint.h>

Since a few weeks I have the same problem with the MP build, that is some compiles these standard types ar not known any more.

nikhiledutech
Posts: 118
Joined: Wed Dec 27, 2017 8:52 am

Re: Problem in building micropython ( error in usbd_def.h)

Post by nikhiledutech » Thu Mar 01, 2018 9:15 am

Okay. thanks sir.

Post Reply