Question

I am not getting answers on the AVR Freaks forum and wonder if someone here could help me.

The answer might lie in this SO question, but I am not sure why it would be necessary.

Basically, I have my fist ever Atmel project (AVR studio 6, UC3 processor). The code compiles and links and I can load it to the Atmel board and step through in the debugger.

However, when I try to step over (or run until a breakpoint on the line after) a (valid) call to sprintf(), malloc() or memcpy() (there may be more, which I have not yet discovered), the IDE never returns to the next line of my code, just seeming to hang, or run forever.

[Note] Compiler optimization is off

Do I need to set some linker options (e.g link static (which I tried & it didn't help)? Or build with some library?

What confuses me is that the code compilers and links - what is being linked when I call these standard functions? If I need something else I would expect a compiler or linker error, but get none - so why won't my code run?

Sorry for such a stupid n00nb question, but it is my first micro-controller project.

Was it helpful?

Solution

I discovered that the CPU on my board is an Engineering Sample and not supported by Atmel Studio without a new io.h file.

I sort of figured that out from this question: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=106652

Sorry to have troubled you.

OTHER TIPS

what is being linked when I call these standard functions?

The AVR-libc, the implementation of the C standard library ported to the AVR platform.

so why won't my code run?

Compiler errors and runtime errors are not even related. Both of these lines are valid C and they compile, however, on most systems, I'd expect them to dump core:

int x = 1 / 0;
*(int *)0 = 41;

So it might be either:

  • a bug in the standard library (very unlikely), or
  • a bug in the online debugger (very unlikely), or
  • maybe you just expect something that is not supposed to happen?

Instead of trying to step over, what happens if you set a breakpoint at next line after the line you want to step over?

Also, does the operation change if you turn off compiler optimization?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top