HackMD
  • Beta
    Beta  Get a sneak peek of HackMD’s new design
    Turn on the feature preview and give us feedback.
    Go → Got it
      • Create new note
      • Create a note from template
    • Beta  Get a sneak peek of HackMD’s new design
      Beta  Get a sneak peek of HackMD’s new design
      Turn on the feature preview and give us feedback.
      Go → Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Please check the box to agree to the Community Guidelines.
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive Export to Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive Import from Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Export to Google Drive Gist
    Import
    Dropbox Google Drive Import from Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Please check the box to agree to the Community Guidelines.
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Rust Embedded Workshop Notepad This document is for alignment during the workshop. Don't be too shy to extend the document and help others. 🦀:blush: Workshop page: https://braun-embedded.com/workshop/ Workshop package: https://braun-embedded.com/barcelona-2019-11-09.zip ## Thanks Thank you for the great workshop Hanno and Matthias! ## Open questions :construction: :tada: This is your place to add new questions and raise issues. We'll try to answer them collaboratively. ## Known issues ### Installing OpenOCD on NixOS Use the package from https://pastebin.com/wEYHhM7z . If you need it, you can use the binary cache at https://thequux.cachix.org/ to save some compile time. ### Installing OpenOCD on macOS You need a pretty recent version of OpenOCD. Homebrew is your friend. ``` brew install open-ocd --HEAD ``` ### Error: arm-none-eabi-gdb ```rust error: could not execute process `arm-none-eabi-gdb -tui -q -x openocd.gdb target/thumbv6m-none-eabi/release/examples/gpio_simple` (never executed) Caused by: No such file or directory (os error 2) ``` Please install the [GNU toolchain for your platform](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads). For macOS, you can use [this homebrew tap](https://github.com/osx-cross/homebrew-arm). > [name=Evan Schwartz] Does anyone know which package to use on Ubuntu? > [name=Wouter Geraedts] `gdb-multiarch`, also change the path to `gdb-multiarch` in `.cargo/config`. > [name=Wouter Geraedts] > It's in the project-folder, i.e. `/minimal/.cargo/config` > ``` > [target.thumbv6m-none-eabi] > runner = "gdb-multiarch -tui -q -x openocd.gdb" > ``` ### Error: Clearing lockup after double fault If you get the following error message when you run your code: ``` lpc84x.cpu -- clearing lockup after double fault Program received signal SIGINT, Interrupt. 0xfffffffe in ?? () (gdb) cont Continuing. target not halted target lpc84x.cpu was not halted when resume was requested ``` Please push the "reset" button on the LPCXpresso. That's the black button next to the white button. :wink: After that, type `cont` or `continue` and hit `Enter`. The program should now run. > [name=nrxus] Does this have to be done every time the program is restarted? > [name=Wouter Geraedts] Mine stays in this mode and does not seem to run my code. ### Device not found After `lpc8xx-hal$ cargo run --features=845-rt --example gpio_delay` ``` ┌──examples/gpio_delay.rs─────────────────────────────────────────────────────────────────────────────────────┐ │8 #[entry] │ │9 fn main() -> ! { │ │10 // Get access to the device's peripherals. Since only one instance of this │ │11 // struct can exist, the call to `take` returns an `Option<Peripherals>`. │ │12 // If we tried to call the method a second time, it would return `None`, but │ │13 // we're only calling it the one time here, so we can safely `unwrap` the │ │14 // `Option` without causing a panic. │ │15 let p = Peripherals::take().unwrap(); │ │16 │ │17 // Initialize the APIs of the peripherals we need. │ │18 let swm = p.SWM.split(); │ │19 let mut delay = Delay::new(p.SYST); │ │20 #[cfg(feature = "82x")] │ │21 let gpio = p.GPIO; // GPIO is initialized by default on LPC82x. │ │22 #[cfg(feature = "845")] │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ exec No process In: L?? PC: ?? Info : only one transport option; autoselect 'swd' Warn : Transport "swd" was already selected target/openocd.cfg:8: Error: Can't find target/lpc84x.cfg in procedure 'script' at file "embedded:startup.tcl", line 60 at file "target/openocd.cfg", line 8 openocd.gdb:1: Error in sourced command file: Remote communication error. Target disconnected.: Connection reset by peer. (gdb) ``` Now what? > [name=Wouter Geraedts] ~~You probably are running Ubuntu. The scripts provided with the Ubuntu openocd do not have the specific `lpc84x.cfg` file. > Change the file to `lpc8xx.cfg` in `openocd.cfg`. I.e.~~ > ``` > source [find target/lpc8xx.cfg] > ``` > > Ubuntu repository OpenOCD is outdated, compile OpenOCD yourself from [this mirror](https://github.com/ntfreak/openocd). > Compile openocd with `./configure --enable-cmsis-dap`. ### Can't find target/openocd.cfg > [name=gakonst] (MacOS). > There is an openocd.cfg generated under `./target/thumbv6m-none-eabi/release/build/lpc8xx-hal-e9e3756869db2498/out/openocd.cfg`, copying it to `./target/openocd.cfg` doesn't help. > [name=polly] > Happens on arch for me > [This](https://elinux.org/OpenOCD_Troubleshooting:_Can%27t_Find_File.cfg#Can.27t_Find_openocd.cfg) might be relevant When running `cargo run --features=845-rt --example gpio_delay` ``` Reading symbols from target/thumbv6m-none-eabi/debug/examples/gpio_delay... Open On-Chip Debugger 0.10.0+dev-00954-gded679902 (2019-11-05-14:28) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html embedded:startup.tcl:26: Error: Can't find target/openocd.cfg in procedure 'script' at file "embedded:startup.tcl", line 26 openocd.gdb:1: Error in sourced command file: Remote communication error. Target disconnected.: Connection reset by peer. (gdb) ``` **SOLUTION: Revert to git hash `969b67d39a45895783b8e0662a272e8d3ce27d42`, at the moment of writing this HEAD does not work (due to last minute changes before the talk)** ;) I'm running Debian 9 and the OCD version from apt was 0.9. I uninstalled it and downloaded it for that website. Then I have version 0.10. See question below about where to extract the tgz file? > [name=gakonst] `brew install openocd` gave 0.10.0, still failing ### Compilation failure (Solved) When running `cargo run --features=845-rt --example gpio_delay` > rustc 1.32.0 (9fda7c223 2019-01-16) ``` error[E0658]: renaming imports with `_` is unstable (see issue #48216) --> src/lib.rs:145:13 | 145 | pub use crate::sleep::Sleep as _; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. error: Could not compile `lpc8xx-hal`. ``` **SOLUTION**: Update rust to latest stable version: rustc 1.39.0 (4560ea788 2019-11-04) > rustup update ### warning: unrecognized item "timeout" in "qSupported" response Full error: ``` warning: unrecognized item "timeout" in "qSupported" response openocd.gdb:1: Error in sourced command file: Remote communication error. Target disconnected.: Connection reset by peer. ``` **Solution**: You're probably using stable openocd. Download the latest git version. latest git version -- thequux > [name=Evan Schwartz] I have this version and I'm still seeing the error: `xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:25)` > [name=gakonst] I have `v0.10.0-esp32-20191008` from [here](https://github.com/espressif/openocd-esp32/releases), same problem. > [name=flomonster] I might have a solution. After using the latest git version of openocd. Clean your project `cargo clean` then try to run it. (Let me know if it works for you) > [name=Evan Schwartz] I tried that and still got `openocd.gdb:1: Error in sourced command file:` (this might be the [Unknown Error](#unknown-error) below) > You need somehow to make OpenOCD view these files: https://github.com/espressif/openocd-esp32/tree/master/tcl/target. > [name=nrxus] The `cargo clean` command worked for me > [name=jap] `cargo clean` did not work for me, but unplugging the device did... > [name=Evan Schwartz] Neither `cargo clean` nor unplugging the device worked for me :crying_cat_face: > [name=gakonst] this is literally just the system being unable to find the config files, the error in sourced command file is the openocd.cfg file trying to import the file under interfaces/ :/ :sadface: ### Unknown error > [name=Doc] This means your board is not detected > In my case it was a bad USB cable !!!!!! <Insert angry face here> ``` openocd.gdb:1: Error in sourced command file: Remote communication error. Target disconnected.: Connection reset by peer. ``` > [name=pizzamig] You can re-run `cargo run` or type manually the commands contained in the openocd.gdb file: ``` target remote | openocd -f target/openocd.cfg load continue ``` Running `target remote` asks me to specify which device I'm connecting to, and even then, `openocd` run with the cfg file does not have the proper interface available ``` Error: The specified debug interface was not found (cmsis-dap) The following debug interfaces are available: 1: ftdi 2: usb_blaster 3: ft232r 4: jlink 5: vsllink 6: ulink 7: hla 8: osbdm 9: opendous 10: aice 11: xds110 ``` >[name=pizzamig] openocd has to be compiled with cmsis-dap enabled. An additional dependency is required, libhidapi, and `--enable-cmsis-dap` during configure ``` target/lpc8xx.cfg:10: Error: Can't find target/lpc1xxx.cfg in procedure 'script' at file "embedded:startup.tcl", line 26 at file "./openocd_82x.cfg", line 6 ``` >[name=pizzamig]Are you using `--features=845-rt`? `openocd_82x.cfg` is the configuration for a different board ### OCD setup I downloaded OCD from https://github.com/xpack-dev-tools/openocd-xpack/releases/ an untared it to some dir `xPacks/openocd/0.10.0-13/`. How is this supposed to be used because just having it unpacked will do nothing with it and the self check command `cargo run --features=845-rt --example gpio_delay` will no know about it. How are the executable and the config files found? > [name=Evan Schwartz] I just manually added that folder to the path (`export PATH=/path/to/xPacks/openocd/0.10.0-13/:$PATH`) > [name=pizzamig] openocd is invoked by gdb via the command `target remote | openocd -f target/openocd.cfg` (the first line of openocd.gdb) but it has to be reachable by your shell. Alternatively, you can modify the openocd.gdb file using an absolute pathname for openocd ### udev: configured OK? (Debian) How to check that it is set up correctly? Command: ... Expected response: .... ### LED not working Level of gpio and LED is counter intuitive for non-embedded developers Solution: set_high() -> led off set_low() -> led on > [name=Wouter Geraedts] Try running it in release mode with `cargo run --release`. This was what worked for me. ### Did someone got to interact with Touch capacitor? Trying to read using `.read().istouch().bit_is_set()` but I guess there is some setup to do?

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully