KDS 1.1.0 adding MQX component using processor expert fails build

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

KDS 1.1.0 adding MQX component using processor expert fails build

3,494 Views
intractablesubt
Contributor III

I created a new simple "Hello World" project using the processor expert that builds and runs fine on my TWRK-21F120M board. I then try to add the MQX component and it fails the build with this error:

 

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections  -g3 -I"C:\Freescale\KDS_1.1.0\eclipse\ProcessorExpert/lib/Kinetis/pdd/inc" -I"C:\Freescale\KDS_1.1.0\eclipse\ProcessorExpert/lib/Kinetis/iofiles" -I"C:/Users/Billy/workspace.kds/example_twrk21f120m/Sources" -I"C:/Users/Billy/workspace.kds/example_twrk21f120m/Generated_Code" -std=c99 -MMD -MP -MF"Generated_Code/Cpu.d" -MT"Generated_Code/Cpu.o" -c -o "Generated_Code/Cpu.o" "../Generated_Code/Cpu.c"

../Generated_Code/Cpu.c:62:17: fatal error: mqx.h: No such file or directory

#include "mqx.h"

                 ^

compilation terminated.

make: *** [Generated_Code/Cpu.o] Error 1

 

I have installed the MQX plugin from the update site.

I have installed Freescale_MQX_KSDK_1.0.0-Beta and added the eclipse_update zip file to the installed software in KDS.

Labels (1)
19 Replies

1,261 Views
BlackNight
NXP Employee
NXP Employee

Hello,

The error indicates that it is looking for the MQX header files, but they are not present in the project or cannot be found.

unlike the MQX-Lite component, this componet does *not* implement (or generate) the MQX sources. What it does is adding MQX Kernel awareness (as an adaptor) and interface to other components. So if you want to use MQX with your project, you need to add the MQX kernel and BSP/PSP sources/libraries to your project, and add to the include path settings of the compiler.

The SDK or the MQX for the SDK unfortunately does not help you in your case, because the K21 is not supported in the Kinetis SDK V1.0.0 release, so you have to use the 'standard' MQX version. An easier approach for you might just to use the MQX-Lite, unless you really need the additional functionality of full MQX.

Erich

0 Kudos

1,261 Views
intractablesubt
Contributor III

Thanks Erich,

We are going to need the full MQX for our project and some variant of SSL too.

We're moving to the K64F120M family and I have a TWRK64F120M eval board on order and it looks like maybe that one is supported. Can you elaborate on your comment: "So if you want to use MQX with your project, you need to add the MQX kernel and BSP/PSP sources/libraries to your project, and add to the include path settings of the compiler."?

Does that mean "Import an existing project into the workspace" using a path similar to Freescale/MQX_KDS_1.0.0/rtos/mqx/mqx/build/kds/bsp_twrk64f120m?

0 Kudos

1,261 Views
BlackNight
NXP Employee
NXP Employee

Hi William,

yes, you need the MQX supporting the K64F installed. From there, import the KDS project.

Erich

0 Kudos

1,261 Views
intractablesubt
Contributor III

Hi Erich,

So I'm able to import those projects from the MQX_KDSK_1.0.0 tree. However, when I create a new Kinetis Design Studio project using the Board profile for TWR-K64F120M and enable Processor Expert, I no longer get the Operating Systems option in the Components Library. I also tried creating a project just using a K64F120M device and it doesn't show up there either. It does show up for a KDS project created using the K21F120M device.

0 Kudos

1,261 Views
BlackNight
NXP Employee
NXP Employee

Hi William,

If you have created the project with the SDK option, then only SDK components apply. the other ones are automatically filtered out (filter icon):

pastedImage_0.png

So if you want to use the (non-SDK) MQX, then you need to create the project with the SDK option disabled:

SDK option.png

Erich

0 Kudos

1,261 Views
intractablesubt
Contributor III

Hi Erich,

I've about run this to ground, at least in the Windows environment. I can resolve a lot of the build issues by including directories in MQX_KSDK_1.0.0 and setting some preprocessor defines. When I do that I get re-definitions of the same macros so I believe there is a conflict between using MQX_KSDK_1.0.0 and Processor Expert. I thought the MQX plugin would bridge the gap but I'm either doing something wrong or it just doesn't work that way. Here are the steps I took:

Step 1: Define some helper environment variables, MQX_KSDK_DIR and MQX_DIR to point to directories within MQX_KSDK_1.0.0.

Screen Shot 2014-08-20 at 10.23.03 AM.png

Step 2: Add include paths for Cross Arm GNU Assembler using the hello_twrk64f120m project as a guide:

Screen Shot 2014-08-20 at 10.26.31 AM.png

Step 3: Add preprocessor defines to Cross ARM GNU Assembler:

Screen Shot 2014-08-20 at 10.27.39 AM.png

Step 4: Add include paths to Cross ARM C Compiler:

Screen Shot 2014-08-20 at 10.28.52 AM.png

Step 5: Added preprocessor definitions to Cross ARM C Compiler:

Screen Shot 2014-08-20 at 10.29.56 AM.png

