Re: RedHat Toolchain for small chips

David Brown <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <[email protected]>
On 14/01/14 13:27, Emil Renner Berthing wrote:
> Hi,
> 
> I just tried installing the new toolchain, r206599 from the GCC SVN and the
> latest newlib from CVS.
> However when I try to compile simple programs for small chips it seems just
> the runtime takes up more SRAM than the chip has. Eg.
> 
> $ cat simple.c
> #include <msp430.h>
> 
> static inline void delay(unsigned int n) {
>   __asm__ __volatile__ (
>       "1: \n"
>       " dec %[n] \n"
>       " jne 1b \n"
>       : [n] "+r"(n));
> }
> 
> int main(void) {
>   WDTCTL = WDTPW | WDTHOLD; /* watchdog_off();       */
>   P1DIR |= BIT0;            /* pin_mode_output(1.0); */
> 
>   while (1) {
>     P1OUT |= BIT0;  /* pin_high(1.0); */
>     delay(0xFFFF);
>     P1OUT &= ~BIT0; /* pin_low(1.0);  */
>     delay(0xFFFF);
>   }
> }
> $ msp430-elf-gcc -mmcu=msp430g2231 -Os -static -Wall -Wextra simple.c -o
> simple.elf
> /usr/lib/gcc/msp430-elf/4.9.0/../../../../msp430-elf/bin/ld: simple.elf
> section `.bss' will not fit in region `RAM'
> /usr/lib/gcc/msp430-elf/4.9.0/../../../../msp430-elf/bin/ld: region `RAM'
> overflowed by 16 bytes
> collect2: error: ld returned 1 exit status
> 
> So am I doing something wrong or will it work eventually and I'm just being
> impatient?
> 
> /Emil
> 
> 

You need to generate a map file to see what is /actually/ taking up space:

-Wl,-Map=simple.map,--cref



------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.