cancel
Showing results for 
Search instead for 
Did you mean: 

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

RMaia
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

7 REPLIES 7

it is probably a bug.

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

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

Indeed, I looked through the repository and the sample files for the F401-Discovery board contain the startup file with all vectors populated.

Based on that and the vector table in RM0368 I completed the auto-generated file table, and it's attached here for reference (with extension changed to .cpp so the system allows upload...).

Amel NASRI
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.

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

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

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