Questions tagged [avr-gcc]
AVR-GCC is a compiler that takes C language high level code and creates a binary source which can be uploaded into an AVR micro controller.
68 questions
21
votes
2
answers
13k
views
Would an infinite loop inside loop() perform faster?
When you're writing a typical sketch, you usually rely on loop() being called repeatedly for as long as the Arduino is running. Moving in and out of the loop() function must introduce a small overhead ...
13
votes
2
answers
12k
views
Will a .ino Arduino Sketch compile directly on GCC-AVR?
Okay, we all have seen those questions all over the web such as Arduino v.s. C++, or other similar questions. And a vast majority of the answers do not even touch compilation differences other than ...
10
votes
1
answer
4k
views
Setting timer3 in CTC mode - conflict with servo library
I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the ...
6
votes
1
answer
3k
views
What are the benfits of global variables over static class members?
On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
5
votes
2
answers
181
views
Trouble with Timer 0
I'm taking my first wobbly steps outside the Arduino IDE and I'm not having much success with timers / interrupts. I can set a pin to output and light an LED with registers fine but I cannot for the ...
3
votes
1
answer
2k
views
Using an Arduino board to program an AVR
I think the arduino board is awesome.
Though I'm not interested in the library and IDE at all...
Is there a way, to use an AVR 328p, as you normally would, on an arduino board?
I like how arduino's ...
2
votes
2
answers
2k
views
Own type definition using a struct does not name a type
I need to initialize several buttons and LEDs connected to my Arduino. To store data related to an individual button or LED, I decided to define my own data type using two different structs. One for a ...
2
votes
1
answer
479
views
AVR-GCC can't call function located on fixed address
I wrote the following code:
#include <avr/io.h>
__attribute__((noinline, section(".app_start"))) void app_start() //app_start section starts at 0xFA0
{
//register_packet_dispatch(...
2
votes
3
answers
537
views
How can I control blinking of LED while in timer function?
When I am in the 30-second standby function, I want to turn the LED on and off at 5-second intervals.
How can I do what I want using the read_counter() function?
The problem here is that I am already ...
2
votes
1
answer
1k
views
programming arduino in pure c
I'm trying to flash pure c-code to arduino Mega2560 board from linux using avr-gcc & avrdude. Compilation is done , now trying to flash using avr-dude, getting error as "avrdude: stk500_recv(): ...
2
votes
2
answers
917
views
Passing arguments to LCD.print through another function
I'd like to write a function like this:
void lcdPositionPrint(int row, int col, content) {
lcdPosition(row, col);
LCD.print(content);
}
but I'm not certain how to declare "content", because ...
2
votes
0
answers
191
views
TFT Screen with Arduino UNO does not display as expected
I have a 3.5" TFT LCD communicating in parallel connected to Arduino UNO.
I expect it draws a white circle on a black background but all it does is to show a white screen.
How to fix this?
main.c
...
1
vote
1
answer
89
views
Why do I have to burn the code to make it run? [closed]
Why do I have to burn the code twice to actually burn it on to the Arduino board? I have to execute this command twice - only then is the chip getting programmed.
I'm using this command to burn the ...
1
vote
1
answer
2k
views
Interleave disassembly + source with avr-objdump
I have a C program for the attiny85, that I want to disassemble and display with interleaved source code.
Here's my program:
test.c
#include <avr/io.h>
int main() {
for(int i=0; i<100; ...
1
vote
1
answer
1k
views
How to pass non-static class member to callback on avr platforms?
I am using the PubSubClient library in my own Arduino library. I'm having trouble with trying to assign a class member as the client library setCallback callback function.
MyClass.cpp:
#include <...
1
vote
1
answer
2k
views
AVRdude does not read the FUSE byte values correctly
I am exploring the ATmega328p MCU via a standard Arduino UNO, with the help of avr-gcc toolchain and AVRdude (All in the WINAVR package). I have successfully programmed the board a few times with it. ...
1
vote
1
answer
5k
views
How would I include Arduino libraries using AVR-gcc without the IDE?
I am writing my own code for the Arduino Uno. I compile my code with AVR-gcc, and then upload it with AVRdude. I am not using the Arduino software, but I do have it installed and working on my PC. I ...
1
vote
1
answer
218
views
avr-gcc -D is ignored
Im trying to use XCode to compile avr program with arduino libs but seems like something wrong with my Makefile because it throws me warnings like
# warning "F_CPU not defined for <util/delay.h&...
1
vote
2
answers
4k
views
Why does my Arduino IDE hang/crash so often?
I've traditionally used a text editor with avr-gcc and makefiles for working with Arduino boards. I'm now trying to develop projects for the wider Arduino user-base, so I am trying to use the Arduino ...
1
vote
2
answers
109
views
Gratuitious instantiation of `Serial`, why?
Let's take a very simple sketch, any simple one-.ino sketch. Say, just a led blinker like this
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop()
{
...
1
vote
1
answer
1k
views
Melzi 2.0 Board Firmware Upload problem
I'm trying to flash the repetier Firmware to my Prusa i3 3D Printer, which uses Melzi 2.0 board. I uploaded it successfully 2 days ago with same settings but now is failing always.
@avrdude -p ...
1
vote
1
answer
265
views
How to detect Genuino 101 from inside the code?
I am using a custom library for Arduino Mega which uses AES library for AES-128 encryption.
However, when I try to use that library in Intel Genuino 101 development board, it shows compilation error ...
1
vote
2
answers
636
views
Use Arduino Uno to program the on-board Atmega328 in C
I have an Arduino Uno board. I have seen how it is possible to program external AVR's through the Arduino Uno board, for instance an ATtiny. But I'm starting with c for atmel µc and I just want to ...
1
vote
0
answers
88
views
Error Compiling any coding in Arduino IDE
I was using the example code of "Blink", and when I try to compile it, it pop out an error as below.
I tried to:
uninstall and installed back the Arduino IDE
installed different versions of Arduino ...
1
vote
0
answers
156
views
Bootloader fails when two Arduinos are connected over serial port
I’d like to connect two Arduinos over serial port so that they can communicate with each other. Initially, I put all necessary code onto one device and now connected another via serial port. As soon ...