FPGARelated.com
Forums

Problem with Scheduler in Xilkernel.

Started by Jespr May 19, 2008
Hi. We are a couple of guys, working on a school project. We are
trying to get the Xilkernel up and running, on the Spartan 3E starter
kit. We are getting these streams from the debugger:
XMK: Starting kernel.
XMK: Initializing Hardware.
XMK: System initialization.
From these streams we can tell that the function xilkernel_init (); is
running. But we expect that after xilkernel_init (); has finished, the
function xilkernel_start (); should be called next. (see function
"void xilkernel_main()" below) So our guess is that we somehow is
stuck in the xilkernel_init (); function. Because the first thing
xilkernel_start (); should do is to stream out "XMK: Process
scheduling starts.",but nothing happens. (see function "void
xilkernel_start ()" below).  This code is taken from the
xilkernel:void xilkernel_main()
{
    DBG_PRINT("XMK: Starting kernel.\r\n");

    xilkernel_init ();
    xilkernel_start ();
}   void xilkernel_start ()
{
    DBG_PRINT("XMK: Process scheduling starts.\r\n");
#if defined (MB_XILKERNEL)
    microblaze_enable_interrupts();
#elif defined (PPC_XILKERNEL)
    XExc_mEnableExceptions (XEXC_NON_CRITICAL);
#endif    idle_task
();                                                       // Does not
return
}  So we think the question we should be asking is:How do we get the
scheduler running ?

This is our mss file:

BEGIN OS
 PARAMETER OS_NAME = xilkernel
 PARAMETER OS_VER = 4.00.a
 PARAMETER PROC_INSTANCE = microblaze_0
 PARAMETER sysintc_spec = xps_intc_0
 PARAMETER stdout = RS232_DCE
 PARAMETER stdin = RS232_DCE
 PARAMETER config_pthread_mutex = true
 PARAMETER systmr_freq = 50000000
 PARAMETER systmr_dev = delay
 PARAMETER config_debug_support = true
 PARAMETER debug_mon = true
 PARAMETER verbose = true
 PARAMETER systmr_interval = 5
 PARAMETER max_readyq = 10
 PARAMETER n_prio = 32
 PARAMETER sched_type = SCHED_RR
 PARAMETER config_sched = true
 PARAMETER config_pthread_support = true
 PARAMETER max_pthread_mutex_waitq = 10
 PARAMETER max_pthread_mutex = 10
 PARAMETER pthread_stack_size = 1000
 PARAMETER max_pthreads = 10
 PARAMETER systmr_spec = true
 PARAMETER static_pthread_table = ((shell_main,1))
END


Source file:

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


void* shell_main(void *dummy)
{
	return 0 ;
}

int main()
{
	xilkernel_main();
}
On May 19, 2:51 am, Jespr <DonMad...@gmail.com> wrote:
> Hi. We are a couple of guys, working on a school project. We are > trying to get the Xilkernel up and running, on the Spartan 3E starter > kit. We are getting these streams from the debugger: > XMK: Starting kernel. > XMK: Initializing Hardware. > XMK: System initialization. > From these streams we can tell that the function xilkernel_init (); is > running. But we expect that after xilkernel_init (); has finished, the > function xilkernel_start (); should be called next. (see function > "void xilkernel_main()" below) So our guess is that we somehow is > stuck in the xilkernel_init (); function. Because the first thing > xilkernel_start (); should do is to stream out "XMK: Process > scheduling starts.",but nothing happens. (see function "void > xilkernel_start ()" below). This code is taken from the > xilkernel:void xilkernel_main() > > <SNIP> > This is our mss file: > <SNIP>
You didn't provide your MHS file, which would help out a little more with respect to your problem. Did you follow the XilKernel requirements of having an external timer for support on the Microblaze? -- Mike
Year I did, here is my MHS file:

PARAMETER VERSION = 2.1.0


 PORT fpga_0_RS232_DCE_RX_pin = fpga_0_RS232_DCE_RX, DIR = I
 PORT fpga_0_RS232_DCE_TX_pin = fpga_0_RS232_DCE_TX, DIR = O
 PORT fpga_0_RS232_DTE_RX_pin = fpga_0_RS232_DTE_RX, DIR = I
 PORT fpga_0_RS232_DTE_TX_pin = fpga_0_RS232_DTE_TX, DIR = O
 PORT sys_clk_pin = dcm_clk_s, DIR = I, SIGIS = CLK, CLK_FREQ =
50000000
 PORT sys_rst_pin = sys_rst_s, DIR = I, RST_POLARITY = 1, SIGIS = RST


BEGIN proc_sys_reset
 PARAMETER INSTANCE = proc_sys_reset_0
 PARAMETER HW_VER = 2.00.a
 PARAMETER C_EXT_RESET_HIGH = 1
 PORT Slowest_sync_clk = sys_clk_s
 PORT Dcm_locked = Dcm_all_locked
 PORT Ext_Reset_In = sys_rst_s
 PORT MB_Reset = mb_reset
 PORT Bus_Struct_Reset = sys_bus_reset
 PORT MB_Debug_Sys_Rst = Debug_SYS_Rst
END

BEGIN microblaze
 PARAMETER HW_VER = 7.00.a
 PARAMETER INSTANCE = microblaze_0
 PARAMETER C_INTERCONNECT = 1
 PARAMETER C_DEBUG_ENABLED = 1
 PARAMETER C_AREA_OPTIMIZED = 1
 BUS_INTERFACE DLMB = dlmb
 BUS_INTERFACE ILMB = ilmb
 BUS_INTERFACE DPLB = mb_plb
 BUS_INTERFACE IPLB = mb_plb
 BUS_INTERFACE DEBUG = microblaze_0_dbg
 PORT RESET = mb_reset
 PORT INTERRUPT = Interrupt
