Questions tagged [gcc]

Users invoke a language-specific driver program (gcc for C, g++ for C++, etc.), which interprets command arguments, calls the actual compiler, runs the assembler on the output, and then optionally runs the linker to produce a complete executable binary.

GCC's external interface follows Unix conventions. Users invoke a language-specific driver program (gcc for C, g++ for C++, etc.), which interprets command arguments, calls the actual compiler, runs the assembler on the output, and then optionally runs the linker to produce a complete executable binary.

21 questions
15
votes
1 answer

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 processor type. But I would like to be more general…
mpflaga
  • 2,523
  • 14
  • 13
9
votes
3 answers

How to write makefile-compatible sketches?

I'd like to write my sketches so that I can either build/upload them using the Arduino IDE, or optionally using GCC and a makefile. I know about including the function declarations at the top, but is there anything else to do in order for my sketch…
Alex Shroyer
  • 437
  • 2
  • 5
  • 9
7
votes
1 answer

Accessing a C++ static variable from gcc inline asm

For some reason I want to mix a bit of assembly with C++ (not C). To allow the code to be compilable using the standard Arduino IDE, I don't want to use direct assembly source. I don't want to use a wrapper C file either. My problem is as follows: I…
kuroi neko
  • 183
  • 6
5
votes
3 answers

Works with gcc, not with Arduino. error: taking address of temporary array

I need to hard code 8 byte addresses into char arrays of length 8. This must be done many places in my code (in function scope), so I have tried to come up with a one-liner. The following works perfectly in C when compiling with gcc. char…
Mads Skjern
  • 1,145
  • 3
  • 13
  • 23
3
votes
1 answer

Using an Arduino board to program an AVR

I think the arduino board is awesome. Though I'm not interested in the library and IDE at all... Is there a way, to use an AVR 328p, as you normally would, on an arduino board? I like how arduino's can be programmed through serial, can get powered…
aaa
  • 2,715
  • 2
  • 25
  • 40
2
votes
0 answers

Error with libraries after setting up Code::blocks to work as an arduino IDE

I followed this guide: http://arduinodev.com/guide-to-arduino-development-environment-codeblocks/ Everything seemed to work until I compiled the example code: #include /* Turns on an LED on for one second, then off for one second,…
1
vote
1 answer

How to fix error line number offset in Sublime Text when compiling for Arduino

When compiling for Arduino via the Stino plugin line numbers are not represented correctly in the output. For example, I have an error on line 117 however the output is: sketch_name.ino.cpp:136:1: error:
aburdi
  • 13
  • 2
1
vote
0 answers

Trying to show g++ (linter-gcc for Atom) where to find Arduino libs

I'm trying to use Atom as an IDE for arduino and arduino-based boards. I'm using arduino-cli for compilation and avrdude for upload, and now I'm trying to use linter-gcc for linting. g++ is running and the linter seems to be working ok, but it's…
1
vote
2 answers

How do I make Arduino IDE use a specific version of GCC in Debian?

Using Raspbian Stretch. I installed gcc-4.9 with specified version. Then I installed arduino (2.1.0.5) which in turn pulled gcc 4.6. When I try to compile Marlin in it, it says Marlin requires C++11 support (gcc >= 4.7, Arduino IDE >= 1.6.8). …
1
vote
1 answer

using references to SFRs in gcc inline assembler

I want to write a driver that can use either timer0 or timer2, based on a choice made at compile time. So I want all references to timer registers to be abstracted, e.g. OCRA for OCR0A/OCR2A, etc. I could do it with plain macros, like so: #define…
kuroi neko
  • 183
  • 6
1
vote
1 answer

How do I order the gcc compiler to generate -S flag in Arduino IDE

How can I set the Arduido IDE to generate the -S flag to gcc to see the machine code in Arduino? (the sketches)
FJsanto
1
vote
1 answer

Inheritance not working as expected

Short version: This is a lighting control project. Some of the clases are Pin and Channel. Channel contains a Pin. Pin is a base class for DigitalOutPin and will be the base class for AnalogOutPin, and I want Channel to be able to use any child…
dj_segfault
  • 137
  • 1
  • 8
1
vote
2 answers

Question about include statements and details in Arduino.h file from core library

This is more of a C/C++ question. However the files I am asking about are a part of the Arduino library. In /arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/Arduino.h : #ifndef Arduino_h #define Arduino_h #include #include…
wgwz
  • 149
  • 1
  • 7
0
votes
1 answer

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 created an Fsm class, which implements the behavior…
ezeg
  • 18
  • 2
0
votes
1 answer

Add -D option via boards.txt

I'm trying to find a way to set a -D compiler option from within the boards.txt file. Basically set a #define for use in code. There are already some special ones like board.vid but is there a generic way to do it? Somehow the Teensy add-on adds a…
Adam Haile
  • 599
  • 2
  • 7
  • 14
1
2