platformio / platform-lattice_ice40

Lattice iCE40: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/lattice_ice40
Apache License 2.0
39 stars 15 forks source link

Cannot override uploader command #6

Closed kitlith closed 7 years ago

kitlith commented 7 years ago

There are various different methods of 'uploading' a bitstream, they depend on your setup.

For instance, with the mystorm board, which has a hardcore cpu as well, the bitstream is managed by the hardcore, with methods ranging from 'include this in the hardcore binary' to 'just send it out over serial and the hardcore will handle it'. I could also imagine a 'stick this on an SD card' upload or others.

At the moment, there is no way to override the uploader command from an extra_script, so if one really wants to change the behavior, they have to prepend PATH with a directory that contains a fake 'iceprog' script that actually does what they want.

Alternatively, there may be some SCons magic that I'm not familiar with and don't know how to find. (I'm not a SCons user, but I've been looking into it due to platformio.)

Jesus89 commented 7 years ago

A solution may be to allow override the programmer in an environment variable (Just editing the builder). Let's see what Ivan thinks.

ivankravets commented 7 years ago

@Jesus89 Could you implement uploading using a separate command? Please take a look how we do that for Atmel AVR development platform:

Here is example how user can override this "upload command"

Jesus89 commented 7 years ago

Added in the builder the env vars:

These variables can be modified from an extra_script.py:

Import('env')
env.Replace(UPLOADBINCMD='yourprogrammer $SOURCES')
Import('env')
env.Replace(UPLOADER='yourprogrammer', UPLOADFLAGS='yourflags')

It will be available in the release v1.2.0

ivankravets commented 7 years ago

@Jesus89 Thanks a lot for your contribution! Can I release 1.2.0 or you have other changes?

Jesus89 commented 7 years ago

I am doing more changes. Btw, I have included windows_x86 and windows_amd64 packages in each toolchain (icestorm, iverilog) but AppVeyor looks for windows package. Do I need to fix the manifest.json?

Jesus89 commented 7 years ago

Thanks @ivankravets. https://github.com/FPGAwars/toolchain-icestorm/pull/64