I am currently working with Gem5 and I have to access via UART from my Host to ARMv8 bare-metal option, so i tried lots way but i stocked yet.
could you please let me know, how can i map my host's Serial port to ARMv8's Serial Port in bare-metal type programming.
Any help would be appreciated
Working setups
This repository contains a highly automated working example. Features:
RealViewPBX
andVExpress_GEM5_V1
. You should preferVExpress_GEM5_V1
as it is a more modern platform.Key implementation points are described below.
https://github.com/tukl-msd/gem5.bare-metal contains another working setup and is more minimal, but it has less features currently.
arm
There is nothing special for ARM, you just need to find out the UART address and entry point address, exactly as for QEMU, and then pass the
--bare-metal
option tofs.py
:The UART address can be found on the gem5 source code
src/dev/arm/RealView.py
:The entry point is deduced from the ELF directly, but TODO some values are not valid. I just step debugged until I found these values:
aarch64
Similar to
arm
, but requires a few extra steps.First you must build your toolchain yourself if you want Newlib since Ubuntu does not have the aarch64 package. I've adapted the existing arm config and reached this working config.
Then, as of 6fa49382ef22e1b01fb24503e3bbe5ab3556750a you must pass the CLI options:
(
auto_reset_addr_64
before 6fa49382ef22e1b01fb24503e3bbe5ab3556750a) otherwise it fails with:The other key patch is: https://github.com/gem5/gem5/commit/3c3ca64b5f0dd9eef7b1ce1c65cc6e8e9147dd38
Alternatively, you could also patch
fs.py
as:The semihosting part is optional, but super convenient, see: How to enable ARM semihosting in gem5? The other options are mandatory.
Tested in Ubuntu 18.04 host.