This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Speed up GPIO by assembly

Hi.

I've tried using SPI for handling communication between DSP and FPGA. Problems on the C5515 with huge delays between successive frames for SPI have made me choose something different. I wanted to go on by using I2S but there are problems with I2S and the code on FLASH. And the fact that it is conceived for audio streaming (frame sync stuff etc.) rather than what I need made me choose, again, something different.

So I'd like to re-implement something similar to SPI using GPIO. First attempts are done and I observe signals on the scope. Now my main problem is that there is a huge difference in performance/clock period if I am in debug or release mode. And even in release mode I'm far from attempting min.values for clock period w.r.t. to the electrical specs (i.e. T_CLK_min = 40ns at 100MHz DSP clock). So I think it might be wise to do the whole communication part in assembly. But the problem is that at the moment I don't have too much experience with assembly on a DSP.

How can I re-write the following macro using assembly statements:

#define GPIO_TX_BIT(BUF,BIT,OUTBIT) \
    txb = (1u<<2u) | ((((BUF)>>(BIT))&0x001)<<(OUTBIT)); \
    gpio_handle->baseAddr->IOOUTDATA2 = txb;
    txb = (0u<<2u) | ((((BUF)>>(BIT))&0x001)<<(OUTBIT)); \
    gpio_handle->baseAddr->IOOUTDATA2 = txb;

with register Uint16 txb;

To get started I've tried something like asm("    mov _txb, 0x1c12"); but I get the following errors

. warning: variable "txb" was set but never used

. this address mode is invalid in CPL=1 mode

. Total size of all instructions in LOCALREPEAT body is too large (is
           130 bytes, must be <= 124 bytes.)

I think for someone with good assembly experience this is quite an easy one, but I'm absolutely not used to it and I'd really appreciate your help.

Regards,

Andreas