Projects ¶
Project Orientation ¶
STM32CubeIDE for Visual Studio Code supports many different types of projects. Some examples of the supported project types are listed below.
-
STM32CubeMX Generated Projects
STM32CubeIDE for VS Code supports projects generated by STM32CubeMX, ST’s graphical configuration tool. These projects include hardware configuration, middleware, and peripheral initialization code tailored to the selected STM32 MCU.
-
Project Structure: Auto-generated HAL (Hardware Abstraction Layer) code, middleware stacks (USB, TCP/IP, FATFS, etc.), and user application code.
-
Use Case: Rapid prototyping and development with automatic initialization of peripherals and middleware.
-
Build System: Uses Makefiles or CMake depending on project setup.
-
-
Bare-Metal STM32 Projects
Users can create bare-metal projects from scratch or import existing ones. These projects directly control the STM32 hardware without relying on HAL or middleware.
-
Project Structure: Startup files, linker scripts, CMSIS core files, and user-written source code.
-
Use Case: Low-level programming, real-time applications, or when minimal overhead is required.
-
Build System: Typically Makefile or CMake based.
-
-
FreeRTOS-Based Projects
STM32CubeIDE for VS Code supports projects that integrate the FreeRTOS real-time operating system.
-
Project Structure: Includes FreeRTOS kernel source files, configuration headers, and user tasks.
-
Use Case: Applications requiring multitasking, real-time scheduling, and inter-task communication.
-
Build System: Compatible with Makefile or CMake workflows.
-
-
STM32Cube Middleware Projects
Projects that leverage STM32Cube middleware components such as USB Device/Host, TCP/IP stack (LwIP), File System (FATFS), Graphics (TouchGFX), and more.
-
Project Structure: Middleware libraries integrated with HAL and user application layers.
-
Use Case: Complex applications needing advanced connectivity, storage, or graphical interfaces.
-
Build System: Managed via Makefile or CMake.
-
-
Example and Template Projects
STM32CubeIDE for VS Code provides example projects and templates for various STM32 series and application domains.
-
Project Structure: Pre-configured projects demonstrating peripheral usage, communication protocols, or RTOS integration.
-
Use Case: Learning, prototyping, and reference for application development.
-
Build System: Predefined build configurations.
-
Creating a New Project ¶
-
First project creation : Start your STM32CubeIDE for Visual Studio Code journey here!
Convert and import an Eclipse STM32CubeIDE project ¶
Note
This operation is also available through the CLI. For more information, use the command:
$ cube ide-project-convert --help
In order to convert an existing Eclipse-based STM32CubeIDE project to STM32CubeIDE for VS Code, navigate to the STM32Cube Key Actions section and select Convert Eclipse STM32CubeIDE project .
After selecting this option a drop-down menu where you need to select Project source and Project destination .
Project source: Navigate to and select the root folder of your current Eclipse-based STM32CubeIDE project.
Project destination: Either create a new folder or select a folder where you wish the converted project to be located.
When both of these fields have been filled in a third option will appear, Convert project .
Clicking the Convert project button will invoke the STM32CubeIDE Eclipse exporter.
Once the process is complete you can choose whether you want to open the converted project in the current VS Code window, open it in a new window or add it to your workspace.
Project Configuration ¶
Key components of project configuration include:
-
Settings (`settings.json`) Customize editor behavior, formatting, linting, and other preferences specific to the project. These settings override user-level defaults when the workspace is opened.
-
Tasks (`tasks.json`) Define automated tasks such as building, testing, or deploying your project. Tasks can be executed directly from the VS Code interface or integrated into debugging workflows.
-
Launch Configurations (`launch.json`) Configure debugging options including environment variables, program arguments, and runtime settings for different languages and frameworks.
-
Extensions Recommendations (`extensions.json`) Suggest extensions that are useful for the project, helping team members maintain a consistent development setup.
-
Workspace Configuration (`*.code-workspace`) Optionally, you can use a workspace file to group multiple folders and their configurations into a single project workspace.
By leveraging these configuration files, VS Code provides a flexible and powerful way to tailor the development environment to the specific needs of your project, enhancing productivity and consistency across teams.
For more information, visit the Visual Studio Code Documentation .
Managing Project Properties ¶
Key aspects of managing project properties in VS Code include:
-
Workspace Settings VS Code uses workspace settings stored in the .vscode/settings.json file to configure project-specific options such as formatting rules, linting, and editor preferences.
-
Tasks Configuration The .vscode/tasks.json file allows defining custom build, test, and deployment tasks that can be executed within the editor.
-
Launch Configurations Debugging settings are managed through .vscode/launch.json , where you specify how to run and debug your applications with different environments and parameters.
-
Extensions and Language Support Project-specific configurations often depend on extensions, which may add their own settings to the workspace configuration files to tailor the development experience.
-
Version Control Integration VS Code seamlessly integrates with Git and other version control systems, allowing project-level source control management.
Overall, managing project properties in VS Code revolves around editing JSON configuration files within the .vscode folder, offering flexibility and customization tailored to diverse development workflows.
For detailed customization, visit the Visual Studio Code Documentation .
Project Organization ¶
Effective project organization in Visual Studio Code (VS Code) helps streamline development workflows and improve productivity. VS Code provides flexible tools and features to structure your projects efficiently.
Key aspects of project organization include:
-
Workspace and Folder Structure Organize your source code, assets, and configuration files into logical folders. VS Code supports single-folder workspaces as well as multi-root workspaces that allow managing multiple folders in one window.
-
.vscode Folder This hidden folder contains project-specific configuration files such as settings.json , tasks.json , and launch.json , which customize the editor behavior and tooling per project.
-
Source Control Integration VS Code integrates seamlessly with Git and other version control systems, enabling branch management, commits, and diffs directly within the editor.
-
File and Symbol Navigation Utilize features like the Explorer, Outline view, and Go to Definition to quickly navigate large codebases.
-
Extensions for Organization Leverage extensions such as project managers, file explorers, and code linters to enhance project structure and maintain code quality.
-
Workspace Settings Customize settings at the workspace level to tailor the development environment to the specific needs of each project.
By organizing your project thoughtfully within VS Code, you can maintain clarity, reduce complexity, and foster collaboration across your development team.
For more details, visit the Visual Studio Code Documentation .
Source Folder Structure Best Practices ¶
Organizing the source folder structure effectively is crucial for maintainability, scalability, and collaboration in software projects. While Visual Studio Code (VS Code) is flexible and agnostic about folder layouts, following best practices helps streamline development and improve clarity.
Key best practices for source folder structure include:
-
Logical Separation of Concerns Group files by their roles or features, such as src/ for source code, tests/ for unit tests, docs/ for documentation, and assets/ for images or other resources.
-
Consistent Naming Conventions Use clear and consistent folder and file names to reflect their purpose, making navigation intuitive for all team members.
-
Feature-Based Organization For larger projects, consider organizing code by feature or module rather than by file type, which can improve modularity and ease of maintenance.
-
Configuration and Build Files Keep configuration files (e.g., .vscode/ , package.json , Makefile ) at the root or in dedicated folders to separate them from source code.
-
Avoid Deep Nesting Limit folder depth to reduce complexity and make files easier to locate.
-
Use `.vscode` Folder for Project Settings Store project-specific settings, tasks, and launch configurations in the .vscode folder to keep them organized and version-controlled.
-
Version Control Considerations Ensure that the folder structure aligns well with your version control system, including proper .gitignore files to exclude unnecessary files.
By adhering to these best practices, you can create a clean, maintainable, and scalable project structure that enhances productivity and collaboration within VS Code.
For further guidance, visit the Visual Studio Code Documentation .
Code Freeze and Release Management ¶
Managing code freeze and release processes effectively within Visual Studio Code (VS Code) ensures stability and quality in software development. This guide outlines the specific actions to take inside VS Code.
Code Freeze ¶
-
Create a Code Freeze Branch :
-
Commit and Push Changes :
-
-
Make sure all changes are committed. Use the Source Control view (
Ctrl+Shift+G) to stage, commit, and push changes: -
-
Stage all changes: Click the “+” icon next to the changes.
-
Commit changes: Enter a commit message and click the checkmark icon.
-
Push changes: Click the “…” menu and select “Push”.
-
-
Make sure all changes are committed. Use the Source Control view (
-
-
Restrict Changes to Critical Bug Fixes :
-
Communicate with your team to ensure only critical bug fixes are made in the code-freeze branch. Use the Source Control view to manage commits related to critical bug fixes.
-
-
Review and Merge Changes :
-
Use the GitLens extension or the built-in Git features to review and merge any necessary changes into the code-freeze branch: - Open the Command Palette (
Ctrl+Shift+P). - Type “Git: Merge Branch” and select the branch to merge.
-
Release Management ¶
-
Create a Release Branch :
-
Tag the Release :
-
Tag the release to mark it in the repository:
` git tag -a v1.0 -m "Release version 1.0" git push origin v1.0 `
-
-
Build and Test :
-
Use VS Code tasks to build and test the project: - Open the Command Palette (
Ctrl+Shift+P). - Type “Tasks: Run Task” and select the build or test task. - Monitor the terminal output for any build or test issues.
-
-
Prepare Release Notes :
-
Use the Markdown editor in VS Code to prepare release notes: - Create a new file (
Ctrl+N) and save it as RELEASE_NOTES.md . - Document the changes, features, and bug fixes included in the release.
-
-
Deploy to Production :
-
Use deployment extensions or integrated terminal commands to deploy the release: - For example, use the Azure App Service extension to deploy to Azure, or use terminal commands for other deployment platforms.
-
-
Monitor and Support :
Further Reading ¶
Handling code freeze and release management effectively within VS Code ensures the stability and quality of software releases. By following these specific actions, you can manage the process efficiently and deliver reliable software to your users.
For more detailed information, visit the Visual Studio Code Documentation .
Updating Bundles and Components ¶
Keeping your development environment up to date is crucial for maintaining productivity and taking advantage of the latest features and improvements. This guide outlines the steps to update bundles and components in Visual Studio Code (VS Code).
Updating Extensions ¶
Extensions add functionality to VS Code and are a key component of bundles. Regularly updating extensions ensures you have the latest features, bug fixes, and security updates.
-
Check for Extension Updates :
-
Open the Extensions view (
Ctrl+Shift+X). -
Click on the “…” menu in the top right corner.
-
Select “Check for Updates”.
-
-
Update Extensions :
-
If updates are available, you will see an “Update” button next to each extension.
-
Click the “Update” button to install the latest version of the extension.
-
-
Automatic Updates :
-
VS Code can automatically update extensions. To enable this: - Open the Command Palette (
Ctrl+Shift+P). - Type “Preferences: Open Settings (UI)” and select it. - Search for “Extensions: Auto Update” and ensure it is enabled.
-