STM32CubeIDE Generated code compiles but doesn't function in PIO

I’m trying to get STM32CubeIDE Generated code for a hid working in PIO.
I’m using a stm32F411CE chip, with the following clock config:

I copied the files that were missing in PIO from stm32CubeIDE.
the code compiles perfectly fine. but when I execute it doens’t get through the USBD_Init function.

Edit: I tried compiling thourgh cubeIDE with the PIO included tool chain. that result works fine.

The way in which this is done is extremely important, since putting files in lib/ may cause problems with linking to interrupt vectors (such as USB) when lib_archive = no is not set in the platformio.ini.

Can you upload the whole project?

Sure. I pushed it to Github: GitHub - NoPlanNomad/stm32f4_hid

adding lib_archive = no didn’t fix it so there is still something wrong

I don’t get it. Where are the interrupt handlers?

I would assume in the files included with platformio.

SysTick_Handler(), OTG_FS_IRQHandler() and OTG_FS_WKUP_IRQHandler() specifically are nowhere in sight in the firmware files.

STM32Cube should have generated some stm32_it.c file, no?

No. See

it must be part of the firmware source files you supply (or are auto-generated).

ah yea. didn’t copy those because i didn’t get an error. It works now.

The interrupt handlers are sneaky, if you don’t define them in your firmware they will just have the default handler in the interrupt vector tables and your firmware won’t do what you expect. It’s a silent error.