Custom platform not cloning

[Fri Oct 20 11:48:34 2017] Processing pro8MHzatmega328 (platform: https://github.com/jhoogeboom/platform-atmelavr.git; lib_deps: https://github.com/jhoogeboom/radiohead.git; upload_port: /dev/tty.usbserial-A901M053; board: pro8MHzatmega328; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------
PlatformManager: Installing platform-atmelavr
git version 2.14.2
Cloning into '/Users/jorishoogeboom/.platformio/platforms/_tmp_installing-idY6RF-package'...
remote: Counting objects: 215, done.
remote: Compressing objects: 100% (136/136), done.
remote: Total 215 (delta 136), reused 108 (delta 67), pack-reused 0
Receiving objects: 100% (215/215), 48.63 KiB | 465.00 KiB/s, done.
Resolving deltas: 100% (136/136), done.
Submodule 'examples/arduino-external-libs/lib/OneWire' (https://github.com/PaulStoffregen/OneWire.git) registered for path 'examples/arduino-external-libs/lib/OneWire'
Cloning into '/Users/jorishoogeboom/.platformio/platforms/_tmp_installing-idY6RF-package/examples/arduino-external-libs/lib/OneWire'...
remote: Counting objects: 121, done.
remote: Total 121 (delta 0), reused 0 (delta 0), pack-reused 121
Receiving objects: 100% (121/121), 42.50 KiB | 414.00 KiB/s, done.
Resolving deltas: 100% (57/57), done.
Submodule path 'examples/arduino-external-libs/lib/OneWire': checked out 'b1ef6b994fe005aec9e6b23e05010ce88a93fac3'
Error: Could not load broken JSON: /Users/jorishoogeboom/.platformio/platforms/_tmp_installing-idY6RF-package/platform.json
The terminal process terminated with exit code: 1

It’s cloning into a weird tmp folder that does not seem to exist, any idea @ivankravets ? I tried a reinstall and deleting ~/.platformio , but it persists.

You broke platform.json. Please validate it and remove trailing commas.

thanks, thats absolutely right! running into a new error:

IndexError: list index out of range:
File "/Users/jorishoogeboom/.platformio/penv/lib/python2.7/site-packages/platformio/builder/main.py", line 156:
env.SConscript("$BUILD_SCRIPT")
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
exec _file_ in call_stack[-1].globals
File "/Users/jorishoogeboom/.platformio/platforms/atmelavr@src-07cf3bd7e1cc70914a8c6f09a0f5d54d/builder/main.py", line 218:
target_elf = env.BuildProgram()
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/Users/jorishoogeboom/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 60:
env.BuildFrameworks(env.get("PIOFRAMEWORK"))
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
return self.method(*nargs, **kwargs)
File "/Users/jorishoogeboom/.platformio/penv/lib/python2.7/site-packages/platformio/builder/tools/platformio.py", line 261:
SConscript(env.GetFrameworkScript(f))
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 604:
return method(*args, **kw)
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/Users/jorishoogeboom/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 250:
exec _file_ in call_stack[-1].globals
File "/Users/jorishoogeboom/.platformio/platforms/atmelavr@src-07cf3bd7e1cc70914a8c6f09a0f5d54d/builder/frameworks/arduino-gateway.py", line 37:
ARDUINO_USBDEFINES = [("ARDUINO", int(FRAMEWORK_VERSION.split(".")[1]))]

I’m creating a duplicate arduino-framework to make some adjustments, so have created a /build/arduino-gateway.py with the right names

FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoavr-gateway")
FRAMEWORK_VERSION = platform.get_package_version("framework-arduinoavr-gateway")

and added everything for the framework in the platform:

"frameworks": {
		"arduino": {
			"package": "framework-arduinoavr",
			"script": "builder/frameworks/arduino.py"
		},
		"simba": {
			"package": "framework-simba",
			"script": "builder/frameworks/simba.py"
		},
		"arduino-gateway": {
			"package": "framework-arduinoavr-gateway",
			"script": "builder/frameworks/arduino-gateway.py"
		}
	},
	"packages": {
		"toolchain-atmelavr": {
			"type": "toolchain",
			"version": "~1.40902.0"
		},
		"framework-arduinoavr": {
			"type": "framework",
			"optional": true,
			"version": "~1.10619.0"
		},
		"framework-arduinoavr-gateway": {
			"type": "framework",
			"optional": true,
			"version": "https://github.com/jhoogeboom/framework-arduino-gateway.git"
		},

Two arduino frameworks can’t exist alongside each other? it’s out of range.

hmmm so this error already appears with just one adjustment, if I fork your framework-arduinoavr and point the package to the fork:

"framework-arduinoavr": {
			"type": "framework",
			"optional": true,
			"version": "https://github.com/jhoogeboom/framework-arduino.git"
},

That’s supposed to work right? This is like the smallest change I can do and that’s failing. @ivankravets

1 Like

Ok I found out, when placing a git to replace the framework it no longer receives a FRAMEWORK_VERSION and therefore the build script chokes up. What is the canonical way to do this? Earlier you gave this example, but that’s not compatible with the arduino.py script: https://github.com/platformio/platform-espressif32/blob/feature/stage/platform.json#L48