Skip to main content

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
13 votes
2 answers
12k views

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 ...
1 vote
1 answer
157 views

If I put this in my arduino program, in main.cpp, I suddenly run out of memory for flash program size: if(msgSize > 2) { //sr::sequentialRead(&serialRead, newTram.hash); uint8_t bytes[...
-1 votes
1 answer
124 views

I'm working on a linux machine with avrdude and avrgcc. NOT using Arduino IDE. I'm using Arduino Nano 33 SENSE REV2 BLE, trying to upload a sample blink .c program and getting this error. This is the ...
2 votes
2 answers
2k views

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

I am new to Arduino and gcov. I have a .ino sketch file, avr-gcov, and avr-gcc from Arduino library in the same directory. Could someone guide me to the steps I should take to run avr-gcov on my .ino ...
2 votes
0 answers
193 views

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 ...
0 votes
2 answers
318 views

I am programming an attiny202 which as per datasheet can run up to 20Mhz, but after compiling/uploading this simple code to the attiny202 and watch the PA2 pin on the oscilloscope, I see that the pin ...
1 vote
1 answer
386 views

Note: This is a reference question (but feel free to write answers of your own!) I want to use the AVR tools directly -- no arduino-builder or arduino-cli. I would also like compilation and uploading ...
0 votes
1 answer
87 views

So I was reading about Simple AutomaticLight Controller using LDR. or with the help of LDRSenso. But I have LM393 Photoresistor (LDR) Sensor I like to know are they same thing or somewhat different. ...
1 vote
1 answer
1k views

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
89 views

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
2 answers
122 views

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
1 answer
204 views

I have two files blink1.cpp typedef unsigned char int8_t; typedef volatile int8_t * volatile port_type; port_type portB = (port_type) 0x25; port_type ddrB = (port_type) 0x24; void delay_500ms() { ...
1 vote
1 answer
2k views

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. ...
11 votes
2 answers
2k views

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 ...
0 votes
3 answers
3k views

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
3 answers
539 views

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

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 ...
1 vote
1 answer
2k views

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
2 answers
111 views

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
553 views

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 ...
1 vote
1 answer
201 views

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
2 answers
94 views

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) ...
1 vote
1 answer
1k views

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

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 ...
1 vote
0 answers
157 views

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 ...
2 votes
2 answers
138 views

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 ...
-1 votes
1 answer
26k views

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
2 answers
4k views

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 ...
10 votes
1 answer
4k views

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 ...
21 votes
2 answers
13k views

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 ...
1 vote
2 answers
490 views

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 ...
2 votes
3 answers
2k views

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 ...
2 votes
2 answers
917 views

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 ...
1 vote
1 answer
2k views

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 ...
9 votes
3 answers
3k views

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 ...
1 vote
0 answers
88 views

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 ...
2 votes
0 answers
1k views

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 ...
2 votes
1 answer
814 views

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 ...
2 votes
1 answer
1k views

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(): ...
4 votes
1 answer
10k views

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 ...
5 votes
2 answers
184 views

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 ...
5 votes
4 answers
241 views

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 <&...
6 votes
1 answer
3k views

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 ...
0 votes
3 answers
294 views

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
1 answer
289 views

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
1 answer
915 views

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()...
0 votes
1 answer
2k views

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 votes
3 answers
1k views

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....
1 vote
0 answers
301 views

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