Breaking problems down into smaller bits really helps to make a solution. The process doesn’t have to be linear like what you see below. Often working on one sub-problem helps to give a better conceptual understanding of the whole, so jumping back and forth between sub-problems is natural (despite it not seeming that way).
Exercise 3b: Make a flash simulator
To figure out where to start, list out the super basic elements. There’s gonna be an array, and the minimum functionality is to read, write, and erase.
Here’s the steps of breaking the problem down into sub-problems, and the sub-problems into further smaller sub-sub-problems. Below this list are my notes. Coding was only done at the very end. The majority of time was figuring out the problem, reading the documentation, and of course - learning!
Breakdown
Step 0: Getting background information
- Downloading the datasheet
- Understanding the block diagram
- Figuring out the nesting… flash, block, sector, page
Step 1: Determining the buffer
- Initializing an array
- Setting its vals and checking max values
- Pointer review
Step 2: Determine the address
- Do not follow this! It is actually not needed, I went down a complete rabbit hole of confusion with this
Step 3: Code the buffer
- Get the coding down right for passing it to functions, reading, writing
- Make a sample test to understand
Step 4: Make erase function
- Review documentation
- Pseudo code
- Find Instruction commands
- Also make the init function (unrelated to erase)
Step 5: Make read function
- Review documentation
- Pseudo code
- Find Instruction commands
Step 6: Make write function
- Review documentation
- Pseudo code
- Find Instruction commands
Step 7: Make test flow
- Based on the test description in the book Making Embedded Systems by Elecia White
Step 8: Make tests to fail
- Brainstorm edge cases and ways it would not work
Step 9: Code it
- Code it, compile it, test it - one new thing at a time
Notebook
Step 0
Step 1
Step 2 (Do not follow!!)
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9
Code
Time
10.75 hours figuring out & learning
3 hours coding
1 hour documenting
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
+1 for the 0-indexed steps
Are you sure? yes | no
😅
Are you sure? yes | no
I am anew user how can i learn hacking
Are you sure? yes | no
C7h/60h means you can send either byte. If you've previous done the write enable command, and none of the sectors are write locked in the status register, sending either byte 0xC7 or 0x60 will cause the entire chip to erase.
Are you sure? yes | no
Hi Paul! Cool! That's good to know about the status register as well. (Oops)
Are you sure? yes | no