Skip to content

Commit

Permalink
Correct code writing single bytes to flash (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Mar 13, 2018
1 parent 4683372 commit f7d7917
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ int flash_lld_write(uint32_t startAddress, uint32_t length, const uint8_t* buffe
}
else
{
// program single byte
*cursor = *buffer++;
// program single byte
*((__IO uint8_t*)cursor++) = *((uint8_t*)buffer);
}

// wait for program operation to be completed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ int flash_lld_write(uint32_t startAddress, uint32_t length, const uint8_t* buffe
// proceed to program the flash by setting the PG Bit
SET_BIT(FLASH->CR, FLASH_CR_PG);

*cursor = *buffer++;
*((__IO uint8_t*)cursor++) = *((uint8_t*)buffer);

#if defined(STM32F756xx) || defined(STM32F746xx) || defined(STM32F745xx) || defined(STM32F767xx) || \
defined(STM32F769xx) || defined(STM32F777xx) || defined(STM32F779xx) || defined(STM32F722xx) || \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ int flash_lld_write(uint32_t startAddress, uint32_t length, const uint8_t* buffe
}
else
{
// program single byte
*cursor = *buffer++;
// program single byte
*((__IO uint8_t*)cursor++) = *((uint8_t*)buffer);
}
}
}
Expand Down

0 comments on commit f7d7917

Please sign in to comment.