Base QBS project to program Arduino with Qt Creator.
Still in beta!
The code editor of the Arduino IDE is very basic and lacks a lot of features, which is annoying for advanced developers.
Qt Creator is a very good C++ IDE, targeted for Qt obviously but it can handle any other toolchain very easily, and using QBS we can have a nicely integrated Arduino solution (not perfect but functional).
Things you loose at the moment are the easy board selector, the integrated library manager and the integrated serial console. Theses could be solved using plugins, which are on the todo list.
- Teensy compilation and uploading using genuine Teensy Loader (all Teensy 3.x boards)
- AVR compilation and uploading (only pro mini supported yet, other boards will come)
Compilation and upload should work on all Arduino-supported platforms, but only macOS has been tested yet (defaults paths to Arduino resources on other platforms than macOS are still to be validated).
Upload will not work under Windows due to the current use of scripts, this is on the todo list.
Qt Creator Bare Metal Device plugin (activate it with the plugins manager)
Some steps are required in order to compile and upload successfully.
To do only once:
Got to Qt Creator Preferences > Compile & Execute > Compilers tab.
Then add custom GCC compilers (C then C++) from the Arduino package/install folder:
- For the Teensy 3:
C: <Path to Arduino App>/Java/hardware/tools/arm/bin/arm-none-eabi-gcc
C++: <Path to Arduino App>/Java/hardware/tools/arm/bin/arm-none-eabi-g++
- For AVR:
C: <Path to Arduino App>/Java/hardware/tools/avr/bin/avr-gcc
C++: <Path to Arduino App>/Java/hardware/tools/avr/bin/avr-g++
- Name: AVR or Teensy,
- Peripheral: Bare Metal Device,
- Compiler: AVR or Teensy you set before,
- Debugger: None
- Qt Version: None
For each project you add:
Download the repo, it is the base project. Rename the folder to your convenience, as well as the ArduinoQbs.qbs
file.
Only the qbs
folder is needed, folders qtcreator
and templates
are future developments and are not needed for your project, you can delete them.
Open what was ArduinoQbs.qbs
in Qt Creator to add the project to your current session. In that file you need to change :
- the list of source files:
files
- the board name:
board
- (option) the frequency used (if needed, mainly for Teensy):
frequency
. If not set, the default value for the board is used. You should not set it for boards that uses a fixed frequency (like most AVR boards), or you may encounter some issues (wrong timings mainly) if it doesn't match the CPU frequency.
In the Projects Tab (on the left), Build & Run, add the toolchain for your project (Teensy or AVR) and remove the Qt Kit if needed (it's usually the default kit).
Edit the install directory as specified in ArduinoQbs.qbs
file under the "Build Configuration Guide" comment.
Add a custom executable configuration and set the fields as specified in ArduinoQbs.qbs
file under the "Run Configuration" comment.
With that you will be able to hit "Run" to upload your code, using avrdude for AVR boards and Teensy Loader for Teensy boards.
Happy coding :)
Don't forget to set/change the compiler according to the board you selected. You might get some weird error/warning messages otherwise...
Still in beta version, everything could change without notice... I plan to integrate this project into QBS & QtCreator when possible (waiting for Windows support, mainly...).
--
- Test under Windows and Linux,
- Add all AVR boards,
- Qt Creator template for project wizard (in progress),
- Qt Creator plugin for missing features (board selector, serial console) (in progress)