简体   繁体   English

基于cortex m3的汇编代码有区别吗?

[英]Is there a difference at assembly code of the based cortex m3?

For example... Are the assembly language of stm32l152 (based on cortex m3) and the assembly language of stm32f103 the same?比如……stm32l152(基于cortex m3)的汇编语言和stm32f103的汇编语言是一样的吗? And is the assembly language of the all mcu of the based cortex m3 the same?并且基于cortex m3的所有MCU的汇编语言是一样的吗?

I know that the peripheral device is different but how about the assembly language?我知道外围设备是不同的,但是汇编语言呢? Is it different?有什么不同吗?

To clarify your question, there is an important difference between the instruction set and the assembly language.为了澄清您的问题,指令集和汇编语言之间存在重要区别。 The instruction set (as the name implies) is the set of instructions that the processor understands.指令集(顾名思义)是处理器能够理解的指令集。 An assembly language is a low-level programming language that provides (mostly) 1:1 correspondence between its mnemonics and actual instructions.汇编语言是一种低级编程语言,它在助记符和实际指令之间提供(大部分)1:1 对应关系。

The instruction set of all Cortex-M3 processors is the same.所有 Cortex-M3 处理器的指令集都是相同的。 It is a subset of that found on the Cortex M4 and M4F, and a superset of that found on the Cortex M0 and M0+.它是 Cortex M4 和 M4F 上的子集,也是 Cortex M0 和 M0+ 上的超集。 It is also binary compatible with those devices, so code written for an M3 will run unmodified on an M4F.它还与这些设备二进制兼容,因此为 M3 编写的代码无需修改即可在 M4F 上运行。

Assembly languages differ between toolchains and architectures, so there's no simple answer to your original question unless you specify a toolchain;汇编语言在工具链和架构之间有所不同,因此除非您指定工具链,否则您的原始问题没有简单的答案; but for example if you're using ARMASM then yes, the assembly language using that toolchain is the same for all Cortex-M3 devices.但是例如,如果您使用的是 ARMASM,那么是的,使用该工具链的汇编语言对于所有 Cortex-M3 设备都是相同的。

As you noted in your question there will be significant peripheral differences between processors from different manufacturers however, so even though two given devices from different manufacturers might share an instruction set it would be difficult to contrive any useful baremetal software that actually ran on them both.正如您在问题中指出的那样,来自不同制造商的处理器之间存在显着的外围差异,因此即使来自不同制造商的两个给定设备可能共享一个指令集,也很难设计出任何在它们两者上实际运行的有用裸机软件。 If you're using an operating system that provides full abstraction of hardware features, then your application code stands a good chance of being binary compatible between the two but I'm not sure how often that's helpful.如果您使用的操作系统提供完全抽象的硬件功能,那么您的应用程序代码很有可能在两者之间实现二进制兼容,但我不确定这是否有用。

This question is quite easily answered by reading the ARM documentation, which I think explains the downvotes - but if English is not your first language I could understand if the documentation seemed a bit daunting.这个问题很容易通过阅读 ARM 文档来回答,我认为这可以解释反对意见 - 但如果英语不是你的第一语言,我可以理解文档看起来有点令人生畏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM