All the code dealing with the peripherals will need to be changed/adapted to address what's bolted to the core.
Going between Cortex-Mx parts will be a matter of recompilation, and linking of appropriate libraries.
Assembler code will need to change based on the instruction set implemented. The direction you suggest should be fine, the issue would be that CM0 is a smaller subset of what the CM3, CM4, etc support.
Expect to have to do some porting work.
Expect to have to go over the pins and ensure the plumbing to the peripherals used.
Code migration with HAL isn't unduly painful
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..