MCUX rearrange project directory structure

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

MCUX rearrange project directory structure

1,840 Views
mci
Contributor III

Hello,

I have spent the last 2.5 months trying out & modifying different SDK imported projects according to the needs of the new embedded product that I'll be developing which is based on the MKL28Z512VLL7 MCU.   I have integrated & combined a 4+ different system modules (e.g. ADC, TSI, PWM, LPTMR, INTMUX) in a single project.   All these times I have been using the same & default MCUXpresso Project Explorer directory or folder structure that is shown on the left side of the workspace, which is like:

...

/board

/component & subdirectories below

/device

/drivers

/source

/startup

/utilities

...

Given that I have many different features to implement combining all the different SDK driver files and functions, I would like to plan & make a different structure, at least under the "/source" directory.

Right now, all the flat single layer /source directory.

For my product's project, can I start adding subdirectories under /source to make things more organized for our own custom board's new & added custom code, maybe like this:

/source

     projstart.c   -  runs before main file main() function

/source/App

/source/Drv

/source/SConsole

... etc.

Will MCUXpresso builder automatically update all make build files to create & add such new directories & subdirectories to build the new binary that works for the target custom board?

Let's say I start from a FreeRTOS based project & build features, tasks, function calls, call backs on top of it in different source files under different /source/directories, is there a limit where I should not "touch" or modify any based directory structure like /board, /component, /device, /drivers.... which come as included in the basic SDK project?

Please advise.

Thanks for the help.

MI

0 Kudos
4 Replies

1,533 Views
mci
Contributor III

Hi Felipe,

Thanks for your response.

Right now, the current SDK project I'm modifying has this include settings:

../board
../source
../
../drivers
../device
../CMSIS
../utilities
../component/serial_manager
../component/uart
../component/lists

I apologize if this is dumb question:

If I understood your correctly, if I add a .c source file in a subdirectory under /source, e.g. /source/App/mainprog.c, I don't need to add the ../source/App  to the above INCLUDE list?   But if I add the header file in a subdirectory, e.g. /source/App/mainprog.h, I have to add ../source/App to the INCLUDE list?

Or whether I add a .c or a .h in a new subdirectory e.g. /source/App, I should put that on the INCLUDE list?

Else, compiler will not automatically create make file & build the new file folders?

Thanks again for the help.

MI

0 Kudos

1,533 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

 

Once you build the project, MCUXpresso will give you an error that the project cannot find the file. Please check snippets below.

 pastedImage_1.png

 

 pastedImage_2.png

Once you add the new directory to the includes paths you shouldn’t have any issue.

 

I hope it helps!

 

Best regards,

Felipe

1,533 Views
mci
Contributor III

Hi again, Felipe.

Thank you very much for the help.

I had to know what results I get before I tried it so I can prevent such problems.

Thanks for trying out yourself.

Regards,

MI

0 Kudos

1,533 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi MI,

 

You shouldn’t have any issues creating a new folder under the source folder.

 

If you add a header file to the source directory, you may have to add it in the include paths in Properties > C/C++ Build > Settings > Tool Settings > MCU C Compiler > Includes.

 

I hope it helps!

 

Have a great day,
Felipe

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------