14
votes
Accepted
Will a .ino Arduino Sketch compile directly on GCC-AVR?
See my answer here: Classes and objects: how many and which file types do I actually need to use them? - specifically: How the IDE organizes things.
I know that at a minimum you have to include the ...
12
votes
Will a .ino Arduino Sketch compile directly on GCC-AVR?
I would just like to add a few points to Nick Gammon's answer:
You do not need to rename a .ino file in order to compile it: if you
explicitly tell the compiler it's C++ (option -x c++), it will
...
7
votes
Accepted
Weird behavior (Couldn't pull the pin LOW)
You are creating a pointer variable, not a normal variable.
That pointer variable is, until told otherwise, pointing at address 0x00. It covers 4 bytes.
Addresses 0x00 to 0x1F are the internal CPU ...
6
votes
Accepted
Where in datasheet is the warning about unreliability of reading PINxn?
did somebody come across such case, or I'm the first in the world?
You are not the first. I recently got bitten by the very same issue.
However, unless you are close to an unusually strong radio ...
6
votes
Accepted
Own type definition using a struct does not name a type
This is a bug in the Arduino IDE: when converting your .ino file to a
.cpp file, it added a declaration for the function ledFactory()
before the declaration of the type led_t.
As it appears to be ...
6
votes
Why do I have to burn the code to make it run?
On a Unix shell, separating commands with the pipe character (|) means
“run these commands in parallel, feeding the standard output of each one
to the standard input of next one”.
In this context, it ...
4
votes
Trouble with Timer 0
Returning from main does not reset the device (it would start up again and do it all over in that case). It calls exit which turns interrupts off and loops indefinitely.
00000068 <__ctors_end>:
...
4
votes
Accepted
Trouble with Timer 0
return 0 resets the device. Use while(1); instead, to make it wait indefinitely.
3
votes
Where in datasheet is the warning about unreliability of reading PINxn?
A test with an Arduino Uno.
I used the usb connector to power-on the arduino uno. The led is at PB5, so I have exchanged PB0 and PB5. My test is therefor not the same.
#define LED_PB PB5 // pin ...
3
votes
Accepted
AVR-GCC can't call function located on fixed address
I've tried this code with arduino and it worked (i taught, of course, i can't add the "-Wl,--section-start=.app_start=0xFA0" flag to the compilation process so the function not gonna be moved to other ...
3
votes
Accepted
Interleave disassembly + source with avr-objdump
The .stabs section contains debugging info, not actual code. There is no
point in trying to “disassemble” it. The -D option of avr-objdump
means “disassemble everything, whether or not you believe it'...
3
votes
Accepted
slower clock frequency than expected on attiny202
Just as a complement to chrisl's answer, if you disassemble the compiled
program, you should see that your infinite loop looks like this:
1: sts 0x0407, r24 ; write to PORTA_OUTTGL
rjmp 1b ...
2
votes
Accepted
Using an Arduino board to program an AVR
Do I have to use all the stuff from arduino?
A = No!
Can I use my own compiler for an arduino board? (GNU-GCC / AVR)
Can I use my own IDE for an arduino board? (Eclipse / Atmel Studio)
Can I still ...
2
votes
Accepted
Running C for arduino
Perhaps you should look into here
https://github.com/arduino/Arduino/wiki/Build-Process
Arduino uses avr-gcc compiler. Basically, it is a C compiler.
There is an step by step on how to customize ...
2
votes
Since double and float represent the same data type (usually), which is preferable?
See avr-gcc
Deviations from the Standard
double
double is only 32 bits wide and implemented in the same way as float
when writing code for ATMega based boards ...
They are the same, ...
2
votes
Accepted
Compilation error using arduino-mk on arch Linux (undefined reference to __dso_handle)
I can't say I fully understand what is going on, but it seems that if you add:
void * __dso_handle;
You may be able to eliminate one of the problems. You might try the same trick with __cxa_atexit ...
2
votes
Accepted
avr-gcc -D is ignored
You are using $(CPPFLAGS) for *.cpp files but only $(CXXFLAGS) are defined.
This should be obvious from command line (if you enable showing executed commands for make)
And also:
CC =
using $(CPP) ...
2
votes
Accepted
Volatile variable not updating from timer ISR
You want CTC mode for that to work. As in:
#include <avr/io.h>
#include <avr/interrupt.h>
volatile uint8_t count;
void init_100us_tick(void) {
TCCR0A = _BV(WGM01); // CTC mode ...
2
votes
Compiling code via terminal
Check out platformio.org it's the best solution out there for command line compiling.
2
votes
Accepted
programming arduino in pure c
In file included from led.c:3:0:
/usr/lib/avr/include/util/delay.h:95:3: warning: #warning "Compiler
optimizations disabled; functions from won't work as designed"
You should start by fixing this....
2
votes
Error compiling code for Arduino/Genuino Uno
The problem is just what the error message says it is.
c:\users\hp\desktop\arduino-nightly\hardware\tools\avr\bin../lib/gcc/avr/4.9.2/../../../../avr/bin/ar.exe: unable to rename 'core\core.a'; ...
2
votes
Accepted
How does the build process in Arduino IDE work for ESP8266
Does it uses same for compiling programs for esp8266 ?.
No. It uses xtensa-lx106-elf-gcc. The compiler has to match the architecture.
Most of the build "process" (as in the actions that are taken) ...
2
votes
How would I include Arduino libraries using AVR-gcc without the IDE?
Since you will end up using a significant portion of the Arduino core
library, the easiest path is to accept the idea that you are now writing
“Arduino sketches” rather than plain C++ code. Don't ...
2
votes
Where in datasheet is the warning about unreliability of reading PINxn?
You have made an antenna with the 10cm wire and are receiving radio waves which is translating to voltages on your input pin. This is why you don't have the same trouble when the wire is not connected....
2
votes
Accepted
Error Compiling sketch for Arduino Uno(ld return 1)
This is a bug in the compiler (linker) used by the Arduino AVR Core. It's not because of a bug in your code, and there's not much you can do about it except using a different version of the AVR Core.
...
2
votes
Accepted
C++ State Machine / Wpmf-convesion
A pointer to a member function is not allowed in C++. GCC can allow it, but moans at you because it's non-standard.
In C++ the normal way of dealing with the kind of thing you want is through class ...
2
votes
Accepted
AVRdude does not read the FUSE byte values correctly
A couple of things. That you can't change fuses from the bootloader and that optiboot can't report fuse values correctly, even if you change them.
No self-programming of fuses
A bootloader can't ...
2
votes
Accepted
Why my arduino board does not blink properly?
There are a couple of issues here.
One of them has already been raised in a comment:
int main()
{
- ddrB = (port_type) 0x20;
+ *ddrB = (int8_t) 0x20;
while(true)
{
The more ...
2
votes
How to pass non-static class member to callback on avr platforms?
You can't. On the AVR platform, PubSubClient::setCallback() expects a
raw function pointer as a callback, and that is what you have to
provide. A static method is equivalent to a raw function, a non-...
2
votes
Accepted
Do I need to use resisters and ICes for specific sensors.What if I dont use it,Will it impact my arduino board some how like making it useless &faulty
Both images, that you included, show breakout boards. They are circuit boards (PCB - Printed Circuit Board), which contain all the components, that are needed to connect the corresponding part (in ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
avr-gcc × 66arduino-uno × 17
avrdude × 15
avr × 11
atmega328 × 10
compile × 9
avr-toolchain × 9
programming × 7
gcc × 7
c++ × 6
timers × 6
arduino-mega × 5
arduino-ide × 5
compilation-errors × 5
serial × 4
interrupt × 4
c × 4
ide × 3
esp8266 × 2
library × 2
arduino-leonardo × 2
bootloader × 2
attiny × 2
uploading × 2
atmega2560 × 2