Accessing semihosting on Microblaze/OVPsim

170 views Asked by At

I am writing code for the Microblaze on OVPsim and wonder is it possible to use semihosting with my own linker script and paging scheme (ie not using crt0?

I have built my platform with semihosting on, but when my assembly hits a global .exit - nothing happens - code example below:

handle_datatlb_miss:
    nop
.global exit
exit:
    ori r19, r0, clock_sweep_pte

(I understand that this should automatically be trapped by the semihosting and result in an end to the simulation).

I am using my own linker script with my own makefile:

SECTIONS
{
    . = 0x0000;
    .vectors.reset : { *(.vectors.reset) }
    . = 0x0008;
    .vectors.sw_exception : { *(.vectors.sw_exception) }
    . = 0x0010;
    .vectors.interrupt : { *(.vectors.interrupt) }
    .= 0x0018;
    .vectors.breakpoint : { *(.vectors.breakpoint) }
    . = 0x0020;
    .vectors.hw_exception : { *(.vectors.hw_exception) }
    .text : { *(.text) }
    .data : { *(.data) }
    .bss : { *(.bss) }
}

If I remove my linker script the code does not compile using the OVP supplied makefile (suitably adapted to build my code):

adrian@hairyirakli:~/Imperas/mb_boot$ make -f alt-makefile 
Linking Application startup.MICROBLAZE.elf
/home/adrian/Imperas/Imperas.20140731/lib/Linux32/CrossCompiler/microblaze-elf/bin/mb-ld: section .text [00000050 -> 0010a27b] overlaps section .vectors.hw_exception [00000020 -> 0000011f]
/home/adrian/Imperas/Imperas.20140731/lib/Linux32/CrossCompiler/microblaze-elf/bin/mb-ld: startup.MICROBLAZE.elf: section .text lma 0x50 overlaps previous sections
/home/adrian/Imperas/Imperas.20140731/lib/Linux32/CrossCompiler/microblaze-elf/bin/mb-ld: startup.MICROBLAZE.elf: section .vectors.breakpoint lma 0x10a27c overlaps previous sections
make: *** [startup.MICROBLAZE.elf] Error 1

When I do use it, with either my own makefile or the OVP-supplied makefile the code compiles but I cannot seem to access semihosting.

Can I access semihosting without using crt0 and the rest?

Update

This is what the start of my code looks like...

_start:
brai _actualstart
.end _start
.section .vectors.sw_exception, "ax"
.align 2
_vector_sw_exception:
brai _exception_handler
.section .vectors.interrupt, "ax"
.align 2
_vector_interrupt:
brai _interrupt_handler
.section .vectors.breakpoint, "ax"
.align 2
_vector_breakpoint:
brai _handle_breakpoint
.section .vectors.hw_exception, "ax"
.align 2
_vector_hw_exception:
brai _hw_exception_handler

(You can see all of it at https://github.com/mcmenaminadrian/mb_boot/blob/master/startup.S)

0

There are 0 answers