Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThis works:
int testcall(int n) __attribute__ ((section (".tc_code")));
int testcall(int n)
{
int i;
i = n;
while (i > 0) {
n += i--;
IOWR_ALTERA_AVALON_PIO_DATA(IO24V_PIO_BASE, n);
printf(".");
}
IOWR_ALTERA_AVALON_PIO_DATA(IO24V_PIO_BASE, 0x55);
return n;
}
I inserted the IOWR and printf to increase code size and have a call to a function in sdram, like the 'real' case. This DOES NOT work:
int pkt_send(char *data, int len) __attribute__ ((section (".tc_code")));
struct buffer_t
{
int len;
unsigned char data;
} buffer_tx;
int pkt_send(char *data, int len)
{
short index;
// is next buffer valid?
index = pkt_send_count & 0x07;
if (buffer_tx.len != 0)
return 0;
if (len >= 0x600)
len = 0x600;
memcpy(buffer_tx.data, data, len);
buffer_tx.len = len;
++pkt_send_count;
return len;
}Remarks: - buffer_tx resides in sdram - pkt_send() works perfectly when I remove the attribute directive - testcall() is called in the very beginning of program; pkt_send after uC RTOS tasks have been initialized Thank you for any help Cris