gpt4 book ai didi

assembly - Cortex-M3 初始化

转载 作者:行者123 更新时间:2023-12-03 06:25:29 25 4
gpt4 key购买 nike

我编写了(IMO)几乎最简单的 ARM 应用程序,但它不起作用:)可能出什么问题了?错过了什么?

闪存写入和 CPU 复位后,寄存器中存在垃圾。

请友善,如果你知道,请告诉我必须做什么才能运行最简单的应用程序在STM32F1上。

也许有人可以列举在应用程序开始之前必须完成的事情,即。

  1. 初始化堆栈(有必要吗?)
  2. 设置一些内容。
  3. 设置其他内容。

应用:

@Directives
.thumb @.code 16
.syntax unified

.section .text
.org 0 @ Alters location of pointer - in this case set to zero

vectors: @ Define basic vectors for specific capabilities
.word _start + 1 @ Set - start address and increment pointer
.word _nmi_handler + 1 @ Below all other vectors will be declared:
.word _hard_fault + 1
.word _memory_fault + 1
.word _bus_fault + 1
.word _usage_fault + 1

_start:
mov r0, #5
mov r1, #4
add r2, r0, r1

_nmi_handler:
_hard_fault:
_memory_fault:
_bus_fault:
_usage_fault:

也许有人知道有关链接器脚本、CPU 初始化等的教程或书籍?

处理器是:STM32F103VBT6

编程者:OpenOCD。

提前致谢。

最佳答案

来自M3 documentation ;

The vector table at location 0 is only required to have four values:

Stack top address
Reset routine location
NMI ISR location
Hard Fault ISR location.

堆栈顶部地址应该位于地址 0,看来您错过了它。

关于assembly - Cortex-M3 初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9565921/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com