I need a little digital io for my project since cortex-m is not economical for me I need to know can i use Cortex-a to do some embedded jobs?
Because with equal price you could have more processing power than a Cortex-M.The only benefits of cortex-m is having industrial interfaces like can and etc.
I had worked on external Rams with Arm9 and LPC2478 it was not that hard.
Because i didn't work with Cortex-A yet,I dont know if i can programming Cortex-A like Cortex-M with C language?Could i rewrite my X86 assembly programs for Arm?
I hope you don't have too much x86 to convert! I assume you mean straightforward x86, no SIMD, but in any case it is worth looking at converting to C instead and even for SIMD there are intrinsics one can use in C on ARM to do that.
If you are determined to do an assembler conversion there are a number of differences but mostly they are of the known unknowns kind. One particular gotcha on the line of things you may know but it ain't so is how the carry flag works. See Carry flag - Wikipedia, the free encyclopedia for a description of the difference.
See Carry flag - Wikipedia, the free encyclopedia for a description of the difference.
sjdaliyan, the pertinent operation is subtraction.
Hi sjdaliyan,
If you will not go into high-volume production and your application/project does not have crucial requirement for power consumption or board size, it's fine to use the Cortex-A especially if you already have a Cortex-A board.
The only benefits of cortex-m is having industrial interfaces like can and etc.
Several Cortex-A devices have "industrial interfaces like can and etc.". See Freescale (now part of NXP) i.MX, Texas Instruments Sitara, XILINX Zynq 7000, among others.
The advantage of using Cortex-M for your project is you can have it done with minimal processing capability, memory, and peripherals. This translates to lower power consumption and ease of board design and programming. For simple embedded projects you get excess features with Cortex-A devices. For example you may not need the MMU, DDR controller, external Flash controller, on-chip graphics processor, PCIe interface, SATA, etc. In embedded applications, Cortex-As are best considered in cases where GUI and OS like Linux and Android are needed.
Could i rewrite my X86 assembly programs for Arm?
Yes, you can (or have to) rewrite your x86 assembly programs if you need them in ARM.
The degree of burden in converting x86 assembly language programs to ARM depends on the complexity of your project. Most of the hurdles relate to the roots of these two processors. With x86 from an older era and having evolved from CISC and ARM being newer and RISC. Some of your concerns are:
x86
64-bit: RAX, RBX, RCX, RDX
32-bit: EAX, EBX, ECX, EDX
16-bit: AX, BX, CX, DX
8-bit: AH/AL, BH/BL, CH/CL, DH/DL
ARM
Other minor differences exist; for example, ARM can support four types of stack based on the combination of empty/full and ascending/descending properties.
If you will use your assembly language program along with C, note that the integer data type in x86 is 16-bit while in ARM it is 32-bit.
Regards,
Goodwin
I need realtime os,20-30 timers and fast external clock generating ,could i use Cortex-A?Main reason i want to do that is you can buy a fully assembled Cortex-A board for 5-10 bucks with more power than cortex-m.
20-30 timers are already quite numerous. Luckily, the number of timers that can be supported by a real-time OS might be limited only by the available resources in the processor. The processing speed imposed depends on the task associated with each timer. Cortex-As have the speed to satisfy your requirement, and, as you stated, you can get more processing power per cost on Cortex-As. Your next step is to evaluate the RTOS for your project.
Another not very obvious difference in assembler conversion is the shift operations. On x86 shifts amounts are modulo the register size so <<32 does nothing. On ARM it would zero the register - but it is module 256 which is strange. On the ARM 64 bit architecture it does the same thing as x86. This can catch you out if you write a routine to extract bits from a variable bit position or to rotate a value for instance. The C standard says shifting by the size of the register or more is undefined, but when people write their code they sometimes assume their code is following the standard so this becomes a nasty gotcha.
https://david.wragg.org/blog/2012/11/shift-instructions.html
This is why you might sometime see code like ((w0 >> 1) >> ( 31-sh)) | (w1 << sh)
where sh must be within 0..31. For rotate there's an intrinsic or code on the web.
Yep it does sound like a lot of timers and I guess external clocks too. So it really depends on how much they each have to do and how quickly, but also you'll have storage requirements for all the routines and their data. Are you hoping to use the controller as a low level sequencer for most operations rather than get signals back as each job is done? That's a common sort of job for Cortex M microprocessors but a Cortex A series gives you extra speed and size.