radare2 load register map

85 Views Asked by At

I'm reversing some stm32f030 code I downloaded from the chip. I do understand the stm32s and arm assembly but I'm completely new to radare2.

There are many special registers e.g. 0x40021000 is RCC_CR, 0x40021004 is RCC_CFGR, 0x48000000 is GPIOA_MODER an so on. s. https://www.st.com/resource/en/reference_manual/dm00091010-stm32f030x4x6x8xc-and-stm32f070x6xb-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

Is there a way to import register definitions in some format so that the code analysis can automatically flag them? Or another way so that all referenzes to them are named?

1

There are 1 best solutions below

0
artless noise On

From the Radare manual on symbols, you can read a dwarf file. So, you can make a dwarf with external definitions for the register at the absolute addresses and it may be able to use them in the disassembler of a second binary.

With bin-utils, you can merge a binary with the symbols. Radare looks to have lots of utilities which can probably do the same thing; if it is not able to merge symbols from a separate DWARF file.. and this step is entirely un-needed.