I am learning about assembly and arm from the book titled "The Designers Guide to the Cortex-M Processor Family" by Trevor Martin from Newnes Press. I downloaded Keil uVision and it is defaulting to "Compiler Version 6" while the book appears to have developed the examples with setting to "Compiler Version 5." I am still trying to get all the different versions untangeled between compilers, MDK, and uVision etc... For the time being I would appreciate some guidance with this specific line of code from an example I am trying to run using the default Compiler Version 6 install. The device header file is included in the code.
register unsigned int apsr __asm("apsr");
but the compiler / IDE returns the following:
main.c(62): error: unknown register name 'apsr' in asmregister unsigned int apsr __asm("apsr");
main.c(62): error: unknown register name 'apsr' in asm
The code syntax and register names appear consistent with ARM documentation from this example so I am guessing something changed and I just cant seem to hunt down the differences perhaps? I am puzzling on whether to download the old compiler 5 or just press on updating the examples as I make my way through the book?
The assembler formats are quite different between Arm Compiler 5 (armcc/armasm) and Arm Compiler 6 (armclang).
Full legacy assembler source can be build with Arm Compiler 6 with the -masm=auto (or -masm=armasm if you wish to be specific), however inline assembler in C source must be re-written.
Some guidelines are available here:https://developer.arm.com/documentation/100068/0620/Migrating-from-armcc-to-armclang/Inline-assembly-with-Arm-Compiler-for-Embedded-6
It may be easiest however to start with using the older toolchain, which can be downloaded from:https://developer.arm.com/downloads/view/ACOMP5
And integrated into your Keil environment as described here:https://developer.arm.com/documentation/ka005073
Also - I have moved this question to the Keil specific forum.
Thank you Ronan Synnott - this is very helpful and just what I was hoping for. Sorting it all out was eating up some cycles for me. Much appreciated!