647 questions
0
votes
0
answers
84
views
+150
Binary size bloats 20x if moved from src/main.rs to examples/
I'm making a library for Arduino Uno in Rust from scratch. Currently, there's a basic Serial.write print example in the src/main.rs, which on compilation is around 500 bytes (cargo b --release).
$ avr-...
1
vote
2
answers
64
views
How to get an ATtiny24A MCU into sleep mode?
I am experiencing somewhat a peculiar phenomenon. I am trying to get an ATtiny24A into sleep mode. I had a working code before, but through revisions and testing of other parts of my program it seems ...
3
votes
1
answer
33
views
Calling C function from the .init3 section of a AVR-GCC compiled program
I am working on a project that contains a firmware update failure feature that :
notifies user/host that firmware update failed whenever the device gets unplugged in the middle of a firmware update ...
4
votes
1
answer
46
views
Where is the offset of the Y register from the call/stack frame in avr-gcc coming from?
On the avr-gcc website (https://gcc.gnu.org/wiki/avr-gcc#Frame_Layout) it says that the frame pointer (Y register) is off by one byte so Y+1 points to the bottom of the frame. However when I compiled ...
1
vote
1
answer
48
views
avr-gcc ATmega4809 problem with `.rodata` section
(This is a follow up of this question)
The following program doesn't work (in ATmega4809)
#include <avr/io.h>
void f(const char str[])
{
if (str[0] == 'a') // <-- here is the problem. ...
3
votes
0
answers
64
views
Problem with avr-g++ 13.3.0 passing const char array as parameter in ATmega4809 (40 pins)
The following code doesn't work in ATmega4809:
#include <avr/io.h>
#include <util/delay.h>
void f(const char str[])
{
if (str[0] == 'a'){ // <-- here is the problem!!! The program ...
0
votes
1
answer
57
views
avr-ld errors; cannot find crtatmega328p, cannot find -lm, ect
I'm trying to link two object files from Makefile, but the linker keeps throwing errors at me. I can't seem to find this errors whe I search the web, so I hope anyone here can help.
In my Makefile, I ...
2
votes
1
answer
203
views
AVR ATtiny1626 bizarre infinite interrupt problem
I have an ATtiny1626 code that I'm in the early stages of just getting the modules going on my custom board for my client.
I had some issues with my interrupts being called indefinitely over and over.
...
0
votes
1
answer
71
views
How to fix a simple error in Atmel studio
I am programming an Atmega chip using Atmel studio 7. I try to define F_CPU on the first line of the main.c file. This F_CPU definition is used inside the other files. However when I compile the ...
0
votes
2
answers
67
views
Template with parameter pack compiles using avr-gcc, but not using Arduino IDE
I'm trying to write a generic template for Print for an Arduino project. In doing so, I encountered a compiler error I didn't understand, so I made a minimum reproducible example.
template <...
1
vote
1
answer
129
views
Issues with Link Time Optimization (LTO) on avr-gcc with ATmega328
I’m working on a project with an ATmega328 and using avr-gcc/g++. I'm trying to enable Link Time Optimization (LTO), but I’m encountering issues during linking.
Here's a simplified example:
• Static ...
0
votes
1
answer
67
views
Compiler Truncates Interrupts Vectors of ATmega328PB in Eclipse AVR Plugin
I would normally use Eclipse avr-gcc plugin and (avr-gcc compiler from zaks https://blog.zakkemble.net/avr-gcc-builds) to develop firmware for AVR MCU.
The MCU ATmega328PB has extra timers (3,4), SPI1,...
2
votes
2
answers
98
views
Saturating addition optimization in avr-gcc
I am programing for ATtiny13 and I have to do a lot of saturating additions.
Trying to optimize them, it seems that avr-gcc just doesn't know how to optimize anything at all. All of this was tried ...
0
votes
3
answers
115
views
How does C compiler or Preprocessor handle MACRO with arguments differently?
I am working on a code for the Atmel Microcontroller and using ATMEL Studio.
You can check the toolchain and studio version from here.
*\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\...
4
votes
1
answer
108
views
Why is 'Placement New' for classes with virtual Members only working when buffer is on local stack?
I have some C++-Code which uses the Placement New operator to create an instance of a class with virtual members in an existing buffer. It works as expected when the buffer is on the local stack of ...