How to switch the project in the IDE

Hello,
have 2 projects open in the IDE. Say Prj1 and Prj2.
first one i built and uploaded was Prj1.

How do i build and upload Prj2?

Hi @AZZ! The easiest way is to select any file from Prj2 in Tree View.

thats what i did. I opened the only cpp file i have in Prj2 and hit “build”. But the Prj1 was built and uploaded to the Uno…

Are you sure you don’t have any uno environment in Prj2?

what do you mean ?
// sorry too new to this IDE

Please provide here two platformio.ini files from both projects.

This is Prj2:

#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#

# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.

# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

[env:uno]
platform = atmelavr
framework = arduino
board = uno

and this is Prj1:

#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#

# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.

# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

[env:uno]
platform = atmelavr
framework = arduino
board = uno

one project has a blue vertical line in the Tree View, another doesn’t. Probably it means that one is “Active” and another is not.

i’m actually mistaken. The PRJ2 builds just fine. BUT it won’t upload.
Here is the short version of what is happening with PRJ1:


platformio run --target clean
[Fri Jul  1 22:17:25 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
--------------------------------------------------------------------------------
Removed .pioenvs/uno/src/main.o
Removed .pioenvs/uno/FrameworkArduino/CDC.o
Removed .pioenvs/uno/FrameworkArduino/HardwareSerial.o
Removed .pioenvs/uno/FrameworkArduino/HardwareSerial0.o
Removed .pioenvs/uno/FrameworkArduino/HardwareSerial1.o

Removed .pioenvs/uno/FrameworkArduino/HardwareSerial2.o
Removed .pioenvs/uno/FrameworkArduino/HardwareSerial3.o
Removed .pioenvs/uno/FrameworkArduino/IPAddress.o
Removed .pioenvs/uno/FrameworkArduino/PluggableUSB.o
Removed .pioenvs/uno/FrameworkArduino/Print.o

platformio run --target upload
avrdude: input file .pioenvs/uno/firmware.hex contains 2320 bytes
avrdude: reading on-chip flash data:
 
Reading | ################################################## | 100% 0.32s
 
avrdude: verifying ...
avrdude: 2320 bytes of flash verified

 
 
avrdude done.  Thank you.
========================= [SUCCESS] Took 5.30 seconds =========================
 

Now with Prj2:
I load the main.cpp from the Prj2 into the editor and select “clean” first:


[Fri Jul  1 22:21:05 2016] Processing uno (platform: atmelavr, board: uno, framework: arduino)
--------------------------------------------------------------------------------
scons: `.pioenvs/uno/firmware.hex' is up to date.
"avr-size" --mcu=atmega328p -C -d .pioenvs/uno/firmware.elf
AVR Memory Usage
----------------
Device: atmega328p

 
Program:    2672 bytes (8.2% Full)
(.text + .data + .bootloader)
 
Data:        222 bytes (10.8% Full)
(.data + .bss + .noinit)
 
 
========================= [SUCCESS] Took 1.03 seconds =========================

it appears that “.pioenvs/uno/firmware.hex” is up to date and as the result there is no upload.

another odd thing is.
on the bottom of the IDE next to the “PlatformIO:Clean” I see “File 0” and “Project 0”.
and it doesn’t matter what project do i click on in the Tree View the “Project 0” always “0”…

and to get the other project to build and upload in the IDE i had to :

  1. remove “project folder” from the “Tree view”
  2. reload the IDE

Based on the above , do i understand corrctly that IDE can only work with one project at a time ? As in “build/clean/upload” work correctly only with the first loaded project.

Just give different names to your environments:

#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#

# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.

# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

[env:Prj1]
platform = atmelavr
framework = arduino
board = uno

and

#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# http://docs.platformio.org/en/latest/projectconf.html
#

# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.

# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

[env:Prj2]
platform = atmelavr
framework = arduino
board = uno

hmm. and how would i do that in IDE? Right clicking on the top of the path with “Rename” doesn’t (literally) do anything. And the “Project 0” line on the bottom of the IDE doesn’t change .

and BTW, the renaming doesn’t help at all … I still can’t upload another project. Have to remove all projects and restart IDE to upload the project.

Hello.

I guess valeros ment to change the name of the environment and not the name of the File/Directory.

So klick on platformio.ini of Prj1 locate the line “[env:uno]” and change it to “[env:Prj1]”.
Then klick on platformio.ini of Prj2 locate the line “[env:uno]” and change it to “[env:Prj2]”.

Robert

PS:Nevertheless i don’t understand why this should help because i assume your projects are located in different directories (is that true?) and you did not set a common “envs_dir” in platformio.ini.
But anyway, please try this, valeros is the expert.

Robert
You are correct - 2 different directories on the same level. Ini files were changed as advised.
Still same problem.

I think it is either a bug or design limitation. Either way pretty odd .

Can anyone else reproduce?

don’t think so.
I’v no problems with many open projects.

for me (OS X) the horizontal bar shows the active project.

Yes. Horizontal is the active project. But it won’t upload. Returns success but doesn’t upload. …
Out of ideas…

Do you use the latest Atom text editor and PlatformIO IDE package?

See attached.
Atom is 1.8.0
IDE 1.3.0 | CLI 2.11.0

Bug #132 has been filled.
Guys already have a fix. Awesome job gents!

1 Like

same absolutely problem. created 3 projects, but platformio compiles and uploads only the latest… i renamed env in patformio.io restarted … doesnt help