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
0
votes
0 answers

Clobber X,Y,Z Registers with avr-gcc

If I code asm volatile("" ::: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", …
Udo Klein
  • 6,784
  • 1
  • 36
  • 61
0
votes
2 answers

enabling SPI and creating an array using MAX7219

#define F_CPU 16000000UL // AVRJazz28PIN Board Used 16MHz #include #include #include #define SPI_PORT PORTB #define SPI_DDR DDRB #define SPI_CS PB2 void SPI_Write(uint8_t addr, uint8_t…
0
votes
2 answers

Part of macro optimized away when using constant value

This is a WS2812B RGB LED strip driving code for AVR (Arduino hardware). I have some issues with the compiler optimizing away parts of my code. I tried -O1, -O2, -Os, same result.I can't use -O0 because then delays don't work. Macros Here is my…
MightyPork
  • 18,270
  • 10
  • 79
  • 133
0
votes
1 answer

_SFR_IO_ADDR() on Arduino Mega PortH+

I tried to use the SoftI2CMaster library [http://playground.arduino.cc/Main/SoftwareI2CLibrary], the library works great in most cases, but it doesn't work on ports H through L, the compiler give me following message: /SoftI2CMaster.h: In function…
xandy
  • 27,357
  • 8
  • 59
  • 64
0
votes
1 answer

Move servo with pushbuttons | C | Atmel Studio

I am now working on a solar tracker project with the ATMEGA1284P and, after configuring PWM it is time for discovering the mechanical limitations of the tracker so I can define boundaries for the servos. For this, I have prepared a simple code. I…
Rui Moreno
  • 1
  • 1
  • 1
0
votes
4 answers

AVR C won't run interrupt

I'm fiddling with my MEGA-1284p kit and avr studio and I'm in need of some help solving a problem. I need it to toggle LED3 on button press SW0. Here is the AVR C code: #define F_CPU 11059200UL // The Xplained kit runs at 11.0592 MHz #include…
John
  • 47
  • 1
  • 5
0
votes
1 answer

CPUs with addressable GPR files, address of register variables, and aliasing between memory and registers

Background Some CPUs, such as the Atmel AVR, have a general purpose register file that is also addressable as part of main memory -- see Figure 7-2 in section 7.4 and the paragraph after the figure. What was WG14 thinking? Given this, why did the C…
LThode
  • 1,843
  • 1
  • 17
  • 28
0
votes
2 answers

Clock on Atmega8

I am trying to do a clock on Atmega8. I have 8Mhz quartz. I use timer0 interrupt for clock timeticks: /* Settings */ #define TMR_RELOAD 80 - 5 /* 8 kHz / 80 = 100 Hz */ #define TMR_CNT_MAX 100 /* 1Hz internal counter */ /* internal…
vitperov
  • 1,347
  • 17
  • 20
0
votes
1 answer

atmel studio AVR debugger quickwatch crazy (float)(1000 / 100)= 1092616192 float

In Atmelstudio 6.1 I debug my AVR 328 When opening Quickwatch I tried to analyze a problem and due to unexected problems I stripped down the problem to this: Entered expression is (float)(1000), also tried with .0F (float)(1000) 1148846080 …
John
  • 7,507
  • 3
  • 52
  • 52
0
votes
1 answer

Day of Week function not working as intended in Atmega8

I have a C function that finds the Day of the week if given the complete date. This function works perfectly when I compile it on my laptop using gcc. But when I compile the function for the Atmega8 using avr-gcc it gives the wrong answer. Could…
0
votes
2 answers

accessing AVR registers with C?

I've been trying to learn everything I can about micro-controllers lately. Since this is self-study, it's taken me a while to learn how the things work at the bare metal. Long story short, I don't want to use the AVR libraries in my C code; I want…
Holandaise
  • 9
  • 1
  • 2
0
votes
1 answer

AVR-GCC Makefile - multiple targets

I'm creating a group of ATMega devices with different programs. They share lot's of files like classes. I want to create a makfile that will contain something like: DEVICE1DEPS = first.o second.o thrid.o DEVICE2DEPS = second.o thrid.o…
peku33
  • 3,628
  • 3
  • 26
  • 44
0
votes
1 answer

Advice: trying to recognize when a device is not connected

I have some hard time trying to find a method to restart my state machine. In other words some part of what I ve got: I have a module that when is powered up it stays for a debounce time of 0.5 s and then it goes in a state machine: first it send a…
0
votes
2 answers

Atmega8A uart spi eeprom

everyone, I want to write and store my string at spi eeprom, then read back from spi eeprom and display in terminal through uart. I already follow the step in [1]: http://ww1.microchip.com/downloads/en/DeviceDoc/21822E.pdf . But it seem that it…
OooO
  • 13
  • 1
  • 8
0
votes
1 answer

Templated abstract class which implements some general methods

I use avr-gcc and in my project are three devices which are able to output characters (Bluetooth, LCD, serial port). So I wrote three classes which implement the method ClassName* write(const char c). Now my idea was to write an abstract class which…