Skip to main content
RMaia
Associate II
April 22, 2021
Solved

F401 CubeIDE auto generated startup file vector table, missing some handlers?

  • April 22, 2021
  • 4 replies
  • 4848 views

I've been developing my own peripheral drivers as a learning exercise, and upon writing the USART drivers, I came to an interesting problem. The interrupts were not being handled at all! Instead of calling the ISR routine, I was getting UsageFault errors...

Upon closer inspection of the startup file (auto generated by CubeIDE), it didn't have any USART handler symbols at all. Just 0's and marked as reserved.

I attach a screenshot of part of the vector table section of the startup_stm32f401ccux.s file:0693W00000AMFVmQAP.pngAccording to the RM for the F401xC chips (RM0368), for example, right after the SPI2 handler, should come the USART1 and USART2 handlers, not the "reserved" 0's...

I added these handlers myself to the vector table (at the appropriate places according to the vector table in section 10.2 of the RM) and now the driver code runs smoothly as it should, with the interrupts being handled properly...

Maybe it's a bug in the auto-generation of these files?

This topic has been closed for replies.
Best answer by RMaia

Hi!

Yes, it indeed looks like to be a very similar problem. As the person that posted on that linked, I also noticed that the startup file with the missing handlers is only generated when creating an "Empty project". If you go through the MX interface to generate the initial HAL related files and code, then the proper startup file is generated.

It's a bit annoying but easy to workaround, I just copy the "proper" startup file from one project to another after creation.

4 replies

Vangelis Fortounas
Associate II
April 22, 2021

it is probably a bug.

i reproduced it. Inside the repository the startup file is ok

Pavel A.
April 23, 2021

Does the header comment of the .s file mention the model?

Amel NASRI
ST Technical Moderator
April 27, 2021

Hi @RMaia​ ,

This seems to be a similar issue as the one reported here.

This limitation is tracked internally in order to provide a fix.

Sorry for such inconvenience.

-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
RMaia
RMaiaAuthorBest answer
Associate II
May 20, 2021

Hi!

Yes, it indeed looks like to be a very similar problem. As the person that posted on that linked, I also noticed that the startup file with the missing handlers is only generated when creating an "Empty project". If you go through the MX interface to generate the initial HAL related files and code, then the proper startup file is generated.

It's a bit annoying but easy to workaround, I just copy the "proper" startup file from one project to another after creation.

mattias norlander
ST Employee
June 9, 2021

Confirmed bug in Empty project startup file template. Let's see if we can address in the next release.

Internal ticket reference: 108658.

Imen Ezzine
ST Employee
July 2, 2021

Hi RMaia,

Indeed the USART handlers (interrupts) were missing in the SVD file declaration.

I am sharing with our latest SVD for stm32F401 that should be integrated in upcoming release for CubeIDE.

All you need is to replace old file with new one under IDE path.

Don't hesitate if you have more feedbacks to share!

Regards,

-Imen