Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ULX3S: Make spiflash optionally accessible from the SoC, and bootable #155

Merged
merged 1 commit into from
Jan 24, 2021

Conversation

blakesmith
Copy link
Contributor

A follow on from: #148. I wanted to be able to use the onboard flash of the ULX3S as a boot target. This PR adds a new --with-spiflash flag that will add the SPI master to the SoC, and lift it into the memory map.

The easiest way to define the FLASH_BOOT_ADDRESS pre-processor definition in the bios was to just do an soc.add_constant call. I couldn't find any other board examples defining FLASH_BOOT_ADDRESS, so if there's a better way to do this (or a cleaner pattern), please let me know!

Because this commit removed SPI flashing functionality from the bios, I built and tested a combined bitstream by using a modified version of @gregdavill's combine script from the OrangeCrab to build a combined ECP5 bitstream and firmware image (thanks Greg!), which I was able to verify on my board.

Thanks!

@enjoy-digital
Copy link
Member

Thanks @blakesmith for the detailed PR and describing the reasoning behind it. This looks good, happy to merge it. I'll probably also apply this to the other boards with SPI Flash in the future.

@enjoy-digital enjoy-digital merged commit 45f538b into litex-hub:master Jan 24, 2021
@blakesmith
Copy link
Contributor Author

Thanks @enjoy-digital! Let me know if you want any help with any of the other boards. I don't have any other boards besides the ULX3S (not many others I could find that are still for sale!), but I'd be happy to help in any way I can, just let me know!

@gregdavill
Copy link
Contributor

It will probably be worth refactoring that combine script into a small LiteX utility at some point.

@blakesmith
Copy link
Contributor Author

blakesmith commented Jan 24, 2021

@gregdavill I can take a crack at refactoring your combine.py script into something parameterized with command line arguments (was going to do that anyways), if you'd be willing to review. What interface do you think would be best to read in the flash_regions?

JSON file with a flash region map

Something like (sadly JSON does not support hexadecimal integers):

{
  "flash_regions": [
    {
      "name": "bitstream",
      "file": "/some/file/path/bitsream.bit",
      "address": "0x80000000"
    },
    {
      "name": "firmware",
      "file": "/some/file/path/firmware.bin",
      "address": "0x80008000"
    }
  ]
}

Then:

$ flash_bitstream_combine.py --flash_regions regions.json -o combined.bit

Vararg argparse parameters

Something like:

$ flash_bitstream_combine.py --flash_region "bitstream: 0x80000000, /some/file/path/bitstream.bit", --flash_region "firmware: 0x80008000, /some/file/path/firmware.bin"  -o combined.bit

There's probably a better way to do this with python's argparse, but I'd have to dig in a bit more to see what's most natural.

I kind of like the JSON approach better, but what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants