How many bytes are the variables in CW10.6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How many bytes are the variables in CW10.6

Jump to solution
1,055 Views
jorgesierra
Contributor II

I just wanted to cross check an answer to something I came across on the web.

c++ faq - What does the C++ standard state the size of int, long type to be? - Stack Overflow

 

In the answers they give a range of numbers which the variables have to be. If I convert these variables into HEX will it give my how big the variables are in bytes?

Labels (1)
1 Solution
875 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

For MK10DX256VLH7, CodeWarrior v10.6.4 includes both GCC compiler and Freescale compiler.

In general, the data type information should be included in the compiler manual for each MCU platform.

But, in the documents in CW 10.x, this manual does not include such information. I need report it to the document team.

For the data type information of Kinetis, you can get it from attached header file limits_api.h

(it locates at:

{cw 10.x}MCU\ARM_GCC_Support\ewl\EWL_C\include

{cw 10.x}MCU\ARM_EABI_Support\ewl\EWL_C\include

).

From them, we can get the size for data type is:

char – 8 bit

short – 2 bytes

int – 4 bytes

long – 4 bytes

long long – 8 bytes

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

3 Replies
875 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

The size of data type is determined by processor architecture and the compiler, what is the part number of your target MCU? And what development environment you are using?

Fiona Kuang

Technical Information & Commercial Support

0 Kudos
875 Views
jorgesierra
Contributor II

MCU: MK10DX256VLH7

IDE: Codewarrior 10.6.4

0 Kudos
876 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Jorge

For MK10DX256VLH7, CodeWarrior v10.6.4 includes both GCC compiler and Freescale compiler.

In general, the data type information should be included in the compiler manual for each MCU platform.

But, in the documents in CW 10.x, this manual does not include such information. I need report it to the document team.

For the data type information of Kinetis, you can get it from attached header file limits_api.h

(it locates at:

{cw 10.x}MCU\ARM_GCC_Support\ewl\EWL_C\include

{cw 10.x}MCU\ARM_EABI_Support\ewl\EWL_C\include

).

From them, we can get the size for data type is:

char – 8 bit

short – 2 bytes

int – 4 bytes

long – 4 bytes

long long – 8 bytes

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------