Forum Discussion
Altera_Forum
Honored Contributor
16 years agoFrom the other thread:
--- Quote Start --- 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). --- Quote End --- This is really useful information but I am not sure how to apply it. I think I found the current linker script used by uClinux (elf2flt/elf2flt.ld) but it uses a flat memory map for all the memory so I don't know how to apply the change to add another section. I also tried the attribute solution [adding __attribute__ ((section (".ssram")))] to a method. I get this error: /opt/build/nios2/bin//nios2-linux-uclibc-ld.real: section .ssram overlaps section .text I don't think there is an sram or ssram section defined anywhere, so looks like this is trying to create one in the middle of the text section, which isn't at all what I want.