Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12595 Discussions

nios2-elf-ar in Quartus Prime Pro 21.2 hangs

frycoo
Novice
1,567 Views

Hello,

nios2-elf-ar.exe hangs (stop responding) when called from WSL with too many *.o files.

 

In my case I'm trying to build BSP for simple system with nios II. The exact command that fails is:

```

nios2-elf-ar.exe -src libhal_bsp.a obj/HAL/src/alt_alarm_start.o obj/HAL/src/alt_busy_sleep.o obj/HAL/src/alt_close.o obj/HAL/src/alt_dcache_flush.o obj/HAL/src/alt_dcache_flush_all.o obj/HAL/src/alt_dcache_flush_no_writeback.o obj/HAL/src/alt_dev.o obj/HAL/src/alt_dev_llist_insert.o obj/HAL/src/alt_dma_rxchan_open.o obj/HAL/src/alt_dma_txchan_open.o obj/HAL/src/alt_do_ctors.o obj/HAL/src/alt_do_dtors.o obj/HAL/src/alt_ecc_fatal_entry.o obj/HAL/src/alt_ecc_fatal_exception.o obj/HAL/src/alt_env_lock.o obj/HAL/src/alt_environ.o obj/HAL/src/alt_errno.o obj/HAL/src/alt_exception_entry.o obj/HAL/src/alt_exception_muldiv.o obj/HAL/src/alt_exception_trap.o obj/HAL/src/alt_execve.o obj/HAL/src/alt_exit.o obj/HAL/src/alt_fcntl.o obj/HAL/src/alt_fd_lock.o obj/HAL/src/alt_fd_unlock.o obj/HAL/src/alt_find_dev.o obj/HAL/src/alt_find_file.o obj/HAL/src/alt_flash_dev.o obj/HAL/src/alt_fork.o obj/HAL/src/alt_fs_reg.o obj/HAL/src/alt_fstat.o obj/HAL/src/alt_get_fd.o obj/HAL/src/alt_getchar.o obj/HAL/src/alt_getpid.o obj/HAL/src/alt_gettod.o obj/HAL/src/alt_gmon.o obj/HAL/src/alt_icache_flush.o obj/HAL/src/alt_icache_flush_all.o obj/HAL/src/alt_iic.o obj/HAL/src/alt_iic_isr_register.o obj/HAL/src/alt_instruction_exception_entry.o obj/HAL/src/alt_instruction_exception_register.o obj/HAL/src/alt_io_redirect.o obj/HAL/src/alt_ioctl.o obj/HAL/src/alt_irq_entry.o obj/HAL/src/alt_irq_handler.o obj/HAL/src/alt_irq_register.o obj/HAL/src/alt_irq_vars.o obj/HAL/src/alt_isatty.o obj/HAL/src/alt_kill.o obj/HAL/src/alt_link.o obj/HAL/src/alt_load.o obj/HAL/src/alt_log_macro.o obj/HAL/src/alt_log_printf.o obj/HAL/src/alt_lseek.o obj/HAL/src/alt_main.o obj/HAL/src/alt_malloc_lock.o obj/HAL/src/alt_mcount.o obj/HAL/src/alt_open.o obj/HAL/src/alt_printf.o obj/HAL/src/alt_putchar.o obj/HAL/src/alt_putcharbuf.o obj/HAL/src/alt_putstr.o obj/HAL/src/alt_read.o obj/HAL/src/alt_release_fd.o obj/HAL/src/alt_remap_cached.o obj/HAL/src/alt_remap_uncached.o obj/HAL/src/alt_rename.o obj/HAL/src/alt_sbrk.o obj/HAL/src/alt_settod.o obj/HAL/src/alt_software_exception.o obj/HAL/src/alt_stat.o obj/HAL/src/alt_tick.o obj/HAL/src/alt_times.o obj/HAL/src/alt_uncached_free.o obj/HAL/src/alt_uncached_malloc.o obj/HAL/src/alt_unlink.o obj/HAL/src/alt_usleep.o obj/HAL/src/alt_wait.o obj/HAL/src/alt_write.o obj/HAL/src/altera_nios2_gen2_irq.o obj/HAL/src/crt0.o obj/alt_sys_init.o obj/drivers/src/altera_avalon_jtag_uart_fd.o obj/drivers/src/altera_avalon_jtag_uart_init.o obj/drivers/src/altera_avalon_jtag_uart_ioctl.o obj/drivers/src/altera_avalon_jtag_uart_read.o obj/drivers/src/altera_avalon_jtag_uart_write.o

```

I've found out that if I remove last five .o files from the list, the command runs correctly. Bellow correctly running call:

