Latest Atmel Studio (7.0.1006) fails to compile cycle_counter.c

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've upgraded yesterday to the latest Atmel Studio and both existing and new project fail to compile when the Delay routine (service) is added.

The reported error is:

Error        recipe for target 'src/ASF/common/services/delay/sam/cycle_counter.o' failed    
Error        's' undeclared here (not in a function)    \src\ASF\sam\utils\compiler.h    242

 

The definition with an error in compiler.h is

#   define OPTIMIZE_HIGH __attribute__((optimize(s)))

 

and that is used in cycle_counter.c:

// Delay loop is put to SRAM so that FWS will not affect delay time
OPTIMIZE_HIGH
RAMFUNC

 

 

Not sure what is changed so that those files built in earlier version of Studio. Anyway, can anybody confirm this error?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can confirm this happens to me as well after the recent Atmel Studio 7 update.

Anyone found a fix yet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've just commented out OPTIMIZE_HIGH for now, I couldn't notice any difference for this fairly inoffensive code (in fact, it's just a dummy while loop AFAIK).

But I'd be more interested in understanding what changes have broken the build.

 

 

Last Edited: Tue. Jul 5, 2016 - 07:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is because the gcc version was upgraded to 5.3.1. The erroneous definition of OPTIMIZE_HIGH was present earlier, but gcc didn't warn about it. Atmel will probably push an updated header file soon. In the mean-time, you can change the definition of portable_delay_cycles in cycle_counter.c to:

// Delay loop is put to SRAM so that FWS will not affect delay time
__attribute__((optimize("Os")))
RAMFUNC
void portable_delay_cycles(unsigned long n)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can confirm, this only happens with GCC 5.3.1.

 

Just a quick add: It can be reproduced if you simply add the Delay routines service to a default, empty board project and try to compile it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

This has been fixed already and will be available in the next release of ASF. (See http://asf.atmel.com/bugzilla/sh...)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks everyone for the comments and fix, will use Bugzilla in the future

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks all for this post.  I have been killing my self for over 3 weeks trying to figure this one out.

Atmel Support was no help at all and I wasted weeks trying things and waiting on them.

Don't know if that is typical or part of the down sizing MicroChip has done to them.

 

John Z
JTZ Engineering, Inc

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Upgrade your old project to ASF 3.34 and update all the project's ASF source and header files.
I can't remember how I have done it, but I remember some manual editing involved, at least for the migration of the project itself to ASF 3.34.
As for the source and header files, simply create a new ASF 3.34 project with the modules you're using in the old project, and copy the created ASF source folder over the ASF folder of the old project.