Getting started - Milo-D/libvmcu-Virtual-MCU-Library GitHub Wiki

This page covers the installation, from cloning to running, of libvmcu. If you don't know how to install libvmcu or if you face an issue while trying, this page might be for you.

Requirements

  • gcc
  • cmake (minimum v3.10.2)

GCC

gcc is the compiler used to compile libvmcu. Personally I am using gcc v10.2.0 for the compilation.

CMake

CMake requires minimum v3.10.2

Setup

Once all requirements are met, we can start to setup the project.

Step 1: Go to build-release/

You@Terminal:~$ cd build-release/

Step 2: Hit make

You@Terminal:~$ make -f build.mk

Now we should have compiled an archive. libvmcu.a can be found in build-release/ Now change back to top level.

Step 3: And create a small driver (prog.c)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "libvmcu_analyzer.h"
#include "libvmcu_system.h"

int main(void) {

    vmcu_report_t *report;

    if((report = vmcu_analyze_ihex("f.hex")) == NULL)
        return -1;

    vmcu_report_dtor(report);
    return 0;
}

The required headers libvmcu_analyzer.h and libvmcu_system.h can be found in engine/include/libvmcu/

Step 4: Compile driver

You@Terminal:~$ gcc -Iengine/include/libvmcu/ -c prog.c -o prog.o

Step 5: Link with lvmcu and lm

You@Terminal:~$ gcc -o prog prog.o -Lbuild-release/ -lvmcu -lm

That's it.

⚠️ **GitHub.com Fallback** ⚠️