Skip to content

Instantly share code, notes, and snippets.

@karlp
Created September 11, 2020 14:00
Show Gist options
  • Save karlp/6fc3edfc5b8087259c6b767f6d4d4cbb to your computer and use it in GitHub Desktop.
Save karlp/6fc3edfc5b8087259c6b767f6d4d4cbb to your computer and use it in GitHub Desktop.
renode for stm32l1 stuff (renode 1.10.1 era)
--- /home/karlp/src/renode-git/platforms/cpus/stm32l151.repl 2020-09-11 10:16:06.627671941 +0000
+++ /opt/renode/platforms/cpus/stm32l151.repl 2020-09-11 12:09:07.482336609 +0000
@@ -77,7 +77,8 @@
sysbus:
init:
- ApplySVD @https://dl.antmicro.com/projects/renode/svd/STM32L1xx.svd.gz
+ //ApplySVD @https://dl.antmicro.com/projects/renode/svd/STM32L1xx.svd.gz
+ ApplySVD @https://raw.githubusercontent.com/posborne/cmsis-svd/master/data/STMicro/STM32L1xx.svd
Tag <0x4000280C, 0x40002810> "RTC_ISR" 0x60
SilenceRange <0x40003000 4>
Tag <0xE0042000 4> "MCU_ID" 0x10000416
@@ -85,6 +86,8 @@
Tag <0x40023C18 4> "FLASH_SR" 0xE
Tag <0x40007000 4> "PWR_CONTROL" 0x1000
Tag <0x40007004 4> "PWR_STATUS" 0x8
+ // hard on all the RDY bits...
+ Tag <0x40023800 4> "RCC_CR" 0x2020202
rccCsr: Python.PythonPeripheral @ sysbus 0x40023834
size: 0x4
using "platforms/cpus/stm32l151.repl"
led0: Miscellaneous.LED @ gpioPortB 8
led1: Miscellaneous.LED @ gpioPortB 9
// Fake CRC data for now.... this is horrible, but lets us run at least.
crcDr: Python.PythonPeripheral @ sysbus 0x40023000
size: 0x4
initable: false
script: "request.value=0x11223344"
itmTER: Python.PythonPeripheral @ sysbus 0xE0000E00
size: 0x4
initable: false
// just pretend that all stimulus ports are enabled
script: "request.value=0xffffffff"
itm: Python.PythonPeripheral @ sysbus 0xe0000000
size: 128 // 32 stimulus ports, 32bit wide.
initable: false
//script: "request.value = 1 if request.isRead"
// note, must be in renode root dir, not in project :( https://github.com/renode/renode/issues/127
filename: "renode.itm.py"
dwtCycleCounter: Python.PythonPeripheral @ sysbus 0xe0001004
size: 4
initable: true
filename: "scripts/pydev/counter.py"
:name: L1 based board
:description: hacking shit y0
using sysbus
$name?="my-l1"
mach create $name
machine LoadPlatformDescription @my-l1-based-platform.repl
cpu PerformanceInMips 36
[email protected]
showAnalyzer sysbus.uart2
### Set random board UNIQUE ID, addresses for l1 cat 2 ###
python "import _random"
python "rand = _random.Random()"
$id1 = `python "print rand.getrandbits(32)"`
$id2 = `python "print rand.getrandbits(32)"`
$id3 = `python "print rand.getrandbits(32)"`
macro reset
"""
sysbus LoadELF $bin
sysbus WriteDoubleWord 0x1FF80050 $id1
sysbus WriteDoubleWord 0x1FF80054 $id2
sysbus WriteDoubleWord 0x1FF80064 $id3
"""
runMacro $reset
# Implements an ITM stimulus port block, returning always available
if request.isRead:
request.value = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment