MCUXpresso supporting multiple board configuration in a single project

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MCUXpresso supporting multiple board configuration in a single project

971 次查看
alonbl
Contributor III

Hello,

I am trying to figure out how to maintain a single project that may run on multiple boards.

I thought that the functional group features of the Pin Tool and the Peripherals Tool is the feature that allows me to define different functional groups and conditionally call the initialization function during initialization based on preprocessor macro.

Let's take a simple example, my debug UART is different than the EVKB board, in EVKB the debug UART is LPUART1 while in my custom board it is LPUART11.

I cannot add DebugConsole components into the BOARD_InitPeripherals as the UART is different, so I tried to create two functional group, BOARD_InitPeripherals_EVK and BOARD_InitPeripherals_B1 and add it to each with the different settings.

However, I get an error that only one DebugConsole may be enabled and the codegen of the settings is removed.

Another example is same pin route in different configuration which is not possible.

What is the recommended method to support multiple board while leveraging the NXP tools capabilities in the same project?

Thanks,

标记 (3)
0 项奖励
回复
4 回复数

954 次查看
alonbl
Contributor III

Hello @DanielRuvalcaba ,

Since the MCUXpresso uses codegen, any change in code such as the one you recommended, will require manual maintenance (revert) each time the NXP tools generate the code due to a change.

I am hopping that similar to other tools the concept of re-usability will be supported by the environment (if codegen is selected), as I wrote the functional groups are almost there as I can conditionally call them from main, however, the solution is not working due to assumption the tools have on the implementation.

ESP32 for example use Kconfig build system, which is much more flexible, maybe a way to run the codegen from mex during build and patch the result? Any other creative idea to enjoy the tools and be able to assembly the blocks into a solution?

Thanks,

0 项奖励
回复

909 次查看
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

I’m sorry, but I don’t think we have something that satisfies your requirements as stated.

I’m afraid you will have to adjust the code manually as I mentioned before or probably, another way to achieve this is from the application, you can make a common GPIO and depending on the state, it will initialize the hardware for the respective board.

I’m sorry for the inconvenience this might cause you.

Regards,

Daniel.

0 项奖励
回复

905 次查看
alonbl
Contributor III

Hello @DanielRuvalcaba ,

Thank you for your senescence response.

Can you please add something similar to roadmap, for example supporting multiple mex files per project where each generate different set of files and function prefix so that main() may conditionally invoke the correct files or anything that will allow us developer to leverage the codegen without fighting with the bots.

Regards,

 

 

0 项奖励
回复

957 次查看
DanielRuvalcaba
NXP TechSupport
NXP TechSupport

Hi,

If you are using different peripherals for both boards, and you want to use the same project, I believe one way to achieve this is to use macros to define what sections of code must be compiled or not. With this method you can have the code for both boards in the same project without interfering each other, you just need to define what board you will use, i.e. board A or board B.

This method is very common in the SDK examples. Please take a look to the following code example.

DanielRuvalcaba_0-1701366032979.png

 

I hope this helps,

Daniel.

0 项奖励
回复