Possibility to add an additional code generator?

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

Possibility to add an additional code generator?

Jump to solution
1,918 Views
The0
Contributor I

Hi 

I was wondering whether it is possible to generate additional .c/.h files with the MCUXpresso Config Tool?

So what I have in mind, the MCUXpresso Config Tool already generates very nice pin_mux.h header files including all the symbols for PORTs and GPIOs. E.g. for the GPIO where my red LED is connected to:

#define BOARD_INITPINS_LED_RED_GPIO GPIO0  /*!<@brief GPIO peripheral base pointer */

With that I would like to generate an additional header file containing same symbols as in pin_mux.h, but with a typecast:

#define LED_RED_PORT (GPIO::Port*)BOARD_INITPINS_LED_RED_GPIO

I fear MCUXpresso Config Tool isn't that flexible. But what do you think, are there any other good approaches/tools to generate such header files each time I run the code generator in MCUXpresso Config Tool?

Best,
THE0

 

 

 

0 Kudos
Reply
1 Solution
1,889 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @The0 

You’re right that the MCUXpresso Config Tool doesn’t have built-in flexibility to generate additional customized .c or .h files with the kind of modifications you’re describing, such as adding typecasts or additional symbols based on the ones in pin_mux.h. However, you can still achieve this by setting up a custom post-processing script that runs after the code generation.

After running the MCUXpresso Config Tool, use a script (Python, Bash, etc.) to read the generated pin_mux.h file, extract the relevant symbols, and create your additional header file (custom_pin_mux.h or similar).

BR

Hang

View solution in original post

0 Kudos
Reply
2 Replies
1,890 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @The0 

You’re right that the MCUXpresso Config Tool doesn’t have built-in flexibility to generate additional customized .c or .h files with the kind of modifications you’re describing, such as adding typecasts or additional symbols based on the ones in pin_mux.h. However, you can still achieve this by setting up a custom post-processing script that runs after the code generation.

After running the MCUXpresso Config Tool, use a script (Python, Bash, etc.) to read the generated pin_mux.h file, extract the relevant symbols, and create your additional header file (custom_pin_mux.h or similar).

BR

Hang

0 Kudos
Reply
1,882 Views
The0
Contributor I

Hi @Harry_Zhang 

Thank you very much for your feedback. I think the approach using a post-processing script should work well.

BR
The0

0 Kudos
Reply