Page 1 of 1

Adding older Typedef to True studio

Posted: Thu Jan 10, 2019 8:29 pm
by conradc2380
Hi ,

Hope someone can help me here .

I am trying to add the following typedef implementation into truestudio, because quite a lot of my older code was built in coocox and i would like to re use it with Attolic. The Problem i am experiencing is that u8,u16 and u32 typedefs are not supported, also i noticed if a uint8_t type is used in a H file the compiler also don recognize the variable , but it only recognizes the standard int and char types in the H files .

typedef long unsigned int u32;
typedef short unsigned int u16;
typedef unsigned char u8;

i added the above to the default system file _default_types.h ,but this did not solve the problem either .

Has anyone looked at this before ?

regards
Conrad

Re: Adding older Typedef to True studio

Posted: Sun Jan 13, 2019 1:17 pm
by artbody
normaly you need

Code: Select all

#include <stdint.h>
#include <stdbool.h>

then you can define what ever you need

Code: Select all

// same file
#define sc_string      char*
 
typedef bool         sc_boolean;
typedef int_fast16_t   sc_short;
typedef uint_fast16_t   sc_ushort;
typedef int32_t         sc_integer;
typedef uint32_t      sc_uinteger;

typedef double         sc_real;

typedef void*         sc_eventid;

typedef intptr_t      sc_intptr_t;

...