qiling
qiling copied to clipboard
MCU: function self.ql.hw.setup_remap() does not exist (dead code)
Describe the bug
The function setup_remap, which is called from this line in mcu.py does not exist in Qiling. Furthermore, the type remap isn't used in any microcontroller's environment dictionary (e.g. stm32f401.py).
In my opinion the following code block is dead code and can be deleted:
if memtype == 'remap':
size = args['size']
base = args['base']
alias = args['alias']
self.ql.hw.setup_remap(alias, base, size, info=f'[{name}]')
If you wish I can create a PR.
Sample Code
from qiling.core import Qiling
test_env = {
"TEST": {
"base": 0x00000000,
"size": 0x40000,
"alias": "test",
"type": "remap"
}
}
def main():
ql = Qiling(["hello_gpioA.hex"], archtype="cortex_m", ostype="mcu", env=test_env)
ql.run()
if __name__ == "__main__":
main()
Output:
Traceback (most recent call last):
File "/mnt/data/Temp/aaa/emulation/test.py", line 19, in <module>
main()
File "/mnt/data/Temp/aaa/emulation/test.py", line 13, in main
ql = Qiling(["hello_gpioA.hex"], archtype="cortex_m", ostype="mcu", env=test_env)
File "/mnt/data/Temp/aaa/emulation/qiling/core.py", line 184, in __init__
self.loader.run()
File "/mnt/data/Temp/aaa/emulation/qiling/loader/mcu.py", line 133, in run
self.load_env()
File "/mnt/data/Temp/aaa/emulation/qiling/loader/mcu.py", line 121, in load_env
self.ql.hw.setup_remap(alias, base, size, info=f'[{name}]')
TypeError: 'NoneType' object is not callable
Additional context sample.zip
You are right, it is a deprecated api