News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Trying to understand how code::blocks does things

Started by vulpes_vulpes, July 12, 2024, 08:09:15 PM

Previous topic - Next topic

vulpes_vulpes

I am trying to understand where/how code::blocks does things. I have used it for simple C based projects in the past, but now I'm trying to use it for Arduino stuff. Yeah I know the wizard is broken, but a wizard only does stuff than can be done manually.

So I have done some compilations one of which looks like this...


avr-g++ -Os -mmcu=atmega328p -I /home/mike/work/arduino-1.8.19/hardware/arduino/avr/cores/arduino -I /home/mike/work/arduino-1.8.19/hardware/arduino/avr/variants/standard -D__AVR_ATmega328P__ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -I /home/mike/.arduino15/packages/arduino/hardware/avr/1.8.19/libraries/HID/src -I /home/mike/.arduino15/packages/arduino/hardware/avr/1.8.19/cores/arduino -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -mmcu=atmega328p -I. -I/usr/bin/arduino/libraries/EEPROM -I/usr/bin/arduino/libraries/Ethernet -I/usr/bin/arduino/libraries/Firmata -I/usr/bin/arduino/libraries/Flash -I/usr/bin/arduino/libraries/LCD4884 -I/usr/bin/arduino/libraries/LCD4Bit_mod -I/usr/bin/arduino/libraries/LiquidCrystal -I/usr/bin/arduino/libraries/OBD -I/usr/bin/arduino/libraries/SD -I/usr/bin/arduino/libraries/SD/utility -I/usr/bin/arduino/libraries/Servo -I/usr/bin/arduino/libraries/SevenSegment -I/usr/bin/arduino/libraries/SoftwareSerial -I/usr/bin/arduino/libraries/SPI -I/usr/bin/arduino/libraries/Stepper -I/usr/bin/arduino/libraries/TinyGPS -I/usr/bin/arduino/libraries/Wire -I/usr/bin/arduino/libraries/Wire/utility -I/usr/bin/arduino/hardware/arduino/cores/arduino -I/usr/bin/arduino/libraries -I/usr/bin/arduino/hardware/arduino/variants/standard -I/home/mike/.arduino15/libraries -c cores/CDC.cpp -o .objs/cores/CDC.o


So looking at the end of this command, we have lots of '-I/usr/bin/arduino...' stuff.

Where does that come from ? Is there a Makefile or something that code::blocks uses ?

I had a hunt about and could not find anything. It is not causing me a problem, I don't have /usr/bin/arduino/<anything> so the lookups fail, and the software compiles OK. I am just curious about how code::blocks works.

For the record this is code::blocks 20.03 on Fedora 39.

stahta01

#1
Did you install the Compiler needed for ARDUINO?
If yes, where is it installed?
If no, then you need to install the Compiler.

Web searches implies below installs the AVR compiler likely needed for ARDUINO.
yum install avr-gcc-c++

Edit: Looks like more ARDUINO stuff is needed and I forgot where I found the files several years back for an Debian based Linux distro.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

vulpes_vulpes

Thanks for the reply.

Yes the compiler is installed and running OK.

I am just curious what is adding all the "-I /usr/bin/arduino..." stuff to the compile command, and in doing so, trying to understand how code::blocks works.

stahta01

#3
Quote from: vulpes_vulpes on July 13, 2024, 02:42:47 PM
Thanks for the reply.

Yes the compiler is installed and running OK.

I am just curious what is adding all the "-I /usr/bin/arduino..." stuff to the compile command, and in doing so, trying to understand how code::blocks works.

That came from the Wizard you used.

See project part of https://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

vulpes_vulpes

OK. Thanks for the reply.

Well I got some arduino code to compile, link, upload and run, and then discovered the CPU frequency was wrong. I'm guessing that this is another "feature" of the broken arduino project wizard. I edited the project .cbp to put it right, and everything is fine now.

Thanks for the help and pointers on this.