Questions tagged [avr-gcc]

avr-gcc is a suite of executable software development tools for Atmel AVR RISC processors

avr-gcc is a suite of executable software development tools for Atmel AVR RISC processors, hosted on the Windows platform, has GNU GCC compiler for C/C++.

Atmel provides also an AVR Toolchain, which is a collection of tools/libraries used to create applications for AVR microcontrollers. The collection includes compiler, assembler, linker and Standard C & other math libraries.

Most of these tools are based on efforts from GNU (www.gnu.org), and some are developed by Atmel.

614 questions
4
votes
1 answer

LUFA Coding an Example for AT90USB162

I'm with an open-source USB library for the USB-enabled AVR microcontrollers, LUFA (2011-10-09), and I am trying to code the CDC (a bootloader) example to my AT90USB162 chip. The sample code is in folder /Bootloads/CDC and comes prepared for…
Rego
  • 1,118
  • 1
  • 18
  • 40
4
votes
3 answers

Tasking with AVR-Ada

I'm trying to implement tasking features using AVR-Ada, but when I run make, I get these error messages: C:\avr_test>make avr-gcc.exe (GCC) 4.3.3 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying…
Rego
  • 1,118
  • 1
  • 18
  • 40
4
votes
1 answer

Sending mutiple characters using USART1 on an atmega4809 results in 0xFF to be send

Solution: Turns out it did not have anything to do with the USART. The problem was in the Makefile. I reused a Makefile I have been using for atmega328p and atmega2560 for a long time. But this Makefile does not include the .rodata section when…
4
votes
2 answers

Moving data into __uint24 with assembly

I originally had the following C code: volatile register uint16_t counter asm("r12"); __uint24 getCounter() { __uint24 res = counter; res = (res << 8) | TCNT0; return res; } This function runs in some hot places and is inlined, and I'm…
Kryštof Vosyka
  • 566
  • 3
  • 15
4
votes
0 answers

What is the difference between read-only and read only data section?

Recently, I have dived into GCC Binutils nm documentation. I read the description of the symbols' classification and don't understand the differences between n and R (or r) symbols. As the manual says: for n The symbol is in the read-only data…
llwafelll
  • 53
  • 1
  • 4
4
votes
2 answers

AVR for Xcode 4?

Has anyone had success using xcode 4 as an IDE for AVR microcontrollers? Is it possible to have the same amount of integration as the plugin for eclipse?
Nathan
  • 835
  • 3
  • 11
  • 20
4
votes
2 answers

Why AVR-GCC compilers append a "clr r1" line after multiplication?

I am trying to check how AVR-GCC compiler compiles for multiplication? Input c code: unsigned char square(unsigned char num) { return num * num; } Output assembly code: square(unsigned char): mul r24,r24 mov r24,r0 clr…
user62039
  • 371
  • 2
  • 15
4
votes
2 answers

AVR G++: Executing a function that is past the 128 Kb ROM boundary

AVR g++ has a pointer size of 16 bits. However, my particular chip (the ATMega2560) has 256 KB of RAM. To support this, the compiler automatically generates trampoline sections in the same section of ROM as the current executing code that then…
David Pfeffer
  • 38,869
  • 30
  • 127
  • 202
4
votes
1 answer

Balancing branches in regard to cycles used

I have a loop with several conditional branches in it. The loop is supposed to always run the same amount of cycles no matter what branches are taken. To achieve this I filled the shorter branches with NOPs (using asm("nop")) until they were of…
tuzojil
  • 43
  • 4
4
votes
1 answer

Can I do something like #define ARRAY(size) char[##size##] in C?

I'm trying to define a macro to generate a structure on my global scope like the code above: #define BUFFER(size) \ struct { \ unsigned short size = ##size; \ unsigned short readIndex = 0; \ unsigned short writeIndex = 0; \ unsigned…
ylima
  • 410
  • 5
  • 17
4
votes
2 answers

invalid conversion from volatile uint8_t* to uint8_t*

I'm trying to set a library in C++ for AVR. The idea is to have an easy way of configuring what pins you use on each device. This is the library: class PINS{ public: //ATTRIBUTES uint8_t* DDRaddr; uint8_t* PORTaddr; uint8_t* PINaddr; int…
Kostas Dafnomilis
  • 629
  • 1
  • 5
  • 13
4
votes
1 answer

avr-gcc generated assembly when setting a register

I'm looking at the asm generated from the following C code. uint8_t anode = lednum / 4; PORTB = (1 << anode); I get the following using O2 optimization: 00000040 : 40: 86 95 lsr r24 42: 86 95 lsr r24 44: 21…
evading
  • 3,032
  • 6
  • 37
  • 57
4
votes
2 answers

avr-gcc destructive optimizations

I'm programming an Atmel ATtiny13a microcontroller using avr-gcc 4.8.2. This is my c code: #include #include int main(void) { DDRB = 1; // PB0 is output for (uint8_t i = 0; i < 10; i++) { PORTB = 1; …
Danilo Bargen
  • 18,626
  • 15
  • 91
  • 127
4
votes
3 answers

Function pointer location not getting passed

I've got some C code I'm targeting for an AVR. The code is being compiled with avr-gcc, basically the gnu compiler with the right backend. What I'm trying to do is create a callback mechanism in one of my event/interrupt driven libraries, but I…
Mark Elliot
  • 75,278
  • 22
  • 140
  • 160
4
votes
2 answers

Why is my function static variable never different despite being incremented?

I am writing a callback function in C. It is intended to initialise an I2C sensor, and it called at the conclusion of each (split-phase) configuration step; after the 9th call, the device is almost ready to use. The basic idea of the function is…
sapi
  • 9,944
  • 8
  • 41
  • 71