29 lines
753 B
C
29 lines
753 B
C
/*
|
|
* flash.c
|
|
*
|
|
* Created on: 29 May 2020
|
|
* Author: Ralim
|
|
*/
|
|
|
|
#include "BSP.h"
|
|
#include "BSP_Flash.h"
|
|
#include "string.h"
|
|
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
|
|
// static uint16_t settings_page[FMC_PAGE_SIZE] __attribute__ ((section (".settings_page")));
|
|
// Linker script doesnt want to play, so for now its hard coded
|
|
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
|
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
|
// #TODO
|
|
return 1;
|
|
}
|
|
|
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
|
return;
|
|
// #TODO
|
|
uint32_t *b = (uint32_t *)buffer;
|
|
uint32_t *b2 = (uint32_t *)SETTINGS_START_PAGE;
|
|
for (int i = 0; i < length / 4; i++) {
|
|
b[i] = b2[i];
|
|
}
|
|
}
|