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.

run placement fails for object "ECanaMboxes"

Hi,

Apart from defining the bits, I wanted to define another struct variable in MDL and MDH regs. Here's what I need:

struct CANMDH_Variable {  //bits description

 

Uint16 A:8;                                       //32:39

Uint16    B:16;                                   //55:40

Uint16    C:8;                                    //63:56

};

 

union CANMDH_REG {

   Uint32                  all;

   struct CANMDH_WORDS     word;

   struct CANMDH_BYTES     byte;

   struct CANMDH_BITS   bit;

   struct CANMDH_Variable    variable;

};

 

 

Similarly in MDL too. When I compile this code, it gives me the following error:

 

Severity and Description Path Resource Location Creation Time Id

run placement fails for object "ECanaMboxesFile", size 0x180 (page 1). Available ranges: ECANA_MBOX   size: 0x100        unused: 0x100        max hole: 0x100 Example_28335_Flash line 0 1304601263380 764

I do not know what this means. It also gives me a linking error during this:
Severity and Description Path Resource Location Creation Time Id
errors encountered during linking; "Example_28335_Flash.out" not built Example_28335_Flash line 0 1304601263382 767
if I delete the line "struct CANMDH_Variable    variable;" , it works alright again. Can anyone tell me what is wrong here.
Thanks,
VY

 

  • Vennela Yadhati said:

    Hi,

    Apart from defining the bits, I wanted to define another struct variable in MDL and MDH regs. Here's what I need:

    struct CANMDH_Variable {  //bits description

     

    Uint16 A:8;                                       //32:39

    Uint16    B:16;                                   //55:40

    Uint16    C:8;                                    //63:56

    };

     

    union CANMDH_REG {

       Uint32                  all;

       struct CANMDH_WORDS     word;

       struct CANMDH_BYTES     byte;

       struct CANMDH_BITS   bit;

       struct CANMDH_Variable    variable;

    };

     

    This is strange, it should work but it is looking like the code is thinking variable is greater than 32-bits wide.  This means it is attempting to assign a larger set of registers to a fixed memory range and hence the error.  Doing some experimenting, lead me to a possible cause: the line: Uint16 B:16;

    The fix:

    struct CANMDH_Variable {  //bits description

    Uint32 A:8;                                       //32:39
    Uint32   B:16;                                   //55:40
    Uint32    C:8;                                    //63:56

    };

    Changing to Uint32 made it compile for me.  Hopefully it does for you.

    Tim

  • Hi,

    I've used this approach and YES, the Uint32 way seems to work. However, here's something else that is interesting. My bits are not allocated in a gradual (0-31 or 31-0). But in the way as shown below:

     

    struct CANMDL_Variable { //bit description

    Uint32 A:8;  //31:24

    Uint32 B:16;                        //23:8 

    Uint32 C:6;                                      //5:0

    Uint32 D:1;                             //6

    Uint32 E:1;                             //7 

    };

    From "C", it has changed the allocation sequence. Is this normal? I've checked this code and I'm pretty sure this is how it is assigning the bits. Where am I going wrong?

  • Vennela Yadhati said:
    Uint32 B:16;                        //23:8 

    The C28x compiler packs bit fields into 16-bit words.  If a bit-field crosses a 16-bit boundary then it will be pushed down to the next word.  I think this may explain why you are not seeing the memory alignment you expect.

    Regards,

    Lori