AN 985: Nios® V Processor Tutorial

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

1.2.2.4. Building the Hello World Application

You can browse the BSP and APP project files in Ashling* RiscFree* IDE for Intel® FPGAs Project Explorer tab.
Figure 72. Project Explorer Tab (Before Build Project)
  1. Go to the Project in the menu tab and click Build Project.
  2. When the build is complete, you can find the console prints as shown in the examples below.
  3. In addition to the console prints, you can find the generated ELF file in the APP project folder.
    Figure 73. Project Explorer Tab (After Build Project)

CMake Console Print

cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -G "Unix Makefiles" <Working directory>/software/bsp 
-- The ASM compiler identification is GNU
-- Found assembler: <Disk drive>/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc
-- The C compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: <Disk drive>/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 12.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: <Disk drive>/riscfree/toolchain/riscv32-unknown-elf/bin/riscv32-unknown-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: <Working directory>/software/bsp/build/Debug

Make Console Print

/usr/bin/gmake -j all 
Scanning dependencies of target hal2_bsp
[  3%] Building ASM object CMakeFiles/hal2_bsp.dir/HAL/src/crt0.S.obj
[ 14%] Building ASM object CMakeFiles/hal2_bsp.dir/HAL/src/machine_trap.S.obj
[ 20%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dma_txchan_open.c.obj
[ 21%] Building ASM object CMakeFiles/hal2_bsp.dir/HAL/src/alt_log_macro.S.obj
[ 30%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_find_dev.c.obj
[ 32%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dev_llist_insert.c.obj
[ 32%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_busy_sleep.c.obj
[ 45%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_icache_flush.c.obj
[ 48%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_irq_handler.c.obj
[ 53%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_ioctl.c.obj
[ 58%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_printf.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_alarm_start.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/drivers/src/ altera_avalon_jtag_uart_write.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/ alt_dcache_flush_no_writeback.c.obj
[ 98%] Building ASM object CMakeFiles/hal2_bsp.dir/HAL/src/alt_mcount.S.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_close.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_env_lock.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_do_dtors.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dev.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_errno.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dma_rxchan_open.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_exit.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_do_ctors.c.obj
[ 25%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dcache_flush_all.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_execve.c.obj
[ 26%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_dcache_flush.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fcntl.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_environ.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_find_file.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fd_lock.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fd_unlock.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fs_reg.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_getchar.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_gettod.c.obj
[ 38%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fork.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_flash_dev.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_iic.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/ alt_instruction_exception_register.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_gmon.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_fstat.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_get_fd.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_getpid.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_io_redirect.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_iic_isr_register.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_icache_flush_all.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_kill.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_link.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_putchar.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_main.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_open.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_remap_uncached.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_remap_cached.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_log_printf.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_isatty.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_sbrk.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_read.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_release_fd.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_putstr.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_rename.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_malloc_lock.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_load.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_settod.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_stat.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_putcharbuf.c.obj
[ 77%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_tick.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_usleep.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_times.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_uncached_free.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_write.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_wait.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_lseek.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_tls.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/intel_fpga_api_niosv.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_unlink.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/ intel_fpga_platform_api_niosv.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/alt_sys_init.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/drivers/src/ altera_avalon_jtag_uart_fd.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/drivers/src/ altera_avalon_jtag_uart_ioctl.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/mtimer.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/drivers/src/ altera_avalon_jtag_uart_init.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/drivers/src/ altera_avalon_jtag_uart_read.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/intel_niosv_irq.c.obj
[ 98%] Building C object CMakeFiles/hal2_bsp.dir/HAL/src/alt_uncached_malloc.c.obj
[100%] Linking C static library libhal2_bsp.a
[100%] Built target hal2_bsp

Alternatively, you can build the application project using CLI.

1. Launch the Nios V Command Shell.
$ niosv-shell
2. Execute the command below to build the application.
$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -B software/app/debug -S software/app
$ make -C software/app/debug