Skip to content

kamva2/Embedded-System

Repository files navigation

EEE2046Pracs

Windows C Setup

  1. This tutorial is based on the video: https://youtu.be/oaebkkOP2Qg
  2. Video Guide for setting up VS Code for C-Programming: https://clipchamp.com/watch/WZsdb849MVL

Download and extract MinGW

  1. Download MinGW: https://nuwen.net/files/mingw/mingw-18.0-without-git.exe
  2. Once downloaded, you should see a file like below. Double click on the icon and set the extraction location to C:\

mingwExtraction

Add Environment Variable

  1. Click on the Start menu and search for "Environment Variables".
  2. Click on "Edit the system environment variables".
  3. Click on the "Environment Variables" button.

environmentvar

  1. Under "System Variables", find the "Path" variable and click "Edit".

envVarEdit

  1. Click "New" and add the following path: "C:\MinGW\bin". Make sure to replace "C:\MinGW" with the installation directory you chose during the MinGW installation.

envVarNew

  1. Click "OK" on all open windows to save the changes.

Check installation

  1. Open the Command Prompt by clicking on the Start menu and searching for "Command Prompt"
  2. Run the following command gcc --version
  3. You should see something like this:

gccVersion

macOS C Setup

  1. Open Terminal by clicking on the magnifying glass icon in the top right corner of the screen and typing "Terminal" in the search bar.
  2. In the Terminal window, type the following command:
xcode-select --install
  1. You will be prompted to install the Command Line Tools. Click "Install" and follow the prompts to complete the installation.

Visual Studio Code Download

  1. Navigate to https://code.visualstudio.com/download
  2. Download the relevant OS
  3. Proceed with installation

Extensions

You will need to install the following extensions:

cExtension

  1. Click on the Extensions icon on the left-hand side of the VSCode window (it looks like a square with four squares inside it).
  2. In the search bar at the top of the Extensions panel, type "C/C++" and press Enter.
  3. Click on the "C/C++" extension from Microsoft.
  4. Click the green "Install" button.

Creating and running your first C program

  1. Create a new file called hello.c with the following code
#include <stdio.h>

int main() {
   printf("Hello, world!");
   return 0;
}
  1. Open the terminal in VSCode and run the following command to compile the c code
gcc hello.c -o hello
  1. An exe called hello.exe should now be in your folder. Run the exe file using the following commad:
./hello
  1. Your output should be as follows:

VScodeTerminalC

C-programming with the STM32

TODO

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages