# Getting started with LPSC project

## Getting started with git

### Managing SSH keys

#### Generate an SSH key paie

**For more details**, please consult the following link: [SSH Keys](https://gitedu.hesge.ch/-/user_settings/ssh_keys)

If you do not have an existing SSH key pair, you can generate a new one:

Run `ssh-keygen -t` command followed by the key type and an optional comment. This comment is included in the `.pub` file which is created. **In out case, we use the school's email address as a comment (e.g., <firstname.lastname>@hesge.ch)**.

For instance, for ED25519:

> ```sh
> $ ssh-keygen -t ed25519 -C "<firstname.lastname>@hesge.ch"
> ```

You will have an output similar to the following which is displayed:

> ```sh
> Generating public/private ed25519 key pair.
> Enter file in which to save the key (/home/user/.ssh/id_ed25519):
> ```

You then have to specify a passphrase:

> ```sh
> Enter passphrase (empty for no passphrase):
> Enter same passphrase again:
> ```

A public and private key are generated. **Add the public SSH key to your GitLab account**.

#### How to use the ssh key

When you open a terminal, before using the git command, you have to add your private key (e.g., `id_ed25519`) with the following command:

> ```sh
> ssh-add ~/.ssh/<your_private_key>
> ```

You then have to enter your passphrase:

> ```sh
> Enter passphrase for /home/user/.ssh/id_ed25519_hesge:
> ```

### Git configuration

Set the name and the email address which will be attached to your commits and tags.

> ```sh
> $ git config --global user.name "Your name"
> $ git config --global user.email "your-email@hesge.ch"
> ```

Enable some colorisation of Git output.

> ```sh
> $ git config --global color.ui auto
> ```

### Clone the git repository

The first step is to clone the directory and its submodules.

> ```sh
> $ git clone ssh://git@ssh.hesge.ch:10572/cores/lpsc.git
> $ cd lpsc
> $ git submodule update --init --recursive
> ```

### Pull with submodules
If you have already cloned the repository, you can pull changes and update the submodules in a single command like this:

> ```sh
> $ git pull --recurse-submodules
> ```

Or from a specific branch (e.g., main) like this:

> ```sh
> $ git pull origin main --recurse-submodules
> ```

#### Update submodules after pulling

In case you already pulled the main repository and forgot to include submodule update, you can manually update the submodules using:

> ```sh
> $ git sub modules update --recursive --remote
> ```

## Installing Vivado

Instruction for installing **Vivado** and **Docker** can be found in the [docker_for_vivado](https://gitedu.hesge.ch/isc/docker-for-vivado) submodule.

## Files for the Scalp board

The files and instructions for the **Scalp board** are in the [scalp_board_files](https://gitedu.hesge.ch/isc/scalp_board_files) submodule.

## Information about the project

The information can be found in the [**fractal_project**](./fractal_project) folder.