aboutsummaryrefslogtreecommitdiffstats
path: root/examples/baremetal
diff options
context:
space:
mode:
Diffstat (limited to 'examples/baremetal')
-rw-r--r--examples/baremetal/at90can128olimex/at90can128olimex.qbs2
-rw-r--r--examples/baremetal/at90can128olimex/redblink/README.md2
-rw-r--r--examples/baremetal/at90can128olimex/redblink/redblink.qbs2
-rw-r--r--examples/baremetal/baremetal.qbs8
-rw-r--r--examples/baremetal/cc2540usbdongle/cc2540usbdongle.qbs2
-rw-r--r--examples/baremetal/cc2540usbdongle/greenblink/greenblink.qbs2
-rw-r--r--examples/baremetal/cc2540usbdongle/greenblink/system.h3
-rw-r--r--examples/baremetal/cy7c68013a/cy7c68013a.qbs2
-rw-r--r--examples/baremetal/cy7c68013a/nes-gamepads/nes-gamepads.qbs2
-rw-r--r--examples/baremetal/esp8266/README.md34
-rw-r--r--examples/baremetal/esp8266/access-point/access-point.qbs28
-rw-r--r--examples/baremetal/esp8266/access-point/user_config.h62
-rw-r--r--examples/baremetal/esp8266/access-point/user_main.c105
-rw-r--r--examples/baremetal/esp8266/esp8266.qbs57
-rw-r--r--examples/baremetal/esp8266/qbs/imports/Esp8266SdkProbe.qbs25
-rw-r--r--examples/baremetal/esp8266/qbs/modules/esp8266_sdk/Esp8266SdkModule.qbs66
-rw-r--r--examples/baremetal/msp430f5529/msp430f5529.qbs2
-rw-r--r--examples/baremetal/msp430f5529/nes-gamepads/nes-gamepads.qbs2
-rw-r--r--examples/baremetal/msp430f5529/redblink/README.md2
-rw-r--r--examples/baremetal/msp430f5529/redblink/redblink.qbs2
-rw-r--r--examples/baremetal/pca10001/greenblink/README.md10
-rw-r--r--examples/baremetal/pca10001/greenblink/gcc/flash.ld150
-rw-r--r--examples/baremetal/pca10001/greenblink/gcc/startup.s173
-rw-r--r--examples/baremetal/pca10001/greenblink/gpio.c96
-rw-r--r--examples/baremetal/pca10001/greenblink/gpio.h65
-rw-r--r--examples/baremetal/pca10001/greenblink/greenblink.qbs170
-rw-r--r--examples/baremetal/pca10001/greenblink/iar/flash.icf73
-rw-r--r--examples/baremetal/pca10001/greenblink/iar/startup.s124
-rw-r--r--examples/baremetal/pca10001/greenblink/keil/flash.sct65
-rw-r--r--examples/baremetal/pca10001/greenblink/keil/startup.s134
-rw-r--r--examples/baremetal/pca10001/greenblink/main.c69
-rw-r--r--examples/baremetal/pca10001/greenblink/system.h82
-rw-r--r--examples/baremetal/pca10001/pca10001.qbs56
-rw-r--r--examples/baremetal/pca10040/greenblink/README.md10
-rw-r--r--examples/baremetal/pca10040/greenblink/gcc/flash.ld151
-rw-r--r--examples/baremetal/pca10040/greenblink/gcc/startup.s253
-rw-r--r--examples/baremetal/pca10040/greenblink/gpio.c96
-rw-r--r--examples/baremetal/pca10040/greenblink/gpio.h65
-rw-r--r--examples/baremetal/pca10040/greenblink/greenblink.qbs176
-rw-r--r--examples/baremetal/pca10040/greenblink/iar/flash.icf102
-rw-r--r--examples/baremetal/pca10040/greenblink/iar/startup.s202
-rw-r--r--examples/baremetal/pca10040/greenblink/keil/flash.sct65
-rw-r--r--examples/baremetal/pca10040/greenblink/keil/startup.s215
-rw-r--r--examples/baremetal/pca10040/greenblink/main.c69
-rw-r--r--examples/baremetal/pca10040/greenblink/system.h84
-rw-r--r--examples/baremetal/pca10040/pca10040.qbs56
-rw-r--r--examples/baremetal/stm32f103/greenblink/README.md10
-rw-r--r--examples/baremetal/stm32f103/greenblink/gcc/flash.ld172
-rw-r--r--examples/baremetal/stm32f103/greenblink/gcc/startup.s177
-rw-r--r--examples/baremetal/stm32f103/greenblink/gpio.c83
-rw-r--r--examples/baremetal/stm32f103/greenblink/gpio.h65
-rw-r--r--examples/baremetal/stm32f103/greenblink/greenblink.qbs172
-rw-r--r--examples/baremetal/stm32f103/greenblink/iar/flash.icf74
-rw-r--r--examples/baremetal/stm32f103/greenblink/iar/startup.s132
-rw-r--r--examples/baremetal/stm32f103/greenblink/keil/flash.sct65
-rw-r--r--examples/baremetal/stm32f103/greenblink/keil/startup.s145
-rw-r--r--examples/baremetal/stm32f103/greenblink/main.c69
-rw-r--r--examples/baremetal/stm32f103/greenblink/system.h102
-rw-r--r--examples/baremetal/stm32f103/stm32f103.qbs56
-rw-r--r--examples/baremetal/stm32f4discovery/blueblink/blueblink.qbs23
-rw-r--r--examples/baremetal/stm32f4discovery/stm32f4discovery.qbs2
-rw-r--r--examples/baremetal/stm8s103f3/redblink/redblink.qbs2
-rw-r--r--examples/baremetal/stm8s103f3/stm8s103f3.qbs2
63 files changed, 4537 insertions, 35 deletions
diff --git a/examples/baremetal/at90can128olimex/at90can128olimex.qbs b/examples/baremetal/at90can128olimex/at90can128olimex.qbs
index dc1760fe9..2c206f7cc 100644
--- a/examples/baremetal/at90can128olimex/at90can128olimex.qbs
+++ b/examples/baremetal/at90can128olimex/at90can128olimex.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for Olimex AVR-CAN board"
references: [
diff --git a/examples/baremetal/at90can128olimex/redblink/README.md b/examples/baremetal/at90can128olimex/redblink/README.md
index 0e9710e57..cbf51898d 100644
--- a/examples/baremetal/at90can128olimex/redblink/README.md
+++ b/examples/baremetal/at90can128olimex/redblink/README.md
@@ -1,4 +1,4 @@
-This examples demonstrates how to build a bare-metal application using
+This example demonstrates how to build a bare-metal application using
different AVR toolchains. It is designed for the OLIMEX AVR-CAN target
board (based on at90can128 chip) and simply flashes the red LED on the
board.
diff --git a/examples/baremetal/at90can128olimex/redblink/redblink.qbs b/examples/baremetal/at90can128olimex/redblink/redblink.qbs
index 84323e3c1..afdbe46f7 100644
--- a/examples/baremetal/at90can128olimex/redblink/redblink.qbs
+++ b/examples/baremetal/at90can128olimex/redblink/redblink.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("avr"))
diff --git a/examples/baremetal/baremetal.qbs b/examples/baremetal/baremetal.qbs
index eba504512..0d71968b6 100644
--- a/examples/baremetal/baremetal.qbs
+++ b/examples/baremetal/baremetal.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "BareMetal"
references: [
@@ -58,6 +56,10 @@ Project {
"cc2540usbdongle/cc2540usbdongle.qbs",
"stm8s103f3/stm8s103f3.qbs",
"msp430f5529/msp430f5529.qbs",
- "cy7c68013a/cy7c68013a.qbs"
+ "cy7c68013a/cy7c68013a.qbs",
+ "stm32f103/stm32f103.qbs",
+ "pca10040/pca10040.qbs",
+ "pca10001/pca10001.qbs",
+ "esp8266/esp8266.qbs",
]
}
diff --git a/examples/baremetal/cc2540usbdongle/cc2540usbdongle.qbs b/examples/baremetal/cc2540usbdongle/cc2540usbdongle.qbs
index 52e1948eb..6cb99e6a4 100644
--- a/examples/baremetal/cc2540usbdongle/cc2540usbdongle.qbs
+++ b/examples/baremetal/cc2540usbdongle/cc2540usbdongle.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for cc2540usbdongle board"
references: [
diff --git a/examples/baremetal/cc2540usbdongle/greenblink/greenblink.qbs b/examples/baremetal/cc2540usbdongle/greenblink/greenblink.qbs
index e8aa3d1fd..d1d3281a9 100644
--- a/examples/baremetal/cc2540usbdongle/greenblink/greenblink.qbs
+++ b/examples/baremetal/cc2540usbdongle/greenblink/greenblink.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("mcs51"))
diff --git a/examples/baremetal/cc2540usbdongle/greenblink/system.h b/examples/baremetal/cc2540usbdongle/greenblink/system.h
index cdc6302d4..4f105dbd0 100644
--- a/examples/baremetal/cc2540usbdongle/greenblink/system.h
+++ b/examples/baremetal/cc2540usbdongle/greenblink/system.h
@@ -66,6 +66,9 @@ extern "C" {
#elif defined (__SDCC_mcs51)
#include <mcs51/compiler.h>
# define DEFINE_SFR(name, addr) __sfr __at(addr) name;
+# ifndef NOP
+# define NOP() __asm NOP __endasm
+# endif
# define system_nop() NOP()
#else
#error "Unsupported toolchain"
diff --git a/examples/baremetal/cy7c68013a/cy7c68013a.qbs b/examples/baremetal/cy7c68013a/cy7c68013a.qbs
index 370844725..dca261d70 100644
--- a/examples/baremetal/cy7c68013a/cy7c68013a.qbs
+++ b/examples/baremetal/cy7c68013a/cy7c68013a.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for cy7c68013a board"
references: [
diff --git a/examples/baremetal/cy7c68013a/nes-gamepads/nes-gamepads.qbs b/examples/baremetal/cy7c68013a/nes-gamepads/nes-gamepads.qbs
index 0d7994033..81566ff96 100644
--- a/examples/baremetal/cy7c68013a/nes-gamepads/nes-gamepads.qbs
+++ b/examples/baremetal/cy7c68013a/nes-gamepads/nes-gamepads.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("mcs51"))
diff --git a/examples/baremetal/esp8266/README.md b/examples/baremetal/esp8266/README.md
new file mode 100644
index 000000000..a9b4ef92d
--- /dev/null
+++ b/examples/baremetal/esp8266/README.md
@@ -0,0 +1,34 @@
+This example demonstrates how to build a bare-metal application using
+GCC toolchain for Espressif ESP8266-WROOM02 MCU.
+
+An application is designed to be flashed on the external SPI FLASH
+with the following parameters:
+
+ * SPI FLASH size: 16 MBit (2048 + 2048 KBytes)
+ * SPI FLASH mode: DIO
+ * SPI FLASH clock: 40 MHz
+ * SPI FLASH map type: 5
+
+An application is running as WiFi access point that discards all
+connection attempts, and has the following WiFi parameters:
+ * SSID: "HELLO FROM QBS"
+ * Authentication mode: "open"
+ * Beacon interval: 1000 milliseconds
+ * Channel number: 3
+
+An application requires the ESP8266 NON-OS SDK:
+
+ * https://github.com/espressif/ESP8266_NONOS_SDK
+
+the path to which should be set via the ESP8266_NON_OS_SDK_ROOT
+environment variable.
+
+To convert the ELF application to the final binary image (and also for
+re-program the ESP8266 MCU), you can use the open source 'esptool'
+utility (using the SPI FLASH parameters, provided above):
+
+ * https://github.com/espressif/esptool
+
+The following toolchains are supported:
+
+ * GNU ESP8266 Toolchain
diff --git a/examples/baremetal/esp8266/access-point/access-point.qbs b/examples/baremetal/esp8266/access-point/access-point.qbs
new file mode 100644
index 000000000..e9b06c340
--- /dev/null
+++ b/examples/baremetal/esp8266/access-point/access-point.qbs
@@ -0,0 +1,28 @@
+CppApplication {
+ condition: qbs.toolchain.contains("gcc") && qbs.architecture === "xtensa"
+
+ Depends { name: "esp8266_sdk" }
+
+ cpp.cLanguageVersion: "c99"
+ cpp.positionIndependentCode: false
+
+ // This required because ESP8266 SDK includes this 'user_config.h' internally.
+ cpp.includePaths: ["."]
+
+ cpp.staticLibraries: [
+ "c",
+ "crypto",
+ "gcc",
+ "lwip",
+ "main",
+ "net80211",
+ "phy",
+ "pp",
+ "wpa"
+ ]
+
+ files: [
+ "user_config.h",
+ "user_main.c"
+ ]
+}
diff --git a/examples/baremetal/esp8266/access-point/user_config.h b/examples/baremetal/esp8266/access-point/user_config.h
new file mode 100644
index 000000000..307f93dd5
--- /dev/null
+++ b/examples/baremetal/esp8266/access-point/user_config.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ESP8266_USER_CONFIG_H
+#define ESP8266_USER_CONFIG_H
+
+// From ESP8266 SDK.
+#include <user_interface.h>
+
+#define ESP_SSID_CFG "HELLO FROM QBS\0"
+#define ESP_AUTO_MODE_CFG (AUTH_OPEN)
+#define ESP_BEACON_INTERVAL_MS_CFG (1000)
+#define ESP_CHANNEL_NO_CFG (3)
+
+#endif // ESP8266_USER_CONFIG_H
diff --git a/examples/baremetal/esp8266/access-point/user_main.c b/examples/baremetal/esp8266/access-point/user_main.c
new file mode 100644
index 000000000..be2a8e92d
--- /dev/null
+++ b/examples/baremetal/esp8266/access-point/user_main.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "user_config.h"
+
+// From ESP8266 SDK.
+#include <osapi.h>
+
+static const partition_item_t esp_partitions[] = {
+ {SYSTEM_PARTITION_BOOTLOADER, ESP_PART_BL_ADDR, ESP_PART_BOOTLOADER_SIZE},
+ {SYSTEM_PARTITION_OTA_1, ESP_PART_APP1_ADDR, ESP_PART_APPLICATION_SIZE},
+ {SYSTEM_PARTITION_OTA_2, ESP_PART_APP2_ADDR, ESP_PART_APPLICATION_SIZE},
+ {SYSTEM_PARTITION_RF_CAL, ESP_PART_RF_CAL_ADDR, ESP_PART_RF_CAL_SIZE},
+ {SYSTEM_PARTITION_PHY_DATA, ESP_PART_PHY_DATA_ADDR, ESP_PART_PHY_DATA_SIZE},
+ {SYSTEM_PARTITION_SYSTEM_PARAMETER, ESP_PART_SYS_PARAM_ADDR, ESP_PART_SYS_PARAM_SIZE}
+};
+
+enum {
+ ESP_PART_COUNT = sizeof(esp_partitions) / sizeof(esp_partitions[0])
+};
+
+LOCAL void ICACHE_FLASH_ATTR user_init_done(void)
+{
+ os_printf("esp: initialization completed\n");
+}
+
+void ICACHE_FLASH_ATTR user_pre_init(void)
+{
+ const bool ok = system_partition_table_regist(esp_partitions, ESP_PART_COUNT, SPI_FLASH_SIZE_MAP);
+ if (!ok) {
+ os_printf("esp: partitions registration failed\n");
+ while (true);
+ }
+}
+
+void ICACHE_FLASH_ATTR user_init(void)
+{
+ os_printf("esp: SDK version: %s\n", system_get_sdk_version());
+ os_printf("esp: reset reason: %u\n", system_get_rst_info()->reason);
+
+ const bool ok = wifi_set_opmode(SOFTAP_MODE);
+ if (!ok) {
+ os_printf("esp: set softap mode failed\n");
+ } else {
+ struct softap_config ap_cfg = {0};
+ ap_cfg.authmode = ESP_AUTO_MODE_CFG;
+ ap_cfg.beacon_interval = ESP_BEACON_INTERVAL_MS_CFG;
+ ap_cfg.channel = ESP_CHANNEL_NO_CFG;
+ ap_cfg.max_connection = 0;
+ ap_cfg.ssid_hidden = false;
+ os_memcpy(&ap_cfg.ssid, ESP_SSID_CFG, sizeof(ESP_SSID_CFG));
+ const bool ok = wifi_softap_set_config(&ap_cfg);
+ if (!ok)
+ os_printf("esp: set softap configuration failed\n");
+ }
+
+ system_init_done_cb(user_init_done);
+}
diff --git a/examples/baremetal/esp8266/esp8266.qbs b/examples/baremetal/esp8266/esp8266.qbs
new file mode 100644
index 000000000..faa74434e
--- /dev/null
+++ b/examples/baremetal/esp8266/esp8266.qbs
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+Project {
+ name: "Examples for esp8266-wroom-02 board"
+ qbsSearchPaths: "qbs"
+ references: [
+ "access-point/access-point.qbs"
+ ]
+}
diff --git a/examples/baremetal/esp8266/qbs/imports/Esp8266SdkProbe.qbs b/examples/baremetal/esp8266/qbs/imports/Esp8266SdkProbe.qbs
new file mode 100644
index 000000000..faa8b1efd
--- /dev/null
+++ b/examples/baremetal/esp8266/qbs/imports/Esp8266SdkProbe.qbs
@@ -0,0 +1,25 @@
+import qbs.Environment
+import qbs.File
+import qbs.FileInfo
+import qbs.Probes
+
+Probes.PathProbe {
+ // Inputs.
+ environmentPaths: Environment.getEnv("ESP8266_NON_OS_SDK_ROOT")
+ // Outputs.
+ property string includesPath;
+ property string libsPath;
+ property string linkerScriptsPath;
+ configure: {
+ for (var i in environmentPaths) {
+ var rootPath = environmentPaths[i];
+ if (!File.exists(rootPath))
+ continue;
+ includesPath = FileInfo.joinPaths(rootPath, "include");
+ libsPath = FileInfo.joinPaths(rootPath, "lib");
+ linkerScriptsPath = FileInfo.joinPaths(rootPath, "ld");
+ found = true;
+ return;
+ }
+ }
+}
diff --git a/examples/baremetal/esp8266/qbs/modules/esp8266_sdk/Esp8266SdkModule.qbs b/examples/baremetal/esp8266/qbs/modules/esp8266_sdk/Esp8266SdkModule.qbs
new file mode 100644
index 000000000..57e1f8572
--- /dev/null
+++ b/examples/baremetal/esp8266/qbs/modules/esp8266_sdk/Esp8266SdkModule.qbs
@@ -0,0 +1,66 @@
+Module {
+ Depends { name: "cpp" }
+
+ Esp8266SdkProbe { id: esp_sdk_probe }
+
+ validate: {
+ if (!esp_sdk_probe.found)
+ throw "ESP8266 NON OS SDK not found. Please set the ESP8266_NON_OS_SDK_ROOT env variable."
+ }
+
+ cpp.systemIncludePaths: [esp_sdk_probe.includesPath]
+ cpp.libraryPaths: [esp_sdk_probe.libsPath]
+ cpp.driverFlags: ["-nostdlib"]
+
+ cpp.cFlags: [
+ "-Wpointer-arith",
+ "-Wundef",
+ "-fno-inline-functions",
+ "-mlongcalls",
+ "-mtext-section-literals",
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-fno-builtin-printf",
+ "-fno-guess-branch-probability",
+ "-freorder-blocks-and-partition",
+ "-fno-cse-follow-jumps"
+ ]
+
+ cpp.linkerFlags: [
+ "--no-check-sections",
+ "--gc-sections",
+ "--start-group"
+ ]
+
+ cpp.defines: [
+ "ICACHE_FLASH",
+ "USE_OPTIMIZE_PRINTF",
+
+ // Target specific defines for the external 40MHz DIO
+ // SPI 16 Mbit FLASH (2048 KByte + 2048 KByte) FOTA.
+ "SPI_FLASH_SIZE_MAP=5",
+ "ESP_PART_BL_ADDR=0x000000",
+ "ESP_PART_APP1_ADDR=0x001000",
+ "ESP_PART_APP2_ADDR=0x101000",
+ "ESP_PART_RF_CAL_ADDR=0x1FB000",
+ "ESP_PART_PHY_DATA_ADDR=0x1FC000",
+ "ESP_PART_SYS_PARAM_ADDR=0x1FD000",
+ "ESP_PART_BOOTLOADER_SIZE=0x001000",
+ "ESP_PART_APPLICATION_SIZE=0x0E0000",
+ "ESP_PART_RF_CAL_SIZE=0x001000",
+ "ESP_PART_PHY_DATA_SIZE=0x001000",
+ "ESP_PART_SYS_PARAM_SIZE=0x003000"
+ ]
+
+ property string _linker_scripts_path: esp_sdk_probe.linkerScriptsPath + "/"
+
+ Group {
+ name: "ESP8266 Linker Scripts"
+ prefix: esp8266_sdk._linker_scripts_path + "/"
+ fileTags: ["linkerscript"]
+ files: [
+ "eagle.rom.addr.v6.ld",
+ "eagle.app.v6.new.2048.ld"
+ ]
+ }
+}
diff --git a/examples/baremetal/msp430f5529/msp430f5529.qbs b/examples/baremetal/msp430f5529/msp430f5529.qbs
index f4a6f95b9..64e62dd57 100644
--- a/examples/baremetal/msp430f5529/msp430f5529.qbs
+++ b/examples/baremetal/msp430f5529/msp430f5529.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for msp430f5529 board"
references: [
diff --git a/examples/baremetal/msp430f5529/nes-gamepads/nes-gamepads.qbs b/examples/baremetal/msp430f5529/nes-gamepads/nes-gamepads.qbs
index 37dfe8ca6..a06cfc6a2 100644
--- a/examples/baremetal/msp430f5529/nes-gamepads/nes-gamepads.qbs
+++ b/examples/baremetal/msp430f5529/nes-gamepads/nes-gamepads.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("msp430"))
diff --git a/examples/baremetal/msp430f5529/redblink/README.md b/examples/baremetal/msp430f5529/redblink/README.md
index 3affbaf7e..2f63b2349 100644
--- a/examples/baremetal/msp430f5529/redblink/README.md
+++ b/examples/baremetal/msp430f5529/redblink/README.md
@@ -1,4 +1,4 @@
-This examples demonstrates how to build a bare-metal application using
+This example demonstrates how to build a bare-metal application using
different MSP430 toolchains. It is designed for the MSP-EXP430F5529LP
target board (based on msp430f5529 chip) and simply flashes the red
LED on the board.
diff --git a/examples/baremetal/msp430f5529/redblink/redblink.qbs b/examples/baremetal/msp430f5529/redblink/redblink.qbs
index 0f056e101..d89d307a9 100644
--- a/examples/baremetal/msp430f5529/redblink/redblink.qbs
+++ b/examples/baremetal/msp430f5529/redblink/redblink.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("msp430"))
diff --git a/examples/baremetal/pca10001/greenblink/README.md b/examples/baremetal/pca10001/greenblink/README.md
new file mode 100644
index 000000000..0abfa46e6
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/README.md
@@ -0,0 +1,10 @@
+This example demonstrates how to build a bare-metal application using
+different ARM toolchains. It is designed for the Nordic pca100001/pca100024
+evaluation kit (based on nRF51822 MCU) and simply flashes the green
+LED on the board.
+
+The following toolchains are supported:
+
+ * GNU Arm Embedded Toolchain
+ * IAR Embedded Workbench
+ * KEIL Microcontroller Development Kit
diff --git a/examples/baremetal/pca10001/greenblink/gcc/flash.ld b/examples/baremetal/pca10001/greenblink/gcc/flash.ld
new file mode 100644
index 000000000..d65ee1464
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/gcc/flash.ld
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+ENTRY(reset_handler)
+
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000
+ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x4000
+}
+
+SECTIONS {
+ .text : {
+ KEEP(*(.isr_vector))
+ *(.text*)
+ KEEP(*(.init))
+ KEEP(*(.fini))
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+ *(.rodata*)
+ *(.eh_frame*)
+ . = ALIGN(4);
+ } > FLASH
+
+ .ARM.extab : {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ . = ALIGN(4);
+ } > FLASH
+
+ _start_of_exidx_section = .;
+ .ARM.exidx : {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ . = ALIGN(4);
+ } > FLASH
+ _end_of_exidx_section = .;
+
+ _end_of_code_section = .;
+
+ .data : AT (_end_of_code_section) {
+ _start_of_data_section = .;
+ *(vtable)
+ *(.data*)
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN(__preinit_array_start = .);
+ *(.preinit_array)
+ PROVIDE_HIDDEN(__preinit_array_end = .);
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN(__init_array_start = .);
+ *(SORT(.init_array.*))
+ *(.init_array)
+ PROVIDE_HIDDEN(__init_array_end = .);
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN(__fini_array_start = .);
+ *(SORT(.fini_array.*))
+ *(.fini_array)
+ PROVIDE_HIDDEN(__fini_array_end = .);
+ *(.jcr)
+ . = ALIGN(4);
+ /* All data end */
+ _end_of_data_section = .;
+ } > RAM
+
+ .bss : {
+ . = ALIGN(4);
+ __bss_start__ = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end__ = .;
+ } > RAM
+
+ .heap (COPY): {
+ __end__ = .;
+ end = __end__;
+ *(.heap*)
+ _heap_limit = .;
+ } > RAM
+
+ .stack_dummy (COPY): {
+ *(.stack*)
+ } > RAM
+
+ /* Set stack top to end of RAM, and stack limit move down by size of stack_dummy section. */
+ _end_of_stack = ORIGIN(RAM) + LENGTH(RAM);
+ _stack_limit = _end_of_stack - SIZEOF(.stack_dummy);
+ PROVIDE(__stack = _end_of_stack);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(_stack_limit >= _heap_limit, "region RAM overflowed with stack")
+}
diff --git a/examples/baremetal/pca10001/greenblink/gcc/startup.s b/examples/baremetal/pca10001/greenblink/gcc/startup.s
new file mode 100644
index 000000000..ec433ac03
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/gcc/startup.s
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.syntax unified
+.arch armv7e-m
+.thumb
+
+// Define the stack.
+.section .stack
+.align 3
+.equ _size_of_stack, 2048
+.globl _end_of_stack
+.globl _stack_limit
+_stack_limit:
+.space _size_of_stack
+.size _stack_limit, . - _stack_limit
+_end_of_stack:
+.size _end_of_stack, . - _end_of_stack
+
+// Define the heap.
+.section .heap
+.align 3
+.equ _size_of_heap, 2048
+.globl _end_of_heap
+.globl _heap_limit
+_end_of_heap:
+.space _size_of_heap
+.size _end_of_heap, . - _end_of_heap
+_heap_limit:
+.size _heap_limit, . - _heap_limit
+
+// Define the empty vectors table.
+.section .isr_vector, "ax"
+.align 2
+.globl _vectors_table
+_vectors_table:
+ // Generic interrupts offset.
+ .word _end_of_stack // Initial stack pointer value.
+ .word reset_handler // Reset.
+ .word 0 // NMI.
+ .word 0 // Hard fault.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // SVC.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // PendSV.
+ .word 0 // SysTick.
+
+ // External interrupts offset.
+ .word 0 // POWER CLOCK.
+ .word 0 // RADIO.
+ .word 0 // UART0
+ .word 0 // SPI0/TWI0.
+ .word 0 // SPI1/TWI1.
+ .word 0 // Reserved.
+ .word 0 // GPIOTE.
+ .word 0 // ADC.
+ .word 0 // TIMER0.
+ .word 0 // TIMER1.
+ .word 0 // TIMER2.
+ .word 0 // RTC0.
+ .word 0 // TEMP.
+ .word 0 // RNG.
+ .word 0 // ECB.
+ .word 0 // CCM_AAR.
+ .word 0 // WDT.
+ .word 0 // RTC1.
+ .word 0 // QDEC.
+ .word 0 // LPCOMP.
+ .word 0 // SWI0.
+ .word 0 // SWI1.
+ .word 0 // SWI2.
+ .word 0 // SWI3.
+ .word 0 // SWI4.
+ .word 0 // SWI5.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+.size _vectors_table, . - _vectors_table
+
+// Define the 'reset_handler' function, which is an entry point.
+.text
+.thumb
+.thumb_func
+.align 1
+.globl reset_handler
+.type reset_handler, %function
+reset_handler:
+ // Loop to copy data from read only memory to RAM.
+ ldr r1, =_end_of_code_section
+ ldr r2, =_start_of_data_section
+ ldr r3, =__bss_start__
+ subs r3, r3, r2
+ ble _copy_data_init_done
+_copy_data_init:
+ subs r3, r3, #4
+ ldr r0, [r1,r3]
+ str r0, [r2,r3]
+ bgt _copy_data_init
+_copy_data_init_done:
+ // Zero fill the bss segment.
+ ldr r1, =__bss_start__
+ ldr r2, =__bss_end__
+ movs r0, 0
+ subs r2, r2, r1
+ ble _loop_fill_zero_bss_done
+
+_loop_fill_zero_bss:
+ subs r2, r2, #4
+ str r0, [r1, r2]
+ bgt _loop_fill_zero_bss
+
+_loop_fill_zero_bss_done:
+ // Call the application's entry point.
+ bl main
+ bx lr
+.size reset_handler, . - reset_handler
diff --git a/examples/baremetal/pca10001/greenblink/gpio.c b/examples/baremetal/pca10001/greenblink/gpio.c
new file mode 100644
index 000000000..5fc910e58
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/gpio.c
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+#include "system.h"
+
+#define GPIO_GREEN_LED_PIN_POS (18u)
+#define GPIO_GREEN_LED_PIN (1u << GPIO_GREEN_LED_PIN_POS)
+
+// Pin direction attributes.
+#define GPIO_PIN_CNF_DIR_POS (0u) // Position of DIR field.
+#define GPIO_PIN_CNF_DIR_OUT (1u) // Configure pin as an output pin.
+#define GPIO_PIN_CNF_DIR_MSK (GPIO_PIN_CNF_DIR_OUT << GPIO_PIN_CNF_DIR_POS)
+
+// Pin input buffer attributes.
+#define GPIO_PIN_CNF_INPUT_POS (1u) // Position of INPUT field.
+#define GPIO_PIN_CNF_INPUT_OFF (1u) // Disconnect input buffer.
+#define GPIO_PIN_CNF_INPUT_MSK (GPIO_PIN_CNF_INPUT_OFF << GPIO_PIN_CNF_INPUT_POS)
+
+// Pin pull attributes.
+#define GPIO_PIN_CNF_PULL_POS (2u) // Position of PULL field.
+#define GPIO_PIN_CNF_PULL_OFF (0u) // No pull.
+#define GPIO_PIN_CNF_PULL_MSK (GPIO_PIN_CNF_PULL_OFF << GPIO_PIN_CNF_PULL_POS)
+
+// Pin drive attributes.
+#define GPIO_PIN_CNF_DRIVE_POS (8u) // Position of DRIVE field.
+#define GPIO_PIN_CNF_DRIVE_S0S1 (0u) // Standard '0', standard '1'.
+#define GPIO_PIN_CNF_DRIVE_MSK (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_POS)
+
+// Pin sense attributes.
+#define GPIO_PIN_CNF_SENSE_POS (16u) // Position of SENSE field.
+#define GPIO_PIN_CNF_SENSE_OFF (0u) // Disabled.
+#define GPIO_PIN_CNF_SENSE_MSK (GPIO_PIN_CNF_SENSE_OFF << GPIO_PIN_CNF_SENSE_POS)
+
+void gpio_init_green_led(void)
+{
+ GPIOD_REGS_MAP->PIN_CNF[GPIO_GREEN_LED_PIN_POS] = (GPIO_PIN_CNF_DIR_MSK
+ | GPIO_PIN_CNF_INPUT_MSK
+ | GPIO_PIN_CNF_PULL_MSK
+ | GPIO_PIN_CNF_DRIVE_MSK
+ | GPIO_PIN_CNF_SENSE_MSK);
+}
+
+void gpio_toggle_green_led(void)
+{
+ const uint32_t gpio_state = GPIOD_REGS_MAP->OUT;
+ GPIOD_REGS_MAP->OUTSET = (GPIO_GREEN_LED_PIN & ~gpio_state);
+ GPIOD_REGS_MAP->OUTCLR = (GPIO_GREEN_LED_PIN & gpio_state);
+}
diff --git a/examples/baremetal/pca10001/greenblink/gpio.h b/examples/baremetal/pca10001/greenblink/gpio.h
new file mode 100644
index 000000000..9e931b715
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/gpio.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GPIO_H
+#define GPIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gpio_init_green_led(void);
+void gpio_toggle_green_led(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPIO_H
diff --git a/examples/baremetal/pca10001/greenblink/greenblink.qbs b/examples/baremetal/pca10001/greenblink/greenblink.qbs
new file mode 100644
index 000000000..1a4dabde7
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/greenblink.qbs
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+CppApplication {
+ condition: {
+ if (!qbs.architecture.startsWith("arm"))
+ return false;
+ return (qbs.toolchain.contains("gcc")
+ || qbs.toolchain.contains("iar")
+ || qbs.toolchain.contains("keil"))
+ && !qbs.toolchain.contains("xcode")
+ }
+ name: "pca10001-greenblink"
+ cpp.cLanguageVersion: "c99"
+ cpp.positionIndependentCode: false
+
+ //
+ // GCC-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ cpp.assemblerFlags: [
+ "-mcpu=cortex-m0",
+ ]
+ cpp.driverFlags: [
+ "-mcpu=cortex-m0",
+ "-specs=nosys.specs"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("gcc")
+ name: "GCC"
+ prefix: "gcc/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.ld"]
+ }
+ }
+
+ //
+ // IAR-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m0"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m0"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("iar")
+ name: "IAR"
+ prefix: "iar/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.icf"]
+ }
+ }
+
+ //
+ // KEIL-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("keil")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m0"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m0"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("keil")
+ name: "KEIL"
+ prefix: "keil/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.sct"]
+ }
+ }
+
+ //
+ // Common code.
+ //
+
+ Group {
+ name: "Gpio"
+ files: ["gpio.c", "gpio.h"]
+ }
+
+ Group {
+ name: "System"
+ files: ["system.h"]
+ }
+
+ files: ["main.c"]
+}
diff --git a/examples/baremetal/pca10001/greenblink/iar/flash.icf b/examples/baremetal/pca10001/greenblink/iar/flash.icf
new file mode 100644
index 000000000..8d1ef63f4
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/iar/flash.icf
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+define symbol _start_of_intvec_section = 0x00000000;
+
+define symbol _start_of_ram_section = 0x20000000;
+define symbol _end_of_ram_section = 0x20003FFF;
+define symbol _start_of_flash_section = 0x00000000;
+define symbol _end_of_flash_section = 0x0003FFFF;
+
+define symbol _min_stack_size = 0x800;
+define symbol _min_heap_size = 0x800;
+
+define memory mem with size = 4G;
+define region flash_section = mem:[from _start_of_flash_section to _end_of_flash_section];
+define region ram_section = mem:[from _start_of_ram_section to _end_of_ram_section];
+
+define block CSTACK with alignment = 8, size = _min_stack_size { };
+define block HEAP with alignment = 8, size = _min_heap_size { };
+
+initialize by copy { readwrite };
+
+place at address mem:_start_of_intvec_section { readonly section .intvec };
+
+place in flash_section { readonly };
+place in ram_section { readwrite, block CSTACK, block HEAP };
diff --git a/examples/baremetal/pca10001/greenblink/iar/startup.s b/examples/baremetal/pca10001/greenblink/iar/startup.s
new file mode 100644
index 000000000..d8041c5c1
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/iar/startup.s
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+ MODULE ?cstartup
+
+ SECTION CSTACK:DATA:NOROOT(3)
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+
+ PUBLIC _vectors_table
+ DATA
+
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD sfe(CSTACK) ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; Power clock.
+ DCD 0 ; Radio.
+ DCD 0 ; UART0.
+ DCD 0 ; SPI0/TWI0
+ DCD 0 ; SPI1/TWI1
+ DCD 0 ; Reserved
+ DCD 0 ; GPIOTE
+ DCD 0 ; ADC
+ DCD 0 ; TIMER0
+ DCD 0 ; TIMER1
+ DCD 0 ; TIMER2
+ DCD 0 ; RTC0
+ DCD 0 ; TEMP
+ DCD 0 ; RNG
+ DCD 0 ; ECB
+ DCD 0 ; CCM/AAR
+ DCD 0 ; WDT
+ DCD 0 ; RTC1
+ DCD 0 ; QDEC
+ DCD 0 ; LPCOMP
+ DCD 0 ; SWI0
+ DCD 0 ; SWI1
+ DCD 0 ; SWI2
+ DCD 0 ; SWI3
+ DCD 0 ; SWI4
+ DCD 0 ; SWI5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+
+ ;; Reset handler.
+ THUMB
+ PUBWEAK reset_handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+reset_handler
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ END
+
+
diff --git a/examples/baremetal/pca10001/greenblink/keil/flash.sct b/examples/baremetal/pca10001/greenblink/keil/flash.sct
new file mode 100644
index 000000000..6d5a1e42d
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/keil/flash.sct
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+;; Load region size_region.
+LR_IROM1 0x00000000 0x00040000 {
+ ;; Load address = execution address.
+ ER_IROM1 0x00000000 0x00040000 {
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ .ANY (+XO)
+ }
+
+ ; RW data.
+ RW_IRAM1 0x20000000 0x00004000 {
+ .ANY (+RW +ZI)
+ }
+}
diff --git a/examples/baremetal/pca10001/greenblink/keil/startup.s b/examples/baremetal/pca10001/greenblink/keil/startup.s
new file mode 100644
index 000000000..4b63519db
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/keil/startup.s
@@ -0,0 +1,134 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+;; Contact: https://www.qt.io/licensing/
+;;
+;; This file is part of the examples of Qbs.
+;;
+;; $QT_BEGIN_LICENSE:BSD$
+;; Commercial License Usage
+;; Licensees holding valid commercial Qt licenses may use this file in
+;; accordance with the commercial license agreement provided with the
+;; Software or, alternatively, in accordance with the terms contained in
+;; a written agreement between you and The Qt Company. For licensing terms
+;; and conditions see https://www.qt.io/terms-conditions. For further
+;; information use the contact form at https://www.qt.io/contact-us.
+;;
+;; BSD License Usage
+;; Alternatively, you may use this file under the terms of the BSD license
+;; as follows:
+;;
+;; "Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions are
+;; met:
+;; * Redistributions of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;; * Redistributions in binary form must reproduce the above copyright
+;; notice, this list of conditions and the following disclaimer in
+;; the documentation and/or other materials provided with the
+;; distribution.
+;; * Neither the name of The Qt Company Ltd nor the names of its
+;; contributors may be used to endorse or promote products derived
+;; from this software without specific prior written permission.
+;;
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+;;
+;; $QT_END_LICENSE$
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+_size_of_stack EQU 0x800
+_size_of_heap EQU 0x800
+
+;; Stack configuration.
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+_start_of_stack SPACE _size_of_stack
+_end_of_stack
+
+;; Heap configuration.
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+_start_of_heap SPACE _size_of_heap
+_end_of_heap
+
+ PRESERVE8
+ THUMB
+
+;; Define the empty vectors table.
+ AREA RESET, DATA, READONLY
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD _end_of_stack ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; Power clock.
+ DCD 0 ; Radio.
+ DCD 0 ; UART0.
+ DCD 0 ; SPI0/TWI0
+ DCD 0 ; SPI1/TWI1
+ DCD 0 ; Reserved
+ DCD 0 ; GPIOTE
+ DCD 0 ; ADC
+ DCD 0 ; TIMER0
+ DCD 0 ; TIMER1
+ DCD 0 ; TIMER2
+ DCD 0 ; RTC0
+ DCD 0 ; TEMP
+ DCD 0 ; RNG
+ DCD 0 ; ECB
+ DCD 0 ; CCM/AAR
+ DCD 0 ; WDT
+ DCD 0 ; RTC1
+ DCD 0 ; QDEC
+ DCD 0 ; LPCOMP
+ DCD 0 ; SWI0
+ DCD 0 ; SWI1
+ DCD 0 ; SWI2
+ DCD 0 ; SWI3
+ DCD 0 ; SWI4
+ DCD 0 ; SWI5
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+ DCD 0 ; Reserved
+_end_of_vectors_table
+
+_size_of_vectors_table EQU _end_of_vectors_table - _vectors_table
+
+ AREA |.text|, CODE, READONLY
+;; Reset handler.
+reset_handler PROC
+ EXPORT reset_handler [WEAK]
+ IMPORT main
+ LDR R0, =main
+ BX R0
+ ENDP
+ ALIGN
+
+ END
diff --git a/examples/baremetal/pca10001/greenblink/main.c b/examples/baremetal/pca10001/greenblink/main.c
new file mode 100644
index 000000000..89d3daeb6
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/main.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+
+#include <stdint.h>
+
+static void some_delay(uint32_t counts)
+{
+ for (uint32_t index = 0u; index < counts; ++index)
+ __asm("nop");
+}
+
+int main(void)
+{
+ gpio_init_green_led();
+
+ while (1) {
+ gpio_toggle_green_led();
+ some_delay(1000000u);
+ }
+}
diff --git a/examples/baremetal/pca10001/greenblink/system.h b/examples/baremetal/pca10001/greenblink/system.h
new file mode 100644
index 000000000..37e6ad8ea
--- /dev/null
+++ b/examples/baremetal/pca10001/greenblink/system.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __IO volatile
+
+struct gpio_regs_map {
+ uint32_t RESERVED0[321u];
+ __IO uint32_t OUT;
+ __IO uint32_t OUTSET;
+ __IO uint32_t OUTCLR;
+ __IO uint32_t IN;
+ __IO uint32_t DIR;
+ __IO uint32_t DIRSET;
+ __IO uint32_t DIRCLR;
+ uint32_t RESERVED1[120u];
+ __IO uint32_t PIN_CNF[32u];
+};
+
+#define GPIO_REGS_ADDRESS (0x50000000u)
+#define GPIOD_REGS_MAP ((struct gpio_regs_map *)GPIO_REGS_ADDRESS)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SYSTEM_H
diff --git a/examples/baremetal/pca10001/pca10001.qbs b/examples/baremetal/pca10001/pca10001.qbs
new file mode 100644
index 000000000..db1303268
--- /dev/null
+++ b/examples/baremetal/pca10001/pca10001.qbs
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+Project {
+ name: "Examples for pca10001/pca10024 boards"
+ references: [
+ "greenblink/greenblink.qbs"
+ ]
+}
diff --git a/examples/baremetal/pca10040/greenblink/README.md b/examples/baremetal/pca10040/greenblink/README.md
new file mode 100644
index 000000000..7d759839b
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/README.md
@@ -0,0 +1,10 @@
+This example demonstrates how to build a bare-metal application using
+different ARM toolchains. It is designed for the Nordic pca10040
+evaluation kit (based on nRF52832 MCU) and simply flashes the green
+LED on the board.
+
+The following toolchains are supported:
+
+ * GNU Arm Embedded Toolchain
+ * IAR Embedded Workbench
+ * KEIL Microcontroller Development Kit
diff --git a/examples/baremetal/pca10040/greenblink/gcc/flash.ld b/examples/baremetal/pca10040/greenblink/gcc/flash.ld
new file mode 100644
index 000000000..b998618ae
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/gcc/flash.ld
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+ENTRY(reset_handler)
+
+MEMORY
+{
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x80000
+ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x10000
+ CODE_RAM (rwx) : ORIGIN = 0x800000, LENGTH = 0x10000
+}
+
+SECTIONS {
+ .text : {
+ KEEP(*(.isr_vector))
+ *(.text*)
+ KEEP(*(.init))
+ KEEP(*(.fini))
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+ *(.rodata*)
+ *(.eh_frame*)
+ . = ALIGN(4);
+ } > FLASH
+
+ .ARM.extab : {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ . = ALIGN(4);
+ } > FLASH
+
+ _start_of_exidx_section = .;
+ .ARM.exidx : {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ . = ALIGN(4);
+ } > FLASH
+ _end_of_exidx_section = .;
+
+ _end_of_code_section = .;
+
+ .data : AT (_end_of_code_section) {
+ _start_of_data_section = .;
+ *(vtable)
+ *(.data*)
+ . = ALIGN(4);
+ /* preinit data */
+ PROVIDE_HIDDEN(__preinit_array_start = .);
+ *(.preinit_array)
+ PROVIDE_HIDDEN(__preinit_array_end = .);
+ . = ALIGN(4);
+ /* init data */
+ PROVIDE_HIDDEN(__init_array_start = .);
+ *(SORT(.init_array.*))
+ *(.init_array)
+ PROVIDE_HIDDEN(__init_array_end = .);
+ . = ALIGN(4);
+ /* finit data */
+ PROVIDE_HIDDEN(__fini_array_start = .);
+ *(SORT(.fini_array.*))
+ *(.fini_array)
+ PROVIDE_HIDDEN(__fini_array_end = .);
+ *(.jcr)
+ . = ALIGN(4);
+ /* All data end */
+ _end_of_data_section = .;
+ } > RAM
+
+ .bss : {
+ . = ALIGN(4);
+ __bss_start__ = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end__ = .;
+ } > RAM
+
+ .heap (COPY): {
+ __end__ = .;
+ end = __end__;
+ *(.heap*)
+ _heap_limit = .;
+ } > RAM
+
+ .stack_dummy (COPY): {
+ *(.stack*)
+ } > RAM
+
+ /* Set stack top to end of RAM, and stack limit move down by size of stack_dummy section. */
+ _end_of_stack = ORIGIN(RAM) + LENGTH(RAM);
+ _stack_limit = _end_of_stack - SIZEOF(.stack_dummy);
+ PROVIDE(__stack = _end_of_stack);
+
+ /* Check if data + heap + stack exceeds RAM limit */
+ ASSERT(_stack_limit >= _heap_limit, "region RAM overflowed with stack")
+}
diff --git a/examples/baremetal/pca10040/greenblink/gcc/startup.s b/examples/baremetal/pca10040/greenblink/gcc/startup.s
new file mode 100644
index 000000000..d1fe7e9de
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/gcc/startup.s
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.syntax unified
+.arch armv7e-m
+.thumb
+
+// Define the stack.
+.section .stack
+.align 3
+.equ _size_of_stack, 8192
+.globl _end_of_stack
+.globl _stack_limit
+_stack_limit:
+.space _size_of_stack
+.size _stack_limit, . - _stack_limit
+_end_of_stack:
+.size _end_of_stack, . - _end_of_stack
+
+// Define the heap.
+.section .heap
+.align 3
+.equ _size_of_heap, 8192
+.globl _end_of_heap
+.globl _heap_limit
+_end_of_heap:
+.space _size_of_heap
+.size _end_of_heap, . - _end_of_heap
+_heap_limit:
+.size _heap_limit, . - _heap_limit
+
+// Define the empty vectors table.
+.section .isr_vector, "ax"
+.align 2
+.globl _vectors_table
+_vectors_table:
+ // Generic interrupts offset.
+ .word _end_of_stack // Initial stack pointer value.
+ .word reset_handler // Reset.
+ .word 0 // NMI.
+ .word 0 // Hard fault.
+ .word 0 // Memory management fault.
+ .word 0 // Bus fault.
+ .word 0 // Usage fault.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // SVC.
+ .word 0 // Debug monitor.
+ .word 0 // Reserved.
+ .word 0 // PendSV.
+ .word 0 // SysTick.
+
+ // External interrupts offset.
+ .word 0 // POWER CLOCK.
+ .word 0 // RADIO.
+ .word 0 // UARTE0/UART0
+ .word 0 // SPIM0/SPIS0/TWIM0/TWIS0/SPI0/TWI0.
+ .word 0 // SPIM1/SPIS1/TWIM1/TWIS1/SPI1/TWI1.
+ .word 0 // NFCT.
+ .word 0 // GPIOTE.
+ .word 0 // SAADC.
+ .word 0 // TIMER0.
+ .word 0 // TIMER1.
+ .word 0 // TIMER2.
+ .word 0 // RTC0.
+ .word 0 // TEMP.
+ .word 0 // RNG.
+ .word 0 // ECB.
+ .word 0 // CCM_AAR.
+ .word 0 // WDT.
+ .word 0 // RTC1.
+ .word 0 // QDEC.
+ .word 0 // COMP_LPCOMP.
+ .word 0 // SWI0_EGU0.
+ .word 0 // SWI1_EGU1.
+ .word 0 // SWI2_EGU2.
+ .word 0 // SWI3_EGU3.
+ .word 0 // SWI4_EGU4.
+ .word 0 // SWI5_EGU5.
+ .word 0 // TIMER3.
+ .word 0 // TIMER4.
+ .word 0 // PWM0.
+ .word 0 // PDM.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // MWU.
+ .word 0 // PWM1.
+ .word 0 // PWM2.
+ .word 0 // SPIM2/SPIS2/SPI2.
+ .word 0 // RTC2.
+ .word 0 // I2S.
+ .word 0 // FPU.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+.size _vectors_table, . - _vectors_table
+
+// Define the 'reset_handler' function, which is an entry point.
+.text
+.thumb
+.thumb_func
+.align 1
+.globl reset_handler
+.type reset_handler, %function
+reset_handler:
+ // Loop to copy data from read only memory to RAM.
+ ldr r1, =_end_of_code_section
+ ldr r2, =_start_of_data_section
+ ldr r3, =__bss_start__
+ subs r3, r3, r2
+ ble _copy_data_init_done
+_copy_data_init:
+ subs r3, r3, #4
+ ldr r0, [r1,r3]
+ str r0, [r2,r3]
+ bgt _copy_data_init
+_copy_data_init_done:
+ // Zero fill the bss segment.
+ ldr r1, =__bss_start__
+ ldr r2, =__bss_end__
+ movs r0, 0
+ subs r2, r2, r1
+ ble _loop_fill_zero_bss_done
+
+_loop_fill_zero_bss:
+ subs r2, r2, #4
+ str r0, [r1, r2]
+ bgt _loop_fill_zero_bss
+
+_loop_fill_zero_bss_done:
+ // Call the application's entry point.
+ bl main
+ bx lr
+.size reset_handler, . - reset_handler
diff --git a/examples/baremetal/pca10040/greenblink/gpio.c b/examples/baremetal/pca10040/greenblink/gpio.c
new file mode 100644
index 000000000..c86f6ac5e
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/gpio.c
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+#include "system.h"
+
+#define GPIO_GREEN_LED_PIN_POS (17u)
+#define GPIO_GREEN_LED_PIN (1u << GPIO_GREEN_LED_PIN_POS)
+
+// Pin direction attributes.
+#define GPIO_PIN_CNF_DIR_POS (0u) // Position of DIR field.
+#define GPIO_PIN_CNF_DIR_OUT (1u) // Configure pin as an output pin.
+#define GPIO_PIN_CNF_DIR_MSK (GPIO_PIN_CNF_DIR_OUT << GPIO_PIN_CNF_DIR_POS)
+
+// Pin input buffer attributes.
+#define GPIO_PIN_CNF_INPUT_POS (1u) // Position of INPUT field.
+#define GPIO_PIN_CNF_INPUT_OFF (1u) // Disconnect input buffer.
+#define GPIO_PIN_CNF_INPUT_MSK (GPIO_PIN_CNF_INPUT_OFF << GPIO_PIN_CNF_INPUT_POS)
+
+// Pin pull attributes.
+#define GPIO_PIN_CNF_PULL_POS (2u) // Position of PULL field.
+#define GPIO_PIN_CNF_PULL_OFF (0u) // No pull.
+#define GPIO_PIN_CNF_PULL_MSK (GPIO_PIN_CNF_PULL_OFF << GPIO_PIN_CNF_PULL_POS)
+
+// Pin drive attributes.
+#define GPIO_PIN_CNF_DRIVE_POS (8u) // Position of DRIVE field.
+#define GPIO_PIN_CNF_DRIVE_S0S1 (0u) // Standard '0', standard '1'.
+#define GPIO_PIN_CNF_DRIVE_MSK (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_POS)
+
+// Pin sense attributes.
+#define GPIO_PIN_CNF_SENSE_POS (16u) // Position of SENSE field.
+#define GPIO_PIN_CNF_SENSE_OFF (0u) // Disabled.
+#define GPIO_PIN_CNF_SENSE_MSK (GPIO_PIN_CNF_SENSE_OFF << GPIO_PIN_CNF_SENSE_POS)
+
+void gpio_init_green_led(void)
+{
+ GPIOD_REGS_MAP->PIN_CNF[GPIO_GREEN_LED_PIN_POS] = (GPIO_PIN_CNF_DIR_MSK
+ | GPIO_PIN_CNF_INPUT_MSK
+ | GPIO_PIN_CNF_PULL_MSK
+ | GPIO_PIN_CNF_DRIVE_MSK
+ | GPIO_PIN_CNF_SENSE_MSK);
+}
+
+void gpio_toggle_green_led(void)
+{
+ const uint32_t gpio_state = GPIOD_REGS_MAP->OUT;
+ GPIOD_REGS_MAP->OUTSET = (GPIO_GREEN_LED_PIN & ~gpio_state);
+ GPIOD_REGS_MAP->OUTCLR = (GPIO_GREEN_LED_PIN & gpio_state);
+}
diff --git a/examples/baremetal/pca10040/greenblink/gpio.h b/examples/baremetal/pca10040/greenblink/gpio.h
new file mode 100644
index 000000000..9e931b715
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/gpio.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GPIO_H
+#define GPIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gpio_init_green_led(void);
+void gpio_toggle_green_led(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPIO_H
diff --git a/examples/baremetal/pca10040/greenblink/greenblink.qbs b/examples/baremetal/pca10040/greenblink/greenblink.qbs
new file mode 100644
index 000000000..2ae3dc2a1
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/greenblink.qbs
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+CppApplication {
+ condition: {
+ if (!qbs.architecture.startsWith("arm"))
+ return false;
+ return (qbs.toolchain.contains("gcc")
+ || qbs.toolchain.contains("iar")
+ || qbs.toolchain.contains("keil"))
+ && !qbs.toolchain.contains("xcode")
+ }
+ name: "pca10040-greenblink"
+ cpp.cLanguageVersion: "c99"
+ cpp.positionIndependentCode: false
+
+ //
+ // GCC-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ cpp.assemblerFlags: [
+ "-mcpu=cortex-m4",
+ "-mfloat-abi=hard",
+ "-mfpu=fpv4-sp-d16",
+ ]
+ cpp.driverFlags: [
+ "-mcpu=cortex-m4",
+ "-mfloat-abi=hard",
+ "-mfpu=fpv4-sp-d16",
+ "-specs=nosys.specs"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("gcc")
+ name: "GCC"
+ prefix: "gcc/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.ld"]
+ }
+ }
+
+ //
+ // IAR-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m4",
+ "--fpu", "vfpv4_sp"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m4",
+ "--fpu", "vfpv4_sp"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("iar")
+ name: "IAR"
+ prefix: "iar/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.icf"]
+ }
+ }
+
+ //
+ // KEIL-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("keil")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m4.fp.sp"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m4.fp.sp"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("keil")
+ name: "KEIL"
+ prefix: "keil/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.sct"]
+ }
+ }
+
+ //
+ // Common code.
+ //
+
+ Group {
+ name: "Gpio"
+ files: ["gpio.c", "gpio.h"]
+ }
+
+ Group {
+ name: "System"
+ files: ["system.h"]
+ }
+
+ files: ["main.c"]
+}
diff --git a/examples/baremetal/pca10040/greenblink/iar/flash.icf b/examples/baremetal/pca10040/greenblink/iar/flash.icf
new file mode 100644
index 000000000..d19640293
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/iar/flash.icf
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+define symbol _start_of_intvec_section = 0x00000000;
+
+define symbol _start_of_irom1_section = 0x00000000;
+define symbol _end_of_irom1_section = 0x0007FFFF;
+define symbol _start_of_irom2_section = 0x0;
+define symbol _end_of_irom2_section = 0x0;
+define symbol _start_of_erom1_section = 0x0;
+define symbol _end_of_erom1_section = 0x0;
+define symbol _start_of_erom2_section = 0x0;
+define symbol _end_of_erom2_section = 0x0;
+define symbol _start_of_erom3_section = 0x0;
+define symbol _end_of_erom3_section = 0x0;
+define symbol _start_of_iram1_section = 0x20000000;
+define symbol _end_of_iram1_section = 0x2000FFFF;
+define symbol _start_of_iram2_section = 0x0;
+define symbol _end_of_iram2_section = 0x0;
+define symbol _start_of_eram1_section = 0x0;
+define symbol _end_of_eram1_section = 0x0;
+define symbol _start_of_eram2_section = 0x0;
+define symbol _end_of_eram2_section = 0x0;
+define symbol _start_of_eram3_section = 0x0;
+define symbol _end_of_eram3_section = 0x0;
+
+define symbol _min_stack_size = 0x2000;
+define symbol _min_proc_stack_size = 0x0;
+define symbol _min_heap_size = 0x2000;
+
+define memory mem with size = 4G;
+define region irom_section = mem:[from _start_of_irom1_section to _end_of_irom1_section]
+ | mem:[from _start_of_irom2_section to _end_of_irom2_section];
+define region erom_section = mem:[from _start_of_erom1_section to _end_of_erom1_section]
+ | mem:[from _start_of_erom2_section to _end_of_erom2_section]
+ | mem:[from _start_of_erom3_section to _end_of_erom3_section];
+define region iram_section = mem:[from _start_of_iram1_section to _end_of_iram1_section]
+ | mem:[from _start_of_iram2_section to _end_of_iram2_section];
+define region eram_section = mem:[from _start_of_eram1_section to _end_of_eram1_section]
+ | mem:[from _start_of_eram2_section to _end_of_eram2_section]
+ | mem:[from _start_of_eram3_section to _end_of_eram3_section];
+
+
+define block CSTACK with alignment = 8, size = _min_stack_size { };
+define block PROC_STACK with alignment = 8, size = _min_proc_stack_size { };
+define block HEAP with alignment = 8, size = _min_heap_size { };
+
+initialize by copy { readwrite };
+
+place at address mem:_start_of_intvec_section { readonly section .intvec };
+
+place in irom_section { readonly };
+place in erom_section { readonly section application_specific_ro };
+place in iram_section { readwrite, block CSTACK, block HEAP, block PROC_STACK };
+place in eram_section { readwrite section application_specific_rw };
diff --git a/examples/baremetal/pca10040/greenblink/iar/startup.s b/examples/baremetal/pca10040/greenblink/iar/startup.s
new file mode 100644
index 000000000..209322ac0
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/iar/startup.s
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+ MODULE ?cstartup
+
+ SECTION CSTACK:DATA:NOROOT(3)
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+
+ PUBLIC _vectors_table
+ DATA
+
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD sfe(CSTACK) ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; Memory management fault.
+ DCD 0 ; Bus fault.
+ DCD 0 ; Usage fault.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; POWER CLOCK.
+ DCD 0 ; RADIO.
+ DCD 0 ; UARTE0/UART0
+ DCD 0 ; SPIM0/SPIS0/TWIM0/TWIS0/SPI0/TWI0.
+ DCD 0 ; SPIM1/SPIS1/TWIM1/TWIS1/SPI1/TWI1.
+ DCD 0 ; NFCT.
+ DCD 0 ; GPIOTE.
+ DCD 0 ; SAADC.
+ DCD 0 ; TIMER0.
+ DCD 0 ; TIMER1.
+ DCD 0 ; TIMER2.
+ DCD 0 ; RTC0.
+ DCD 0 ; TEMP.
+ DCD 0 ; RNG.
+ DCD 0 ; ECB.
+ DCD 0 ; CCM_AAR.
+ DCD 0 ; WDT.
+ DCD 0 ; RTC1.
+ DCD 0 ; QDEC.
+ DCD 0 ; COMP_LPCOMP.
+ DCD 0 ; SWI0_EGU0.
+ DCD 0 ; SWI1_EGU1.
+ DCD 0 ; SWI2_EGU2.
+ DCD 0 ; SWI3_EGU3.
+ DCD 0 ; SWI4_EGU4.
+ DCD 0 ; SWI5_EGU5.
+ DCD 0 ; TIMER3.
+ DCD 0 ; TIMER4.
+ DCD 0 ; PWM0.
+ DCD 0 ; PDM.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; MWU.
+ DCD 0 ; PWM1.
+ DCD 0 ; PWM2.
+ DCD 0 ; SPIM2/SPIS2/SPI2.
+ DCD 0 ; RTC2.
+ DCD 0 ; I2S.
+ DCD 0 ; FPU.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+
+ ;; Reset handler.
+ THUMB
+ PUBWEAK reset_handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+reset_handler
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ END
diff --git a/examples/baremetal/pca10040/greenblink/keil/flash.sct b/examples/baremetal/pca10040/greenblink/keil/flash.sct
new file mode 100644
index 000000000..29843331a
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/keil/flash.sct
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+;; Load region size_region.
+LR_IROM1 0x00000000 0x00080000 {
+ ;; Load address = execution address.
+ ER_IROM1 0x00000000 0x00080000 {
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ .ANY (+XO)
+ }
+
+ ; RW data.
+ RW_IRAM1 0x20000000 0x00008000 {
+ .ANY (+RW +ZI)
+ }
+}
diff --git a/examples/baremetal/pca10040/greenblink/keil/startup.s b/examples/baremetal/pca10040/greenblink/keil/startup.s
new file mode 100644
index 000000000..369ca96f8
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/keil/startup.s
@@ -0,0 +1,215 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+;; Contact: https://www.qt.io/licensing/
+;;
+;; This file is part of the examples of Qbs.
+;;
+;; $QT_BEGIN_LICENSE:BSD$
+;; Commercial License Usage
+;; Licensees holding valid commercial Qt licenses may use this file in
+;; accordance with the commercial license agreement provided with the
+;; Software or, alternatively, in accordance with the terms contained in
+;; a written agreement between you and The Qt Company. For licensing terms
+;; and conditions see https://www.qt.io/terms-conditions. For further
+;; information use the contact form at https://www.qt.io/contact-us.
+;;
+;; BSD License Usage
+;; Alternatively, you may use this file under the terms of the BSD license
+;; as follows:
+;;
+;; "Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions are
+;; met:
+;; * Redistributions of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;; * Redistributions in binary form must reproduce the above copyright
+;; notice, this list of conditions and the following disclaimer in
+;; the documentation and/or other materials provided with the
+;; distribution.
+;; * Neither the name of The Qt Company Ltd nor the names of its
+;; contributors may be used to endorse or promote products derived
+;; from this software without specific prior written permission.
+;;
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+;;
+;; $QT_END_LICENSE$
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+_size_of_stack EQU 0x2000
+_size_of_heap EQU 0x2000
+
+;; Stack configuration.
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+_start_of_stack SPACE _size_of_stack
+_end_of_stack
+
+;; Heap configuration.
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+_start_of_heap SPACE _size_of_heap
+_end_of_heap
+
+ PRESERVE8
+ THUMB
+
+;; Define the empty vectors table.
+ AREA RESET, DATA, READONLY
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD _end_of_stack ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; Memory management fault.
+ DCD 0 ; Bus fault.
+ DCD 0 ; Usage fault.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Debug monitor.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; Power clock.
+ DCD 0 ; Radio.
+ DCD 0 ; UARTE0/UART0.
+ DCD 0 ; SPIM0/SPIS0/TWIM0/TWIS0/SPI0/TWI0.
+ DCD 0 ; SPIM1/SPIS1/TWIM1/TWIS1/SPI1/TWI1.
+ DCD 0 ; NFCT.
+ DCD 0 ; GPIOTE.
+ DCD 0 ; SAADC.
+ DCD 0 ; TIMER0.
+ DCD 0 ; TIMER1.
+ DCD 0 ; TIMER2.
+ DCD 0 ; RTC0.
+ DCD 0 ; TEMP.
+ DCD 0 ; RNG.
+ DCD 0 ; ECB.
+ DCD 0 ; CCM/AAR.
+ DCD 0 ; WDT.
+ DCD 0 ; RTC1.
+ DCD 0 ; QDEC.
+ DCD 0 ; COMP/LPCOMP.
+ DCD 0 ; SWI0/EGU0.
+ DCD 0 ; SWI1/EGU1.
+ DCD 0 ; SWI2/EGU2.
+ DCD 0 ; SWI3/EGU3.
+ DCD 0 ; SWI4/EGU4.
+ DCD 0 ; SWI5/EGU5.
+ DCD 0 ; TIMER3.
+ DCD 0 ; TIMER4.
+ DCD 0 ; PWM0.
+ DCD 0 ; PDM.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; MWU.
+ DCD 0 ; PWM1.
+ DCD 0 ; PWM2.
+ DCD 0 ; SPIM2/SPIS2/SPI2.
+ DCD 0 ; RTC2.
+ DCD 0 ; I2S.
+ DCD 0 ; FPU.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+
+_end_of_vectors_table
+
+_size_of_vectors_table EQU _end_of_vectors_table - _vectors_table
+
+ AREA |.text|, CODE, READONLY
+;; Reset handler.
+reset_handler PROC
+ EXPORT reset_handler [WEAK]
+ IMPORT main
+ LDR R0, =main
+ BX R0
+ ENDP
+ ALIGN
+
+ END
diff --git a/examples/baremetal/pca10040/greenblink/main.c b/examples/baremetal/pca10040/greenblink/main.c
new file mode 100644
index 000000000..89d3daeb6
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/main.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+
+#include <stdint.h>
+
+static void some_delay(uint32_t counts)
+{
+ for (uint32_t index = 0u; index < counts; ++index)
+ __asm("nop");
+}
+
+int main(void)
+{
+ gpio_init_green_led();
+
+ while (1) {
+ gpio_toggle_green_led();
+ some_delay(1000000u);
+ }
+}
diff --git a/examples/baremetal/pca10040/greenblink/system.h b/examples/baremetal/pca10040/greenblink/system.h
new file mode 100644
index 000000000..bf9e4b352
--- /dev/null
+++ b/examples/baremetal/pca10040/greenblink/system.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __IO volatile
+
+struct gpio_regs_map {
+ uint32_t RESERVED0[321u];
+ __IO uint32_t OUT;
+ __IO uint32_t OUTSET;
+ __IO uint32_t OUTCLR;
+ __IO uint32_t IN;
+ __IO uint32_t DIR;
+ __IO uint32_t DIRSET;
+ __IO uint32_t DIRCLR;
+ __IO uint32_t LATCH;
+ __IO uint32_t DETECTMODE;
+ uint32_t RESERVED1[118u];
+ __IO uint32_t PIN_CNF[32u];
+};
+
+#define GPIO_REGS_ADDRESS (0x50000000u)
+#define GPIOD_REGS_MAP ((struct gpio_regs_map *)GPIO_REGS_ADDRESS)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SYSTEM_H
diff --git a/examples/baremetal/pca10040/pca10040.qbs b/examples/baremetal/pca10040/pca10040.qbs
new file mode 100644
index 000000000..e5e516c3f
--- /dev/null
+++ b/examples/baremetal/pca10040/pca10040.qbs
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+Project {
+ name: "Examples for pca10040 board"
+ references: [
+ "greenblink/greenblink.qbs"
+ ]
+}
diff --git a/examples/baremetal/stm32f103/greenblink/README.md b/examples/baremetal/stm32f103/greenblink/README.md
new file mode 100644
index 000000000..8d19ac73a
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/README.md
@@ -0,0 +1,10 @@
+This example demonstrates how to build a bare-metal application using
+different ARM toolchains. It is designed for the stm32f103 "Blue Pill"
+evaluation kit (based on stm32f103c8 MCU) and simply flashes the green
+LED on the board.
+
+The following toolchains are supported:
+
+ * GNU Arm Embedded Toolchain
+ * IAR Embedded Workbench
+ * KEIL Microcontroller Development Kit
diff --git a/examples/baremetal/stm32f103/greenblink/gcc/flash.ld b/examples/baremetal/stm32f103/greenblink/gcc/flash.ld
new file mode 100644
index 000000000..3fe5c1563
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/gcc/flash.ld
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* Entry point (defined in assembled file). */
+ENTRY(reset_handler)
+
+/* End of RAM, it is the user mode stack pointer address. */
+_end_of_stack = 0x20005000;
+
+/* Generate a link error if heap and stack don't fit into RAM. */
+_size_of_heap = 0x200; /* Required amount of heap. */
+_size_of_stack = 0x400; /* Required amount of stack. */
+
+MEMORY {
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
+ FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
+}
+
+SECTIONS {
+ /* The vectors table goes into FLASH. */
+ .isr_vector : {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code. */
+ . = ALIGN(4);
+ } > FLASH
+
+ /* The program code and other data goes into FLASH. */
+ .text : {
+ . = ALIGN(4);
+ *(.text)
+ *(.text*)
+ *(.glue_7) /* Glue arm to thumb code. */
+ *(.glue_7t) /* Glue thumb to arm code. */
+ *(.eh_frame)
+ KEEP(*(.init))
+ KEEP(*(.fini))
+ . = ALIGN(4);
+ _end_of_text_section = .; /* Export global symbol at end of code. */
+ } > FLASH
+
+ /* Constant data goes into FLASH. */
+ .rodata : {
+ . = ALIGN(4);
+ *(.rodata)
+ *(.rodata*)
+ . = ALIGN(4);
+ } > FLASH
+
+ .ARM.extab : {
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ } > FLASH
+
+ .ARM : {
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ } > FLASH
+
+ .preinit_array : {
+ PROVIDE_HIDDEN(__preinit_array_start = .);
+ KEEP(*(.preinit_array*))
+ PROVIDE_HIDDEN(__preinit_array_end = .);
+ } > FLASH
+
+ .init_array : {
+ PROVIDE_HIDDEN(__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array*))
+ PROVIDE_HIDDEN(__init_array_end = .);
+ } > FLASH
+
+ .fini_array : {
+ PROVIDE_HIDDEN(__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array*))
+ PROVIDE_HIDDEN(__fini_array_end = .);
+ } > FLASH
+
+ _start_of_init_data_section = LOADADDR(.data);
+
+ /* Initialized data sections goes into RAM, load LMA copy after code. */
+ .data : {
+ . = ALIGN(4);
+ _start_of_data_section = .; /* Export global symbol at data start. */
+ *(.data)
+ *(.data*)
+ . = ALIGN(4);
+ _end_of_data_section = .; /* Export global symbol at data end. */
+ } > RAM AT > FLASH
+
+ /* Uninitialized data section. */
+ . = ALIGN(4);
+ .bss : {
+ /* This is used by the startup in order to initialize the .bss secion. */
+ _start_of_bss_section = .; /* Export global symbol at bss start. */
+ __bss_start__ = _start_of_bss_section;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(4);
+ _end_of_bss_section = .; /* Export global symbol at bss end. */
+ __bss_end__ = _end_of_bss_section;
+ } > RAM
+
+ /* Used to check that there is enough RAM left. */
+ ._user_heap_stack : {
+ . = ALIGN(4);
+ PROVIDE(end = .);
+ PROVIDE(_end = .);
+ . = . + _size_of_heap;
+ . = . + _size_of_stack;
+ . = ALIGN(4);
+ } > RAM
+
+ /* Remove information from the standard libraries. */
+ /DISCARD/ : {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : {
+ *(.ARM.attributes)
+ }
+}
diff --git a/examples/baremetal/stm32f103/greenblink/gcc/startup.s b/examples/baremetal/stm32f103/greenblink/gcc/startup.s
new file mode 100644
index 000000000..5bb262f16
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/gcc/startup.s
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+.syntax unified
+.cpu cortex-m3
+.fpu softvfp
+.thumb
+
+// These symbols are exported from the linker script.
+.word _start_of_init_data_section
+.word _start_of_data_section
+.word _end_of_data_section
+.word _start_of_bss_section
+.word _end_of_bss_section
+
+.equ _boot_ram, 0xF108F85F
+
+.section .text.reset_handler
+.weak reset_handler
+.type reset_handler, %function
+reset_handler:
+ // Copy the data segment initializers from flash to SRAM.
+ movs r1, #0
+ b _loop_copy_data_init
+_copy_data_init:
+ ldr r3, =_start_of_init_data_section
+ ldr r3, [r3, r1]
+ str r3, [r0, r1]
+ adds r1, r1, #4
+_loop_copy_data_init:
+ ldr r0, =_start_of_data_section
+ ldr r3, =_end_of_data_section
+ adds r2, r0, r1
+ cmp r2, r3
+ bcc _copy_data_init
+ ldr r2, =_start_of_bss_section
+ b _loop_fill_zero_bss
+
+ // Zero fill the bss segment.
+_fill_zero_bss:
+ movs r3, #0
+ str r3, [r2], #4
+_loop_fill_zero_bss:
+ ldr r3, = _end_of_bss_section
+ cmp r2, r3
+ bcc _fill_zero_bss
+
+ // Call the static constructors.
+ bl __libc_init_array
+
+ // Call the application entry point.
+ bl main
+ bx lr
+.size reset_handler, .-reset_handler
+
+// Define the empty vectors table.
+.section .isr_vector,"a",%progbits
+.type _vectors_table, %object
+.size _vectors_table, .-_vectors_table
+_vectors_table:
+ // Generic interrupts offset.
+ .word _end_of_stack // Initial stack pointer value.
+ .word reset_handler // Reset.
+ .word 0 // NMI.
+ .word 0 // Hard fault.
+ .word 0 // Memory management fault.
+ .word 0 // Bus fault.
+ .word 0 // Usage fault.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // Reserved.
+ .word 0 // SVC.
+ .word 0 // Debug monitor.
+ .word 0 // Reserved.
+ .word 0 // PendSV.
+ .word 0 // SysTick.
+
+ // External interrupts offset.
+ .word 0 // Window watchdog.
+ .word 0 // PVD through EXTI Line detection.
+ .word 0 // Tamper and timestamps through the EXTI line.
+ .word 0 // RTC wakeup through the EXTI line.
+ .word 0 // FLASH.
+ .word 0 // RCC.
+ .word 0 // EXTI line0.
+ .word 0 // EXTI line1.
+ .word 0 // EXTI line2.
+ .word 0 // EXTI line3.
+ .word 0 // EXTI line4.
+ .word 0 // DMA1 stream 0.
+ .word 0 // DMA1 stream 1.
+ .word 0 // DMA1 stream 2.
+ .word 0 // DMA1 stream 3.
+ .word 0 // DMA1 stream 4.
+ .word 0 // DMA1 stream 5.
+ .word 0 // DMA1 stream 6.
+ .word 0 // ADC1/2.
+ .word 0 // USB HP/CAN1 TX.
+ .word 0 // USB LP / CAN1 RX0.
+ .word 0 // CAN1 RX1.
+ .word 0 // CAN1 SCE.
+ .word 0 // EXTI line [9:5]s.
+ .word 0 // TIM1 break.
+ .word 0 // TIM1 update.
+ .word 0 // TIM1 trigger and communication.
+ .word 0 // TIM1 capture compare.
+ .word 0 // TIM2.
+ .word 0 // TIM3.
+ .word 0 // TIM4.
+ .word 0 // I2C1 event.
+ .word 0 // I2C1 error.
+ .word 0 // I2C2 event.
+ .word 0 // I2C2 error.
+ .word 0 // SPI1.
+ .word 0 // SPI2.
+ .word 0 // USART1.
+ .word 0 // USART2.
+ .word 0 // USART3.
+ .word 0 // EXTI line [15:10]s.
+ .word 0 // RTC alarm.
+ .word 0 // USB wakeup.
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word _boot_ram // Boot RAM mode for stm32f10x medium density devices.
diff --git a/examples/baremetal/stm32f103/greenblink/gpio.c b/examples/baremetal/stm32f103/greenblink/gpio.c
new file mode 100644
index 000000000..84c87a2b9
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/gpio.c
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+#include "system.h"
+
+#define GPIO_GREEN_LED_PIN_POS (13u)
+#define GPIO_GREEN_LED_PIN (1u << GPIO_GREEN_LED_PIN_POS)
+
+// Bit definition for RCC_APB2ENR register.
+#define RCC_APB2ENR_IOPCEN_POS (4u)
+#define RCC_APB2ENR_IOPCEN (0x1u << RCC_APB2ENR_IOPCEN_POS)
+
+// Bit definition for GPIO_CRL register.
+#define GPIO_CRL_MODE_POS (0u) // MODE field position.
+#define GPIO_CRL_MODE_MSK (0x3u << GPIO_CRL_MODE_POS) // MODE field mask.
+#define GPIO_CRL_MODE_OUT_FREQ_LOW (0x2u << GPIO_CRL_MODE_POS) // As output with low frequency.
+
+#define GPIO_CRL_CNF_POS (2u) // CNF field position.
+#define GPIO_CRL_CNF_MSK (0x3u << GPIO_CRL_CNF_POS) // CNF field mask.
+#define GPIO_CRL_CNF_OUTPUT_PP (0x00000000u) // General purpose output push-pull.
+
+void gpio_init_green_led(void)
+{
+ // Enable RCC clock on GPIOC port.
+ RCC_REGS_MAP->APB2ENR |= RCC_APB2ENR_IOPCEN;
+ // Configure GPIOC pin #13.
+ const uint32_t offset = ((GPIO_GREEN_LED_PIN_POS - 8u) << 2u);
+ GPIOC_REGS_MAP->CRH &= ~((GPIO_CRL_MODE_MSK | GPIO_CRL_CNF_MSK) << offset);
+ GPIOC_REGS_MAP->CRH |= ((GPIO_CRL_MODE_OUT_FREQ_LOW | GPIO_CRL_CNF_OUTPUT_PP) << offset);
+}
+
+void gpio_toggle_green_led(void)
+{
+ GPIOC_REGS_MAP->ODR ^= GPIO_GREEN_LED_PIN;
+}
diff --git a/examples/baremetal/stm32f103/greenblink/gpio.h b/examples/baremetal/stm32f103/greenblink/gpio.h
new file mode 100644
index 000000000..9e931b715
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/gpio.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GPIO_H
+#define GPIO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gpio_init_green_led(void);
+void gpio_toggle_green_led(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPIO_H
diff --git a/examples/baremetal/stm32f103/greenblink/greenblink.qbs b/examples/baremetal/stm32f103/greenblink/greenblink.qbs
new file mode 100644
index 000000000..18fe8e536
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/greenblink.qbs
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+CppApplication {
+ condition: {
+ if (!qbs.architecture.startsWith("arm"))
+ return false;
+ return (qbs.toolchain.contains("gcc")
+ || qbs.toolchain.contains("iar")
+ || qbs.toolchain.contains("keil"))
+ && !qbs.toolchain.contains("xcode")
+ }
+ name: "stm32f103-greenblink"
+ cpp.cLanguageVersion: "c99"
+ cpp.positionIndependentCode: false
+
+ //
+ // GCC-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("gcc")
+ cpp.assemblerFlags: [
+ "-mcpu=cortex-m3"
+ ]
+ cpp.driverFlags: [
+ "-mcpu=cortex-m3",
+ "-specs=nosys.specs"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("gcc")
+ name: "GCC"
+ prefix: "gcc/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.ld"]
+ }
+ }
+
+ //
+ // IAR-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("iar")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m3",
+ "--fpu", "none"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m3",
+ "--fpu", "none"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("iar")
+ name: "IAR"
+ prefix: "iar/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.icf"]
+ }
+ }
+
+ //
+ // KEIL-specific properties and sources.
+ //
+
+ Properties {
+ condition: qbs.toolchain.contains("keil")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m3"
+ ]
+ cpp.driverFlags: [
+ "--cpu", "cortex-m3"
+ ]
+ }
+
+ Group {
+ condition: qbs.toolchain.contains("keil")
+ name: "KEIL"
+ prefix: "keil/"
+ Group {
+ name: "Startup"
+ fileTags: ["asm"]
+ files: ["startup.s"]
+ }
+ Group {
+ name: "Linker Script"
+ fileTags: ["linkerscript"]
+ files: ["flash.sct"]
+ }
+ }
+
+ //
+ // Common code.
+ //
+
+ Group {
+ name: "Gpio"
+ files: ["gpio.c", "gpio.h"]
+ }
+
+ Group {
+ name: "System"
+ files: ["system.h"]
+ }
+
+ files: ["main.c"]
+}
diff --git a/examples/baremetal/stm32f103/greenblink/iar/flash.icf b/examples/baremetal/stm32f103/greenblink/iar/flash.icf
new file mode 100644
index 000000000..1b424d29f
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/iar/flash.icf
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+define symbol _start_of_intvec_section = 0x08000000;
+
+define symbol _start_of_flash_section = 0x08000000;
+define symbol _end_of_flash_section = 0x0801FFFF;
+define symbol _start_of_ram_section = 0x20000000;
+define symbol _end_of_ram_section = 0x20004FFF;
+
+define symbol _min_stack_size = 0x400;
+define symbol _min_heap_size = 0x200;
+
+define memory mem with size = 4G;
+define region flash_section = mem:[from _start_of_flash_section to _end_of_flash_section];
+define region ram_section = mem:[from _start_of_ram_section to _end_of_ram_section];
+
+define block CSTACK with alignment = 8, size = _min_stack_size { };
+define block HEAP with alignment = 8, size = _min_heap_size { };
+
+initialize by copy { readwrite };
+do not initialize { section .noinit };
+
+place at address mem:_start_of_intvec_section { readonly section .intvec };
+
+place in flash_section { readonly };
+place in ram_section { readwrite, block CSTACK, block HEAP };
diff --git a/examples/baremetal/stm32f103/greenblink/iar/startup.s b/examples/baremetal/stm32f103/greenblink/iar/startup.s
new file mode 100644
index 000000000..cda2a4e7b
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/iar/startup.s
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+ MODULE ?cstartup
+
+ SECTION CSTACK:DATA:NOROOT(3)
+ SECTION .intvec:CODE:NOROOT(2)
+
+ EXTERN __iar_program_start
+
+ PUBLIC _vectors_table
+ DATA
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD sfe(CSTACK) ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; MPU fault.
+ DCD 0 ; Bus fault.
+ DCD 0 ; Usage fault.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Debug monitor.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; Window watchdog.
+ DCD 0 ; PVD through EXTI line detection.
+ DCD 0 ; Tamper.
+ DCD 0 ; RTC.
+ DCD 0 ; Flash.
+ DCD 0 ; RCC.
+ DCD 0 ; EXTI line 0.
+ DCD 0 ; EXTI line 1.
+ DCD 0 ; EXTI line 2.
+ DCD 0 ; EXTI line 3.
+ DCD 0 ; EXTI line 4.
+ DCD 0 ; DMA1 channel 1.
+ DCD 0 ; DMA1 channel 2.
+ DCD 0 ; DMA1 channel 3.
+ DCD 0 ; DMA1 channel 4.
+ DCD 0 ; DMA1 channel 5.
+ DCD 0 ; DMA1 channel 6.
+ DCD 0 ; DMA1 channel 7.
+ DCD 0 ; ADC1/2.
+ DCD 0 ; USB high priority or CAN1 TX.
+ DCD 0 ; USB low priority or CAN1 RX0.
+ DCD 0 ; CAN1 RX1.
+ DCD 0 ; CAN1 SCE.
+ DCD 0 ; EXTI line 9..5.
+ DCD 0 ; TIM1 break.
+ DCD 0 ; TIM1 update.
+ DCD 0 ; TIM1 trigger and commutation.
+ DCD 0 ; TIM1 capture compare.
+ DCD 0 ; TIM2.
+ DCD 0 ; TIM3.
+ DCD 0 ; TIM4.
+ DCD 0 ; I2C1 event.
+ DCD 0 ; I2C1 error.
+ DCD 0 ; I2C2 event.
+ DCD 0 ; I2C2 error.
+ DCD 0 ; SPI1.
+ DCD 0 ; SPI2.
+ DCD 0 ; USART1.
+ DCD 0 ; USART2.
+ DCD 0 ; USART3.
+ DCD 0 ; EXTI line 15..10.
+ DCD 0 ; RTC alarm through EXTI line.
+ DCD 0 ; USB wakeup from suspend.
+
+ ;; Reset handler.
+ THUMB
+ PUBWEAK reset_handler
+ SECTION .text:CODE:REORDER:NOROOT(2)
+reset_handler
+ BLX R0
+ LDR R0, =__iar_program_start
+ BX R0
+
+ END
diff --git a/examples/baremetal/stm32f103/greenblink/keil/flash.sct b/examples/baremetal/stm32f103/greenblink/keil/flash.sct
new file mode 100644
index 000000000..3547ca2c0
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/keil/flash.sct
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+;; Load region size_region.
+LR_IROM1 0x08000000 0x00010000 {
+ ;; Load address = execution address.
+ ER_IROM1 0x08000000 0x00010000 {
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ .ANY (+RO)
+ .ANY (+XO)
+ }
+
+ ; RW data.
+ RW_IRAM1 0x20000000 0x00005000 {
+ .ANY (+RW +ZI)
+ }
+}
diff --git a/examples/baremetal/stm32f103/greenblink/keil/startup.s b/examples/baremetal/stm32f103/greenblink/keil/startup.s
new file mode 100644
index 000000000..d80de94c6
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/keil/startup.s
@@ -0,0 +1,145 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+;; Contact: https://www.qt.io/licensing/
+;;
+;; This file is part of the examples of Qbs.
+;;
+;; $QT_BEGIN_LICENSE:BSD$
+;; Commercial License Usage
+;; Licensees holding valid commercial Qt licenses may use this file in
+;; accordance with the commercial license agreement provided with the
+;; Software or, alternatively, in accordance with the terms contained in
+;; a written agreement between you and The Qt Company. For licensing terms
+;; and conditions see https://www.qt.io/terms-conditions. For further
+;; information use the contact form at https://www.qt.io/contact-us.
+;;
+;; BSD License Usage
+;; Alternatively, you may use this file under the terms of the BSD license
+;; as follows:
+;;
+;; "Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following conditions are
+;; met:
+;; * Redistributions of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;; * Redistributions in binary form must reproduce the above copyright
+;; notice, this list of conditions and the following disclaimer in
+;; the documentation and/or other materials provided with the
+;; distribution.
+;; * Neither the name of The Qt Company Ltd nor the names of its
+;; contributors may be used to endorse or promote products derived
+;; from this software without specific prior written permission.
+;;
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+;; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+;; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+;;
+;; $QT_END_LICENSE$
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+_size_of_stack EQU 0x400
+_size_of_heap EQU 0x200
+
+;; Stack configuration.
+ AREA STACK, NOINIT, READWRITE, ALIGN=3
+_start_of_stack SPACE _size_of_stack
+_end_of_stack
+
+;; Heap configuration.
+ AREA HEAP, NOINIT, READWRITE, ALIGN=3
+_start_of_heap SPACE _size_of_heap
+_end_of_heap
+
+ PRESERVE8
+ THUMB
+
+;; Define the empty vectors table.
+ AREA RESET, DATA, READONLY
+_vectors_table
+ ;; Generic interrupts offset.
+ DCD _end_of_stack ; Initial stack pointer value.
+ DCD reset_handler ; Reset.
+ DCD 0 ; NMI.
+ DCD 0 ; Hard fault.
+ DCD 0 ; Memory management fault.
+ DCD 0 ; Bus fault.
+ DCD 0 ; Usage fault.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; Reserved.
+ DCD 0 ; SVC.
+ DCD 0 ; Debug monitor.
+ DCD 0 ; Reserved.
+ DCD 0 ; PendSV.
+ DCD 0 ; SysTick.
+ ;; External interrupts offset.
+ DCD 0 ; Window watchdog.
+ DCD 0 ; PVD through EXTI line detection.
+ DCD 0 ; Tamper and TimeStamps through the EXTI line.
+ DCD 0 ; RTC wakeup through the EXTI line.
+ DCD 0 ; FLASH.
+ DCD 0 ; RCC.
+ DCD 0 ; EXTI line0.
+ DCD 0 ; EXTI line1.
+ DCD 0 ; EXTI line2.
+ DCD 0 ; EXTI line3.
+ DCD 0 ; EXTI line4.
+ DCD 0 ; DMA1 channel 1.
+ DCD 0 ; DMA1 channel 2.
+ DCD 0 ; DMA1 channel 3.
+ DCD 0 ; DMA1 channel 4.
+ DCD 0 ; DMA1 channel 5.
+ DCD 0 ; DMA1 channel 6.
+ DCD 0 ; DMA1 channel 7.
+ DCD 0 ; ADC1/2.
+ DCD 0 ; USB high priority or CAN1 TX.
+ DCD 0 ; USB low priority or CAN1 RX0.
+ DCD 0 ; CAN1 RX1.
+ DCD 0 ; CAN1 SCE.
+ DCD 0 ; EXTI line 9..5.
+ DCD 0 ; TIM1 break.
+ DCD 0 ; TIM1 update.
+ DCD 0 ; TIM1 trigger and commutation.
+ DCD 0 ; IM1 capture compare.
+ DCD 0 ; TIM2.
+ DCD 0 ; TIM3.
+ DCD 0 ; TIM4.
+ DCD 0 ; I2C1 event.
+ DCD 0 ; I2C1 error.
+ DCD 0 ; I2C2 event.
+ DCD 0 ; I2C2 error.
+ DCD 0 ; SPI1.
+ DCD 0 ; SPI2.
+ DCD 0 ; USART1.
+ DCD 0 ; USART2.
+ DCD 0 ; USART3.
+ DCD 0 ; EXTI line 15..10.
+ DCD 0 ; RTC alarm through EXTI line.
+ DCD 0 ; USB wakeup from suspend.
+_end_of_vectors_table
+
+_size_of_vectors_table EQU _end_of_vectors_table - _vectors_table
+
+ AREA |.text|, CODE, READONLY
+;; Reset handler.
+reset_handler PROC
+ EXPORT reset_handler [WEAK]
+ IMPORT main
+ LDR R0, =main
+ BX R0
+ ENDP
+ ALIGN
+
+ END
diff --git a/examples/baremetal/stm32f103/greenblink/main.c b/examples/baremetal/stm32f103/greenblink/main.c
new file mode 100644
index 000000000..21bc5badc
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/main.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gpio.h"
+
+#include <stdint.h>
+
+static void some_delay(uint32_t counts)
+{
+ for (uint32_t index = 0u; index < counts; ++index)
+ __asm("nop");
+}
+
+int main(void)
+{
+ gpio_init_green_led();
+
+ while (1) {
+ gpio_toggle_green_led();
+ some_delay(100000u);
+ }
+}
diff --git a/examples/baremetal/stm32f103/greenblink/system.h b/examples/baremetal/stm32f103/greenblink/system.h
new file mode 100644
index 000000000..d18854bea
--- /dev/null
+++ b/examples/baremetal/stm32f103/greenblink/system.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __IO volatile
+
+// General purpose input/output registers map.
+struct gpio_regs_map {
+ __IO uint32_t CRL;
+ __IO uint32_t CRH;
+ __IO uint32_t IDR;
+ __IO uint32_t ODR;
+ __IO uint32_t BSRR;
+ __IO uint32_t BRR;
+ __IO uint32_t LCKR;
+};
+
+// Reset and clock control registers map.
+struct rcc_regs_map {
+ __IO uint32_t CR;
+ __IO uint32_t CFGR;
+ __IO uint32_t CIR;
+ __IO uint32_t APB2RSTR;
+ __IO uint32_t APB1RSTR;
+ __IO uint32_t AHBENR;
+ __IO uint32_t APB2ENR;
+ __IO uint32_t APB1ENR;
+ __IO uint32_t BDCR;
+ __IO uint32_t CSR;
+};
+
+#define PERIPH_ADDRESS (0x40000000u)
+
+#define APB2PERIPH_ADDRESS (PERIPH_ADDRESS + 0x00010000u)
+#define AHBPERIPH_ADDRESS (PERIPH_ADDRESS + 0x00020000u)
+
+#define GPIOC_REGS_ADDRESS (APB2PERIPH_ADDRESS + 0x00001000u)
+#define RCC_REGS_ADDRESS (AHBPERIPH_ADDRESS + 0x00001000u)
+
+#define GPIOC_REGS_MAP ((struct gpio_regs_map *)GPIOC_REGS_ADDRESS)
+#define RCC_REGS_MAP ((struct rcc_regs_map *)RCC_REGS_ADDRESS)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SYSTEM_H
diff --git a/examples/baremetal/stm32f103/stm32f103.qbs b/examples/baremetal/stm32f103/stm32f103.qbs
new file mode 100644
index 000000000..705502c52
--- /dev/null
+++ b/examples/baremetal/stm32f103/stm32f103.qbs
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of Qbs.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+Project {
+ name: "Examples for stm32f103 board"
+ references: [
+ "greenblink/greenblink.qbs"
+ ]
+}
diff --git a/examples/baremetal/stm32f4discovery/blueblink/blueblink.qbs b/examples/baremetal/stm32f4discovery/blueblink/blueblink.qbs
index 5ccf8b3b0..f2e1dfcc9 100644
--- a/examples/baremetal/stm32f4discovery/blueblink/blueblink.qbs
+++ b/examples/baremetal/stm32f4discovery/blueblink/blueblink.qbs
@@ -48,15 +48,14 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
- if (!qbs.architecture.contains("arm"))
+ if (!qbs.architecture.startsWith("arm"))
return false;
- return qbs.toolchain.contains("gcc")
- || qbs.toolchain.contains("iar")
- || qbs.toolchain.contains("keil")
+ return (qbs.toolchain.contains("gcc")
+ || qbs.toolchain.contains("iar")
+ || qbs.toolchain.contains("keil"))
+ && !qbs.toolchain.contains("xcode")
}
name: "stm32f4discovery-blueblink"
cpp.cLanguageVersion: "c99"
@@ -68,6 +67,11 @@ CppApplication {
Properties {
condition: qbs.toolchain.contains("gcc")
+ cpp.assemblerFlags: [
+ "-mcpu=cortex-m4",
+ "-mfloat-abi=hard",
+ "-mfpu=fpv4-sp-d16",
+ ]
cpp.driverFlags: [
"-mcpu=cortex-m4",
"-mfloat-abi=hard",
@@ -98,6 +102,10 @@ CppApplication {
Properties {
condition: qbs.toolchain.contains("iar")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m4",
+ "--fpu", "vfpv4_sp"
+ ]
cpp.driverFlags: [
"--cpu", "cortex-m4",
"--fpu", "vfpv4_sp"
@@ -126,6 +134,9 @@ CppApplication {
Properties {
condition: qbs.toolchain.contains("keil")
+ cpp.assemblerFlags: [
+ "--cpu", "cortex-m4.fp"
+ ]
cpp.driverFlags: [
"--cpu", "cortex-m4.fp"
]
diff --git a/examples/baremetal/stm32f4discovery/stm32f4discovery.qbs b/examples/baremetal/stm32f4discovery/stm32f4discovery.qbs
index a402848ca..cbb3bdc3a 100644
--- a/examples/baremetal/stm32f4discovery/stm32f4discovery.qbs
+++ b/examples/baremetal/stm32f4discovery/stm32f4discovery.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for stm32f4discovery board"
references: [
diff --git a/examples/baremetal/stm8s103f3/redblink/redblink.qbs b/examples/baremetal/stm8s103f3/redblink/redblink.qbs
index 197bae8ae..c01f323cd 100644
--- a/examples/baremetal/stm8s103f3/redblink/redblink.qbs
+++ b/examples/baremetal/stm8s103f3/redblink/redblink.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
CppApplication {
condition: {
if (!qbs.architecture.contains("stm8"))
diff --git a/examples/baremetal/stm8s103f3/stm8s103f3.qbs b/examples/baremetal/stm8s103f3/stm8s103f3.qbs
index 922c4c1f0..cfbfc87a8 100644
--- a/examples/baremetal/stm8s103f3/stm8s103f3.qbs
+++ b/examples/baremetal/stm8s103f3/stm8s103f3.qbs
@@ -48,8 +48,6 @@
**
****************************************************************************/
-import qbs
-
Project {
name: "Examples for stm8s103f3 board"
references: [