VSC Can't open/locate upload port during "Upload"

What is the problem?

I am baffled novice. My Platform.ini file contains:
[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
default_envs = mega2560
include_dir = Marlin
upload_port = /dev/AMA0

but when I build it returns:

Configuring upload protocol...
AVAILABLE: wiring
CURRENT: upload_protocol = wiring
Looking for upload port...
Error: Please specify upload_port for environment or use global --upload-port option.
For some development platforms it can be a USB flash drive (i.e. /media//)
**** [upload] Explicit exit, status 1*

What did you already try to solve it?

No idea what else to try to resolve this error.

Have you tried running in safe mode?

Not applicable

Did running in safe mode solve the problem?

Not applicable

Complete Logs

Not applicable

WRITE HERE

Additional information about your setup

Uploaded correctly when Arduino Mega 2560 connected to PC USB Port connected by finding correct port automatically. No mention of upload_port needed in Platform.ini>

WRITE HERE

This doesn't appear to be an OctoPrint issue? If it is, could you explain it a bit more clearly what the problem is? It looks like upload_port is set to me, but it can't find whatever device you are targeting.

OK let me try and clarify and thanks for you very prompt response:
My Raspberry Pi is running the Octoprint OS connected by USB cable to an Arduino Mega 2560 running Marlin 2.0 firmware with a RAMPS 1.4 EFB to controlingl the printer.

All was working just fine with Pronterface connecting to a COM port form my Windows 10 desktop PC.

My aim is to have the Pi control the printer by use of VSC in conjunction with Marlin firmware. Does this help? It is, I appreciate, loosely related to Octoprint and must have been completed by other users.

Wait...let me see if I understand what you're trying to ask. Visual Studio Code (VSC) in conjunction with Octopriont and Marlin? First of all, VS Code is used to compile your Marlin firmware. It does not have anything to do with running the firmware or connecting to your printer. Second of all, Octoprint has absolutely nothing at all to do with compiling your Marlin firmware or uploading it to your Arduino. This is a Marlin question, not an Octoprint question. But your premise is all wrong.

My humble apologies. I guess, in my frustration and naivity I was clutching at straws and you are completely correct it was NOT a Octoprint issue.

I have resolved the issue now and VSC compiles and loads without error.

Most importantly I can now control the printer from within Octoprint. I am now able to troubleshoot my "Eaglemoss V3 printer" after its original control board burnt out.

As I mentioned in my original post I have replaced it with a Raspberry Pi 3, an Arduino Mega 2560 and a RAMPS 1.4 EFB.

Do you know any other members who have attempted this. The positioning of the Z-axis is an ongoing issue.

Thanks for you comments.