ä»åãããRenode ã¨ãããªã¼ãã³ã½ã¼ã¹ã®çµè¾¼ã¿ããã¤ã¹ã®ã¨ãã¥ã¬ã¼ã¿ã試ãã¦ããã¾ãã
ç°¡åã«è¨ãã¨ãQEMU ã¨åãä½ç½®ä»ãã® OSS ã§ããQEMU ããããçµè¾¼ã¿ããã¤ã¹ã®ãµãã¼ããå
å®ãã¦ããããã§ãã
ããã§ã¯ããã£ã¦ããã¾ãã
ã¯ããã«
ãQEMUãåãããã®è¨äºä¸è¦§ã§ããè¯ãã£ããåèã«ãã¦ãã ããã
QEMUãåããã®è¨äºä¸è¦§
ã¾ããRenode ã®å
¬å¼ãµã¤ãã¯ä»¥ä¸ã§ãã
https://renode.io/
Renode ã®å
¬å¼ã®ããã¥ã¡ã³ãã¯ä»¥ä¸ã§ãã
https://renode.readthedocs.io/en/latest/
ã¾ããGitHub ã¯ä»¥ä¸ã§ãã
https://github.com/renode/renode
ä»åã¯ãRenode ã®ã¤ã³ã¹ãã¼ã«ã¨ããµã³ãã«ã½ã¼ã¹ã®åä½ç¢ºèªããã£ã¦ããã¾ãã
Renodeã®ã¤ã³ã¹ãã¼ã«
ã¤ã³ã¹ãã¼ã«æé ã¯ãå
¬å¼ã® GitHub ã«æ¸ããã¦ããã®ã§ãããã«å¾ãã¾ãã
ã¨è¨ã£ã¦ããRenode èªä½ã¯ãportable ãé¸ã¹ã°ã解åããã ãã§ãã
ä¾åãã¦ããããã±ã¼ã¸ã¨ãã¦ãmono-complete ããã±ã¼ã¸ãå
ã«ã¤ã³ã¹ãã¼ã«ããå¿
è¦ãããã¾ãã
ããã§ã¯ãã£ã¦ããã¾ãã
mono-completeã®ã¤ã³ã¹ãã¼ã«
以ä¸ã®å
¬å¼ãµã¤ãã®æé ã«å¾ãã¾ãã
ä»åã¯ãVirtualBox ã® Ubuntu 22.04 ã«ã¤ã³ã¹ãã¼ã«ãã¾ãããUbuntu 20.04 ã®æé ã¾ã§ããæ¸ããã¦ãªãã§ãããUbuntu 20.04 ã®æé ã«å¾ãã¾ãã
Download - Stable | Mono
$ sudo apt install ca-certificates gnupg
ca-certificates ã¯ãã§ã«ææ°ãã¼ã¸ã§ã³ (20230311ubuntu0.22.04.1) ã§ãã
gnupg ã¯ãã§ã«ææ°ãã¼ã¸ã§ã³ (2.2.27-3ubuntu2.1) ã§ãã
$ sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
gpg: keybox'/usr/share/keyrings/mono-official-archive-keyring.gpg'ãä½æããã¾ãã
gpg: /tmp/trustdb.gpg: ä¿¡ç¨ãã¼ã¿ãã¼ã¹ãã§ãã¾ãã
gpg: éµA6A19B38D3D831EF: å
¬ééµ"Xamarin Public Jenkins (auto-signing) <[email protected]>"ãã¤ã³ãã¼ããã¾ãã
gpg: å¦çæ°ã®åè¨: 1
gpg: ã¤ã³ãã¼ã: 1
$ echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main
$ sudo apt update
$ sudo apt install mono-devel
çµæ§å¤ããã£ãã§ããã
$ mono -V
Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:37:50 UTC 2023)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(610)
Suspend: hybrid
GC: sgen (concurrent by default)
ãã¼ã¸ã§ã³ 6.12 ãã¤ã³ã¹ãã¼ã«ããã¾ãããRenode ã«ã¯ããã¼ã¸ã§ã³ 5.2 以ä¸ãå¿
è¦ã¨ããæ¡ä»¶ã§ããã
ä¾åé¢ä¿ã®ããã±ã¼ã¸ã¤ã³ã¹ãã¼ã«
ç¶ãã¦ãä»ã®ä¾åé¢ä¿ã®ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã¾ãã
$ sudo apt-get install policykit-1 libgtk2.0-0 screen uml-utilities gtk-sharp2 libc6-dev gcc python3 python3-pip
Renodeã®ãã¦ã³ãã¼ãã¨ã¤ã³ã¹ãã¼ã«
Renode ç¨ã«å°ç¨ã®ä½æ¥ãã£ã¬ã¯ããªãä½ã£ã¦ãããã« Renode ããã¦ã³ãã¼ããã¾ãã
$ mkdir renode
$ cd renode
$ wget https://github.com/renode/renode/releases/download/v1.15.0/renode-1.15.0.linux-portable.tar.gz
å
¬å¼ã®æé ã§ã¯ã解åã« -C
㨠--strip-components=1
ã使ã£ã¦ãã¾ãããåããã¨ãå®ç¾ããã®ã«ãå¥ã®æé ã使ãã®ã¯ãå¹çãè¯ããªãã¨æãã¾ãã
ã¨ãããã¨ã§ãæ®éã®ããæ¹ã«ãã¾ãã
$ tar zxvf renode-1.15.0.linux-portable.tar.gz
$ renode_1.15.0_portable/renode -v
Renode v1.15.0.27975
build: 9111b18e-202403181532
build type: Release
runtime: Mono 4.0.30319.42000
Renode ã®ã¤ã³ã¹ãã¼ã«ã¯ä»¥ä¸ã§ãã
STM32ã§åä½ç¢ºèª
å
¬å¼ã®ããã¥ã¡ã³ãã«ã¯ãSTM32 ã®ãã¥ã¼ããªã¢ã«ã¯è¦å½ããã¾ããã§ããã代ããã«ä»¥ä¸ã®ãã¼ã¸ãè¦ã¤ãã¾ããã
interrupt.memfault.com
å°ãå¤ãã§ããããã®ãã¼ã¸ã®ãã¥ã¼ããªã¢ã«ããã£ã¦ããã¾ãã
ãµã³ãã«ã½ã¼ã¹ã®ãã«ã
èµ·åæ¹æ³ãç¾å¨ã®ãã®ã¨ã¯ç°ãªã£ã¦ããããã¨ãã¥ã¬ã¼ã·ã§ã³éå§æã®æåãå°ãç°ãªãã¾ãã
$ git clone https://github.com/memfault/interrupt.git
$ cd interrupt/example/renode/
$ make
git clone https://github.com/libopencm3/libopencm3.git libopencm3
Cloning into 'libopencm3'...
remote: Enumerating objects: 30727, done.
remote: Counting objects: 100% (149/149), done.
remote: Compressing objects: 100% (104/104), done.
remote: Total 30727 (delta 83), reused 75 (delta 45), pack-reused 30578
Receiving objects: 100% (30727/30727), 7.04 MiB | 25.76 MiB/s, done.
Resolving deltas: 100% (20039/20039), done.
Initializing OPENCM3 Lib
git -C libopencm3 checkout 89074d6a13ed7febba04d3c421ce7bf2b7972156
Note: switching to '89074d6a13ed7febba04d3c421ce7bf2b7972156'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 89074d6a stm32h7: fix inverted VOS settings for Vcore.
make -C libopencm3
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ã«å
¥ãã¾ã
GENHDR include/libopencm3/stm32/f0/irq.json
/usr/bin/env: `python': ãã®ãããªãã¡ã¤ã«ããã£ã¬ã¯ããªã¯ããã¾ãã
make[1]: *** [Makefile:59: include/libopencm3/stm32/f0/irq.json.genhdr] ã¨ã©ã¼ 127
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ããåºã¾ã
make: *** [Makefile:17: libopencm3/89074d6a13ed7febba04d3c421ce7bf2b7972156] ã¨ã©ã¼ 2
ã¨ã©ã¼ãåºã¾ãããGit ã§ã¨ã©ã¼ãåºã¦ãããã§ãï¼ã®ã§ã対å¦ãã¾ãã
$ cd libopencm3/
$ git switch -
$ cd ..
$ make
Initializing OPENCM3 Lib
git -C libopencm3 checkout 89074d6a13ed7febba04d3c421ce7bf2b7972156
HEAD is now at 89074d6a stm32h7: fix inverted VOS settings for Vcore.
make -C libopencm3
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ã«å
¥ãã¾ã
GENHDR include/libopencm3/stm32/f0/irq.json
/usr/bin/env: `python': ãã®ãããªãã¡ã¤ã«ããã£ã¬ã¯ããªã¯ããã¾ãã
make[1]: *** [Makefile:59: include/libopencm3/stm32/f0/irq.json.genhdr] ã¨ã©ã¼ 127
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ããåºã¾ã
make: *** [Makefile:17: libopencm3/89074d6a13ed7febba04d3c421ce7bf2b7972156] ã¨ã©ã¼ 2
Git ã¯åå ã§ã¯ãªãã£ãããããã¾ãããpython
ãç¡ãã¨è¨ããã¦ã¾ããpython3
ã¯ããã®ã§ãã·ã³ããªãã¯ãªã³ã¯ãä½ã£ã¦å¯¾å¿ãã¾ãã
$ which python3
/usr/bin/python3
$ cd /usr/bin/
$ sudo ln -s python3 python
$ cd -
$ make
Initializing OPENCM3 Lib
git -C libopencm3 checkout 89074d6a13ed7febba04d3c421ce7bf2b7972156
HEAD is now at 89074d6a stm32h7: fix inverted VOS settings for Vcore.
make -C libopencm3
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ã«å
¥ãã¾ã
GENHDR include/libopencm3/stm32/f0/irq.json
GENHDR include/libopencm3/stm32/f1/irq.json
GENHDR include/libopencm3/stm32/f2/irq.json
ï¼é·ãã®ã§çç¥ï¼
CC sync.c
CC dwt.c
AR libopencm3_pac55xx.a
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode/libopencm3' ããåºã¾ã
touch libopencm3/89074d6a13ed7febba04d3c421ce7bf2b7972156
Building renode example app
make -f Makefile_renode_example.mk
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode' ã«å
¥ãã¾ã
CC renode-example.c
GENLNK stm32f407vgt6
LD renode-example.elf
OBJCOPY renode-example.bin
make[1]: ãã£ã¬ã¯ã㪠'/home/daisuke/svn_/renode/interrupt/example/renode' ããåºã¾ã
ãã«ãã¯æåããããã§ãã
å®è¡ãã¦ã¿ã
Renode ã¯è§£åãããã£ã¬ã¯ããªä»¥ä¸ã®ãã¹ãã@xxx
ã¨ããå½¢ã§ãç¸å¯¾ãã¹ã§æå®ã§ããããã§ããçæããã ELFãã¡ã¤ã«ã®ã·ã³ããªãã¯ãªã³ã¯ã Renode ã®ãã£ã¬ã¯ããªã«ä½ããã¨ã«ãã¾ãã
$ cd renode_1.15.0_portable/
$ ln -s ../interrupt/example/renode/renode-example.elf
ããã§ã¯ãRenode ãèµ·åãã¦ããã¾ãã
$ ./renode
Renode ãèµ·åããã¨ãRenode ã¢ãã¿ã¼ã¨å¼ã°ãããRenode ç¨ã®ã³ã³ã½ã¼ã«ãèªåçã«ç«ã¡ä¸ããã¾ãï¼ä¸å³ã®å³å´ã®ã¦ã£ã³ãã¦ï¼ã
ãã® Renode ã¢ãã¿ã¼ã§ã以ä¸ã®ããã«ãç°å¢ã®æ§ç¯ãè©ä¾¡ãã¼ãã®æå®ãELF ãã¡ã¤ã«ã®ãã¼ããUART ç¨ã®ã¢ãã¿ã¼ã®èµ·åãGDB ã®è¨å®ãªã©ãè¡ããæå¾ã« start ã§ã¨ãã¥ã¬ã¼ã·ã§ã³ãéå§ãã¾ãã
(monitor) mach create
(machine-0) machine LoadPlatformDescription @platforms/boards/stm32f4_discovery-kit
.repl
(machine-0) sysbus LoadELF @renode-example.elf
(machine-0) showAnalyzer sysbus.usart2
(machine-0) machine StartGdbServer 3333
(machine-0) start
ãããããã¥ã¼ããªã¢ã«ã«ãããããã«ãä»åã®è©ä¾¡ãã¼ãã®è¨å®ããCCM ã¡ã¢ãªã«å¯¾å¿ãã¦ããªãããã以ä¸ã®ãããªå¤§éã®è¦åãåºã¾ãã
18:04:50.1427 [WARNING] sysbus: [cpu: 0x8000D94] WriteDoubleWord to non existing peripheral at 0x1004CC3C, value 0x0.
ãã¥ã¼ããªã¢ã«ã®æ¹ã§ãCCM ã®è¨å®ãä½ã£ã¦ããã¦ããã®ã§ãããã使ãã¾ããæ¡å¼µåã repl ã®ãã¡ã¤ã«ã¯ãREnode PLatform ã¨ãã Renode ã®è¨å®ãã¡ã¤ã«ã§ãã
$ cp ../interrupt/example/renode/add-ccm.repl ./
$ cat add-ccm.repl
ccm: Memory.MappedMemory @ sysbus 0x10000000
size: 0x10000
ã¤ãã§ã«ãã·ã§ã«ã¹ã¯ãªããã®ããã«ãèªåçã«è¨å®ãªã©ãå®è¡ãããã¡ã¤ã«ãã³ãã¼ãã¦ããã¾ãããã®æ¡å¼µåã resc ã®ãã¡ã¤ã«ã Renode ã§ä½¿ããã¡ã¤ã«ã§ãREnode SCripts ããæ¥ã¦ããããã§ãã
å
ã»ã©ãæåã§å®è¡ããå
容ããæ¸ããã¦ãã¾ãã
$ cp ../interrupt/example/renode/renode-config.resc ./
cat renode-config.resc
name: STM32F4 Discovery Printf
description: This script runs the usart_printf example on stm32f4 discovery
$name?="STM32F4_Discovery"
$bin?=@renode-example.elf
mach create $name
machine LoadPlatformDescription @platforms/boards/stm32f4_discovery-kit.repl
machine LoadPlatformDescription @add-ccm.repl
showAnalyzer sysbus.usart2
machine StartGdbServer 3333
macro reset
"""
sysbus LoadELF $bin
"""
runMacro $reset
ã§ã¯ãä»åº¦ã¯ãrescãã¡ã¤ã«ã使ã£ã¦å®è¡ãã¾ããRenode ã®èµ·åã«å¼æ°ã¨ãã¦ãrescãã¡ã¤ã«ãæå®ãããã¨ãåºæ¥ã¾ãã
$ ./renode renode-config.resc
èµ·åãã Renodeã¢ãã¿ã¼ã«ããstartããå
¥åãã¾ãã
USART ã§è¦åãåºã¦ãã®ãæ°ã«ãªãã¾ãããã¨ãããããåä½ããããã§ãã
ãããã«
ä»åã¯ãQEMU ã«ä¼¼ããRenode ã¨ããã¨ãã¥ã¬ã¼ã¿ãåããã¦ã¿ã¾ããã
å°ã使ã£ã¦ã¿ãå°è±¡ã¨ãã¦ã¯ãQEMU ããæ±ãããããUIï¼ã¦ã¼ã¶ã¤ã³ã¿ãã§ã¼ã¹ï¼ãæ´ç·´ããã¦ããæãã§ããQEMU ã¯ãCCMãã¼ã¿RAM ã«å¯¾å¿ãã¦ãã¾ããã§ããããRenode ã¯ãè¨å®ã追å ããã ãã§å¯¾å¿ã§ãã¾ããã
ã¾ããQEMU ã¯ãEclipse ã§ä½¿ãã¾ããããRenode ã¯ãVSCode ã®ãããã°ã«å
¬å¼ã®ããã¥ã¡ã³ãã¨ãã¦å¯¾å¿ãã¦ãã¾ãï¼QEMU ã VSCode ã§åãããã¨æãã¾ãï¼ã
次åã¯ãRenode 㧠GDB ã使ã£ã¦ãããã°ããã¦ã¿ããã¨æãã¾ãã
ãã®è¨äºã誰ãã®å½¹ã«ç«ã¦ã°å¬ããã§ãã
æå¾ã«ãªãã¾ããããã¨ã³ã¸ãã¢ã°ã«ã¼ãã®ã©ã³ãã³ã°ã«åå ä¸ã§ãã
æ°æ¥½ã«ãããã¨ãããããé¡ããããã¾ãð
ä»åã¯ä»¥ä¸ã§ãï¼
æå¾ã¾ã§ãèªã¿ããã ãããããã¨ããããã¾ããã