Page 1 of 1

Linker Error

Posted: Wed 2019-08-21 7:28
by rflores765
I'm having some trouble with what seems to be the linker. I get this error when trying to use SetJmpiHookFunction:

?_VoidVoid? ?_SetJmpiHookFunction? ERROR: "_VoidVoid" is needed but not found anywhere.
ERROR: "_SetJmpiHookFunction" is needed but not found anywhere.

Any idea what I did wrong in the setup?

Thanks,
Rodrigo

Re: Linker Error

Posted: Wed 2019-08-21 10:31
by Panu
Hmm, are you using a generic (compatible) app template? I think you need to use a ROM-specific app template to access most ROM functions.

If that is the case, then the fix is to use a VS1010D -specific template for the project. That will include vs1010d_romabs.o or something that has the symbols.

-Panu

Re: Linker Error

Posted: Thu 2019-08-22 2:53
by rflores765
I created a new project with the VS101D Romspecific VSOS Hello World template. This does work!

The reason I need this function is to free the I2S pins 29 and 34 - 36 to use them as GPIO. Even when I use the following code to these pins to GPIO mode, I still I2S operation.
PERIP(GPIO2_MODE) &= ~(GPIO2_I2S_FRAME); // RED
PERIP(GPIO2_MODE) &= ~(GPIO2_I2S_BITCLK); // GREEN
PERIP(GPIO2_MODE) &= ~(GPIO2_I2S_DO); // BLUE
PERIP(GPIO0_MODE) &= ~(GPIO0_I2S_MCLK); // VOL_PLUS

PERIP(GPIO0_DDR) &= ~(GPIO0_I2S_MCLK); // VOL_PLUS
PERIP(GPIO2_DDR) |= GPIO2_I2S_FRAME; // RED
PERIP(GPIO2_DDR) |= GPIO2_I2S_BITCLK; // GREEN
PERIP(GPIO2_DDR) |= GPIO2_I2S_DO; //BLUE

PERIP(GPIO2_ODATA) |= GPIO2_I2S_FRAME; // RED
PERIP(GPIO2_ODATA) |= GPIO2_I2S_BITCLK; // GREEN
PERIP(GPIO2_ODATA) |= GPIO2_I2S_DO; //BLUE
Pin 29 is used as an input and the rest as outputs. Pin 29 is measured at ~0.8V instead of IOVDD which it is pulled up to.

I follow the same pattern with pin 9 to set as a GPIO and output high. It works on this pin but not the I2S pins.

Re: Linker Error

Posted: Thu 2019-08-22 6:51
by Panu
Hmm, do you have the VS1010 Handbook?

Various functions in the ROM configure various parts of the chip to various purposes as needed. What you are experiencing is the IOCTL_RESTART function of the audio output, which sets up DAC, analog drivers and I2S output in SRC mode. The problem probably goes away if you start the audio out in your code manually, and only after that set those pins to GPIO mode and set their states. IOCTL_RESTART of the stdaudioout sets a global variable audioInited to "1" and then the PlayerPlayFile does not attempt to restart the audio again.

-Panu

Re: Linker Error

Posted: Thu 2019-08-22 16:24
by rflores765
Yes I do have the handbook. For the ROM source code, do I have access to the .c files? I can only seem to find the .h files. I'm not sure it would help me but it may help with understanding.

The handbook mentions this line:
stdaudioout->op->Ioctl(stdaudioout, IOCTL_RESTART, 0);
to start the audio output on page 114. I have this line at the start of main before I set the GPIO and still see the I2S is enabled. Is there any bit I can check and print to the console to verify when the audio output is ready?

Re: Linker Error

Posted: Fri 2019-08-23 5:08
by rflores765
I was able to use the I2S pins as GPIOs. I used SETHANDLER(88,MyAudioInitedHandler); where MyAudioInitedHandler simply set the pins as GPIO and outputs. I see that it runs every time PlayerPlayFile is called.

Re: Linker Error

Posted: Sat 2019-08-24 12:18
by Panu
Hi!

Great that you made it to work!. Hmm, so it was the AudioInit thing after all... I was really dumbstruck as to why just initializing the audio in your boot.dlx and then setting the pins didn't work, and, hmm, still am.. I guess something triggers a complete restart of the audio at some point. But great that you found the proper way to handle it! Just set your fini() function so that your program doesn't get unloaded from the memory, since you need to keep that MyAudioInitedHandler in the memory even after your program ends.

-Panu