Manually converting project to MCUXpresso SDK

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

Manually converting project to MCUXpresso SDK

851 Views
scottm
Senior Contributor II

I can't seem to find any documentation on how to convert an existing project to use the MCUXpresso SDK.  I'm not expecting a tool to automatically replace my code, I'm just looking for instructions on how to link in the SDK and set everything up so that the configuration tools can run.

I have a feeling the answer is going to be 'create a new project and import your code and replicate the settings' but I'd really like to understand how the SDK setup works.  There's never been an embedded SDK or code generation tool that I didn't have to eventually bypass or replace pieces of and I hate working with black boxes.  I can't find any information on how the SDK package management works, either.  I know that ZIP files are kept in the user's mcuxpresso home directory and the project creation wizard apparently extracts files as needed. I can't find anything beyond that.

I've got two major projects I'd like to start converting, but I need to be able to replace a component at a time, starting with the clock and pin setup.  I'm working with a modified version of the bare metal USB stack v5 and it's going to take me some time to apply my modifications to the SDK's stack and I've got some peripheral drivers tuned for specific applications that I don't want to replace with SDK modules at all.

Thanks,

Scott

Labels (1)
0 Kudos
2 Replies

547 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

I don't know we have this kind of document.

If you need SDK driver files for your project, I suggest you use MCUXpresso Config Tool.


Have a great day,
Jennie Zhang

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

0 Kudos

547 Views
scottm
Senior Contributor II

Can you walk me through this process so I can figure out which things are not implemented yet and which things are just broken?  I've spent the last hour reading documentation and trying to set up a project and I'm not much closer to where I want to be.

My target MCU is an MK22FN1M0AVLH12.  I have a couple of large projects that I'd like to port, mainly for the sake of getting rid of the old buggy Freescale bare metal USB stack (v5).  Both projects use FreeRTOS, and both were formerly using Processor Expert but were converted to static files with PEx removed.  My expectation is that I should be able to create an SDK project, move my code into it, resolve conflicts with memory map defines, startup code, and so on, replace low-level initialization code like the clock and pin setup with the SDK's versions, and then for the peripheral drivers I want to replace, incrementally remove or rewrite my code to use the SDK.  Not all peripherals will be changed - I've got a highly customized and optimized UART driver tuned for use with a particular WiFi module, for example.

I've deleted all installed SDK versions, rebuilt the SDK with the tool, and installed the new version.  If I create a new project with the MK22FN1M0Axxx12, the USB stack does not show up in the middleware options.  This is the main thing I need.  The user's guide does say something about the USB middleware component not being supported by add/remove, but based on the surrounding text I take that to mean that you can't add/remove the component from an existing project.

Is that correct?  Or is the only way to get the USB middleware component to start with one of the example projects?  If that's the case, how were the example projects created?  If they're created with those components added manually, why is there no documentation on that procedure?

Moving on, I'm using all of the peripheral drivers except flexcan, sdhc, and smartcard_uart, library type is NewlibNano (nohost), language standard is GNU C99.  My project is created and I click on the clocks perspective, and it says "MCU is not selected".  I click on the peripherals perspective and it says "no configuration created yet".  The pins perspective is blank.  There is no obvious way to create a configuration.

Going back to the user's guide, I see that it has you select these perspectives by first right-clicking on the project and selecting the config tools.  This does get the clocks perspective to work - though I had to switch back to the default color scheme because it's unreadable with the dark theme.

At this point the pins view is still blank:

pastedImage_1.png

The peripherals view says the processor is not supported, and to select a different tool:

pastedImage_2.png

Incidentally, when it says to select a different tool, what exactly is expected?  Is there another tool that WILL configure peripherals?  Or is it telling me to give up and go do something else?  What processors ARE supported by the tool, and how do I find that out?  Will this processor EVER be supported?

I started over and this time chose a development board, the FRDMK22F.  It actually shows me two identical images for the board, and I discovered that you have to hover over the image to see which SDK it's from.  In this case the first image was actually from the MK02FN64 SDK and of course didn't have the components I needed.  I do appreciate the images of the boards to help quickly find what I'm looking for on the rare occasions I use one of these boards, but this is one of those cases where the attempt at a pretty, user-friendly view is concealing necessary information.

I still don't have the USB stack option for this device.  Starting over again, I try importing a demo project.  I select my MCU and it says "Please select an available board for your project."  None are shown:

pastedImage_4.png

But wait, why does a blank page need a scrollbar?  If you click on the blank page, THEN it shows some boards:

pastedImage_5.png

Again with two copies of the board I want.  'dev_composite_cdc_msc_freertos' is the closest project to what I'm looking for.  Now I have to change the system oscillator setup since I'm using a 12 MHz crystal.  But oops - this configuration won't work on my board, because the MK22FN512 on the FRDMK22F doesn't use the same core as the MK22FN1M0, and the 1M0 part doesn't have HSRUN mode.  Now I realize that 'available boards' doesn't actually reflect your selected MCU, and the twrk21f120m is the proper board for this MCU.  Rebuild, download, install...

This at least gets me to a point where I have a project with the USB stack and the proper clock configuration, and it runs on my hardware.  It's running the wrong version of FreeRTOS, though, and will have to have that replaced manually.  The USB stack, too, will need some modifications. Can I take these components out of the SDK package management, so it doesn't ever try to update them in the event I use the project refresh option?

And is this *really* the only way to get USB in a project - by starting with the demo?

Thanks,

Scott

0 Kudos