Reply
Moderator
Posts: 58
Registered: 2007-02-12
0

General Technical MQX FAQs

[ Edited ]

 


Top Technical FAQ's


Q: I installed the MQX software release, but when I run a project, CodeWarrior can't find file x...  

A: Symptom
A project will build correctly, but when you run it, CodeWarrior asks you to locate files that it can't find.

Solution:
This problem is caused if you are running from a directory that is not the default directory that the installer placed the files. You just need to re-build the libraries.
To build all MQX libraries at once, the special mass-build project may be used. The project is located together with the user_config.h file in directory: <install_dir>/config/<board>/build_libs.mcp.

See the Release Notes for more details on building the libraries.

Message Edited by amh on 2009-06-26 10:19 PM
Moderator
Posts: 58
Registered: 2007-02-12
0

Re: Top Technical FAQs

[ Edited ]

Q: What software tools do I need for the MQX 3.0.0 demos and lab tutorials?

A:
The first release of Freescale MQX (3.0.0) requires CodeWarrior for ColdFire v7.1 Professional Edition (30-day evaluation available) to unlock the full potential of the demos and labs.

Is version 7.1 necessary?  
Yes, 7.1 contains the necessary support for M5225EVB and M52259DEMOKIT.

What about CodeWarrior Special Edition
?  Due to the code size limitation (<128k) of Special Edition, several lab demos will not compile/program.  These include MQX labs 3 and 4.  Also, Task Aware Debugging is not available in Special edition, therefore lab 5 is not possible.  Additionally, the targets which utilize the MRAM on the M52259EVB will not work.

 

What about CodeWarrior Basic and Standard Edition?

Task Aware Debugging is not available in Basic or Standard edition,therefore lab 5 is not possible.  Also, with Basic Edition the targets whichutilize the MRAM on the M52259EVB may not work.

 

 

Q: I'm having trouble establishing an Ethernet connection between my PC and the board.  What do I do?


A:

1) Hit the Reset button on the board after you plug in the cable.   

2) Wait a minute or two for your computer to connect.

Connect the board directly to your computer with an ethernet crossover cable.  You must wait a minute or two for your computer to try to aquire a network address.  Since you're no longer connected to your network the computer will eventually revert to an Auto IP address on the same subnet as board (169.254.x.x). 

3) Disable your wireless router if you have one. 

4) Disable proxy server settings in your web browser. 

 

Notes:

When connected your computer might report limited or no connectivity, but it should still work. 

 Ping is disabled in release 3.0.0, so pinging the board from the computer will not work. 
 

If all else fails, configure your IP address manually as instructed by the quick start guide.

 


Q: Can I modify the webpages used in the webserver lab? 

A: Yes, there is a tool called MKTFS which can be used to convert web pages and images into a C array's, which are used by the MQX webserver.  Edit the webpages in the folder \demo\web_hvac\web_pages.  Then click on \demo\web_hvac\mktfs.bat.  The script will update the file tfs_data.c in the \demo\web_hvac folder.  When you recompile the hvac_web project and program it the new webpages will be loaded into memory.        
      



Q: Can I use my own USB Flash drive in the labs?

 

A: Yes, just copy over the files from the flash drive that is provided with the M52259EVB or M52259DEMOKIT. 

 


Q: My USB Flash drive doesn’t work, what should I do?

 

A: Not all USB flash drive conform to the same specification and there are small differences between them that could cause some not to work.  It will say "Unable to open USB disk" at the terminal if the flash drive is not compatible.

We are working to expand compatibility to as many usb flash drive manufactures and models as possible.  If you encounter one that does not work please perform the following tasks.

Open up the project in <mqx install directory>/usb/host/examples/mass/msc_commands/codewarrior/
Load and run the project with the USB stick unattached. Then with the Terminal open and connected, plug in the non-functioning USB stick. A test will run automatically upon insertion of the USB stick.  The test will output useful information to the terminal that will help us. 

Please provide us the output that this test generates, along with the exact make and model of the USB flash drive.  We will create a thread on the forums that you can post this to.

 

More info: Tested USB Stick

Message Edited by amh on 2009-06-26 10:19 PM
Moderator
Posts: 58
Registered: 2007-02-12
0

Re: General Technical MQX FAQs

[ Edited ]

Question:
 What are tasks and how are they created?

Answer: 
 Tasks share the same code space if they execute the same root function. A task always starts executing at the entry point of the root function even if the function is its creator’s root function. This is not the same behavior as fork() in UNIX.

 

Question:
 Do I always need at least one autostart task?

Answer: 
Yes. In an application, at least one autostart application task is required in order to start the application. In a multiprocessor application (the application can create tasks remotely), each image need not have an autostart application task; however, each image must include IPC Task as an autostart task in the task template list. If no application task is created on a processor, Idle Task runs.

 

 

Question:
 How much stack space should I give to various tasks in my application? 

Answer:
 This is a really hard question to answer as the amount of stack space is extremely application specific. Different tasks will need varying amounts of stack space depending on the job they are trying to perform. We usually recommend starting all (or most) of tasks with plenty of stack memory (double or triple what you think they would need) and then later optimizing the system with TAD (Task Aware Debugging module).

Question:
 How do I dynamically alter the task stack size?

Answer: 
In a situation where a task runs a while and then blocks. In it's blocked state, it holds a couple of event connections which are used by interrupts, but otherwise needs no stack space. One would like to reduce the stack space being used by the task in its blocked state. How do you do this?
If the task is never going to run again, the user could _mem_free or better yet _mem_free_part on the stack. Using _mem_free_part will not cause some of our tools to complain.
In the task whose stack to be freed, the very first thing it does is to save the value of kernel_data->ACTIVE_PTR->MEMORY_RESOURCE_LIST;

/* Global var */ 

pointer stack_ptr;

 

{ /* In task */

KERNEL_DATA_STRUCT_PTR kernel_data = _mqx_get_kernel_data();

 

/* Do this very first thing */

stack_ptr = kernel_data->ACTIVE_PTR->MEMORY_RESOURCE_LIST;

 

/* Rest of code for task */

}

 

{ /* some other task*/

_mem_free(stack_ptr);

}

 

Question:
 How does MQX™ measure a timeslice? Is the timeslice absolute or relative? That is, if a task has a 10-ms timeslice and starts at time=0 ms, does it give up the processor at time=10 ms, or does it give up the processor after 10 ms of execution?

Answer: 
With a 10-ms timeslice, MQX counts the number of periodic timer interrupts that have occurred while the task is active. If the equivalent of 10 or more milliseconds have expired, MQX effectively runs _sched_yield() for the task. As a result, a task does not get 10 ms of linear time since higher-priority tasks will preempt it. Also, if the task calls a scheduling service (for example _task_block() or _sched_yield()), MQX sets the task’s timeslice counter back to zero. As with timeouts, the time that MQX allocates is plus or minus BSP_ALARM_RESOLUTION.

 

 

Message Edited by macl on 2009-07-07 10:02 AM
Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

[ Edited ]

Question:
Does RTCS support IPv6?

Answer: 
Currently, RTCS does not support IPv6. IPV6 is planned for 2011.

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
How do I increase TCP performance?

Answer: 
Increase the size of the send and/or receive windows. Send data in multiples of the maximum segment size (MSS). Disable the Nagle algorithm.

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
Is there a limit to the number of sockets that can be created with RTCS?

Answer: 
No. Sockets come from a partition with an infinite growth factor, so the number of sockets is limited only by the available memory on the board.

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
Do I always need at least one autostart task?

Answer: 
Yes. In an application, at least one autostart application task is required in order to start the application. In a multiprocessor application (the application can create tasks remotely), each image need not have an autostart application task; however, each image must include IPC Task as an autostart task in the task template list. If no application task is created on a processor, Idle Task runs.

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
Is it possible to rename a task after it is created?

Answer: 

Here's a function to get a pointer to the task's template struct where the task's name is stored. The function needs a couple of structures from mqx_prv.h.Namely, TD_STRUCT and KERNEL_DATA_STRUCT. You can add the function to your application or add it into MQX itself. If you are adding it to app, you will need to include "mqx_inc.h" and add mqx\source\include to the compiler's include search path.

 

/*FUNCTION*------------------------------------------------------------------- * * Function Name : _task_get_template_ptr * Returned Value : TASK_TEMPLATE_STRUCT_PTR * Comments : * Returns a pointer to the task's template structure * *END*----------------------------------------------------------------------*/ TASK_TEMPLATE_STRUCT_PTR _task_get_template_ptr ( _task_id ) { /* Body */ KERNEL_DATA_STRUCT_PTR kernel_data; TD_STRUCT_PTR td_ptr; _GET_KERNEL_DATA(kernel_data); if (task_id == MQX_NULL_TASK_ID) { td_ptr = kernel_data->ACTIVE_PTR; } else { td_ptr = (TD_STRUCT_PTR)_task_get_td(_task_id); } /* Endif */ if (td_ptr) { return( td_ptr->TASK_TEMPLATE_PTR ); } /* Endif */ return( NULL ); } /* Endbody */ An example of how to use this function: /* Need prototype */ extern TASK_TEMPLATE_STRUCT_PTR _task_get_template_ptr(_task_id); . . . . /* Dynamically create the task */ some_task_id = _task_create(..... ); . . . /* Change name of some_task */ template_ptr = _task_get_template_ptr(some_task_id); template_ptr->TASK_NAME = "new name"; . . /* Change name of the current (active) task */ template_ptr = _task_get_template_ptr(MQX_NULL_TASK_ID); template_ptr->TASK_NAME = "new name";

 

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
How are exceptions or unhandled interrupts handled by MQX?

Answer: 

Basically, there are three ways of handling unhandled interrupts. They are mutually exclusive - in other words, you can only have one active at a time. You'd pick the one that best suits you for an application and use it:
1) _int_default_isr()
This is the default mode of handling interrupts - it simply blocks the offending task and sets its state to "Unhandled Interrupt Blocked"
2) _int_unexpected_isr()
This mode can be activated by calling _int_install_unexpected_isr() from the application. This will also block the offending task and set its state, but also will print some info on the console about who and what caused the unexpected exception
3) _int_exception_isr()
This is the most functional (but also most complex) of all the modes. It can be activated by calling _int_install_exception_isr().
Once this is installed, any unhandled interrupts will call _int_exception_isr(). It might help you understand the behavior of this function by actually looking at the code. It's in source\psp\\int_xcpt.c.


Here are the comments that define the behavior:
If an exception happens while a task is running, then:
if a task exception handler exists, it is executed, otherwise the task is aborted.
If an exception happens while an isr is running, then:
if an isr exception handler exists, it is executed, and the isr aborted otherwise the isr is aborted.
This is why you have to provide exception handlers.
For tasks, you install these with _task_set_exception_handler(). You would need to install a handler for each task in your system that you want handled (conceivably, this could be the same handler for all of them)
For ISRs, you install these with _int_set_exception_handler(). The parameter is the vector number of the interrupt your installing a handler for, not the exception vector itself (in other words, you'd install handlers for the vectors of ethernet, UARTs, timers, etc, not the divide by zero vector)
So, if you want to have full "handling" of all unhandled interrupts, you'll have to install handlers for all the tasks and ISRs that exist in your system. The handler itself could simply flag the error and allow the task to continue running. Other comments:
-Note that you shouldn't have to rebuild MQX libraries to change the modes - its simply done with a function call
-If one of the above three methods of handling unhandled interrupts does not suit you, you can also create your own handler to take whichever action you want and install it by calling _int_install_default_isr() with your own ISR as a parameter. This might be a simpler approach than using the exception handlers.

Freescaler
Garabo
Posts: 16
Registered: 2009-07-21
0

Re: General Technical MQX FAQs

Question:
How is DNS enabled?

Answer: 

Include DNS.H in the application. Call DNS_init() after calling RTCS_create(). Then insert the following code: DNS_First_Local_server[0].IP_ADDR = "my dns server's ip addr";