diff --git a/index.html b/index.html index 097c878..8dae164 100644 --- a/index.html +++ b/index.html @@ -2,610 +2,922 @@ - - + + - Renode: Easy CI for your Weird Hardware + Renode: Easy CI for your Weird Hardware - - - + + + - - + + -
-
-
-
-

Renode

-

I find it a useful tool. Maybe you will, too! -

-
-

About Me: I Do Weird Hardware

-
    -
  • Simmel: Contact Tracing with Audio
  • -
  • Chibitronics: Programming Stickers with Audio
  • -
  • Novena: Open Source Laptop
  • -
  • Senoko: Open Source Power Board for Novena
  • -
-
-
-

Hardware with Embedded Software

-
    -
  • Software needs to be written
  • -
  • Software needs to be tested
  • -
  • Software needs to be debugged
  • -
-
-
-

About Renode

-
    -
  • Whole-System Emulator
  • -
  • Supports concurrent emulation
  • -
  • Extensible with C# and Python
  • -
  • Windows, Mac, Linux
  • -
  • MIT Licensed
  • -
-
-
-

About This Talk

-
    -
  • Overview of Emulators
  • -
  • Oevrview of Weird Hardware
  • -
  • Cool things you can do
  • -
-
-
-

Who will find this interesting?

-
    -
  • Creators: Those making new boards or hardware
  • -
  • Integrators: Running CI on firmware files
  • -
  • Reverse Engineers: Understanding new hardware and firmware
  • -
-
-
-

Creators: Making New Things!

-
    -
  • Reusing an existing platform
  • -
  • Reusing an existing microcontroller
  • -
  • New microcontroller fron existing family
  • -
-
-
-

Integrators: Making Sure Nothing Broke!

-
    -
  • Hardware testing incompatible with cloud
  • -
      -
    • ...it sure is effective, though
    • -
    -
  • Hardware crunch makes it difficult to get hardware
  • -
  • Downloading software is much cheaper than shipping
  • -
  • Can run tests on every code push
  • -
-
-
-

Reverse Engineers: What Is This Blob Doing?

-
    -
  • Staring at code flow is enlightening, but time-consuming
  • -
  • What is it doing and how does it get there?
  • -
  • How can we make it do $x?
  • -
-
-
-
-
-

What is an Emulator?

- -
-
-

What is an Emulator?

- -
-
-

What is an Emulator?

- -
-
-

Whole-System Emulator

- - -
-
-

Whole-System Emulator

- - -
-
-

Transparent Emulator

-
    -
  • WSL2/Docker
  • -
  • qemu on Linux
  • -
  • Rosetta on Mac
  • -
-
-
-

Renode Is Many of These

-
    -
  • Console: Able to present an interactive environment
  • -
  • Transparent: Can run in CI via Robot commands
  • -
  • Debugger: Has a GDB server built in
  • -
-
-
+
+
+
+
+

Renode

+

I find it a useful tool. Maybe you will, too! +

+
+

About Me: I Do Weird Hardware

+
    +
  • Simmel: Contact Tracing with Audio
  • +
  • Chibitronics: Programming Stickers with Audio
  • +
  • Novena: Open Source Laptop
  • +
  • Senoko: Open Source Power Board for Novena
  • +
+
+
+

Hardware with Embedded Software

+
    +
  • Software needs to be written
  • +
  • Software needs to be tested
  • +
  • Software needs to be debugged
  • +
+
+
+

About Renode

+
    +
  • Whole-System Emulator
  • +
  • Supports concurrent emulation
  • +
  • Extensible with C# and Python
  • +
  • Windows, Mac, Linux
  • +
  • MIT Licensed
  • +
+
+
+

About This Talk

+
    +
  • Overview of Emulators
  • +
  • Oevrview of Weird Hardware
  • +
  • Cool things you can do
  • +
+
+
+

Who will find this interesting?

+
    +
  • Creators: Those making new boards or hardware
  • +
  • Integrators: Running CI on firmware files
  • +
  • Reverse Engineers: Understanding new hardware and firmware
  • +
+
+
+

Creators: Making New Things!

+
    +
  • Reusing an existing platform
  • +
  • Reusing an existing microcontroller
  • +
  • New microcontroller fron existing family
  • +
+
+
+

Integrators: Making Sure Nothing Broke!

+
    +
  • Hardware testing incompatible with cloud
  • +
      +
    • ...it sure is effective, though
    • +
    +
  • Hardware crunch makes it difficult to get hardware
  • +
  • Downloading software is much cheaper than shipping
  • +
  • Can run tests on every code push
  • +
+
+
+

Reverse Engineers: What Is This Blob Doing?

+
    +
  • Staring at code flow is enlightening, but time-consuming
  • +
  • What is it doing and how does it get there?
  • +
  • How can we make it do $x?
  • +
+
+
+
+
+

What is an Emulator?

+ +
+
+

What is an Emulator?

+ +
+
+

What is an Emulator?

+ +
+
+

Whole-System Emulator

+ + +
+
+

Whole-System Emulator

+ + +
+
+

Transparent Emulator

+
    +
  • WSL2/Docker
  • +
  • qemu on Linux
  • +
  • Rosetta on Mac
  • +
+
+
+

Renode Is Many of These

+
    +
  • Console: Able to present an interactive environment
  • +
  • Transparent: Can run in CI via Robot commands
  • +
  • Debugger: Has a GDB server built in
  • +
+
+
-
-
-

What is a Computer?

- -
-
-

What is a Computer?

-
    -
  • A system of devices
  • -
  • One or more CPU
  • -
  • One or more buses
  • -
  • One or more blocks of memory
  • -
  • Some I/O
  • -
-
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

What is a Computer?

- -
-
-

Defining a Computer in Renode

-

-						flash: Memory.MappedMemory @ sysbus 0x00000000
-							size: 0x00008000
+            
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+
    +
  • A system of devices
  • +
  • One or more CPU
  • +
  • One or more buses
  • +
  • One or more blocks of memory
  • +
  • Some I/O
  • +
+
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

What is a Computer?

+ +
+
+

Defining a Computer in Renode

+

+                        flash: Memory.MappedMemory @ sysbus 0x00000000
+                            size: 0x00008000
 
-						sram: Memory.MappedMemory @ sysbus 0x20000000
-							size: 0x00001000
-	
-						nvic: IRQControllers.NVIC @ sysbus 0xE000E000
-							IRQ -> cpu@0
+                        sram: Memory.MappedMemory @ sysbus 0x20000000
+                            size: 0x00001000
+    
+                        nvic: IRQControllers.NVIC @ sysbus 0xE000E000
+                            IRQ -> cpu@0
 
-						cpu: CPU.CortexM @ sysbus
-							nvic: nvic
-							cpuType: "cortex-m0+"
-							PerformanceInMips: 24
-					
-
-
+ cpu: CPU.CortexM @ sysbus + nvic: nvic + cpuType: "cortex-m0+" + PerformanceInMips: 24 +
+
+
-
-

That's Nice, but What About...

-
    -
  1. Loading firmware?
  2. -
  3. Adding peripherals?
  4. -
-
+
+

That's Nice, but What About...

+
    +
  1. Loading firmware?
  2. +
  3. Adding peripherals?
  4. +
+
-
-
-

What is "Firmware"?

-
Firmware is a series of instructions executed by the CPU in - order to accomplish a task
-
Firmware is Memory
-
-
-

Loading Firmware in Renode

-

-						sysbus LoadELF @firmware.elf
-					
-

-						sysbus LoadBinary @rom.bin 0x20000000
-					
-

-						sysbus LoadSymbolsFrom @rom.elf
-					
-
-
-

How does Renode Interact With $VENDOR_TOOL?

-
    -
  • Hopefully your vendor tool produces ELF files
  • -
  • At the end of the day, it's all bytes. Just use LoadBinary! -
  • -
-
-
-

What About Boot ROMs?

-
    -
  1. Initialize peripherals
  2. -
  3. Check for boot override
  4. -
  5. Check for low-power state
  6. -
  7. Load firmware into RAM
  8. -
  9. Validate firmware
  10. -
  11. Jump to loaded program
  12. -
-

-						sysbus.cpu VectorTableOffset 0x20000000
-						sysbus.cpu PC 0x20000c00
-					
-
-
-
-
-

What about New Peripherals?

-
-
-

It's All About Small Victories

-
    -
  • Serial ports are super rewarding
  • -
  • They're also usually simple!
  • -
  • They are easy to script
  • -
-
-
-

Reusing an Existing Port

-
-
-

Steps to Set Up a Serial Port

-
    -
  1. Enable peripheral
  2. -
  3. Set up clock
  4. -
  5. Mux GPIOs
  6. -
  7. Calculate baud rate
  8. -
  9. Write to UART TX register
  10. -
-
-
-

Steps to Set Up a Serial Port

- -
-
-

Steps to Set Up a Serial Port

-
    -
  • Interrupt Support
  • -
  • DMA
  • -
-
-
-

Example Serial Port

-

-						{(long)Registers.RxTx, new DoubleWordRegister(this)
-							.WithValueField(0, 8,
-								writeCallback: (_, value) => {
-									this.TransmitCharacter((byte)value);
-								},
-								valueProviderCallback: _ => {
-									if(!TryGetCharacter(out var character))
-									{
-										this.Log(LogLevel.Warning, "Empty Rx FIFO.");
-									}
-									return character;
-								})
-						},
-					
-
-
-

What about Missing Definitions?

-
    -
  • Most registers are unused
  • -
  • Most writes can be ignored
  • -
-
-
-

Advantages of Emulation

- -
-
-

Advantages of Emulation

- -
-
- -
+
+
+

What is "Firmware"?

+
Firmware is a series of instructions executed by the CPU in + order to accomplish a task
+
Firmware is Memory
+
+
+

