1. Home
  2. Docs
  3. How-To
  4. Start Coding with Hexabit...
  5. Writing Code with STM32CubeIDE

Writing Code with STM32CubeIDE

1) Download the latest version of STM32CubeIDE here.

2) Clone or download the module firmware you are working on. Latest stable release is always on master branch.

    1. GitHub’s firmware repositories can be accessed from module page >> Resources tab.
    2. Note that if you download the firmware as ZIP, submodule folders BOS and Thirdparty will be empty. You need to click on each submodule link on GitHub, download its content as ZIP, then unzip it and copy its content directly inside the submodule folder on your drive.

3) Sometimes when you clone a repository, your Git tool might not initiate (clone) the submodules on its own. In this case, you will find submodule folders (BOS and Thirdpaty) empty. Just make a double click on the submodules in your Git tool or update/initiate them, and they will be cloned. Check out this article for a review of standard module project folders and files. Your application code should be mainly written in main.c file for easy portability to future revisions.

      1. Add your one-time initialization code in the top of UserTask before the endless loop.
      2. Add your recurring code inside the endless loop in UserTask.
      3. Add your project global definition and constants in project.h header file.
      4. Do not write anything in main() function.
      5. Do not write anything after the endless loop in UserTask.
      6. Add your own callbacks and functions anywhere in main.c file before the UserTask.
      7. Add your other .c/.h application files inside User folder for portability. Make sure to add your source files to STM32CubeIDE project structure by right-clicking User folder in Project tree >> Add Existing Files to Group “User”. Your header files will show up automatically once you include them in main.c and compile the project.

4) If you are using a predefined fixed array topology, design and activate your project topology and create new targets as explained here. Learn how to program your module firmware via Serial Wire Debug (SWD) pads here

5) Learn how to debug your code here.

How can we help?