Giter VIP home page Giter VIP logo

nrf9160-demo's Introduction

nrf9160-blink

An example Rust project for the nRF9160 LTE SiP

This project is developed and maintained by 42 Technology (www.42technology.com)

Features

  • Is started by the Nordic 'secure bootloader' and operates in ‘insecure’ mode
  • Uses just 140 KiB out of 768 KiB of Application Flash
  • Uses just 8 KiB out of the 128 KiB Application RAM (plus stack)
  • Uses the pre-compiled Nordic libbsd static library for mbedTLS, the Nordic socket API, access to the LTE modem, etc.
  • Demonstrates embedded-hal compliant drivers for the nRF9160's Timer, GPIO and UARTE peripherals
  • Has a menu-driven interface over UARTE0 (which appears as a USB Serial device)
  • Demonstrates access to HTTP services over TLS

Dependencies

To build embedded programs using this template you'll need:

  • Rust rustc 1.36.0 (a53f9df32 2019-07-03) or newer

  • rust-std components (pre-compiled core crate) for armv8m.main targets.

  • Bindgen (we used 0.51)

  • GCC for bare-metal ARM (arm-none-eabi-gcc), with the newlib C library

  • clang

To get these things on Ubuntu 18.04, run:

$ apt-get update && apt-get install -y curl llvm-dev libclang-dev clang git
$ curl -Lq https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 | tar xjf - -C ~
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s - '-y'
$ source $HOME/.cargo/env
$ rustup target add thumbv8m.main-none-eabi
$ cargo install bindgen
$ export PATH=$PATH:~/gcc-arm-none-eabi-8-2018-q4-major/bin
$ export NEWLIB_PATH=~/gcc-arm-none-eabi-8-2018-q4-major/arm-none-eabi/include

To build, just run:

$ ./release.sh

The outputs are placed in target/bin/release. You can also run ./debug.sh if you want an unoptimised version.

To flash, load up J-Link Commander, and run:

J-Link> usb
J-Link> connect
# select nRF9160
J-Link> r # for reset
J-Link> loadfile ~/nrf9160-blink/target/bin/release/nrf9160-demo.hex # to flash the board
J-Link> r # for reset
J-Link> g # for go

NOTE: The Nordic secure bootloader will not boot if the USB-Serial is disconnected. Connect your serial terminal to the lowest numbered COM port on the nRF9160-DK then press the 'Reset' button to reboot the chip.

Upstream

This project is based on cortex-m-quickstart by the Rust Embedded team. We are grateful for their work.

License

This example is licensed to your under either:

at your option. Please note that any dependencies, including the Nordic libbsd library, may be under different licensing terms.

nrf9160-demo's People

Stargazers

 avatar Darko Yovanoski avatar Ellen Poe avatar Phil avatar  avatar  avatar  avatar Zhongqiu Zhao avatar John Wass avatar Jared Wolff avatar  avatar Håkan Olsson avatar Charles Cai avatar  avatar Jaanus Torp avatar Christoph Grabo avatar Henrik Mohr avatar Arnaud Durand avatar Marcel avatar Marcin Szymczyk avatar

Watchers

Jaanus Torp avatar James Cloos avatar Marcin Szymczyk avatar Fernando avatar Jonathan Pallant avatar

nrf9160-demo's Issues

Remove bindgen dependancy?

I am new to Rust so take my suggestion with a huge grain of salt.
To simplify for new users it would be great to remove the clang and bindgen dependency.

I have noticed that issue that is listed as the reason for bindgen in https://github.com/thejpster/nrfxlib-sys is closed:
rust-lang/cargo#5730

Guess Cargo issue 5730 not solving the problem but should it not be possible to solve this with something precompiled like they do in:
https://github.com/rusqlite/rusqlite#binding-generation

BR Håkan

getting the demo to run

I'm struggling to get the demo to run. I'm using the Icarus board and I'm connecting over SWD.

This is how I flash it:

JLinkExe -device NRF9160 -if SWD -speed 100 -autoconnect 1
SEGGER J-Link Commander V6.84a (Compiled Sep  7 2020 17:28:57)
DLL version V6.84a, compiled Sep  7 2020 17:28:41

Connecting to J-Link via USB...O.K.
Firmware: J-Link EDU Mini V1 compiled Jul 17 2020 16:25:21
Hardware version: V1.00
S/N: 801026105
License(s): FlashBP, GDB
VTref=3.297V
Device "NRF9160_XXAA" selected.


Connecting to target via SWD
ConfigTargetSettings() start
---Setting ROM table---
ConfigTargetSettings() end
Found SW-DP with ID 0x6BA02477
DPIDR: 0x6BA02477
Scanning AP map to find all available APs
AP[7]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x84770001)
AP[1]: AHB-AP (IDR: 0x24770011)
AP[2]: JTAG-AP (IDR: 0x12880000)
AP[3]: APB-AP (IDR: 0x54770002)
AP[4]: JTAG-AP (IDR: 0x12880000)
AP[5]: JTAG-AP (IDR: 0x12880000)
AP[6]: MEM-AP (IDR: 0x128800A1)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FD212. Implementer code: 0x41 (ARM)
Found Cortex-M33 r0p2, Little endian.
FPUnit: 8 code (BP) slots and 0 literal slots
Security extension: implemented
Secure debug: enabled
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105900D, PID: 000BBD21 Cortex-M33
ROMTbl[0][1]: E0001000, CID: B105900D, PID: 000BBD21 DWT
ROMTbl[0][2]: E0002000, CID: B105900D, PID: 000BBD21 FPB
ROMTbl[0][3]: E0000000, CID: B105900D, PID: 000BBD21 ITM
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 002BBD21 ETM
ROMTbl[0][6]: E0042000, CID: B105900D, PID: 000BBD21 CTI
Cortex-M33 identified.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
J-Link>loadfile /Users/martin/repos/external/nrf9160-demo/target/bin/release/icarus.hex
Downloading file [/Users/martin/repos/external/nrf9160-demo/target/bin/release/icarus.hex]...
J-Link: Flash download: Bank 2 @ 0x00000000: 1 range affected (16384 bytes)
J-Link: Flash download: Total: 3.260s (Prepare: 0.369s, Compare: 0.252s, Erase: 0.372s, Program & Verify: 2.184s, Restore: 0.081s)
J-Link: Flash download: Program & Verify speed: 7 KB/s
O.K.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
J-Link>g

The output I get from screen is:

...
SPM: NS reset vector at 0xed61
SPM: prepare to jump to Non-Secure image.

The demo doesn't seem to run, however i.e. I get nothing on serial and the leds are not turning on.

You mentioned that the board wouldn't boot unless the usb-serial is connected. Is that true for the Icarus board too and does that mean I will need a DK to flash it?

not building

When I try to build I get:

error: no matching package named actinius-icarus-bsp found
location searched: https://github.com/nrf-rs/nrf52-hal

I would love to try rust on the nrf9160 and this repo seems like the best starting point but I can't get it to work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.