aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-09-27 17:13:39 +0200
committerlonkaars <loek@pipeframe.xyz>2022-09-27 17:13:39 +0200
commit3bf32b389dc7cfc85014d91356cfb0ec4cb4df70 (patch)
tree18a4d7150b55a8ab679c8a2ecc4479689b160293
parentf9f1e5bf0bd7e8b0ca0708fb63f4d2c56d47ef49 (diff)
windows toolchain setup
-rw-r--r--.gitignore1
-rw-r--r--.vscode/extensions.json6
-rw-r--r--.vscode/launch.json17
-rw-r--r--.vscode/settings.json10
-rw-r--r--.vscode/tasks.json45
-rw-r--r--readme.md8
-rw-r--r--scripts/install-msys2.ps13
-rw-r--r--scripts/install-packages-mingw.sh11
-rw-r--r--scripts/readme.md21
9 files changed, 122 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 5d0c3ad..cc3cefc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ stm32f091/.cache
client/makefile
client/client
.qmake.stash
+.vscode/.cortex-debug.registers.state.json
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..730e372
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "marus25.cortex-debug",
+ "ms-vscode.cpptools-extension-pack"
+ ]
+} \ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..e580e37
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,17 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "stm32 debug",
+ "cwd": "${workspaceFolder}",
+ "executable": "${workspaceFolder}/stm32f091/main.elf",
+ "request": "launch",
+ "type": "cortex-debug",
+ "runToEntryPoint": "main",
+ "servertype": "stlink",
+ "armToolchainPath": "C:/msys64/mingw64/bin",
+ "stlinkPath": "C:/msys64/mingw64/bin/st-util.exe",
+ "gdbPath": "C:/msys64/mingw64/bin/gdb-multiarch.exe"
+ }
+ ]
+} \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..565c3cf
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,10 @@
+{
+ "terminal.integrated.defaultProfile.windows": "MSYS2 MinGW x64",
+ "terminal.integrated.profiles.windows": {
+ "MSYS2 MinGW x64": {
+ "path": [ "C:/msys64/msys2_shell.cmd" ],
+ "args": [ "-defterm", "-no-start", "-mingw64", "-shell", "sh", "-here" ],
+ "icon": "terminal-bash"
+ }
+ }
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..fcf4120
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,45 @@
+{
+ "version": "2.0.0",
+ "options": {
+ "cwd": "${workspaceFolder}",
+ "shell": {
+ "executable": "C:/msys64/msys2_shell.cmd",
+ "args": [ "-defterm", "-no-start", "-mingw64", "-shell", "sh", "-here", "-c" ],
+ }
+ },
+ "tasks": [
+ {
+ "label": "build stm32 firmware",
+ "group": {
+ "isDefault": false,
+ "kind": "build"
+ },
+ "options": { "cwd": "${workspaceFolder}/stm32f091" },
+ "command": "make",
+ "args": [ "" ],
+ "type": "shell"
+ },
+ {
+ "label": "flash stm32 firmware",
+ "group": {
+ "isDefault": false,
+ "kind": "test"
+ },
+ "options": { "cwd": "${workspaceFolder}/stm32f091" },
+ "command": "make flash",
+ "args": [ "" ],
+ "type": "shell"
+ },
+ {
+ "label": "generate compilation db",
+ "group": {
+ "isDefault": false,
+ "kind": "test"
+ },
+ "options": { "cwd": "${workspaceFolder}/stm32f091" },
+ "command": "make compile_commands",
+ "args": [ "" ],
+ "type": "shell"
+ }
+ ]
+}
diff --git a/readme.md b/readme.md
index 7c9e0ae..71fefed 100644
--- a/readme.md
+++ b/readme.md
@@ -9,3 +9,11 @@
compilation. make sure to initialize and sync the git submodules, or re-clone
using the `--recursive` flag.
+## windows specific notes
+
+[link to windows toolchain installation](scripts/readme.md#windows-install)
+
+- if you're experiencing libusb-related issues while using st-link,
+ try using [zadig](https://zadig.akeo.ie/) to update the usb driver.
+- make sure to use the 64-bit version of msys2 (titled "MSYS2 MINGW64" in your
+ start menu)
diff --git a/scripts/install-msys2.ps1 b/scripts/install-msys2.ps1
new file mode 100644
index 0000000..e7e0472
--- /dev/null
+++ b/scripts/install-msys2.ps1
@@ -0,0 +1,3 @@
+Start-BitsTransfer -Source https://github.com/msys2/msys2-installer/releases/download/2022-09-04/msys2-x86_64-20220904.exe -Destination .\msys2-x86_64-latest.exe
+.\msys2-x86_64-latest.exe in --confirm-command --accept-messages --root C:/msys64
+Remove-Item .\msys2-x86_64-latest.exe
diff --git a/scripts/install-packages-mingw.sh b/scripts/install-packages-mingw.sh
new file mode 100644
index 0000000..aed48d9
--- /dev/null
+++ b/scripts/install-packages-mingw.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+pacman --noconfirm -Sy \
+ make git \
+ mingw-w64-x86_64-arm-none-eabi-gcc \
+ mingw-w64-x86_64-arm-none-eabi-gdb \
+ mingw-w64-x86_64-arm-none-eabi-newlib \
+ mingw-w64-x86_64-arm-none-eabi-binutils \
+ mingw-w64-x86_64-stlink \
+ mingw-w64-x86_64-gdb-multiarch
+
+printf "\n\n\ninstalling packages done!" \ No newline at end of file
diff --git a/scripts/readme.md b/scripts/readme.md
new file mode 100644
index 0000000..41742cf
--- /dev/null
+++ b/scripts/readme.md
@@ -0,0 +1,21 @@
+# scripts
+
+this subdirectory contains auxiliary scripts
+
+## windows install
+
+right-click "install-msys2.ps1" and click "Run with PowerShell" in the context
+menu. this will open powershell, install msys2, and close the powershell window
+once it's done installing.
+
+open "MSYS2 MINGW64" from the windows start menu, and use the `cd` command to
+navigate to this folder. drive letters (`C:\`) are written like `/c/` in msys2,
+and paths use forward slashes instead of backward slashes. e.g. `cd
+/c/Users/Loek/Documents/project-weerstation/scripts`.
+
+run `sh install-packages-mingw.sh`, and wait for the text "installing packages
+done!" to appear.
+
+you've now installed the necessary tools to compile, upload and debug the stm32
+firmware. shortcuts for commonly used commands are implemented as visual studio
+code tasks, so you don't have to be a terminal ninja.