energia / msp430-lg-core

15 stars 12 forks source link

New compiler #33

Closed StefanSch closed 7 years ago

StefanSch commented 7 years ago

This updates allow to also use the new generation of the msp gcc compiler It also includes some improvements for maintenance and future Launchpad additions.

rei-vilo commented 7 years ago

Could you be add the macro for FRAM included in the pull-request #31?

RickKimball commented 7 years ago

Is there going to be a build menu item to switch between msp430-gcc and msp430-elf-gcc?

RickKimball commented 7 years ago

Is there a reason to use the -O2 optimization flag instead of -Os? Why is -lstdc++ included for libraries

rei-vilo commented 7 years ago

Wasn't -O2 bugged?

RickKimball commented 7 years ago

I'm not sure what that means rei-vilo

RickKimball commented 7 years ago

I noticed that CCS is shipping with msp430-elf-gcc with a gcc 6 version. Is there a reason that CCS and Energia aren't using the same versions? Wouldn't that make it easier to use energia projects in CCS?

In addtion, the msp430fr5994.h in the newer version is radically different from the one used here

rei-vilo commented 7 years ago

@RickKimball Sorry!

The -O parameter sets the optimisation level. Some levels, here -O2, may be bugged while others, like -Os, still work fine with the new compiler.

RickKimball commented 7 years ago

So you agree that it probably shouldn't be using -O2?

rei-vilo commented 7 years ago

There is no secret, only the trial and error approach can provide an answer, unless the GCC provides all the documentation on the bugs.

See for example here and there for GCC against another platform.

RickKimball commented 7 years ago

You can't look at other gcc compilers to make decisions about msp430-elf-gcc. Its problems are unique to itself.

RickKimball commented 7 years ago

Why is dtostrf() using sprintf() stdlib functions? This is going to inflate the size of both the flash and ram.

rei-vilo commented 7 years ago

You can't look at other gcc compilers to make decisions about msp430-elf-gcc. Its problems are unique to itself.

I provided the links just for example. Changing a compiler is a huge operation.

RickKimball commented 7 years ago

Has any of this been compiled with the compiler warnings on? I see many discouraging compiler warnings.

RickKimball commented 7 years ago

The reported size of the Sketch is incorrect for any board that is placing its code in upper memory. I compiled the ASCIITable.ino it reported 1218 bytes instead of 4646:

Sketch uses 1,218 bytes (2%) of program storage space. Maximum is 48,128 bytes.
Global variables use 198 bytes (2%) of dynamic memory, leaving 7,994 bytes for local variables. Maximum is 8,192 bytes.

If you use the size command with no args it adds up all the text and rodata sections, not just the lower memory ones.

$ msp430-elf-size  ASCIITable.ino.elf
   text    data     bss     dec     hex filename
   4646     102     196    4944    1350 ASCIITable.ino.elf
$ 

The missing bytes are in the .upper.text, .rodata2, and .lowtext ... and other sections

$ msp430-elf-size -A ASCIITable.ino.elf 
ASCIITable.ino.elf  :
section                   size    addr
__interrupt_vector_46        2   65498
__interrupt_vector_47        2   65500
__interrupt_vector_56        2   65518
__interrupt_vector_57        2   65520
__interrupt_vector_58        2   65522
__reset_vector               2   65534
.rodata                    276   17408
.rodata2                    96   17684
.data                        6    9216
.bss                       192    9222
.noinit                      0    9414
.heap                        4    9414
.lowtext                   114   17786
.text                     1212   17900
.upper.text               2502   65536
.MSP430.attributes          23       0
.comment                    65       0
.debug_aranges            1496       0
.debug_info              44323       0
.debug_abbrev             6194       0
.debug_line               8483       0
.debug_frame              4636       0
.debug_str               10025       0
.debug_loc               20285       0
.debug_ranges             1640       0
.upper.lowtext             530   19112
Total                   102114
RickKimball commented 7 years ago

The linker grouping command line arguments are completely neutered based on where they are used in platform.txt. They should be wrapping all the sketches objects and the core library file. They aren't

-Wl,--start-group ... there is nothing being wrapped ... -Wl,--end-group ...

should be something like:

-Wl,--start-group {object_files} "{build.path}/{archive_file}" -Wl,--end-group

RickKimball commented 7 years ago

Maxium flash size is wrong for boards that are using upper addresses as .text. MSP430F5529 says it only has 48128 bytes, it isn't 128k but it isn't 48128.

Also, is the expectation that users will force code into lower memory themselves on these large flash sized chips?

robertinant commented 7 years ago

@RickKimball what do you suggest we use in dtostrf()? I would be happy to get rid of sprintf().

RickKimball commented 7 years ago

Why is this pull in here? Shouldn't this be part of the msp430-ng-core?