Running Badge Software in Renode
Xtensa is an Uncommon Architecture
- Audio DSPs
- Possibly Intel?
- NXP
Extensive use of Boot ROM
Extensive use of Boot ROM
$ esptool.py dump_mem \
0x3ff90000 \
65536 \
irom.bin
Add a serial port
namespace Antmicro.Renode.Peripherals.UART {
public class ESP32_UART : UARTBase, IDoubleWordPeripheral,
IKnownSize {
private readonly DoubleWordRegisterCollection registers;
public ESP32_UART(Machine machine) : base(machine) {
registers = new DoubleWordRegisterCollection(this,
new Dictionary<long, DoubleWordRegister> {
{0x00, new DoubleWordRegister(this).WithValueField(0,8,
writeCallback: (_, v) => TransmitCharacter((byte)v))}
});
}
Add a serial port
{0x00, new DoubleWordRegister(this)
.WithValueField(0, 8,
writeCallback: (_, v) => TransmitCharacter((byte)v))}
Add a platform file
cpu1: CPU.Xtensa @ sysbus
cpuId: 1
cpuType: "esp32s3"
dram: Memory.MappedMemory @ sysbus 0x3FC88000
size: 0x78000
irom: Memory.MappedMemory @ sysbus 0x3FF00000
size: 0x20000
drom: Memory.MappedMemory @ sysbus 0x40000000
size: 0x60000
iram: Memory.MappedMemory @ sysbus 0x40370000
size: 0x70000
uart0: UART.ESP32_UART @ sysbus 0x60000000
SVD Files Are Your Friend
Load SVD file
sysbus:
init:
ApplySVD @esp32s3.svd
Load SVD file
sysbus: Read from an unimplemented register SYSTEM:SYSCLK_CONF
(0x600C0060), returning a value from SVD: 0x1. (3)
sysbus: Read from an unimplemented register SYSTEM:PERIP_CLK_EN0
(0x600C0018), returning a value from SVD: 0xF9C1E06F.
sysbus: Write of value 0xF9C1E06F to an unimplemented register
SYSTEM:PERIP_CLK_EN0 (0x600C0018) generated from SVD.
sysbus: Read from an unimplemented register SYSTEM:PERIP_RST_EN0
(0x600C0020), returning a value from SVD: 0x0.
sysbus: Write of value 0x0 to an unimplemented register SYSTEM:PERIP_RST_EN0
0x600C0020) generated from SVD.
sysbus: Read from an unimplemented register SYSTEM:PERIP_RST_EN0
(0x600C0020), returning a value from SVD: 0x0.
sysbus: Write of value 0x4 to an unimplemented register SYSTEM:PERIP_RST_EN0 (0x600C0020) generated from SVD.
Add Peripherals
- See what's failing
- Implement peripheral
- Repeat
Slowly Advance
Debugging with GDB
Logging Function Calls
cpu1: Entering function image_load at 0x403CE7D4
cpu1: Entering function process_segments (entry) at 0x403CE474
cpu1: Entering function process_segments at 0x403CE477
cpu1: Entering function process_segments at 0x403CE4AF
cpu1: Entering function process_segments at 0x403CE4B5
cpu1: Entering function process_segments at 0x403CE74D
cpu1: Entering function process_segments at 0x403CE4F4
cpu1: Entering function image_load at 0x403CE7E4
cpu1: Entering function image_load at 0x403CE7EB
cpu1: Entering function image_load at 0x403CE7EF
cpu1: CPU abort [PC=0x403CE7F2]: reading from external register not yet supported.
What's Left?
- SPI Controller
- Interrupt Controller
- I2C Controller
- Touch Controller
- Display
Displays
- Implement
ISpiDevice
- Subclass AutoRepaintingVideo
- Implement
Repaint()
Touch Controller
- Possibly interact with the Display controller
- Implement
II2CPeripheral
Audio is Hard
- Existing I2S peripherals just pattern-match audio