Before I start having fun trying to work with your sketch thought I would add a few things that I am finding.
Shared memory really should be reserved to using SDRAM reserved memory otherwise you can get into trouble. Take a look at this thread: String sharing between M7 cores and M4 cores - Hardware / GIGA R1 - Arduino Forum. That gives you the general idea but not the only way.
I have been doing a bit of googling and these are a few things I found:
Best/easiest way to share data between cores in ST... - STMicroelectronics Community
Portenta H7 dual core shared memory - Portenta / Portenta H7 - Arduino Forum
that last post has a link to a lib that can also be used. Now to go play ![]()