Category : avr-gcc

Intro: While i was coding and testing a library, I’ve noticed a very strange behavior from the compiler, not really optimizing unnecessary variables […] and i was socked to observe that for example: "unnecessary definitions of functions" where optimized/"removed" in the compilation process, while "unnecessary variable definitions" not exactly as someone would imagine them to ..

Read more

Intro: While i was coding and testing a library, I’ve noticed a very strange behavior from the compiler, not really optimizing unnecessary variables […] and i was socked to observe that for example: "unnecessary definitions of functions" where optimized/"removed" in the compilation process, while "unnecessary variable definitions" not exactly as someone would imagine them to ..

Read more

My question is more like: Why the compiler "thinks" that a "PROGMEM variable" is the same as a "plain Variable"? is it because PROGMEM-keyword is "just" a macro and nothing more? or is it for some other reason? ISSUE demonstration: Lets consider the below example: class object { public: object(int variable); object(int variable PROGMEM); }; ..

Read more

My question is more like: Why the compiler "thinks" that a "PROGMEM variable" is the same as a "plain Variable"? is it because PROGMEM-keyword is "just" a macro and nothing more? or is it for some other reason? and is there any workaround..? ISSUE demonstration: Lets consider the below example: class object { public: object(int* ..

Read more

I have been learning the make program. I wanna to program LCD by the AtMega8 and compile it with the Makefile. I wrote this basic code: #ifndef __AVR_ATmega8__ #define __AVR_ATmega8__ #endif #define F_CPU 8000000UL #include <avr/io.h> #include <util/delay.h> #include "hd44780.h" int main(void) { lcd_init(); lcd_clrscr(); lcd_puts("Hello World"); while (1); return 0; } And I wrote ..

Read more

I wrote a c++ code in avr version 4.14 for atmega328p #include <avr/io.h> #include <util/delay.h> int main(){ DDRB |= (1<<0x01); while(1) { PORTB |= (1<<0x01); _delay_ms(500); PORTB &= ~(1<<0x01); _delay_ms(500); } return 0; } It gives me that error that I don’t understand: ../test.c:21: fatal error: opening dependency file dep/test.o.d: No such file or directory ..

Read more

I have noticed the following code, which is obviously invalid C++, compiles in Arduino IDE (using AVR-GCC): // The program compiles even when the following // line is commented. // void someRandomFunction(); void setup() { // put your setup code here, to run once: someRandomFunction(); } void loop() { // put your main code here, ..

Read more