Loading Firmware in Renode

+

+                        sysbus LoadELF @firmware.elf
+                    
+

+                        sysbus LoadBinary @rom.bin 0x20000000
+                    
+

+                        sysbus LoadSymbolsFrom @rom.elf
+                    
+
+
+

How does Renode Interact With $VENDOR_TOOL?

+
    +
  • Hopefully your vendor tool produces ELF files
  • +
  • At the end of the day, it's all bytes. Just use LoadBinary! +
  • +
+
+
+

What About Boot ROMs?

+
    +
  1. Initialize peripherals
  2. +
  3. Check for boot override
  4. +
  5. Check for low-power state
  6. +
  7. Load firmware into RAM
  8. +
  9. Validate firmware
  10. +
  11. Jump to loaded program
  12. +
+

+                        sysbus.cpu VectorTableOffset 0x20000000
+                        sysbus.cpu PC 0x20000c00
+                    
+
+
+
+
+

What about New Peripherals?

+
+
+

It's All About Small Victories

+
    +
  • Serial ports are super rewarding
  • +
  • They're also usually simple!
  • +
  • They are easy to script
  • +
+
+
+

What is a Register?

+ + +
+
+

What is a Register?

+ +
+
+

What is a Register?

+ +
+
+

Reuse an Existing Block!

+

+                        flash: Memory.MappedMemory @ sysbus 0x00000000
+                            size: 0x00008000
 
-				
-

Robot Framework: Running Tests in CI

-

-							*** Test Cases ***
-							Should Read Acceleration
-								Create Machine
-								Create Terminal Tester    ${UART}
-							
-								Execute Command   sysbus.twi1.lis2ds12 AccelerationX 10
-								Execute Command   sysbus.twi1.lis2ds12 AccelerationY 5
-								Execute Command   sysbus.twi1.lis2ds12 AccelerationZ -5
-							
-								Start Emulation
-							
-								Wait For Line On Uart  x 9.997213 , y 4.997410 , z -4.999803
-						
-
-
-
-
-

SVD Files

-
-
-

Logging Memory Accesses

-
-
-

Debugging with GDB

-
-
-

Software Assumes Hardware Works

-
    -
  • Rarely checks for sane ranges (why would you?)
  • -
  • TOC-TOU
  • -
-
-
-

Incremental Changes

-
    -
  • Small changes are very rewrding
  • -
  • Device will work with only partial implementation
  • -
-
-
-
-
+ sram: Memory.MappedMemory @ sysbus 0x20000000 + size: 0x00001000 + + nvic: IRQControllers.NVIC @ sysbus 0xE000E000 + IRQ -> cpu@0 - - - - - - - + + + + + + + \ No newline at end of file diff --git a/media/betrusted-ec-com-1.png b/media/betrusted-ec-com-1.png new file mode 100644 index 0000000..ef497b4 Binary files /dev/null and b/media/betrusted-ec-com-1.png differ diff --git a/media/bluenrg-renode-svd.png b/media/bluenrg-renode-svd.png new file mode 100644 index 0000000..9b1291a Binary files /dev/null and b/media/bluenrg-renode-svd.png differ diff --git a/media/bluenrg-renode-uart.png b/media/bluenrg-renode-uart.png new file mode 100644 index 0000000..4882728 Binary files /dev/null and b/media/bluenrg-renode-uart.png differ diff --git a/media/ghidra-decompile.png b/media/ghidra-decompile.png new file mode 100644 index 0000000..e2e26de Binary files /dev/null and b/media/ghidra-decompile.png differ diff --git a/media/pl011-arm.png b/media/pl011-arm.png new file mode 100644 index 0000000..56f87ba Binary files /dev/null and b/media/pl011-arm.png differ diff --git a/media/pl011-bcm2835-cropped.png b/media/pl011-bcm2835-cropped.png new file mode 100644 index 0000000..202fa20 Binary files /dev/null and b/media/pl011-bcm2835-cropped.png differ diff --git a/media/pl011-cc2538-cropped.png b/media/pl011-cc2538-cropped.png new file mode 100644 index 0000000..c192739 Binary files /dev/null and b/media/pl011-cc2538-cropped.png differ diff --git a/media/renode-betrusted-log.png b/media/renode-betrusted-log.png new file mode 100644 index 0000000..dc9ae29 Binary files /dev/null and b/media/renode-betrusted-log.png differ diff --git a/media/renode-connect-gdb.png b/media/renode-connect-gdb.png new file mode 100644 index 0000000..5ef1624 Binary files /dev/null and b/media/renode-connect-gdb.png differ diff --git a/media/renode-multi-system.png b/media/renode-multi-system.png new file mode 100644 index 0000000..e8be66c Binary files /dev/null and b/media/renode-multi-system.png differ diff --git a/media/renode-start-gdb.png b/media/renode-start-gdb.png new file mode 100644 index 0000000..cd7e683 Binary files /dev/null and b/media/renode-start-gdb.png differ