Questions tagged [avr-toolchain]

The AVR® Toolchain is a collection of tools/libraries used to create applications for AVR microcontrollers. This collection includes compiler, assembler, linker and Standard C and math libraries.

Filter by
Sorted by
Tagged with
1
vote
1answer
193 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. ...
3
votes
1answer
98 views

What happens when you call malloc()/free()/new/delete?

So I understand that generally speaking, dynamic allocation should be avoided. My question isn't how or why, but what happens when you call a function that allocates memory? On Windows or Linux, when ...
12
votes
1answer
942 views

_delay_ms() is much slower than expected (by a factor of 6) on TinyAVR 0/1 (ATTiny1604)

I designed a custom AVR development board using the Atmel ATTiny1604 microcontroller. It belongs to the new Tiny-0 family, due to its recentness, some required changes to relevant toolchains have yet ...
0
votes
1answer
88 views

What else is consuming Data Segment reported by avr-size?

I am facing a low memory available problem in arduino. I am compiling a big sketch for arduino mega 2560. Analysing a .elf file, the avr-size tool gives: text data bss dec hex filename ...
1
vote
1answer
513 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; ...
4
votes
1answer
257 views

MEGA 2560: Simple program - One analogWrite turns off the other

I'm using Windows 10, Arduino 1.8.12 (Windows Store 1.8.33.0) I have an Arduino MEGA 2560 and a red LED connected to pin 4. #define RED 4 #define GREEN 2 void setup() { analogWrite(GREEN, 0); ...
0
votes
1answer
230 views

Why is Toolchain Not Updated with Arduino IDE Install on Mac

I have not been doing any Arduino work for about a year. The last time I ran the Arduino IDE was in the previous version of MacOS. Now that I have updated to the latest MacOS Version Catalina (10.15....
1
vote
2answers
312 views

Multiple defintion error, Linker error [closed]

Trying to create an elf file for two sets of files in different folders. LIDARBOT.h ----------- #ifndef LIDARBOT_H_ #define LIDARBOT_H_ #include <avr/io.h> #include "drivers/motors.h" #endif ...
0
votes
1answer
43 views

ISR definition causing boot loop?

I am trying to compile and upload code to an Arduino Uno from the command-line, however I seem to be experiencing an odd issue. When I compile this code: #include <avr/interrupt.h> #include &...
0
votes
1answer
87 views

My software serial code won't work at > 4800bps

I've put together a simple software serial (send-only) implementation for use on my attiny8[45] microcontrollers. I realize that there are more efficient USI-based implementations out there; this was ...
2
votes
1answer
292 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(...
1
vote
1answer
4k 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

avr_g++ compiler error: expected primary-expression before '.' token (C code in .ino)

The compiler is complaining about a macro defined in mjson.h Documents\Arduino\libraries\microjson/mjson.h:135:28: error: expected primary-expression before '.' token #define STRUCTOBJECT(s, f) ....
0
votes
1answer
4k 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 ...
1
vote
0answers
237 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 ...
0
votes
1answer
82 views

Where is CLKPR located on Ubuntu 16.04 with Arduino 1.8.3

I would like to see the definition of CLKPR. I guess that similarly to PORTB and other registers, it should be defined by the toolchain? (see Where is PORTB defined? ) Am I right? Where should I look ...
1
vote
4answers
156 views

Porting code from Arduino IDE to other IDEs - expected code size reduction

Could I realistically be expecting some 25% - 50% code size reduction if I abandoned Arduino IDE's framework and moved to something more rudimentary such as AVR Studio ? I am using the EEPROM, Timer1 ...
0
votes
1answer
173 views

Equivalent to POSIX mmap() in AVR-libc

Is there an similar function in AVR-libc/Arduino C++ to mmap()? I'm looking for a way to place machine code in memory at runtime and make it executable.
1
vote
1answer
695 views

Compiling source with Arduino.h with avr-g++

How should I include the Arduino libraries when I'm compiling from the the command line? I tried to do it like this: avr-g++ -g -Os -Wall -mcall-prologues -mmcu=atmega328p -fno-exceptions -o blink....
2
votes
2answers
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(): ...
1
vote
3answers
243 views

Can I port a project built on Arduino Uno to a standalone ATmega328 using the exact same code?

I'm building an IoT power usage monitor in which the data is logged using a RTC and an SD card module and a web app hosted on an ESP8266 gives access to this data. My question is can I use the exact ...
1
vote
1answer
155 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
2answers
118 views

Logging without IDE

Is there a way to log events on Arduino when developing using C / AVR toolchain, and not the Arduino IDE? Working on Ubuntu.
2
votes
1answer
205 views

How can I make Arduino IDE use Atmel's provided toolchain? (Linux/Ubuntu)

I have an Arduino based board using ATmega168PB, but so far only Atmel's provided toolchain supports this microcontroller. I can download the toolchain from Atmel's website, but I am not sure how to ...
3
votes
2answers
7k views

How to program AVR in Mac OS X?

In our college we are using a module developed by IIT Bombay (called FIREBIRD V[ver 5]). It has ATmega2560 and ATmega8 microcontrollers (master and slave) with bootloader. The staff uses AVR Studio ...
2
votes
1answer
570 views

Interleave Assembly and Source for avr-objdump

Trying to get avr-objdump to generate a listing that interleaves the assembly with the source code. I've tried a bunch of debugging arguments in different configurations but I can't seem to get it. ...
3
votes
1answer
2k views

Arduino in Eclipse IDE: How to add SPI library (core library already added)?

I want to use eclipse for arduino programming, so I followed the guides to set up a static project for the arduino core library. Then I added the library file (.a) and the .h and .cpp files to my new ...
3
votes
1answer
3k views

Storing in a global variable using inline assembly

What I'm trying to do is pretty basic: I have a global variable and I'm trying to store some value in it (specifically, the SP_H and SP_L values). The variable is an array of structs and I'm trying ...
1
vote
1answer
122 views

Why are Tone.cpp and IPAddress.cpp getting built for my project?

I'm using avr-size to see the size of library objects to free up some FLASH. Why are Tone.cpp and IPAddress.cpp getting built? e.g. $ cd /var/folders/3j/6wp3hvrj34n0xg3xzq6vjq380000gn/T/...
13
votes
2answers
1k views

Assembly on the Arduino: IO registers

Question: What registers do I use to access the IO on the Arduino Uno when I am using assembly for programming? Background: I was interested in practicing my assembly language skills on the Arduino (...