mirror of
https://github.com/andreili/katapult.git
synced 2025-08-24 03:44:06 +02:00
stm32: Avoid alignment issues in flash_read_block()
Use a regular memcpy() call to avoid issues with pointer alignment. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
566e9ccf3a
commit
468b756f8d
@ -4,9 +4,10 @@
|
|||||||
//
|
//
|
||||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
#include "flash.h"
|
#include <string.h> // memcpy
|
||||||
#include "autoconf.h"
|
#include "autoconf.h" // CONFIG_MACH_STM32F103
|
||||||
#include "internal.h"
|
#include "flash.h" // flash_write_page
|
||||||
|
#include "internal.h" // FLASH
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
flash_get_page_size(void)
|
flash_get_page_size(void)
|
||||||
@ -72,8 +73,5 @@ flash_write_page(uint32_t page_address, uint16_t *data)
|
|||||||
void
|
void
|
||||||
flash_read_block(uint32_t block_address, uint32_t *buffer)
|
flash_read_block(uint32_t block_address, uint32_t *buffer)
|
||||||
{
|
{
|
||||||
uint32_t* block_addr = (uint32_t*)block_address;
|
memcpy(buffer, (void*)block_address, CONFIG_BLOCK_SIZE);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < CONFIG_BLOCK_SIZE / 4; i++)
|
|
||||||
buffer[i] = block_addr[i];
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user