-
Notifications
You must be signed in to change notification settings - Fork 70
Hackaday Supercon 2019 badge
Hi! If you're sent here, you probably managed to get a prototype badge from Mike or someone else on the team, and (hopefully?) are willing to invest some time to make the badge more awesome, so everyone at the actual Supercon can have a good time playing around with it. Here, I'll jot down the intentions for the various aspects of the badge, the work that has already been done there, and the work that still needs to be done. If you're willing to pick up a certain item, or have a great idea for something else, don't hesitate to hit me up! I'm Sprite_tm on Freenode, or mail me at jeroen at spritesmods dot com.
Note that the items in the ToDo-list are more-or-less ordered by priority. If you are going to pick anything, I'd really prefer it if you take something from the top of the list - the badge is pretty useless if it has e.g. a fully functional 3D-renderer, but no way to write code to access the flash or develop programs.
The main 'thing' of the hardware this year is that it is not based around an existing SoC, but that we have a SoC that is specifically designed for the Hackaday Supercon. As building an ASIC for this is a bit pricey, the actual silicon on the badge is a FPGA, namely a Lattice ECP5. This FPGA gets configured to 'act as' the SoC of the badge; as a FPGA is fully user configurable, the neat bit is that end users will be able to tweak the hardware. There's also 16MiB of SPI RAM and 16MiB of flash on the board, fully usable by the FPGA.
As you may have already noted, the badge this year is a Game Boy like thing: there's a nice 480x320 screen, buttons that can be used as D-pad and a/b/select/start, and if you solder a small speaker to J3 (and as soon as the software supports it), it can also make sound. There's TVOut as well on an HDMI-port, and an USB-port for uploading stuff and debugging. As expansion, there's 2 upgraded Shitty Add On connectors, as well as an (unpopulated) PMOD port.
On the back of the thing, there's a power supply in the form of 2 AA batteries, as well as a cartridge connector. This cartridge connector has power supply pins, a bunch of free-to-use IO, and connections for a serial flash chip. This serial flash chip can contain files to be accessed from the main badge (e.g. for the Basic-interpreter), applications that run on the SoC (compiled C programs), or even entirely new FPGA configurations. This should allow for e.g. adding hardware support for the peripherals on a cartridge (think e.g. hardware readout and triggering logic for an ADC on a cartridge to use the badge as a 'scope) or even replacing the entire SoC (e.g. a cartridge with its own GameBoy slot that reconfigures the FPGA to work as the internals of a GameBoy).
- Proto2 board (HDMI, USB, power supply, LCD, LEDs) works, with a few small reworks.
- Final boards have arrived in Pasadena and seem to function well!
- Cartridge is designed and fabbed and in Pasadena as well.
When the FPGA boots up, it's an empty slate of gates. The first thing it does is to load up the configuration to 'morph itself' into whatever hardware the configuration prescribes. In the case of this badge, that configuration is a system-on-a-chip, in other words one or more microprocessor-cores with supporting peripherals.
The SoC designed here is still in progress, but here's the (partially tentative) main specs:
- 2X RiscV core (PicoRV32) with hardware-accelerated multiplier
- PIC16F84-style RISC core for fancy LED effects
- Both Z80 as well as 6502 processors, for the old farts
- Cached access to the 16MiB of PSRAM, so this can be transparently used as main memory
- Simple SPI peripheral for access to flash
- UART (on JTAG-connector near FPGA)
- USB1.1 device port (for mass storage / cdc-acm)
- Graphics hardware, for controlling the HDMI and LCD. Should be a tile-based, multi-layer thing, like SNES/GBA.
- 16MiB of memory is accessible as main memory through cache
- GPU: Basic 4-bit framebuffer in main memory
- GPU: Display over LCD and HDMI
- Psram: Run iface at 96MHz instead of 48MHz, for more speed
- RiscV: Add icache to speed up cpu
- RiscV: Add atomic instructions for multi-threading?
- PIC: default software (WiP - Voja) (re-integrate)
- SAO header: Add WS2801 support
- SAO header: Add I2C
- SAO header: Add 'DRM'.
- Z80: Find nice Verilog Z80 core and add
- 6502: Find nice Verilog core and add
- Z80/6502: Find a way to bankswitch main memory into 64K
- CPUs: Speed up bus infrastructure for moar speed
- Audio: Add support
- GPU: Amiga-like Copper, for cool hbl effects
- Audio: Add HDMI support
- GPU: 3d-renderer?
After the SoC is loaded from flash, the processors of the system can boot. They do this from a small 'bootrom' (actually pre-loaded cache memory) that has enough intelligence to load the so-called IPL, or Initial Program Loader, from flash. This IPL resides in the main flash, and is more of a MSDOS-like operating system: it contains USB, file system, and other low-level drivers that are callable by applications over a syscall interface. After startup, it will initialize the flash translation layer and FAT driver for the filesystem partitions on both the internal and (if available) external flash and will load the startup application from there. Any application can use the syscall interface to load another application (only one can be active at a time), or make use of e.g. the filesystem or send bytes over the CDC-ACM port.
The bootloader is capable of loading and executing the IPL, although better error reporting could be implemented. The IPL itself already contains the flash driver, flash translation layer and fat filesystem drivers. The IPL is capable of loading and executing elf-files and there is a syscall-ish interface between it and the application.
- Design a syscall interface (Done-ish but not frozen - Sprite_tm)
- Add application-level newlib libgloss that uses syscalls into IPL to handle things like FS and memory allocation (Done - Sprite_tm)
- Add capability to load/change apps (Done - Sprite_tm)
- Audio: Add SW support (mod/wav renderer?)
As the badge starts up, it shows a fancy intro screen and if it doesn't immediately boot to the app on the cartridge, shows a fancy menu to let the user know that he has options. At least some of the menu items are 'fun stuff' to keep everyone entertained while waiting between talks.
- IPL is pretty complete by now.
To make it easy (or at least: equally hard for everyone) to program the badge, the badge comes with a BASIC interpreter pre-installed (MyBasic variant). People can use this to exchange and run BASIC programs. To easily develop Basic programs, you can connect the badge to a laptop over USB and use a fancy html/js-based IDE to develop and debug your programs
There is a proof-of-concept which contains a MyBasic compiled for RiscV and an embedded environment similar to the badge
- Package MyBasic as an application
- Add hooks and commands for the hardware (graphics, leds, buttons)
- Figure out USB-interface for debugging/writing programs (CDC_Eth, combined with lwip as tcp/ip stack?)
- Write html5-based IDE