eCos Reference Manual
Prev |  | Next

# mcmp

## Name

mcmp -- Compare two segments of memory

## Synopsis

mcmp {-s `location1`} {-d `location1`} {-l `length`} [-1 | -2 | -4]

## Arguments

Name | Type | Description | Default
--- | --- | --- | ---
-s `location1` | Memory address | Location for start of data. | none
-d `location2` | Memory address | Location for start of data. | none
-l `length` | Number | Length of data | none
-1 |  | Access one byte (8 bits) at a time. Only the least significant 8 bits of the pattern will be used. | -4
-2 |  | Access two bytes (16 bits) at a time. Only the least significant 16 bits of the pattern will be used. | -4
-4 |  | Access one word (32 bits) at a time. | -4

## Description

Compares the contents of two ranges of memory (RAM, ROM, FLASH, etc).

## Examples

Compare two buffers which match (result is quiet).

    RedBoot> mfill -b 0x100000 -l 0x20 -p 0xDEADFACE
    RedBoot> mfill -b 0x200000 -l 0x20 -p 0xDEADFACE
    RedBoot> mcmp -s 0x100000 -d 0x200000 -l 0x20

Compare two buffers which don't match. Only the first non-matching element is displayed.

    RedBoot> mcmp -s 0x100000 -d 0x200000 -l 0x30 -2
    Buffers don't match - 0x00100020=0x6000, 0x00200020=0x0000

Prev | Home | Next
load | Up | mfill