1594 views|9 replies

155

Posts

0

Resources
The OP
 

What is the difference between C and Embedded C? [Copy link]

It is specifically reflected in the startup process, storage space allocation, hardware access, resource restrictions, etc.

1. Startup process

The common C language compiler on the PC will automatically complete the startup program, so the programmer does not need to make his own startup program. After automatically initializing the CPU and peripherals, the main function is called.

The embedded C language equipped microprocessor is different from the ordinary PC machine, and requires the startup program of the embedded system: it must be able to initialize the hardware platform equipped with the microprocessor and the required data. Therefore, programmers who do embedded development must create a specific startup program.

2. Storage Space

RAM: Random Access Memory is the internal memory that exchanges data directly with the CPU. It can be read and written at any time, and the speed is very fast.

ROM: Read-only memory. The data stored in ROM can only be read out during operation, and cannot be quickly and easily rewritten like random access memory. The data stored in ROM is stable and will not change after power failure.

The biggest difference between RAM and ROM is that the data stored on RAM will automatically disappear after power failure, while ROM will not automatically disappear and can be saved for a long time without power. If you need to save data, you must use ROM (such as a hard disk).

For ordinary C programs, the operating system loads the program and data from the external storage device into RAM to run. Code, data, and stack are all in RAM.

For embedded C programs, since there is no universal operating system, the embedded system must first set the code to ROM and the data and stack to RAM before it can run.

3. Restrictions on hardware access and resources, etc.

For ordinary C, the operating system operates the computer hardware devices, and the application can notify the operating system to perform a specific action so that the application can indirectly operate the hardware through the operating system.

You only need to have a general understanding of how the operating system controls hardware devices. This process is the process of the application calling the function interface. This process is called a system call. The operating system can be directed to work through the interface function provided by the system.

When an embedded system accesses hardware, it is necessary to write an application program that directly operates the hardware.

Since small and power hungry components are used in embedded systems, embedded systems have limited ROM and RAM and less processing power, so one should be aware of the limited resources while writing programs in embedded C.

In C language, the PC can access the system operating system, memory, etc. and can utilize all computer resources.

Latest reply

Thanks to the author for sharing selflessly. Very exciting content, I learned a lot and benefited a lot. Thank you very much.  Details Published on 2024-10-7 11:53
 
 

66

Posts

1

Resources
2
 

Embedded C language requires a specific startup program

 
 
 

1

Posts

0

Resources
3
 

Is the low-level driver programming of consumer electronics such as mobile phones and tablets also considered embedded?

 
 
 

6075

Posts

6

Resources
4
 

The language is still the same, but the application scenarios are different

Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

6841

Posts

11

Resources
5
 

The programming ideas and drivers are the same, there is no difference. If you really want to make a difference, it is that embedded systems are more careful about memory management resources. . .

 
 
 

4771

Posts

12

Resources
6
 

C language can be used in computers to allocate memory and addresses using various underlying libraries and resources. It is equivalent to further operation of the machine. I guess

 
 
 

6069

Posts

4

Resources
7
 

The computer also needs to start a program called BIOS and then boot the operating system (windows, linux, etc.). The C language calls the operating system's functions to operate memory, peripherals, display, etc.

Some embedded systems also need to start programs. For example, there is an operating system running Windows CE, Linux, etc., which also needs to start programs and boot the operating system, similar to the above. C language also calls the operating system's functions to operate memory, peripherals, display, etc.

Some embedded systems run a small real-time operating system, such as FreeRTOS. The boot program, operating system, and C code are compiled together and then downloaded.

Some small embedded systems do not run the operating system directly. There are startup files xxx.s xxx.c and then guide to the main function. Write C code directly in main. Compile them together and then download them.

 
 
 

419

Posts

0

Resources
8
 

The language is still the same, but the application scenarios are different. I agree.

 
 
 

6

Posts

0

Resources
9
 

C language is just a computer language and is not divided into C language and embedded C language.

C is an imperative procedural language that supports structured programming, lexical variable scope, and recursion, with a static type system. It is designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions, all with minimal runtime support. Despite its low-level capabilities, the language is designed to encourage cross-platform programming. A conforming C program is written with portability in mind and can be compiled for a variety of computer platforms and operating systems with only minor changes to its source code.

 
 
 

59

Posts

5

Resources
10
 
Thanks to the author for sharing selflessly. Very exciting content, I learned a lot and benefited a lot. Thank you very much.
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list