QBS Install: run commands to program into mictrocontroller
-
I've managed to setup qbs to build my microcontroller project using avr-gcc and the desired flags, but now comes the deployment part of running avr-objcopy and avrdude (to upload it).
I tried using the custom build steps, but that's hard for two reasons:
- That config is saved in a .user file, and is generaly kept out of version control.
- There is a variable %{buildDir}, but the actual files are stored in a semi-random dir named %{buildDir}/qtc_AVR_GCC_2bcb96b3-debug. Putting that in the build steps is not portable.
Currently, my qbs test project is this:
CppApplication { type: "application" // To suppress bundle generation on Mac consoleApplication: true cpp.architecture: "attiny85" // Does nothing, but I had to set it cpp.optimization: "small" cpp.cFlags: ["-mmcu=attiny85", "-fpack-struct", "-fshort-enums", "-funsigned-bitfields", "-funsigned-char", "-Wstrict-prototypes"] files: [ "main.c", "piet.c", ] Group { // Properties for the produced executable fileTagsFilter: product.type qbs.install: false } }
I looked through the reference documentation, but I can't seem to define install commands. I need it to run:
avr-objcopy -j .text -j .data -O ihex MainsBuffer.out MainsBuffer.hex avr-objcopy -j .eeprom --change-section-lma .eeprom=0 -O ihex MainsBuffer.out MainsBuffer.ee.hex avrdude -c avrispmkii -p attiny85 -P usb -e -U flash:w:MainsBuffer.hex
Does qbs provide scripting/variables to define this in the .qbs file? I can't seem to find anything. The only thing I can seem to find, is related to installing in a directory or starting the built executable directly. I don't even seem to have access to the output ELF filename in a variable?