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.

Filter by
Sorted by
Tagged with
0
votes
1answer
39 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
1answer
33 views

Weird assembly output

I was taking a look at the disassembly for a loop of mine that seemed to be taking too long and I found these assembly instructions that I don't understand. Why does it load 0 into r25 and then do two ...
1
vote
2answers
66 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() { ...
0
votes
1answer
44 views

Reading port register and print

I am playing with port registers directly to improve speed on a Arduino micro. I have no problem writing them, like PORTF &= B11101111 However, when I try to read and print it, things get funny ...
0
votes
1answer
86 views

C++ State Machine / Wpmf-convesion

I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language: https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines. I have ...
0
votes
0answers
65 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
1answer
376 views

Error Compiling sketch for Arduino Uno(ld return 1)

I have got an telnet server with esp8266 + SoftwareSerial+ UNO, and here I want to on led with command ON . will be 1 or 2. It is for recive 1 or 2 numbered pins. And I extract pin from request with ...
0
votes
2answers
45 views

Atmega collecting and relaying interrupt calls

I like to collect all possible interrupt and relay them to an alternative handler interrupt table what the user can set. In order to do this i have to: 1) collect all/any interrup request 2) ...
0
votes
2answers
727 views

DigiSpark AT Tiny85 compile problem?

Friend asked me to find problem with compilation for his DigiSpark AT Tiny85 board. We are trying to compile sketch from here: https://forum.arduino.cc/index.php?topic=314773.0 But with no luck - ...
2
votes
1answer
197 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(...
0
votes
1answer
274 views

compilation error when changing variable from char to String

I have a code with these two lines: char handshakecode = "S"; // Capital S char receive; The lines of code are placed in a separate void, and not setup or loop. When i change the two variables ...
2
votes
2answers
65 views

Weird behavior (Couldn't pull the pin LOW)

I was trying to implement my own code to control a stepper motor on arduino uno, however I noticed that the pins were always HIGH despite what was written to them. I started to erase the code to leave ...
4
votes
4answers
171 views

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 <avr/io.h> int main(void) { PORTB |= 1 <&...
1
vote
2answers
2k 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 ...
0
votes
1answer
1k views

Timer0 overflow interrupt not working

I try to use the Timer0 of an Arduino Leonardo (ATmega32u) to trigger an interrupt at regular intervals, using plain avr-gcc (not the arduino library). I try to blink the built-in LED as test, but it ...
2
votes
1answer
205 views

How does the build process in Arduino IDE work for ESP8266

How does the build process for esp8266 work in arduino IDE. Arduino ide uses avr-gcc to compile programs For atmel micro controllers. Does it uses same for compiling programs for esp8266?
0
votes
1answer
3k views

avr/io.h No such file or directory error when compiling using avr-gcc

I am trying to use the atmega328p as standalone microchip and program it. I ama using an Arduino Uno as ISP. I have written a simple program to test it however when I try to compile it using avr-gcc ...
0
votes
0answers
214 views

AVR-Toolchain for Arduino crashes on Mac OSX 10.11.6: Hints or debugging help needed

My Arduino IDE does not compile any project since I updated from Mac OSX 10.6.8 to 10.11.6. I even tried reinstalling and also manually installing the original AVR-toolchain. But the behaviour did ...
-1
votes
3answers
621 views

avrdude flash issues

I want to burn a hex file to a custom ATmega2560 board. I use this USBasp programmer for flashing (firmware version 1.01) on my Mac OS X 10.12.6 system. All hex files are compiled with avr-gcc (GCC) 4....
0
votes
0answers
100 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 ...
-1
votes
1answer
24k views

Error compiling code for Arduino/Genuino Uno

Arduino: 1.8.6 Hourly Build 2017/10/20 02:33 (Windows 10), Board: "Arduino/Genuino Uno" c:\users\hp\desktop\arduino-nightly\hardware\tools\avr\bin../lib/gcc/avr/4.9.2/../../../../avr/bin/ar.exe:...
1
vote
2answers
453 views

Building mocoLUFA under OSX & Linux

I am attempting to build mocoLUFA under OS X el Capitan 10.11.6. [Editor: mocoLUFA (MIDI firmware for Arduino Uno)] I am using the specified LUFA version (LUFA101122) and I have tried building with ...
0
votes
1answer
521 views

UECIDE: linker error with U8g2 library

This sketch: #include <SPI.h> #include <Wire.h> #include <U8g2lib.h> // OLED display. U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); void setup()...
2
votes
2answers
955 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
3answers
886 views

Compiling code via terminal

How can I compile my code via terminal? I am working on a Chrome app that allows you to write, compile, and upload code to an Arduino, and I need to know this so I can use the command line compiler on ...
1
vote
1answer
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
1answer
608 views

Volatile variable not updating from timer ISR

I know this is a problem that has come up many times but I can't seem to get this code fragment to update the count variable on an ATMEGA328P. I am using an Arduino Uno as a development board, with ...
1
vote
1answer
176 views

Compiling Error

I am trying to compile this code on arduino IDE...It showing error code is #include <IRremote.h> int RECV_PIN = 6; int led = 12;//1FE50AF int led1 = 10;//1FED827 int led2 = 9; //1FEF807 int ...
0
votes
1answer
132 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
1answer
166 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 ...
10
votes
2answers
8k 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 ...
2
votes
2answers
5k views

Since double and float represent the same data type (usually), which is preferable?

It looks like on ATMega based boards, float and double are equivalent 32-bit (4-byte) data types. However, on the Arduino Due, doubles are 64-bit (8-byte) where floats are 32-bit (4-byte), same as ...
2
votes
1answer
625 views

Compilation error using arduino-mk on arch Linux (undefined reference to __dso_handle)

I'm compiling a simple sketch that reads values from an analog input and activates a buzzer on a digital input. working on an Arduino uno. the sketch compiles and runs fine on windows and arch linux ...
5
votes
2answers
132 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 ...
0
votes
3answers
180 views

Why atmega168/328p starts to reset?

First we set fuse bits: avrdude -c usbasp -p atmega328p -U lfuse:w:0xFF:m -U hfuse:w:0xDF:m -U efuse:w:0x07:m # same for atmega168 In the following examples we use the following commands to compile ...
0
votes
1answer
1k views

Why serial communication does not work on atmega168/328p?

I expect from the following program serial.c to light the led on if I send key 1 from terminal, and light the led off when I send key 0 from terminal: #define F_CPU 16000000UL #define BAUD 9600 #...
1
vote
2answers
413 views

Question about include statements and details in Arduino.h file from core library

This is more of a C/C++ question. However the files I am asking about are a part of the Arduino library. In /arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/Arduino.h : #ifndef Arduino_h #...
0
votes
1answer
245 views

Running Arduino code for Bluefruit LE on bare ATMega328

I need to hook up Bluefruit LE Breakout (nRF8001-based) to ATMega328 chip (to use it as wireless UART), and it seems like the library provided is for Arduino. What I have is just bare ATMega328 (note ...
2
votes
1answer
762 views

avr-g++ (or avr-gcc) and LiquidCrystal library

I'm trying to run a simple Hello World program from Arduino 1.6.5 from terminal. When I run it in Arduino IDE, it works good. When I'm trying to get it by avr-g++ I have hard way to figure out how to ...
0
votes
1answer
1k views

undefined reference to `PPMintIn::PPMintIn(int)'

I am making a new library that will utilize PinChangeInt's library. My intention is to further simplify repetitive code by creating a library. (This is to allow for multiple PPM channels without ...
1
vote
2answers
374 views

New Language - Interfacing with AVR

So I'm taking a class where the project is to create a new embedded language. We are using OCaml for the compiler, so I was looking for a way to interface with AVR or its C library in such a way as I ...
1
vote
2answers
568 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 ...
0
votes
1answer
4k views

Running C for arduino

Is there a compiler that I can use to run C on an arduino or any other way so that I can upload C programs to my arduino?
0
votes
2answers
562 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 ...
3
votes
1answer
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 ...
1
vote
0answers
1k views

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 ...
0
votes
1answer
554 views

TIMER1 CTC Interrupts not working with avr-gcc

I am attempting to program my arduino in plain C, and I've come across some very strange behavior. If I load the following code from the Arduino IDE, it works as expected and toggles Pin 6 every 100ms....
6
votes
1answer
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 ...
10
votes
1answer
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 ...
5
votes
1answer
8k views

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 ...