QuickEmbeddedTips is the source for Embedded Tips and Tricks.

If you want to add your tips, please register here and start publishing your content instantly. If you have questions, please contact us by email: info [at] quickembeddedtips [dot] com or use our contact form.

What is an lvalue and rvalue in C

Lvalue or location value is an address that is stored into while rvalue is the "read" value, ie., value of a constant or the value stored at a location. In the assignment

a = 31;

we have the lvalue of a used on the left hand side and the integer contant value 31 assigned to this location.

In the assignment

fromELF usage tips

fromELF is the ARM image conversion utility.
supports plain binary, Motorola 32-bit S-record format, Intel Hex-32 format,Byte Oriented Hex format.

To convert an ELF file to a plain binary (.bin) file, enter:
fromelf --bin -o outfile.bin infile.axf

To produce a plain-text output file that contains the disassembled version of an ELF file

ARM compiler cheatsheet

armcc [PCS-options] [source-language] [search-paths] [PCH-options]
[preprocessor-options] [syntax-checking] [C++-language] [output-format]
[target-options] [debug-options] [code-generation-options]
[default-object-extension] [diagnostic-options] [warning-options]
[additional-checks] [error-options] [source]

[PCS-options]

Semaphore basics for embedded professionals

Semaphores, another important contribution by E. W. Dijkstra,
can be viewed as an extension to mutex locks. A semaphore is an object
with two methods Wait and Signal, a private integer counter and a
private queue (of threads). The semantics of a semaphore is very simple.
Suppose S is a semaphore whose private counter has been

Low cost flash microcontroller with a built-in 10-base-T ethernet MAC+PHY, and reasonable program memory (32-64k)

Low cost flash microcontroller with a built-in 10-base-T ethernet MAC+PHY, and reasonable program memory(32-64k)

Microchip ENC28J

CodeSourcery Vs FSF ARM toolchain

CodeSourcery give you free toolchain but you have to pay for debugger and Eclipse IDE support. FSF is free (as in freedom !)

How to Reduce the ROM Code Size.

Some general tips for reducing the Code size for firmware.

1) Use the Map file.
Configure the tool to generate a MAP file. Most linker/locators will generate a fairly detailed map file, which you can use to hunt down the biggest targets for code reduction.


2) Use compiler optimization.

ARM7 gcc Toolchains with IDE and Debug support for beginners

1) GNUARM toolchain.
http://www.gnuarm.com/

2) Rowley provides a professional quality IDE,Debugger for arm GCC toolchain at a very

reasonable price.

Why should we do memory remapping in ARM7 ?

why should we do memory remapping in ARM7 ?

Most ARM cores support two vector locations 0x0 or 0xFFFF0000, controlled via a signal sampled at reset and a bit in CP15. Lets say that the core is configured to have its vectors at 0x0, then as the core comes out of reset it will start fetching instructions from 0x0. There has to some valid code at this position. So generally you would require to have a nonvolatile memory at this location.

Design Tips for embedded Software engineers

These tips can be used while designing any embedded Real Time application

Process Tips
1) Follow the Coding convention religiously. These include variable,Data structure, Functions names etc. It makes the code easy to maintain.
2) Have Code review and discussion with fellow programmers.
3) Prepare the documentation before implementations.

Design Tips
1) The detailed design should cover all the functionalities with a separate diagram for each. The diagram should display the Process-Flow, data flow, dependency graphs, data relationship. Any State machines should be explained separately.
2) The design should mention the worst case timings for servicing functionalities. The system behaviour can then be confirmed to this while testing.
3) Perform memory analysis to compute the memory usage. While testing this should be confirmed
4) Possible unhandled error cases should be mentioned separately with the reason for their exclusion.

Coding
1) Avoid using global variables. If needed encapsulate all of them into a single data structure.
Now Control the access of this data structure to prevent race-conditions.
2) Avoid fine grain optimization during the first implementation. Keep it simple.
3) Use timers for delay than empty loops. You ca poll the count down value of a timer instead.
4) Use StateMachine, Lookuptables than using many if-else statements.

Testing Tips
1) Measure the execution timings of critical portions of code.
2) Measure and record the interrupt latency for the system.

How do RTOS kernel keep track of time ?

How do RTOS kernel keep track of time ?

Every kernel provides a mechanism to keep track of time. This is done by a hardware timer which interrupts the CPU periodically.
The ISR for this timer invokes a service provided by the kernel, which is responsible to update time dependent variables. This ISR is generally called a Clock Tick ISR. Kernel maintains a special list to keep track of tasks that are waiting for the time to expire. This is called delayed task list.

What is Interrupt nesting?

Q: What is interrupt nesting?

Pre-Emption of low priority Interrupt by another high priority interrupt is known as Interrupt nesting.
If a high priority interrupt pre-empts the lower priority interrupt, then the higher priority Interrupt context would be saved on the previous lower priority one. We now say the depth is two and nesting is two.

Q: How is nesting of interrupt handled ?

Most architectures have two stacks. Task and Interrupt stack. The size of interrupt stack is decided by the maximum depth of nesting. If an ISR gets interrupted, the interrupt stack saves the context of the first interrupt service routine. The context here is generally all the registers, PC and local variables. When the second ISR executes its return from interrupt instruction, it pops back to the first ISR, stack,registers and interrupt level. Now when this first ISR routine executes return from interrupt, then it may back to the task level, the stack is restored to the task stack and the registers and processor level go back to the normal task level.

Q: How to avoid nesting of interrupts?

Nesting of interrupts can be avoided by disabling the interrupt as soon as interrupt service routine is invoked.
In most architecture, interrupts are automatically disabled on invoking ISR.

Q:For a level triggered interrupt, if the interrupts are not disabled, will it result in repeated invoking of ISR?

Yes. If an interrupt is level triggered, then you need to reset the level
when the interrupt is serviced. IF you fail to reset the interrupt
request, the interrupt will recur when interrupts (at that level) are
re-enabled. Usually that would be when the ISR returns.

Which -mcpu option must be used to gcc-compile for an arm processor ?

Which -mcpu option must be used to gcc-compile for an arm processor ?

-mcpu specifies the name of the target ARM processor. GCC uses this name to determine what kind of instructions it can emit when generating assembly code.
These are the -mcpu options used for ARM processors with gcc.

Resources for MSP430F2013 chip

Here are the resources for MSP430F2013 chip, where all components are using I2C bus to communicate.

Software I2C Slave Using the MSP430

This application report describes the design of a software I2C slave that can run up to 100-kbps using an MSP430 MCU. This software I2C uses a small amount of MCU resources so that it can be implemented on lower-end MSP430 devices. The interface to the I2C bus uses two I/O pins; and the code size, including flash memory and RAM, is small. Low power is built into the software design. The application of this software I2C is not just confined to low-end products.

Implementing SMBus using MSP430 Hardware I2C

This application report describes the implementation of the system management bus (SMBus) using the MSP430 hardware I2C peripheral. SMBus is used as a communication

link for smart batteries, power related devices and a wide variety of other system devices. This report includes the support for master and slave protocols in a SMBus communication system.

Interfacing an EEPROM to the MSP430 I2C Module

Interfacing an EEPROM to the MSP430 I2C Module Application Report

 

 

Syndicate content