avr-gcc

Multiple definitions of - GCC bogus error

走远了吗. 提交于 2019-12-11 11:26:22
问题 I have a header file lcd.h with this (shortened): #pragma once // ... const uint8_t LCD_ROW_ADDR[] = {0x00, 0x40, 0x14, 0x54}; // ... other prototypes and macros... And a file lcd.c where this variable is used: #include <stdbool.h> #include <stdint.h> // ... #include "lcd.h" // ... /** Set cursor position */ void lcd_xy(const uint8_t x, const uint8_t y) { lcd_set_addr(LCD_ROW_ADDR[y] + (x)); } I include lcd.h in main.c , and lcd.c is compiled separately using makefile. I'm getting this error:

Encountering “Launch failed as no binaries could be found”

可紊 提交于 2019-12-11 10:30:06
问题 In AVR32 Studio (2.6) I'm trying to debug an AVR project and I get the error message "Launch failed as no binaries could be found". I can see in the console that Build is complete (an executable .elf file is in the build folder) and I've cleaned my project, created a new build configuration and I still can't seem to launch (and or program the chip) the debugger. 回答1: Check your debug launch configuration . It ought to be a little more intuitive, but is not. After you create and build your

Weird exception thrown when using simulavr with avr-gdb

為{幸葍}努か 提交于 2019-12-11 08:36:52
问题 I am debugging a program that I have written for the AVR architecture and compiled using avr-gcc with the -g argument. I launch simulavr using the following command: simulavr --device atmega8 --gdbserver Then I invoke avr-gdb and do (gdb) file main.elf as well as (gdb) target remote localhost:1212 Once debugging has started, I can successfully step through the assembly portion of my program .init et al. However, once jmp main is executed and a call to another function is made, simulavr throws

How to find the address of a variable when using AVR?

痞子三分冷 提交于 2019-12-11 06:02:29
问题 I am trying to write a program that detects pixel level collision of bitmaps on a Teensy micro controller compiling with AVR-GCC. I am trying to work out how to calculate the position of a single byte of the bitmap on the screen and have been told I should be using pointers. I don't see the relationship between the physical address of a bitmap byte and it's position on the screen, but I would like to investigate. The problem is, I have no way of printing this address. AVR doesn't have printf

Atmel / Arduino: ISR(TIMER0_OVF_vect) won't compile (“first defined” in __vector_16)

帅比萌擦擦* 提交于 2019-12-11 04:12:13
问题 I'm currently working on a PWM modulator to "simulate" a car engine ignition commutation. Then, I will use it to drive another microcontroller which handles the conversion from a raw signal (engine's commutator) to a clean output voltage, going through the RPM-counter's galvanometer. This project is also a pretext for me to learn how to have a better control upon my microcontroller. Well, I wrote a small program, using timer0 (8 bits), and I need to trigger two interrupt service routines

How can I prevent the need to copy strings passed to a avr-gcc C++ constructor?

偶尔善良 提交于 2019-12-11 02:33:44
问题 In the ArduinoUnit unit testing library I have provided a mechanism for giving a TestSuite a name. A user of the library can write the following: TestSuite suite("my test suite"); // ... suite.run(); // Suite name is used here This is the expected usage - the name of the TestSuite is a string literal. However to prevent hard-to-find bugs I feel obliged to cater for different usages, for example: char* name = (char*) malloc(14); strcpy(name, "my test suite"); TestSuite suite(name); free(name);

Undefined reference to in AVR-GCC

孤人 提交于 2019-12-11 02:13:48
问题 My main.c is as below #include <avr/io.h> #include<avr/interrupt.h> #include<util/delay.h> #include <string.h> #include "main.h" #include "globle.h" #include "LCD.h" int main() { ... ... ... lcdInit(0xc0); lcdScreen(0); . . . return 0; } The definition of lcdInit(0xc0); and lcdScreen(0); is in my lcd.c file and I have a header file lcd.h having the following lines: void lcdInit(char); void lcdScreen(char); But still I am getting: C:\Documents and Settings\Tanv\My Documents\my_project5\default

Macro defined in main.c not visible in another included file

让人想犯罪 __ 提交于 2019-12-10 22:48:44
问题 I have multiple C and H files In main.c I defined a macro, and in ws_driver.c I want to use it. ws_driver.h is included in main.c . main.c #define WS_PORT PORT_D8 #define WS_BIT D8 #define WS_DDR DDR_D8 #include "ws_driver.h" In ws_dirver.c I have two checks: ws_driver.c #include "ws_driver.h" #ifndef WS_PORT # error "WS_PORT not defined!" #endif #ifndef WS_BIT # error "WS_BIT not defined!" #endif Both are failing. $ avr-gcc -std=gnu99 -mmcu=atmega328p -DF_CPU=16000000UL -Os -I. -I -funsigned

Arduino (Uno) Ethernet client connection fails after many client prints

为君一笑 提交于 2019-12-10 14:22:54
问题 I'm using an Arduino Uno with Ethernet Shield. After sending many HTTP requests, client.println(...) , the client starts to fail when connecting. The time to failure appears to be random, and the sequence readout from the loop can vary anywhere between ~1000 and ~7000. The error is not to do with the Ethernet Transmit Buffer overflowing (Following this advice) Here is the code that is failing: #include <Ethernet.h> #include <SPI.h> // Network constants byte mac[] = {0x00, 0x23, 0xdf, 0x82,

How to link against just symbols correctly

妖精的绣舞 提交于 2019-12-10 12:09:56
问题 I guess this is a continuation of this question. I've compiled my intermediate bootloader library and have verified it working, now it's time to write some application code against it. I'm able to generate a symbol list from the bootloader's generated .hex file using $(OBJCOPY) --wildcard --strip-symbol=main --strip-symbol="_*" $(TARGET).elf $(TARGET).syms , this gives me bootloader.syms . I've written a test application that uses a few of the functions in the library section of memory, and I