I hope this message finds you well. I am reaching out to seek your
expertise regarding a persistent issue I have encountered while working
with QEMU, specifically a hardfault error when emulating the MPS2AN505 with
a Cortex-M33 core.

I have been grappling with this issue for some time and am unsure of the
next steps to take. Could you please advise on potential areas to
investigate or adjustments that might resolve this error? I am particularly
curious if the issue lies with the vector table placement or the
configuration in my linker script.

The error I am facing is as follows:
*qemu: fatal: Lockup: can't escalate 3 to HardFault (current priority -1)*

This occurs when I attempt to run my kernel.elf file using the following
QEMU command:




*qemu-system-arm -machine mps2-an505 -cpu cortex-m33 \                -m
16M \                -nographic -serial mon:stdio \                -device
loader,file=kernel.elf*

For your reference, here are the relevant details of my setup:

Startup File (Boot.s)
*.**thumb*
*.section .isr_vector*
*    .long    __StackTop         /* Initial Top of Stack */*
*    .long    Reset_Handler      /* Reset Handler */*

*.text*
*.global Reset_Handler*
*Reset_Handler:  *
*    ldr     R0, = main*
*bx      R0*

Linker Script (Kernel.ld)






















*MEMORY{   NS_CODE (rx)     : ORIGIN = 0x00000000, LENGTH = 512K
 S_CODE_BOOT (rx) : ORIGIN = 0x10000000, LENGTH = 512k   RAM   (rwx) :
ORIGIN = 0x20000000, LENGTH = 512k}/* Entry Point
*/ENTRY(Reset_Handler)SECTIONS{    .text :    {
KEEP(*(.isr_vector))        *(.text)        *(.data)        *(.bss)    } >
S_CODE_BOOT    /* Set stack top to end of S_CODE_BOOT. */    __StackTop =
ORIGIN(S_CODE_BOOT) + LENGTH(S_CODE_BOOT);}*

Toolchain Used:
*arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi*

Compilation Commands to generate my elf file:




*arm-none-eabi-gcc -mcpu=cortex-m33 -g -c boot.s -o boot.oarm-none-eabi-ld
boot.o main.o -T kernel.ld -o kernel.elfarm-none-eabi-objdump -d kernel.elf
> kernel.listarm-none-eabi-objdump -t kernel.elf | sed '1,/SYMBOL TABLE/d;
s/ .* / /; /^$/d' > kernel.symarm-none-eabi-readelf -A kernel.elf*

Main Function (main.c):



*void main(void){    while (1);}*

Output of readelf -wl Command:











*Elf file type is EXEC (Executable file)Entry point 0x10000008There is 1
program header, starting at offset 52Program Headers:  Type
Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align  LOAD
0x001000 0x10000000 0x10000000 0x00016 0x00016 R E 0x1000 Section to
Segment mapping:  Segment Sections...   00     .text*

Guest Errors Observed:
I
*nvalid read at addr 0x10000000, size 4, region '(null)', reason:
rejectedInvalid read at addr 0x10000004, size 4, region '(null)', reason:
rejected*

Your guidance on this matter would be greatly appreciated. I am eager to
understand and resolve this issue, and I believe your expertise could be
invaluable in this context.

Thank you for your time and consideration. I look forward to any insights
or suggestions you might have.

Best regards,
Sanjana Gogte

Reply via email to