HOWTO: Add custom SDK into existing project

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

HOWTO: Add custom SDK into existing project

HOWTO: Add custom SDK into existing project

Sometimes you would like to share sources between projects and - even better - between platforms. Let's say that we are developing software with the very same functionality for S32K144 and MPC5744P. In this case, we can identify platform independent functions - generic, platform specific functions - not related to MCU itself, but related to the way some peripheral works (for example different ADC result range) - and MCU dependent functions like clock init. In attachment is a very simple SDK which can be shared with S32K144 and MPC5744P (each in different S32DS editions). 

Unzip my_sdk.zip archive (for example C:\NXP folder). You can import example projects, but instead let's start from the beginning. Create a new S32DS Application project and choose MCU:

s32ds_2018-08-08_14-26-47.png

You can use default project configurations and click through to finish:

Right click on project name -> Properties and select SDKs -> Adds32ds_2018-08-08_13-56-04.png

Complete the Name, Version and Description fields in New SDK dialog and click on Change button next to Location field.

pastedImage_2.png

In Change SDK Location dialog, leave Define new variable setting selected, click Browse and find the my_sdk path:

pastedImage_3.png

pastedImage_4.png

Now we can select files (sources, headers...) from selected SDK, you can select all available files. If you select a folder, then all files in that folder will be selected as well.

pastedImage_5.png

Don't forget to select header files too:

pastedImage_1.png

If you choose Copy - the files will be copied into project folder and you can do local changes. Without this option (default) - changes will be shared between all projects depended on this particular SDK.

The ability to individually select the files to be included from the SDK as well as to copy into the project folder, provides much flexibility to customize SDK usage in your projects.

Click on OK, then Attach/Detach... to attach this SDK into your project: 

s32ds_2018-08-08_13-59-22.png

s32ds_2018-08-08_14-02-39.png

If you like to use your SDK for newly created projects (as an option in SDK select list) - click on Make global button:

pastedImage_2.png

Now you can see changes in your project:

s32ds_2018-08-08_14-03-45.png

As well, the SDK can be viewed in SDK Explorer (Window -> Show View -> Other...), where functions and macros are available for drag and drop functionality into your code:

pastedImage_1.png

Platform specific code is filtered by preprocessor-defined macro. So - let's define if we are working with S32K144 or MPC5744P. Right click on project name -> Properties -> C/C++ Build -> Settings -> <Standard S32DS C Compiler OR name of your compiler> -> Preprocessor:

s32ds_2018-08-08_14-23-06.png

We are done - now we can use SDK functions - S32K144: 

pastedImage_12.png

and MPC5744P (enabling interrupts is default part of empty project for MPC5744P - that's only difference):

pastedImage_14.png

Tags (3)
Attachments
No ratings
Version history
Last update:
‎08-08-2018 06:48 AM
Updated by: