I need to define my own interrupt handler. Cube not not generate the ISR as weak so everytime I regenerate the code with cube, I have to modify the code to hide the interrupt handler generated by cube.
Would it be possible to define them as weakß
If I remember correctly, no. There are only two definitions allowed, one "weak" and one none-weak (i.e. without the weak attribute).
And the weak definition of interrupt handlers usually comes from the startup code.
That would make two "weak" definitions, confusing the linker.
I think you need to use a development method that doesn't require CubeMX to constantly update your code. Have Cube generate into a sandbox project if you must use this method, and then merge the new code into your development branch so you don't constant break your code, or have Cube inadvertently nuke it by accident. A lot of people have lost critical project code by expecting CubeMX to tread lightly, or recognize users intentions.
Doesn't MX create stubs for the interrupts in the <processor>_it.c file? Those then call HAL drivers or user interrupt handlers which are both defined with the weak keyword.
Or am I mistaken?
CubeMX as a similar process for freertos: task entry function can be defined as weak default or external.
Idea behind this is to have a similar process for interrupt handler, In some situation there is no stub (hardfaulthandler...) and in this situation we need to modify the startup file, or we may not want to use the stubs and HAL drivers defined as weak and managed directly interrupts.
Goal is to have a clean separation between code generated by cube and application specific code and like this avoid to mess up project when regenerating code with cubeMX.
From my side I solved this by relocating interrupt in RAM and remapping to my own specific interrupt handler (only the ones requiring specific management).
Retrieving data ...