This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS320F28379D: Byte Packing awaylable today?

Part Number: TMS320F28379D

Tool/software: TI C/C++ Compiler

Hello,

I was wondering if it is possible to do byte Packing with the C2000 MCUs.

The Forum states that it's not:
http://e2e.ti.com/support/tools/ccs/f/81/t/262328

But this post is from 2013, I just want to make sure, that byte packing wasn't added later.
It would help me a lot with my problem if this works.

Thanks and regards,

Marcel.

  • Marcel,

    As far as I am aware byte packing is still not supported by the C28x C compiler.  However, the assembly instruction set does support limited byte operations on the accumulator, so you can do this if you work in assembly.

    I am not sure if this will help you, but the attached file contains two assembly functions to pack and un-pack four bytes into a 32-bit long.  It makes use of a struct to hold the bytes.  The C prototypes would be something like...

    typedef volatile struct {

       char b0;

       char b1;

       char b2;

       char b3;

    } BYTE_PACK;

    BYTE_PACK lbp;

    long lx, ly;

    extern long byte_pack(BYTE_PACK *s);

    extern BYTE_PACK byte_unpack(long x);

    ...then in your code...

       lbp.b0 = 0x3F;

       lbp.b1 = 0x0C;

       lbp.b2 = 0x16;

       lbp.b3 = 0x9E;

       lx = byte_pack(&lbp);

       ly = 0x12345678;

       lbp = byte_unpack(ly);

    This is just an example and I have not tested it extensively.  You may be able to modify it if you have something specific you want to do. 

    Others on the forum may have other suggestions.  Anyway, I hope it helps.

    Regards,

    Richard

    demo2806x_byte.asm