Test Driven Development for Embedded C by James W. Grenning — Erase Suspend Resume Flowchart

Rohit Imandi
2 min readOct 8, 2023

--

This post describes my solution to the exercise on implementation of Erase Suspend and Resume flowchart of m28w160ect (a flash memory) mentioned in chapter 10 of the book (link). I used the CppUTest harness for the tests. The source files for CppUTest and Unity can be downloaded from here.

Erase Suspend Resume (ERS) Algorithm

The Erase Suspend & Resume flowchart (shown below) is given on pg-44 of the datasheet.

Erase Suspend Resume Flowchart

Design Notes

  1. Following the book, the status register address is set to 0x00
  2. The device specific register addresses and status flags are defined in m28w160ect.h
  3. The “any_address” used in write and read operations mentioned in the flowchart is defined by the variable randomAddr = 0x01 in ERSTests.cpp
  4. Flash_Create() and Flash_Destroy() functions are dummy functions created to maintain consistency

Test List

  1. Erase resume succeeds immediately — DONE
  2. Erase suspend succeeds immediately — DONE
  3. Erase resume/suspend does not succeed immediately — DONE

In summary, the test list and design is very similar to the test list created for write operation explained in chapter 10. I couldn’t think of any additional tests for this exercise.

--

--

Rohit Imandi
Rohit Imandi

Written by Rohit Imandi

Electronics and Embedded Systems | Programmer | Software Development

No responses yet