After this the build finds all the files and actually generates binaries but with conflicts between the include files generated by Processor Expert and those in MQX_KSDK_1.0.0:

Screen Shot 2014-08-20 at 10.31.43 AM.png

So at the moment it looks like I have to abandon Processor Expert if I want to use MQX. Any suggestions?

0 Kudos

1,261 Views
dereksnell
NXP Employee
NXP Employee

Hi William,

The confusion here is between the new MQX for KSDK, and the classical MQX without KSDK.  The MQX component you are using in Processor Expert (PEx) only works with Classic MQX, and will cause issues with MQX for KSDK.

We just posted a tutorial to get started with MQX for KSDK using PEx, see https://community.freescale.com/message/433784#433784

Besides the difference with KSDK, these two MQX components are also different in how they use the MQX source code.  The new MQX_KSDK component adds the kernel source code directly to the newly created project, and doesn't need to reference an MQX installation located elsewhere.  This is similar to the MQX-Lite component users may already be familiar with.  Although, the MQX_KSDK kernel is not reduced and limited like MQX-Lite, and allows more kernel features.

The MQX component for Classic MQX does not add the kernel projects directly to the project, and requires the MQX libraries and headers be linked to the project.  The Classic MQX BSP projects enable this with PEx included and already configured.  With Classic MQX, it's best to use a BSP project already enabled with PEx and avoid trying to create a new project with the MQX component.  The document installed with Classic MQX at \Freescale_MQX_4_1_1\doc\tools\cw\MQX_CW10_Getting_Started.pdf is a good tutorial for using PEx in the BSP project, and uses the installed demo application \Freescale_MQX_4_1_1\demo\pe_demo.  That tutorial document was written for CodeWarrior, but still applies to other toolchains as well.  The installed document \Freescale_MQX_4_1_1\doc\mqx\MQX_BSP_Porting_Example_User_Guide.pdf also covers using PEx in other toolchains with the MQX BSP.

But in your case, since you are using the K64 which is supported by KSDK and you are using KDS, I suggest you stick with MQX for KSDK, and use the new tutorial to create a KDS project with PEx.

Thanks

1,261 Views
intractablesubt
Contributor III

Thanks Derek,

That cleared an awful lot up for me. The new tutorial is excellent. I have run into one problem when I attempt to set the fsl_uart1 component for UART1, PTC3,PTC4 that are used on the TWR-K64F120M. The code generator errs off saying that it is impossible to set the baud rate to 115200. I've attached a screen shot.

Screen Shot 2014-09-09 at 4.14.13 PM.png

If I click on the baud rate selector in "Configurations" it takes me to a screen where I can look at the clock tree and it looks like 115200 should be fine. I've attached that screen shot as well.

Screen Shot 2014-09-09 at 4.14.46 PM.png

I must be missing something.

The next challenge for me is to add in the RTCS components of MQX so if you can add that to the tutorial or comment here it would be helpful.

0 Kudos

1,261 Views
dereksnell
NXP Employee
NXP Employee

Hi William,

Currently, when using MQX_KSDK component in PEx, there is no automated method to add the RTCS TCP/IP stack to the project.  The MQX_KSDK component is designed to add the MQX kernel directly to the project with the KSDK.  You will need to manually add the RTCS library to the project.

You can either copy the RTCS sub-directory from the MQX for KSDK installation directly to your PEx project, or link your project to the separate installation of MQX for KSDK.  But your application project will need to add the RTCS compiled library for the linker, like \MQX_KSDK_1.0.0\tcpip\rtcs\lib\twrk64f120m.kds\debug\rtcs\rtcs.a.  You will also need to add the RTCS header file directory to the compiler search paths, like \MQX_KSDK_1.0.0\tcpip\rtcs\lib\twrk64f120m.kds\debug\rtcs.  You can use the RTCS example projects in \MQX_KSDK_1.0.0\tcpip\rtcs\examples as references for how they link in the RTCS library for the toolchain.

Or another option is to start with the RTCS example projects for your application, which already have the RTCS library linked in the application.  If you want to use PEx with that, you can generate the PEx code from a separate project you create, and the copy the generated PEx code over your MQX for KSDK installed files.

Thanks

0 Kudos

1,261 Views
dave408
Senior Contributor II

Hi Derek, thank goodness I found my way back to this thread, since I was trying to figure out where the RTCS component was in KDS.  :smileyhappy:

I see you've recommended that we copy the RTCS source code into our project.  I've done that and imported it into my Sources folder in the IDE.  This resulted in several, expected compilation errors.  I was able to resolve some of them quite easily by adding the necessary paths to the includes section in Cross ARM C Compiler.  However, now I'm trying to fix one that's quite baffling:

Description    Resource    Path    Location    Type

static declaration of 'strdup' follows non-static declaration    getaddrinfo.c    /MQX_KSDK_PEx/Sources/rtcs/source/if    line 73    C/C++ Problem

The declaration is this:

static char * strdup(const char *s)

The actual implementation of the function matches it perfectly, so I'm not sure what the fuss is all about.  For now, I've just commented out strdup because it doesn't look like it's being used.  I've resolved all of the compiler errors, except that now I just get the following ambiguous build error:

