Hello,
I can successfully control ports of GPIO1 and GPIO5 from the Cortex-M7 by using freertos-sdk-2.10.0-fsimx8mp-V2022.07.1 SDK. Basically, the code is the same as in the led_output example of the SDK. However, it does not work for ports from GPIO2 (didn't try GPIO3 and GPIO4 yet). I've selected pads SD_B_WP and SD_B_CD, because their signals are available on pins of the J11 connector of the evaluation carrier board, so I can test the result.
First, I've disabled SD_B in the Linux device tree (Linux is running in parallel on the A53 cores):
#undef CONFIG_PICOCOREMX8MP_SD_B
#undef CONFIG_PICOCOREMX8MP_SD_B_CD
#undef CONFIG_PICOCOREMX8MP_SD_B_WP
The code for the M7 looks like this:
IOMUXC_SetPinMux(IOMUXC_SD2_CD_B_GPIO2_IO12, 0U);
GPIO2->GDIR = (1ul << 12);
GPIO2->DR = (1ul << 12);
This code should set the regarding pin to high, but nothing happens. The same code works fine for ports from GPIO1 and GPIO5. Interestingly, even after configuring the port as "output", the value of GPIO2->GDIR remains '0' when I read it out after the code above has been executed. For GPIO1 and GPIO5, the value reflects what I have written to the register.
Maybe I missed something fundamental, but currently I have no idea what is wrong.