Show Posts
Pages: [1] 2 3 ... 11
1  Using Arduino / Project Guidance / Re: best way to learn C++? on: February 11, 2014, 10:37:33 am
I'd recommend CppDroid app - new C/C++ IDE on Android. It has a lot of included C/C++ examples and tutorials. Blog: http://cppdroid.blogspot.com, Google Play: https://play.google.com/store/apps/details?id=name.antonsmirnov.android.cppdroid
2  Using Arduino / Programming Questions / Re: Using other IDEs to develop on: January 02, 2014, 12:49:34 pm
Take a look at ArduinoDroid:
http://arduinodroid.blogspot.com/2014/01/arduinodroid-30.html
3  Development / Suggestions for the Arduino Project / Re: Autocomplete on: January 02, 2014, 12:48:10 pm
Autocomplete is not implemented in ArduinoDroid:
http://arduinodroid.blogspot.com/2014/01/arduinodroid-30.html
4  Development / Other Software Development / Re: Arduino Code Highlighting, Auto-complete & Call-tip Help in Notepad ++ on: January 02, 2014, 12:47:08 pm
This is how it works in ArduinoDroid:
http://1.bp.blogspot.com/-KL24Z1AshMM/UsVjXpJWn5I/AAAAAAAAAnM/p0QnNL5crYE/s400/code_complete.png

http://arduinodroid.blogspot.com/2014/01/arduinodroid-30.html
5  Development / Other Software Development / Re: ArduinoDroid app new features (autocomplete, diagnostics and fixes, navigator) on: January 02, 2014, 12:46:07 pm
Done:
http://arduinodroid.blogspot.com/2014/01/arduinodroid-30.html

6  Development / Other Software Development / ArduinoDroid app new features (autocomplete, diagnostics and fixes, navigator) on: December 25, 2013, 07:16:14 am
Hey.