Description    Resource    Path    Location    Type

make: *** [MQX_KSDK_PEx.elf] Error 1    MQX_KSDK_PEx             C/C++ Problem

Can you recommend any strategies for determining the source of this error?  Also, one thing I had also done (possibly erroneously) was to add an ENET Process Expert component to my project.  Do I even need that?

0 Kudos

1,261 Views
dave408
Senior Contributor II

Oh, silly me, I should have looked in the Console:

arm-none-eabi-g++: error: ./SDK/tos/mqx/mqx/source/psp/cortex_m/psp_nsti.o: No such file or directory

something's not getting compiled, apparently!  And my guess is that it's because the 'r' in "rtos" somehow got deleted.

0 Kudos

1,261 Views
dereksnell
NXP Employee
NXP Employee

Hi William,

You should try to break these different issues out into separate posts.  But regarding the PEx issue with the UART baud rate error, from your screenshots, that appears to be caused by multiple clock configurations in your CPU component.  The error message shows Clock Configuration 3 has the issue generating that baud rate.  And when you show the clock path in the timing dialog, it is for Clock Configuration 0.  My guess is that your Clock Configuration 3 uses a peripheral bus clock frequency that is not fast enough for a 115,200 baud rate for that UART.

The Timing Dialog does show information for the different clock configurations if you click the Advanced button.  But it appears the Clock path is fixed on Clock Configuration 0.  And the baud rate appears to need to be the same for all clock configurations.

timing dialog.jpg

Unfortunately, with the MQX_KSDK and fsl_uart components, I don't see how to disable the UART for specific clock configurations, or change the baud.  I'll submit that to the PEx team to see if there is an option.  But to work around the error and generate the PEx code, you may need to delete Clock Configuration 3 from your CPU component, or change the System Clock frequencies so your desired baud rate is possible in that Clock Configuration.

Thanks

0 Kudos

1,261 Views
dereksnell
NXP Employee
NXP Employee

Hi William,

I confirmed this multiple clock configuration issue is a limitation with PEx for KSDK.  We plan to update it in the KSDK release v1.1.

Thanks

0 Kudos

1,260 Views
intractablesubt
Contributor III

Thanks Derek,

Understood, I will endeavor to split my posts according to topic in the future. This forum is really handy and I appreciate the rapid response. You guys are doing a great job.

0 Kudos

1,261 Views
dave408
Senior Contributor II

@William Koos, I think I'm at a pretty similar point as you in the bring-up process.  Deleting clock configurations 1-4 did the trick for me in resolving that error, but then I hit another wall.  By any chance did you end up with a compiler error that says "device/MK64F12/MK64F12.h: No such file or directory"?  If so, how did you resolve it?  I've tried to add the folder that contains this header file in my project's C and C++ compiler options, but then that creates even more errors.  Could you please share with me where you're at, and how you resolved any issues?  Thanks!

0 Kudos

1,261 Views
intractablesubt
Contributor III

Hi Dave,

I did get additional errors but I can't remember if that was one of them. The tutorial referenced by Derek above (https://community.freescale.com/message/433784#433784) got me over the hump. However, it only works if you select a Processor (not a Board) from the "Devices" dialog box. If you select a Board (and I tried both the FRDM-K64F and the TWR-K64F120M) the project is generated with multiple clock configurations on the CPU component and an apparent bug (see Derek's post below) in KSDK prevents the fsl_uart component from working. I do intend to use multiple clock configurations at some point because my device is battery operated and I need to drop down in to the low power modes. I haven't gotten around to dealing with that.

0 Kudos

1,261 Views
dave408
Senior Contributor II

Thanks, William -- I had already read that previous post and in following those instructions, haven't gotten the project I created to compile.  I also can't get the project Derek shared to compile.  Hopefully, he'll get back to me in that thread so I can keep moving forward!  In the meantime, I guess I'll keep trying things.

0 Kudos

1,261 Views
intractablesubt
Contributor III

Hi Erich,

I'm getting closer using the windows variants(instead of Ubuntu) in that I'm able to build hello_twrk64f120m using the procedure described in "Getting Started with Freescale MQX RTOS for Kinetis SDK.pdf" However, hello_twrk64f120m is an existing project and clearly doesn't take advantage of Processor Expert code. I'm still getting the same error as above when I create a new project using Processor Expert and add in the MQX component.

The odd thing about the Ubuntu variants  of bps_twrk64f120m and pep_twrk64f120m is that they don't seem to really build anything even though they report "Build Finished". The same is true when I build hello_twrk64f120m and it does not create any binaries.

I've attached screenshots of both:

Screen Shot 2014-08-19 at 11.49.43 AM.png

Screen Shot 2014-08-19 at 11.49.55 AM.png

0 Kudos

1,261 Views
intractablesubt
Contributor III

Thanks Erich,

I've attached a screenshot to try and convey as much information as possible. Essentially, it's still not finding mqx.h even though it appears in the BSP_Files section of bps_twrk64f120m.

Screen Shot 2014-08-18 at 5.27.26 PM (2).png

0 Kudos