Skip to content

flash: add docs for user defined data #6373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions hal/TARGET_FLASH_CMSIS_ALGO/flash_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,44 @@

#include <stdint.h>

// Target flash algorithm structure
/** Target flash algorithm structure
*/
typedef struct {
const uint32_t init;
const uint32_t uninit;
const uint32_t erase_sector;
const uint32_t program_page;
const uint32_t static_base;
uint32_t *algo_blob;
const uint32_t init; /**< Init function address */
const uint32_t uninit; /**< Uninit function address */
const uint32_t erase_sector; /**< Erase sector function address */
const uint32_t program_page; /**< Program page function address */
const uint32_t static_base; /**< Static base address */
uint32_t *algo_blob; /**< Pointer to flash algo binary blob */
} flash_algo_t;

/** Sector information structure
*/
typedef struct {
const uint32_t start;
const uint32_t size;
const uint32_t start; /**< Sector start address */
Copy link

@li-ho li-ho Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is start the start address of a flash memory block like 0x02000000? is it 32 bit address?

const uint32_t size; /**< Sector size */
Copy link

@li-ho li-ho Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typical range of size is between xxx and yyyy. It should not be less than xxx.

} sector_info_t;

/** Flash configuration structure
*/
typedef struct {
const uint32_t page_size;
const uint32_t flash_start;
const uint32_t flash_size;
const sector_info_t *sectors;
const uint32_t sector_info_count;
const uint32_t page_size; /**< The minimum program page size that can be written */
const uint32_t flash_start; /**< Start address of the flash <0, flash_size) */
const uint32_t flash_size; /**< Flash size. The size is accumulative sum of all sector sizes */
const sector_info_t *sectors; /**< List of sectors - sector can vary in sizes */
const uint32_t sector_info_count; /**< Number of sectors */
} flash_target_config_t;

// Target flash configuration
/** Target flash configuration
*/
struct flash_s {
const flash_target_config_t *target_config;
const flash_algo_t *flash_algo;
};

/** Flash algo argument structure
* Contains all registers that should be preserved
*/
typedef struct {
uint32_t r0;
uint32_t r1;
Expand Down