All Questions
336 questions
1
vote
1
answer
91
views
Is there a way to create a static array in the .data section, where its length is calculated by the size of the .bss section on the Arduino?
I'm just wondering if there is a way I can tell the compiler that I want to create a static array inside the .data section of the Arduino's SRAM, where the array's size is calculated using the size of ...
0
votes
2
answers
149
views
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
77
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 ...
4
votes
1
answer
58
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
68
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
1
answer
86
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 ...
2
votes
1
answer
222
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
79
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
114
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 ...
4
votes
2
answers
611
views
char arrays in PROGMEM
In a program, I have a lot of arrays of different length strings, and each array is declared as an array of pointers to those strings, like:
static const char * num_tab[] = {"First", "...
1
vote
2
answers
132
views
AVR128DB28 communication with SD card over SPI failed
I am trying to achieve communication between an AVR128DB28 microcontroller and an SD card over SPI.I'm programming it in Microchip Studio, programming is done through an MPLAB SNAP over UPDI. The ...
0
votes
1
answer
90
views
libgcc subroutines documentation for avr-gcc
I disassembled some C++ code with the avr-gcc compiler in godbolt and often found calls to libgcc subroutines like __udivmodhi4 or __mulhi3.
Where can I find good and insightful documentation about ...
1
vote
1
answer
132
views
Passing string by reference not working in Atmel Studio
MCU: Atmega2560
IDE: Microchip Studio v7.0.2594
Toolchain: WinAVR (also tried with Native)
I am trying communicate with my MCU over UART. I have written two very basic functions over UART to transmit ...
0
votes
0
answers
70
views
AVR-GCC (Arduino) - IEEE 754/IEC 559 compliance
Informally, it appears AVR-GCC is IEEE 754 compliant.
In this environment, how do I verify at compile time that floats are indeed IEEE 754 compliant? Much searching yields informative but ...
2
votes
1
answer
1k
views
"avr/io.h" not found when compiling assembly for ATmega128
I'm new to assembler and ATmega128.
The problem I have is I can't compile my assembly file. After this step I'd want to upload the program to an STK-300.
Here's the code
.include "avr/io.h"
...