Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

console driver

For starters, my experience with operating systems is predicated around vxWorks. That said consider the contrived program:

#  include <iostream>
 
bool done = false ;
static 
void display() {
  std::cout << "." ;
  done = true ;
}
 
int main() {
  while ( !done ) {}
}

vxWorks has a 'console driver' that allows the user to type the static funciton "display" and observe - in this case the output. The question: How can I write a console driver for microC that'll achieve the same objective? Of course if a member on this board has a driver available and is willing to share, then by all means feel free to contact me.

I have JTAG and UART to work with.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This isn't a trivial task. Basically VxWorks is doing several things for you:

    1 - Handling all STDIN functions via the console.

    2 - Parsing STDIN text.

    3 - Performing a lookup to find a corresponding task with the command name given from the console.

    4 - Calling the task (function).

    5 - Sending any standard output from the task to the console.

    That being said, you'd have to write something that does the same thing.

    Now there is truly only one existing example I could think to point you to. The InterNiche TCP/IP stack bundled with the NIOS tools has support for something similar. It doesn't do quite as much for you as VxWorks. Basically it supports the concept of menus. You can create menus which basically consist of titles and callback functions. The console driver provided in the InterNiche stack will parse the console input and call your specified callback function should it be called along with any arguments you've provided. Your function can then use a special "nsprintf" function to print text to the console.

    This console is available either from the STDIN, STDOUT streams or via the Telnet console if you've connected to the board via Telnet.

    Jake
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    This console is available either from the STDIN, STDOUT streams or via the Telnet console if you've connected to the board via Telnet.

    Jake

    --- Quote End ---

    Jake thanks for the response. I'm not connected via telnet. That said, could you elaborate on this: "This console is available either from STDIN, STDOUT streams". Trying to make sure I understand fully given my two options - JTAG or UART.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I perused the InterNiche TCP/IP documentation online. Trouble is, I have no Ethernet functionality on my board so I'm up for the alternative.