We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone,
First of all, I'm new when it comes to ARM assembly. I actually have some pieces of code written for ARM instruction set, but my target is a Cortex-M4 architecture using Thumb-2 instruction set. Do I have to re-write the whole code, change some of it or keep it the way it is?
Hi,
You may not have to re-write it all. If you are using ARM tools (as opposed to third-party tools), then they will support an assembler syntax called UAL (Unified Assembly Language) which is a common syntax supported by both ARM and Thumb instruction sets. Code written in UAL will assembler without error for both ARM and Thumb.
You can see some pointers about UAL in the "Writing ARM Assembler Language" manual which comes with the ARM tools (you can download this from infocenter.arm.com). In particular, look at the chapter on "Assembly language changes after RVCTv2.1" which describes the differences between UAL and pre-UAL syntax.
If your ARM code is recent, it may well have been written in UAL. In that case, you just need to re-assemble it. If it isn't in UAL, then you may need to rewrite some of the instructions. But it shouldn't be too difficult.
Hope this helps.
Chris