├── .gitignore ├── template-stm32f0 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2-1.cfg │ └── openocd-stlink-v2.cfg ├── qbs │ ├── utils.js │ └── stm32f0.qbs └── template-stm32f0.qbs ├── template-stm32f1 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg ├── qbs │ ├── utils.js │ └── stm32f1.qbs └── template-stm32f1.qbs ├── template-stm32f2 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg ├── qbs │ ├── utils.js │ └── stm32f2.qbs └── template-stm32f2.qbs ├── template-stm32f3 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32f3.qbs ├── template-stm32f4 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32f4.qbs ├── template-stm32f7 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32f7.qbs ├── template-stm32h7 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ ├── openocd-stlink-v2-1.cfg │ ├── openocd-dualbank-stlink-v2.cfg │ └── openocd-dualbank-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32h7.qbs ├── template-stm32l0 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ ├── openocd-stlink-v2-1.cfg │ ├── openocd-dualbank-stlink-v2.cfg │ └── openocd-dualbank-stlink-v2-1.cfg ├── qbs │ ├── utils.js │ └── stm32l0.qbs └── template-stm32l0.qbs ├── template-stm32l1 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ ├── openocd-stlink-v2-1.cfg │ ├── openocd-dualbank-stlink-v2.cfg │ └── openocd-dualbank-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32l1.qbs ├── template-stm32l4 ├── bin │ ├── debug │ │ └── placeholder │ └── release │ │ └── placeholder ├── build │ └── placeholder ├── .gitignore ├── openocd │ ├── openocd-stlink-v2.cfg │ └── openocd-stlink-v2-1.cfg └── qbs │ ├── utils.js │ └── stm32l4.qbs ├── img ├── 01-plugins.png ├── 00-debugging.png ├── 05-debugger-gdb.png ├── 12-qbs-profiles.png ├── 03-devices-devices.png ├── 04-debugger-general.png ├── 06-debugger-gdb-ext.png ├── 02-devices-bare-metal.png ├── 10-build-and-run-kits.png ├── 11-build-and-run-general.png ├── 02-devices-bare-metal-pipe.png ├── 07-build-and-run-debuggers.png ├── 08-build-and-run-compilers-c.png └── 09-build-and-run-compilers-cpp.png ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /*.sh 2 | -------------------------------------------------------------------------------- /template-stm32f0/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f0/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f1/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f1/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f2/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f2/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f3/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f3/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f4/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f4/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f7/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f7/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32h7/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32h7/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l0/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l0/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l1/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l1/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l4/bin/debug/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l4/build/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f0/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f1/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f2/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f3/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f4/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32f7/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32h7/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l0/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l1/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template-stm32l4/bin/release/placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/01-plugins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/01-plugins.png -------------------------------------------------------------------------------- /img/00-debugging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/00-debugging.png -------------------------------------------------------------------------------- /img/05-debugger-gdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/05-debugger-gdb.png -------------------------------------------------------------------------------- /img/12-qbs-profiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/12-qbs-profiles.png -------------------------------------------------------------------------------- /img/03-devices-devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/03-devices-devices.png -------------------------------------------------------------------------------- /img/04-debugger-general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/04-debugger-general.png -------------------------------------------------------------------------------- /img/06-debugger-gdb-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/06-debugger-gdb-ext.png -------------------------------------------------------------------------------- /img/02-devices-bare-metal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/02-devices-bare-metal.png -------------------------------------------------------------------------------- /img/10-build-and-run-kits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/10-build-and-run-kits.png -------------------------------------------------------------------------------- /img/11-build-and-run-general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/11-build-and-run-general.png -------------------------------------------------------------------------------- /img/02-devices-bare-metal-pipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/02-devices-bare-metal-pipe.png -------------------------------------------------------------------------------- /img/07-build-and-run-debuggers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/07-build-and-run-debuggers.png -------------------------------------------------------------------------------- /img/08-build-and-run-compilers-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/08-build-and-run-compilers-c.png -------------------------------------------------------------------------------- /img/09-build-and-run-compilers-cpp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xebef/qube/HEAD/img/09-build-and-run-compilers-cpp.png -------------------------------------------------------------------------------- /template-stm32f0/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f1/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f2/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f3/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f4/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f7/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32h7/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32l0/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32l1/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32l4/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/release/*.bin 2 | /bin/release/*.elf 3 | /bin/release/*.hex 4 | /bin/release/*.lst 5 | /bin/release/*.map 6 | /bin/debug/*.bin 7 | /bin/debug/*.elf 8 | /bin/debug/*.hex 9 | /bin/debug/*.lst 10 | /bin/debug/*.map 11 | /build/build* 12 | /build/qtc* 13 | /*.qbs.user 14 | -------------------------------------------------------------------------------- /template-stm32f1/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f1x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f2/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f2x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f3/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f3x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f4/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f4x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f7/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f7x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32h7/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32h7x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l0/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l0.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l1/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l1.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l4/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l4x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f0/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f0x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f0/openocd/openocd-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f0x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f1/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f1x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f2/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f2x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f3/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f3x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f4/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f4x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f7/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32f7x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32h7/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32h7x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l0/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l0.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l1/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l1.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l4/openocd/openocd-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l4x.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32h7/openocd/openocd-dualbank-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32h7x_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l0/openocd/openocd-dualbank-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l0_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l1/openocd/openocd-dualbank-stlink-v2.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l1x_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32h7/openocd/openocd-dualbank-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32h7x_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l0/openocd/openocd-dualbank-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l0_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32l1/openocd/openocd-dualbank-stlink-v2-1.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/stlink-v2-1.cfg] 2 | 3 | transport select hla_swd 4 | 5 | source [find target/stm32l1x_dual_bank.cfg] 6 | 7 | $_TARGETNAME configure -event gdb-attach { 8 | reset halt 9 | } 10 | 11 | reset_config srst_only srst_nogate connect_assert_srst 12 | -------------------------------------------------------------------------------- /template-stm32f0/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32f1/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32f2/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32f3/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32f4/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32f7/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32h7/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32l0/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32l1/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /template-stm32l4/qbs/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | function generate_build_path(filename) { 10 | var build_type_index = filename.toLowerCase().indexOf('-debug'); 11 | var build_type = ''; 12 | 13 | if (build_type_index >= 0) { 14 | build_type = 'debug'; 15 | } else { 16 | build_type_index = filename.toLowerCase().indexOf('-release'); 17 | build_type = 'release'; 18 | } 19 | 20 | if (build_type_index >= 0) { 21 | return '../../../../bin/' + build_type; 22 | } 23 | 24 | return '/tmp/'; 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2018 0xebef, https://github.com/0xebef 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /template-stm32f0/qbs/stm32f0.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F0 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m0") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | driverFlags.push("-mfloat-abi=soft") 49 | 50 | if (project.lto) { 51 | driverFlags.push("-flto") 52 | } 53 | 54 | driverFlags.push("-fstack-usage") 55 | driverFlags.push("-ffunction-sections") 56 | driverFlags.push("-fdata-sections") 57 | driverFlags.push("-fno-strict-aliasing") 58 | 59 | if (project.libc) { 60 | if (project.libc_nano) { 61 | driverFlags.push("--specs=nano.specs") 62 | } 63 | 64 | if (project.libc_sys === "semihosting") { 65 | driverFlags.push("--specs=rdimon.specs") 66 | } else if (project.libc_sys === "nosys") { 67 | driverFlags.push("--specs=nosys.specs") 68 | } 69 | 70 | if (project.libc_printf_float) { 71 | driverFlags.push("-u_printf_float") 72 | } 73 | 74 | if (project.libc_scanf_float) { 75 | driverFlags.push("-u_scanf_float") 76 | } 77 | } 78 | 79 | return driverFlags 80 | } 81 | 82 | cpp.commonCompilerFlags: { 83 | var compilerFlags = base 84 | 85 | compilerFlags.push("-Wformat") 86 | compilerFlags.push("-Wformat-security") 87 | compilerFlags.push("-Wno-unused-function") 88 | compilerFlags.push("-Wno-unused-but-set-variable") 89 | compilerFlags.push("-Wundef") 90 | 91 | return compilerFlags 92 | } 93 | 94 | cpp.linkerFlags: { 95 | var linkerFlags = base 96 | 97 | linkerFlags.push("-Map") 98 | linkerFlags.push(outPath + "/" + targetFile + ".map") 99 | linkerFlags.push("--cref") 100 | linkerFlags.push("--gc-sections") 101 | linkerFlags.push("--no-wchar-size-warning") 102 | 103 | return linkerFlags 104 | } 105 | 106 | cpp.debugInformation: true 107 | cpp.optimization: project.optimize_small ? "small" : "none" 108 | } 109 | 110 | Properties { 111 | condition: qbs.buildVariant === "release" 112 | 113 | cpp.defines: { 114 | var defines = base 115 | 116 | if (project.full_assert) { 117 | defines.push("USE_FULL_ASSERT") 118 | } 119 | 120 | return defines 121 | } 122 | 123 | cpp.driverFlags: { 124 | var driverFlags = base 125 | 126 | driverFlags.push("-mcpu=cortex-m0") 127 | driverFlags.push("-mthumb") 128 | driverFlags.push("-mlittle-endian") 129 | driverFlags.push("-mfloat-abi=soft") 130 | 131 | if (project.lto) { 132 | driverFlags.push("-flto") 133 | } 134 | 135 | driverFlags.push("-fstack-usage") 136 | driverFlags.push("-ffunction-sections") 137 | driverFlags.push("-fdata-sections") 138 | driverFlags.push("-fno-strict-aliasing") 139 | 140 | if (project.libc) { 141 | if (project.libc_nano) { 142 | driverFlags.push("--specs=nano.specs") 143 | } 144 | 145 | if (project.libc_sys === "semihosting") { 146 | driverFlags.push("--specs=rdimon.specs") 147 | } else if (project.libc_sys === "nosys") { 148 | driverFlags.push("--specs=nosys.specs") 149 | } 150 | 151 | if (project.libc_printf_float) { 152 | driverFlags.push("-u_printf_float") 153 | } 154 | 155 | if (project.libc_scanf_float) { 156 | driverFlags.push("-u_scanf_float") 157 | } 158 | } 159 | 160 | return driverFlags 161 | } 162 | 163 | cpp.commonCompilerFlags: { 164 | var compilerFlags = base 165 | 166 | compilerFlags.push("-Wformat") 167 | compilerFlags.push("-Wformat-security") 168 | compilerFlags.push("-Wno-unused-function") 169 | compilerFlags.push("-Wno-unused-but-set-variable") 170 | compilerFlags.push("-Wundef") 171 | 172 | return compilerFlags 173 | } 174 | 175 | cpp.linkerFlags: { 176 | var linkerFlags = base 177 | 178 | linkerFlags.push("-Map") 179 | linkerFlags.push(outPath + "/" + targetFile + ".map") 180 | linkerFlags.push("--cref") 181 | linkerFlags.push("--gc-sections") 182 | linkerFlags.push("--no-wchar-size-warning") 183 | 184 | return linkerFlags 185 | } 186 | 187 | cpp.debugInformation: false 188 | cpp.optimization: project.optimize_small ? "small" : "fast" 189 | } 190 | 191 | Rule { 192 | id: elf 193 | inputs: ["application"] 194 | Artifact { 195 | fileTags: ["elf"] 196 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 197 | } 198 | prepare: { 199 | var cmd = new JavaScriptCommand() 200 | 201 | cmd.sourceCode = function() { 202 | File.copy(input.filePath, output.filePath) 203 | } 204 | cmd.description = "copying the \"elf\" file" 205 | cmd.highlight = "linker" 206 | 207 | return cmd 208 | } 209 | } 210 | 211 | Rule { 212 | id: bin 213 | inputs: ["application"] 214 | Artifact { 215 | fileTags: ["bin"] 216 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 217 | } 218 | prepare: { 219 | var args = ["-O", "binary", input.filePath, output.filePath] 220 | var cmd = new Command("arm-none-eabi-objcopy", args) 221 | 222 | cmd.description = "generating the \"binary\" file" 223 | cmd.highlight = "linker" 224 | 225 | return cmd 226 | } 227 | } 228 | 229 | Rule { 230 | id: hex 231 | inputs: ["application"] 232 | Artifact { 233 | fileTags: ["hex"] 234 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 235 | } 236 | prepare: { 237 | var args = ["-O", "ihex", input.filePath, output.filePath] 238 | var cmd = new Command("arm-none-eabi-objcopy", args) 239 | 240 | cmd.description = "generating the \"hex\" file" 241 | cmd.highlight = "linker" 242 | 243 | return cmd 244 | } 245 | } 246 | 247 | Rule { 248 | id: assembly 249 | inputs: ["application"] 250 | Artifact { 251 | fileTags: ["assembly"] 252 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 253 | } 254 | prepare: { 255 | var args = [input.filePath, "-D", "-S"] 256 | var cmd = new Command("arm-none-eabi-objdump", args) 257 | 258 | cmd.stdoutFilePath = output.filePath 259 | cmd.description = "generating the assembly listing" 260 | cmd.highlight = "codegen" 261 | 262 | return cmd 263 | } 264 | } 265 | 266 | Rule { 267 | id: size 268 | inputs: ["application"] 269 | Artifact { 270 | fileTags: ["size"] 271 | } 272 | prepare: { 273 | var args = [input.filePath] 274 | var cmd = new Command("arm-none-eabi-size", args) 275 | 276 | cmd.description = "generating the size statistics" 277 | cmd.highlight = "linker" 278 | 279 | return cmd 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /template-stm32f1/qbs/stm32f1.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F1 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m3") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | driverFlags.push("-mfloat-abi=soft") 49 | 50 | if (project.lto) { 51 | driverFlags.push("-flto") 52 | } 53 | 54 | driverFlags.push("-fstack-usage") 55 | driverFlags.push("-ffunction-sections") 56 | driverFlags.push("-fdata-sections") 57 | driverFlags.push("-fno-strict-aliasing") 58 | 59 | if (project.libc) { 60 | if (project.libc_nano) { 61 | driverFlags.push("--specs=nano.specs") 62 | } 63 | 64 | if (project.libc_sys === "semihosting") { 65 | driverFlags.push("--specs=rdimon.specs") 66 | } else if (project.libc_sys === "nosys") { 67 | driverFlags.push("--specs=nosys.specs") 68 | } 69 | 70 | if (project.libc_printf_float) { 71 | driverFlags.push("-u_printf_float") 72 | } 73 | 74 | if (project.libc_scanf_float) { 75 | driverFlags.push("-u_scanf_float") 76 | } 77 | } 78 | 79 | return driverFlags 80 | } 81 | 82 | cpp.commonCompilerFlags: { 83 | var compilerFlags = base 84 | 85 | compilerFlags.push("-Wformat") 86 | compilerFlags.push("-Wformat-security") 87 | compilerFlags.push("-Wno-unused-function") 88 | compilerFlags.push("-Wno-unused-but-set-variable") 89 | compilerFlags.push("-Wundef") 90 | 91 | return compilerFlags 92 | } 93 | 94 | cpp.linkerFlags: { 95 | var linkerFlags = base 96 | 97 | linkerFlags.push("-Map") 98 | linkerFlags.push(outPath + "/" + targetFile + ".map") 99 | linkerFlags.push("--cref") 100 | linkerFlags.push("--gc-sections") 101 | linkerFlags.push("--no-wchar-size-warning") 102 | 103 | return linkerFlags 104 | } 105 | 106 | cpp.debugInformation: true 107 | cpp.optimization: project.optimize_small ? "small" : "none" 108 | } 109 | 110 | Properties { 111 | condition: qbs.buildVariant === "release" 112 | 113 | cpp.defines: { 114 | var defines = base 115 | 116 | if (project.full_assert) { 117 | defines.push("USE_FULL_ASSERT") 118 | } 119 | 120 | return defines 121 | } 122 | 123 | cpp.driverFlags: { 124 | var driverFlags = base 125 | 126 | driverFlags.push("-mcpu=cortex-m3") 127 | driverFlags.push("-mthumb") 128 | driverFlags.push("-mlittle-endian") 129 | driverFlags.push("-mfloat-abi=soft") 130 | 131 | if (project.lto) { 132 | driverFlags.push("-flto") 133 | } 134 | 135 | driverFlags.push("-fstack-usage") 136 | driverFlags.push("-ffunction-sections") 137 | driverFlags.push("-fdata-sections") 138 | driverFlags.push("-fno-strict-aliasing") 139 | 140 | if (project.libc) { 141 | if (project.libc_nano) { 142 | driverFlags.push("--specs=nano.specs") 143 | } 144 | 145 | if (project.libc_sys === "semihosting") { 146 | driverFlags.push("--specs=rdimon.specs") 147 | } else if (project.libc_sys === "nosys") { 148 | driverFlags.push("--specs=nosys.specs") 149 | } 150 | 151 | if (project.libc_printf_float) { 152 | driverFlags.push("-u_printf_float") 153 | } 154 | 155 | if (project.libc_scanf_float) { 156 | driverFlags.push("-u_scanf_float") 157 | } 158 | } 159 | 160 | return driverFlags 161 | } 162 | 163 | cpp.commonCompilerFlags: { 164 | var compilerFlags = base 165 | 166 | compilerFlags.push("-Wformat") 167 | compilerFlags.push("-Wformat-security") 168 | compilerFlags.push("-Wno-unused-function") 169 | compilerFlags.push("-Wno-unused-but-set-variable") 170 | compilerFlags.push("-Wundef") 171 | 172 | return compilerFlags 173 | } 174 | 175 | cpp.linkerFlags: { 176 | var linkerFlags = base 177 | 178 | linkerFlags.push("-Map") 179 | linkerFlags.push(outPath + "/" + targetFile + ".map") 180 | linkerFlags.push("--cref") 181 | linkerFlags.push("--gc-sections") 182 | linkerFlags.push("--no-wchar-size-warning") 183 | 184 | return linkerFlags 185 | } 186 | 187 | cpp.debugInformation: false 188 | cpp.optimization: project.optimize_small ? "small" : "fast" 189 | } 190 | 191 | Rule { 192 | id: elf 193 | inputs: ["application"] 194 | Artifact { 195 | fileTags: ["elf"] 196 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 197 | } 198 | prepare: { 199 | var cmd = new JavaScriptCommand() 200 | 201 | cmd.sourceCode = function() { 202 | File.copy(input.filePath, output.filePath) 203 | } 204 | cmd.description = "copying the \"elf\" file" 205 | cmd.highlight = "linker" 206 | 207 | return cmd 208 | } 209 | } 210 | 211 | Rule { 212 | id: bin 213 | inputs: ["application"] 214 | Artifact { 215 | fileTags: ["bin"] 216 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 217 | } 218 | prepare: { 219 | var args = ["-O", "binary", input.filePath, output.filePath] 220 | var cmd = new Command("arm-none-eabi-objcopy", args) 221 | 222 | cmd.description = "generating the \"binary\" file" 223 | cmd.highlight = "linker" 224 | 225 | return cmd 226 | } 227 | } 228 | 229 | Rule { 230 | id: hex 231 | inputs: ["application"] 232 | Artifact { 233 | fileTags: ["hex"] 234 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 235 | } 236 | prepare: { 237 | var args = ["-O", "ihex", input.filePath, output.filePath] 238 | var cmd = new Command("arm-none-eabi-objcopy", args) 239 | 240 | cmd.description = "generating the \"hex\" file" 241 | cmd.highlight = "linker" 242 | 243 | return cmd 244 | } 245 | } 246 | 247 | Rule { 248 | id: assembly 249 | inputs: ["application"] 250 | Artifact { 251 | fileTags: ["assembly"] 252 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 253 | } 254 | prepare: { 255 | var args = [input.filePath, "-D", "-S"] 256 | var cmd = new Command("arm-none-eabi-objdump", args) 257 | 258 | cmd.stdoutFilePath = output.filePath 259 | cmd.description = "generating the assembly listing" 260 | cmd.highlight = "codegen" 261 | 262 | return cmd 263 | } 264 | } 265 | 266 | Rule { 267 | id: size 268 | inputs: ["application"] 269 | Artifact { 270 | fileTags: ["size"] 271 | } 272 | prepare: { 273 | var args = [input.filePath] 274 | var cmd = new Command("arm-none-eabi-size", args) 275 | 276 | cmd.description = "generating the size statistics" 277 | cmd.highlight = "linker" 278 | 279 | return cmd 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /template-stm32f2/qbs/stm32f2.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F2 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m3") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | driverFlags.push("-mfloat-abi=soft") 49 | 50 | if (project.lto) { 51 | driverFlags.push("-flto") 52 | } 53 | 54 | driverFlags.push("-fstack-usage") 55 | driverFlags.push("-ffunction-sections") 56 | driverFlags.push("-fdata-sections") 57 | driverFlags.push("-fno-strict-aliasing") 58 | 59 | if (project.libc) { 60 | if (project.libc_nano) { 61 | driverFlags.push("--specs=nano.specs") 62 | } 63 | 64 | if (project.libc_sys === "semihosting") { 65 | driverFlags.push("--specs=rdimon.specs") 66 | } else if (project.libc_sys === "nosys") { 67 | driverFlags.push("--specs=nosys.specs") 68 | } 69 | 70 | if (project.libc_printf_float) { 71 | driverFlags.push("-u_printf_float") 72 | } 73 | 74 | if (project.libc_scanf_float) { 75 | driverFlags.push("-u_scanf_float") 76 | } 77 | } 78 | 79 | return driverFlags 80 | } 81 | 82 | cpp.commonCompilerFlags: { 83 | var compilerFlags = base 84 | 85 | compilerFlags.push("-Wformat") 86 | compilerFlags.push("-Wformat-security") 87 | compilerFlags.push("-Wno-unused-function") 88 | compilerFlags.push("-Wno-unused-but-set-variable") 89 | compilerFlags.push("-Wundef") 90 | 91 | return compilerFlags 92 | } 93 | 94 | cpp.linkerFlags: { 95 | var linkerFlags = base 96 | 97 | linkerFlags.push("-Map") 98 | linkerFlags.push(outPath + "/" + targetFile + ".map") 99 | linkerFlags.push("--cref") 100 | linkerFlags.push("--gc-sections") 101 | linkerFlags.push("--no-wchar-size-warning") 102 | 103 | return linkerFlags 104 | } 105 | 106 | cpp.debugInformation: true 107 | cpp.optimization: project.optimize_small ? "small" : "none" 108 | } 109 | 110 | Properties { 111 | condition: qbs.buildVariant === "release" 112 | 113 | cpp.defines: { 114 | var defines = base 115 | 116 | if (project.full_assert) { 117 | defines.push("USE_FULL_ASSERT") 118 | } 119 | 120 | return defines 121 | } 122 | 123 | cpp.driverFlags: { 124 | var driverFlags = base 125 | 126 | driverFlags.push("-mcpu=cortex-m3") 127 | driverFlags.push("-mthumb") 128 | driverFlags.push("-mlittle-endian") 129 | driverFlags.push("-mfloat-abi=soft") 130 | 131 | if (project.lto) { 132 | driverFlags.push("-flto") 133 | } 134 | 135 | driverFlags.push("-fstack-usage") 136 | driverFlags.push("-ffunction-sections") 137 | driverFlags.push("-fdata-sections") 138 | driverFlags.push("-fno-strict-aliasing") 139 | 140 | if (project.libc) { 141 | if (project.libc_nano) { 142 | driverFlags.push("--specs=nano.specs") 143 | } 144 | 145 | if (project.libc_sys === "semihosting") { 146 | driverFlags.push("--specs=rdimon.specs") 147 | } else if (project.libc_sys === "nosys") { 148 | driverFlags.push("--specs=nosys.specs") 149 | } 150 | 151 | if (project.libc_printf_float) { 152 | driverFlags.push("-u_printf_float") 153 | } 154 | 155 | if (project.libc_scanf_float) { 156 | driverFlags.push("-u_scanf_float") 157 | } 158 | } 159 | 160 | return driverFlags 161 | } 162 | 163 | cpp.commonCompilerFlags: { 164 | var compilerFlags = base 165 | 166 | compilerFlags.push("-Wformat") 167 | compilerFlags.push("-Wformat-security") 168 | compilerFlags.push("-Wno-unused-function") 169 | compilerFlags.push("-Wno-unused-but-set-variable") 170 | compilerFlags.push("-Wundef") 171 | 172 | return compilerFlags 173 | } 174 | 175 | cpp.linkerFlags: { 176 | var linkerFlags = base 177 | 178 | linkerFlags.push("-Map") 179 | linkerFlags.push(outPath + "/" + targetFile + ".map") 180 | linkerFlags.push("--cref") 181 | linkerFlags.push("--gc-sections") 182 | linkerFlags.push("--no-wchar-size-warning") 183 | 184 | return linkerFlags 185 | } 186 | 187 | cpp.debugInformation: false 188 | cpp.optimization: project.optimize_small ? "small" : "fast" 189 | } 190 | 191 | Rule { 192 | id: elf 193 | inputs: ["application"] 194 | Artifact { 195 | fileTags: ["elf"] 196 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 197 | } 198 | prepare: { 199 | var cmd = new JavaScriptCommand() 200 | 201 | cmd.sourceCode = function() { 202 | File.copy(input.filePath, output.filePath) 203 | } 204 | cmd.description = "copying the \"elf\" file" 205 | cmd.highlight = "linker" 206 | 207 | return cmd 208 | } 209 | } 210 | 211 | Rule { 212 | id: bin 213 | inputs: ["application"] 214 | Artifact { 215 | fileTags: ["bin"] 216 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 217 | } 218 | prepare: { 219 | var args = ["-O", "binary", input.filePath, output.filePath] 220 | var cmd = new Command("arm-none-eabi-objcopy", args) 221 | 222 | cmd.description = "generating the \"binary\" file" 223 | cmd.highlight = "linker" 224 | 225 | return cmd 226 | } 227 | } 228 | 229 | Rule { 230 | id: hex 231 | inputs: ["application"] 232 | Artifact { 233 | fileTags: ["hex"] 234 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 235 | } 236 | prepare: { 237 | var args = ["-O", "ihex", input.filePath, output.filePath] 238 | var cmd = new Command("arm-none-eabi-objcopy", args) 239 | 240 | cmd.description = "generating the \"hex\" file" 241 | cmd.highlight = "linker" 242 | 243 | return cmd 244 | } 245 | } 246 | 247 | Rule { 248 | id: assembly 249 | inputs: ["application"] 250 | Artifact { 251 | fileTags: ["assembly"] 252 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 253 | } 254 | prepare: { 255 | var args = [input.filePath, "-D", "-S"] 256 | var cmd = new Command("arm-none-eabi-objdump", args) 257 | 258 | cmd.stdoutFilePath = output.filePath 259 | cmd.description = "generating the assembly listing" 260 | cmd.highlight = "codegen" 261 | 262 | return cmd 263 | } 264 | } 265 | 266 | Rule { 267 | id: size 268 | inputs: ["application"] 269 | Artifact { 270 | fileTags: ["size"] 271 | } 272 | prepare: { 273 | var args = [input.filePath] 274 | var cmd = new Command("arm-none-eabi-size", args) 275 | 276 | cmd.description = "generating the size statistics" 277 | cmd.highlight = "linker" 278 | 279 | return cmd 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /template-stm32l0/qbs/stm32l0.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32L0 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m0plus") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | driverFlags.push("-mfloat-abi=soft") 49 | 50 | if (project.lto) { 51 | driverFlags.push("-flto") 52 | } 53 | 54 | driverFlags.push("-fstack-usage") 55 | driverFlags.push("-ffunction-sections") 56 | driverFlags.push("-fdata-sections") 57 | driverFlags.push("-fno-strict-aliasing") 58 | 59 | if (project.libc) { 60 | if (project.libc_nano) { 61 | driverFlags.push("--specs=nano.specs") 62 | } 63 | 64 | if (project.libc_sys === "semihosting") { 65 | driverFlags.push("--specs=rdimon.specs") 66 | } else if (project.libc_sys === "nosys") { 67 | driverFlags.push("--specs=nosys.specs") 68 | } 69 | 70 | if (project.libc_printf_float) { 71 | driverFlags.push("-u_printf_float") 72 | } 73 | 74 | if (project.libc_scanf_float) { 75 | driverFlags.push("-u_scanf_float") 76 | } 77 | } 78 | return driverFlags 79 | } 80 | 81 | cpp.commonCompilerFlags: { 82 | var compilerFlags = base 83 | 84 | compilerFlags.push("-Wformat") 85 | compilerFlags.push("-Wformat-security") 86 | compilerFlags.push("-Wno-unused-function") 87 | compilerFlags.push("-Wno-unused-but-set-variable") 88 | compilerFlags.push("-Wundef") 89 | 90 | return compilerFlags 91 | } 92 | 93 | cpp.linkerFlags: { 94 | var linkerFlags = base 95 | 96 | linkerFlags.push("-Map") 97 | linkerFlags.push(outPath + "/" + targetFile + ".map") 98 | linkerFlags.push("--cref") 99 | linkerFlags.push("--gc-sections") 100 | linkerFlags.push("--no-wchar-size-warning") 101 | 102 | return linkerFlags 103 | } 104 | 105 | cpp.debugInformation: true 106 | cpp.optimization: project.optimize_small ? "small" : "none" 107 | } 108 | 109 | Properties { 110 | condition: qbs.buildVariant === "release" 111 | 112 | cpp.defines: { 113 | var defines = base 114 | 115 | if (project.full_assert) { 116 | defines.push("USE_FULL_ASSERT") 117 | } 118 | 119 | return defines 120 | } 121 | 122 | cpp.driverFlags: { 123 | var driverFlags = base 124 | 125 | driverFlags.push("-mcpu=cortex-m0plus") 126 | driverFlags.push("-mthumb") 127 | driverFlags.push("-mlittle-endian") 128 | driverFlags.push("-mfloat-abi=soft") 129 | 130 | if (project.lto) { 131 | driverFlags.push("-flto") 132 | } 133 | 134 | driverFlags.push("-fstack-usage") 135 | driverFlags.push("-ffunction-sections") 136 | driverFlags.push("-fdata-sections") 137 | driverFlags.push("-fno-strict-aliasing") 138 | 139 | if (project.libc) { 140 | if (project.libc_nano) { 141 | driverFlags.push("--specs=nano.specs") 142 | } 143 | 144 | if (project.libc_sys === "semihosting") { 145 | driverFlags.push("--specs=rdimon.specs") 146 | } else if (project.libc_sys === "nosys") { 147 | driverFlags.push("--specs=nosys.specs") 148 | } 149 | 150 | if (project.libc_printf_float) { 151 | driverFlags.push("-u_printf_float") 152 | } 153 | 154 | if (project.libc_scanf_float) { 155 | driverFlags.push("-u_scanf_float") 156 | } 157 | } 158 | 159 | return driverFlags 160 | } 161 | 162 | cpp.commonCompilerFlags: { 163 | var compilerFlags = base 164 | 165 | compilerFlags.push("-Wformat") 166 | compilerFlags.push("-Wformat-security") 167 | compilerFlags.push("-Wno-unused-function") 168 | compilerFlags.push("-Wno-unused-but-set-variable") 169 | compilerFlags.push("-Wundef") 170 | 171 | return compilerFlags 172 | } 173 | 174 | cpp.linkerFlags: { 175 | var linkerFlags = base 176 | 177 | linkerFlags.push("-Map") 178 | linkerFlags.push(outPath + "/" + targetFile + ".map") 179 | linkerFlags.push("--cref") 180 | linkerFlags.push("--gc-sections") 181 | linkerFlags.push("--no-wchar-size-warning") 182 | 183 | return linkerFlags 184 | } 185 | 186 | cpp.debugInformation: false 187 | cpp.optimization: project.optimize_small ? "small" : "fast" 188 | } 189 | 190 | Rule { 191 | id: elf 192 | inputs: ["application"] 193 | Artifact { 194 | fileTags: ["elf"] 195 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 196 | } 197 | prepare: { 198 | var cmd = new JavaScriptCommand() 199 | 200 | cmd.sourceCode = function() { 201 | File.copy(input.filePath, output.filePath) 202 | } 203 | cmd.description = "copying the \"elf\" file" 204 | cmd.highlight = "linker" 205 | 206 | return cmd 207 | } 208 | } 209 | 210 | Rule { 211 | id: bin 212 | inputs: ["application"] 213 | Artifact { 214 | fileTags: ["bin"] 215 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 216 | } 217 | prepare: { 218 | var args = ["-O", "binary", input.filePath, output.filePath] 219 | var cmd = new Command("arm-none-eabi-objcopy", args) 220 | 221 | cmd.description = "generating the \"binary\" file" 222 | cmd.highlight = "linker" 223 | 224 | return cmd 225 | } 226 | } 227 | 228 | Rule { 229 | id: hex 230 | inputs: ["application"] 231 | Artifact { 232 | fileTags: ["hex"] 233 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 234 | } 235 | prepare: { 236 | var args = ["-O", "ihex", input.filePath, output.filePath] 237 | var cmd = new Command("arm-none-eabi-objcopy", args) 238 | 239 | cmd.description = "generating the \"hex\" file" 240 | cmd.highlight = "linker" 241 | 242 | return cmd 243 | } 244 | } 245 | 246 | Rule { 247 | id: assembly 248 | inputs: ["application"] 249 | Artifact { 250 | fileTags: ["assembly"] 251 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 252 | } 253 | prepare: { 254 | var args = [input.filePath, "-D", "-S"] 255 | var cmd = new Command("arm-none-eabi-objdump", args) 256 | 257 | cmd.stdoutFilePath = output.filePath 258 | cmd.description = "generating the assembly listing" 259 | cmd.highlight = "codegen" 260 | 261 | return cmd 262 | } 263 | } 264 | 265 | Rule { 266 | id: size 267 | inputs: ["application"] 268 | Artifact { 269 | fileTags: ["size"] 270 | } 271 | prepare: { 272 | var args = [input.filePath] 273 | var cmd = new Command("arm-none-eabi-size", args) 274 | 275 | cmd.description = "generating the size statistics" 276 | cmd.highlight = "linker" 277 | 278 | return cmd 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /template-stm32l1/qbs/stm32l1.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32L1 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m3") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | driverFlags.push("-mfloat-abi=soft") 49 | 50 | if (project.lto) { 51 | driverFlags.push("-flto") 52 | } 53 | 54 | driverFlags.push("-fstack-usage") 55 | driverFlags.push("-ffunction-sections") 56 | driverFlags.push("-fdata-sections") 57 | driverFlags.push("-fno-strict-aliasing") 58 | 59 | if (project.libc) { 60 | if (project.libc_nano) { 61 | driverFlags.push("--specs=nano.specs") 62 | } 63 | 64 | if (project.libc_sys === "semihosting") { 65 | driverFlags.push("--specs=rdimon.specs") 66 | } else if (project.libc_sys === "nosys") { 67 | driverFlags.push("--specs=nosys.specs") 68 | } 69 | 70 | if (project.libc_printf_float) { 71 | driverFlags.push("-u_printf_float") 72 | } 73 | 74 | if (project.libc_scanf_float) { 75 | driverFlags.push("-u_scanf_float") 76 | } 77 | } 78 | 79 | return driverFlags 80 | } 81 | 82 | cpp.commonCompilerFlags: { 83 | var compilerFlags = base 84 | 85 | compilerFlags.push("-Wformat") 86 | compilerFlags.push("-Wformat-security") 87 | compilerFlags.push("-Wno-unused-function") 88 | compilerFlags.push("-Wno-unused-but-set-variable") 89 | compilerFlags.push("-Wundef") 90 | 91 | return compilerFlags 92 | } 93 | 94 | cpp.linkerFlags: { 95 | var linkerFlags = base 96 | 97 | linkerFlags.push("-Map") 98 | linkerFlags.push(outPath + "/" + targetFile + ".map") 99 | linkerFlags.push("--cref") 100 | linkerFlags.push("--gc-sections") 101 | linkerFlags.push("--no-wchar-size-warning") 102 | 103 | return linkerFlags 104 | } 105 | 106 | cpp.debugInformation: true 107 | cpp.optimization: project.optimize_small ? "small" : "none" 108 | } 109 | 110 | Properties { 111 | condition: qbs.buildVariant === "release" 112 | 113 | cpp.defines: { 114 | var defines = base 115 | 116 | if (project.full_assert) { 117 | defines.push("USE_FULL_ASSERT") 118 | } 119 | 120 | return defines 121 | } 122 | 123 | cpp.driverFlags: { 124 | var driverFlags = base 125 | 126 | driverFlags.push("-mcpu=cortex-m3") 127 | driverFlags.push("-mthumb") 128 | driverFlags.push("-mlittle-endian") 129 | driverFlags.push("-mfloat-abi=soft") 130 | 131 | if (project.lto) { 132 | driverFlags.push("-flto") 133 | } 134 | 135 | driverFlags.push("-fstack-usage") 136 | driverFlags.push("-ffunction-sections") 137 | driverFlags.push("-fdata-sections") 138 | driverFlags.push("-fno-strict-aliasing") 139 | 140 | if (project.libc) { 141 | if (project.libc_nano) { 142 | driverFlags.push("--specs=nano.specs") 143 | } 144 | 145 | if (project.libc_sys === "semihosting") { 146 | driverFlags.push("--specs=rdimon.specs") 147 | } else if (project.libc_sys === "nosys") { 148 | driverFlags.push("--specs=nosys.specs") 149 | } 150 | 151 | if (project.libc_printf_float) { 152 | driverFlags.push("-u_printf_float") 153 | } 154 | 155 | if (project.libc_scanf_float) { 156 | driverFlags.push("-u_scanf_float") 157 | } 158 | } 159 | 160 | return driverFlags 161 | } 162 | 163 | cpp.commonCompilerFlags: { 164 | var compilerFlags = base 165 | 166 | compilerFlags.push("-Wformat") 167 | compilerFlags.push("-Wformat-security") 168 | compilerFlags.push("-Wno-unused-function") 169 | compilerFlags.push("-Wno-unused-but-set-variable") 170 | compilerFlags.push("-Wundef") 171 | 172 | return compilerFlags 173 | } 174 | 175 | cpp.linkerFlags: { 176 | var linkerFlags = base 177 | 178 | linkerFlags.push("-Map") 179 | linkerFlags.push(outPath + "/" + targetFile + ".map") 180 | linkerFlags.push("--cref") 181 | linkerFlags.push("--gc-sections") 182 | linkerFlags.push("--no-wchar-size-warning") 183 | 184 | return linkerFlags 185 | } 186 | 187 | cpp.debugInformation: false 188 | cpp.optimization: project.optimize_small ? "small" : "fast" 189 | } 190 | 191 | Rule { 192 | id: elf 193 | inputs: ["application"] 194 | Artifact { 195 | fileTags: ["elf"] 196 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 197 | } 198 | prepare: { 199 | var cmd = new JavaScriptCommand() 200 | 201 | cmd.sourceCode = function() { 202 | File.copy(input.filePath, output.filePath) 203 | } 204 | cmd.description = "copying the \"elf\" file" 205 | cmd.highlight = "linker" 206 | 207 | return cmd 208 | } 209 | } 210 | 211 | Rule { 212 | id: bin 213 | inputs: ["application"] 214 | Artifact { 215 | fileTags: ["bin"] 216 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 217 | } 218 | prepare: { 219 | var args = ["-O", "binary", input.filePath, output.filePath] 220 | var cmd = new Command("arm-none-eabi-objcopy", args) 221 | 222 | cmd.description = "generating the \"binary\" file" 223 | cmd.highlight = "linker" 224 | 225 | return cmd 226 | } 227 | } 228 | 229 | Rule { 230 | id: hex 231 | inputs: ["application"] 232 | Artifact { 233 | fileTags: ["hex"] 234 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 235 | } 236 | prepare: { 237 | var args = ["-O", "ihex", input.filePath, output.filePath] 238 | var cmd = new Command("arm-none-eabi-objcopy", args) 239 | 240 | cmd.description = "generating the \"hex\" file" 241 | cmd.highlight = "linker" 242 | 243 | return cmd 244 | } 245 | } 246 | 247 | Rule { 248 | id: assembly 249 | inputs: ["application"] 250 | Artifact { 251 | fileTags: ["assembly"] 252 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 253 | } 254 | prepare: { 255 | var args = [input.filePath, "-D", "-S"] 256 | var cmd = new Command("arm-none-eabi-objdump", args) 257 | 258 | cmd.stdoutFilePath = output.filePath 259 | cmd.description = "generating the assembly listing" 260 | cmd.highlight = "codegen" 261 | 262 | return cmd 263 | } 264 | } 265 | 266 | Rule { 267 | id: size 268 | inputs: ["application"] 269 | Artifact { 270 | fileTags: ["size"] 271 | } 272 | prepare: { 273 | var args = [input.filePath] 274 | var cmd = new Command("arm-none-eabi-size", args) 275 | 276 | cmd.description = "generating the size statistics" 277 | cmd.highlight = "linker" 278 | 279 | return cmd 280 | } 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /template-stm32f4/qbs/stm32f4.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F4 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m4") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | 49 | if (project.fpu) { 50 | driverFlags.push("-mfloat-abi=hard"); 51 | driverFlags.push("-mfpu=fpv4-sp-d16"); 52 | } else { 53 | driverFlags.push("-mfloat-abi=soft") 54 | } 55 | 56 | if (project.lto) { 57 | driverFlags.push("-flto") 58 | } 59 | 60 | driverFlags.push("-fstack-usage") 61 | driverFlags.push("-ffunction-sections") 62 | driverFlags.push("-fdata-sections") 63 | driverFlags.push("-fno-strict-aliasing") 64 | 65 | if (project.libc) { 66 | if (project.libc_nano) { 67 | driverFlags.push("--specs=nano.specs") 68 | } 69 | 70 | if (project.libc_sys === "semihosting") { 71 | driverFlags.push("--specs=rdimon.specs") 72 | } else if (project.libc_sys === "nosys") { 73 | driverFlags.push("--specs=nosys.specs") 74 | } 75 | 76 | if (project.libc_printf_float) { 77 | driverFlags.push("-u_printf_float") 78 | } 79 | 80 | if (project.libc_scanf_float) { 81 | driverFlags.push("-u_scanf_float") 82 | } 83 | } 84 | 85 | return driverFlags 86 | } 87 | 88 | cpp.commonCompilerFlags: { 89 | var compilerFlags = base 90 | 91 | compilerFlags.push("-Wformat") 92 | compilerFlags.push("-Wformat-security") 93 | compilerFlags.push("-Wno-unused-function") 94 | compilerFlags.push("-Wno-unused-but-set-variable") 95 | compilerFlags.push("-Wundef") 96 | 97 | return compilerFlags 98 | } 99 | 100 | cpp.linkerFlags: { 101 | var linkerFlags = base 102 | 103 | linkerFlags.push("-Map") 104 | linkerFlags.push(outPath + "/" + targetFile + ".map") 105 | linkerFlags.push("--cref") 106 | linkerFlags.push("--gc-sections") 107 | linkerFlags.push("--no-wchar-size-warning") 108 | 109 | return linkerFlags 110 | } 111 | 112 | cpp.debugInformation: true 113 | cpp.optimization: project.optimize_small ? "small" : "none" 114 | } 115 | 116 | Properties { 117 | condition: qbs.buildVariant === "release" 118 | 119 | cpp.defines: { 120 | var defines = base 121 | 122 | if (project.full_assert) { 123 | defines.push("USE_FULL_ASSERT") 124 | } 125 | 126 | return defines 127 | } 128 | 129 | cpp.driverFlags: { 130 | var driverFlags = base 131 | 132 | driverFlags.push("-mcpu=cortex-m4") 133 | driverFlags.push("-mthumb") 134 | driverFlags.push("-mlittle-endian") 135 | 136 | if (project.fpu) { 137 | driverFlags.push("-mfloat-abi=hard"); 138 | driverFlags.push("-mfpu=fpv4-sp-d16"); 139 | } else { 140 | driverFlags.push("-mfloat-abi=soft") 141 | } 142 | 143 | if (project.lto) { 144 | driverFlags.push("-flto") 145 | } 146 | 147 | driverFlags.push("-fstack-usage") 148 | driverFlags.push("-ffunction-sections") 149 | driverFlags.push("-fdata-sections") 150 | driverFlags.push("-fno-strict-aliasing") 151 | 152 | if (project.libc) { 153 | if (project.libc_nano) { 154 | driverFlags.push("--specs=nano.specs") 155 | } 156 | 157 | if (project.libc_sys === "semihosting") { 158 | driverFlags.push("--specs=rdimon.specs") 159 | } else if (project.libc_sys === "nosys") { 160 | driverFlags.push("--specs=nosys.specs") 161 | } 162 | 163 | if (project.libc_printf_float) { 164 | driverFlags.push("-u_printf_float") 165 | } 166 | 167 | if (project.libc_scanf_float) { 168 | driverFlags.push("-u_scanf_float") 169 | } 170 | } 171 | 172 | return driverFlags 173 | } 174 | 175 | cpp.commonCompilerFlags: { 176 | var compilerFlags = base 177 | 178 | compilerFlags.push("-Wformat") 179 | compilerFlags.push("-Wformat-security") 180 | compilerFlags.push("-Wno-unused-function") 181 | compilerFlags.push("-Wno-unused-but-set-variable") 182 | compilerFlags.push("-Wundef") 183 | 184 | return compilerFlags 185 | } 186 | 187 | cpp.linkerFlags: { 188 | var linkerFlags = base 189 | 190 | linkerFlags.push("-Map") 191 | linkerFlags.push(outPath + "/" + targetFile + ".map") 192 | linkerFlags.push("--cref") 193 | linkerFlags.push("--gc-sections") 194 | linkerFlags.push("--no-wchar-size-warning") 195 | 196 | return linkerFlags 197 | } 198 | 199 | cpp.debugInformation: false 200 | cpp.optimization: project.optimize_small ? "small" : "fast" 201 | } 202 | 203 | Rule { 204 | id: elf 205 | inputs: ["application"] 206 | Artifact { 207 | fileTags: ["elf"] 208 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 209 | } 210 | prepare: { 211 | var cmd = new JavaScriptCommand() 212 | 213 | cmd.sourceCode = function() { 214 | File.copy(input.filePath, output.filePath) 215 | } 216 | cmd.description = "copying the \"elf\" file" 217 | cmd.highlight = "linker" 218 | 219 | return cmd 220 | } 221 | } 222 | 223 | Rule { 224 | id: bin 225 | inputs: ["application"] 226 | Artifact { 227 | fileTags: ["bin"] 228 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 229 | } 230 | prepare: { 231 | var args = ["-O", "binary", input.filePath, output.filePath] 232 | var cmd = new Command("arm-none-eabi-objcopy", args) 233 | 234 | cmd.description = "generating the \"binary\" file" 235 | cmd.highlight = "linker" 236 | 237 | return cmd 238 | } 239 | } 240 | 241 | Rule { 242 | id: hex 243 | inputs: ["application"] 244 | Artifact { 245 | fileTags: ["hex"] 246 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 247 | } 248 | prepare: { 249 | var args = ["-O", "ihex", input.filePath, output.filePath] 250 | var cmd = new Command("arm-none-eabi-objcopy", args) 251 | 252 | cmd.description = "generating the \"hex\" file" 253 | cmd.highlight = "linker" 254 | 255 | return cmd 256 | } 257 | } 258 | 259 | Rule { 260 | id: assembly 261 | inputs: ["application"] 262 | Artifact { 263 | fileTags: ["assembly"] 264 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 265 | } 266 | prepare: { 267 | var args = [input.filePath, "-D", "-S"] 268 | var cmd = new Command("arm-none-eabi-objdump", args) 269 | 270 | cmd.stdoutFilePath = output.filePath 271 | cmd.description = "generating the assembly listing" 272 | cmd.highlight = "codegen" 273 | 274 | return cmd 275 | } 276 | } 277 | 278 | Rule { 279 | id: size 280 | inputs: ["application"] 281 | Artifact { 282 | fileTags: ["size"] 283 | } 284 | prepare: { 285 | var args = [input.filePath] 286 | var cmd = new Command("arm-none-eabi-size", args) 287 | 288 | cmd.description = "generating the size statistics" 289 | cmd.highlight = "linker" 290 | 291 | return cmd 292 | } 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /template-stm32l4/qbs/stm32l4.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32L4 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m4") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | 49 | if (project.fpu) { 50 | driverFlags.push("-mfloat-abi=hard"); 51 | driverFlags.push("-mfpu=fpv4-sp-d16"); 52 | } else { 53 | driverFlags.push("-mfloat-abi=soft") 54 | } 55 | 56 | if (project.lto) { 57 | driverFlags.push("-flto") 58 | } 59 | 60 | driverFlags.push("-fstack-usage") 61 | driverFlags.push("-ffunction-sections") 62 | driverFlags.push("-fdata-sections") 63 | driverFlags.push("-fno-strict-aliasing") 64 | 65 | if (project.libc) { 66 | if (project.libc_nano) { 67 | driverFlags.push("--specs=nano.specs") 68 | } 69 | 70 | if (project.libc_sys === "semihosting") { 71 | driverFlags.push("--specs=rdimon.specs") 72 | } else if (project.libc_sys === "nosys") { 73 | driverFlags.push("--specs=nosys.specs") 74 | } 75 | 76 | if (project.libc_printf_float) { 77 | driverFlags.push("-u_printf_float") 78 | } 79 | 80 | if (project.libc_scanf_float) { 81 | driverFlags.push("-u_scanf_float") 82 | } 83 | } 84 | 85 | return driverFlags 86 | } 87 | 88 | cpp.commonCompilerFlags: { 89 | var compilerFlags = base 90 | 91 | compilerFlags.push("-Wformat") 92 | compilerFlags.push("-Wformat-security") 93 | compilerFlags.push("-Wno-unused-function") 94 | compilerFlags.push("-Wno-unused-but-set-variable") 95 | compilerFlags.push("-Wundef") 96 | 97 | return compilerFlags 98 | } 99 | 100 | cpp.linkerFlags: { 101 | var linkerFlags = base 102 | 103 | linkerFlags.push("-Map") 104 | linkerFlags.push(outPath + "/" + targetFile + ".map") 105 | linkerFlags.push("--cref") 106 | linkerFlags.push("--gc-sections") 107 | linkerFlags.push("--no-wchar-size-warning") 108 | 109 | return linkerFlags 110 | } 111 | 112 | cpp.debugInformation: true 113 | cpp.optimization: project.optimize_small ? "small" : "none" 114 | } 115 | 116 | Properties { 117 | condition: qbs.buildVariant === "release" 118 | 119 | cpp.defines: { 120 | var defines = base 121 | 122 | if (project.full_assert) { 123 | defines.push("USE_FULL_ASSERT") 124 | } 125 | 126 | return defines 127 | } 128 | 129 | cpp.driverFlags: { 130 | var driverFlags = base 131 | 132 | driverFlags.push("-mcpu=cortex-m4") 133 | driverFlags.push("-mthumb") 134 | driverFlags.push("-mlittle-endian") 135 | 136 | if (project.fpu) { 137 | driverFlags.push("-mfloat-abi=hard"); 138 | driverFlags.push("-mfpu=fpv4-sp-d16"); 139 | } else { 140 | driverFlags.push("-mfloat-abi=soft") 141 | } 142 | 143 | if (project.lto) { 144 | driverFlags.push("-flto") 145 | } 146 | 147 | driverFlags.push("-fstack-usage") 148 | driverFlags.push("-ffunction-sections") 149 | driverFlags.push("-fdata-sections") 150 | driverFlags.push("-fno-strict-aliasing") 151 | 152 | if (project.libc) { 153 | if (project.libc_nano) { 154 | driverFlags.push("--specs=nano.specs") 155 | } 156 | 157 | if (project.libc_sys === "semihosting") { 158 | driverFlags.push("--specs=rdimon.specs") 159 | } else if (project.libc_sys === "nosys") { 160 | driverFlags.push("--specs=nosys.specs") 161 | } 162 | 163 | if (project.libc_printf_float) { 164 | driverFlags.push("-u_printf_float") 165 | } 166 | 167 | if (project.libc_scanf_float) { 168 | driverFlags.push("-u_scanf_float") 169 | } 170 | } 171 | 172 | return driverFlags 173 | } 174 | 175 | cpp.commonCompilerFlags: { 176 | var compilerFlags = base 177 | 178 | compilerFlags.push("-Wformat") 179 | compilerFlags.push("-Wformat-security") 180 | compilerFlags.push("-Wno-unused-function") 181 | compilerFlags.push("-Wno-unused-but-set-variable") 182 | compilerFlags.push("-Wundef") 183 | 184 | return compilerFlags 185 | } 186 | 187 | cpp.linkerFlags: { 188 | var linkerFlags = base 189 | 190 | linkerFlags.push("-Map") 191 | linkerFlags.push(outPath + "/" + targetFile + ".map") 192 | linkerFlags.push("--cref") 193 | linkerFlags.push("--gc-sections") 194 | linkerFlags.push("--no-wchar-size-warning") 195 | 196 | return linkerFlags 197 | } 198 | 199 | cpp.debugInformation: false 200 | cpp.optimization: project.optimize_small ? "small" : "fast" 201 | } 202 | 203 | Rule { 204 | id: elf 205 | inputs: ["application"] 206 | Artifact { 207 | fileTags: ["elf"] 208 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 209 | } 210 | prepare: { 211 | var cmd = new JavaScriptCommand() 212 | 213 | cmd.sourceCode = function() { 214 | File.copy(input.filePath, output.filePath) 215 | } 216 | cmd.description = "copying the \"elf\" file" 217 | cmd.highlight = "linker" 218 | 219 | return cmd 220 | } 221 | } 222 | 223 | Rule { 224 | id: bin 225 | inputs: ["application"] 226 | Artifact { 227 | fileTags: ["bin"] 228 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 229 | } 230 | prepare: { 231 | var args = ["-O", "binary", input.filePath, output.filePath] 232 | var cmd = new Command("arm-none-eabi-objcopy", args) 233 | 234 | cmd.description = "generating the \"binary\" file" 235 | cmd.highlight = "linker" 236 | 237 | return cmd 238 | } 239 | } 240 | 241 | Rule { 242 | id: hex 243 | inputs: ["application"] 244 | Artifact { 245 | fileTags: ["hex"] 246 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 247 | } 248 | prepare: { 249 | var args = ["-O", "ihex", input.filePath, output.filePath] 250 | var cmd = new Command("arm-none-eabi-objcopy", args) 251 | 252 | cmd.description = "generating the \"hex\" file" 253 | cmd.highlight = "linker" 254 | 255 | return cmd 256 | } 257 | } 258 | 259 | Rule { 260 | id: assembly 261 | inputs: ["application"] 262 | Artifact { 263 | fileTags: ["assembly"] 264 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 265 | } 266 | prepare: { 267 | var args = [input.filePath, "-D", "-S"] 268 | var cmd = new Command("arm-none-eabi-objdump", args) 269 | 270 | cmd.stdoutFilePath = output.filePath 271 | cmd.description = "generating the assembly listing" 272 | cmd.highlight = "codegen" 273 | 274 | return cmd 275 | } 276 | } 277 | 278 | Rule { 279 | id: size 280 | inputs: ["application"] 281 | Artifact { 282 | fileTags: ["size"] 283 | } 284 | prepare: { 285 | var args = [input.filePath] 286 | var cmd = new Command("arm-none-eabi-size", args) 287 | 288 | cmd.description = "generating the size statistics" 289 | cmd.highlight = "linker" 290 | 291 | return cmd 292 | } 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /template-stm32f3/qbs/stm32f3.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F3 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m4") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | 49 | if (project.float_hard) { 50 | driverFlags.push("-mfloat-abi=hard"); 51 | driverFlags.push("-mfpu=fpv4-sp-d16"); 52 | } else { 53 | driverFlags.push("-mfloat-abi=soft") 54 | } 55 | 56 | if (project.lto) { 57 | driverFlags.push("-flto") 58 | } 59 | 60 | driverFlags.push("-fstack-usage") 61 | driverFlags.push("-ffunction-sections") 62 | driverFlags.push("-fdata-sections") 63 | driverFlags.push("-fno-strict-aliasing") 64 | 65 | if (project.libc) { 66 | if (project.libc_nano) { 67 | driverFlags.push("--specs=nano.specs") 68 | } 69 | 70 | if (project.libc_sys === "semihosting") { 71 | driverFlags.push("--specs=rdimon.specs") 72 | } else if (project.libc_sys === "nosys") { 73 | driverFlags.push("--specs=nosys.specs") 74 | } 75 | 76 | if (project.libc_printf_float) { 77 | driverFlags.push("-u_printf_float") 78 | } 79 | 80 | if (project.libc_scanf_float) { 81 | driverFlags.push("-u_scanf_float") 82 | } 83 | } 84 | 85 | return driverFlags 86 | } 87 | 88 | cpp.commonCompilerFlags: { 89 | var compilerFlags = base 90 | 91 | compilerFlags.push("-Wformat") 92 | compilerFlags.push("-Wformat-security") 93 | compilerFlags.push("-Wno-unused-function") 94 | compilerFlags.push("-Wno-unused-but-set-variable") 95 | compilerFlags.push("-Wundef") 96 | 97 | return compilerFlags 98 | } 99 | 100 | cpp.linkerFlags: { 101 | var linkerFlags = base 102 | 103 | linkerFlags.push("-Map") 104 | linkerFlags.push(outPath + "/" + targetFile + ".map") 105 | linkerFlags.push("--cref") 106 | linkerFlags.push("--gc-sections") 107 | linkerFlags.push("--no-wchar-size-warning") 108 | 109 | return linkerFlags 110 | } 111 | 112 | cpp.debugInformation: true 113 | cpp.optimization: project.optimize_small ? "small" : "none" 114 | } 115 | 116 | Properties { 117 | condition: qbs.buildVariant === "release" 118 | 119 | cpp.defines: { 120 | var defines = base 121 | 122 | if (project.full_assert) { 123 | defines.push("USE_FULL_ASSERT") 124 | } 125 | 126 | return defines 127 | } 128 | 129 | cpp.driverFlags: { 130 | var driverFlags = base 131 | 132 | driverFlags.push("-mcpu=cortex-m4") 133 | driverFlags.push("-mthumb") 134 | driverFlags.push("-mlittle-endian") 135 | 136 | if (project.float_hard) { 137 | driverFlags.push("-mfloat-abi=hard"); 138 | driverFlags.push("-mfpu=fpv4-sp-d16"); 139 | } else { 140 | driverFlags.push("-mfloat-abi=soft") 141 | } 142 | 143 | if (project.lto) { 144 | driverFlags.push("-flto") 145 | } 146 | 147 | driverFlags.push("-fstack-usage") 148 | driverFlags.push("-ffunction-sections") 149 | driverFlags.push("-fdata-sections") 150 | driverFlags.push("-fno-strict-aliasing") 151 | 152 | if (project.libc) { 153 | if (project.libc_nano) { 154 | driverFlags.push("--specs=nano.specs") 155 | } 156 | 157 | if (project.libc_sys === "semihosting") { 158 | driverFlags.push("--specs=rdimon.specs") 159 | } else if (project.libc_sys === "nosys") { 160 | driverFlags.push("--specs=nosys.specs") 161 | } 162 | 163 | if (project.libc_printf_float) { 164 | driverFlags.push("-u_printf_float") 165 | } 166 | 167 | if (project.libc_scanf_float) { 168 | driverFlags.push("-u_scanf_float") 169 | } 170 | } 171 | 172 | return driverFlags 173 | } 174 | 175 | cpp.commonCompilerFlags: { 176 | var compilerFlags = base 177 | 178 | compilerFlags.push("-Wformat") 179 | compilerFlags.push("-Wformat-security") 180 | compilerFlags.push("-Wno-unused-function") 181 | compilerFlags.push("-Wno-unused-but-set-variable") 182 | compilerFlags.push("-Wundef") 183 | 184 | return compilerFlags 185 | } 186 | 187 | cpp.linkerFlags: { 188 | var linkerFlags = base 189 | 190 | linkerFlags.push("-Map") 191 | linkerFlags.push(outPath + "/" + targetFile + ".map") 192 | linkerFlags.push("--cref") 193 | linkerFlags.push("--gc-sections") 194 | linkerFlags.push("--no-wchar-size-warning") 195 | 196 | return linkerFlags 197 | } 198 | 199 | cpp.debugInformation: false 200 | cpp.optimization: project.optimize_small ? "small" : "fast" 201 | } 202 | 203 | Rule { 204 | id: elf 205 | inputs: ["application"] 206 | Artifact { 207 | fileTags: ["elf"] 208 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 209 | } 210 | prepare: { 211 | var cmd = new JavaScriptCommand() 212 | 213 | cmd.sourceCode = function() { 214 | File.copy(input.filePath, output.filePath) 215 | } 216 | cmd.description = "copying the \"elf\" file" 217 | cmd.highlight = "linker" 218 | 219 | return cmd 220 | } 221 | } 222 | 223 | Rule { 224 | id: bin 225 | inputs: ["application"] 226 | Artifact { 227 | fileTags: ["bin"] 228 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 229 | } 230 | prepare: { 231 | var args = ["-O", "binary", input.filePath, output.filePath] 232 | var cmd = new Command("arm-none-eabi-objcopy", args) 233 | 234 | cmd.description = "generating the \"binary\" file" 235 | cmd.highlight = "linker" 236 | 237 | return cmd 238 | } 239 | } 240 | 241 | Rule { 242 | id: hex 243 | inputs: ["application"] 244 | Artifact { 245 | fileTags: ["hex"] 246 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 247 | } 248 | prepare: { 249 | var args = ["-O", "ihex", input.filePath, output.filePath] 250 | var cmd = new Command("arm-none-eabi-objcopy", args) 251 | 252 | cmd.description = "generating the \"hex\" file" 253 | cmd.highlight = "linker" 254 | 255 | return cmd 256 | } 257 | } 258 | 259 | Rule { 260 | id: assembly 261 | inputs: ["application"] 262 | Artifact { 263 | fileTags: ["assembly"] 264 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 265 | } 266 | prepare: { 267 | var args = [input.filePath, "-D", "-S"] 268 | var cmd = new Command("arm-none-eabi-objdump", args) 269 | 270 | cmd.stdoutFilePath = output.filePath 271 | cmd.description = "generating the assembly listing" 272 | cmd.highlight = "codegen" 273 | 274 | return cmd 275 | } 276 | } 277 | 278 | Rule { 279 | id: size 280 | inputs: ["application"] 281 | Artifact { 282 | fileTags: ["size"] 283 | } 284 | prepare: { 285 | var args = [input.filePath] 286 | var cmd = new Command("arm-none-eabi-size", args) 287 | 288 | cmd.description = "generating the size statistics" 289 | cmd.highlight = "linker" 290 | 291 | return cmd 292 | } 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /template-stm32f7/qbs/stm32f7.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32F7 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | driverFlags.push("-mcpu=cortex-m7") 46 | driverFlags.push("-mthumb") 47 | driverFlags.push("-mlittle-endian") 48 | 49 | if (project.fpu) { 50 | driverFlags.push("-mfloat-abi=hard"); 51 | if (project.fpu_dp) { 52 | driverFlags.push("-mfpu=fpv5-sp-d16"); 53 | } else { 54 | driverFlags.push("-mfpu=fpv4-sp-d16"); 55 | } 56 | } else { 57 | driverFlags.push("-mfloat-abi=soft") 58 | } 59 | 60 | if (project.lto) { 61 | driverFlags.push("-flto") 62 | } 63 | 64 | driverFlags.push("-fstack-usage") 65 | driverFlags.push("-ffunction-sections") 66 | driverFlags.push("-fdata-sections") 67 | driverFlags.push("-fno-strict-aliasing") 68 | 69 | if (project.libc) { 70 | if (project.libc_nano) { 71 | driverFlags.push("--specs=nano.specs") 72 | } 73 | 74 | if (project.libc_sys === "semihosting") { 75 | driverFlags.push("--specs=rdimon.specs") 76 | } else if (project.libc_sys === "nosys") { 77 | driverFlags.push("--specs=nosys.specs") 78 | } 79 | 80 | if (project.libc_printf_float) { 81 | driverFlags.push("-u_printf_float") 82 | } 83 | 84 | if (project.libc_scanf_float) { 85 | driverFlags.push("-u_scanf_float") 86 | } 87 | } 88 | 89 | return driverFlags 90 | } 91 | 92 | cpp.commonCompilerFlags: { 93 | var compilerFlags = base 94 | 95 | compilerFlags.push("-Wformat") 96 | compilerFlags.push("-Wformat-security") 97 | compilerFlags.push("-Wno-unused-function") 98 | compilerFlags.push("-Wno-unused-but-set-variable") 99 | compilerFlags.push("-Wundef") 100 | 101 | return compilerFlags 102 | } 103 | 104 | cpp.linkerFlags: { 105 | var linkerFlags = base 106 | 107 | linkerFlags.push("-Map") 108 | linkerFlags.push(outPath + "/" + targetFile + ".map") 109 | linkerFlags.push("--cref") 110 | linkerFlags.push("--gc-sections") 111 | linkerFlags.push("--no-wchar-size-warning") 112 | 113 | return linkerFlags 114 | } 115 | 116 | cpp.debugInformation: true 117 | cpp.optimization: project.optimize_small ? "small" : "none" 118 | } 119 | 120 | Properties { 121 | condition: qbs.buildVariant === "release" 122 | 123 | cpp.defines: { 124 | var defines = base 125 | 126 | if (project.full_assert) { 127 | defines.push("USE_FULL_ASSERT") 128 | } 129 | 130 | return defines 131 | } 132 | 133 | cpp.driverFlags: { 134 | var driverFlags = base 135 | 136 | driverFlags.push("-mcpu=cortex-m7") 137 | driverFlags.push("-mthumb") 138 | driverFlags.push("-mlittle-endian") 139 | 140 | if (project.fpu) { 141 | driverFlags.push("-mfloat-abi=hard"); 142 | if (project.fpu_dp) { 143 | driverFlags.push("-mfpu=fpv5-sp-d16"); 144 | } else { 145 | driverFlags.push("-mfpu=fpv4-sp-d16"); 146 | } 147 | } else { 148 | driverFlags.push("-mfloat-abi=soft") 149 | } 150 | 151 | if (project.lto) { 152 | driverFlags.push("-flto") 153 | } 154 | 155 | driverFlags.push("-fstack-usage") 156 | driverFlags.push("-ffunction-sections") 157 | driverFlags.push("-fdata-sections") 158 | driverFlags.push("-fno-strict-aliasing") 159 | 160 | if (project.libc) { 161 | if (project.libc_nano) { 162 | driverFlags.push("--specs=nano.specs") 163 | } 164 | 165 | if (project.libc_sys === "semihosting") { 166 | driverFlags.push("--specs=rdimon.specs") 167 | } else if (project.libc_sys === "nosys") { 168 | driverFlags.push("--specs=nosys.specs") 169 | } 170 | 171 | if (project.libc_printf_float) { 172 | driverFlags.push("-u_printf_float") 173 | } 174 | 175 | if (project.libc_scanf_float) { 176 | driverFlags.push("-u_scanf_float") 177 | } 178 | } 179 | 180 | return driverFlags 181 | } 182 | 183 | cpp.commonCompilerFlags: { 184 | var compilerFlags = base 185 | 186 | compilerFlags.push("-Wformat") 187 | compilerFlags.push("-Wformat-security") 188 | compilerFlags.push("-Wno-unused-function") 189 | compilerFlags.push("-Wno-unused-but-set-variable") 190 | compilerFlags.push("-Wundef") 191 | 192 | return compilerFlags 193 | } 194 | 195 | cpp.linkerFlags: { 196 | var linkerFlags = base 197 | 198 | linkerFlags.push("-Map") 199 | linkerFlags.push(outPath + "/" + targetFile + ".map") 200 | linkerFlags.push("--cref") 201 | linkerFlags.push("--gc-sections") 202 | linkerFlags.push("--no-wchar-size-warning") 203 | 204 | return linkerFlags 205 | } 206 | 207 | cpp.debugInformation: false 208 | cpp.optimization: project.optimize_small ? "small" : "fast" 209 | } 210 | 211 | Rule { 212 | id: elf 213 | inputs: "application" 214 | Artifact { 215 | fileTags: "elf" 216 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 217 | } 218 | prepare: { 219 | var cmd = new JavaScriptCommand() 220 | 221 | cmd.sourceCode = function() { 222 | File.copy(input.filePath, output.filePath) 223 | } 224 | cmd.description = "copying the \"elf\" file" 225 | cmd.highlight = "linker" 226 | 227 | return cmd 228 | } 229 | } 230 | 231 | Rule { 232 | id: bin 233 | inputs: "application" 234 | Artifact { 235 | fileTags: "bin" 236 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 237 | } 238 | prepare: { 239 | var args = ["-O", "binary", input.filePath, output.filePath] 240 | var cmd = new Command("arm-none-eabi-objcopy", args) 241 | 242 | cmd.description = "generating the \"binary\" file" 243 | cmd.highlight = "linker" 244 | 245 | return cmd 246 | } 247 | } 248 | 249 | Rule { 250 | id: hex 251 | inputs: "application" 252 | Artifact { 253 | fileTags: "hex" 254 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 255 | } 256 | prepare: { 257 | var args = ["-O", "ihex", input.filePath, output.filePath] 258 | var cmd = new Command("arm-none-eabi-objcopy", args) 259 | 260 | cmd.description = "generating the \"hex\" file" 261 | cmd.highlight = "linker" 262 | 263 | return cmd 264 | } 265 | } 266 | 267 | Rule { 268 | id: assmbly 269 | inputs: "application" 270 | Artifact { 271 | fileTags: "assembly" 272 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 273 | } 274 | prepare: { 275 | var args = [input.filePath, "-D", "-S"] 276 | var cmd = new Command("arm-none-eabi-objdump", args) 277 | 278 | cmd.stdoutFilePath = output.filePath 279 | cmd.description = "generating the assembly listing" 280 | cmd.highlight = "codegen" 281 | 282 | return cmd 283 | } 284 | } 285 | 286 | Rule { 287 | id: size 288 | inputs: "application" 289 | Artifact { 290 | fileTags: "size" 291 | filePath: "-" 292 | } 293 | prepare: { 294 | var args = [input.filePath] 295 | var cmd = new Command("arm-none-eabi-size", args) 296 | 297 | cmd.description = "generating the size statistics" 298 | cmd.highlight = "linker" 299 | 300 | return cmd 301 | } 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /template-stm32h7/qbs/stm32h7.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import qbs.FileInfo 11 | import qbs.File 12 | import "utils.js" as utils 13 | 14 | Product { 15 | name: "STM32H7 Firmware" 16 | Depends { 17 | name: "cpp" 18 | } 19 | 20 | targetName: targetFile 21 | 22 | cpp.warningLevel: "all" 23 | cpp.visibility: "internal" 24 | cpp.cLanguageVersion: project.c_std 25 | cpp.cxxLanguageVersion: project.cpp_std 26 | cpp.positionIndependentCode: project.pic 27 | 28 | Properties { 29 | condition: qbs.buildVariant === "debug" 30 | 31 | cpp.defines: { 32 | var defines = base 33 | 34 | defines.push("DEBUG") 35 | if (project.full_assert) { 36 | defines.push("USE_FULL_ASSERT") 37 | } 38 | 39 | return defines 40 | } 41 | 42 | cpp.driverFlags: { 43 | var driverFlags = base 44 | 45 | if (project.cm4_instr) { 46 | driverFlags.push("-mcpu=cortex-m4") 47 | } else { 48 | driverFlags.push("-mcpu=cortex-m7") 49 | } 50 | driverFlags.push("-mthumb") 51 | driverFlags.push("-mlittle-endian") 52 | 53 | if (project.fpu) { 54 | driverFlags.push("-mfloat-abi=hard"); 55 | if (project.fpu_dp) { 56 | driverFlags.push("-mfpu=fpv5-sp-d16"); 57 | } else { 58 | driverFlags.push("-mfpu=fpv4-sp-d16"); 59 | } 60 | } else { 61 | driverFlags.push("-mfloat-abi=soft") 62 | } 63 | 64 | if (project.lto) { 65 | driverFlags.push("-flto") 66 | } 67 | 68 | driverFlags.push("-fstack-usage") 69 | driverFlags.push("-ffunction-sections") 70 | driverFlags.push("-fdata-sections") 71 | driverFlags.push("-fno-strict-aliasing") 72 | 73 | if (project.libc) { 74 | if (project.libc_nano) { 75 | driverFlags.push("--specs=nano.specs") 76 | } 77 | 78 | if (project.libc_sys === "semihosting") { 79 | driverFlags.push("--specs=rdimon.specs") 80 | } else if (project.libc_sys === "nosys") { 81 | driverFlags.push("--specs=nosys.specs") 82 | } 83 | 84 | if (project.libc_printf_float) { 85 | driverFlags.push("-u_printf_float") 86 | } 87 | 88 | if (project.libc_scanf_float) { 89 | driverFlags.push("-u_scanf_float") 90 | } 91 | } 92 | 93 | return driverFlags 94 | } 95 | 96 | cpp.commonCompilerFlags: { 97 | var compilerFlags = base 98 | 99 | compilerFlags.push("-Wformat") 100 | compilerFlags.push("-Wformat-security") 101 | compilerFlags.push("-Wno-unused-function") 102 | compilerFlags.push("-Wno-unused-but-set-variable") 103 | compilerFlags.push("-Wundef") 104 | 105 | return compilerFlags 106 | } 107 | 108 | cpp.linkerFlags: { 109 | var linkerFlags = base 110 | 111 | linkerFlags.push("-Map") 112 | linkerFlags.push(outPath + "/" + targetFile + ".map") 113 | linkerFlags.push("--cref") 114 | linkerFlags.push("--gc-sections") 115 | linkerFlags.push("--no-wchar-size-warning") 116 | 117 | return linkerFlags 118 | } 119 | 120 | cpp.debugInformation: true 121 | cpp.optimization: project.optimize_small ? "small" : "none" 122 | } 123 | 124 | Properties { 125 | condition: qbs.buildVariant === "release" 126 | 127 | cpp.defines: { 128 | var defines = base 129 | 130 | if (project.full_assert) { 131 | defines.push("USE_FULL_ASSERT") 132 | } 133 | 134 | return defines 135 | } 136 | 137 | cpp.driverFlags: { 138 | var driverFlags = base 139 | 140 | if (project.cm4_instr) { 141 | driverFlags.push("-mcpu=cortex-m4") 142 | } else { 143 | driverFlags.push("-mcpu=cortex-m7") 144 | } 145 | driverFlags.push("-mthumb") 146 | driverFlags.push("-mlittle-endian") 147 | 148 | if (project.fpu) { 149 | driverFlags.push("-mfloat-abi=hard"); 150 | if (project.fpu_dp) { 151 | driverFlags.push("-mfpu=fpv5-sp-d16"); 152 | } else { 153 | driverFlags.push("-mfpu=fpv4-sp-d16"); 154 | } 155 | } else { 156 | driverFlags.push("-mfloat-abi=soft") 157 | } 158 | 159 | if (project.lto) { 160 | driverFlags.push("-flto") 161 | } 162 | 163 | driverFlags.push("-fstack-usage") 164 | driverFlags.push("-ffunction-sections") 165 | driverFlags.push("-fdata-sections") 166 | driverFlags.push("-fno-strict-aliasing") 167 | 168 | if (project.libc) { 169 | if (project.libc_nano) { 170 | driverFlags.push("--specs=nano.specs") 171 | } 172 | 173 | if (project.libc_sys === "semihosting") { 174 | driverFlags.push("--specs=rdimon.specs") 175 | } else if (project.libc_sys === "nosys") { 176 | driverFlags.push("--specs=nosys.specs") 177 | } 178 | 179 | if (project.libc_printf_float) { 180 | driverFlags.push("-u_printf_float") 181 | } 182 | 183 | if (project.libc_scanf_float) { 184 | driverFlags.push("-u_scanf_float") 185 | } 186 | } 187 | 188 | return driverFlags 189 | } 190 | 191 | cpp.commonCompilerFlags: { 192 | var compilerFlags = base 193 | 194 | compilerFlags.push("-Wformat") 195 | compilerFlags.push("-Wformat-security") 196 | compilerFlags.push("-Wno-unused-function") 197 | compilerFlags.push("-Wno-unused-but-set-variable") 198 | compilerFlags.push("-Wundef") 199 | 200 | return compilerFlags 201 | } 202 | 203 | cpp.linkerFlags: { 204 | var linkerFlags = base 205 | 206 | linkerFlags.push("-Map") 207 | linkerFlags.push(outPath + "/" + targetFile + ".map") 208 | linkerFlags.push("--cref") 209 | linkerFlags.push("--gc-sections") 210 | linkerFlags.push("--no-wchar-size-warning") 211 | 212 | return linkerFlags 213 | } 214 | 215 | cpp.debugInformation: false 216 | cpp.optimization: project.optimize_small ? "small" : "fast" 217 | } 218 | 219 | Rule { 220 | id: elf 221 | inputs: ["application"] 222 | Artifact { 223 | fileTags: ["elf"] 224 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".elf" 225 | } 226 | prepare: { 227 | var cmd = new JavaScriptCommand() 228 | 229 | cmd.sourceCode = function() { 230 | File.copy(input.filePath, output.filePath) 231 | } 232 | cmd.description = "copying the \"elf\" file" 233 | cmd.highlight = "linker" 234 | 235 | return cmd 236 | } 237 | } 238 | 239 | Rule { 240 | id: bin 241 | inputs: ["application"] 242 | Artifact { 243 | fileTags: ["bin"] 244 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".bin" 245 | } 246 | prepare: { 247 | var args = ["-O", "binary", input.filePath, output.filePath] 248 | var cmd = new Command("arm-none-eabi-objcopy", args) 249 | 250 | cmd.description = "generating the \"binary\" file" 251 | cmd.highlight = "linker" 252 | 253 | return cmd 254 | } 255 | } 256 | 257 | Rule { 258 | id: hex 259 | inputs: ["application"] 260 | Artifact { 261 | fileTags: ["hex"] 262 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".hex" 263 | } 264 | prepare: { 265 | var args = ["-O", "ihex", input.filePath, output.filePath] 266 | var cmd = new Command("arm-none-eabi-objcopy", args) 267 | 268 | cmd.description = "generating the \"hex\" file" 269 | cmd.highlight = "linker" 270 | 271 | return cmd 272 | } 273 | } 274 | 275 | Rule { 276 | id: assembly 277 | inputs: ["application"] 278 | Artifact { 279 | fileTags: ["assembly"] 280 | filePath: utils.generate_build_path(input.filePath) + "/" + FileInfo.baseName(input.filePath) + ".lst" 281 | } 282 | prepare: { 283 | var args = [input.filePath, "-D", "-S"] 284 | var cmd = new Command("arm-none-eabi-objdump", args) 285 | 286 | cmd.stdoutFilePath = output.filePath 287 | cmd.description = "generating the assembly listing" 288 | cmd.highlight = "codegen" 289 | 290 | return cmd 291 | } 292 | } 293 | 294 | Rule { 295 | id: size 296 | inputs: ["application"] 297 | Artifact { 298 | fileTags: ["size"] 299 | } 300 | prepare: { 301 | var args = [input.filePath] 302 | var cmd = new Command("arm-none-eabi-size", args) 303 | 304 | cmd.description = "generating the size statistics" 305 | cmd.highlight = "linker" 306 | 307 | return cmd 308 | } 309 | } 310 | } 311 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # qube - Qt Creator "Bare-Metal" Qbs Project Templates for STM32 Development with STM32CubeMX 2 | 3 | ## Brief 4 | 5 | The aim of this project is to simplify using the [*Qt Creator*](https://www.qt.io/ide/) IDE with its [*BareMetal*](https://doc.qt.io/qtcreator/creator-developing-baremetal.html) plugin to program, compile and debug [*STM32*](https://www.st.com/en/microcontrollers/stm32-32-bit-arm-cortex-mcus.html) microcontroller projects generated by the [*STM32CubeMX*](https://www.st.com/en/development-tools/stm32cubemx.html) software. 6 | 7 | To use these templates you will need to install the *Qt Creator*, *GNU ARM Embedded Toolchain*, *OpenOCD* software packages and the *Newlib* C standard library into your system. 8 | 9 | ## Screenshots 10 | 11 | Debugging session: 12 | 13 | ![Devices -> Bare Metal](/img/00-debugging.png?raw=true) 14 | 15 | ## Supported Microcontroller Series 16 | 17 | * STM32F0 18 | 19 | * STM32F1 20 | 21 | * STM32F2 22 | 23 | * STM32F3 24 | 25 | * STM32F4 26 | 27 | * STM32F7 28 | 29 | * STM32L0 30 | 31 | * STM32L1 32 | 33 | * STM32L4 34 | 35 | * STM32H7 36 | 37 | ## Supported RTOS and Libraries 38 | 39 | * FreeRTOS 40 | 41 | * Newlib (C Standard Library) 42 | 43 | * CMSIS 44 | 45 | * CMSIS Math (DSP) 46 | 47 | * HAL 48 | 49 | * LL 50 | 51 | * Audio 52 | 53 | * USB Device 54 | 55 | * USB Host 56 | 57 | * STMTouch 58 | 59 | * STemWin 60 | 61 | * FatFs 62 | 63 | * LibJPEG 64 | 65 | * LwIP 66 | 67 | * mbedTLS 68 | 69 | * Custom (user-defined) Libraries 70 | 71 | ## Installation 72 | 73 | These templates are supposed to work correctly at least on fully updated *Ubuntu 16.04 LTS*, *Ubuntu 18.04 LTS* and *Arch Linux* operating systems using *Qt Creator 4.6* or later versions. 74 | 75 | ### *Ubuntu 16.04* instructions 76 | 77 | * Run `sudo apt install gcc gcc-arm-none-eabi gdb gdbserver gdb-arm-none-eabi binutils-arm-none-eabi openocd libnewlib-dev libnewlib-doc libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib newlib-source` 78 | 79 | * Next, you can try to use the default Qt Creator version from Ubuntu repositories by executing `sudo apt install qtcreator qtcreator-doc qbs`, or you can download and install *Qt Creator* from its [official web-site](https://www.qt.io/offline-installers/) (recommended) 80 | 81 | * See the Known Issues below 82 | 83 | ### *Ubuntu 18.04* instructions 84 | 85 | * Run `sudo apt install gcc gcc-arm-none-eabi gdb gdbserver gdb-multiarch binutils-arm-none-eabi openocd libnewlib-dev libnewlib-doc libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib newlib-source` 86 | 87 | * Next, you can try to use the default Qt Creator version from Ubuntu repositories by executing `sudo apt install qtcreator qtcreator-doc qbs`, or you can download and install *Qt Creator* from its [official web-site](https://www.qt.io/offline-installers/) (recommended) 88 | 89 | * See the Known Issues below 90 | 91 | ### *Arch Linux* Instructions 92 | 93 | * Run `pacman -S gcc gdb arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-gdb arm-none-eabi-newlib openocd qtcreator` 94 | 95 | ## *Qt Creator* Configuration 96 | 97 | Make sure to configure *Qt Creator* as shown in the screenshots below. 98 | 99 | ## *Qt Creator* Configuration Screenshots 100 | 101 | * Enable the BareMetal plugin 102 | 103 | ![Plugins](/img/01-plugins.png?raw=true) 104 | 105 | * Add and configure OpenOCD as a GDB Server Provider for BareMetal projects 106 | 107 | * Start the OpenOCD session manually (recommended) 108 | 109 | ![Devices -> Bare Metal](/img/02-devices-bare-metal.png?raw=true) 110 | 111 | * You may want to try using one of the available startup modes if you don't like starting up an OpenOCD session manually 112 | 113 | ![Devices -> Bare Metal](/img/02-devices-bare-metal-pipe.png?raw=true) 114 | 115 | * OpenOCD startup commands 116 | 117 | ``` 118 | set remote hardware-breakpoint-limit 6 119 | set remote hardware-watchpoint-limit 4 120 | set mem inaccessible-by-default off 121 | monitor arm semihosting enable 122 | monitor reset halt 123 | load 124 | monitor reset halt 125 | ``` 126 | 127 | * Add a new Device type named ST-Link v2 and set its GDB Server Provider the previously created OpenOCD item 128 | 129 | ![Devices -> Devices](/img/03-devices-devices.png?raw=true) 130 | 131 | * Configure the Debugger settings 132 | 133 | ![Debugger -> General](/img/04-debugger-general.png?raw=true) 134 | 135 | * Configure the GDB settings 136 | 137 | ![Debugger -> GDB](/img/05-debugger-gdb.png?raw=true) 138 | 139 | * Configure the GDB Extended settings 140 | 141 | ![Debugger -> GDB Extended](/img/06-debugger-gdb-ext.png?raw=true) 142 | 143 | * Add a new debugger binary 144 | 145 | * If Qt Creator has already detected your GCC ARM GDB debugger then you can skip this step and use the automatically detected one in the next steps 146 | 147 | * Depending on your system, you should use either one of `arm-none-eabi-gdb` or `gdb-multiarch` binaries (whichever you have); if you have neither of those then it's possbile that your standard `gdb` binary comes with "multiarch" support built-in so you can just use it instead 148 | 149 | ![Build & Run -> Debuggers](/img/07-build-and-run-debuggers.png?raw=true) 150 | 151 | * Add two new compiler binaries for C and C++ 152 | 153 | * If Qt Creator has already detected your GCC ARM compilers (for C and C++) then you can skip this step and use the automatically detected ones in the next step 154 | 155 | ![Build & Run -> Compilers (C)](/img/08-build-and-run-compilers-c.png?raw=true) 156 | 157 | ![Build & Run -> Compilers (C++)](/img/09-build-and-run-compilers-cpp.png?raw=true) 158 | 159 | * Create a new Kit using the added device type, debugger and compilers, then make the kit as default 160 | 161 | ![Build & Run -> Kits](/img/10-build-and-run-kits.png?raw=true) 162 | 163 | * Choose the Projects Directory as you wish, but make sure to change the Default build directory to the `build` directory of the project's directory, instead of an upper directory, by replacing the `../` prefix with `./build/` 164 | 165 | ![Build & Run -> General](/img/11-build-and-run-general.png?raw=true) 166 | 167 | * Configure the Qbs profile for the newly added Kit 168 | 169 | ![Qbs -> Profiles](/img/12-qbs-profiles.png?raw=true) 170 | 171 | ## Usage 172 | 173 | 1. In your STM32CubeMX project choose "Makefile" as your "Toolchain / IDE" in the "Project" tab of the "Project Settings" window 174 | 175 | 2. Select the "Copy only the necessary library files" radio-button in the "Code Generator" tab of the "Project Settings" window 176 | 177 | 3. Generate the code using the "Project -> Generate Code" menu entry or the toolbar button or the "Ctrl+Shift-G" shortcut 178 | 179 | 4. Copy the contents of one of this repository's template directories (correcsponding to your microcontroller series) to the generated project's directory 180 | 181 | 5. Rename the `template-stm32xy.qbs` file to `your-project-name.qbs` (optional) 182 | 183 | 6. Open `your-project-name.qbs` file using *Qt Creator*'s "Open Project" button 184 | 185 | 7. If the "ARM-None-EABI" kit wasn't selected as default in your Settings you will have to open the "Project" tab and activate the "ARM-None-EABI" kit under "Build & Run" while disactivating the other kits 186 | 187 | 8. Open the your-project-name.qbs file using the code editor and tune the project's properties according to your needs 188 | 189 | 9. Don't forget to set the `microcontroller_series` property in the Qbs file to choose your exact microcontroller series 190 | 191 | 10. If you need semihosting in your DEBUG build you should change the `libc_sys` property in the Qbs file to "semihosting" 192 | 193 | 11. To start debugging a firmware you'll need to start up a working OpenOCD session. You can use one of the provided configuration files, for example, by running `openocd -f ./openocd/openocd-stlink-v2-1.cfg` in the porject's directory, or you can use one of the stock configuration files (i.e. `openocd -f boards/st_nucleo_f4.cfg`) or a custom one. 194 | 195 | ## Tips 196 | 197 | * You should examine the `Makefile` generated by STM32CubeMX to find additional compiler definitions required for your project. 198 | 199 | Example: 200 | 201 | ```Makefile 202 | ... 203 | ... 204 | # C defines 205 | C_DEFS = \ 206 | -D_TIMEVAL_DEFINED \ 207 | -D_SYS_TIME_H_ \ 208 | -DUSE_HAL_DRIVER \ 209 | -DSTM32H743xx 210 | ... 211 | ... 212 | ``` 213 | 214 | The "USE_HAL_DRIVER" and "STM32H743xx" are already handled by the template, but you will have to add the other two definitions into your project: 215 | 216 | ```Qbs 217 | cpp.defines: { 218 | var defines = base 219 | 220 | defines.push("STM32") 221 | defines.push("STM32H7") 222 | defines.push(project.microcontroller_series) 223 | 224 | if (project.hal) { 225 | defines.push("USE_HAL_DRIVER") 226 | } 227 | 228 | // Added by us 229 | defines.push("_TIMEVAL_DEFINED") 230 | defines.push("_SYS_TIME_H_") 231 | 232 | return defines 233 | } 234 | ``` 235 | 236 | ## Known Issues 237 | 238 | * On older toolchain versions (like the one in Ubuntu 16.04) there is an ABI mismatch issue between the objects when linking Cortex-M7 projects which make use of the FPU: 239 | 240 | ``` 241 | /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /path/to/xxx.c.o 242 | /usr/lib/gcc/arm-none-eabi/4.9.3/../../../arm-none-eabi/bin/ld: error: /path/to/xxx.c.o uses VFP register arguments, /path/to/firmware.elf does not 243 | ``` 244 | 245 | If you can't use a newer version of the toolchain then, as a workaround, you can disactivate the `fpu_dp` property and activate the `cm4_instr` property to use only Cortex-M4 instructions, then copy/replace the required files from the STM32CubeF4 library. 246 | 247 | * As of September 1, 2018, Ubuntu 18.04 has a [known issue](https://bugs.launchpad.net/ubuntu/+source/gcc-arm-none-eabi/+bug/1767223) with the "newlib" library packaging. 248 | 249 | If it is still not fixed when you are reading this then you will have to download the updated packages from the next Ubuntu release (codenamed Cosmic) and install those over the buggy ones. Download the [libnewlib-arm-none-eabi](https://packages.ubuntu.com/cosmic/all/libnewlib-arm-none-eabi/download) and [libnewlib-dev](https://packages.ubuntu.com/cosmic/all/libnewlib-dev/download) packages and install them to fix the issue (i.e. `sudo dpkg -i libnewlib-arm-none-eabi_3.0.0.20180802-2_all.deb libnewlib-dev_3.0.0.20180802-2_all.deb`). 250 | 251 | ## License 252 | 253 | The code is released under the MIT license, see the LICENSE file. 254 | -------------------------------------------------------------------------------- /template-stm32f2/template-stm32f2.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import "qbs/stm32f2.qbs" as stm32f2 11 | 12 | Project { 13 | minimumQbsVersion: "1.6" 14 | 15 | /* 16 | * microcontroller series 17 | * 18 | * supported definitions are: 19 | * - STM32F205xx 20 | * - STM32F215xx 21 | * - STM32F207xx 22 | * - STM32F217xx 23 | */ 24 | readonly property string microcontroller_series: "STM32F205xx" 25 | 26 | /* 27 | * common properties for all build types 28 | */ 29 | readonly property string c_std : "gnu11" 30 | readonly property string cpp_std : "gnu++14" 31 | readonly property bool libc : true // use the Newlib C Standard library 32 | readonly property bool libc_nano : true // use the Newlib Nano specs 33 | readonly property bool libc_math : false // use the Standard Math library 34 | readonly property bool cmsis : true // use the CMSIS library 35 | readonly property bool cmsis_math : false // use the CMSIS Math library (DSP) 36 | readonly property bool hal : true // use ST's HAL library 37 | readonly property bool ll : true // use ST's LL library 38 | readonly property bool audio : false // use ST's Audio library 39 | readonly property bool usb_device : false // use ST's USB Device library 40 | readonly property bool usb_host : false // use ST's USB Host library 41 | readonly property bool stm_touch : false // use ST's STMTouch library 42 | readonly property bool stemwin : false // use ST's STemWin library 43 | readonly property string stemwin_v : "532" // ST's STemWin library version 44 | readonly property bool freertos : false // use the FreeRTOS real-time operating system 45 | readonly property bool mpu : false // use the MPU in FreeRTOS 46 | readonly property bool fatfs : false // use ChaN's FatFs library 47 | readonly property bool libjpeg : false // use the LibJPEG library 48 | readonly property bool lwip : false // use the LwIP library 49 | readonly property bool mbedtls : false // use the mbedTLS library 50 | readonly property bool libs : false // use own libraries in /Lib 51 | 52 | /* 53 | * properties for the debug build 54 | */ 55 | Properties { 56 | condition: qbs.buildVariant === "debug" 57 | 58 | // set the libc system interface: "nosys", "semihosting" or "custom" 59 | readonly property string libc_sys : "nosys" 60 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 61 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 62 | 63 | readonly property bool optimize_small : false // use the compiler's "small" code optimizations, otherwise "none" will be used 64 | readonly property bool lto : false // use link time optimizations 65 | readonly property bool pic : false // position independent code 66 | readonly property bool full_assert : true // enable full assert mode 67 | } 68 | 69 | /* 70 | * properties for the release build 71 | */ 72 | Properties { 73 | condition: qbs.buildVariant === "release" 74 | 75 | // set the libc system interface: "nosys", "semihosting" or "custom" 76 | readonly property string libc_sys : "nosys" 77 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 78 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 79 | 80 | readonly property bool optimize_small : true // use the compiler's "small" code optimizations, otherwise "fast" will be used 81 | readonly property bool lto : false // use link time optimizations 82 | readonly property bool pic : false // position independent code 83 | readonly property bool full_assert : false // enable full assert mode 84 | } 85 | 86 | stm32f2 { 87 | property string basePath : project.sourceDirectory 88 | property string appPath : basePath 89 | property string startupPath : basePath 90 | property string cmsisPath : basePath + "/Drivers/CMSIS" 91 | property string halPath : basePath + "/Drivers/STM32F2xx_HAL_Driver" 92 | property string utilitiesPath : basePath + "/Utilities" 93 | property string audioPath : basePath + "/Middlewares/ST/STM32_Audio" 94 | property string usbDevicePath : basePath + "/Middlewares/ST/STM32_USB_Device_Library" 95 | property string usbHostPath : basePath + "/Middlewares/ST/STM32_USB_Host_Library" 96 | property string stmTouchPath : basePath + "/Middlewares/ST/STM32_TouchSensing_Library" 97 | property string stemwinPath : basePath + "/Middlewares/ST/STemWin" 98 | property string freertosPath : basePath + "/Middlewares/Third_Party/FreeRTOS" 99 | property string fatfsPath : basePath + "/Middlewares/Third_Party/FatFs" 100 | property string libjpegPath : basePath + "/Middlewares/Third_Party/LibJPEG" 101 | property string lwipPath : basePath + "/Middlewares/Third_Party/LwIP" 102 | property string mbedtlsPath : basePath + "/Middlewares/Third_Party/mbedTLS" 103 | property string libPath : basePath + "/Lib" 104 | property string linkerPath : basePath 105 | property string openocdPath : basePath + "/openocd" 106 | property string outPath : basePath + "/bin/" + qbs.buildVariant 107 | property string targetFile : "firmware.elf" 108 | 109 | type: ["application", "elf", "bin", "hex", "assembly", "size"] 110 | name: "firmware" 111 | consoleApplication: true 112 | 113 | cpp.defines: { 114 | var defines = base 115 | 116 | defines.push("STM32") 117 | defines.push("STM32F2") 118 | defines.push(project.microcontroller_series) 119 | 120 | if (project.hal) { 121 | defines.push("USE_HAL_DRIVER") 122 | } 123 | 124 | if (project.ll) { 125 | defines.push("USE_FULL_LL_DRIVER") 126 | } 127 | 128 | if (project.libc_sys === "semihosting") { 129 | defines.push("USING_SEMIHOSTING") 130 | } 131 | 132 | return defines 133 | } 134 | 135 | cpp.includePaths: { 136 | var includePaths = base 137 | 138 | includePaths.push(appPath + "/Inc") 139 | 140 | if (project.cmsis) { 141 | includePaths.push(cmsisPath + "/Include") 142 | includePaths.push(cmsisPath + "/Device/ST/STM32F2xx/Include") 143 | } 144 | 145 | if (project.hal || project.ll) { 146 | includePaths.push(halPath + "/Inc") 147 | includePaths.push(halPath + "/Inc/Legacy") 148 | includePaths.push(halPath + "/Utilities/CPU") 149 | includePaths.push(halPath + "/Utilities/Fonts") 150 | includePaths.push(halPath + "/Utilities/JPEG") 151 | includePaths.push(halPath + "/Utilities/Log") 152 | } 153 | 154 | if (project.audio) { 155 | includePaths.push(audioPath + "/Addons/PDM") 156 | } 157 | 158 | if (project.usb_device) { 159 | includePaths.push(usbDevicePath + "/Core/Inc") 160 | includePaths.push(usbDevicePath + "/Class/AUDIO/Inc") 161 | includePaths.push(usbDevicePath + "/Class/CDC/Inc") 162 | includePaths.push(usbDevicePath + "/Class/CustomHID/Inc") 163 | includePaths.push(usbDevicePath + "/Class/DFU/Inc") 164 | includePaths.push(usbDevicePath + "/Class/HID/Inc") 165 | includePaths.push(usbDevicePath + "/Class/MSC/Inc") 166 | } 167 | 168 | if (project.usb_host) { 169 | includePaths.push(usbHostPath + "/Core/Inc") 170 | includePaths.push(usbHostPath + "/Class/AUDIO/Inc") 171 | includePaths.push(usbHostPath + "/Class/CDC/Inc") 172 | includePaths.push(usbHostPath + "/Class/HID/Inc") 173 | includePaths.push(usbHostPath + "/Class/MSC/Inc") 174 | includePaths.push(usbHostPath + "/Class/MTP/Inc") 175 | } 176 | 177 | if (project.stm_touch) { 178 | includePaths.push(stmTouchPath + "/inc") 179 | } 180 | 181 | if (project.stemwin) { 182 | includePaths.push(stemwinPath + "/Config") 183 | includePaths.push(stemwinPath + "/inc") 184 | } 185 | 186 | if (project.freertos) { 187 | includePaths.push(freertosPath + "/Source/CMSIS_RTOS") 188 | includePaths.push(freertosPath + "/Source/include") 189 | if (project.mpu) { 190 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM3_MPU") 191 | } else { 192 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM3") 193 | } 194 | } 195 | 196 | if (project.fatfs) { 197 | includePaths.push(fatfsPath + "/src") 198 | includePaths.push(fatfsPath + "/src/drivers") 199 | } 200 | 201 | if (project.libjpeg) { 202 | includePaths.push(libjpegPath + "/include") 203 | } 204 | 205 | if (project.lwip) { 206 | includePaths.push(lwipPath + "/src/include") 207 | includePaths.push(lwipPath + "/system") 208 | } 209 | 210 | if (project.mbedtls) { 211 | includePaths.push(mbedtlsPath + "/configs") 212 | includePaths.push(mbedtlsPath + "/include") 213 | } 214 | 215 | if (project.libs) { 216 | includePaths.push(libPath) 217 | } 218 | 219 | return includePaths 220 | } 221 | 222 | cpp.libraryPaths: { 223 | var libraryPaths = base 224 | 225 | if (project.cmsis_math) { 226 | libraryPaths.push(cmsisPath + "/Lib/GCC") 227 | } 228 | 229 | if (project.audio) { 230 | libraryPaths.push(audioPath + "/Addons/PDM") 231 | } 232 | 233 | if (project.stemwin) { 234 | libraryPaths.push(stemwinPath + "/Lib") 235 | } 236 | 237 | return libraryPaths 238 | } 239 | 240 | cpp.staticLibraries: { 241 | var staticLibraries = base 242 | 243 | if (project.libc_sys === "semihosting") { 244 | staticLibraries.push("rdimon") 245 | } else if (project.libc_sys === "nosys") { 246 | staticLibraries.push("nosys") 247 | } 248 | 249 | if (project.cmsis_math) { 250 | staticLibraries.push("arm_cortexM3l_math") 251 | } 252 | 253 | if (project.audio) { 254 | staticLibraries.push("PDMFilter_CM3_GCC") 255 | } 256 | 257 | if (project.stemwin) { 258 | if (project.freertos) { 259 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM3_OS_GCC") 260 | } else { 261 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM3_GCC") 262 | } 263 | } 264 | 265 | staticLibraries.push("gcc") 266 | staticLibraries.push("c") 267 | 268 | if (project.libc_math) { 269 | staticLibraries.push("m") 270 | } 271 | 272 | return staticLibraries 273 | } 274 | 275 | Group { 276 | name: "Startup" 277 | prefix: startupPath 278 | fileTags: ["asm"] 279 | files: [ 280 | "/*.s", 281 | "/*.S" 282 | ] 283 | } 284 | 285 | Group { 286 | name: "App" 287 | prefix: appPath 288 | files: [ 289 | "/Src/**/*.c", 290 | "/Src/**/*.cpp", 291 | "/Inc/**/*.h" 292 | ] 293 | } 294 | 295 | Group { 296 | name: "Drivers/CMSIS" 297 | prefix: cmsisPath 298 | files: [ 299 | "/**/*.h" 300 | ] 301 | excludeFiles: [ 302 | "*template*", 303 | "*Template*" 304 | ] 305 | } 306 | 307 | Group { 308 | condition: project.hal === true || project.ll === true 309 | 310 | name: "Drivers/HAL" 311 | prefix: halPath 312 | files: [ 313 | "/**/*.c", 314 | "/**/*.h" 315 | ] 316 | excludeFiles: [ 317 | "*template*", 318 | "*Template*" 319 | ] 320 | } 321 | 322 | Group { 323 | condition: project.hal === true || project.ll === true 324 | 325 | name: "Utilities" 326 | prefix: utilitiesPath 327 | files: [ 328 | "/**/*.c", 329 | "/**/*.c", 330 | "/**/*.h" 331 | ] 332 | excludeFiles: [ 333 | "*template*", 334 | "*Template*" 335 | ] 336 | } 337 | 338 | Group { 339 | condition: project.audio === true 340 | 341 | name: "Middleware/Audio" 342 | prefix: audioPath 343 | files: [ 344 | "/**/*.c", 345 | "/**/*.h" 346 | ] 347 | excludeFiles: [ 348 | "*template*", 349 | "*Template*" 350 | ] 351 | } 352 | 353 | Group { 354 | condition: project.usb_device === true 355 | 356 | name: "Middleware/USBDevice" 357 | prefix: usbDevicePath 358 | files: [ 359 | "/**/*.c", 360 | "/**/*.h" 361 | ] 362 | excludeFiles: [ 363 | "*template*", 364 | "*Template*" 365 | ] 366 | } 367 | 368 | Group { 369 | condition: project.usb_host === true 370 | 371 | name: "Middleware/USBHost" 372 | prefix: usbHostPath 373 | files: [ 374 | "/**/*.c", 375 | "/**/*.h" 376 | ] 377 | excludeFiles: [ 378 | "*template*", 379 | "*Template*" 380 | ] 381 | } 382 | 383 | Group { 384 | condition: project.stm_touch === true 385 | 386 | name: "Middleware/STMTouch" 387 | prefix: usbDevicePath 388 | files: [ 389 | "/src/*.c", 390 | "/inc/*.h" 391 | ] 392 | excludeFiles: [ 393 | "*template*", 394 | "*Template*" 395 | ] 396 | } 397 | 398 | Group { 399 | condition: project.stemwin === true 400 | 401 | name: "Middleware/STemWin" 402 | prefix: stemwinPath 403 | files: [ 404 | "/Config/**/*.c", 405 | "/Config/**/*.h", 406 | "/OS/**/*.c", 407 | "/OS/**/*.h", 408 | "/inc/**/*.h" 409 | ] 410 | excludeFiles: [ 411 | "*template*", 412 | "*Template*" 413 | ] 414 | } 415 | 416 | Group { 417 | condition: project.freertos === true 418 | 419 | name: "Middleware/FreeRTOS" 420 | prefix: freertosPath 421 | files: [ 422 | "/Source/**/*.c", 423 | "/Source/**/*.h" 424 | ] 425 | excludeFiles: [ 426 | "*template*", 427 | "*Template*" 428 | ] 429 | } 430 | 431 | Group { 432 | condition: project.fatfs === true 433 | 434 | name: "Middleware/FatFs" 435 | prefix: fatfsPath 436 | files: [ 437 | "/src/**/*.c", 438 | "/src/**/*.h" 439 | ] 440 | excludeFiles: [ 441 | "*template*", 442 | "*Template*" 443 | ] 444 | } 445 | 446 | Group { 447 | condition: project.libjpeg === true 448 | 449 | name: "Middleware/LibJPEG" 450 | prefix: libjpegPath 451 | files: [ 452 | "/include/**/*.h", 453 | "/source/**/*.c" 454 | ] 455 | excludeFiles: [ 456 | "*template*", 457 | "*Template*" 458 | ] 459 | } 460 | 461 | Group { 462 | condition: project.lwip === true 463 | 464 | name: "Middleware/LwIP" 465 | prefix: lwipPath 466 | files: [ 467 | "/src/**/*.c", 468 | "/src/**/*.h", 469 | "/system/**/*.c", 470 | "/system/**/*.h" 471 | ] 472 | excludeFiles: [ 473 | "*template*", 474 | "*Template*" 475 | ] 476 | } 477 | 478 | Group { 479 | condition: project.mbedtls === true 480 | 481 | name: "Middleware/mbedTLS" 482 | prefix: lwipPath 483 | files: [ 484 | "/configs/*.h", 485 | "/include/**/*.h", 486 | "/library/**/*.c" 487 | ] 488 | excludeFiles: [ 489 | "*template*", 490 | "*Template*" 491 | ] 492 | } 493 | 494 | Group { 495 | condition: project.libs === true 496 | 497 | name: "Lib" 498 | prefix: libPath 499 | files: [ 500 | "/**/*.c", 501 | "/**/*.cpp", 502 | "/**/*.h" 503 | ] 504 | excludeFiles: [ 505 | "*template*", 506 | "*Template*" 507 | ] 508 | } 509 | 510 | Group { 511 | name: "Linker" 512 | prefix: linkerPath 513 | fileTags: ["linkerscript"] 514 | files: [ 515 | "/*.ld" 516 | ] 517 | } 518 | 519 | Group { 520 | name: "OpenOCD" 521 | prefix: openocdPath 522 | files: [ 523 | "/*.cfg" 524 | ] 525 | } 526 | } 527 | } 528 | -------------------------------------------------------------------------------- /template-stm32f0/template-stm32f0.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import "qbs/stm32f0.qbs" as stm32f0 11 | 12 | Project { 13 | minimumQbsVersion: "1.6" 14 | 15 | /* 16 | * microcontroller series 17 | * 18 | * supported definitions are: 19 | * - STM32F030x6 20 | * - STM32F030x8 21 | * - STM32F031x6 22 | * - STM32F038xx 23 | * - STM32F042x6 24 | * - STM32F048xx 25 | * - STM32F051x8 26 | * - STM32F058xx 27 | * - STM32F070x6 28 | * - STM32F070xB 29 | * - STM32F071xB 30 | * - STM32F072xB 31 | * - STM32F078xx 32 | * - STM32F091xC 33 | * - STM32F098xx 34 | * - STM32F030xC 35 | */ 36 | readonly property string microcontroller_series: "STM32F030x6" 37 | 38 | /* 39 | * common properties for all build types 40 | */ 41 | readonly property string c_std : "gnu11" 42 | readonly property string cpp_std : "gnu++14" 43 | readonly property bool libc : true // use the Newlib C Standard library 44 | readonly property bool libc_nano : true // use the Newlib Nano specs 45 | readonly property bool libc_math : false // use the Standard Math library 46 | readonly property bool cmsis : true // use the CMSIS library 47 | readonly property bool cmsis_math : false // use the CMSIS Math library (DSP) 48 | readonly property bool hal : true // use ST's HAL library 49 | readonly property bool ll : true // use ST's LL library 50 | readonly property bool audio : false // use ST's Audio library 51 | readonly property bool usb_device : false // use ST's USB Device library 52 | readonly property bool usb_host : false // use ST's USB Host library 53 | readonly property bool stm_touch : false // use ST's STMTouch library 54 | readonly property bool stemwin : false // use ST's STemWin library 55 | readonly property string stemwin_v : "532" // ST's STemWin library version 56 | readonly property bool freertos : false // use the FreeRTOS real-time operating system 57 | readonly property bool fatfs : false // use ChaN's FatFs library 58 | readonly property bool libjpeg : false // use the LibJPEG library 59 | readonly property bool lwip : false // use the LwIP library 60 | readonly property bool mbedtls : false // use the mbedTLS library 61 | readonly property bool libs : false // use own libraries in /Lib 62 | 63 | /* 64 | * properties for the debug build 65 | */ 66 | Properties { 67 | condition: qbs.buildVariant === "debug" 68 | 69 | // set the libc system interface: "nosys", "semihosting" or "custom" 70 | readonly property string libc_sys : "nosys" 71 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 72 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 73 | 74 | readonly property bool optimize_small : false // use the compiler's "small" code optimizations, otherwise "none" will be used 75 | readonly property bool lto : false // use link time optimizations 76 | readonly property bool pic : false // position independent code 77 | readonly property bool full_assert : true // enable full assert mode 78 | } 79 | 80 | /* 81 | * properties for the release build 82 | */ 83 | Properties { 84 | condition: qbs.buildVariant === "release" 85 | 86 | // set the libc system interface: "nosys", "semihosting" or "custom" 87 | readonly property string libc_sys : "nosys" 88 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 89 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 90 | 91 | readonly property bool optimize_small : true // use the compiler's "small" code optimizations, otherwise "fast" will be used 92 | readonly property bool lto : false // use link time optimizations 93 | readonly property bool pic : false // position independent code 94 | readonly property bool full_assert : false // enable full assert mode 95 | } 96 | 97 | stm32f0 { 98 | property string basePath : project.sourceDirectory 99 | property string appPath : basePath 100 | property string startupPath : basePath 101 | property string cmsisPath : basePath + "/Drivers/CMSIS" 102 | property string halPath : basePath + "/Drivers/STM32F0xx_HAL_Driver" 103 | property string utilitiesPath : basePath + "/Utilities" 104 | property string audioPath : basePath + "/Middlewares/ST/STM32_Audio" 105 | property string usbDevicePath : basePath + "/Middlewares/ST/STM32_USB_Device_Library" 106 | property string usbHostPath : basePath + "/Middlewares/ST/STM32_USB_Host_Library" 107 | property string stmTouchPath : basePath + "/Middlewares/ST/STM32_TouchSensing_Library" 108 | property string stemwinPath : basePath + "/Middlewares/ST/STemWin" 109 | property string freertosPath : basePath + "/Middlewares/Third_Party/FreeRTOS" 110 | property string fatfsPath : basePath + "/Middlewares/Third_Party/FatFs" 111 | property string libjpegPath : basePath + "/Middlewares/Third_Party/LibJPEG" 112 | property string lwipPath : basePath + "/Middlewares/Third_Party/LwIP" 113 | property string mbedtlsPath : basePath + "/Middlewares/Third_Party/mbedTLS" 114 | property string libPath : basePath + "/Lib" 115 | property string linkerPath : basePath 116 | property string openocdPath : basePath + "/openocd" 117 | property string outPath : basePath + "/bin/" + qbs.buildVariant 118 | property string targetFile : "firmware.elf" 119 | 120 | type: ["application", "elf", "bin", "hex", "assembly", "size"] 121 | name: "firmware" 122 | consoleApplication: true 123 | 124 | cpp.defines: { 125 | var defines = base 126 | 127 | defines.push("STM32") 128 | defines.push("STM32F0") 129 | defines.push(project.microcontroller_series) 130 | 131 | if (project.hal) { 132 | defines.push("USE_HAL_DRIVER") 133 | } 134 | 135 | if (project.ll) { 136 | defines.push("USE_FULL_LL_DRIVER") 137 | } 138 | 139 | if (project.libc_sys === "semihosting") { 140 | defines.push("USING_SEMIHOSTING") 141 | } 142 | 143 | return defines 144 | } 145 | 146 | cpp.includePaths: { 147 | var includePaths = base 148 | 149 | includePaths.push(appPath + "/Inc") 150 | 151 | if (project.cmsis) { 152 | includePaths.push(cmsisPath + "/Include") 153 | includePaths.push(cmsisPath + "/Device/ST/STM32F0xx/Include") 154 | } 155 | 156 | if (project.hal || project.ll) { 157 | includePaths.push(halPath + "/Inc") 158 | includePaths.push(halPath + "/Inc/Legacy") 159 | includePaths.push(halPath + "/Utilities/CPU") 160 | includePaths.push(halPath + "/Utilities/Fonts") 161 | includePaths.push(halPath + "/Utilities/JPEG") 162 | includePaths.push(halPath + "/Utilities/Log") 163 | } 164 | 165 | if (project.audio) { 166 | includePaths.push(audioPath + "/Addons/PDM") 167 | } 168 | 169 | if (project.usb_device) { 170 | includePaths.push(usbDevicePath + "/Core/Inc") 171 | includePaths.push(usbDevicePath + "/Class/AUDIO/Inc") 172 | includePaths.push(usbDevicePath + "/Class/CDC/Inc") 173 | includePaths.push(usbDevicePath + "/Class/CustomHID/Inc") 174 | includePaths.push(usbDevicePath + "/Class/DFU/Inc") 175 | includePaths.push(usbDevicePath + "/Class/HID/Inc") 176 | includePaths.push(usbDevicePath + "/Class/MSC/Inc") 177 | } 178 | 179 | if (project.usb_host) { 180 | includePaths.push(usbHostPath + "/Core/Inc") 181 | includePaths.push(usbHostPath + "/Class/AUDIO/Inc") 182 | includePaths.push(usbHostPath + "/Class/CDC/Inc") 183 | includePaths.push(usbHostPath + "/Class/HID/Inc") 184 | includePaths.push(usbHostPath + "/Class/MSC/Inc") 185 | includePaths.push(usbHostPath + "/Class/MTP/Inc") 186 | } 187 | 188 | if (project.stm_touch) { 189 | includePaths.push(stmTouchPath + "/inc") 190 | } 191 | 192 | if (project.stemwin) { 193 | includePaths.push(stemwinPath + "/Config") 194 | includePaths.push(stemwinPath + "/inc") 195 | } 196 | 197 | if (project.freertos) { 198 | includePaths.push(freertosPath + "/Source/CMSIS_RTOS") 199 | includePaths.push(freertosPath + "/Source/include") 200 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM0") 201 | } 202 | 203 | if (project.fatfs) { 204 | includePaths.push(fatfsPath + "/src") 205 | includePaths.push(fatfsPath + "/src/drivers") 206 | } 207 | 208 | if (project.libjpeg) { 209 | includePaths.push(libjpegPath + "/include") 210 | } 211 | 212 | if (project.lwip) { 213 | includePaths.push(lwipPath + "/src/include") 214 | includePaths.push(lwipPath + "/system") 215 | } 216 | 217 | if (project.mbedtls) { 218 | includePaths.push(mbedtlsPath + "/configs") 219 | includePaths.push(mbedtlsPath + "/include") 220 | } 221 | 222 | if (project.libs) { 223 | includePaths.push(libPath) 224 | } 225 | 226 | return includePaths 227 | } 228 | 229 | cpp.libraryPaths: { 230 | var libraryPaths = base 231 | 232 | if (project.cmsis_math) { 233 | libraryPaths.push(cmsisPath + "/Lib/GCC") 234 | } 235 | 236 | if (project.audio) { 237 | libraryPaths.push(audioPath + "/Addons/PDM") 238 | } 239 | 240 | if (project.stemwin) { 241 | libraryPaths.push(stemwinPath + "/Lib") 242 | } 243 | 244 | return libraryPaths 245 | } 246 | 247 | cpp.staticLibraries: { 248 | var staticLibraries = base 249 | 250 | if (project.libc_sys === "semihosting") { 251 | staticLibraries.push("rdimon") 252 | } else if (project.libc_sys === "nosys") { 253 | staticLibraries.push("nosys") 254 | } 255 | 256 | if (project.cmsis_math) { 257 | staticLibraries.push("arm_cortexM0l_math") 258 | } 259 | 260 | if (project.audio) { 261 | staticLibraries.push("PDMFilter_CM0_GCC") 262 | } 263 | 264 | if (project.stemwin) { 265 | if (project.freertos) { 266 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM0_OS_GCC") 267 | } else { 268 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM0_GCC") 269 | } 270 | } 271 | 272 | staticLibraries.push("gcc") 273 | staticLibraries.push("c") 274 | 275 | if (project.libc_math) { 276 | staticLibraries.push("m") 277 | } 278 | 279 | return staticLibraries 280 | } 281 | 282 | Group { 283 | name: "Startup" 284 | prefix: startupPath 285 | fileTags: ["asm"] 286 | files: [ 287 | "/*.s", 288 | "/*.S" 289 | ] 290 | } 291 | 292 | Group { 293 | name: "App" 294 | prefix: appPath 295 | files: [ 296 | "/Src/**/*.c", 297 | "/Src/**/*.cpp", 298 | "/Inc/**/*.h" 299 | ] 300 | } 301 | 302 | Group { 303 | name: "Drivers/CMSIS" 304 | prefix: cmsisPath 305 | files: [ 306 | "/**/*.h" 307 | ] 308 | excludeFiles: [ 309 | "*template*", 310 | "*Template*" 311 | ] 312 | } 313 | 314 | Group { 315 | condition: project.hal === true || project.ll === true 316 | 317 | name: "Drivers/HAL" 318 | prefix: halPath 319 | files: [ 320 | "/**/*.c", 321 | "/**/*.h" 322 | ] 323 | excludeFiles: [ 324 | "*template*", 325 | "*Template*" 326 | ] 327 | } 328 | 329 | Group { 330 | condition: project.hal === true || project.ll === true 331 | 332 | name: "Utilities" 333 | prefix: utilitiesPath 334 | files: [ 335 | "/**/*.c", 336 | "/**/*.c", 337 | "/**/*.h" 338 | ] 339 | excludeFiles: [ 340 | "*template*", 341 | "*Template*" 342 | ] 343 | } 344 | 345 | Group { 346 | condition: project.audio === true 347 | 348 | name: "Middleware/Audio" 349 | prefix: audioPath 350 | files: [ 351 | "/**/*.c", 352 | "/**/*.h" 353 | ] 354 | excludeFiles: [ 355 | "*template*", 356 | "*Template*" 357 | ] 358 | } 359 | 360 | Group { 361 | condition: project.usb_device === true 362 | 363 | name: "Middleware/USBDevice" 364 | prefix: usbDevicePath 365 | files: [ 366 | "/**/*.c", 367 | "/**/*.h" 368 | ] 369 | excludeFiles: [ 370 | "*template*", 371 | "*Template*" 372 | ] 373 | } 374 | 375 | Group { 376 | condition: project.usb_host === true 377 | 378 | name: "Middleware/USBHost" 379 | prefix: usbHostPath 380 | files: [ 381 | "/**/*.c", 382 | "/**/*.h" 383 | ] 384 | excludeFiles: [ 385 | "*template*", 386 | "*Template*" 387 | ] 388 | } 389 | 390 | Group { 391 | condition: project.stm_touch === true 392 | 393 | name: "Middleware/STMTouch" 394 | prefix: usbDevicePath 395 | files: [ 396 | "/src/*.c", 397 | "/inc/*.h" 398 | ] 399 | excludeFiles: [ 400 | "*template*", 401 | "*Template*" 402 | ] 403 | } 404 | 405 | Group { 406 | condition: project.stemwin === true 407 | 408 | name: "Middleware/STemWin" 409 | prefix: stemwinPath 410 | files: [ 411 | "/Config/**/*.c", 412 | "/Config/**/*.h", 413 | "/OS/**/*.c", 414 | "/OS/**/*.h", 415 | "/inc/**/*.h" 416 | ] 417 | excludeFiles: [ 418 | "*template*", 419 | "*Template*" 420 | ] 421 | } 422 | 423 | Group { 424 | condition: project.freertos === true 425 | 426 | name: "Middleware/FreeRTOS" 427 | prefix: freertosPath 428 | files: [ 429 | "/Source/**/*.c", 430 | "/Source/**/*.h" 431 | ] 432 | excludeFiles: [ 433 | "*template*", 434 | "*Template*" 435 | ] 436 | } 437 | 438 | Group { 439 | condition: project.fatfs === true 440 | 441 | name: "Middleware/FatFs" 442 | prefix: fatfsPath 443 | files: [ 444 | "/src/**/*.c", 445 | "/src/**/*.h" 446 | ] 447 | excludeFiles: [ 448 | "*template*", 449 | "*Template*" 450 | ] 451 | } 452 | 453 | Group { 454 | condition: project.libjpeg === true 455 | 456 | name: "Middleware/LibJPEG" 457 | prefix: libjpegPath 458 | files: [ 459 | "/include/**/*.h", 460 | "/source/**/*.c" 461 | ] 462 | excludeFiles: [ 463 | "*template*", 464 | "*Template*" 465 | ] 466 | } 467 | 468 | Group { 469 | condition: project.lwip === true 470 | 471 | name: "Middleware/LwIP" 472 | prefix: lwipPath 473 | files: [ 474 | "/src/**/*.c", 475 | "/src/**/*.h", 476 | "/system/**/*.c", 477 | "/system/**/*.h" 478 | ] 479 | excludeFiles: [ 480 | "*template*", 481 | "*Template*" 482 | ] 483 | } 484 | 485 | Group { 486 | condition: project.mbedtls === true 487 | 488 | name: "Middleware/mbedTLS" 489 | prefix: lwipPath 490 | files: [ 491 | "/configs/*.h", 492 | "/include/**/*.h", 493 | "/library/**/*.c" 494 | ] 495 | excludeFiles: [ 496 | "*template*", 497 | "*Template*" 498 | ] 499 | } 500 | 501 | Group { 502 | condition: project.libs === true 503 | 504 | name: "Lib" 505 | prefix: libPath 506 | files: [ 507 | "/**/*.c", 508 | "/**/*.cpp", 509 | "/**/*.h" 510 | ] 511 | excludeFiles: [ 512 | "*template*", 513 | "*Template*" 514 | ] 515 | } 516 | 517 | Group { 518 | name: "Linker" 519 | prefix: linkerPath 520 | fileTags: ["linkerscript"] 521 | files: [ 522 | "/*.ld" 523 | ] 524 | } 525 | 526 | Group { 527 | name: "OpenOCD" 528 | prefix: openocdPath 529 | files: [ 530 | "/*.cfg" 531 | ] 532 | } 533 | } 534 | } 535 | -------------------------------------------------------------------------------- /template-stm32l0/template-stm32l0.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import "qbs/stm32l0.qbs" as stm32l0 11 | 12 | Project { 13 | minimumQbsVersion: "1.6" 14 | 15 | /* 16 | * microcontroller series 17 | * 18 | * supported definitions are: 19 | * - STM32L011xx 20 | * - STM32L021xx 21 | * - STM32L031xx 22 | * - STM32L041xx 23 | * - STM32L051xx 24 | * - STM32L052xx 25 | * - STM32L053xx 26 | * - STM32L061xx 27 | * - STM32L062xx 28 | * - STM32L063xx 29 | * - STM32L071xx 30 | * - STM32L072xx 31 | * - STM32L073xx 32 | * - STM32L081xx 33 | * - STM32L082xx 34 | * - STM32L083xx 35 | */ 36 | readonly property string microcontroller_series: "STM32L011xx" 37 | 38 | /* 39 | * common properties for all build types 40 | */ 41 | readonly property string c_std : "gnu11" 42 | readonly property string cpp_std : "gnu++14" 43 | readonly property bool libc : true // use the Newlib C Standard library 44 | readonly property bool libc_nano : true // use the Newlib Nano specs 45 | readonly property bool libc_math : false // use the Standard Math library 46 | readonly property bool cmsis : true // use the CMSIS library 47 | readonly property bool cmsis_math : false // use the CMSIS Math library (DSP) 48 | readonly property bool hal : true // use ST's HAL library 49 | readonly property bool ll : true // use ST's LL library 50 | readonly property bool audio : false // use ST's Audio library 51 | readonly property bool usb_device : false // use ST's USB Device library 52 | readonly property bool usb_host : false // use ST's USB Host library 53 | readonly property bool stm_touch : false // use ST's STMTouch library 54 | readonly property bool stemwin : false // use ST's STemWin library 55 | readonly property string stemwin_v : "540" // ST's STemWin library version 56 | readonly property bool freertos : false // use the FreeRTOS real-time operating system 57 | readonly property bool fatfs : false // use ChaN's FatFs library 58 | readonly property bool libjpeg : false // use the LibJPEG library 59 | readonly property bool lwip : false // use the LwIP library 60 | readonly property bool mbedtls : false // use the mbedTLS library 61 | readonly property bool libs : false // use own libraries in /Lib 62 | 63 | /* 64 | * properties for the debug build 65 | */ 66 | Properties { 67 | condition: qbs.buildVariant === "debug" 68 | 69 | // set the libc system interface: "nosys", "semihosting" or "custom" 70 | readonly property string libc_sys : "nosys" 71 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 72 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 73 | 74 | readonly property bool optimize_small : false // use the compiler's "small" code optimizations, otherwise "none" will be used 75 | readonly property bool lto : false // use link time optimizations 76 | readonly property bool pic : false // position independent code 77 | readonly property bool full_assert : true // enable full assert mode 78 | } 79 | 80 | /* 81 | * properties for the release build 82 | */ 83 | Properties { 84 | condition: qbs.buildVariant === "release" 85 | 86 | // set the libc system interface: "nosys", "semihosting" or "custom" 87 | readonly property string libc_sys : "nosys" 88 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 89 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 90 | 91 | readonly property bool optimize_small : true // use the compiler's "small" code optimizations, otherwise "fast" will be used 92 | readonly property bool lto : false // use link time optimizations 93 | readonly property bool pic : false // position independent code 94 | readonly property bool full_assert : false // enable full assert mode 95 | } 96 | 97 | stm32l0 { 98 | property string basePath : project.sourceDirectory 99 | property string appPath : basePath 100 | property string startupPath : basePath 101 | property string cmsisPath : basePath + "/Drivers/CMSIS" 102 | property string halPath : basePath + "/Drivers/STM32L0xx_HAL_Driver" 103 | property string utilitiesPath : basePath + "/Utilities" 104 | property string audioPath : basePath + "/Middlewares/ST/STM32_Audio" 105 | property string usbDevicePath : basePath + "/Middlewares/ST/STM32_USB_Device_Library" 106 | property string usbHostPath : basePath + "/Middlewares/ST/STM32_USB_Host_Library" 107 | property string stmTouchPath : basePath + "/Middlewares/ST/STM32_TouchSensing_Library" 108 | property string stemwinPath : basePath + "/Middlewares/ST/STemWin" 109 | property string freertosPath : basePath + "/Middlewares/Third_Party/FreeRTOS" 110 | property string fatfsPath : basePath + "/Middlewares/Third_Party/FatFs" 111 | property string libjpegPath : basePath + "/Middlewares/Third_Party/LibJPEG" 112 | property string lwipPath : basePath + "/Middlewares/Third_Party/LwIP" 113 | property string mbedtlsPath : basePath + "/Middlewares/Third_Party/mbedTLS" 114 | property string libPath : basePath + "/Lib" 115 | property string linkerPath : basePath 116 | property string openocdPath : basePath + "/openocd" 117 | property string outPath : basePath + "/bin/" + qbs.buildVariant 118 | property string targetFile : "firmware.elf" 119 | 120 | type: ["application", "elf", "bin", "hex", "assembly", "size"] 121 | name: "firmware" 122 | consoleApplication: true 123 | 124 | cpp.defines: { 125 | var defines = base 126 | 127 | defines.push("STM32") 128 | defines.push("STM32L0") 129 | defines.push(project.microcontroller_series) 130 | 131 | if (project.hal) { 132 | defines.push("USE_HAL_DRIVER") 133 | } 134 | 135 | if (project.ll) { 136 | defines.push("USE_FULL_LL_DRIVER") 137 | } 138 | 139 | if (project.libc_sys === "semihosting") { 140 | defines.push("USING_SEMIHOSTING") 141 | } 142 | 143 | return defines 144 | } 145 | 146 | cpp.includePaths: { 147 | var includePaths = base 148 | 149 | includePaths.push(appPath + "/Inc") 150 | 151 | if (project.cmsis) { 152 | includePaths.push(cmsisPath + "/Include") 153 | includePaths.push(cmsisPath + "/Device/ST/STM32L0xx/Include") 154 | } 155 | 156 | if (project.hal || project.ll) { 157 | includePaths.push(halPath + "/Inc") 158 | includePaths.push(halPath + "/Inc/Legacy") 159 | includePaths.push(halPath + "/Utilities/CPU") 160 | includePaths.push(halPath + "/Utilities/Fonts") 161 | includePaths.push(halPath + "/Utilities/JPEG") 162 | includePaths.push(halPath + "/Utilities/Log") 163 | } 164 | 165 | if (project.audio) { 166 | includePaths.push(audioPath + "/Addons/PDM") 167 | } 168 | 169 | if (project.usb_device) { 170 | includePaths.push(usbDevicePath + "/Core/Inc") 171 | includePaths.push(usbDevicePath + "/Class/AUDIO/Inc") 172 | includePaths.push(usbDevicePath + "/Class/CDC/Inc") 173 | includePaths.push(usbDevicePath + "/Class/CustomHID/Inc") 174 | includePaths.push(usbDevicePath + "/Class/DFU/Inc") 175 | includePaths.push(usbDevicePath + "/Class/HID/Inc") 176 | includePaths.push(usbDevicePath + "/Class/MSC/Inc") 177 | } 178 | 179 | if (project.usb_host) { 180 | includePaths.push(usbHostPath + "/Core/Inc") 181 | includePaths.push(usbHostPath + "/Class/AUDIO/Inc") 182 | includePaths.push(usbHostPath + "/Class/CDC/Inc") 183 | includePaths.push(usbHostPath + "/Class/HID/Inc") 184 | includePaths.push(usbHostPath + "/Class/MSC/Inc") 185 | includePaths.push(usbHostPath + "/Class/MTP/Inc") 186 | } 187 | 188 | if (project.stm_touch) { 189 | includePaths.push(stmTouchPath + "/inc") 190 | } 191 | 192 | if (project.stemwin) { 193 | includePaths.push(stemwinPath + "/Config") 194 | includePaths.push(stemwinPath + "/inc") 195 | } 196 | 197 | if (project.freertos) { 198 | includePaths.push(freertosPath + "/Source/CMSIS_RTOS") 199 | includePaths.push(freertosPath + "/Source/include") 200 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM0") 201 | } 202 | 203 | if (project.fatfs) { 204 | includePaths.push(fatfsPath + "/src") 205 | includePaths.push(fatfsPath + "/src/drivers") 206 | } 207 | 208 | if (project.libjpeg) { 209 | includePaths.push(libjpegPath + "/include") 210 | } 211 | 212 | if (project.lwip) { 213 | includePaths.push(lwipPath + "/src/include") 214 | includePaths.push(lwipPath + "/system") 215 | } 216 | 217 | if (project.mbedtls) { 218 | includePaths.push(mbedtlsPath + "/configs") 219 | includePaths.push(mbedtlsPath + "/include") 220 | } 221 | 222 | if (project.libs) { 223 | includePaths.push(libPath) 224 | } 225 | 226 | return includePaths 227 | } 228 | 229 | cpp.libraryPaths: { 230 | var libraryPaths = base 231 | 232 | if (project.cmsis_math) { 233 | libraryPaths.push(cmsisPath + "/Lib/GCC") 234 | } 235 | 236 | if (project.audio) { 237 | libraryPaths.push(audioPath + "/Addons/PDM") 238 | } 239 | 240 | if (project.stemwin) { 241 | libraryPaths.push(stemwinPath + "/Lib") 242 | } 243 | 244 | return libraryPaths 245 | } 246 | 247 | cpp.staticLibraries: { 248 | var staticLibraries = base 249 | 250 | if (project.libc_sys === "semihosting") { 251 | staticLibraries.push("rdimon") 252 | } else if (project.libc_sys === "nosys") { 253 | staticLibraries.push("nosys") 254 | } 255 | 256 | if (project.cmsis_math) { 257 | staticLibraries.push("arm_cortexM0l_math") 258 | } 259 | 260 | if (project.audio) { 261 | staticLibraries.push("PDMFilter_CM0_GCC") 262 | } 263 | 264 | if (project.stemwin) { 265 | if (project.freertos) { 266 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM0_OS_GCC") 267 | } else { 268 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM0_GCC") 269 | } 270 | } 271 | 272 | staticLibraries.push("gcc") 273 | staticLibraries.push("c") 274 | 275 | if (project.libc_math) { 276 | staticLibraries.push("m") 277 | } 278 | 279 | return staticLibraries 280 | } 281 | 282 | Group { 283 | name: "Startup" 284 | prefix: startupPath 285 | fileTags: ["asm"] 286 | files: [ 287 | "/*.s", 288 | "/*.S" 289 | ] 290 | } 291 | 292 | Group { 293 | name: "App" 294 | prefix: appPath 295 | files: [ 296 | "/Src/**/*.c", 297 | "/Src/**/*.cpp", 298 | "/Inc/**/*.h" 299 | ] 300 | } 301 | 302 | Group { 303 | name: "Drivers/CMSIS" 304 | prefix: cmsisPath 305 | files: [ 306 | "/**/*.h" 307 | ] 308 | excludeFiles: [ 309 | "*template*", 310 | "*Template*" 311 | ] 312 | } 313 | 314 | Group { 315 | condition: project.hal === true || project.ll === true 316 | 317 | name: "Drivers/HAL" 318 | prefix: halPath 319 | files: [ 320 | "/**/*.c", 321 | "/**/*.h" 322 | ] 323 | excludeFiles: [ 324 | "*template*", 325 | "*Template*" 326 | ] 327 | } 328 | 329 | Group { 330 | condition: project.hal === true || project.ll === true 331 | 332 | name: "Utilities" 333 | prefix: utilitiesPath 334 | files: [ 335 | "/**/*.c", 336 | "/**/*.c", 337 | "/**/*.h" 338 | ] 339 | excludeFiles: [ 340 | "*template*", 341 | "*Template*" 342 | ] 343 | } 344 | 345 | Group { 346 | condition: project.audio === true 347 | 348 | name: "Middleware/Audio" 349 | prefix: audioPath 350 | files: [ 351 | "/**/*.c", 352 | "/**/*.h" 353 | ] 354 | excludeFiles: [ 355 | "*template*", 356 | "*Template*" 357 | ] 358 | } 359 | 360 | Group { 361 | condition: project.usb_device === true 362 | 363 | name: "Middleware/USBDevice" 364 | prefix: usbDevicePath 365 | files: [ 366 | "/**/*.c", 367 | "/**/*.h" 368 | ] 369 | excludeFiles: [ 370 | "*template*", 371 | "*Template*" 372 | ] 373 | } 374 | 375 | Group { 376 | condition: project.usb_host === true 377 | 378 | name: "Middleware/USBHost" 379 | prefix: usbHostPath 380 | files: [ 381 | "/**/*.c", 382 | "/**/*.h" 383 | ] 384 | excludeFiles: [ 385 | "*template*", 386 | "*Template*" 387 | ] 388 | } 389 | 390 | Group { 391 | condition: project.stm_touch === true 392 | 393 | name: "Middleware/STMTouch" 394 | prefix: usbDevicePath 395 | files: [ 396 | "/src/*.c", 397 | "/inc/*.h" 398 | ] 399 | excludeFiles: [ 400 | "*template*", 401 | "*Template*" 402 | ] 403 | } 404 | 405 | Group { 406 | condition: project.stemwin === true 407 | 408 | name: "Middleware/STemWin" 409 | prefix: stemwinPath 410 | files: [ 411 | "/Config/**/*.c", 412 | "/Config/**/*.h", 413 | "/OS/**/*.c", 414 | "/OS/**/*.h", 415 | "/inc/**/*.h" 416 | ] 417 | excludeFiles: [ 418 | "*template*", 419 | "*Template*" 420 | ] 421 | } 422 | 423 | Group { 424 | condition: project.freertos === true 425 | 426 | name: "Middleware/FreeRTOS" 427 | prefix: freertosPath 428 | files: [ 429 | "/Source/**/*.c", 430 | "/Source/**/*.h" 431 | ] 432 | excludeFiles: [ 433 | "*template*", 434 | "*Template*" 435 | ] 436 | } 437 | 438 | Group { 439 | condition: project.fatfs === true 440 | 441 | name: "Middleware/FatFs" 442 | prefix: fatfsPath 443 | files: [ 444 | "/src/**/*.c", 445 | "/src/**/*.h" 446 | ] 447 | excludeFiles: [ 448 | "*template*", 449 | "*Template*" 450 | ] 451 | } 452 | 453 | Group { 454 | condition: project.libjpeg === true 455 | 456 | name: "Middleware/LibJPEG" 457 | prefix: libjpegPath 458 | files: [ 459 | "/include/**/*.h", 460 | "/source/**/*.c" 461 | ] 462 | excludeFiles: [ 463 | "*template*", 464 | "*Template*" 465 | ] 466 | } 467 | 468 | Group { 469 | condition: project.lwip === true 470 | 471 | name: "Middleware/LwIP" 472 | prefix: lwipPath 473 | files: [ 474 | "/src/**/*.c", 475 | "/src/**/*.h", 476 | "/system/**/*.c", 477 | "/system/**/*.h" 478 | ] 479 | excludeFiles: [ 480 | "*template*", 481 | "*Template*" 482 | ] 483 | } 484 | 485 | Group { 486 | condition: project.mbedtls === true 487 | 488 | name: "Middleware/mbedTLS" 489 | prefix: lwipPath 490 | files: [ 491 | "/configs/*.h", 492 | "/include/**/*.h", 493 | "/library/**/*.c" 494 | ] 495 | excludeFiles: [ 496 | "*template*", 497 | "*Template*" 498 | ] 499 | } 500 | 501 | Group { 502 | condition: project.libs === true 503 | 504 | name: "Lib" 505 | prefix: libPath 506 | files: [ 507 | "/**/*.c", 508 | "/**/*.cpp", 509 | "/**/*.h" 510 | ] 511 | excludeFiles: [ 512 | "*template*", 513 | "*Template*" 514 | ] 515 | } 516 | 517 | Group { 518 | name: "Linker" 519 | prefix: linkerPath 520 | fileTags: ["linkerscript"] 521 | files: [ 522 | "/*.ld" 523 | ] 524 | } 525 | 526 | Group { 527 | name: "OpenOCD" 528 | prefix: openocdPath 529 | files: [ 530 | "/*.cfg" 531 | ] 532 | } 533 | } 534 | } 535 | -------------------------------------------------------------------------------- /template-stm32f1/template-stm32f1.qbs: -------------------------------------------------------------------------------- 1 | /* 2 | * qube - Qt Creator BareMetal QBS Templates for STM32CubeMX 3 | * 4 | * Copyright (c) 2017-2018 0xebef, all rights reserved, https://github.com/0xebef 5 | * 6 | * License: MIT 7 | */ 8 | 9 | import qbs 10 | import "qbs/stm32f1.qbs" as stm32f1 11 | 12 | Project { 13 | minimumQbsVersion: "1.6" 14 | 15 | /* 16 | * microcontroller series 17 | * 18 | * supported definitions are: 19 | * - STM32F100xB 20 | * - STM32F100xE 21 | * - STM32F101x6 22 | * - STM32F101xB 23 | * - STM32F101xE 24 | * - STM32F101xG 25 | * - STM32F102x6 26 | * - STM32F102xB 27 | * - STM32F103x6 28 | * - STM32F103xB 29 | * - STM32F103xE 30 | * - STM32F103xG 31 | * - STM32F105xC 32 | * - STM32F107xC 33 | */ 34 | readonly property string microcontroller_series: "STM32F100xB" 35 | 36 | /* 37 | * common properties for all build types 38 | */ 39 | readonly property string c_std : "gnu11" 40 | readonly property string cpp_std : "gnu++14" 41 | readonly property bool libc : true // use the Newlib C Standard library 42 | readonly property bool libc_nano : true // use the Newlib Nano specs 43 | readonly property bool libc_math : false // use the Standard Math library 44 | readonly property bool cmsis : true // use the CMSIS library 45 | readonly property bool cmsis_math : false // use the CMSIS Math library (DSP) 46 | readonly property bool hal : true // use ST's HAL library 47 | readonly property bool ll : true // use ST's LL library 48 | readonly property bool audio : false // use ST's Audio library 49 | readonly property bool usb_device : false // use ST's USB Device library 50 | readonly property bool usb_host : false // use ST's USB Host library 51 | readonly property bool stm_touch : false // use ST's STMTouch library 52 | readonly property bool stemwin : false // use ST's STemWin library 53 | readonly property string stemwin_v : "532" // ST's STemWin library version 54 | readonly property bool freertos : false // use the FreeRTOS real-time operating system 55 | readonly property bool mpu : false // use the MPU in FreeRTOS 56 | readonly property bool fatfs : false // use ChaN's FatFs library 57 | readonly property bool libjpeg : false // use the LibJPEG library 58 | readonly property bool lwip : false // use the LwIP library 59 | readonly property bool mbedtls : false // use the mbedTLS library 60 | readonly property bool libs : false // use own libraries in /Lib 61 | 62 | /* 63 | * properties for the debug build 64 | */ 65 | Properties { 66 | condition: qbs.buildVariant === "debug" 67 | 68 | // set the libc system interface: "nosys", "semihosting" or "custom" 69 | readonly property string libc_sys : "nosys" 70 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 71 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 72 | 73 | readonly property bool optimize_small : false // use the compiler's "small" code optimizations, otherwise "none" will be used 74 | readonly property bool lto : false // use link time optimizations 75 | readonly property bool pic : false // position independent code 76 | readonly property bool full_assert : true // enable full assert mode 77 | } 78 | 79 | /* 80 | * properties for the release build 81 | */ 82 | Properties { 83 | condition: qbs.buildVariant === "release" 84 | 85 | // set the libc system interface: "nosys", "semihosting" or "custom" 86 | readonly property string libc_sys : "nosys" 87 | readonly property bool libc_printf_float : false // enable float support for printed formatted strings 88 | readonly property bool libc_scanf_float : false // enable float support for scanned formatted strings 89 | 90 | readonly property bool optimize_small : true // use the compiler's "small" code optimizations, otherwise "fast" will be used 91 | readonly property bool lto : false // use link time optimizations 92 | readonly property bool pic : false // position independent code 93 | readonly property bool full_assert : false // enable full assert mode 94 | } 95 | 96 | stm32f1 { 97 | property string basePath : project.sourceDirectory 98 | property string appPath : basePath 99 | property string startupPath : basePath 100 | property string cmsisPath : basePath + "/Drivers/CMSIS" 101 | property string halPath : basePath + "/Drivers/STM32F1xx_HAL_Driver" 102 | property string utilitiesPath : basePath + "/Utilities" 103 | property string audioPath : basePath + "/Middlewares/ST/STM32_Audio" 104 | property string usbDevicePath : basePath + "/Middlewares/ST/STM32_USB_Device_Library" 105 | property string usbHostPath : basePath + "/Middlewares/ST/STM32_USB_Host_Library" 106 | property string stmTouchPath : basePath + "/Middlewares/ST/STM32_TouchSensing_Library" 107 | property string stemwinPath : basePath + "/Middlewares/ST/STemWin" 108 | property string freertosPath : basePath + "/Middlewares/Third_Party/FreeRTOS" 109 | property string fatfsPath : basePath + "/Middlewares/Third_Party/FatFs" 110 | property string libjpegPath : basePath + "/Middlewares/Third_Party/LibJPEG" 111 | property string lwipPath : basePath + "/Middlewares/Third_Party/LwIP" 112 | property string mbedtlsPath : basePath + "/Middlewares/Third_Party/mbedTLS" 113 | property string libPath : basePath + "/Lib" 114 | property string linkerPath : basePath 115 | property string openocdPath : basePath + "/openocd" 116 | property string outPath : basePath + "/bin/" + qbs.buildVariant 117 | property string targetFile : "firmware.elf" 118 | 119 | type: ["application", "elf", "bin", "hex", "assembly", "size"] 120 | name: "firmware" 121 | consoleApplication: true 122 | 123 | cpp.defines: { 124 | var defines = base 125 | 126 | defines.push("STM32") 127 | defines.push("STM32F1") 128 | defines.push(project.microcontroller_series) 129 | 130 | if (project.hal) { 131 | defines.push("USE_HAL_DRIVER") 132 | } 133 | 134 | if (project.ll) { 135 | defines.push("USE_FULL_LL_DRIVER") 136 | } 137 | 138 | if (project.libc_sys === "semihosting") { 139 | defines.push("USING_SEMIHOSTING") 140 | } 141 | 142 | return defines 143 | } 144 | 145 | cpp.includePaths: { 146 | var includePaths = base 147 | 148 | includePaths.push(appPath + "/Inc") 149 | 150 | if (project.cmsis) { 151 | includePaths.push(cmsisPath + "/Include") 152 | includePaths.push(cmsisPath + "/Device/ST/STM32F1xx/Include") 153 | } 154 | 155 | if (project.hal || project.ll) { 156 | includePaths.push(halPath + "/Inc") 157 | includePaths.push(halPath + "/Inc/Legacy") 158 | includePaths.push(halPath + "/Utilities/CPU") 159 | includePaths.push(halPath + "/Utilities/Fonts") 160 | includePaths.push(halPath + "/Utilities/JPEG") 161 | includePaths.push(halPath + "/Utilities/Log") 162 | } 163 | 164 | if (project.audio) { 165 | includePaths.push(audioPath + "/Addons/PDM") 166 | } 167 | 168 | if (project.usb_device) { 169 | includePaths.push(usbDevicePath + "/Core/Inc") 170 | includePaths.push(usbDevicePath + "/Class/AUDIO/Inc") 171 | includePaths.push(usbDevicePath + "/Class/CDC/Inc") 172 | includePaths.push(usbDevicePath + "/Class/CustomHID/Inc") 173 | includePaths.push(usbDevicePath + "/Class/DFU/Inc") 174 | includePaths.push(usbDevicePath + "/Class/HID/Inc") 175 | includePaths.push(usbDevicePath + "/Class/MSC/Inc") 176 | } 177 | 178 | if (project.usb_host) { 179 | includePaths.push(usbHostPath + "/Core/Inc") 180 | includePaths.push(usbHostPath + "/Class/AUDIO/Inc") 181 | includePaths.push(usbHostPath + "/Class/CDC/Inc") 182 | includePaths.push(usbHostPath + "/Class/HID/Inc") 183 | includePaths.push(usbHostPath + "/Class/MSC/Inc") 184 | includePaths.push(usbHostPath + "/Class/MTP/Inc") 185 | } 186 | 187 | if (project.stm_touch) { 188 | includePaths.push(stmTouchPath + "/inc") 189 | } 190 | 191 | if (project.stemwin) { 192 | includePaths.push(stemwinPath + "/Config") 193 | includePaths.push(stemwinPath + "/inc") 194 | } 195 | 196 | if (project.freertos) { 197 | includePaths.push(freertosPath + "/Source/CMSIS_RTOS") 198 | includePaths.push(freertosPath + "/Source/include") 199 | if (project.mpu) { 200 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM3_MPU") 201 | } else { 202 | includePaths.push(freertosPath + "/Source/portable/GCC/ARM_CM3") 203 | } 204 | } 205 | 206 | if (project.fatfs) { 207 | includePaths.push(fatfsPath + "/src") 208 | includePaths.push(fatfsPath + "/src/drivers") 209 | } 210 | 211 | if (project.libjpeg) { 212 | includePaths.push(libjpegPath + "/include") 213 | } 214 | 215 | if (project.lwip) { 216 | includePaths.push(lwipPath + "/src/include") 217 | includePaths.push(lwipPath + "/system") 218 | } 219 | 220 | if (project.mbedtls) { 221 | includePaths.push(mbedtlsPath + "/configs") 222 | includePaths.push(mbedtlsPath + "/include") 223 | } 224 | 225 | if (project.libs) { 226 | includePaths.push(libPath) 227 | } 228 | 229 | return includePaths 230 | } 231 | 232 | cpp.libraryPaths: { 233 | var libraryPaths = base 234 | 235 | if (project.cmsis_math) { 236 | libraryPaths.push(cmsisPath + "/Lib/GCC") 237 | } 238 | 239 | if (project.audio) { 240 | libraryPaths.push(audioPath + "/Addons/PDM") 241 | } 242 | 243 | if (project.stemwin) { 244 | libraryPaths.push(stemwinPath + "/Lib") 245 | } 246 | 247 | return libraryPaths 248 | } 249 | 250 | cpp.staticLibraries: { 251 | var staticLibraries = base 252 | 253 | if (project.libc_sys === "semihosting") { 254 | staticLibraries.push("rdimon") 255 | } else if (project.libc_sys === "nosys") { 256 | staticLibraries.push("nosys") 257 | } 258 | 259 | if (project.cmsis_math) { 260 | staticLibraries.push("arm_cortexM3l_math") 261 | } 262 | 263 | if (project.audio) { 264 | staticLibraries.push("PDMFilter_CM3_GCC") 265 | } 266 | 267 | if (project.stemwin) { 268 | if (project.freertos) { 269 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM3_OS_GCC") 270 | } else { 271 | staticLibraries.push("STemWin" + project.stemwin_v + "_CM3_GCC") 272 | } 273 | } 274 | 275 | staticLibraries.push("gcc") 276 | staticLibraries.push("c") 277 | 278 | if (project.libc_math) { 279 | staticLibraries.push("m") 280 | } 281 | 282 | return staticLibraries 283 | } 284 | 285 | Group { 286 | name: "Startup" 287 | prefix: startupPath 288 | fileTags: ["asm"] 289 | files: [ 290 | "/*.s", 291 | "/*.S" 292 | ] 293 | } 294 | 295 | Group { 296 | name: "App" 297 | prefix: appPath 298 | files: [ 299 | "/Src/**/*.c", 300 | "/Src/**/*.cpp", 301 | "/Inc/**/*.h" 302 | ] 303 | } 304 | 305 | Group { 306 | name: "Drivers/CMSIS" 307 | prefix: cmsisPath 308 | files: [ 309 | "/**/*.h" 310 | ] 311 | excludeFiles: [ 312 | "*template*", 313 | "*Template*" 314 | ] 315 | } 316 | 317 | Group { 318 | condition: project.hal === true || project.ll === true 319 | 320 | name: "Drivers/HAL" 321 | prefix: halPath 322 | files: [ 323 | "/**/*.c", 324 | "/**/*.h" 325 | ] 326 | excludeFiles: [ 327 | "*template*", 328 | "*Template*" 329 | ] 330 | } 331 | 332 | Group { 333 | condition: project.hal === true || project.ll === true 334 | 335 | name: "Utilities" 336 | prefix: utilitiesPath 337 | files: [ 338 | "/**/*.c", 339 | "/**/*.c", 340 | "/**/*.h" 341 | ] 342 | excludeFiles: [ 343 | "*template*", 344 | "*Template*" 345 | ] 346 | } 347 | 348 | Group { 349 | condition: project.audio === true 350 | 351 | name: "Middleware/Audio" 352 | prefix: audioPath 353 | files: [ 354 | "/**/*.c", 355 | "/**/*.h" 356 | ] 357 | excludeFiles: [ 358 | "*template*", 359 | "*Template*" 360 | ] 361 | } 362 | 363 | Group { 364 | condition: project.usb_device === true 365 | 366 | name: "Middleware/USBDevice" 367 | prefix: usbDevicePath 368 | files: [ 369 | "/**/*.c", 370 | "/**/*.h" 371 | ] 372 | excludeFiles: [ 373 | "*template*", 374 | "*Template*" 375 | ] 376 | } 377 | 378 | Group { 379 | condition: project.usb_host === true 380 | 381 | name: "Middleware/USBHost" 382 | prefix: usbHostPath 383 | files: [ 384 | "/**/*.c", 385 | "/**/*.h" 386 | ] 387 | excludeFiles: [ 388 | "*template*", 389 | "*Template*" 390 | ] 391 | } 392 | 393 | Group { 394 | condition: project.stm_touch === true 395 | 396 | name: "Middleware/STMTouch" 397 | prefix: usbDevicePath 398 | files: [ 399 | "/src/*.c", 400 | "/inc/*.h" 401 | ] 402 | excludeFiles: [ 403 | "*template*", 404 | "*Template*" 405 | ] 406 | } 407 | 408 | Group { 409 | condition: project.stemwin === true 410 | 411 | name: "Middleware/STemWin" 412 | prefix: stemwinPath 413 | files: [ 414 | "/Config/**/*.c", 415 | "/Config/**/*.h", 416 | "/OS/**/*.c", 417 | "/OS/**/*.h", 418 | "/inc/**/*.h" 419 | ] 420 | excludeFiles: [ 421 | "*template*", 422 | "*Template*" 423 | ] 424 | } 425 | 426 | Group { 427 | condition: project.freertos === true 428 | 429 | name: "Middleware/FreeRTOS" 430 | prefix: freertosPath 431 | files: [ 432 | "/Source/**/*.c", 433 | "/Source/**/*.h" 434 | ] 435 | excludeFiles: [ 436 | "*template*", 437 | "*Template*" 438 | ] 439 | } 440 | 441 | Group { 442 | condition: project.fatfs === true 443 | 444 | name: "Middleware/FatFs" 445 | prefix: fatfsPath 446 | files: [ 447 | "/src/**/*.c", 448 | "/src/**/*.h" 449 | ] 450 | excludeFiles: [ 451 | "*template*", 452 | "*Template*" 453 | ] 454 | } 455 | 456 | Group { 457 | condition: project.libjpeg === true 458 | 459 | name: "Middleware/LibJPEG" 460 | prefix: libjpegPath 461 | files: [ 462 | "/include/**/*.h", 463 | "/source/**/*.c" 464 | ] 465 | excludeFiles: [ 466 | "*template*", 467 | "*Template*" 468 | ] 469 | } 470 | 471 | Group { 472 | condition: project.lwip === true 473 | 474 | name: "Middleware/LwIP" 475 | prefix: lwipPath 476 | files: [ 477 | "/src/**/*.c", 478 | "/src/**/*.h", 479 | "/system/**/*.c", 480 | "/system/**/*.h" 481 | ] 482 | excludeFiles: [ 483 | "*template*", 484 | "*Template*" 485 | ] 486 | } 487 | 488 | Group { 489 | condition: project.mbedtls === true 490 | 491 | name: "Middleware/mbedTLS" 492 | prefix: lwipPath 493 | files: [ 494 | "/configs/*.h", 495 | "/include/**/*.h", 496 | "/library/**/*.c" 497 | ] 498 | excludeFiles: [ 499 | "*template*", 500 | "*Template*" 501 | ] 502 | } 503 | 504 | Group { 505 | condition: project.libs === true 506 | 507 | name: "Lib" 508 | prefix: libPath 509 | files: [ 510 | "/**/*.c", 511 | "/**/*.cpp", 512 | "/**/*.h" 513 | ] 514 | excludeFiles: [ 515 | "*template*", 516 | "*Template*" 517 | ] 518 | } 519 | 520 | Group { 521 | name: "Linker" 522 | prefix: linkerPath 523 | fileTags: ["linkerscript"] 524 | files: [ 525 | "/*.ld" 526 | ] 527 | } 528 | 529 | Group { 530 | name: "OpenOCD" 531 | prefix: openocdPath 532 | files: [ 533 | "/*.cfg" 534 | ] 535 | } 536 | } 537 | } 538 | --------------------------------------------------------------------------------