mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-07 21:18:10 +02:00
Fix flash bounds check
This commit is contained in:
@@ -38,13 +38,15 @@
|
||||
/**
|
||||
* @brief Erase the containing sector(s) and program data to flash.
|
||||
*
|
||||
* The data buffer must reside in RAM (not flash). Interrupts
|
||||
* are disabled for the duration of the erase/program cycle.
|
||||
* The write length must be a multiple of FLASH_PAGE_SIZE
|
||||
* (256 bytes); pad with 0xFF if necessary.
|
||||
* The data buffer must reside in RAM (not flash). Guards against
|
||||
* NULL @p data and out-of-range @p offset, returning immediately
|
||||
* if either is invalid. If @p len would exceed the flash boundary
|
||||
* it is clamped to the remaining space. Interrupts are disabled
|
||||
* for the erase/program cycle. The write length must be a multiple
|
||||
* of FLASH_PAGE_SIZE (256 bytes); pad with 0xFF if necessary.
|
||||
*
|
||||
* @param offset byte offset from the start of flash (sector-aligned)
|
||||
* @param data pointer to the source buffer in RAM
|
||||
* @param data pointer to the source buffer in RAM (must not be NULL)
|
||||
* @param len number of bytes to write
|
||||
* @retval None
|
||||
*/
|
||||
@@ -52,8 +54,13 @@ void flash_write(uint32_t offset, const uint8_t *data, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief Read bytes from on-chip flash via the XIP memory map.
|
||||
*
|
||||
* Guards against NULL @p out and out-of-range @p offset, returning
|
||||
* immediately if either is invalid. If @p len would exceed the flash
|
||||
* boundary it is clamped to the remaining space before the read.
|
||||
*
|
||||
* @param offset byte offset from the start of flash
|
||||
* @param out pointer to the destination buffer
|
||||
* @param out pointer to the destination buffer (must not be NULL)
|
||||
* @param len number of bytes to read
|
||||
* @retval None
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user