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.

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. In documentation, AVR GCC is used when referring to GCC targeting specifically the AVR, or something that is AVR specific about GCC.

68 questions
21
votes
2 answers

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 though. To avoid that, you could presumably…
Peter Bloomfield
  • 10,982
  • 9
  • 48
  • 87
15
votes
1 answer

Is there a preprocessor constant for memory size

I would like my compiles to exclude some code depending upon the flash/program space available. To be used in the demo code of a library I support. Whereas my current solution is to use a #ifdef of processor type. But I would like to be more general…
mpflaga
  • 2,523
  • 14
  • 13
13
votes
2 answers

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 through abstracted information. My question aims to…
RedDogAlpha
  • 190
  • 1
  • 1
  • 9
11
votes
2 answers

Understanding the compilation/linking/upload process (so I don't have to use the IDE)

I have started to play with and arduino UNO quite recently (without any prior experience with micro-controllers). I would like to use emacs instead of the IDE, and I'd also like to know what the IDE does under the hood, in order to be able to write…
Ash
  • 225
  • 1
  • 11
10
votes
1 answer

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 following steps: CPU freq: 16MHz Timer resolution:…
UserK
  • 559
  • 1
  • 11
  • 24
9
votes
3 answers

How to write makefile-compatible sketches?

I'd like to write my sketches so that I can either build/upload them using the Arduino IDE, or optionally using GCC and a makefile. I know about including the function declarations at the top, but is there anything else to do in order for my sketch…
Alex Shroyer
  • 437
  • 2
  • 5
  • 9
6
votes
1 answer

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 global sense, i.e. they are used only inside one…
Ariser
  • 577
  • 1
  • 8
  • 26
5
votes
4 answers

Where in datasheet is the warning about unreliability of reading PINxn?

I use atmega32u4 (but believe it applies to all models). Here is the datasheet. Consider the following C program (I use AVR-GCC 5.4.0): #include int main(void) { PORTB |= 1 << PB5; /* pullup */ DDRB |= 1 << PB0; /* LED */ if (!(PINB…
5
votes
2 answers

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 life of me get it to blink using a timer. I have…
Ashlyn Black
  • 339
  • 1
  • 9
4
votes
1 answer

Does ATMega 328/2560 chips support JTAG-type programmer and hardware debugger?

As stated in www.Arduino.cc FAQ, "Can I use an Arduino board without the Arduino software? Sure. It's just an AVR development board, you can use straight AVR C or C++ (with avr-gcc and avrdude or AVR Studio) to program it." For UNO/Pro…
EEd
  • 904
  • 1
  • 14
  • 21
3
votes
1 answer

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 can be programmed through serial, can get powered…
aaa
  • 2,715
  • 2
  • 25
  • 40
2
votes
0 answers

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 // sudo apt-get install avr-libc gcc-avr binutils-avr…
ar2015
  • 173
  • 7
2
votes
3 answers

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 in the timer function with the read_counter()…
2
votes
0 answers

Cannot program Mega2560 using Atmel Studio 6.2 and avrdude

So I will admit that I am a noob to Arduino. I have some experience programming microcontrollers, and that was back in the day (about 4 years ago - such as the Freescale 68HC12) so up until this point I thought I was experienced enough to get this…
JoshRyan
  • 21
  • 3
2
votes
2 answers

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 button and another one for a LED. As I need to…
albert
  • 205
  • 2
  • 13
1
2 3 4 5