Hi,
I'm experimenting with the -ffunction-sections and -fdata-sections parameters of mspgcc. The goal is to split a TinyOS application between near and far flash memory using the large memory model. If I do this without special compile parameters, only a small amount of code ends up in the .text section (presumably the ISRs), and the rest is put in .far.text, rather than filling up .text first.

Now unfortunately -ffunction-sections and -fdata-sections seem to be broken in mspgcc 4.7.0 20120911. For example, if I compile the TinyOS Blink application for telosb with them, I get:

/tmp/ccb7btaA.s:1220: Error: Missing symbol name in directive
/tmp/ccb7btaA.s:1220: Error: junk at end of line, first unrecognized character is `x'
/tmp/ccb7btaA.s:1221: Error: expected comma after name `' in .size directive
/tmp/ccb7btaA.s:1222: Error: junk at end of line, first unrecognized character is `0'
/tmp/ccb7btaA.s:1224: Error: Missing symbol name in directive
/tmp/ccb7btaA.s:1224: Error: junk at end of line, first unrecognized character is `x'
/tmp/ccb7btaA.s:1225: Error: expected comma after name `' in .size directive
/tmp/ccb7btaA.s:1226: Error: junk at end of line, first unrecognized character is `0'
/tmp/ccb7btaA.s:1229: Error: Missing symbol name in directive
... and lots more of those.

The problem is that the assembler code contains addresses instead of symbol names:
.LIRD0:
    .size    main, .-main
    .section    .bss.0x0019,"aw",@nobits
    .type    0x0019, @object    ;Line 1220
    .size    0x0019, 1
0x0019:
    .zero    1
    .type    0x0019, @object
    .size    0x0019, 1                ;Line 1225
0x0019:
    .zero    1
    .section    .bss.0x001D,"aw",@nobits
    .type    0x001D, @object
    .size    0x001D, 1                ;Line 1230

I tried this without any special options, i.e. with memory model "none". It compiles fine on mspgcc 4.6.3 20120406. The thread at [1] mentions the same issue, but without a solution. And in [2] Peter suggests the problem is caused by the asm statement, which is treated differently by gcc 4.7. However, the code above seems to correspond to the following declarations in app.c (each appearing in several functions):

static volatile uint8_t r __asm("0x0019");
static volatile uint8_t r __asm("0x001D");

So they are already static.
Is there a known workaround for this issue?


Thanks,
Martin

[1] - http://lists.gnu.org/archive/html/bug-binutils/2012-10/msg00111.html
[2] - http://sourceforge.net/mailarchive/forum.php?thread_name=CAPOJ94M1tobePYig6XdJjwTVamFj1DC2uDFyUu%3DZChzFHBApUw%40mail.gmail.com&forum_name=mspgcc-users

--

Martin Zoller ? Tinynode <http://www.tinynode.com/> ? System Architect ? Lausanne ? D: +41 21 510 11 81 ? F: +41 21 510 11 71 ? martin.zol...@tinynode.com <mailto:martin.zol...@tinynode.com>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to