Пт фев 17, 2017 14:09:22
Сб фев 18, 2017 07:57:28
import qbs
Project {
name: "simple"
Product {
name: "micro"
type: "hex"
Group {
name: "sources"
files: ["*.c", "*.h", "*.S"]
fileTags: ['c']
}
Rule {
inputs: ["c"]
Artifact {
fileTags: ['obj']
filePath: input.fileName + '.o'
}
prepare: {
var args = [];
args.push("-mcpu=cortex-m3")
args.push("-mthumb")
args.push("-g")
args.push("-ffunction-sections")
args.push("-O0")
args.push("-Wall")
args.push("-Wunused")
args.push("-DM3")
args.push('-c');
args.push(input.filePath);
args.push('-o');
args.push(output.filePath);
var compilerPath = "c:/development/gcc-arm/bin/arm-none-eabi-gcc.exe"
var cmd = new Command(compilerPath, args);
cmd.description = 'compiling ' + input.fileName;
cmd.highlight = 'compiler';
cmd.silent = false;
return cmd;
}
}
Rule{
multiplex: true
inputs: ['obj']
Artifact{
fileTags:['elf']
filePath: project.name + '.elf'
}
prepare:{
var args = []
args.push("-mcpu=cortex-m3")
args.push("-mthumb")
args.push("-g")
args.push("-nostartfiles")
args.push("-O0")
args.push("-Wl,--gc-sections")
for(i in inputs['obj'])
args.push(inputs["obj"][i].filePath);
args.push("-Td:/work/workspace/uc/qbs_c/stm32f10x_flash.ld")
args.push('-o');
args.push(output.filePath);
var compilerPath = "c:/development/gcc-arm/bin/arm-none-eabi-gcc.exe"
var cmd = new Command(compilerPath,args);
cmd.description = "linking"+project.name
return cmd;
}
}
Rule{
inputs: ['elf']
Artifact{
fileTags:['hex']
filePath: project.name + '.hex'
}
prepare:{
var args = []
args.push("-O")
args.push("ihex")
args.push(input.filePath)
args.push(output.filePath)
var hexcreator = "c:/development/gcc-arm/bin/arm-none-eabi-objcopy.exe"
var cmd = new Command(hexcreator,args);
cmd.description = 'create_hex'+project.name
return cmd;
}
}
}
}
Сб фев 18, 2017 17:29:52
Сб фев 18, 2017 18:49:47
Чт фев 23, 2017 22:05:04
import qbs
Project
{
name: "stm32"
Product
{
type: ["hex", "bin"]
property string c_compilerPath: "c:/development/gcc-arm/bin/arm-none-eabi-gcc.exe"
property string cpp_compilerPath: "c:/development/gcc-arm/bin/arm-none-eabi-g++.exe"
property string asm_compilerPath: "c:/development/gcc-arm/bin/arm-none-eabi-as.exe"
property string linkerPath: "c:/development/gcc-arm/bin/arm-none-eabi-ld.exe"
property string objcpyPath: "c:/development/gcc-arm/bin/arm-none-eabi-objcopy.exe"
Group
{
name: "source_cpp"
prefix: "./"
files: ["*.cpp"]
fileTags: ["cpp"]
}
Group
{
name: "source_c"
prefix: "./"
files: ["*.c"]
fileTags: ["c"]
}
Group
{
name: "source_asm"
prefix: "./"
files: ["*.s"]
fileTags: ["asm"]
}
Rule
{
inputs: ["cpp"]
Artifact
{
filePath: project.path + "/.obj/" + input.fileName + ".o"
fileTags: ["obj"]
}
prepare:
{
var args = [];
args.push("-mcpu=cortex-m3");
args.push("-mthumb");
args.push("-O0");
args.push("--specs=nosys.specs");
args.push("-finline-functions");
args.push("-ffunction-sections");
args.push("-fdata-sections");
args.push("-fno-exceptions");
args.push("-fno-unwind-tables");
args.push("-fno-asynchronous-unwind-tables");
args.push("-c");
args.push("-DSTM32F10X_LD_VL");
args.push(project.path + "/" + input.fileName);
args.push("-o");
args.push(project.path + "/.obj/" + output.fileName);
var cmd = new Command(product.cpp_compilerPath, args);
cmd.description = "compiling: " + input.fileName;
cmd.highlight = "compiler";
cmd.silent = false;
return cmd;
}
}
Rule
{
inputs: ["c"]
Artifact
{
filePath: project.path + "/.obj/" + input.fileName + ".o"
fileTags: ["obj"]
}
prepare:
{
var args = [];
args.push("-mcpu=cortex-m3");
args.push("-mthumb");
args.push("-O0");
args.push("--specs=nosys.specs");
args.push("-finline-functions");
args.push("-ffunction-sections");
args.push("-fdata-sections");
args.push("-fno-exceptions");
args.push("-fno-unwind-tables");
args.push("-fno-asynchronous-unwind-tables");
args.push("-c");
args.push("-DSTM32F10X_LD_VL");
args.push(project.path + "/" + input.fileName);
args.push("-o");
args.push(project.path + "/.obj/" + output.fileName);
var cmd = new Command(product.c_compilerPath, args);
cmd.description = "compiling: " + input.fileName;
cmd.highlight = "compiler";
cmd.silent = false;
return cmd;
}
}
Rule
{
inputs: ["asm"]
Artifact
{
filePath: project.path + "/.obj/" + input.fileName + ".o"
fileTags: ["obj"]
}
prepare:
{
var args = [];
args.push("-mcpu=cortex-m3");
args.push("-mthumb");
args.push("-c");
args.push(project.path + "/" + input.fileName);
args.push("-o");
args.push(project.path + "/.obj/" + output.fileName);
var cmd = new Command(product.asm_compilerPath, args);
cmd.description = "compiling: " + input.fileName;
cmd.highlight = "compiler";
cmd.silent = false;
return cmd;
}
}
Rule
{
multiplex: true
inputs: ["obj"]
Artifact
{
filePath: project.path + "/bin/" + project.name + ".elf";
fileTags: ["elf"]
}
prepare:
{
var args = [];
args.push("-mcpu=cortex-m3");
args.push("-mthumb");
args.push("--specs=nosys.specs");
args.push("-finline-functions");
args.push("-ffunction-sections");
args.push("-fdata-sections");
args.push("-nostartfiles");
args.push("-fno-exceptions");
args.push("-fno-unwind-tables");
args.push("-fno-asynchronous-unwind-tables");
args.push("-T" + project.path + "/" + "stm32f10x_flash.ld");
for(i in inputs["obj"])
args.push(inputs["obj"][i].filePath);
args.push("-o");
args.push(output.filePath);
var cmd = new Command(product.c_compilerPath, args);
cmd.description = "linking project: " + project.name;
cmd.highlight = "linker";
cmd.silent = false;
return cmd;
}
}
Rule
{
inputs: ["elf"]
Artifact
{
filePath: project.path + "/bin/" + project.name + ".hex";
fileTags: ["hex"]
}
prepare:
{
var args = [];
args.push("-O");
args.push("ihex");
args.push(input.filePath);
args.push(output.filePath);
var cmd = new Command(product.objcpyPath, args);
cmd.description = "convert to hex";
cmd.highlight = "codegen";
cmd.silent = false;
return cmd;
}
}
Rule
{
inputs: ["elf"]
Artifact
{
filePath: project.path + "/bin/" + project.name + ".bin";
fileTags: ["bin"]
}
prepare:
{
var args = [];
args.push("-O");
args.push("binary");
args.push(input.filePath);
args.push(output.filePath);
var cmd = new Command(product.objcpyPath, args);
cmd.description = "convert to bin";
cmd.highlight = "codegen";
cmd.silent = false;
return cmd;
}
}
}
}
Пт фев 24, 2017 08:38:58
Пт фев 24, 2017 12:05:15