Modifying a ESP32 core library - HardwareSerial.cpp

Hi, I am trying to modify the HardwareSerial.cpp library file to update the TX1/TX2 default GPIO as per Andreas Spiess video (#152 Additional ESP32 Serial Channels in Arduino IDE (Quickie) - YouTube). It looks easy in Arduino IDE but I can only find the binary file HardwareSerial.cpp.o or .d in PIO. Can you please help. Btw, Andreas does say that the modification is temporary and overwritten on reboot : that’s fine with me.

If the project is only supposed to be compiled on your computer: Do that change locally in C:\Users\<user>\.platformio\packages\framework-arduinoespressif32\.

If you want it to be portable: Advanced scripting, replace_node_with_another.

@maxgerhardt : Thank you very much for the swift response. I have used method 1 and it worked fine for my test. It would have better if these parameters were modifiable from platform.ini but that’s ok.

Well checking on the video again, the highest comment is

At least in latest Arduino core for ESP32 you can define UART pins on begin() call, like Serial1.begin (115200, SERIAL_8N1, 4, 2), format is Serial1.begin (BaudRate, SerialMode, RX_pin, TX_pin).

So the problem should be entirely solvable in firmware code now with 0 modifications of framework code, right?