onbmotorsのメモ

onbmotorsのメモ

電子工作とかマイクロマウス関連のメモ書き。

STM32f4Discoveryの開発環境を整える

STM32f4Discoveryの開発環境を整える

上記の評価ボードを扱うにあたり、SW4STM32とSTM32CubeMXで環境を構築することにした。手順についてメモしておく。

内容はMAC OSメインで書いているが、Windowsでも各ツールをダウンロードしたファイルに含まれるexeファイルを実行すれば同様の環境を構築可能である。

手順

1.SW4STM32のダウンロード

OpenSTM32 Community Site OpenSTM32 Community Site | HomePageよりダウンロードする。
ダウンロードするにはユーザ登録が必要。

Step1[Exploreのdownload areaリンクからダウンロードページに移動する
今回はMacOSのためinstall_sw4stm32_macos_64bits-v2.7.runをダウンロード

f:id:nantakosu5656:20190218225640p:plain

f:id:nantakosu5656:20190218225727p:plain

2.SW4STM32のインストール

上記でダウンロードしたファイルがあるディレクトリで以下のコマンドを実行するとインストーラーが開きインストールが始まる
$ chmod 755 install_sw4stm32_macos_64bits-v2.7.run
$ ./install_sw4stm32_macos_64bits-v2.7.run
すべてデフォルト状態でNextをクリック(ライセンスはすべてAgrreする)
また、インストール中にターミナル上でパスワードを求められるので注意

3.SW4STM32の起動とアップデート

2.SW4STM32においてすべてデフォルトでインストールした場合、Application/Ac6/にあるSystemWorkbenchで起動することができる

f:id:nantakosu5656:20190218225858p:plain

SW4STM32起動画面

また、アップデートは“Help”にある“Check for Updates”からおこなうことができる。

f:id:nantakosu5656:20190218225902p:plain

SW4STM32アップデート画面
4.STM32CubeMXのダウンロード

http://www.st.com/en/development-tools/stm32cubemx.html?sc=stm32cubemxの下部からダウンロードを行うダウンロードを行うにはメールアドレスを入力する必要がある

5.STM32CubeMXのインストール

ここでは、
$ brew cask install java
でOpenJDK11をインストールした
STM32CubeMXは下記コマンドでインストールできる
$ ./[解凍したディレクトリ]/SetupSTM32CubeMX-5.0.0.app/Contents/MacOs/SetupSTM32CubeMX-5_
0_0_macos

f:id:nantakosu5656:20190218225727p:plain

STM32CubeMXインストール画面

 補足

SW4STM32について

https://www.st.com/ja/development-tools/sw4stm32.html#getsoftware-scroll
The System Workbench toolchain, called SW4STM32, is a free multi-OS software development
environment based on Eclipse, which supports the full range of STM32 microcontrollers and associated
boards.
The SW4STM32 toolchain may be obtained from the website www.openstm32.org, which includes forums,
blogs, and trainings for technical support. Once registered to this site, users will get installation
instructions at the Documentation > System Workbench page to proceed with the download of the free
toolchain.
The System Workbench toolchain and its collaborative website have been built by AC6, a service company
providing training and consultancy on embedded systems.
This product is supplied by a third party not affiliated to ST. For the latest information on the specification,
refer to the third party’s website: www.ac6.fr.
Key Features
Comprehensive support for STM32 microcontrollers, STM32 Nucleo boards, Discovery kits and
Evaluation boards, as well as STM32 firmware (Standard Peripheral library or STM32Cube HAL)
GCC C/C++ compiler
GDB-based debugger
Eclipse IDE with team-work management
Compatible with Eclipse plug-ins
ST-LINK support
No code size limit
Multiple OS support: Windows®, Linux and OS X®

 

STM32CubeMXについて

http://www.st.com/en/development-tools/stm32cubemx.html?sc=stm32cubemx
STM32CubeMX is part of STMicroelectronics STM32Cube original initiative to make developers’ lives
easier by reducing development effort, time and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube includes STM32CubeMX, a graphical software configuration tool that allows the generation of
C initialization code using graphical wizards.
STM32Cube also embeds comprehensive STM32Cube MCU Packages, delivered per STM32
microcontroller Series (such as STM32CubeF4 for STM32F4 Series). All packages are composed of the
hardware abstraction layer (HAL) and the low-layer (LL) APIs, plus a consistent set of middleware
components (such as RTOS, USB, TCP/IP and graphics). All embedded software utilities are delivered with
a full set of examples running on STMicroelectronics boards.
The STM32Cube HAL is an STM32 embedded software layer that ensures maximized portability across
the STM32 portfolio, while the LL APIs make up a fast, light-weight, expert-oriented layer which is closer to
the hardware that the HAL.
STM32CubeMX is a graphical tool that allows a very easy configuration of STM32 microcontrollers and the
generation of the corresponding initialization C code through a step-by-step process.
Step one consists in selecting the STMicroelectronics STM32 microcontroller that matches the required
set of peripherals.
The user must then configure each required embedded software thanks to a pinout-conflict solver, a
clock-tree setting helper, a power-consumption calculator, and an utility performing MCU peripheral
configuration (GPIO, USART, ..) and middleware stacks (USB, TCP/IP, …).
Finally, the user launches the generation of the initialization C code based on the selected configuration.
This code is ready to be used within several development environments. The user code is kept at the next
code generation.
In addition to STM32CubeMX, other software development tools are available within STM32Cube, such as
STM32CubeProgrammer (STM32CubeProg) and STM32CubeMonitor-Power
(http://www.st.com/en/product/stm32cubemonpwr).
Key Features
Intuitive STM32 microcontroller selection
Rich easy-to-use graphical user interface allowing to configure:
Pinout with automatic conflict resolution
Peripherals and middleware functional modes and initialization with dynamic validation of parameter
constraints
Clock tree with dynamic validation of the configuration
Power sequence with estimate of consumption results
C code project generation covering STM32 microcontroller initialization compliant with IAR, Keil,
SW4STM32 and GCC compilers
Available as a standalone software running on Windows, Linux and macOS (macOS is a trademark of
Apple Inc. registered in the U.S. and other countries.) operating systems, or through Eclipse plug-in