1. Introduction
The purpose of this guide is to provide an example of the 
process for programming to internal flash on MCXN10 utilizing 
the command write sequence. The process follows the generic flash command 
write sequence (see figure 10 from the FMU chapter  in the Reference Manual) to erase and program the second half of flash (1MB). 

2. Overview
A high level overview of the steps used:
1) Initialize the necessary clocks and registers.
2) Erase one sector (8192 Bytes) of internal flash using the erase sector command.
3) Ensure that sector is erased using read 1s sector command.
4) Program a page of flash within the sector using the program page command.
5) Repeat step 4 until the sector is programmed. (64 times)
6) Repeat these steps starting from step 2 until 1MB of flash is programmed. (128 times)
7) Verify the that the values stored match expected values.
8) Additionally, between each command, check the FSTAT registers for error handling and wait for CCIF to be set before continuing with the next command.

3. Running The Demo
1.  After downloading the project and importing into MCUXpresso, connect a micro USB cable between the PC host and the MCU-Link USB port (J5) on the board
2.  Open a serial terminal with the following settings
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control
3.  Download the program to the target board.
4.  Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
When the example runs successfully, the following message is displayed in the terminal:

Erase of sector 0x100000 -> 0x101fff succeeded
Verify erase of sector 0x100000 -> 0x101fff succeeded
Program and verify of sector 0x100000 -> 0x101fff succeeded



Erase of sector 0x1fe000 -> 0x1fffff succeeded
Verify erase of sector 0x1fe000 -> 0x1fffff succeeded
Program and verify of sector 0x1fe000 -> 0x1fffff succeeded

End of Flash Programming Example!

