Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Use C or Assembly language to program ARM?

Status
Not open for further replies.

yuenkit

Advanced Member level 4
Joined
Jan 20, 2005
Messages
107
Helped
6
Reputation
12
Reaction score
1
Trophy points
1,298
Activity points
1,047
assembly versus c for arm

Use C or Assembly language to program ARM?

Is C portable among different compiler? Any one use Assembly to code ARM?
 

I am using C basically, but when i need to use assembly, i am using the asm function:

asm("put your assembly code here")

in cases where assembly code is huge and cannot be simply put into paranthesis, i use a different .s file to store it and call it from the c code itself.

but you are also mentioning about porting other compilers? this assembly portion makes thing difficult when it comes to porting other architectures. The best is to use c, and only c if you can.

here is a good book about arm programming, i do not know whether it is posted on the form:

https://www.amazon.com/gp/product/1558608745/002-6520285-5096858?v=glance&n=283155

regards.
 

Hi

Both are good ...

C Has certain advantage Asm too had advantage. Better try C

Thx+
 

Hi

I can recomend you to use C anguage when writing for ARM

C language is more portable the ASM.
And since the ARM controller/Processor is A FAST one (can reach up 58 MIPS) there is no need for ASM language.
Unless you are using verey tide timming access - you wish to squiz the processor for most of his power.

All the best

Bobi
 

Hi,

OK. ASM or C the old question again :). If you say C because its portable then I have to say. Nonsense, I write ASM code and have proven in the past that it was portable among different MCU/CPU's. Why ?. Since C and ASM code are both languages use in embedded systems most of the times the interaction with hardware is more a problem and makes the language used very tight to the MCU/CPU used. All MCU/CPU's have ASM instructions that look the same, only a different name. I have done, search/replace and worked 100% error free on ASM code.

But Now the question ?. What to use.

If your application needs to be very in expensive, memory is expensive, and you have to write your program as small as possible. The choice is ASM. If your code space is not expensive or the CPU/MCU you use has more than enough (like most ASM's) then go for C. (Makes like easy). I wrote a AES128 Bit encryption transmission system with packets in an PIC12F629 (1 K) memory I used ASM since C would make this impossible. AES128 implementation is 400 Bytes !!!!!!. In C this would be 4 K !

regards,

Paul.
 

If u understand deeply how the compile will deal with your C code, u will find there're few cases that u have to write asm code.

For me, I only write asm for system init process, such as exception handlers, program-models' stacks initialize, system clock initialize, memory controller initialize ... Then jump to C program. Sometimes, we still need inline asm code in C program for Coprocessor process, such as WFI, mmu/cache config...
 

I am asking this because I have experience in programming PIC (8-bit) uC in both C and Assembly. The nature of 8-bit uC makes ASM a more suitable language to program.

for ARM, since it is 16/32bit, which is same as our computer CPU, this makes me think that C would be a better choice, as for computer programming, we hardly use Assembly.

I was told that motorola is using ARM for their cell phone, is it true? Most people are using C or mixture of both?
 

Hi, The ARM core is in lots of the following products:

GSM/UMTS Phones.
CD/CD-RW/DVD/DVD-RW drivers for PC (not home)
Digital photo cam.
Organizers
etc...

regards,

Paul.

PS: They are all programmed in C. Since most of the code is portable and can be reused (very important in industry).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top