CMSIS-Pack
Version 1.5.0
Delivery Mechanism for Software Packs
|
Blank Check
The following functions are available for creating new Flash programming algorithms:
Function Name | Indication | Description |
---|---|---|
BlankCheck | optional | Check and compare patterns. |
EraseChip | optional | Delete entire Flash memory content. |
EraseSector | mandatory | Delete Flash memory content of a specific sector. |
Init | mandatory | Initialize and prepare device for Flash programming. |
ProgramPage | mandatory | Write the application into the Flash memory. |
UnInit | mandatory | De-initialize the microcontroller after one of the Flash programming steps. |
Verify | optional | Compare Flash memory content with the program code. |
The following diagrams show how the functions of the Flash Programming Algorithms are executed by a development tool.
The Flash Erase sequence is executed to erase the Flash content.
The Flash Program sequence is executed to program the Flash memory.
The Flash Verify sequence is executed to verify the content after flash programming.
adr | Block start address |
sz | Block size in bytes |
pat | Pattern to compare |
The function BlankCheck can be used to check whether the specified block is empty, or whether the content is equal to a specific pattern defined in the argument pat.
The argument adr specifies the start address of the block that is to be verified.
The argument sz specifies the size of the block that is to be verified.
Code Example
The function EraseChip deletes the content of the entire Flash memory. It is invoked whenever the uVision menu Flash - Erase is used, or whenever an attempt is made to download the program to Flash and the option Erase Full Chip has been set in the Flash Download Setup dialog. If this function is missing in the Flash Programming Algorithm, the EraseSector function is executed until the entire content of the Flash memory area has been deleted.
Code Example
adr | Sector address |
The function EraseSector deletes the content of the sector starting at the address specified by the argument adr. The function is invoked whenever the uVision menu Flash - Erase is used, or whenever an attempt is made to download the program to Flash and the option Erase Sectors has been set in the Flash Download Setup dialog.
Code Example
adr | Device base address |
clk | Clock frequency (Hz) |
fnc | Function code |
The function Init initializes the microcontroller for Flash programming. It is invoked whenever an attempt is made to download the program to Flash.
The argument adr specifies the base address of the device.
The argument clk specifies the clock frequency for prgramming the device.
The argument fnc is a number:
Thus, different initialization sections can be implemented for each individual Flash programming step.
Code Example
adr | Page start address |
sz | Page size |
buf | Data to be written |
The function ProgramPage is used to write code into the Flash memory. It is invoked whenever an attempt is made to download a program to Flash.
The argument adr specifies the start address of the page that is to be programmed.
The argument sz specifies the size of the page that is to be programmed.
The argument buf points to the buffer containing the data to be programmed.
Code Example
fnc | Function code |
The function UnInit de-initializes the microcontroller and is invoked at the end of an erasing, programming, or verifying step.
The argument fnc is a number:
Thus, different de-initialization sections can be implemented for each individual Flash programming step.
Code Example
adr | Start address |
sz | Size in bytes |
buf | Data to be compared |
The function Verify compares the content of the Flash memory with the program code *buf.
The argument adr specifies the start address for the verification.
The argument sz specifies the size of the verification.
The argument buf points to the buffer containing the data to be verified.
Code Example