Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: msp430: garbage collect dead code when linking. #5713

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

basilfx
Copy link
Member

@basilfx basilfx commented Jul 30, 2016

The MSP430-based board are blacklisted from U8g2 package, because the flash file size exceeds the memory size. There was a similar problem with the ATMega targets, which was fixed with #5632.

This PR does the same for MSP430-based boards. However, I don't have any boards to test it with and I don't know what implications it has for other programs. Without this patch the U8g2 test application fails to compile, with this patch it succeeds.

msp430-size /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/chronos/pkg_u8g2.elf
   text    data     bss     dec     hex filename
  14472      90    2644   17206    4336 /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/chronos/pkg_u8g2.elf
msp430-size /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/msb-430/pkg_u8g2.elf
   text    data     bss     dec     hex filename
  14886      18    2702   17606    44c6 /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/msb-430/pkg_u8g2.elf
msp430-size /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/wsn430-v1_3b/pkg_u8g2.elf
   text    data     bss     dec     hex filename
  14838      18    2702   17558    4496 /home/basilfx/Desktop/RIOT/tests/pkg_u8g2/bin/wsn430-v1_3b/pkg_u8g2.elf

@basilfx basilfx changed the title boards: msp430-common: remove dead code when linking. boards: msp430: remove dead code when linking. Jul 30, 2016
@basilfx basilfx changed the title boards: msp430: remove dead code when linking. boards: msp430: garbage collect dead code when linking. Jul 30, 2016
@jnohlgard
Copy link
Member

Could this not be set directly in the cpu/msp430-common makefile instead?

@basilfx basilfx force-pushed the bugfix/msp430_linker branch from 1e807e3 to 661b5be Compare July 30, 2016 22:22
@basilfx
Copy link
Member Author

basilfx commented Jul 30, 2016

You are absolutely right. I just couldn't find that file since I wasn't looking for Makefiles in the cpu/ itself :-)

Fixed it.

@jnohlgard
Copy link
Member

ACK if Murdock agrees.

@jnohlgard jnohlgard added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Platform: MSP Platform: This PR/issue effects MSP-based platforms Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 30, 2016
@jnohlgard
Copy link
Member

Btw, should #5632 be modified the same way perhaps? (move from boards to cpu dir)

@basilfx
Copy link
Member Author

basilfx commented Jul 31, 2016

Murdock agrees.

Yes, I think a similar change must be made for #5632. Maybe this can be part of #5451 and/or #5590 (cc @mali)? I'm not really good with Makefiles and I don't have boards to test this with :-)

@LudwigKnuepfer
Copy link
Member

Just for curiosity: could you please post numbers for master and with/without the -ffunction-sections -fdata-sections change?

@basilfx
Copy link
Member Author

basilfx commented Aug 1, 2016

Just for curiosity: could you please post numbers for master and with/without the -ffunction-sections -fdata-sections change?

I would love to do, but compilation fails before it can output numbers. However, it spits out numbers that exceed 1 MB due to all the fonts being compiled in.

@OlegHahm
Copy link
Member

OlegHahm commented Aug 1, 2016

You could try to modify the linkerscripts to fake more available memory.

@basilfx
Copy link
Member Author

basilfx commented Aug 1, 2016

Well, another problem is that the MSP-430 cannot address more than 1 MB (20 bit address if I recall correctly).

/build/buildd/gcc-msp430-4.6.3~mspgcc-20120406/./gcc-4.6.3/gcc/config/msp430/crt0.S:195: relocation truncated to fit: R_MSP430_16_BYTE against symbol `__data_load_start' defined in *ABS* section in /home/basilfx/Bureaublad/RIOT/tests/pkg_u8g2/bin/chronos/pkg_u8g2.elf

Anyway, this is some of the build output for Chronos board (1.67 MB):

/usr/lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: /home/basilfx/Bureaublad/RIOT/tests/pkg_u8g2/bin/chronos/pkg_u8g2.elf section `.rodata' will not fit in region `rom'
/usr/lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: section .vectors loaded at [000000000000ff80,000000000000ffff] overlaps section .rodata loaded at [000000000000bb10,00000000001bba6b]
/usr/lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: region `rom' overflowed by 1751878 bytes

@OlegHahm
Copy link
Member

OlegHahm commented Aug 1, 2016

Ah, yes, true. Anyhow, we it's obvious that this improves a lot. Did anyone check if it is still working on hardware?

@kYc0o
Copy link
Contributor

kYc0o commented Aug 1, 2016

I can give a try on a Z1 node

@kYc0o
Copy link
Contributor

kYc0o commented Aug 1, 2016

I confirm it still works

@basilfx basilfx force-pushed the bugfix/msp430_linker branch from 661b5be to 7cf1c46 Compare August 1, 2016 16:35
@basilfx
Copy link
Member Author

basilfx commented Aug 1, 2016

Rebased.

Murdock failed this afternoon, but it already succeeded yesterday and no new commits were added since. Related to #5689?

@kYc0o
Copy link
Contributor

kYc0o commented Aug 1, 2016

I don't think so. I detected the same problem in 2 different PRs.

@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 1, 2016
@kaspar030
Copy link
Contributor

kaspar030 commented Aug 1, 2016

I don't think so. I detected the same problem in 2 different PRs.

Fixed. A system upgrade made gdb collide with stack randomization seccomp options.

@kYc0o
Copy link
Contributor

kYc0o commented Aug 1, 2016

Great! Thanks @kaspar030 :D

@basilfx
Copy link
Member Author

basilfx commented Aug 1, 2016

Murdock complains, but I don't think it has to do with this PR. Something about not being able to reach Github.com for jsmn package.

basilfx added a commit to basilfx/RIOT that referenced this pull request Aug 1, 2016
basilfx added a commit to basilfx/RIOT that referenced this pull request Aug 1, 2016
@kaspar030 kaspar030 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 1, 2016
@miri64 miri64 merged commit f1b519d into RIOT-OS:master Aug 5, 2016
@basilfx basilfx deleted the bugfix/msp430_linker branch August 20, 2016 11:17
@miri64 miri64 added this to the Release 2016.10 milestone Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants