In y application i trying to create lwevent, but
_lwevent_create returns me error.
I would like to ask which parts of MQX should be installed?
Should i run _int_unexpected_isr() before lwevent creation?
Solved! Go to Solution.
Check which instruction exactly has the breakpoint. Might be due to some optimization for size or something like that, that you put breakpoint on a different instruction than you would think. Alternatively, build the example with compiler optimization set to level 0 (off).
Do you have #define MQX_USE_LWEVENTS 1 in your user configuration ? (user_config.h).
Some BSPs may have this MQX component disabled by default.
Im using K60N512 and user_config.h do not has such parameter but include
/* use the rest of defaults from small-RAM-device profile */
#include "small_ram_config.h"
maximum_config.h and smallest_config.h contain such parameter
maximum_config.h contain
/*
** When MQX_USE_LWEVENTS is defined as 1,
** then mqx will compile in the support code for light weight event component.
*/
#ifndef MQX_USE_LWEVENTS
#define MQX_USE_LWEVENTS 1
#endif
smallest_config.h contain
/*
** When MQX_USE_LWEVENTS is defined as 1,
** then mqx will compile in the support code for light weight event component.
*/
#ifndef MQX_USE_LWEVENTS
#define MQX_USE_LWEVENTS 0
#endif
you can add a line
#define MQX_USE_LWEVENTS 1
to your user_config.h
I just tried our standard lwevent example c:\Freescale\Freescale MQX 3.8\mqx\examples\lwevent\lwevent.c on TWR-K60N512 and it works for me.
what is the error code returned by _lwevent_create() ?
Creation is OK.
_lwevent_wait_ticks return error.
Event task:
void evnttask( uint_32 temp)
{
result = _lwevent_test(&error_ptr, &error2_ptr);
if (result != MQX_OK){
printf("\nFailed _lwevent_test: 0x%X.", result);}
if (_lwevent_create(&lwevent1,0) != MQX_OK) {
printf("\nMake event failed");
}
while (1) {
if (_lwevent_wait_ticks(&lwevent1,1,TRUE,0) != MQX_OK) {
printf("\nEvent Wait failed");
}else
printf("\nEvent\n");
if (_lwevent_clear(&lwevent1,0x01) != MQX_OK) {
printf("\nEvent Clear failed");
}
printf(" Tick \n");
}
}
OK, what is the error code returned by _lwevent_wait_ticks ?
Everything works correct. This is just debugger bug.
Thanks!
Perfect !
Just would like to add MQX_OK is defined as zero (0). So if a function returns 0 it actually means MQX_OK.
c:\Freescale\Freescale MQX 3.8\mqx\source\include\mqx.h
Yes. But i have set breakpoint on this row
printf("\nEvent Wait failed");
And debugger stopped on this row, but _lwevent_wait_ticks(&lwevent,1,TRUE,0) returned 0.
Check which instruction exactly has the breakpoint. Might be due to some optimization for size or something like that, that you put breakpoint on a different instruction than you would think. Alternatively, build the example with compiler optimization set to level 0 (off).
OK. I will try that.
Thanks.
_lwevent_wait_ticks returns 0.
I have tried to start lwevent example from MQX package and faced with the same problem.
In demo application after task and lwevent creation service_task start the next code:
if (_lwevent_wait_ticks(&lwevent,1,TRUE,0) != MQX_OK) { | |
printf("\nEvent Wait failed"); | |
_task_block(); | |
} |
and i can see by debugger that _lwevent_wait_ticks(&lwevent,1,TRUE,0) returns 0 and pass this step and goes to
printf(" Tick \n");
But simulated_ISR_task did not set _lwevent_set(&lwevent,0x01) yet.
After that task returns to this step - if (_lwevent_wait_ticks(&lwevent,1,TRUE,0)) and hangs.
simulated_ISR_task works normally and every 200 ticks set event bit (_lwevent_set(&lwevent,0x01)), but service_task cant pass _lwevent_wait_ticks(&lwevent,1,TRUE,0) and hangs.
I set breakpoint on this row
printf(" Tick \n"); and can see that this row performs only once after simulated_ISR_task creation.
Message was edited by: Rozberg Dmitry
I found in mqx_cnfg.h the next part:
Comments:
*
* This file contains the default configuration definitions for configuring
* the various optional features of MQX. Individual config. Defines can be
* overridden in the "user_config.h" file.
*
* By default, MQX is configured as follows:
* MQX_ALLOW_TYPED_MEMORY 1
* MQX_COMPONENT_DESTRUCTION 1
* MQX_DEFAULT_TIME_SLICE_IN_TICKS 0
* MQX_EXIT_ENABLED 1
* MQX_EXTRA_TASK_STACK_ENABLE 1
* MQX_HAS_TIME_SLICE 1
* MQX_CHECK_ERRORS 1
* MQX_CHECK_MEMORY_ALLOCATION_ERRORS 1
* MQX_CHECK_VALIDITY 1
* MQX_INCLUDE_FLOATING_POINT_IO 0
* MQX_IS_MULTI_PROCESSOR 1
* MQX_KERNEL_LOGGING 1
* MQX_LWLOG_TIME_STAMP_IN_TICKS 1
* MQX_MEMORY_FREE_LIST_SORTED 1
* MQX_MONITOR_STACK 1
* MQX_MUTEX_HAS_POLLING 1
* MQX_PROFILING_ENABLE 0
* MQX_ROM_VECTORS 0
* MQX_RUN_TIME_ERR_CHECK_ENABLE 0
* MQX_TASK_CREATION_BLOCKS 1
* MQX_TASK_DESTRUCTION 1
* MQX_TIMER_USES_TICKS_ONLY 0
* MQX_USE_32BIT_MESSAGE_QIDS 0
* MQX_USE_32BIT_TYPES 0
* MQX_USE_EVENTS 1
* MQX_USE_IDLE_TASK 1
* MQX_USE_INLINE_MACROS 1
* MQX_USE_IPC 1
* MQX_USE_LOGS 1
* MQX_USE_LWEVENTS 1
* MQX_USE_LWLOGS 1
* MQX_USE_LWMEM 1
* MQX_USE_LWMEM_ALLOCATOR 0
* MQX_USE_LWMSGQ 1
* MQX_USE_LWTIMER 1
* MQX_USE_MESSAGES 1
* MQX_USE_MUTEXES 1
* MQX_USE_NAME 1
* MQX_USE_PARTITIONS 1
* MQX_USE_SEMAPHORES 1
* MQX_USE_SW_WATCHDOGS 1
* MQX_USE_TIMER 1
* MQX_VERIFY_KERNEL_DATA 1
* MQX_ENABLE_USER_MODE 0
* MQX_ENABLE_LOW_POWER 0
*
*END************************************************************************/
So, i think lwevents are enabled.
Iam trying to implement event in security_telnet example.
Later i will write _lwevent_create() error code.