1

我正在 OVPsim 上为 Microblaze 编写代码,想知道是否可以将半主机与我自己的链接器脚本和分页方案一起使用(即不使用crt0?

我已经使用半主机构建了我的平台,但是当我的程序集遇到全局.exit时 - 没有任何反应 - 下面的代码示例:

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

(我知道这应该被半主机自动捕获并导致模拟结束)。

我正在使用我自己的链接器脚本和我自己的 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) }
}

如果我删除我的链接器脚本,则代码不会使用 OVP 提供的 makefile 进行编译(适合构建我的代码):

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

当我使用它时,无论是使用我自己的 makefile 还是 OVP 提供的 makefile,代码都会编译,但我似乎无法访问半主机。

我可以在不使用crt0其他的情况下访问半主机吗?

更新

这就是我的代码开头的样子......

_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

(你可以在https://github.com/mcmenaminadrian/mb_boot/blob/master/startup.S看到所有这些)

4

0 回答 0