```

nios2-elf-ar.exe -src libhal_bsp.a obj/HAL/src/alt_alarm_start.o obj/HAL/src/alt_busy_sleep.o obj/HAL/src/alt_close.o obj/HAL/src/alt_dcache_flush.o obj/HAL/src/alt_dcache_flush_all.o obj/HAL/src/alt_dcache_flush_no_writeback.o obj/HAL/src/alt_dev.o obj/HAL/src/alt_dev_llist_insert.o obj/HAL/src/alt_dma_rxchan_open.o obj/HAL/src/alt_dma_txchan_open.o obj/HAL/src/alt_do_ctors.o obj/HAL/src/alt_do_dtors.o obj/HAL/src/alt_ecc_fatal_entry.o obj/HAL/src/alt_ecc_fatal_exception.o obj/HAL/src/alt_env_lock.o obj/HAL/src/alt_environ.o obj/HAL/src/alt_errno.o obj/HAL/src/alt_exception_entry.o obj/HAL/src/alt_exception_muldiv.o obj/HAL/src/alt_exception_trap.o obj/HAL/src/alt_execve.o obj/HAL/src/alt_exit.o obj/HAL/src/alt_fcntl.o obj/HAL/src/alt_fd_lock.o obj/HAL/src/alt_fd_unlock.o obj/HAL/src/alt_find_dev.o obj/HAL/src/alt_find_file.o obj/HAL/src/alt_flash_dev.o obj/HAL/src/alt_fork.o obj/HAL/src/alt_fs_reg.o obj/HAL/src/alt_fstat.o obj/HAL/src/alt_get_fd.o obj/HAL/src/alt_getchar.o obj/HAL/src/alt_getpid.o obj/HAL/src/alt_gettod.o obj/HAL/src/alt_gmon.o obj/HAL/src/alt_icache_flush.o obj/HAL/src/alt_icache_flush_all.o obj/HAL/src/alt_iic.o obj/HAL/src/alt_iic_isr_register.o obj/HAL/src/alt_instruction_exception_entry.o obj/HAL/src/alt_instruction_exception_register.o obj/HAL/src/alt_io_redirect.o obj/HAL/src/alt_ioctl.o obj/HAL/src/alt_irq_entry.o obj/HAL/src/alt_irq_handler.o obj/HAL/src/alt_irq_register.o obj/HAL/src/alt_irq_vars.o obj/HAL/src/alt_isatty.o obj/HAL/src/alt_kill.o obj/HAL/src/alt_link.o obj/HAL/src/alt_load.o obj/HAL/src/alt_log_macro.o obj/HAL/src/alt_log_printf.o obj/HAL/src/alt_lseek.o obj/HAL/src/alt_main.o obj/HAL/src/alt_malloc_lock.o obj/HAL/src/alt_mcount.o obj/HAL/src/alt_open.o obj/HAL/src/alt_printf.o obj/HAL/src/alt_putchar.o obj/HAL/src/alt_putcharbuf.o obj/HAL/src/alt_putstr.o obj/HAL/src/alt_read.o obj/HAL/src/alt_release_fd.o obj/HAL/src/alt_remap_cached.o obj/HAL/src/alt_remap_uncached.o obj/HAL/src/alt_rename.o obj/HAL/src/alt_sbrk.o obj/HAL/src/alt_settod.o obj/HAL/src/alt_software_exception.o obj/HAL/src/alt_stat.o obj/HAL/src/alt_tick.o obj/HAL/src/alt_times.o obj/HAL/src/alt_uncached_free.o obj/HAL/src/alt_uncached_malloc.o obj/HAL/src/alt_unlink.o obj/HAL/src/alt_usleep.o obj/HAL/src/alt_wait.o obj/HAL/src/alt_write.o obj/HAL/src/altera_nios2_gen2_irq.o obj/HAL/src/crt0.o obj/alt_sys_init.o

```

Anyone have some thoughts?

0 Kudos
8 Replies
EricMunYew_C_Intel
Moderator
1,542 Views

Can you follow below:


1. install WSL 1 for windows

i. https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/nios2/n2sw_nii5v2gen2.pdf (chapter 2.1)

 Note: Windows 10 build version 16215.0 or higher 

ii. Launch Ubuntu 18.04.

iii. Install additional distro packages required:

 a. sudo apt-get update

b. sudo apt install wsl

 c. sudo apt install dos2unix

 d. sudo apt install make


2. install nios2 eclipse folder

https://www.intel.com/content/altera-www/global/en_us/index/support/support-resources/knowledge-base/tools/2019/why-does-the-nios--ii-not-installed-after-full-installation-of-t.html


3. Refer to point 4 below:

https://www.intel.com/content/www/us/en/programmable/support/support-resources/download/os-support.html







0 Kudos
Cameron1
Employee
1,530 Views
0 Kudos
frycoo
Novice
1,478 Views

Hello,

I don't want to reinstall entire WSL just for this test. I have WSL2 enabled and installed Ubuntu:

Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal

