AN 985: Nios® V Processor Tutorial

ID 784468
Date 7/24/2024
Public
Document Table of Contents

1.2.2.2. Creating an Application Project File

Application Project (app) provides the software application for Nios® V/m processor system.
  1. In <Working directory>/software/app folder, create a C source code. Name it as hello.c.
  2. In hello.c, copy and paste the Hello World application code below
    #include <stdio.h>
    #include <unistd.h>
    
    void looper() {
        for (int i = 0; i < 1000; ++i) {
            printf("Hello world, this is the Nios V/m cpu checking in %d...\n", i);
        }
    }
    
    int main() {
        looper();
        usleep(1000000);
        printf("Bye world!\n");
        fflush(stdout);
        return 0;
    }
    
  3. Launch the Nios V Command Shell.
    $ niosv-shell
  4. Execute the command below to generate an application CMakeLists.txt.
    $ niosv-app --bsp-dir=software/bsp --app-dir=software/app \
    --srcs=software/app/hello.c --elf-name=hello.elf
    
    Figure 70. Generated APP Files