qemu-discuss
[Top][All Lists]
Advanced

[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: ckim
Subject: RE: Please help.. I wish to load .elf file directly for baremetal run..
Date: Thu, 25 Mar 2021 09:46:07 +0900

Hello Peter Maydell,

Thanks for the information. 
I tried with that '-device loader' option and got some errors, but soon found 
it's for loading small amount of data.
The manual says maximum 8 bytes can be loaded.
Example :  -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
Thanks always for the support.
Regards,
Chan Kim

> -----Original Message-----
> From: Peter Maydell <peter.maydell@linaro.org>
> Sent: Wednesday, March 24, 2021 10:30 PM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: qemu-discuss <qemu-discuss@nongnu.org>
> Subject: Re: Please help.. I wish to load .elf file directly for baremetal
> run..
> 
> 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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]