Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
6 replies
80 views

I have a AVR GCC toolchain compiled to work on aarch64-linux-gnu devices (ARM64) and it produced twice larger file (around 35Kb) than almost identical command-line on desktop (mac silicon, around 20Kb)...
4ntoine's user avatar
  • 20.6k
4 votes
2 answers
141 views

I have a weird problem when doing inline asm and compiling/linking with avr-g++ (version 16, fresh from the Git). I think this might be a bug of the tool chain, but I wanted second opinions in case I ...
krab5's user avatar
  • 105
3 votes
1 answer
84 views

With avr-gcc 14, the compiler gives this warning: avrenv.c: In function ‘main’ avrenv.c:12:13: warning: ‘strncpy’ output may be truncated copying 255 bytes from a string of length 509 [-Wstringop-...
Torsten Römer's user avatar
0 votes
0 answers
51 views

I'm cross compiling (canadian build) AVR-GCC 7.3.0 to work on aarch64-linux-android (typical 64bit android devices) with Android NDK r29 on Ubuntu. During the build i'm getting: ... /home/anton/tools/...
4ntoine's user avatar
  • 20.6k
0 votes
0 answers
34 views

I'm cross-compiling avr-gcc statically (in order not to depend on Android linker) to work on aarch64 android devices. gcc is compiled with the flags: generic_arm64:/data/data/myapp/files/sdk/hardware/...
4ntoine's user avatar
  • 20.6k
0 votes
1 answer
94 views

I've cross-compiled an executable (AVR GCC) to run on Android arm64 device with aarch64-linux-gnu toolchain (not using Android NDK). file avr-g++ gives the following in "adb shell": file avr-...
4ntoine's user avatar
  • 20.6k
2 votes
3 answers
128 views

I got: #include <inttypes.h> typedef struct dbg_s dbg_t; struct dbg_s{ const uint8_t size; const uint8_t* item; }; #define DBG_SIZE 2 const uint8_t const dbgItems[DBG_SIZE] PROGMEM = {...
hypnoticum's user avatar
0 votes
0 answers
98 views

I'm making a software latch with following features: ATtiny85 @ 1 MHz, BOD disabled PB0 = LED, PB3 = Button (with internal pull-up) Interrupt on change Deep sleep until button press Change state with ...
tubos's user avatar
  • 99
2 votes
1 answer
56 views

I am building an avr-libc static library like this: avr-gcc -O2 -I. -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -g -ggdb -ffunction-sections -fdata-...
Torsten Römer's user avatar
1 vote
2 answers
72 views

With an Arduino Nano ATmega328P (Arduino IDE 1.8), the following C++ code (with 8bit operands): volatile uint8_t un8 = 123; volatile uint8_t res8; res8 = un8 >> 1; generates a 16bit shift ...
brewmanz's user avatar
  • 1,230
1 vote
1 answer
79 views

Avr-gcc 7.1, Win10. When compiling a simple LED blinker C code using avr-gcc, it outputs: Invoking the avr-gcc is done by hand using: avr-gcc -g -Os -mmcu=attiny13a -c "Attiny_blink_01.c" ...
Noideas's user avatar
  • 127
1 vote
5 answers
155 views

I'm rewriting an interrupt based I2C driver to avoid internal fixed buffer sizes. To achieve this, I'm passing a buffer pointer into the driver for it to use. This is simple for the transmit case as ...
Donald B's user avatar
-3 votes
2 answers
142 views

I have a simple C program: #include <stdint.h> #define WHEELS_PWM_CYCLES_PER_MS (5) #define WHEELS_TIME_TO_GO_1_CM_MS (10) int main(void) { for (;;) { uint32_t x = (uint32_t)...
user avatar
1 vote
1 answer
87 views

I could of course be lazy and determine it by path alone. But say I want a more reliable approach, like: if(IS_AVR) add_compile_options( --arduino-avr-specific-option ) endif() CMake ...
Tomáš Zato's user avatar
2 votes
2 answers
93 views

On AVR 8-bit, avoiding floats, I'm dividing a signed integer and formatting it with snprintf: int16_t tempx10 = -5; div_t temp = div(tempx10, 10); char buf[10]; snprintf(buf, sizeof (buf), "%4d.%...
Torsten Römer's user avatar
1 vote
1 answer
117 views

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 ...
Logan Seeley's user avatar
0 votes
2 answers
174 views

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-...
zombiesauce's user avatar
1 vote
2 answers
110 views

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 ...
Charles Florestal's user avatar
3 votes
1 answer
93 views

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 ...
Tom MacDonald's user avatar
4 votes
1 answer
77 views

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 ...
golden bananas's user avatar
1 vote
1 answer
85 views

(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. ...
Antonio's user avatar
  • 651
3 votes
1 answer
96 views

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 ...
Antonio's user avatar
  • 651
0 votes
1 answer
182 views

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 ...
Jon Leithe's user avatar
1 vote
1 answer
289 views

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. ...
MSSJCODER's user avatar
0 votes
1 answer
228 views

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 ...
Bavly's user avatar
  • 133
0 votes
2 answers
106 views

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 <...
asky's user avatar
  • 1,827
1 vote
1 answer
270 views

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 ...
zombieanfuehrer's user avatar
0 votes
1 answer
94 views

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,...
avong's user avatar
  • 31
2 votes
2 answers
140 views

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 ...
Kryštof Vosyka's user avatar
0 votes
3 answers
138 views

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\...
BetaEngineer's user avatar
4 votes
1 answer
174 views

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 ...
DocValle's user avatar
  • 167
4 votes
2 answers
774 views

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", "...
Robert Wallner's user avatar
1 vote
2 answers
164 views

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 ...
n0rmi's user avatar
  • 111
0 votes
1 answer
112 views

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 ...
Lars Schubert's user avatar
1 vote
1 answer
162 views

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 ...
Manish Verma's user avatar
2 votes
1 answer
357 views

I am encountering an issue with USART communication on an ATmega328P microcontroller and would appreciate some assistance with debugging. The problem I'm facing is as follows: I have implemented USART ...
Vamsi's user avatar
  • 87
0 votes
0 answers
78 views

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 ...
Malachi's user avatar
  • 2,501
2 votes
1 answer
1k views

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" ...
Elías's user avatar
  • 163
0 votes
1 answer
254 views

Here&there I find the likes of mulqi3.S & divmodhi4.S. Is there a reference anywhere on gnu.org on how to browse current official revisions of such architecture specific source code? What is ...
greybeard's user avatar
  • 2,677
1 vote
2 answers
152 views

I've a class template like that: struct Relay { int pin; bool state; }; template<std::size_t N, uint8_t D = 10> class RelayArray { private: Relay array[N]; //or std::array<Relay, ...
Fred's user avatar
  • 636
0 votes
1 answer
239 views

I'm using the ATmega328P TWI interface as follows. The problem is that it goes into an infinite loop strobing the LED, and never turns the LED off. If I change the condition to TRUE then it turns the ...
Matt Murphy's user avatar
2 votes
3 answers
240 views

On an 8-bit platform, I am composing an unsigned 32-bit integer from 4 8-bit integers like this: uint8_t buf[4]; uint32_t large = 0; large |= ((uint32_t)buf[0]) << 24; large |= ((uint32_t)buf[1])...
Torsten Römer's user avatar
1 vote
1 answer
407 views

I'm writing to the ATmega328P EEPROM as follows: eeprom_write_byte(address, (U8_T) 0); void eeprom_write_byte(void* address, U8_T data) { cli(); /* Wait for previous write to complete */ ...
Matt Murphy's user avatar
2 votes
1 answer
102 views

I'm at a total loss with this one, I don't even know what to include in my question. When I cast a constant to a pointer my (.data + .bss + .noinit) section grows by 1K, exceeding the ATmega328P's ...
Matt Murphy's user avatar
1 vote
1 answer
181 views

I am using Attiny1616 with Microchip Studio. I want to store the float type results obtained from the calculation of the code in FLASH memory. I have looked into PROGMEM, but PROGMEM does not support ...
Takeru Tsuji's user avatar
2 votes
1 answer
385 views

I am trying to learn AVR C, and was tinkering with the atmega328p microcontroller. I am using the avr-gcc toolchain on Linux Mint to compile and flash my code to the Arduino board. So I was trying to ...
Shobhit's user avatar
  • 133
0 votes
0 answers
56 views

I am using avr-g++ 10.2.0 on Fedora 37, target is ATmega128. My project should be optimized for code size and RAM usage. One 8-bit hardware register port is defined like this: struct MyPort { ...
user2849906's user avatar
0 votes
0 answers
154 views

In a method in a class I'm working on I have template <typename T = int_fast16_t, uint8_t Bits = sizeof(T) * 8 - 2> struct FixedPointFraction { using value_type = T; constexpr static uint8_t ...
Petr's user avatar
  • 63.6k
-1 votes
1 answer
192 views

EDIT: update learning assembly: ok so this function causes no compiler warnings and they should all be turned on now. Are my constraint values correct for these inputs and outputs? void ...
josie hinton's user avatar
0 votes
2 answers
223 views

I'm trying to implement a timing system on an ATtiny204 using Timer/Counter B in Microchip studio but I'm getting a very unexpected interrupt frequency based on my register and fuse settings. I have ...
Willis Hershey's user avatar

1
2 3 4 5
14