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

    评论

报告相同问题?

悬赏问题

  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求