Commit be25a29b authored by Alan Wood's avatar Alan Wood

Documentation corrections pt3

parent 2e2eb18f
......@@ -41,23 +41,23 @@ Inside the SDK repository (mystorm _SDK_ branch) you will find and SDK directory
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....
PlatformIO will check your 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 the build, and without you manually having to install any of the toolchains, automagically!! We mentioned 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 yit will upload and start it for you also
If you also have an STLink (or Chinese copy, or Discovery/Nucleo board) connected to the STlink header on myStorm SDK it will upload and start it for you also
Which will program myStorm, easy huh...
Which will program myStorm, isn't that easy...
## The Detail
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..
In truth it did not do an honest full build due to the assumption about single toolchains, I cheeted a little here (by including the binary bitimage object). 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 :
What platformio will do when you run it with :
```
platformio run
```
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.
is build for each environment, in our case an IceStorm build and an Nucleo mbed 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.
......@@ -66,7 +66,7 @@ The way myStorm currently works is as follows:
* 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.
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 output 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.
```
extern uint8_t __binary_bitmap_bin_start
......@@ -84,14 +84,14 @@ However by running :
```
createbitmap.sh
```
it does this for us, if you look inside that you will see:
The script does this for us, if you look inside that 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. later we will integrate this into a pre-link script in python for platformio to make it easier.n After running this you may need to do a platformio run again depending if your updating Verilog and or C/C++.
This of course makes a whole load of silly assumptions about where platformio is installed among other things, hopefully you won't have to mess with it. later we will integrate this into a pre-link script in python for platformio to make it easier. After running this you may need to do a platformio run again depending if your updating Verilog and or C/C++.
Our earlier assumption was that you were also using an STLink to program myStorm (Thats how we currently develop the SDK), obviously this isn't true for everyone. So how do you upload your new minted binary without an STLink? There are two ways you can do this, the easiest is by using the built in DFU support of the STM32l476, to do this download and install [dfu-utils] (http://dfu-util.sourceforge.net/) and plug in a usb cable to myStorm (microusb) then issue the following:
Our earlier assumption was that you were also using an STLink to program myStorm (That is how we currently develop the SDK here), obviously this isn't ideal for everyone. So how do you upload your new minted binary without an STLink? There are two ways you can do this, the easiest is by using the built in DFU support of the STM32l476; to do this download and install [dfu-utils] (http://dfu-util.sourceforge.net/) and plug in a usb cable to myStorm (microusb) then issue the following:
```
sudo dfu-util -a 0 -d 0483:df11 -s 0x8000000:leave -D .pioenvs/nucleo_l476rg/firmware.bin
......@@ -109,32 +109,33 @@ else look at :
lsusb
```
and you may also want to checl:
and you may also want to check:
```
dmesg
```
If you see usb enumeration failures you may need to contact us on the forum, we might be able to resolve the issue depending...
If you see usb enumeration failures you may need to contact us on the forum, we might be able to resolve the issue depending on the results...
Another alternative to dfu is [stm32flash](https://sourceforge.net/p/stm32flash/wiki/Home/) make sure to use the latest, I used head as the STM32476 is quite new and wasn't on some of the older dev_tables in the source. With this tool and a serial port (from say a Raspberry Pi) or a Usb-serial cable/adaptor you can then program using the Uart bootloader:
Another alternative to DFU is [stm32flash](https://sourceforge.net/p/stm32flash/wiki/Home/), make sure to use the latest, I used head as the STM32L476 is quite new and wasn't on some of the older dev_tables in the source. With this tool and a serial port (from say a Raspberry Pi) or a Usb-serial cable/adaptor you can then program using the Uart bootloader:
```
stm32flash -b 1500000 -w .pioenvs/nucleo_l476rg/firmware.bin -v -g 0x0 /dev/ttyUSB0
```
For both the DFU and Uart bootloading make sure you have the boot jumper set like this (it's a 2mm jumper but you can get away with a 0.1" one):
For both the DFU and Uart bootloading make sure you have the boot jumper set like this when reset or powered (it's a 2mm jumper but you can get away with a 0.1" one):
```
[:]:
boot
```
* nucleo_l476rg is the atrget we use as a cheet due to it's similarity to the hardcore3 STM476 we are using on myStorm. Eventually we will have our own but it requires quite a lot of work to get thaT DONE FOR THE DIFFERENT PLATFORMS LIKE MBED/STM etc..
* nucleo_l476rg is the existing target we use as a cheat due to it's similarity to the STM32L476 configuration we are using on myStorm (be careful as mem is actually lower on myStorm). Eventually we will have our own but it requires quite a lot of work to get that done for all the different platforms like MBED/STM etc..
Useful command:
A Useful command:
```
platformio run --target clean
```
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