FPGARelated.com
Forums

Xilkernel problem

Started by adrian September 12, 2005
Hi there,

I'm having problems trying to use Xilkernel on a XPS system designed to 
work on a Virtex-II Pro FPGA with MicroBlaze processor.
I am testing with a very simple code that is supposed to launch only one 
process and then terminate. The problem is that after launching 
xilkernel_main and initializing parameters the system isn't launching 
the process indicated in the static_pthread_table parameter.
I have no errors compiling and I have tried changing some xilkernel 
parameters but I can't really see what is failing.

Here is the definition of xilkernel in the MSS file:

--------------------------------------------------------

BEGIN OS
  PARAMETER OS_NAME = xilkernel
  PARAMETER OS_VER = 3.00.a
  PARAMETER PROC_INSTANCE = microblaze_0
  PARAMETER systmr_dev = opb_timer_1
  PARAMETER stdin = RS232
  PARAMETER stdout = RS232
  PARAMETER config_time = true
  PARAMETER n_prio = 6
  PARAMETER config_sema = true
  PARAMETER max_sem = 4
  PARAMETER config_msgq = true
  PARAMETER num_msgqs = 1
  PARAMETER config_bufmalloc = true
  PARAMETER config_debug_support = true
  PARAMETER verbose = true
  PARAMETER enhanced_features = true
  PARAMETER config_kill = true
  PARAMETER static_pthread_table = ((capture_main,1))
  PARAMETER mem_table = ((4,30),(8,20))
END

----------------------------------------------------------

Here is the application C code:

----------------------------------------------------------

#include "xmk.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <os_config.h>
#include <sys/process.h>
#include <pthread.h>

#define UART_BAUDRATE (115200)

static pid_t spid;
static pthread_t tid;
static pthread_attr_t attr;

void* sum(void *arg);

int main ()
{
    microblaze_enable_interrupts();
    xil_printf("Before xilkernel_main...\r\n");
    xilkernel_main ();
    xil_printf("After xilkernel_main...\r\n"); //Never reaches this point
}

void* capture_main (void *arg)
{
int ret;
pthread_attr_init (&attr);
xil_printf("Before launching the process...\r\n");
    ret = pthread_create (&tid, &attr, (void*)sum, NULL);
    if (ret != 0) {
       xil_printf ("-- ERROR (%d) launching process...\n", ret);
       return;
    }
    ret = pthread_join (tid, NULL);
    xil_printf("After launching process...");
}

void* sum (void *arg)
{
    int a = 1, b= 2, c=3;
    xil_printf("a + b = %d\r\n",(a+b));
    xil_printf("a + c = %d\r\n",(a+c));
    xil_printf("b + c = %d\r\n",(b+c));
}

-----------------------------------------------------------

And here is the program output:

-------------------------------------------------------------

Before xilkernel_main...
XMK: Start
XMK: Initializing Hardware...
XMK: Initializing PIT device.
XMK: System initialization...
XMK: Enabling interrupts and starting system...
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
Idle Task
.........
.........
.........

-------------------------------------------------------------

and carries on like that forever.

I can't really see what is going wrong so that's why I'm posting the 
message to this group hoping that somebody with more experience using 
xilkernel with MicroBlaze processor could help me out.

Any help would be greatly appreciated.

Thanks in advance,

Adrian.