Starting with MQX - KSDK - Strange behavior

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Starting with MQX - KSDK - Strange behavior

1,414 Views
MAPC
Senior Contributor I

Hello, Sirs.

 

I just wrote a simple code with MQX - KSDK: I created two tasks; one prints out "Hello" and the other prints out "World" on a Windows Terminal. I used two semaphores to control the usage of the serial output by both tasks.

 

I don't know why after the fifth print ("Hello"), the tasks stop running and it falls into "Default ISR". I can't identify what could be causing that:

 

20242_20242.jpgterminal_screenshot_2.jpg

 

Strange to realize that lwsemaphore demo for FRDM-K64F is running perfectly.

 

Did anybody ever experienced anything similar to that?

 

I would really appreciate any help or tips.

 

My project is attached.

 

 

Thanks,

 

Marco Coelho

Original Attachment has been moved to: projeto_novo_mqx.zip

Labels (1)
9 Replies

709 Views
MAPC
Senior Contributor I

Iva,

Your method is good, easier, faster and less prone to errors rather than creating a new project from zero.

I would like to share with you a workaround I found in order not to mess with the original boards/frdmk64f folder files like gpio_pins.c, board.h, etc and get free to change them to meet my application needs. It may be helpful to other people in the Community.

1) I cloned (Ctl + C, Ctl + V) the "C:/Freescale/KSDK_1.1.0/board/frdmk64f" folder and renamed it, in my case, to "myboard_k64f" in the same directory, keeping the files inside with the same name:

frdmk64f_folder_cloning.png

2) Then, I created a virtual folder and named it "KSDK_Files" and included the linked files inside that folder. To do it, I right clicked on project's name, "New", "Folder". I filled the "Folder name" field with "KSDK_Files", clicked on "Advanced", checked on the option "Folder is not located in the file system (Virtual Folder)" and clicked on "Finish":

virtual_folder.png

virtual_folder_2.png

3) Right click on "KSDK_Files" folder. Select New / File / Advanced and mark the option "Link to File in File System". Click on "Browse" button and point to "board.h" file inside recently created "myboard_k64f" folder and click on "Open" to confirm:

link_to_files.png

4) Repeat the same procedure above in order to link to the other files: "gpio_pins.c", "gpio_pins.h", "hardware_init.c", "pin_mux.c" and "pin_mux.h". Do not link to "frdmk64f.peb" file. We won't use it in our case.

5) Now it is necessary to change the path which points to "frdmk64f" folder to "myboard_k64f" folder in "Compiler / Includes" and "Assembler / Includes" Settings:

5.1) First, go to "Project / Settings / Cross ARM GNU Assembler / Includes". Double click on the "...boards/frdmk64f" folder path and change it to "...boards/myboard_k64f". Click on "OK" and "Apply":

assembler_include_path.png

Repeat the same procedure above in "Project / Settings / Cross ARM C Compiler / Includes", rebuild the project and it is finished. Now you have you own board configuration files to do change acording to your board setup, without messing with the original ones.

Best regards,

Marco Coelho

0 Kudos

709 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Marco Aurelio P. Coelho,


according to your project structure it looks like project which was importing from CW to KDS. E.g. folder Project_Settings, bad set Toolchain, Preprocessor etc in your project.

If you create new project for KDS and KSDK and put the code here, it will work correctly.

So, please go to the example hello from C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples\hello and replace it according to my attached code.

This solution works well, I tested as well.

hello.png

If you don´t want to modify original demo, it is more simple to copy the demo and modify its copy.

So, you can do it by e.g. Total Commander and replace the old name to new one, or you can use this very useful script, which creates Anthony Huereca.

Create new KSDK Projects

Just take a exe script (make_new_ksdk_project) and put it in your case into C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples

I also attach you the script.bat, which you execute for your creation copy. I set "hello" example, by double click on script.bat.

script.png

Best Regards,

Iva

0 Kudos

709 Views
MAPC
Senior Contributor I

Hello, Iva

Thank you very much for your attention.

I still can't understand what is wrong with my code. I just followed a step by step guide of how to create a new MQX - KSDK project posted by Carlos Musich on this Community (https://community.freescale.com/thread/339684).

