How i can write to a bit field in IDE CWide eTPU?

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

How i can write to a bit field in IDE CWide eTPU?

845 Views
demian91
Contributor III

Hi, i'm using CWide or codewarrior for eTPU and when i create for example a struct:

typedef union

{

   struct

   {

      uint32_t B0:1;

      uint32_t B1:1;

      uint32_t B2:2;

      uint32_t B3:4;

      uint32_t B4:8;

      uint32_t B5:16;

   }B;

   uint32_t R;

}EST;

EST Est;

if i write Est.R = 1<<30; works but when Est.B1 = 1; that's not works.

If posible write a bit like that?

Labels (1)
0 Kudos
Reply
1 Reply

742 Views
stanish
NXP Employee
NXP Employee

Hello Demian,

CodeWarrior for ETPU supports bitfields.

I noticed there is missing .B in your usecase:

Est.B.B1 = 1;

Note:

if you expect reversed bitfield allocation please check pragma below:

<CW eTPU v10.x>\ETPU\Help\PDF\eTPU_Build_Tools_Reference.pdf

#pragma reverse_bitfields on | off | reset

Hope it helps.

Stan

0 Kudos
Reply