cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop STM32Cubemx from generating code for specific handlers

newdev
Associate II

I am using Keil MDK to setup a project for STM32 devices. STM32cubemx is integrated into Keil and can be used to generate a skeleton for the project (main.c, stm32XX.c, .h files and stm32CubeMX.ioc, etc).

This is helpful but some of the generated code contain duplicates of some handlers, like "void PendSV_Handler(void)". How do I stop STM32CubeMX from generating these defines?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Syn_BE​ 

First, I apologize for my late reply.

If I did understand well the situation; you need that CubeMx stop generating the interrupt handlers, you mentioned.

If so, under System Core --> NVIC --> Code generation you will find the list of all the interrupt handlers. You uncheck those you don't need CubeMx to generate:

0693W00000WJS5eQAH.png 

Hope this is a good answer to your question. If yes, please select it as a best one else give me your feedback to be able to provide help.

Kind regards,

Semer.

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.

View solution in original post

6 REPLIES 6
newdev
Associate II

0693W00000Uol9pQAB.png0693W00000UolBVQAZ.png

Semer CHERNI
ST Employee

Hello @newdev​ 

First let me thank you for posting.

I trying to reproduce the same behavior you encountered but it works fine from my side.

To be able to push further the analysis could you please provide a minimal project which show the problem.

I'll be waiting for your feedback.

Thx.

Semer.

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.

Syn_BE
Associate III

I have the same problem here.

I use CubIDE 1.10.1 with integrated CubeMX 6.6.1 for STM32G474.

  • I use "my own" FreeRTOS, not the one of CubeMX (Middleware FreeRTOS is "disabled")
  • I use "generate as a pair of '.c/.h' files per peripheral"

As @newdev​ wrote:

CubeMX is generating handler functions (in file "stm32g4xx_it.c") for

  • PendSV_Handler
  • SVC_Handler
  • SysTick_Handler

which collide with the handlers of "my" RTOS.

How can I prevent the generation of these functions in CubeMX?

Best regards, Andy

Syn_BE
Associate III

Hello,

@Semer CHERNI​ do you have any news to this issue, or do you need anyhing from me to dive deeper into this subject? Just let me know.

Short remark: it seems that this issue has also popped up in the past...

https://community.st.com/s/question/0D50X0000BNunGxSQJ/bug-cubemx-generates-erroneous-svc-and-pendsv-handlers-with-freertos

Best regards, Andy

Hello @Syn_BE​ 

First, I apologize for my late reply.

If I did understand well the situation; you need that CubeMx stop generating the interrupt handlers, you mentioned.

If so, under System Core --> NVIC --> Code generation you will find the list of all the interrupt handlers. You uncheck those you don't need CubeMx to generate:

0693W00000WJS5eQAH.png 

Hope this is a good answer to your question. If yes, please select it as a best one else give me your feedback to be able to provide help.

Kind regards,

Semer.

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.

This solved the issue. Thanks!