Skip to main content
brandongmiche
Associate
July 21, 2023
Question

STM32CubeMX: Change Formatting of Generated Source Code

  • July 21, 2023
  • 1 reply
  • 1281 views

Hello,

Is it possible to change the format of the generated code from CubeMX? In other words, is it possible to configure the indentation and header comments that get generated from CubeMX, either with a template or some user option?

Thanks!

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    July 24, 2023

    Hello @brandongmiche 

    First let me thank you for posting.

    Unfortunately the generated code from CubeMX can't be changed.

    Otherwise, STM32CubeMX can generate a custom code based on a FreeMarker template file (.ftl
    extension) for any of the following MCU configuration information:
    • List of MCU peripherals used by the user configuration
    • List of parameters values for those peripherals
    • List of resources used by these peripherals: GPIO, DMA requests and interrupts

    I recommend you to check the UM1718 paragraph 6.3 Custom code generation for more details.

    Thx

    Souhaib

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.