Setup


table of contents

  1. Traditions…
  2. Quick Setup Tour
  3. Creating the First Program

Traditions…

Writing a "Hello, World!" program is a time-honored tradition that continues to be relevant today. This simple program serves as a sanity check before diving into more complex tasks. It allows you to test your coding environment and ensure everything is functioning correctly. Interestingly, some folks also consider this program to be a harbinger of good luck.

Oh! Where are my manners? Here is a very quick setup tour to begin with. Moreover, Don’t forget to check out Mastering STM32. This books is a good resource to familiarize with the STM32 environment and would be considered as one of the most comprehensive introductory book in the STM32 domain.

Quick Setup Tour


NOTE

During my experimentation with various development tools, I would like to recommend you to stick with your favorite IDE. My favorite one is Clion as it integrates well with CMake, in which I will use a template to automate CMake file during the projects. However, for your convenience, you’ll still need STM’s software. For example, I generate codes using CubeIDE and then switch back to CLion. If configurations need adjustments, I can rely on CubeMX to assist me in the process.


Creating the First Program

  1. Launch CubeIDE
  2. Go to File > New > STM32 Project.
  3. In the target selection part, navigate to Board Selector.
  4. Enter your Commercial Part Number (for example, mine was STM32F407G-DISC1).
  5. Select your board from the list.
  6. Click Next.
  7. Provide a Project Name and Click Next
  8. In the Code Generator Options, choose the option that says Copy only the necessary library files.
  9. Click Finish.
  10. Ensure that the option to Initialize all peripherals with their Default Mode is set to Yes.

Now, you should see your Pinout Configuration tab in CubeIDE.

  1. In CubeIDE, open the Pinout Configuration tab, which is opened by default. This tab displays your microprocessor’s default pin configuration, with some peripherals already configured and named for your convenience.
  2. Check the Clock Configuration tab, where you’ll find clock settings already configured.
  3. Next, navigate to Project Manager, and on the left-hand side, select Code Generator.
  4. In the On Generated File section, opt for Generate peripheral initialization as a pair of '.c/.h' files per peripheral.

With these essentials in place and the recommended reading, you’re well-equipped to embark on your embedded systems journey. Keep in mind that the following sections won’t delve into every detail, but they’ll provide you with a solid foundation.