embOS-MPU

embOS-MPU uses the hardware's memory protection unit as well as additional software mechanisms implemented with embOS-MPU to prevent one task from affecting the entirety of the system. This guarantees that even in case a bug occurs in one task, all other tasks and the operating system itself continue execution.

emCrypt

emLib

Internet of Things

Secure, connected, embedded devices build with SEGGER solutions

Software IP components from SEGGER such as emSSL, emSSH, emSecure Crypto libraries, HTTP Web server, and embOS/IP to name a few, can be used as foundations for your securely, connected IoT device. Our software works on any MCU.

Flasher ST7

Flasher ATE

Flasher ATE is an in-circuit-programmer for high volume mass production. The interfaces to start and monitor the programming tasks have been designed with the implementer of the production system in mind.

emLib ECC

emLib ECC is a library that provides functions for detection and correction of data errors. The library can be employed to ensure the reliability of data transferred via digital networks or of the data stored on storage devices. The error detection and correction is performed using a BCH linear block code.

What is BCH?

BCH is a widely used linear block error-correcting code that is capable of detecting and correcting multiple random bit errors. The name of the code comes from the names of scientists that discovered this code: Raj Bose, D. K. Ray-Chaudhuri, and Alexis Hocquenghem. Error-correcting codes work by adding redundant parity-check bits to the information bits which have to be protected against bit errors.

The information bits together with the parity-check bits form a codeword. The parity-check bits are a linear combination (XOR and shift operations) of the information bits and are calculated by the means of a generator polynomial. The generator polynomial is chosen based on the capabilities of the BCH code such as number of correctable bit errors and the size of the data block.

The error correction process uses the property that the Hamming distance ( that is the number of bit positions that have different values) between any two different valid codewords (that is without bit errors) is exactly two times the number of bit errors that can be corrected plus one. Using this property the error correction procedure is able to map a codeword with bit errors to a valid codeword and thus to correct the occurred bit errors. The BCH code is also able to detect but not correct a number of bit errors equal to error correction capability plus one.

Given the capability of BCH code to correct random bit errors this error-correcting code is typically employed for the correction of data stored on NAND flash devices.

Resources

Using emLib ECC

The emLib ECC module has a simple yet powerful API. It can be easily integrated into an existing application. The code is completely written in ANSI-C.

To simply calculate the ECC of contiguous data block, the application would only need to call one function. If two or more distinct data blocks need to be protected by the same ECC, a separate API function can be called which can process a list of data blocks.

All functionality can be verified with standard test patterns using the validation API functions. The functions for generating the lookup tables that are used for different calculation are also included for full transparency.

Performance and resource usage

The following table contains performance values for an emLib ECC release build as tested on a Cortex-M7 running at 217 MHz using lookup tables.

Correction capability

Calculation speed

1 bit correction speed

2 bit correction speed

3 bit correction speed

4 bit correction speed

8 bit correction speed

24 bit correction speed

40 bit correction speed

4-bit

25 MByte / sec

18.5 MByte / sec

2.4 MByte / sec

1.8 MByte / sec

1.4 MByte / sec

-

-

-

8-bit

13 MByte / sec

7.2 MByte / sec

1.2 MByte / sec

0.8 MByte / sec

0.5 MByte / sec

0.3 MByte / sec

-

-

24-bit

2 MByte / sec

0.9 MByte / sec

0.5 MByte / sec

0.4 MByte / sec

0.4 MByte / sec

0.2 MByte / sec

54 KByte/sec

-

40-bit

1.5 MByte / sec

0.4 MByte / sec

0.3 MByte / sec

0.2 MByte / sec

0.2 MByte / sec

0.1 MByte / sec

51 KByte/sec

36 KByte/sec

The following table contains resource usage values for an emLib ECC release build. The lookup tables can be disabled at compile time to reduce the ROM usage. Please note that disabling the lookup tables will reduce the performance of the ECC routines.

Correction capability

Code

Division table

GF tables

Total

4-bit

8.2 KByte

2 KByte

32 KByte

42.2 KByte

8-bit

9.3 KByte

4 KByte

32 KByte

45.3 KByte

24-bit

9.3 KByte

12.2 KByte

64 KByte

85.5 KByte

40-bit

9.4 KByte

18.4 KByte

64 KByte

91.8 KByte

Example code

Using the 4-bit ECC to correct bit errors

This sample shows how to use emLib ECC to correct bit errors. The sample starts by calculating the ECC. On the next step 4 bit errors are forced toggling some bits in the data block. The sample ends by correcting the bit errors using the previously calculated ECC.

Sample applications

emLib ECC includes sample applications to demonstrate its functionality and to provide an easy to use starting point for your application. The source code of these applications is included in the shipment. The following applications are delivered with emLib ECC:

Application name

Target platform

Description

ECCCalcApply.exe

Windows

Command line tool to calculate the ECC of a specified file and to correct the bit errors in a file using the calculated ECC.

ECCCalcApply

ECCCalcApply is a Windows command line tool to calculate the ECC for a specified file and to correct bit errors occurred in it. The calculated ECC is stored to a separate file. The bit correction capability and the block size are configurable.

Used to indicate that error correction should be performed. If omitted the tool calculates ECC.

[-e <ECCFile>]

Optional path to the file where the ECC is stored. If omitted the tool uses <datafile>.ecc as file name.</datafile>

[-h]

Show usage information.

[-q]

Do not display any information.

<DataFile>

Path to the file that contains the data to be protected by ECC.

The screenshot beneath shows how to calculate the ECC of the file "Test.txt" that contains the string "TTTTTTTT". The ECC value is stored in the file "Test.ecc".

The next screenshot shows how the bit errors can be corrected using the previously calculated ECC. First, 4 bit errors are generated by changing the contents of the file "Test.txt" to the string "UUUUTTTT". After the bit error correction is performed the contents of the file "Test.txt" changes back to "TTTTTTTT".