[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please help.. I wish to load .elf file directly for baremetal run..
From: |
Peter Maydell |
Subject: |
Re: Please help.. I wish to load .elf file directly for baremetal run.. |
Date: |
Wed, 24 Mar 2021 13:29:31 +0000 |
On Wed, 24 Mar 2021 at 12:49, <ckim@etri.re.kr> wrote:
> I managed to make the baremetal program run using pflash in address 0~64KB
> and RAM starting from 0x40000000.
>
> (I wanted to reply as a follow-up to Jakob Bohm’s reply to my question, but I
> didn’t receive his email. It’s only in the email archive.
>
> His suggestion was that I have to do as I really have to do on a real
> bare-metal machine but it looked much more difficult so I devised a trick
> which I’ll explain below.
> The command I used is : (it provides both -kernel and -drive if=pflash
> options. With the modifications above, it just runs ok.)
>
> qemu-system-aarch64 -machine
> type=virt,gic-version=3,secure=true,virtualization=true -cpu cortex-a72
> -nographic -smp 1 -m 2048 -semihosting -kernel test.elf -drive
> if=pflash,file=pflash.img,format=raw,readonly=on
This seems quite complicated. I think you could achieve the same
effect by dropping the -kernel and -drive options, and just using
the 'generic loader' device (-device loader,file=file.elf -- see
https://qemu-project.gitlab.io/qemu/system/generic-loader.html)
That will load all the segments of the ELF file where the ELF
file says they need to go, so the ELF file can specify a
segment to go at 0x0 and one to go at 0x4000_0000. I haven't
tested this, though -- it's possible you might still run into
issues with the dtb conflicting with your ELF file.
thanks
-- PMM