1

I want to disassembler file was created after every build. This command will do this:

arm-none-eabi-objcopy -DS project.elf > project.dasm

How to execute it with qbs? Tried to do a rule for it.

Rule {
    id: dasm
    inputs: "application"
    Artifact {
        fileTags: ["dasm"]
        filePath: FileInfo.baseName(input.filePath) + ".dasm"
    }
    prepare: {
        var args = ["-DS", input.filePath, ">", output.filePath];
        var cmd = new Command("arm-none-eabi-objdump", args);
        cmd.description = "disassembler from: "+FileInfo.fileName(input.filePath);
        cmd.highlight = "linker";
        cmd.silent = true;
        return cmd;

    }
}

But this just shows result in build console and displays errors on the last two arguments. Any ideas?

Jake Petroules
  • 23,472
  • 35
  • 144
  • 225
bkolbov
  • 11
  • 3

2 Answers2

0

I don't think you can use output piping in a qbs. These (>,>>,|) won't work because Command isn't a bash shell. Command is passing > as an argument to arm-none-eabi-objcopy. You probably want to create a shell script like this:

myShellScript.sh

#!/bin/bash
arm-none-eabi-objcopy -DS $1 > $2

Then in your rule just call the shell script.

Rule {
    id: dasm
    inputs: "application"
    Artifact {
        fileTags: ["dasm"]
        filePath: FileInfo.baseName(input.filePath) + ".dasm"
    }
    prepare: {
        var args = [input.filePath, output.filePath];
        var cmd = new Command("myShellScript.sh", args);
        cmd.description = "disassembler from: "+FileInfo.fileName(input.filePath);
        cmd.highlight = "linker";
        cmd.silent = true;
        return cmd;
        }
    }
}
vpicaver
  • 1,771
  • 1
  • 15
  • 16
0

In Qbs 1.5.0 you can redirect command outputs to files using the new stdoutFilePath and stderrFilePath properties on the Command object.

For example:

Rule {
    id: dasm
    inputs: ["application"]
    Artifact {
        fileTags: ["dasm"]
        filePath: input.baseName + ".dasm"
    }
    prepare: {
        var args = ["-DS", input.filePath];
        var cmd = new Command("arm-none-eabi-objdump", args);
        cmd.description = "disassembling " + input.fileName;
        cmd.stdoutFilePath = output.filePath;
        cmd.highlight = "linker";
        cmd.silent = true;
        return cmd;
    }
}
Jake Petroules
  • 23,472
  • 35
  • 144
  • 225