-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- binaries now show "Fixed Pin Information" in picotool - removed unused wozmon header file MCP: - added flash size detection - fixed problems in CPU detection - "cpu" command renamed to "sys", since output is expanded - command line interface now has (short) history and line editing - "reboot" command fixed and renamed to "cold" Signed-off-by: Sven Oliver Moll <svolli@svolli.de>
- Loading branch information
Sven Oliver Moll
committed
Aug 11, 2023
1 parent
59d3cd2
commit 1c16328
Showing
14 changed files
with
355 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2023 SvOlli | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <pico/stdlib.h> | ||
#include <hardware/flash.h> | ||
|
||
#include "fake_eeprom.h" | ||
|
||
static const uint8_t *flash_target_base = (const uint8_t *)XIP_BASE; | ||
|
||
uint32_t flash_size_detect() | ||
{ | ||
uint32_t size; | ||
/* sizes: 1MB 64MB */ | ||
for( size = (1 << 20); size < (1 << 27); size <<= 1 ) | ||
{ | ||
if( !memcmp( flash_target_base, flash_target_base + size, FLASH_PAGE_SIZE ) ) | ||
{ | ||
break; | ||
} | ||
} | ||
|
||
return size; | ||
} | ||
|
||
static uint32_t last_flash_block_start() | ||
{ | ||
static uint32_t last_block = 0; | ||
if( !last_block ) | ||
{ | ||
last_block = flash_size_detect() - FLASH_PAGE_SIZE; | ||
} | ||
return last_block; | ||
} | ||
|
||
void settings_write( void* memory, uint32_t size ) | ||
{ | ||
assert( size <= FLASH_PAGE_SIZE ); | ||
flash_range_erase(last_flash_block_start(), FLASH_SECTOR_SIZE); | ||
flash_range_program(last_flash_block_start(), memory, FLASH_PAGE_SIZE); | ||
} | ||
|
||
void settings_read( void* memory, uint32_t size ) | ||
{ | ||
assert( size <= FLASH_PAGE_SIZE ); | ||
memcpy( memory, flash_target_base + last_flash_block_start(), size ); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) 2023 SvOlli | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#ifndef FAKE_EEPROM_H | ||
#define FAKE_EEPROM_H FAKE_EEPROM_H | ||
|
||
uint32_t flash_size_detect(); | ||
void settings_write( void* memory, uint32_t size ); | ||
void settings_read( void* memory, uint32_t size ); | ||
|
||
#endif |
Oops, something went wrong.