简体   繁体   中英

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? And is the assembly language of the all mcu of the based cortex m3 the same?

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.

The instruction set of all Cortex-M3 processors is the same. 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+. It is also binary compatible with those devices, so code written for an M3 will run unmodified on an 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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