Knee-Deep in the LED: Hackers Get Doom Running on Ikea Smart Bulb

Knee-Deep in the LED: Hackers Get Doom Running on Ikea Smart Bulb

A group of hackers has gotten Doom up and running on an unusual platform: an Ikea smart bulb. The group wrote up its project on Next-Hack and shared details of the implementation.

This group decided to get Doom running on a low-end platform and set specific rules for themselves in what would and would not be acceptable. The device must have reasonable computing power relative to Doom’s original requirements. The team references a 486-33, though I can tell you from personal experience you could play it with a modest viewing frustum on hardware as weak as an 80386SX-16. Only the microcontroller inside the chosen device could be used to run the game. Adding a small color display and additional flash memory to store files were both acceptable. The minimum goal was to play E1M1, otherwise known as the first level of “Knee-Deep in the Dead.”

The team originally planned to deploy an Ikea Trådefri lamp. While the modest 40MHz Cortex M4 was plenty powerful, the chip only had 32KB of RAM. This was deemed impossible. Then, some months later, Ikea updated with a new model. These new lamps featured an 80MHz Cortex-M33 and 108KB of RAM in total with 1MB of NAND flash. The team also attached an additional 8MB of NAND flash.

Development was handled on a comparatively powerful Cortex-M7. The STM chip they used, an STM32H743, features a memory-mapped QSPI (quad serial parallel interface) NAND flash chip, allowing the team to treat it as memory-mapped flash.

The team steps through the optimizations it made to get Doom running in under 108KB of RAM as opposed to the 160KB+ they estimate it requires by default. They saved a substantial amount of memory by converting data types — Doom used 32-bit integers in some cases, where only 8 or 16-bits were required. In several cases, they took data that was originally stored in RAM and moved it to NAND flash to free enough capacity to let the game run in the first place. They even optimized the memory buffer to save 5KB of RAM. One interesting thing their testing revealed: Performance, even on a smart bulb, is determined more by the speed of flash memory accesses than by the speed of the CPU.

But even after all of this, the team had a problem: Data transfer speeds on the STM32H743 were fast enough, but the EFR32MG21 they were working with inside the Ikea smart bulb didn’t support the same high-speed (relatively) interface. Their initial storage bandwidth was limited to 2.5MB/s until they overclocked the chip to 80MHz. That improved bandwidth up to 5MB/s. I’ll let them explain how they doubled it again:

The EFR32MG21 has three USARTs. One o tem is used for printing debug messages and downloading the WAD file to the external flash. We have two USART left… and the peripheral reflex system! With these two, we can synchronize the two USARTs (working in SPI mode) so that they read data at the same time, actually creating a double SPI (DSPI). Luckily, the QSPI memory also supports dual read, and in this way, we can reach 10MB/s!

The story goes on to describe how they kept the two SPIs synchronized and the additional work the team did to get audio working and play the game at Ultra Violence difficulty without running out of RAM. There are also step-by-step instructions for how to build the device. Overall performance and image quality are better than the GBA version. The group points out that the GBA’s 16.7MHz ARM7TDMI was only capable of 0.9 DMIPS/MHz, while the CM33 achieves ~1.5DMIPS/MHz and runs at 80MHz. The team isn’t done optimizing Doom for their diminutive platform and they plan to improve both performance and RAM usage in the coming days.

Continue reading

Review: The Oculus Quest 2 Could Be the Tipping Point for VR Mass Adoption
Review: The Oculus Quest 2 Could Be the Tipping Point for VR Mass Adoption

The Oculus Quest 2 is now available, and it's an improvement over the original in every way that matters. And yet, it's $100 less expensive than the last release. Having spent some time with the Quest 2, I believe we might look back on it as the headset that finally made VR accessible to mainstream consumers.

Asteroid Bennu Might Be Hollow and Doomed to Crumble
Asteroid Bennu Might Be Hollow and Doomed to Crumble

A new analysis from the University of Colorado Boulder’s OSIRIS-REx team suggests the Bennu is much less stable than expected. In fact, it could completely go to pieces in the coming eons.

What Does It Mean for the PC Market If Apple Makes the Fastest CPU?
What Does It Mean for the PC Market If Apple Makes the Fastest CPU?

Apple's M1 SoC could have a profound impact on the PC market. After 25 years, x86 may no longer be the highest-performing CPU architecture you can practically buy.

Microsoft: Pluton Chip Will Bring Xbox-Like Security to Windows PCs
Microsoft: Pluton Chip Will Bring Xbox-Like Security to Windows PCs

Intel, AMD, and Qualcomm are working to make Pluton part of their upcoming designs, which should make PCs more difficult to hack, but it also bakes Microsoft technology into your hardware.