MQX Getting Hung at startup, MQX Getting Hung at startup

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX Getting Hung at startup, MQX Getting Hung at startup

2,154件の閲覧回数
josephgundel
Contributor III

Essentially I followed this guide to building a framework MQX project: How To: Create a New MQX RTOS for KSDK Project in KDS

Something must be configured incorrectly in the linker or startup code.

If I load the same code from the pre-built example project (rtos hello world), it works fine.  If I try to build my own project from scratch by following these instructions (which I will need to do with a custom board) I run into this issue that appears to be the WDOG_EWM_IRQHandler being called and causing a DefaultISR interrup , even though if you look at the board files the DISABLE_WDOG code appears to be set correctly.

Here is the stack trace which happens just a few ms after startup:

21599_21599.pngpastedImage_1.png

I've tried creating an explicit handler for this (which doesn't fire), I don't know what else to do.  I'm new to the quirks of MQX but I don't know how to make a project that is any simpler and it's already showing issues.

Appreciate any help you can give here, thanks.

0 件の賞賛
返信
9 返答(返信)

1,226件の閲覧回数
RadekS
NXP Employee
NXP Employee

From my point of view described issue looks like some side effect.

I tried follow up How To: Create a New MQX RTOS for KSDK Project in KDS guide.

Additionally I add Cross Arm C Compiler ==> Preprocessor symbols:

"CPU_MK64FN1M0VMD12=1"

"FSL_RTOS_MQX=1"""

"_AEABI_LC_CTYPE=C"

"__STRICT_ANSI__=1"

"_DEBUG=1"

and set Cross Arm C Compiler ==> Optimization as the “GNU ISO C99 (-std=gnu99)”

But I stopped at step 3.15. With this step I was able build project but without them, building cause errors (no reference to serial interface). It was strange because step 3.15 should do the same as steps 3.13 and 3.14 together.

This leads us (thank you Marian) that problem will be in compiler dependencies.

Proposed solution:

Please modify Cross Arm C++ Linker Command line patter by adding “-Wl,--start-group” and “-Wl,--end-group” commend line option.

${COMMAND} ${cross_toolchain_flags} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} -Wl,--start-group ${INPUTS} -Wl,--end-group

This will resolve cyclic references between several libraries.

With these settings we don’t need step 3.15 and code works correctly on my side. I see “Hello World” on terminal.

Could you please test it on your side?

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

1,226件の閲覧回数
josephgundel
Contributor III

I made these changes and it seemed to help until I added a loop in the second task.

Once i add loops in 2 or more tasks the same issue happens.

Any more suggestions Below is the main.c

#include <stdio.h>

#include <mqx.h>

#include <bsp.h>

/* Task IDs */

#define HELLO_TASK 5

#define WORLD_TASK 6

extern void hello_task(uint32_t);

extern void world_task(uint32_t);

const TASK_TEMPLATE_STRUCT MQX_template_list[] =

{

/* Task Index, Function, Stack, Priority, Name, Attributes, Time Slice */

        {WORLD_TASK, world_task, 700, 0 , "world", MQX_AUTO_START_TASK, 0, 0},

        {HELLO_TASK, hello_task, 700, 0 ,  "hello", 0, 0, 0},

        {0}

        };

void world_task ( uint32_t initial_data )

{

    _task_id hello_task_id;

    hello_task_id = _task_create(0, HELLO_TASK, 0);

    if (hello_task_id == MQX_NULL_TASK_ID)

    {

        printf ("\n Could not create hello_task\n");

    } else

    {

    }

    while(1)

    {

        printf(" World \n");

        _time_delay(1);

    }

    _task_block();

}

void hello_task ( uint32_t initial_data )

{

    while(1)

    {

        printf("\n Hello\n");

        _time_delay(1);

    }

    _task_block();

}

0 件の賞賛
返信

1,226件の閲覧回数
ironsean
Contributor V

jeffreygraves, the Issue is in the linker not finding the appropriate library files and then not finding the proper vector table for interrupts, and what you run into is the SysTick_Handler() firing, which increments tick time every 5 ms. When it can't find the handler it enters a generic interrupt which never returns and ceases code execution after 5ms. The most complete information on the issue is here in the comments: How To: Create a New MQX RTOS for KSDK Project in KDS

0 件の賞賛
返信

1,226件の閲覧回数
mozturk
Contributor I

I have run into the same problem with the SystTick_Handler() while trying to build the SDK folder into a static library in a standalone KSDK/Processor Expert project. Do you know if there is a definitive fix for this? There doesn't seem to be a conclusion in the thread you linked, and I have tried configuring the linker every way I know how.

0 件の賞賛
返信

1,228件の閲覧回数
ironsean
Contributor V

Meric,

Are you using the latest KSDK 1.2.0 and KDS 3.0? The workaround I had to do in KSDK 1.1.0 was to build my project inside of a an MQX example project that was properly configured.

Using the new version of the new project guide with the new 1.2/3.0 versions worked fine and I didn't run into the issue anymore.

Sean

0 件の賞賛
返信

1,228件の閲覧回数
jeffreygraves
Contributor III

I have seen this document.

As it turned out for us, creating a new project in KDS 2.0 (wizard guided), using KSDK 1.2 and PEx, MQX wound up included in our project as source code.

We did not have this problem...


Thanks for the info.  Good luck with the rest of your project.


0 件の賞賛
返信

1,228件の閲覧回数
jeffreygraves
Contributor III

Joseph,

I haven't read all of the details here, but at first glance this sounds like a problem I had.

If using PEx components that generate interrupts, check calls to NVIC_SetPriority() in cpu.c.

If you see priorities greater than 15U, then you have a problem.

See:

Re: UART Rx (callback) Makes MQX Weird

Good Luck,

0 件の賞賛
返信

1,228件の閲覧回数
josephgundel
Contributor III

I am not using processor expert So I don't think this applies.

0 件の賞賛
返信

1,228件の閲覧回数
jeffreygraves
Contributor III

The main thing is NVIC_SetPriority().

I think (internally) the priority gets ANDed with 0x0F and shifted left 4 bits.

If you set a priority above 15 then you wind up with an actual priority of 0 which interrupts MQX...


0 件の賞賛
返信