There is a difference in Ubuntu version, you suggested 18.04, do You think It may be relevant?

also I had no dos2unix and eclipse installed so I follow steps c. and 2.

I don't know how to answer to point 3. I'm using WSL already. 

 

In effect, nothing changed. nios2-elf-ar.exe still hangs.

0 Kudos
frycoo
Novice
1,513 Views

Solved? No. But a temporary solution is to modify Makefile of BSP (in my case the BSP build causes the problem) to run nios2-elf-ar twice and split the argument list (nios2-elf-ar just adds new files into archive).

```

$(BSP_LIB)$(OBJS)
    @$(ECHO) Creating $@...
    $(AR_PRE_PROCESS)
    $(RM) -f $@
    $(AR) $(BSP_ARFLAGS) $@ $(wordlist 1, 10, $^)
    $(AR) $(BSP_ARFLAGS) $@ $(wordlist 10, 1000, $^)
    $(AR_POST_PROCESS)
```
The drawback here is, of course, that BSP Makefile is autogenerated and modification have to be done every time BSP is modified.
0 Kudos
EricMunYew_C_Intel
Moderator
1,488 Views

Can you try this nios2-elf-ar q <archive_name>.a <object files>


0 Kudos
frycoo
Novice
1,481 Views

nios2-elf-ar.exe q libhal_bsp.a obj/HAL/src/alt_alarm_start.o obj/HAL/src/alt_busy_sleep.o obj/HAL/src/alt_close.o obj/HAL/src/alt_dcache_flush.o obj/HAL/src/alt_dcache_flush_all.o obj/HAL/src/alt_dcache_flush_no_writeback.o obj/HAL/src/alt_dev.o obj/HAL/src/alt_dev_llist_insert.o obj/HAL/src/alt_dma_rxchan_open.o obj/HAL/src/alt_dma_txchan_open.o obj/HAL/src/alt_do_ctors.o obj/HAL/src/alt_do_dtors.o obj/HAL/src/alt_ecc_fatal_entry.o obj/HAL/src/alt_ecc_fatal_exception.o obj/HAL/src/alt_env_lock.o obj/HAL/src/alt_environ.o obj/HAL/src/alt_errno.o obj/HAL/src/alt_exception_entry.o obj/HAL/src/alt_exception_muldiv.o obj/HAL/src/alt_exception_trap.o obj/HAL/src/alt_execve.o obj/HAL/src/alt_exit.o obj/HAL/src/alt_fcntl.o obj/HAL/src/alt_fd_lock.o obj/HAL/src/alt_fd_unlock.o obj/HAL/src/alt_find_dev.o obj/HAL/src/alt_find_file.o obj/HAL/src/alt_flash_dev.o obj/HAL/src/alt_fork.o obj/HAL/src/alt_fs_reg.o obj/HAL/src/alt_fstat.o obj/HAL/src/alt_get_fd.o obj/HAL/src/alt_getchar.o obj/HAL/src/alt_getpid.o obj/HAL/src/alt_gettod.o obj/HAL/src/alt_gmon.o obj/HAL/src/alt_icache_flush.o obj/HAL/src/alt_icache_flush_all.o obj/HAL/src/alt_iic.o obj/HAL/src/alt_iic_isr_register.o obj/HAL/src/alt_instruction_exception_entry.o obj/HAL/src/alt_instruction_exception_register.o obj/HAL/src/alt_io_redirect.o obj/HAL/src/alt_ioctl.o obj/HAL/src/alt_irq_entry.o obj/HAL/src/alt_irq_handler.o obj/HAL/src/alt_irq_register.o obj/HAL/src/alt_irq_vars.o obj/HAL/src/alt_isatty.o obj/HAL/src/alt_kill.o obj/HAL/src/alt_link.o obj/HAL/src/alt_load.o obj/HAL/src/alt_log_macro.o obj/HAL/src/alt_log_printf.o obj/HAL/src/alt_lseek.o obj/HAL/src/alt_main.o obj/HAL/src/alt_malloc_lock.o obj/HAL/src/alt_mcount.o obj/HAL/src/alt_open.o obj/HAL/src/alt_printf.o obj/HAL/src/alt_putchar.o obj/HAL/src/alt_putcharbuf.o obj/HAL/src/alt_putstr.o obj/HAL/src/alt_read.o obj/HAL/src/alt_release_fd.o obj/HAL/src/alt_remap_cached.o obj/HAL/src/alt_remap_uncached.o obj/HAL/src/alt_rename.o obj/HAL/src/alt_sbrk.o obj/HAL/src/alt_settod.o obj/HAL/src/alt_software_exception.o obj/HAL/src/alt_stat.o obj/HAL/src/alt_tick.o obj/HAL/src/alt_times.o obj/HAL/src/alt_uncached_free.o obj/HAL/src/alt_uncached_malloc.o obj/HAL/src/alt_unlink.o obj/HAL/src/alt_usleep.o obj/HAL/src/alt_wait.o obj/HAL/src/alt_write.o obj/HAL/src/altera_nios2_gen2_irq.o obj/HAL/src/crt0.o obj/alt_sys_init.o obj/drivers/src/altera_avalon_jtag_uart_fd.o obj/drivers/src/altera_avalon_jtag_uart_init.o obj/drivers/src/altera_avalon_jtag_uart_ioctl.o obj/drivers/src/altera_avalon_jtag_uart_read.o obj/drivers/src/altera_avalon_jtag_uart_write.o

 

Above invocation also hangs. The effect is the same as previous. When there is a small number of .o files it works correctly, otherwise it hangs.

0 Kudos
EricMunYew_C_Intel
Moderator
1,442 Views

Can you try to archive directly in the folder containing the object files.



frycoo
Novice
1,408 Views

I moved one step down in the folder structure, inside the obj directory and run fillowing command:

nios2-elf-ar.exe -src libhal_bsp.a HAL/src/alt_alarm_start.o HAL/src/alt_busy_sleep.o HAL/src/alt_close.o HAL/src/alt_dcache_flush.o HAL/src/alt_dcache_flush_all.o HAL/src/alt_dcache_flush_no_writeback.o HAL/src/alt_dev.o HAL/src/alt_dev_llist_insert.o HAL/src/alt_dma_rxchan_open.o HAL/src/alt_dma_txchan_open.o HAL/src/alt_do_ctors.o HAL/src/alt_do_dtors.o HAL/src/alt_ecc_fatal_entry.o HAL/src/alt_ecc_fatal_exception.o HAL/src/alt_env_lock.o HAL/src/alt_environ.o HAL/src/alt_errno.o HAL/src/alt_exception_entry.o HAL/src/alt_exception_muldiv.o HAL/src/alt_exception_trap.o HAL/src/alt_execve.o HAL/src/alt_exit.o HAL/src/alt_fcntl.o HAL/src/alt_fd_lock.o HAL/src/alt_fd_unlock.o HAL/src/alt_find_dev.o HAL/src/alt_find_file.o HAL/src/alt_flash_dev.o HAL/src/alt_fork.o HAL/src/alt_fs_reg.o HAL/src/alt_fstat.o HAL/src/alt_get_fd.o HAL/src/alt_getchar.o HAL/src/alt_getpid.o HAL/src/alt_gettod.o HAL/src/alt_gmon.o HAL/src/alt_icache_flush.o HAL/src/alt_icache_flush_all.o HAL/src/alt_iic.o HAL/src/alt_iic_isr_register.o HAL/src/alt_instruction_exception_entry.o HAL/src/alt_instruction_exception_register.o HAL/src/alt_io_redirect.o HAL/src/alt_ioctl.o HAL/src/alt_irq_entry.o HAL/src/alt_irq_handler.o HAL/src/alt_irq_register.o HAL/src/alt_irq_vars.o HAL/src/alt_isatty.o HAL/src/alt_kill.o HAL/src/alt_link.o HAL/src/alt_load.o HAL/src/alt_log_macro.o HAL/src/alt_log_printf.o HAL/src/alt_lseek.o HAL/src/alt_main.o HAL/src/alt_malloc_lock.o HAL/src/alt_mcount.o HAL/src/alt_open.o HAL/src/alt_printf.o HAL/src/alt_putchar.o HAL/src/alt_putcharbuf.o HAL/src/alt_putstr.o HAL/src/alt_read.o HAL/src/alt_release_fd.o HAL/src/alt_remap_cached.o HAL/src/alt_remap_uncached.o HAL/src/alt_rename.o HAL/src/alt_sbrk.o HAL/src/alt_settod.o HAL/src/alt_software_exception.o HAL/src/alt_stat.o HAL/src/alt_tick.o HAL/src/alt_times.o HAL/src/alt_uncached_free.o HAL/src/alt_uncached_malloc.o HAL/src/alt_unlink.o HAL/src/alt_usleep.o HAL/src/alt_wait.o HAL/src/alt_write.o HAL/src/altera_nios2_gen2_irq.o HAL/src/crt0.o alt_sys_init.o drivers/src/altera_avalon_jtag_uart_fd.o drivers/src/altera_avalon_jtag_uart_init.o drivers/src/altera_avalon_jtag_uart_ioctl.o drivers/src/altera_avalon_jtag_uart_read.o drivers/src/altera_avalon_jtag_uart_write.o

 

It worked as expected. Turns out it has something to do with the overall path lengths nios2-elf-ar can accept.  That does not solve the problem. I do not see the easy solution without modifying auto-generated Makefile.

0 Kudos
Reply