Giter Club home page Giter Club logo

sonar's Introduction

STM32 M4 Template No IDE


Table of Contents

  1. Project Structure
  2. To Debug in VSCode
  3. Building and Flashing Steps
  4. How to use from WSL

PROJECT STRUCTURE:

  • GPIO: Includes a simple program that demonstrates how to blink LED on Nucleo F411RE
  • shared: required to build a project
  • To create a new project from template, run:
  $ tools/new_project.sh

TO DEBUG IN VSCODE:

  • Install toolchain and openocd:
  $ sudo apt install gcc-arm-none-eabi gdb-multiarch openocd
{
  "version": "0.2.0",
  "configurations": [
      {
          "cwd": "${workspaceRoot}",
          "executable": "./output/output_fmw.elf",
          "name": "Debug with OpenOCD",
          "request": "launch",
          "type": "cortex-debug",
          "servertype": "openocd",
          "configFiles": [
              "/usr/share/openocd/scripts/board/st_nucleo_f4.cfg"
          ],
          "searchDir": [],
          "runToEntryPoint": "main",
          "showDevDebugOutput": "none"
      }
  ]
}
  • Create settings.json:
{
    "cortex-debug.armToolchainPath": "/usr/bin",
    "cortex-debug.openocdPath": "/usr/bin/openocd",
    "cortex-debug.variableUseNaturalFormat": false
}
  • Create c_cpp_properties.json:
{
    "configurations": [
        {
            "name": "vscode_stm32_c_cpp_properties",
            "compilerPath": "/usr/bin/arm-none-eabi-gcc",
            "includePath": [
                "${workspaceRoot}/include/include/",
                "${workspaceRoot}/include/cmsis/include/",
                "${workspaceRoot}/include/drivers/inc"
            ],
            "defines": [
                "STM32F429xx"
            ],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

Building and Flashing Steps:

  • COMPILE THE DEMO CODE (src/main.c) :
  $ make 
  • FLASH :
  $ make flash

or

  $ stlink_flash.sh

or

  $ st-flash --reset write output/output_fmw.bin 0x8000000

or

  $ openocd -f /usr/share/openocd/scripts/board/st_nucleo_f4.cfg -c "program output/output_fmw.elf verify reset exit"
  • CLEAN BINARIES (OPTIONAL) :
  $ make clean
  • ERASE THE CHIP'S CONTENT (OPTIONAL) :
  $ make erase
  • START THE DEBUGGING SESSION :
  $ make debug
  • OPEN ANOTHER TERMINAL WINDOW, AND LET THE FUN BEGIN :
  $ make gdb

How to use from WSL:

  • On Windows side:
 $ usbipd wsl list

following by:

 $ usbipd wsl attach --busid <busid>
  • On Linux side (just to check):
 $ lsusb

Source: WSL + USB = ❤️

sonar's People

Contributors

cesiumua avatar

Watchers

 avatar

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.