Steve Hosgood escreveu:
Steve Underwood wrote:
<snip>
I'm not sure if MIPs ever changed. Now, the question is, what do people really expect on a thing like the MSP430.

If you try something like

struct
{
   int x;
   char y;
} xxx[10];

and loop through the array accessing x, all is well. If you pack the structure it fails with mspgcc. The only real difference in the generated code is the loop steps 3 bytes at a time instead of 4. Now, if you try this with the IAR compiler for the MSP430, things still work with the packed structure. However, to achieve that complex code is produced when the structure is packed, and simple code is produced when it is not. Is this something people would like to see in mspgcc?


It's an interesting dilemma. My opinion is that it should do what the IAR compiler does, but generate a warning. Alternatively, fail to compile with an error message explaining the issue.

The big thing about compiling for compact embedded environments where the MSP430 is often found is that there just isn't the code space to allow code bloat due to possible user mistakes like packing inappropriate structs. A warning would be the least I'd expect.

Steve.

Just my R$0,02...

Consider the case in which this struct is a parameter table stored in flash, relatively large and seldom accessed. What would generate a smaller flash image? In the end, what matters is the flash space used, and in this case it will be smaller with a packed structure and longer code. You may also be in a case where you are short in RAM and with enough free FLASH and processor time. So, I think the best situation is to generate functional code and let the user decide.

Ricardo


Reply via email to