what are the method or tool to analysis a large arduino program?

i have large arduino project code...it contain many functions,loop,strcture,etc colud you please tell me ...how can i easly analysis that program ??

That is a very open question. What sort of analysis do you want to run? The easiest I can think of is to copy the sketch into Word and then check the amount of word in the sketch- that's a type of analysis, but I have a feeling it isn't what you're after.

sir my question is .......how can easily analysis the control flow to functions???

A very useful tool for visualizing the program structure is to do a Tools > Auto Format on your code. The resulting indentation will allow you to see the program structure with a quick scan through the code, without even needing to read anything.

The Arduino IDE also has a feature where if you place the cursor on one bracket, the other is highlighted. If you place the cursor on a closing brace and the opening brace is off the screen, it will appear in a tooltip after a short delay.

If you enable File > Preferences > Enable code folding, you can fold braces, which can be helpful when trying to review a lot of code.

I know this isn’t the answer to the question you’re actually asking, but the GCC compiler actually serves as a reasonably good and simple to use linter when you have warnings set to -Wall -Wextra. In the Arduino IDE, do this:

  • File > Preferences
  • Set “Compiler Warnings” to “All”.
  • Disable “Show verbose output during: compile”. The reason I recommend this is because otherwise you end up with a lot of extra output in the console that is not useful unless you’re trying to troubleshoot a bug in the Arduino IDE and makes it more difficult to read the useful compiler warnings.
  • Click “OK”.
  • Sketch > Verify/Compile

After compilation finishes, scroll the black console window at the bottom of the Arduino IDE all the way up to the top, and then start working your way down, reading any warnings you might find. Often these warnings convey some really helpful information. I recommend always leaving compiler warnings set to “All”, and always paying attention to warnings and fixing them in your own code when possible.

There are more sophisticated linters available, but I’ve never figured out how to use them with Arduino sketches.

THANKS A LOT...

wounder: colud you please tell me ...how can i easly analysis that program ??

Is this a program you have written yourself? If so my immediate response is that the analysis should have been done while it was still a small program.

On the other hand if you are trying to figure out a large program that someone else has written then you have my sympathy. It could range from difficult to impossible and a lot depends on how much patience you have.

I think if I had the problem I would write down all the functions on a piece of paper and then try to draw lines that show which functions make calls to the other functions. And try to try to write a one or two line summary of the purpose of each function so that I have something akin to a narrative in English of what the code tries to do.

On the third hand, it may actually be easier to write a new program from scratch rather than figure out a program written by someone else.

...R

Robin2: On the third hand

You must be an economist as your day job?

Robin2: if you are trying to figure out a large program that someone else has written then you

.... can just read their comments in the code which will explain it nicely. Mwahahahahaha.

elvon_blunden: You must be an economist as your day job?

That is perceptive of you. Actually I just learned the phrase from an economist.

...R

Robin2: That is perceptive of you. Actually I just learned the phrase from an economist.

There was an American comedian a decade or three back, I forget his name, who did Ronald Reagan's voice to a "T" and was explaining Reaganomics as if it was a cake that was cut up. The punch-line started something along the lines of "And the third half....."

There are free flow-chart generators for C/C++ - try google.

lastchancename: There are free flow-chart generators for C/C++ - try google.

You give it the code for a large program and it generates the flow chart?

...R

I hate to be the guy who does this, but this is not a kinder, gentler message board: you don't want to analysis the code. you want to analyze it. analyze is the verb for what you do, analysis is the noun for what you get after you do.

I hate to be the guy who does this, but the verb is not analyze but analyse, hence the associated noun which is analysis rather than analyzis :)

[quote author=Geek Emeritus date=1550947580 link=msg=4071045] I hate to be the guy who does this, but this is not a kinder, gentler message board: you don't want to analysis the code. you want to analyze it. analyze is the verb for what you do, analysis is the noun for what you get after you do. [/quote] If we must descend into pedantry then the title could also be written as

what are the methods or tools for an analysis of a large arduino program?

And my Concise Oxford Dictionary recognizes "analyze" as the US spelling.

I suspect the OP is not a native English speaker so we should also make allowances for our friends "across the pond"

...R

Analysister and brother is a technique out a living of word association football ..

Meanwhile on topic : you can watch the progress of your sketch by adding print statements at strategic places ; also some of the tools such as “visual studio” which have de buggers allowing you to set break points etc

We can also say: The Arduino environment does not provide any code analysis tools beyond those provided by the pre-configured compiler commands (and some of those are hard to find.) Since an arduino sketch becomes standard C/C++ code at some point, many other tools may be used...

(For an example of a hard-to-find analysis tool, Arduino ARM compiles will produce a .map file that includes a cross-reference table (which functions are called by which other functions.) I find it hopelessly verbose (very full of references that have long-since been optimized away), but something like that is usually considered the predecessor to more complete call-graph analysis...) (This is not created for AVR sketches, for some reason.)

THANKS A LOT

If you are on Windows you can install Visual Studio ("Community" version is free) and Visual Micro for Visual Studio (30 day trial + $45). That's a better choice than Arduino IDE for navigating/working on larger projects and Visual Micro has also some rudimentary debugging capability. Visual Assist plugin (30 day trial + $99) for Visual Studio is also quite useful for navigating large projects.

There’s always EMACS, ETAGS, and The ID Utilitiesreat
Great stuff for navigating unfamiliar source. Once you get used to it.

Any of the other “major” free IDEs (CodeBlocks, Eclipse, XCode, Netbeans, Visual Studio Code, PlatformIO) will have a lot of capabilities not present in the Arduino IDE, with somewhat varying “friendliness” to Arduino Projects. And then there are the commercial IDEs…