Questions tagged [avr-gcc]
AVR-GCC is a compiler that takes C language high level code and creates a binary source which can be uploaded into an AVR micro controller.
68 questions
1
vote
1
answer
157
views
Why does the use of serial.readBytes increase program size by 10kb?
If I put this in my arduino program, in main.cpp, I suddenly run out of memory for flash program size:
if(msgSize > 2) {
//sr::sequentialRead(&serialRead, newTram.hash);
uint8_t bytes[...
2
votes
2
answers
2k
views
Own type definition using a struct does not name a type
I need to initialize several buttons and LEDs connected to my Arduino. To store data related to an individual button or LED, I decided to define my own data type using two different structs. One for a ...
0
votes
1
answer
179
views
How to run avr-gcov on a .ino sketch file
I am new to Arduino and gcov. I have a .ino sketch file, avr-gcov, and avr-gcc from Arduino library in the same directory. Could someone guide me to the steps I should take to run avr-gcov on my .ino ...
2
votes
0
answers
191
views
TFT Screen with Arduino UNO does not display as expected
I have a 3.5" TFT LCD communicating in parallel connected to Arduino UNO.
I expect it draws a white circle on a black background but all it does is to show a white screen.
How to fix this?
main.c
...
1
vote
1
answer
385
views
How do I build and upload a C++ program without the Arduino Library or IDE?
Note: This is a reference question (but feel free to write answers of your own!)
I want to use the AVR tools directly -- no arduino-builder or arduino-cli. I would also like compilation and uploading ...
1
vote
1
answer
89
views
Why do I have to burn the code to make it run? [closed]
Why do I have to burn the code twice to actually burn it on to the Arduino board? I have to execute this command twice - only then is the chip getting programmed.
I'm using this command to burn the ...
0
votes
3
answers
3k
views
DigiSpark AT Tiny85 compile problem?
Friend asked me to find problem with compilation for his DigiSpark AT Tiny85 board.
We are trying to compile sketch from here:
https://forum.arduino.cc/index.php?topic=314773.0
But with no luck - ...
2
votes
3
answers
536
views
How can I control blinking of LED while in timer function?
When I am in the 30-second standby function, I want to turn the LED on and off at 5-second intervals.
How can I do what I want using the read_counter() function?
The problem here is that I am already ...
1
vote
1
answer
204
views
Why my arduino board does not blink properly?
I have two files
blink1.cpp
typedef unsigned char int8_t;
typedef volatile int8_t * volatile port_type;
port_type portB = (port_type) 0x25;
port_type ddrB = (port_type) 0x24;
void delay_500ms()
{
...
1
vote
1
answer
5k
views
How would I include Arduino libraries using AVR-gcc without the IDE?
I am writing my own code for the Arduino Uno. I compile my code with AVR-gcc, and then upload it with AVRdude. I am not using the Arduino software, but I do have it installed and working on my PC. I ...
11
votes
2
answers
2k
views
Understanding the compilation/linking/upload process (so I don't have to use the IDE)
I have started to play with and arduino UNO quite recently (without any prior experience with micro-controllers). I would like to use emacs instead of the IDE, and I'd also like to know what the IDE ...
1
vote
1
answer
1k
views
Error Compiling sketch for Arduino Uno(ld return 1)
I have got an telnet server with esp8266 + SoftwareSerial+ UNO, and here I want to on led with command ON .
will be 1 or 2. It is for recive 1 or 2 numbered pins.
And I extract pin from request with ...
1
vote
2
answers
121
views
Weird assembly output
I was taking a look at the disassembly for a loop of mine that seemed to be taking too long and I found these assembly instructions that I don't understand. Why does it load 0 into r25 and then do two ...
2
votes
2
answers
7k
views
Since double and float represent the same data type (usually), which is preferable?
It looks like on ATMega based boards, float and double are equivalent 32-bit (4-byte) data types.
However, on the Arduino Due, doubles are 64-bit (8-byte) where floats are 32-bit (4-byte), same as ...
0
votes
1
answer
902
views
compilation error when changing variable from char to String
I have a code with these two lines:
char handshakecode = "S"; // Capital S
char receive;
The lines of code are placed in a separate void, and not setup or loop.
When i change the two variables ...
2
votes
1
answer
479
views
AVR-GCC can't call function located on fixed address
I wrote the following code:
#include <avr/io.h>
__attribute__((noinline, section(".app_start"))) void app_start() //app_start section starts at 0xFA0
{
//register_packet_dispatch(...
0
votes
1
answer
287
views
C++ State Machine / Wpmf-convesion
I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language:
https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines.
I have ...
0
votes
1
answer
9k
views
Running C for arduino
Is there a compiler that I can use to run C on an arduino or any other way so that I can upload C programs to my arduino?
10
votes
1
answer
4k
views
Setting timer3 in CTC mode - conflict with servo library
I would like to set up a timer in order to call a function 800 times per second. I'm using the Arduino Mega and Timer3 with a prescaler of 1024. To choose the prescaler factor I've considered the ...
1
vote
2
answers
1k
views
Building mocoLUFA under OSX & Linux
I am attempting to build mocoLUFA under OS X el Capitan 10.11.6.
[Editor: mocoLUFA (MIDI firmware for Arduino Uno)]
I am using the specified LUFA version (LUFA101122) and I have tried building with ...
6
votes
1
answer
3k
views
What are the benfits of global variables over static class members?
On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
1
vote
1
answer
999
views
Volatile variable not updating from timer ISR
I know this is a problem that has come up many times but I can't seem to get this code fragment to update the count variable on an ATMEGA328P. I am using an Arduino Uno as a development board, with ...
15
votes
1
answer
386
views
Is there a preprocessor constant for memory size
I would like my compiles to exclude some code depending upon the flash/program space available. To be used in the demo code of a library I support. Whereas my current solution is to use a #ifdef of ...
5
votes
2
answers
181
views
Trouble with Timer 0
I'm taking my first wobbly steps outside the Arduino IDE and I'm not having much success with timers / interrupts. I can set a pin to output and light an LED with registers fine but I cannot for the ...
0
votes
1
answer
2k
views
Why serial communication does not work on atmega168/328p?
I expect from the following program serial.c to light the led on if I send key 1 from terminal, and light the led off when I send key 0 from terminal:
#define F_CPU 16000000UL
#define BAUD 9600
#...