OpenSTLinux distribution does not provide the flash memory layout (flashlayout) files required to use a UART as a serial boot device.
Refer to Using_STM32Programmer_over_UART article to see how to modify a flashlayout file to use a UART as a serial boot device.
You can use this modified flashlayout as described in STM32CubeProgrammer article.
For example, the provided FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv file can be used on USB with the command:
STM32_Programmer_CLI -c port=usb1 -w FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv
By replacing tf-a-stm32mp157f-dk2-usb.stm32 to tf-a-stm32mp157f-dk2-uart.stm32 in this tsv file, the resulting file FlashLayout_sdcard_stm32mp157f-dk2-optee_uart.tsv can be used on UART port /dev/ttyACM1 with the command:
STM32_Programmer_CLI -c port=/dev/ttyACM1 -w FlashLayout_sdcard_stm32mp157f-dk2-optee_uart.tsv