c - const char array[] = {set} storing in big endian, I need little endian -
i'm writing c big endian 32-bits microcontroller , need store char arrays in rom:
const uint8 font_6x8[570] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <space> 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // '!' 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // '"' ... } const uint8 font_6x6var[665] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // <space> 0x02, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, // '!' 0x04, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, // '"' ... }
and on multiple bitmap fonts use on graphic lcd. problem compiler stores bytes in big endian 4-bytes sets messes every character each other they're not made of n*4 bytes each.
they're supposed const
, set in rom can't go , reverse them in code.
is there way tell compiler these bytes need inserted in little endian order. thought using 8-bits types enforce doesn't.
if using gcc
, try calling flag -mbig-endian
or -mlittle-endian
respectively.
Comments
Post a Comment