Completed: / exercises
These instructions will help you get started with C programming exercises and later the hardware device both in the workstation classroom and at home. Detailed information about the setup for programming the device will be shown during the mandatory lab exercise sessions.
We expect you have some basic computing skills e.g. using a text editor or utilizing your terminal. Please, have a look to the introductory lecture of Elementary Programming course for further details.

Software recommended for programming

For programming C Exercises you can choose among all these options:
For Programming the SensorTag:
For Programming the Raspberry Pi Pico

Instructions to setup software

Following instructions show how to install the required software for the course(s) for either remote use at home or at the university classrooms.
All software required for this course is installed in a VirtualBox virtual machine. You can run this virtual machine either in the computer classroom or in your home computer when you install VirtualBox (see instructions below). With a virtualization environment A virtualization environment, like VirtualBox, allows you to run multiple operating systems simultaneously on a single physical machine by creating virtual machines (VMs). Each VM operates as if it were a separate computer, with its own resources, and software, completely isolated from the host system.
Important: Files saved on the virtual machines in the workstations will be deleted between uses, so remember to back up your code after the exercises.
NOTE FOR FITECH STUDENTS: It is not needed to setup the virtual machine. Any of the previous software would do it.

Virtual machine

Fall 2024 you can freely go to the computer classrooms (TS135 and TS137) to work on the course tasks. They have installed the virtual machines.

Course virtual machine

In the workstations at the classrooms you can download a virtual machine (VirtualBox) that contain all the required software:
The virtual machine is based on the "Linux Lite" lightweight distribution, so you will be using Linux in the course. Just so you realize, Linux isn’t that scary after all.

Setting up virtualBox

  1. Download the Virtual Machine. Link can be found from this Lovelace page
  2. Copy the file: TKJ_24.ova in your own account.
  3. Open VirtualBox and press import. Choose the .ova file.
  4. Check that in Settings > USB you have activated the 3.0 option.
  5. Run the virtual machine.

Transfer files between systems

Files are removed from the virtual machines when you restart the machine. There are several ways you can transmit your code between your virtual machine and your host system or your home computer.

GIT

By far this is the most appropiate option.

Traditional

Use USB memory stick to copy and move files. You can also use GoogleDrive, OneDrive, Dropbox, or even email. But these methods are not very orthodox for this course.

Dragging Dropping / Copy Paste

Moving from Host (University Workstation) to VM using SCP

scp is a Unix command line interface used to transfer files from one machine to another. You have access to scp through the Git Bash in your host machine. You would need the user password. Ask any of the course staff for it.
scp -P 2222  linuxlite@localhost:/path/to/destination
scp -P 2222 linuxlite@localhost:/path/to/destination  
You can save your files persistently in the K: drive of the University Workstation. This is the home directory of your university computer systems account

Setting up envrionment at home and other computers

MAC IS NOT SUPPORTTED If you find the way of running the virtualbox image in modern MAC computers, please share the knowledge with rest of students.

Using the VirtualBox and the Provided Virtual Machine

Of course, you can always use VirtualBox image. But first you must install and configure virtualbox:

Installing C compiler

These instructions explain how to install a C compiler in your own computer at home.

Windows machines

The easiest option is to install a IDE which contains all necessary sofware including compiler. You have multiple options

Setting up gcc Compiler in Windows

Alternatively, specially if you want to program from command line, or you want to use Visual Studio Code you would need to install a Windows gcc compiler. The best option is mingw-w-64
Installing mingw-w-64.
  1. Download from https://sourceforge.net/projects/mingw/
  2. During installation select architecture: x86_64. Select the i686 architecture only if you really know what you are doing.
  3. Otherwise just click Next.
  4. Section 4 in advanced of this tutorial provide some additional information
  5. After mingw has installed, navigate to the installation directory and run mingw-w64.bat. This will setup the needed environment variables
  6. Finally check tne installation by opening command prompt and typing gcc --version. Now you should see gcc version information.
As mingw-w64 contains just the compiler, you may also want to install a development environment for C programming.
The list of options include:

Command line compiler

Obviously, when you installed minGW shell, you can use gcc directly from there.

Linux machines

Install gcc through your Linux distribution.
  1. Open a terminal program (such as konsole, gnome-terminal, urvxt, xterm, ...)
  2. write gcc --version to check that gcc is installed.
You can also use any othe alternative IDES such us Code::Blocks IDE

MacOS

Option 1. Using any of the multiplatform IDEs such us Code::Blocks IDE
Option 2.
  1. Install XCode. You may need an Apple user account.
Option 3.
  1. Install Homebrew by following the site intructions
  2. Open a terminal window
  3. Type command brew install gcc.
  4. Type command gcc --version to check that installation is ok.

Online C Compilers

Try google search with keywords c online compiler.

Programming the embedded device

Don't worry about this setup yet, you will learn how to program the device during the mandatory laboratory exercise!
At home or with your laptop, you use the Code Composer Studio-development environment. This program requires license, which is provided through the course device SensorTag.
If you are programming the Raspberry Pico, you would need to install Visual Studio Code with following extensions:
?