Have Qt Creator automatically generate makefiles for my avr-gcc project
-
I'd like to develop my Atmel microcontroller project using QtCreator. I don't need a lot, just that it automatically builds all *.c files with avr-gcc, does a make clean, links, etc. To that end, I'd like it to generate a make file, like it does with qmake for a Qt project, that compiles and links my (currently) 4 .c files like this:
avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=main.lst -c main.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=devices.lst -c devices.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=adc.lst -c adc.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=settingsmemory.lst -c settingsmemory.c avr-gcc -Wl,-Map,MainsBuffer.out.map -mmcu=attiny85 -lm -o MainsBuffer.out main.o devices.o adc.o settingsmemory.o
I'd also like QtCreator be aware of the include path containing all the libc-avr .h files, for autocomplete.
How do I do this? Creating a .pro file and then using qmake generates a hugely complicated makefile containg all kinds of Qt stuff, and I have no idea how to make it run the avr-gcc commands above. Creating a general project (with a .files, .creator, .includes and .config file) can't seem to generate makefiles, or otherwise have the ability to automatically build all files listen in project.files.
Isn't there just a way to define a template and then say 'foreach source_files, do stuff'?
-
That thread is missing one vital bit of information, and that is how to have Qt Creator compile each .c file automatically (with a specified kit). It should be a very simple thing to just compile each source file with a specified command or compiler/kit, giving it project specific command line options. But I can't seem to figure it out.
I'm trying QBS now, but I'm having a hard time understanding it. For one, my Qt Creator is missing the QBS settings in tools->options (edit: I just had to upgrade it). I was hoping I could use Qbs with an AVR-GCC kit to do what I need.
-
You could also try getting started with a non Qt qmake project. What version of Qt creator are you running ?
-
I'd like to develop my Atmel microcontroller project using QtCreator. I don't need a lot, just that it automatically builds all *.c files with avr-gcc, does a make clean, links, etc. To that end, I'd like it to generate a make file, like it does with qmake for a Qt project, that compiles and links my (currently) 4 .c files like this:
avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=main.lst -c main.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=devices.lst -c devices.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=adc.lst -c adc.c avr-gcc -I. -g -mmcu=attiny85 -Os -fpack-struct -fshort-enums -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -Wa,-ahlms=settingsmemory.lst -c settingsmemory.c avr-gcc -Wl,-Map,MainsBuffer.out.map -mmcu=attiny85 -lm -o MainsBuffer.out main.o devices.o adc.o settingsmemory.o
I'd also like QtCreator be aware of the include path containing all the libc-avr .h files, for autocomplete.
How do I do this? Creating a .pro file and then using qmake generates a hugely complicated makefile containg all kinds of Qt stuff, and I have no idea how to make it run the avr-gcc commands above. Creating a general project (with a .files, .creator, .includes and .config file) can't seem to generate makefiles, or otherwise have the ability to automatically build all files listen in project.files.
Isn't there just a way to define a template and then say 'foreach source_files, do stuff'?
@halfgaar Can you please post your hardware details here? What controller and kit you are using and what are their specifications?
Also what are the other hardware components?
Also what about your QTcreator? which one you are using?