mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Draft flash settings
This commit is contained in:
@@ -21,7 +21,7 @@ StackSize = 0x1000; /* 4KB */
|
|||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1024K
|
xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1022K /* 1024K, less the two pages we are using for settings and logo*/
|
||||||
itcm_memory (rx) : ORIGIN = 0x22014000, LENGTH = 16K
|
itcm_memory (rx) : ORIGIN = 0x22014000, LENGTH = 16K
|
||||||
dtcm_memory (rx) : ORIGIN = 0x42018000, LENGTH = 16K
|
dtcm_memory (rx) : ORIGIN = 0x42018000, LENGTH = 16K
|
||||||
ram_memory (!rx) : ORIGIN = 0x4201C000, LENGTH = 80K
|
ram_memory (!rx) : ORIGIN = 0x4201C000, LENGTH = 80K
|
||||||
|
|||||||
@@ -7,17 +7,25 @@
|
|||||||
|
|
||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
#include "BSP_Flash.h"
|
#include "BSP_Flash.h"
|
||||||
|
#include "hal_flash.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#define FMC_PAGE_SIZE ((uint16_t)0x400U)
|
|
||||||
// static uint16_t settings_page[FMC_PAGE_SIZE] __attribute__ ((section (".settings_page")));
|
#define FLASH_PAGE_SIZE ((uint16_t)1024)
|
||||||
// Linker script doesnt want to play, so for now its hard coded
|
|
||||||
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
|
#define SETTINGS_START_PAGE (1023 * 1024) // Hal auto offsets base addr
|
||||||
|
#define SETTINGS_READ_PAGE 0x23000000 + SETTINGS_START_PAGE
|
||||||
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) {
|
||||||
// #TODO
|
flash_erase(SETTINGS_START_PAGE, length);
|
||||||
|
|
||||||
|
flash_write(SETTINGS_START_PAGE, buffer, sizeof(length));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
void flash_read_buffer(uint8_t *buffer, const uint16_t length) {
|
||||||
|
|
||||||
|
/* read 0x00010000 flash data */
|
||||||
|
flash_read(SETTINGS_START_PAGE, buffer, sizeof(length));
|
||||||
return;
|
return;
|
||||||
// #TODO
|
// #TODO
|
||||||
uint32_t *b = (uint32_t *)buffer;
|
uint32_t *b = (uint32_t *)buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user