|
From: | James Gutbub |
Subject: | Re: Hello world example with qemu-system-arm |
Date: | Tue, 17 May 2022 15:54:58 -0700 |
Thanks for all your help! I was able to get something working based on your suggestion to use arm-linux-* toolchain.
I am encountering some compile error message if I try to specify ‘-march=armv7-r’ or ‘-mcpu=cortex-r5’ (conflicting architecture profiles R/A), but ‘-mtune=cortex-r5’ works.
And I am encountering some qemu-arm error message with the ‘-mtune=cortex-r5’ built ELF if I try to specify ‘-cpu cortex-r5f’ or ‘-cpu cortex-r5’ (uncaught target signal 4 (Illegal instruction)), but ‘-cpu cortex-a7’ works.
Pasting the working scenario for others who might come across this thread:
test_linux.c file contents:
#include <stdio.h>
int main(){
printf("Test test\n");
return 0;
}
arm-none-linux-gnueabihf-gcc -mtune=cortex-r5 -static test_linux.c -o test.elf
qemu-arm -cpu cortex-a7 ./test.elf
Much appreciated!
Kind Regards,
James G.
On Mon, 16 May 2022 at 23:26, James Gutbub <jgutbub@asu.edu> wrote:
>
> Thank you for the help. I tried specifying ‘-R 0’ and receive the same error message - qemu-arm: Unable to reserve 0xffff0000 bytes of virtual address space at 0x1000 (Permission denied) for use as guest address space (check your virtual memory ulimit setting, min_mmap_addr or reserve less using -R option)
>
> I have been using the default linker script provided by arm-none-eabi-ld but I will continue by using the linker script defined below, which gives the same error message as before.
>
> test.ld file contents:
>
> ENTRY(_Reset)
> SECTIONS
> {
> . = 0x0000000;
> .startup . : { startup.o(.text)}
> .text : { *(.text) }
> . = 0x8000000;
> .data : { *(.data) }
> .bss : { *(.bss COMMON) }
> . = ALIGN(8);
> . = . + 0x1000;
> _stack = .;
> }
Bear in mind that you are essentially linking a Linux binary
here, not a real bare metal binary. So you don't necessarily get
full control over where you want to put stuff in the address space,
and in particular putting stuff at address 0 is not going to work.
(If you can use an arm-linux-* toolchain then you can likely get
away without having a linker map at all.)
-- PMM
[Prev in Thread] | Current Thread | [Next in Thread] |