Pages

I am getting a feel of it now. There are a lot of such declarations especially extern in the project. I am doing this on AS7 (is that what you meant?) and all the files are in C(with reference to the io stream declaration - does it matter if I go for the uppercase or lowercase declarations - I read that the upper case is used as an initializer for a variable type 'FILE'

Amateur programmer.
Believe when I tell you that my struggle on here is real.

Edited: I am getting a feel of it now. There are a lot of such declarations especially extern in the project. I haven't made much changes to the code yet - I will try doing it and keep it posted. and all the files are in C(with reference to the io stream declaration - does it matter if I go for the uppercase or lowercase declarations - I read that the upper case is used as an initializer for a variable type 'FILE'

How do you delete a comment on here?

Amateur programmer.
Believe when I tell you that my struggle on here is real.

As Cliff says in that thread, the first post in it is more or less a repetition of what is written in the official avrlibc documentation.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Possibly never (explicitly). the vfprintf(...) function is primarily the "worker" behind both printf(...) and sprintf(...). When documentation mentions vsprintf(...) it most likely does so to document that behavior that printf(...) and sprintf(...) shares, rather than documenting it for both of those two functions.

azimmali wrote:

What I am doing wrong here?

We can't tell.

You've shown a snippet of code, of about 100 lines. Yet all error messages in your screen dump are at line number 410, except for the venerable "recipe failed" - which is a stupid error message, better explained by the complete build output.

Speaking of that, haven't we told you before to switch to the output tab and post complete build output rather than those meaningless screen shots? If we've missed that, here it comes: Don't post screen shots. For build errors, post complete build output (switch to output tab, mark everything, copy and paste in a post here.

When posting such errors, also post the complete source file(s) (perhaps as attachments).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

It starts with the build system saying it compiles .././level3_4026.c , and ends with the warning about avr/signal.h . So, there is no question about avr/signal.h being included in .././level3_4026.c . You have several such errors.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

A lot of your questions are really just about basic C programming rather than AVR in particular. You may find it easier to learn C first using a PC development system writing programs for Windows/Linux (faster results and easier to debug) then switch to AVR development when you have a stronger understanding of C. Things like:

error: 'uart_str' undeclared (first use in this function)

are the kind of error you will get from a C compiler whatever you are building for:

#include <stdio.h>
int main(void) {
uart_str = 1;
}

That program will cause the same error whether you build for AVR, x86, ARM, AMD64 or whatever.

Once you understand what "undeclared" means you can bring that knowledge to your AVR programs

What did you do? We can't tell exactly what you did only from the word "that" and an implication that tou've taken some earlier advice and applied it. SHOW CODE!

Which errors did you get? We can't guess (especially since we don't know what you did). SHOW ERROR MESSAGES! I.e. build output.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

but for that to work "uart_str" must be "known" by the time the compiler gets to this line. But as it stands you have this function at line 271 and the uart_str you want to use being defined at line 409. So that definition of uart_str:

However this then raises another issue. This is referring to uart_putchar() and uart_getchar() but at line 216 the compiler has not encountered those functions yet (they are defined at lines 299 and 316). So initially this would appear to be a problem. You need uart_str "early" in the file so it is before the UARTIni() function where it is now used but it is created by making reference to uart_putchar() and uart_getchar() that are now after it.

This is the whole point of C having declarations and definitions. For a function they look like:

You can tell a declaration because it ends with ';' and you can tell a definition because it ends with "{ some_code }". You can put a declaration very early in a C file (or even in a .h header file that it #include's) to say "expect to see a function with this name, these parameters and this return type coming up later". In my example:

int add(int a, int b); // declaration

could be on line 5 and

int add(int a, int b) { // definition
return a + b;
}

on line 417. In between the two I could have at line 207:

void some_function() {
PORTB = add(37, 52);
}

and the compiler would already understand how to use add() because although it hasn't seen the full function definition yet it has seen the declaration:

int add(int a, int b); // declaration

which told it enough about the function (takes two integers, returns one) so it can be used in some_function().

This is exactly what you need to be able to refer to uart_putchar() and uart_getchar() "early" in the FDEV_SETUP_STREAM before the real functions have been encountered. So somewhere up near the top of the file add:

This, the second definition of uart_str, is where the conflict arises. Next, the compiler is nice enough to tell you where the first definition was:

int uart_str = 1;

Isn't the situation quite clear? In fact, crystal-clear?

1. It is totally obvious that you are not good friends with C programming yet. Maybe take a step back and learn the basics first? Preferably using and targeting a PC.

2. I know you won't follow the advice under 1. above so here's another idea: You have stated earlier that you have software engineers in the project. Even if they are not specifically C programmers they will surely be skilled enough to be able to help you sort out things like the above.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here.

No guarantees, but if we don't report problems they won't get much of a chance to be fixed! Details/discussions at link given just above.

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]