Embedded Programming
Embedded Programming
• Memory requires some signals to read from and write to registers and
microprocessor transmits some signals for reading or writing data.
The disadvantage of masked ROM is that no one can change the data on the chip.
• Programmable Read-Only Memory (PROM): These are programmable chips that you
purchase unprogrammed and program only one time. Companies use them to store
firmware and constants in source code.
“They can be used for storing serial numbers, radio configurations or some other data
that is not supposed to be changed by the user," .
Day says PROM is becoming obsolete, in part, because it requires high voltages to
program and operate. Day adds, "Most PROMs require the device manufacturer to
perform the one-time programming and (that) can be a logistical headache.” This can be
especially true for companies that buy and use the memory in their products.
• Flash: Developers use flash memory in embedded systems more often than any other non-
volatile or hybrid memory. The memory is fast for a device to read and low-cost. Devices use
it for storing large files.
Like EEPROM, it is also electrically reprogrammable. But you erase and reprogram flash
memory one sector at a time, compared to byte-by-byte in EEPROM. Some System on a Chips
(SoCs) have flash memories built into them. For external storage, there are two main kinds of
flash memory:
• NAND flash: Engineers most commonly use this flash memory. It is small and often used in
USB flash drives and solid-state disks (SSDs).
• NOR flash: Faster than NAND, NOR flash is more expensive and doesn't last as long as NAND.
Engineers often use NOR flash for Execute-In-Place (XIP) code.
• The language chosen should be in common use. This will ensure that you can
continue to recruit experienced developers who have knowledge of the
language. It will also mean that your existing developers will have access to
sources of information (such as books, training courses, WWW sites) which
give examples of good design and programming practice.
void main(void)
{ // Prepare run function X
X_Init();
while(1) // ‘for ever’ (Super Loop)
{
X(); // Run function X()
}
}
• Task Shifting: Time assigned for shifting tasks in these systems is very less. For
example, in older systems, it takes about 10 microseconds. Shifting one task to
another and in the latest systems, it takes 3 microseconds.
• Use Heavy System Resources: Sometimes the system resources are not so good
and they are expensive as well.
• Complex Algorithms: The algorithms are very complex and difficult for the designer
to write on.
• Device Driver And Interrupt signals: It needs specific device drivers and interrupts
signals to respond earliest to interrupts.
• Thread Priority: It is not good to set thread priority as these systems are very less
prone to switching tasks.
• Every process has its own state and each state include
registers and memory. In many OSs each process is kept in a
separate address space by the memory management unit.
• There will be a possibility of process initiation rate less than the period even in
case of single-CPU systems. If the process execution time is significantly less
than the period, the multiple copies of a program can be initiated in slightly
offset times.
22/04/2024 Embedded C Programming 37
A sequence of processes with high initiation rate
Run state-Executing the codes and getting the system resources at this instance. It will run till it
needs some IPC (input) or wait for an event or till it gets preempted by another higher priority task
than this one.
Blocked state- Execution of task codes suspends after saving the needed parameters into its
context. It needs some IPC (input) or it needs to wait for an event or wait for higher priority task to
block to enable running after blocking.
Deleted Task─ The created task has memory de-allotted to its structure. It frees the memory. Task
has to be re-created.