aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-11-20 15:39:51 +0100
committerlonkaars <loek@pipeframe.xyz>2022-11-20 15:39:51 +0100
commita72b2ece0338905391538a78ea7b3df3a9a6f324 (patch)
tree41aa85e93ff71744331fffa61d0bc6183132c8d4
parent32c89c804b1922ab5dd45eade36f27ea8b3fb197 (diff)
working nrf source tree
-rw-r--r--.gitignore4
-rw-r--r--docs/research.md51
-rw-r--r--nrf528xx/CMakeLists.txt7
-rw-r--r--nrf528xx/main.c0
-rw-r--r--nrf528xx/prj.conf1
-rw-r--r--nrf528xx/readme.md22
-rw-r--r--nrf528xx/src/main.c13
7 files changed, 96 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 32b66c5..f6b22af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,9 +5,13 @@
**/.DS_Store
**/.$*
+# other
copyright/
temp/
+# build artifacts
+nrf528xx/build
+
# confui
confui/confui
diff --git a/docs/research.md b/docs/research.md
index c157eb5..554756f 100644
--- a/docs/research.md
+++ b/docs/research.md
@@ -111,6 +111,57 @@ Provisioning is the process by which a Bluetooth device (unprovisioned device) j
WIP
+# Manual nRF toolchain installation
+
+Installing the nRF toolchain can usually be done through Nordic's [nRF Connect
+for
+Dekstop](https://www.nordicsemi.com/Products/Development-tools/nrf-connect-for-desktop)
+application. This program is shipped as an AppImage file for Linux users, and
+though AppImage files are supposed to be containerized applications that will
+run in any environment, the latest nRF connect application is broken on Arch
+Linux as of November 20th 2022.
+
+Nordic also provides [manual installation
+instructions](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_installing.html)
+for generic Linux distro's, but here is a more specific guide for Arch users
+(assuming [yay](https://github.com/Jguer/yay) is installed):
+
+```bash
+# 1. install the required tools
+yay -S cmake python python-pip dtc
+
+# 2. install west
+pip3 install --user west
+# make sure to add ~/.local/bin to PATH in your shell's startup/environment
+
+# 3. nRF sdk code (change ~/.local/share/ncs if you want to install elsewhere)
+mkdir -p ~/.local/share/ncs
+cd ~/.local/share/ncs
+west init -m https://github.com/nrfconnect/sdk-nrf --mr v2.1.2
+west update
+west zephyr-export
+
+# 4. install other python dependencies (also in ncs folder)
+pip3 install --user -r zephyr/scripts/requirements.txt
+pip3 install --user -r nrf/scripts/requirements.txt
+pip3 install --user -r bootloader/mcuboot/scripts/requirements.txt
+
+# 5. install a toolchain
+yay -S zephyr-sdk
+
+# copy zephyrrc
+cp /usr/share/zephyr-sdk/zephyrrc ~/.zephyrrc
+```
+
+## Additional notes
+
+- The toolchain installation process takes up a lot of space (around 15G on my
+ system, excluding python packages)
+- The examples in `ncs/zephyr/samples/` are for any zephyr-compatible boards,
+ and require extra configuration before they'll compile without errors. To
+ test if you've set up the toolchain correctly, running `west build` in the
+ `ncs/nrf/samples/bluetooth/mesh/light/` sample should work
+
# Links
These are the links used for Bluetooth mesh research
diff --git a/nrf528xx/CMakeLists.txt b/nrf528xx/CMakeLists.txt
new file mode 100644
index 0000000..5265fc3
--- /dev/null
+++ b/nrf528xx/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.20.0)
+
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+project(NONE)
+
+target_sources(app PRIVATE src/main.c)
+
diff --git a/nrf528xx/main.c b/nrf528xx/main.c
deleted file mode 100644
index e69de29..0000000
--- a/nrf528xx/main.c
+++ /dev/null
diff --git a/nrf528xx/prj.conf b/nrf528xx/prj.conf
new file mode 100644
index 0000000..91c3c15
--- /dev/null
+++ b/nrf528xx/prj.conf
@@ -0,0 +1 @@
+CONFIG_GPIO=y
diff --git a/nrf528xx/readme.md b/nrf528xx/readme.md
index 77ea509..c54c54e 100644
--- a/nrf528xx/readme.md
+++ b/nrf528xx/readme.md
@@ -1,4 +1,22 @@
# nrf528xx subdirectory
-- compatible with nrf52833 and nrf52840
-- west for building and flashing
+## building
+
+```bash
+# build for big dev board
+west build -b nrf52833dk_nrf52833
+
+# build for usb dongle
+west build -b nrf52840dongle_nrf52840
+```
+
+## flashing
+
+```bash
+# incremental flash
+west flash
+
+# force erase flash first
+west flash --erase
+```
+
diff --git a/nrf528xx/src/main.c b/nrf528xx/src/main.c
new file mode 100644
index 0000000..649af38
--- /dev/null
+++ b/nrf528xx/src/main.c
@@ -0,0 +1,13 @@
+#include <zephyr/zephyr.h>
+#include <zephyr/drivers/gpio.h>
+
+static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
+
+void main() {
+ gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
+
+ while (1) {
+ gpio_pin_toggle_dt(&led);
+ k_msleep(1000);
+ }
+}