Can't get programs compiled with PlatformIO to run on ESP8266 ESP-07 board

I’ve just started using PlatformIO to program an ESP-07 board. I have previously programmed it using the Arduino IDE without any problems. I can not get even simple programs to execute using PlatformIO. I’m sure it’s something simple I’m doing wrong, but I can’t seem to track down the problem.

Here’s my code:

#include <Arduino.h>
void setup(void) {
Serial.begin(115200);
Serial.println(“Testing Serial”);
}
void loop(void) {
Serial.print(“.”);
delay(500);
}

Pretty simple. When I compile and upload from the Arduino IDE, it works as expected and I see a series of … displayed in the serial monitor. I have the board “Generic ESP8266 module” selected.

I now switch to VSCode and PlatformIO. If I just click on Monitor, I get the expected output …, so I know the serial monitor is working OK. Now I try to Build and Upload the exact same code. I don’t get any errors and it appears to upload OK, but the Monitor just shows some garbage like the following (r␘␂␀l��r�␀�#␂�n�␄��␌␘�␌␜��␜p�<���␀�8␂��ǒ��␜p␌␘␌�nn�␂�;�nĒ��␌) then nothing.

I closed VSCode and switch back to Arduino IDE and use the serial monitor there and get the same couple of lines of garbage then nothing more.

My platformio.ini consists of the following:
[env:esp07]
platform = espressif8266
board = esp07
framework = arduino
monitor_speed = 115200

Anyone have any ideas?

Update: I found that if I do an “Upload and Monitor” I was able to capture a new error message…
… copied from terminal near end of firmware upload
Writing at 0x00030000… (100 %)
Wrote 269344 bytes (197728 compressed) at 0x00000000 in 17.6 seconds (effective 122.3 kbit/s)…
Hash of data verified.

Leaving…
Soft resetting…
============================================================================ [SUCCESS] Took 20.01 seconds ============================================================================
— Terminal on /dev/ttyUSB0 | 115200 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
flash read err, ets_unpack_flash_code
**ets_main.c Fatal exception (28): **
epc1=0x4000228b, epc2=0x00000000, epc3=0x00000000, excvaddr=0x000000b5, depc=0x00000000
Fatal exception (28):

Please provide a screenshot of the Arduino IDE → Tools menu with the settings that work for your ESP-07. Likely you’re just not telling PlatformIO the right flash mode or another setting that is documented here.

What you’re seeing now is the bootloader hanging up (at 74480 baud).

Thank you for pointing me to the page with the configuration info for the ESP8266. This was the info that was missing for me.
I added the line:
board_build.flash_mode = dout
to the platformio.ini file and now everything is working

Thanks for your help

FYI this was also the correct solution to fix the same problem with my Sonoff switch