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

Writing Code with Keil uVision

  1. Download the latest version of Keil uVision here.
  2. Activate uVision with the free STM32F0/L0/G0 license available in the top right corner of this page. This unlocks the software Flash size limitations and enables you to develop and compile code for most of our standard modules. Steps for activating your license:
    1. Open uVision as administrator.
    2. Click on File >> License Management >> Get LIC via Internet.
    3. Enter the PSN for F0/L0/G0 license from here and fill out the rest of the form.
    4. You will receive an email with your LIC code. Paste it in License Management and click “Add LIC”.
  3. Download device packs required for STM32F0 MCUs through uVision pack installer >> Devices >> Select STMicroelectronics > STM32F0 Series > STM32F091 (or other F0 MCUs) >> On the right side, make sure Keil:STM32F0xx_DFP is up-to-date.
  4. 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.
  5. 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 uVision 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.
    8. If you are using a predefined fixed array topology, design and activate your project topology and create new targets as explained here.
  6. Learn how to program your module firmware via Serial Wire Debug (SWD) pads here. You need to select your programmer/debugger device from uVision Options for Target >> Debug tab (ST-Link, ULINK2, etc.) and adjust its settings if needed. 
  7. Learn how to debug your code here.

How can we help?