Just want to let you know about new ArduinoDroid (free Android Arduino IDE with donations) features:
  • autocomplete (now you don't have to remember everything!)
  • real-time diagnostics (warnings and errors) and fixes
  • file navigator (variables, methods, etc)
  • smart syntax highlighting

http://arduinodroid.blogspot.com/2013/12/arduinodroid-30-testing.html

Let's make great Arduino IDE together!
7  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 12, 2013, 11:07:29 pm
I can confirm it works now and Serial extern var (as HardwareSerial) is available now (it confirms avr/io.h included needed file and HardwareSerial found required definition) though autocomplete feature works not as i expect. Thank you, guys!
8  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 01:08:02 pm
You really want to use -mcu=<xxx> and not just define the appropriate macros.  The -mcu=<xxx> option controls what instructions the compiler generates.  Different boards might have different instructions.  If whatever default your gcc was built for uses instructions that your machine does not support, your program won't run.  If the default is the least common denominator, your program might be bigger and slower than if you used the correct -mcu=<xxx> option.

i would be happy to just use it, but unfortunately i can't as my toolchain is not gcc and i have to do pretty the same as avr-gcc does behind the scene. fortunately, the community is very experienced and friendly to help me with it.
9  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 01:05:23 pm
Quote
i found avr, avr-3, avr-4 folders
There are two places where "avr-3" and "avr-4" shows up.

One is near the top-level of the toolchain directory, and is a consequence of some sort of incompatibility between compiler versions 4.3.x and 3.4.x;  I don't know the details, but avr-gcc packages (winavr, crosspack, linux installs) from those days include TWO versions of the compiler, selectable with avr-gcc-select.  Arduino only uses 4.x  Hopefully there are lots of symlinks involved, but I'm not sure that they survive the sort of packaging and unpackaging and re-packaging that has gone on.
okay, now i know it.

Quote
The other is that in addition to the specific CPUs like __AVR_ATmega328P__, the avr chips are also divided into several "architectures" with minor but significant differences to compiler tools.  These are unimaginatively called "avr1", "avr3.5", and so on, and affect things like libraries, startup code, and linker scripts.

great to know that too! (i've seen that folders but also did not understand the meaning). that relates to these link too: http://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html

thank you, now it becomes more and more clear
10  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 10:23:14 am
The IDE in boards.txt has a line <board>.build.mcu=<avr>.  When you select the board type (tools->board), it will look at boards.txt to see what options to pass.  The build.mcu option says to add the appropriate -mcu=<board> to the compile line.  So for an example, the lines for the Uno are:

Code:
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

The uno.build.mcro=atmega328p line says to add the -mcu=atmega328p option to the compiler.

If you look in the compiler source, in <gcc>/gcc/config/avr/avr-mcus.def, there is the line for atmega328p board:

Code:
AVR_MCU ("atmega328p",           ARCH_AVR5, "__AVR_ATmega328P__",        0, 0, 0x0100, 1, "m328p")

The third argument gives the identifier to be defined (__AVR_ATmega328P__ in the case of the Uno).

I'm getting closer and closer.
So in order to emulate this avr-gcc toolchain -mmcu arg usage i need to define __AVR_ATmega328P__ definition and include file "m328.h" in sketch code and it's path to I:

Code:
#define __AVR_ATmega328P__
#include <m328p.h>
#include <Arduino.h>
%sketch_code%

and execute compilation with params:
Code:
%sketch_filename%
-I%core_path%
-I%m328p.h_filepath%

All other things wil be done automatically according to definitions from "avr/io.h" which is included by "Arduino.h". Is it correct?
11  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 09:43:39 am
Is "__AVR_ATmega32__"  etc defined in the command line with a -D?...no I don't see it, there is a "-mmcu=" switch that I think gets its value from boards.txt. That probably causes the correct file to be included but the link escapes me at this point.
If you use -mmcu=<xxx>, the compiler will automatically define the appropriate __AVR_<xxx> macro.

How does it know what file needs to be included and what macro should be added?
12  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 08:25:06 am

that's what i need.
Does it mean i need to include according header file?
13  Development / Other Software Development / Re: Autocomplete for Arduino IDE on: December 11, 2013, 04:53:01 am
Quote
what header files should be included first for each board type?
The various hardware register definitions come in through the "#include <avr/io.h>" statement in Arduino.h.
io.h in turn includes one of the many io*.h files from avr/include/avr, depending on the setting of the -mmcu switch on the compile statement.  These in turn are automatically generated from xml "device description" files provided by Atmel.
So if you say -mmcu=atmega328p, you'll get iom328p.h sucked into your program, which defines all of the hardware registers "and stuff, and support" that are present on the ATmega328p.

How is that correlation done? Will that work only with arduino gcc toolchain from desktop distribution or with another too (Clang f.e.). Let's say i using clang which support gcc arguments. will that work with it or arduino toolchain knows somehow the correlation and it's not presented in the sources (headers)? I'm asking because i already pass mmcu argument and it does not work in my case, so i assume that my current toolchain (not gcc and not arduino gcc) does not have such correlation rules or smth.

Quote
You can read a statement like: "#if defined(UBRRH) || defined(UBRR0H)" as "if there is a single UART, or there is a UART0, then (create the datastructures arduino uses for dealing with the first serial port.)"

As of relatively recently, most of the arduino core code will check for the existence of particular peripherals by looking for the definition of a significant register from that peripheral, rather than doing conditional compilation based on board or cpu type.
So on an Arduino MEGA, the code will define data for Serial3, *not* because it's a MEGA, or because it has a m1280 cpu, but because UBRRH3 is defined, which means that "elsewhere" knows that a UART3 exists...

PS: this also means that io.h pulls in a LOT of register definitions that you probably do NOT want to add to your autocomplete word list for the average Arduino user!


Thank you for great and clear explanation! One more question to solve is to build correct -I paths list. I have avr/avr-3/avr-4 folders that have exactly the same files list in each of them. Which one should i use in -I paths or should i just add all of them?
14  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 04:28:33 am
So the file io.h decides what to include based on some definitions, for example

Code:
#elif defined (__AVR_ATmega32__)
#  include <avr/iom32.h>

Is "__AVR_ATmega32__"  etc defined in the command line with a -D?...no I don't see it, there is a "-mmcu=" switch that I think gets its value from boards.txt.

Absolutely correct:
in "boards.txt" file
Code:
uno.name=Arduino Uno
...
uno.build.mcu=atmega328p
and i know mcu for the board and pass -mmcu argument just like desktop IDE does:

Code:
12-09 16:16:32.729: INFO/System.out(15329): /Users/me/sdk/hardware/tools/avr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/Users/me/sdk/hardware/arduino/cores/arduino -I/Users/me/sdk/hardware/arduino/variants/standard /Users/me/sdk/hardware/arduino/cores/arduino/wiring.c -o /data/data/name.antonsmirnov.android.arduinodroid/build/wiring.c.o

but it's not working. I' not sure it's not working because of Clang and it should work or
Code:
-mmcu
does not affect to board-related headers inclusion.

Quote
That probably causes the correct file to be included but the link escapes me at this point.

______
Rob


15  Using Arduino / Programming Questions / Re: Simpler alternative to #if ! defined() ... #endif ? on: December 11, 2013, 02:34:01 am
If you use a program like notepad++ you have the ability to search and replace.

To remove all Serial.print stuff:
Search
Replace...
Find what: Serial.
Replace with: //Serial. 
Replace all.

You did not understand. i do WRITE smth like Notepad++ with autocomplete for Arduino so i need to know how to build command-line for compile  (autocomplete to be more detailed) dependent on board type
Pages: [1] 2 3 ... 11