Code Monkey home page Code Monkey logo

stm32f030-cmsis-setup-for-linux-or-windows's Introduction

STM32F030-CMSIS-Setup-for-Linux-or-Windows

Procedure to install a bare-bones, command-line based, CMSIS-based toolchain to program the STM32F030 under Linux or Windows without STM's HAL. Includes a "Blinky" sanity check to confirm the toolchain is properlly installed and working.
Note that this is the same installation as STM32F103-CMSIS-Setup-for-Linux-or-Windows, but with links to the Blinky program that runs on the STM32F030 microcontroller. The installation procedure only needs to be carried out one time, and will support any STM32 microcontroller.

Linux Installation Procedure (Click to expand)
  1. Install STM32CubeProgrammer
    https://www.st.com/en/development-tools/stm32cubeprog.html
    Follow the registration and download instructions. Extract the zip file. Enter the new directory, double-click on the linux installer, SetupSTM32CubeProgrammer-x.xx.x.linux, and follow the installation instructions.
  2. Install "libusb-1.0-0-dev" (From the command line).
    sudo apt install libusb-1.0-0-dev
  3. Add permissions to use USB ST-Link Programmer.
    sudo cp ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules/*.* /etc/udev/rules.d
  4. Create persistent environment variable to point to the STM32_Programmer_CLI executable (to be used within Makefile). Note that if the path to STM32_Programmer_CLI is different from the default install location of:
    ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin
    then the following line must be modified accordingly.
    export STMCUBE_PROG=~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI
  5. Install "make".
    sudo apt install make
  6. Install arm-none-eabi toolchain. Note that if the install of gcc-arm-none-eabi gives an error due to lack of disc space, then the command can be run again and may correctly install.
    sudo apt install gcc-arm-none-eabi
  7. Download and build a simple Blinky project as a sanity check.
    Navigate to where you want to keep your STM32 projects.
    Then clone the sample blinky project to your PC and move to that directory:
    git clone https://github.com/ezdenki/STM32F030-CMSIS-Blinky && cd STM32F030-CMSIS-Blinky
  8. Connect the ST-Link programmer to a USB port and connect the ST-Link programmer to your Blue Pill. Note that if the ST-Link programmer was already connected during the installation process, then you should unplug it from the USB port and plug it in again so that is recognized.
  9. Build and upload the code to the Blue Pill.
    make clean && make
  10. The LED on the Blue Pill should be blinking!

Windows Installation Procedure (Click to expand)
  1. Install Git for Windows
    https://gitforwindows.org/
    Download and install. Accept default settings, except:
    Under the option for Adjusting the name of the initial branch in new repositories, select the option to Override the default branch name for new repositories and specify the branch name as main.
  2. Install STM32CubeProgrammer
    https://www.st.com/en/development-tools/stm32cubeprog.html
    Click Get Software and then Get latest for STM32CubePrg-W64
    Accept license agreement and enter your name and email address and click Download. Close this page and open the email from STMicroelectronics. Click the Download now button in the confirmation email to start the download. (This will open another download webpage, but don't click on Get Software again.)
    Open the zip file and double-click on the SetupSTM32CubeProgrammer_win64 program to install.
    Follow the installation instructions, including installing the device software
  3. Add a Path variable to point to the STM32CubeProgrammer_CLI.exe file (to be used within Makefile)
    Click the Windows Key and type "environment variables" and select Edit the system environment variables
    Click on Environment Variables...
    Under User variables..., click New...
    Under Variable name:, type STMCUBE_PROG
    Click Browse File..., and navigate to:
    C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI application, and click Open, and then click OK.
    Click OK twice more to exit the dialog boxes.
  4. Install GNU Make for Windows
    https://gnuwin32.sourceforge.net/downlinks/make.php
    Run the downloaded make-3.81.exe file. Accept the default installation options.
  5. Add a Path ennvironment variable to point to Make.
    Click the Windows Key and type "environment variables" and select Edit the system environment variables
    Click on Environment Variables...
    Under the User variables... section click on the Path line and then click Edit..
    Then click New and then Browse... Browse to This PC -> Local Disk (C:) -> Program Files (x86) -> GnuWin32 -> bin, then click OK. Then click OK 3 more times to exit the dialog boxes.
  6. Install GNU Arm Embedded Toolchain
    https://developer.arm.com/downloads/-/gnu-rm
    Do not click on the Arm GNU Toolchain at the top of the page. Scroll down to the link for:
    gcc-arm-none-eabi-10.3-2021.10-win32.exe.
    Click on the link to download. Open the downloaded file. Follow the default settings, except, under Completing the GNU Arm Embedded Toolchain 10.3-2021.10 Setup Wizard, check the box that says Add path to environment variable before clicking Finish. Close the readme document and close the command-line terminal that pops up.
  7. Download and build a simple Blinky project as a sanity check.
    Open a command-line terminal (by touching the Windows-Key, then type command prompt).
    From the command prompt:
    Navigate to where you want to keep your STM32 projects.
    Then clone the sample blinky project to your PC and move to that directory:
    git clone https://github.com/ezdenki/STM32F030-CMSIS-Blinky && cd STM32F030-CMSIS-Blinky
  8. Connect the ST-Link programmer to a USB port and connect the ST-Link programmer to your Blue Pill.
    Note that if the ST-Link programmer was already connected during the installation process, then you should unplug it from the USB port and plug it in again so that is recognized.
  9. Build and upload the code to the Blue Pill.
    make clean && make
  10. The LED on the Blue Pill should be blinking!

End of Procedure

stm32f030-cmsis-setup-for-linux-or-windows's People

Contributors

sandynomike avatar ezdenki 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.