So, I was looking at the sdk branch of the mystorm repository, and was playing around with platformio. Seeing the issues with integration between the ice40 side and the stm32f side, I figured I'd try and work on that a bit.
There are a few ways to do this. All of them, so far as I know, require a extra_script be added. I setup the cleanest way to include the file (using the
.incbin directive provided by GAS in an assembly file),
however, in the end it's one of the less clean ways to do it due to having to remove the targets for the other side and the object file.
Alternatively, if we use bin2c or bin2s, or something similar reimplemented in python for portibility, we can just plop/update the file in the source directory, which will cause a recompile because it detected that the file changed, unlike my workaround for the 'cleaner' method because it didn't actually change any source files.
You'll want to add a line:
extra_script = mystorm.py
platformio.ini in the
[env:icestorm] section, and remove
,bitmap.o from the end of the build_flags line in the
The current contents of my
# OLD CODE, SEE LATER POST
# This is licenced under the WTFPL, placed into the Public Domain, whatever.
# Just trying to avoid those licencing issues for you.
def bitstream_built(source, target, env):
print "bitstream built, touching integration file."
basedir = env['PROJECTPIOENVS_DIR'] + "/nucleo_l476rg"
os.remove(basedir + "/src/bitstream.o")
os.remove(basedir + "/firmware.bin")
os.remove(basedir + "/firmware.elf")
Long story short, whenever the new bitstream (bitmap?) is built, it removes the final target for the nucleo_l476rg as well as the object file that has the bitstream. The assembly file the object file is built from looks like:
;@ This is licenced under the WTFPL, placed into the Public Domain, whatever.
;@ Just trying to avoid those licencing issues for you.
bitstream: .incbin "../.pioenvs/icestorm/hardware.bin"
bitstream_size: .int 1b - bitstream
And finally, just a few small changes to main.cpp, reproduced here in the form of a diff: https://hastebin.com/fadokuruka.diff
Also, go ahead and delete the
bitmap.o files, as well as the
The results? Any time that you make a change to the verilog that changes the resulting bitstream, it
deletes a few parts of the stm32f side and rebuilds it to have the new bitstream included in it.
Unfortunately, you can probably also see what I mean by 'less clean'. I'll look into a bin2c/bin2s/bin2o alike solution as well, but I thought I'd share what I currently had.
I will note that this doesn't handle uploading, which, iirc, was another mentioned issue. Just need to add a bit to the mystorm.py to get a custom uploader going, though, afaict.