Big-endian or Little-endian of S12Z

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

Big-endian or Little-endian of S12Z

844 Views
frankkong
Contributor III

Hello, 

     I use the code warrior 10.7 & s12zvml31.

     What's the function of "Bit-field gap limit(0-127 or 255(0xff)) as -1"?. I find the instruction "#pragma bfield_gap_limit -1 /*this guarantee correct bitfield positions*/" in "mc9s12zvml31.h" .  Is it same as Bit-field gap limit?

If they are the same thing ,why I can set -1 on compiler setting?

         

       If I don't add #include "mc9s12zvml31.h" in my own .c file ,the compiler will be little-endian, or it will be big-endian. 

You can see it in the pictures.

     pastedImage_5.pngpastedImage_8.png

pastedImage_6.pngpastedImage_7.png

Regards,

Frank

Tags (1)
0 Kudos
1 Reply

646 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

There is an option ("-bfield_gap_limit") that is controlling which is the maximum number of gap bits allowed in the bit-field allocation. The bit-field allocation is done "byte" wise, unless the padding required for "byte" allocation exceeds the gap.

By default, the gap is "0" which means that "byte" allocation is used all the time.

The Processor Expert generated header files ("IO_Map.h") the gap limit is set to "-1" (by using "pragma bfield_gap_limit -1"). The gap set to "-1" automaticaly forces the bit-field allocation to "word" (2-byte). thus all the bit structures under this line are grouped together in a "word" instead of staying grouped in "byte" units.

I don't suggest you remove this line. If your application requires"byte" allocation, you should set the gap limit to 0 after the inclusion of the "IO_Map.h" file, by using:

#pragma bfield_gap_limit 0

example:


1. bfield_gap_limit = 0 (set in panel)
- #include "derivative.h" will set the "bfield_gap_limit" to -1
- all following bfield data structures (from included headers) will consider the "bfield_gap_limit" as -1 and will behave accordingly


2. bfield_gap_limit = 255 (set in panel)
- #include "derivative.h" will set the "bfield_gap_limit" to -1
- this results in the same behavior as before


Have a great day,
TIC

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

0 Kudos