Commit aa57c680 authored by Alan Wood's avatar Alan Wood

Documentation added the detail

parent 87aadcbb
......@@ -35,18 +35,58 @@ One day soon we are hoping that the develpment tools we need for myStorm SDK are
Inside the SDK repository (mystorm SDK branch) you will find and SDK directory (we assume you have this locally now), in this you will see a platforio.ini file, we won't bore you with how PlatformIO works and uses the ini file but you might want to take a peek (and check their documentation in your own time) you will see to sections. They call them environments but we are using them like targets of sorts. There is a section focused on building the FPGA side of the project (lattice_Ice40) and a section focused on the STM32 build. On the command line inside the SDK directory issue :
```
platformio run
platformio run -e nucleo_l476rg -t upload
```
PlatformIO will check you ini file and work out what is needed to build this project and go off and download all the packages it needs to do so, followed by actually doing so!! without you manually having to install any of the toolchains automagically!! We mentioned we we were lazy and wanted to do the minimum docs didn't we....
If you also have an STLink (or Chinese copy, or discovery/nucleo board) connected to the STlink header on myStorm SDK you can then just issue:
If you also have an STLink (or Chinese copy, or discovery/nucleo board) connected to the STlink header on myStorm SDK yit will upload and start it for you also
Which will program myStorm, easy huh...
## Gah! The harder bits and small print
In truth it did not do an honest full build due to the assumption about single toolchains, I cheeted a little here. Also if you don't have an STLINK connected it won't upload so let me break some of these exceptions off and handle them..
What platformio will do when you run it :
```
platformio run -e nucleo_l476rg -t upload
platformio run
```
Which will program myStorm, easy huh...
is build for each environment, in our case an Ice lattice build and an STM32 arm build. If you peak into your .pioenvs directory you will see the results of this process (you may have to dig down a little). However right now platformio doesn't understand how we have to structure the two builds with relation to each other, as we need them connected, let me explain.
The way myStorm currently works is as follows:
*1. Build the FPGA target with IceStorm from Verilog/pcf sources, using Yosys and then Arachnepnr to create a bitimage for the ice40.
*2. Convert the bitimage to an objectfile with the correct symbols
*3. Compile the stm32 source code c/c++ using Arm-eabi tools
*4 Link it all in and create the bin/hex etc..
*5 Upload and enjoy...
If you look at the c/cpp code we have an array value (normally RO) starting at _binary_bitmap_bin_start and ending at _binary_bitmap_bin_end see the code excerpt below where we use this to program the bit file with ms.ice_prog(&_binary_bitmap_bin_start, len). The clever build step is the conversion of the bitimage poutput from icestorm into a suitable object file for linking with the arm eabi toochain. This is the bit that isn't done automagically for us (yet) with platformio run.
''' c
extern uint8_t __binary_bitmap_bin_start
extern uint8_t __binary_bitmap_bin_end
...
...
//Lets get the bit image size
uint32_t len = &_binary_bitmap_bin_end - &_binary_bitmap_bin_start;
//Initialise anfd program Ice40
ms.ice_prog(&_binary_bitmap_bin_start, len);
'''
running
```
createbitmap.sh
```
does this for us, if you look inside you will see:
```
~/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/bin/objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata bitmap.bin bitmap.o
```
This of course makes a whole load of silly assumptions about where platformio is installed among other things, hope fully you won't have to mess with it.
```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment