How to use Multiple board in single project

Hi I am new to PlatformIO IDE and using it for ESP32 IOT device. I like to understand if there are ways for me to connect two boards simultaneously and build with same project source with two different compile option and send respective build binaries to device connected on different COM port. I assume there is a way but I am new to it

Context: I have two identical ESP32 devices and I want to use one device to transmit the data and other device to receive the data. I wonder in Platform.ini etc I can build two target binary and flash one to device connected to COMx port and other binary to device connected to COMy port

Generally what is the best way to use the common source code and build & flash multiple binary to different target device. Should I do multiple compile etc by switching default_envs and recompiling


Create two environments with their upload_port and monitor_port being set their respective board’s COM port.