qq_34007813 2018-04-12 07:58 采纳率: 66.7%
浏览 973
已结题

求高手解答,这是什么问题?

图片说明
我跟随剑桥大学计算机实验室的树莓派裸机程序编写教程编写树莓派3的裸机程序,工具是arm-none-eabi-as(YARGATO),makefile我用的他们的,本机操作系统Windows10,当我编译完成时,出现了图片中的故障,并且我将生成的kernel.img拷到SD卡上时竟无法点亮小灯。我的功能是实现在子函数里的,必须要把函数里的代码拿出来才能生效,不懂了?怀疑就是图片中的原因,求各位高手解答。附代码如下:

.arch armv6
.align 2
.globl _start
.section .init
_start:
 b main
 main:
    mov sp,#0x8000
    mov r0,#0x9 
    mov r1,#1
    bl SetGpioFunction
    mov r0,#0x9
    mov r1,#1
    bl SetGPIO
loop$:
     b loop$

.globl SetGpioFunction @function
SetGpioFunction:
     cmp r0,#0x28 
    cmpls r1,#0x7
    movhi pc,lr
    push {lr}
    mov r2,r0
    ldr r0,=0x3f200000
floop:
    cmp r2,#0x9
    subhi r2,#0xa
    addhi r0,#0x4
    bhi floop
    add r2,r2,r2,lsl #1
    lsl r1,r2
    str r1,[r0]
    pop {pc}


.globl SetGPIO @function
SetGPIO:
    cmp r0,#0x28
    movhi pc,lr
    push {lr}
    mov r2,r0
    ldr r0,=0x3f200000
    lsl r3,r2,#5
    lsl r3,#2
    add r0,r3
    and r2,#0x1f
    mov r3,#1
    lsl r3,r2
    cmp r1,#0
    streq r3,[r0,#0x28]
    strne r3,[r0,#0x1c]
    pop {pc}    



kernel.ld

/******************************************************************************
*   kernel.ld
*    by Alex Chadwick
*
*   A linker script for generation of raspberry pi kernel images.
******************************************************************************/

SECTIONS {
    /*
    * First and formost we need the .init section, containing the code to 
        * be run first. We allow room for the ATAGs and stack and conform to 
        * the bootloader's expectation by putting this code at 0x8000.
    */
    .init 0x8000 : {
        *(.init)
    }

    /* 
    * Next we put the rest of the code.
    */
    .text : {
        *(.text)
    }

    /* 
    * Next we put the data.
    */
    .data : {
        *(.data)
    }

    /*
    * Finally comes everything else. A fun trick here is to put all other 
    * sections into this section, which will be discarded by default.
    */
    /DISCARD/ : {
        *(*)
    }
}


  • 写回答

2条回答

  • _1_1_7_ 2018-04-12 08:08
    关注

    看一下 这个,或能给你提示 :
    https://www.avrfreaks.net/forum/windows-81-compilation-error

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