I had to include some defined symbols in "Cross Arm C Compiler ==> Preprocessor" Internal Settings in order to fix some compile errors that came up. After that, the code seemed to run fine, but after I included semaphores and removed the task_abort to see the messages scrolling down on the Terminal, that failure took place. It doesn't make any sense.


I would really like to find out what is wrong with my code and caused this issue.


But your solution sounds very interesting, but I didn't receive your code and the script.bat file you commented before. Could you please send it to me again?



Thanks and best regards,


Marco

0 Kudos

709 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Marco Aurelio P. Coelho,


I´m attaching it by the end of the previous post. It is called frdm_k64f_hello.zip and in this folder I attach you script.bat, script by Anthony and main.c


frdm_k64f_hello.zip

Please, try the process, which I refer to you above, and tell me. It looks you badly create a project.

And I try your process with creating new MQX project and your code by this way.

Best Regards,

Iva

0 Kudos

709 Views
MAPC
Senior Contributor I

Hello, Iva

I just tested your solution and it really works with the script file, but only when you copy the hello project to the same location C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples and keep it there.

I tried to copy the hello project to another directory and use the script file to create a copy of the project there, but when I import the project to KDS and compile it, the following error comes up:

new_project_compile_error(script).jpg

I would like to have the freedom of creating my project anywhere. One disadvantage of the script method is that the files from the examples are linked to the libraries where they are located at and if you need to make any modification, you change the content of the original files and that is not good. The method proposed by Carlos Musich copy the files so you can change them any time you want.

The author of scipt solution, Anthony Huereca says that it is possible to move hello project to another directory and make a copy of it there, but I don't know if I there is a way to do it through the script file or there is another way to do it. Were you able to do it on your side?

I also tried to remove the linked folders, create new folders and copy all the files and libraries manually, by following the Carlos Musich's method, but it failed, as well.

Thanks.

Marco

0 Kudos

709 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Marco Aurelio P. Coelho,


It looks you have do not include the libraries (mqx_stlib_frdmk64f, mqx_frdmk64f and ksdk_mqx-lib_k64f12)

Please, check it according to this Compiler and Linker settings in KDS. After that please clean your project and build again.

edit3.png

edit4.png

edit2.png


You have to set the paths to your project and therefore you cannot move your project in your way. So modifying the demo/example is the best way how to avoid conflict.

If you want to copy another project, edit the bat file, type the name of example, which you want to copy, save it and execute the script.bat and type the name of new project.

The name must be different.

edit.png

I tested on my side and it works without problems.

Yes,it is possible to move the script to another example folder. You can copy the script e.g. to C:\Freescale\KSDK_1.1.0\demos


I hope it helps you,

Iva

0 Kudos

709 Views
MAPC
Senior Contributor I

Hello, Iva

Thanks for your dedication to help me so far.

The script solution works very well when I copy hello project inside examples folder, but when I try to copy the same project to a directory other than C:\Freescale\KSDK_1.1.0\rtos\mqx\mqx\examples\, it fails, as you can see on the screenshot bellow:

script_other_directory.jpg

I had to set the paths to ${KSDK_PATH}, and the libraries you mentioned above are already there:

compiler_includes.jpg

linker_miscelaneous.jpg

It looks like the best solution so far is the script solution, keeping the copied project at examples folder. If there is not a better way, I can adopt that as a temporary solution. I will try the Carlos Musich's method once more, although it is a very tiring process.

If you have other tips or advice, please let me know.

As I said, any help is always very welcome.

Thanks and best regards,

Marco

0 Kudos

709 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Marco Aurelio P. Coelho,


please, check your procedure with this step-by-step guide.

How to create copy of KSDK example in KDS

I hope it helps you,

Iva

0 Kudos

709 Views
ivadorazinova
NXP Employee
NXP Employee

Hi Marco Aurelio P. Coelho,


It looks you have do not include the libraries (mqx_stlib_frdmk64f, mqx_frdmk64f and ksdk_mqx-lib_k64f12)

Please, I´m working on short tutorial for you for checking whole procedure.

Hopefully, during the day, I have finished the tutorial and post it to Community.


Please, check the libraries included to the project. I also write you the paths to the libraries.

First of all, build the libraries and after that build the project. It works.

script.png

I hope it helps you,

Iva