Atmel Studio 6 fails to link at -O0

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

Posts: 2
Joined: Thu Jan 17, 2013 2:42 am

Atmel Studio 6 fails to link at -O0

Thu Jan 17, 2013 9:16 pm


My project for the Sam3u4e compiles and links fine, unless I turn optimizations off (which makes it a lot easier to debug)

I get the following errors:
Error 12 undefined reference to `_write' /usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/writer.c 58 1 testbed
Error 13 undefined reference to `_read' /usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/newlib-1.19.0/newlib/libc/reent/readr.c 58 1 testbed

I'm not sure what is causing the errors, any advice would be helpful.

From the ASF wizard I have:
SD/MMC mci
System Clock
SPI usart_andstandard

Posts: 9
Joined: Thu Dec 06, 2012 2:10 am

Re: Atmel Studio 6 fails to link at -O0

Sat Jan 19, 2013 12:17 pm

I can't exactly help, but I also had a problem recently where things would go awry if I turned optimisation off.

What I did to narrow down the problem was turn optimisation off, but then turn on all of the -O1 level optimisations manually. ... ze-Options

You can see there what the individual options are, or alternatively run gcc with these options "-Q -O1 --help=optimizers" to see what optimisations are enabled or disabled at -O1.

The documentation warns that specifying the optimisations individually won't necessarily work. Doing this did work for me though, and so I was able to to go through and compile with a different one disabled each time.

From there I found there was a single optimisation flag that needed to be enabled in order to get everything to work (e.g. in my case I needed the -fomit-frame-pointer flag to get my program to work). That narrowed the problem down a lot and from there I was able to find the actual problem. This might be something you can try.

Return to “Development Tools”

Who is online

Users browsing this forum: No registered users and 3 guests