Binary (.bin) file for the B2 bootloader?


#1

Hello there.
So I’ve managed to solder together my very own B2 board. It’s been quite the challenge but I think I’ve got it right.
Now I suspect I need to flash the board with the bootloader. I have an arduino mega wired in with the programmer sketch loaded, all setup according to this: https://github.com/tinyfpga/TinyFPGA-B-Series/tree/master/programmer_arduino

I have installed the python program and have tried this:

tinyfpgab -d 2341:0042 -a 0 -p ~/Downloads/fw.mcs

mcs is probably an Intel HEX file right? I suspect I need a bin file to see if this board is working. Can I grab the binary from somewhere please?

I just hope everything has soldered in correctly! Trying to do BGA in a frying pan is a little tricky!

Cheers
B


#2

Hello oni,

In a few days I will hopefully be in a very similar situation. My plan was to first try to flash an existing hello world to the boot partition before trying to attempt to flash the bootloader.

For the flashing I plan to use https://www.flashrom.org/Flashrom (with a bus pirate) but they also support Arduino.


#3

Well, I’ve installed all the Lattice software on my windows box so if I understand correctly, I should be able to build the binary there and then move it over to my mac for flashing. It seems a long way to go for just the bootloader. I fear I’ll get to the end of the long slog only to find the BGA hasn’t flowed right :stuck_out_tongue:


#4

If you have a multimeter it would be a great idea to measure that the voltages are present/correct

image10

If you have a scope (checking that the clock is working) and if you have a logic analyzer or similar seeing activity on the SPI bus is a good sign that the chip is trying to do something.


#5

Thanks! It’s a good tip though I haven’t gotten my nice Saleae yet. I could probably use the multimeter to check these lines though, but I’ll be happier if I can at least get the bootloader on there. I am going to have to get a logic analyser at some point :confused:


#6

Any thoughts? Would really love to have the bin file. I’m right at the last bit of the tutorial now and keen to see if it’ll all come together! :slight_smile:


#7

Hi,

I am starting to wonder if you need Windows at all. Can you not build the bootloader from here?

Apparently not:

TinyFPGA-Bootloader/boards/TinyFPGA_B2$ make
make: *** No rule to make target ‘TinyFPGA_BX.rpt’, needed by ‘all’. Stop.


#8

It doesn’t look as if that version of the bootloader, built with icestorm, was ever finished for the B2 board. To get further, you would need to change the PROJ= line in the Makefile to

PROJ = TinyFPGA_B2

but then the code in TinyFPGA_B2.v is commented out.

If you uncomment it, you find that all the relevant verilog files have not been included so you need to change the line in the Makefile to say:

%.blif: %.v …/…/common/*.v

If you do that, it builds a bootloader. Whether it works or not, I don’t know.

Also, I think you need to build a multiboot binary for the warmboot feature to work, so you would need to change the Makefile to more like the BX version.

I don’t have a B2 board, but I am looking into doing similar things for my BX board.

Another way to get the bootloader or multiboot loader is to read it from the flash memory of an existing BX device, if you have one.


#9

Hmmmm, surely the bootloader must already exist somewhere for the B2 board? This seems like retrofitting something that may not work. I’d rather not introduce another variable to the mix, especially as I’ve likely to have made a mistake in the soldering.
@lukevalenty could you drop the bin file for the B2 bootloader somewhere please? Next time, I’ll go for the BX model instead :confused:


#10

The project to build it with the Lattice tools exists:


#11

Ok, I’ll try that. I’ve just got the lattice tools for Windows in place. Hopefully that will do the business. Thanks!


#12

I think you need to create the warm boot (multi-boot) configuration as well. Without that, the bootloader will be able to read a bitstream and write it to the flash memory, but it won’t be able to boot to it.


#13

If the original bootloader is not present perhaps somebody who has a B2 board can read it from his device and share?


#14

@lukevalenty do you have the binaries?


#15

So in the end I setup the arduino as in the post, with the resistors to take the voltage down to 3.3v. I build the binary bootloader in icecube lattice, then got hold of the python program and ran it as follows:

tinyfpgab -d 2341:0042 -a 0 -p ~/Desktop/tinyfpga_bootloader/TinyFPGA_B_bitmap.bin

Sadly, all I get is:

TinyFPGA B-series Programmer CLI
--------------------------------
Using device id 2341:0042
Only one board with active bootloader, using it.
Programming /dev/cu.usbmodemFA141 with /Users/oni/Desktop/tinyfpga_bootloader/TinyFPGA_B_bitmap.bin
Bootloader not active
Bootloader not active
Bootloader not active

I suspect this means that my TinyFPGA didn’t really work in the end :confused: It might have been too much to put the whole thing together on a frying pan! :wink:


#16

Hi,

I think it would be better to use a standard spi programming solution to try flashing

Have a look here, I did not try myself yet (but soon will)


#19

The project is well documented here:

you might be right (in the way you are doing things)


#20

The code that gives that “Bootloader not active” message Is:

def is_bootloader_active(self):
    time.sleep(0.1)
    for i in range(6):
        self.wake()
        time.sleep(0.001)
        self.read(0, 16)
        time.sleep(0.001)
        self.wake()
        time.sleep(0.001)
        devid = self.read_id()
        expected_devid = '\x1f\x84\x01'
        if devid == expected_devid:
            return True
        time.sleep(0.05)
    return False

It is worth putting some diagnostics in it to see if you are getting sensible data back from the read of the first 16 bytes of data and to see what device id, if any, is being returned. You flash chip might have a different id.
Printing them both in hex would be a good idea.


#21

Hello there. Thanks for the feedback. I’ve been following the guide here:

There’s a very good chance that the board assembly didn’t work if I’m honest. I think the best best bet is to move on with the next stage in this project and come back to this at some point. Time to fire up the kicad! :slight_smile: