Forum Discussion
Altera_Forum
Honored Contributor
16 years agoYes, this is what I referred as 'with optimisation'. Check that the -O3 option is set for both the application and the system library.
For a strange reason I can't open my project in the NIOS IDE anymore, it can't find it. But looking directly in the project settings files, I found the option. You must compile the system library with the -ffunction-sections option. That way each function is compiled in a separate section (.text.function_name). Then I adapted the linker script (tci is the name of the memory attached to the tightly coupled instruction memory:SECTIONS
{
.tci :
{
PROVIDE (_alt_partition_tci_start = ABSOLUTE(.));
. = ALIGN(32 / 8);
* (.text.cksum)
* (.text.asm_cksum)
* (.text.irq_Unmask)
* (.text.memcpy)
* (.text.sosend)
* (.text.udp_send)
* (.text.ip_write_internal)
* (.text.pk_alloc)
* (.text.udp4_socksend)
* (.text.ip2mac)
* (.text.ip_write)
* (.text.t_sendto)
* (.text.m_freem)
* (.text.m_getnbuf)
* (.text.udp_maxalloc)
* (.text.udp_usrreq)
* (.text.tcp_wakeup)
* (.text.udp_send)
* (.text.udp_alloc)
* (.text.m_free)
* (.text.udp_maxalloc)
* (.text.ip_mymach)
* (.text.send_via_arp)
* (.text.pk_free)
* (.text.tse_mac_raw_send)
* (.text.memmove)
* (.text.putq)
* (.text.pk_validate)
* (.text.irq_Mask)
* (.text.alt_remap_uncached)
* (.text.alt_avalon_sgdma_construct_mem_to_stream_desc)
* (.text.tse_mac_sTxWrite)
* (.text.alt_remap_cached)
* (.text.alt_dcache_flush)
* (.text.alt_avalon_sgdma_do_sync_transfer)
* (.text.alt_remap_cached)
* (.text.getq)
* (.text.qdel)
PROVIDE (_alt_partition_tci_end = ABSOLUTE(.));
} > tci
.text :
{
*(.text .stub .text.* .gnu.linkonce.t.*)
}
The tci soction must be listed before the text section. You need to change one line in the .text section, as indicated, to put all the .text.* functions that are not defined in the tci section back in the text section. I also noticed that each packet sent generates lots of function calls. I wonder if it would be possible to put the Interniche task stack in a tightly coupled data memory and gain a bit more. Of course if you still need more speed you can do some UDP communication with hardware, as in the nios2 udp offload example (http://www.nioswiki.com/exampledesigns/nios2udpoffloadexample).