what's happen for this error?

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

what's happen for this error?

Postby ENGHK » Fri Feb 19, 2010 7:07 am

I would like to ask the below error:

xmap: Error: Symbol "outP" for resolution of resource expression for ".tmpLLNKi19" is undefined.
xmap: Error: Symbol "outClock" for resolution of resource expression for ".tmpLLNKi22" is undefined.
xmap: Error: Symbol "clk" for resolution of resource expression for ".tmpLLNKi25" is undefined.

how can I solve it ? my code is:

#include <xs1.h>
#include <stdio.h>
#include <platform.h>
on stdcore[1]: out port outP = XS1_PORT_8A ;
on stdcore[1]:out port outClock = XS1_PORT_1A ;
on stdcore[1]:clock clk = XS1_CLKBLK_1 ;
int main ( void ) {

configure_clock_rate (clk , 20, 2);

configure_out_port (outP , clk , 0);

configure_port_clock_output ( outClock , clk );

start_clock (clk );
for ( int i=0; i <5; i ++)
{outP <: i;}

}


I think it should be the problem of the core number. How can I solve this ? Actually I want to connect to a pin on the core 1, and make an input signal from the pin . Please help.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Fri Feb 19, 2010 7:22 am

The problem is that your ports are placed on core 1 but you code is running on the default core (core 0). There error message is telling you that the symbols for your ports don't exist where you're trying to use them.

You can place your code on core 1 like this:

Code: Select all

#include <xs1.h>
#include <stdio.h>
#include <platform.h>
on stdcore[1]: out port outP = XS1_PORT_8A ;
on stdcore[1]: out port outClock = XS1_PORT_1A ;
on stdcore[1]: clock clk = XS1_CLKBLK_1 ;
int main ( void ) {
  par
  {
    on stdcore[1]:
    {
      configure_clock_rate (clk , 20, 2);
      configure_out_port (outP , clk , 0);
      configure_port_clock_output ( outClock , clk );
      start_clock (clk );
      for ( int i=0; i <5; i ++)
        {outP <: i;}
    }
  }
   return(0);
}
Best friends with the code fairy.
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

Postby ENGHK » Fri Feb 19, 2010 8:01 am

it works!! thank you.

May I ask a question?Why for core(0), the "par" can be ignored, but when i use core(1), we need to add "par" for parallel process ?
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Fri Feb 19, 2010 9:42 am

ENGHK wrote:it works!! thank you.
May I ask a question?Why for core(0), the "par" can be ignored, but when i use core(1), we need to add "par" for parallel process ?
Historically, if you don't use "on.." then the default for ports is that they appear on every core but for code it's that it runs on core 0. This works quite well for very simple examples but because declaring a port causes it be to initialised it's almost always the Wrong Thing in larger applications. In the future it will become required to explicitly place ports.

In your example you placed the ports explicitly (on 1) but left the code in the default place (on 0). If you'd put the ports on 0 then your wouldn't have needed the par.

In practice it's best to always be explicit with both.
Best friends with the code fairy.
ENGHK
Member++
Posts: 16
Joined: Fri Feb 19, 2010 7:03 am

Postby ENGHK » Fri Feb 19, 2010 10:39 am

yes, thanks so much.

Who is online

Users browsing this forum: No registered users and 3 guests