cancel
Showing results for 
Search instead for 
Did you mean: 

uint8_t definition

greg_t
Associate II
Posted on August 13, 2010 at 16:28

uint8_t definition

16 REPLIES 16
domen23
Associate II
Posted on May 17, 2011 at 14:02

IT DEPENDS ON YOUR LIBC

On codesourcery's arm-2010q1 lite it's in arm-none-eabi-include/stdint.h .

line 42 typedef unsigned char uint8_t ;

I bet this helped you a lot!

There are tools for searching for strings in files, you know.

Posted on May 17, 2011 at 14:02

but this line from the stdint.h 

typedef __UINT8_T_TYPE__ uint8_t;

There is no stdint.h file in the STM32F10x_StdPeriph_Lib v3.3.0 download dated Apr-2010:

 

http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib.zip

- so you must be looking at an earlier version, or something toolchain-specific.

Note that, by convention, names in ALL CAPITALS are preprocessor #defines - so have you searched for a #define __UINT8_T_TYPE__   ?

Any decent IDE should have a ''Go To Definition'' facility - have you tried that...?

drzile86
Associate II
Posted on May 17, 2011 at 14:02

Hi,

in stdint.h you this definition 

typedef unsigned char uint8_t;

Cheers,

Dragan

Posted on May 17, 2011 at 14:02

''in stdint.h you this definition 

typedef unsigned char uint8_t;''

As I just noted, there is no stdint.h anywhere in the ST Library!

Therefore any stdint.h that you may have is specific to your particular (unspecified) toolchain - and is clearly not the same as the one in the OP's (unspecified) toolchain!

Posted on May 17, 2011 at 14:02

The OP is likely using IAR

stdint.h

/* Fixed size types. These are all optional. */

#ifdef __INT8_T_TYPE__

  typedef __INT8_T_TYPE__   int8_t;

  typedef __UINT8_T_TYPE__ uint8_t;

#endif /* __INT8_T_TYPE__ */

Seeing as it is prefaced with an #ifdef, one might reasonably assume that it is there to allow the user to override the normal setting for whatever bizarre reason, or be able to define them as a command line option to the compiler. In either case, if it is not defined the typedef never occurs, so you are left to explicitly typedef them yourself in your main code, or in an include a file you pull into the project. The compiler might also have it's own defaults.

Looking at some of the objects, __INT8_T_TYPE__ is ''signed char'', and __UINT8_T_TYPE__ is ''unsigned char''

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
greg_t
Associate II
Posted on May 17, 2011 at 14:02

the original declaration must be a part of an object file being included by the compiler 

Posted on May 17, 2011 at 14:02

''the original declaration must be a part of an object file...''

No, of course it isn't!

Typedefs (and #defines) are purely at the Source code level!

''... included by the compiler''

The Compiler does not ''include'' object files - that is the Linker's job!