HOWTO: Add custom SDK into existing project

Document created by Jiri Kral Employee on Aug 8, 2018Last modified by Mike Doidge on Mar 12, 2019
Version 7Show Document
  • View in full screen mode

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 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:

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


Right click on project name -> Properties and select SDKs -> Add


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


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


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.


Don't forget to select header files too:


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: 



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


Now you can see changes in your project:


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:


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:



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


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