1. NiosII SBTE Build Project过程分析
NiosII GNU C编译工具:
(1)nios2-elf-gcc
(2)nios2-elf-ar
(3)nios2-elf-g++
(4)nios2-elf-insert
(5)nios2-elf-objdump
Prj_Name:Prj_***
Prj_BSP_Name:Prj_***_bsp
点击“Build Project”,出现如下编译提示信息:
make all //all:两个工程Prj_***和Prj_***_bsp
//开始编译Prj_***_bsp工程
Info:Building ../Prj_***_bsp
make –no-print-directory –C ../Prj_***_bsp
//调用nios2-elf-gcc编译
//以下编译的这些文件位于Prj_***_bsp/HAL/src目录下
Compiling alt_alarm_start.c
Compiling alt_busy_sleep.c
Compiling alt_close.c
Compiling alt_dcache_flush.c
Compiling alt_dcache_flush_all.c
Compiling alt_dcache_flush_no_writeback.c
Compiling alt_dev.c
Compiling alt_llist_insert.c
Compiling alt_dma_rxchan_open.c
Compiling alt_dma_txchan_open.c
Compiling alt_do_ctors.c
Compiling alt_do_dtors.c
Compiling alt_env_lock.c
Compiling alt_environ.c
Compiling alt_errno.c
Compiling alt_exception_entry.S
Compiling alt_exception_muldiv.S
Compiling alt_exception_trap.S
Compiling alt_execve.c
Compiling alt_exit.c
Compiling alt_fcntl.c
Compiling alt_fd_lock.c
Compiling alt_fd_unlock.c
Compiling alt_find_dev.c
Compiling alt_find_file.c
Compiling alt_flash_dev.c
Compiling alt_fork.c
Compiling alt_fs_reg.c
Compiling alt_stat.c
Compiling alt_get_fd.c
Compiling alt_getchar.c
Compiling alt_getpid.c
Compiling alt_gettod.c
Compiling alt_gmon.c
Compiling alt_icache_flush.c
Compiling alt_icache_flush_all.c
Compiling alt_iic.c
Compiling alt_iic_isr_register.c
Compiling alt_instruction_exception_entry.c
Compiling alt_instruction_exception_register.c
Compiling alt_io_redirect.c
Compiling alt_ioctl.c
Compiling alt_irq_entry.S
Compiling alt_irq_handler.c
Compiling alt_irq_register.c
Compiling alt_irq_vars.c
Compiling alt_isatty.c
Compiling alt_kill.c
Compiling alt_link.c
Compiling alt_load.c
Compiling alt_log_macro.S
Compiling alt_log_printf.c
Compiling alt_lseek.c
Compiling alt_main.c
Compiling alt_malloc_lock.c
Compiling alt_mount.S
Compiling alt_open.c
Compiling alt_printf.c
Compiling alt_putchar.c
Compiling alt_putstr.c
Compiling alt_read.c
Compiling alt_release_fd.c
Compiling alt_remap_cached.c
Compiling alt_remap_uncached.c
Compiling alt_rename.c
Compiling alt_sbrk.c
Compiling alt_settod.c
Compiling alt_software_exception.S
Compiling alt_stat.c
Compiling alt_tick.c
Compiling alt_times.c
Compiling alt_uncached_free.c
Compiling alt_uncached_malloc.c
Compiling alt_unlink.c
Compiling alt_usleep.c
Compiling alt_wait.c
Compiling alt_write.c
Compiling altera_nios2_irq.c
Compiling crt0.S
//以上编译的这些文件位于Prj_***_bsp/HAL/src目录下
//以下编译的这些文件位于Prj_***_bsp/目录下
Compiling alt_sys_init.c
//以上编译的这些文件位于Prj_***_bsp/目录下
//以下编译的这些文件位于Prj_***_bsp/drivers/src目录下
Compiling altera_avalon_jtag_uart_fd.c
......//接着编译各个IP核对应的驱动源文件
//以上编译的这些文件位于Prj_***_bsp/drivers/src目录下
//调用nios2-elf-ar汇编
Creating libhal_bsp.a //将前面编译生成的所有*.o文件汇编为libhal_bsp.a
//至此,BSP build complete,即Prj_***_bsp工程编译完毕
//开始编译Applications
Info:Compiling app_***.c to obj/app_src.o //调用nios2-elf-gcc编译
Info:Linking ***.elf //调用nios2-elf-g++/nios2-elf-insert链接、更改模式
Info:Creating ***.objdump //调用nios2-elf-objdump
//至此,Prj_*** build complete,NiosII App编译完毕。
2. SOPC Builder Generate过程分析
SOPC Builder中建立的NiosII系统记为:Directory/NiosII_***
系统构建完成后,点击“Generate”,出现下列提示信息:
Info:Wrote Directory/NiosII_***.sopcinfo
Info:NiosII_***:Wrote Directory/NiosII_***.html
//------
Info:NiosII_***:Generating QIP file //产生QIP文件
Info:Info:Running QuartusII Shell
Info:Info:Command:quartus_sh –t sopc_add_qip_file.tcl
Info:Info:Evaluation of Tcl script sopc_add_qip_file.tcl was successful
Info:Info:QuartusII Shell was successful
//------
Info:Starting PTF file elaboration //PTF文件
…..
Info:Finished elaborating PTF file
//------
Executing:sopc_builder –classic –generate Directory/NiosII_***.ptf
Info:Starting generation
……
No .sopc_builder configuration file (!) //缺少文件
### mk_custom_sdk starting
### Reading project Directory/NiosII_***.ptf
### Finding all CPUs
### Finding all available components
### Reading Directory/.sopc_builder/install.ptf
### Found No.* components
### Finding all peripherals
### Finding software components
### ……
### mk_custom_sdk finishing
### Starting generation for system:NiosII_***
……
### Running Generator Program for cpu //提示产生NiosII,之后是详细过程
### Running Generator Program for sysid //提示产生sysid模块
### … //依次提示产生各个IP组件
### Generating Quartus symbol for top level:NiosII_*** //产生QuartusII符号
### Creating system-generation script:Directory/NiosII_***_generation_script
### Running setup for HDL simulator:modelsim
### The following system items have been generated:
(1)SOPC Builder database:Directory/NiosII_***.ptf
(2)System HDL Model:Directory/NiosII_***.v
(3)System Generation Script:Directory/NiosII_***_generation_script
Info:System generation was successful //NiosII_***系统生成
3. QuartusII Compiling过程分析
QuartusII编译工具:
(1)quartus_map
(2)quartus_fit
(3)quartus_asm
(4)quartus_sta
QuartusII硬件工程记为:Prj_***
点击“Starting Compilation”后,出现如下提示信息:
Info:Running QuartusII Analysis & Synthesis //分析、综合 开始
Info:Command:quartus_map –read_settings_files=on –write_settings_files=off Prj_*** -c Prj_***
Info:Parallel compilation is enabled and will use 2 of the 2 processors detected
……
Info:QuartusII Analysis & Synthesis was successful //分析、综合 完成
……
Info:Running QuartusII Fitter //适配 开始
Info:Command:quartus_fit –read_settings_files=off –write_settings_file=off Prj_*** -c Prj_***
Info:Parallel compilation is enabled and will use 2 of the 2 processors detected
Info:Selected device EP3C55F484C8 for design “Prj_***”
……
Info:Fitter preparation operations ending
Info:Fitter placement preparation operations beginning
Info:Fitter placement preparation operations ending
Info:Fitter placement operations beginning
Info:Fitter placement was successful
Info:Fitter routing operations beginning
Info:Fitter routing operations ending
……
Info:Started post-fitting delay annotation
Info:Delay annotation completed successfully
……
Info:QuartusII Fitter was successful //适配 完成
……
Info:Running QuartusII Assembler //实现 开始
Info:Command:quartus_asm –read_settings_files=off –write_settings_file=off Prj_*** -c Prj_***
……
Info:Running QuartusII TimeQuest Timing Analyzer //时序分析 开始
Info:Command:quartus_sta Prj_*** -c Prj_***
Info:Parallel compilation is enabled and will use 2 of the 2 processors detected
……
Info:Assembler is generating device programming files
……
Info:QuartusII Assembler was successful //实现 完成
……
Info:QuartusII TimeQuest Timing Analyzer was successful //时序分析 结束
……
Info:QuartusII Full Compilation was successful //QuartusII编译完成