END

BEGIN plb_v46
 PARAMETER INSTANCE = mb_plb
 PARAMETER HW_VER = 1.00.a
 PORT PLB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN bram_block
 PARAMETER INSTANCE = lmb_bram
 PARAMETER HW_VER = 1.00.a
 BUS_INTERFACE PORTA = ilmb_port
 BUS_INTERFACE PORTB = dlmb_port
END

BEGIN lmb_bram_if_cntlr
 PARAMETER INSTANCE = ilmb_cntlr
 PARAMETER HW_VER = 2.10.a
 PARAMETER C_BASEADDR = 0x00000000
 PARAMETER C_HIGHADDR = 0x00003fff
 BUS_INTERFACE SLMB = ilmb
 BUS_INTERFACE BRAM_PORT = ilmb_port
END

BEGIN lmb_v10
 PARAMETER INSTANCE = ilmb
 PARAMETER HW_VER = 1.00.a
 PORT LMB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN lmb_bram_if_cntlr
 PARAMETER INSTANCE = dlmb_cntlr
 PARAMETER HW_VER = 2.10.a
 PARAMETER C_BASEADDR = 0x00000000
 PARAMETER C_HIGHADDR = 0x00003fff
 BUS_INTERFACE SLMB = dlmb
 BUS_INTERFACE BRAM_PORT = dlmb_port
END

BEGIN lmb_v10
 PARAMETER INSTANCE = dlmb
 PARAMETER HW_VER = 1.00.a
 PORT LMB_Clk = sys_clk_s
 PORT SYS_Rst = sys_bus_reset
END

BEGIN mdm
 PARAMETER INSTANCE = debug_module
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_MB_DBG_PORTS = 1
 PARAMETER C_USE_UART = 1
 PARAMETER C_UART_WIDTH = 8
 PARAMETER C_BASEADDR = 0x84400000
 PARAMETER C_HIGHADDR = 0x8440ffff
 BUS_INTERFACE SPLB = mb_plb
 BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg
 PORT Debug_SYS_Rst = Debug_SYS_Rst
END

BEGIN clock_generator
 PARAMETER INSTANCE = clock_generator_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_EXT_RESET_HIGH = 1
 PARAMETER C_CLKIN_FREQ = 50000000
 PARAMETER C_CLKOUT0_FREQ = 50000000
 PARAMETER C_CLKOUT0_PHASE = 0
 PARAMETER C_CLKOUT0_GROUP = NONE
 PORT CLKOUT0 = sys_clk_s
 PORT CLKIN = dcm_clk_s
 PORT LOCKED = Dcm_all_locked
 PORT RST = net_gnd
END

BEGIN xps_uartlite
 PARAMETER INSTANCE = RS232_DTE
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BAUDRATE = 9600
 PARAMETER C_DATA_BITS = 8
 PARAMETER C_ODD_PARITY = 0
 PARAMETER C_USE_PARITY = 0
 PARAMETER C_SPLB_CLK_FREQ_HZ = 50000000
 PARAMETER C_BASEADDR = 0x84020000
 PARAMETER C_HIGHADDR = 0x8402ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT RX = fpga_0_RS232_DTE_RX
 PORT TX = fpga_0_RS232_DTE_TX
END

BEGIN xps_uartlite
 PARAMETER INSTANCE = RS232_DCE
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BAUDRATE = 9600
 PARAMETER C_DATA_BITS = 8
 PARAMETER C_ODD_PARITY = 0
 PARAMETER C_USE_PARITY = 0
 PARAMETER C_SPLB_CLK_FREQ_HZ = 50000000
 PARAMETER C_BASEADDR = 0x84000000
 PARAMETER C_HIGHADDR = 0x8400ffff
 BUS_INTERFACE SPLB = mb_plb
 PORT RX = fpga_0_RS232_DCE_RX
 PORT TX = fpga_0_RS232_DCE_TX
END

BEGIN xps_bram_if_cntlr
 PARAMETER INSTANCE = xps_bram_if_cntlr_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_SPLB_NATIVE_DWIDTH = 32
 PARAMETER C_BASEADDR = 0x84414000
 PARAMETER C_HIGHADDR = 0x84417fff
 BUS_INTERFACE SPLB = mb_plb
 BUS_INTERFACE PORTA = xps_bram_if_cntlr_0_PORTA
END

BEGIN bram_block
 PARAMETER INSTANCE = bram_block_0
 PARAMETER HW_VER = 1.00.a
 BUS_INTERFACE PORTA = xps_bram_if_cntlr_0_PORTA
END

BEGIN xps_timer
 PARAMETER INSTANCE = delay
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0x84410800
 PARAMETER C_HIGHADDR = 0x844109ff
 BUS_INTERFACE SPLB = mb_plb
 PORT Interrupt = delay_Interrupt
END

BEGIN xps_intc
 PARAMETER INSTANCE = xps_intc_0
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_BASEADDR = 0x84412000
 PARAMETER C_HIGHADDR = 0x844121ff
 BUS_INTERFACE SPLB = mb_plb
 PORT Intr = delay_Interrupt
 PORT Irq = Interrupt
END

You could try to step through those functions with the debugger (GDB):
compile the libraries with -g and -O0 options, set a breakpoint in
xilkernel_main(), and set into the xilkernel_init() function.
See also XAPP1037 for a really nice introduction to debugging
Microblaze programs.
Hope this helps,
Guy.
Thank you for your input, we will try the debugging.