Allow compile-time override of detected flash size.
On the STM32F103C8, as used in the "blue pill" boards, it has been determined that, despite these only officially having 64KiB flash, it is possible to actually use 128KiB of flash. This commit allows for a preprocessor define STM32F103_OVERRIDE_FLASH_SIZE which, when set, is used as the size of flash in KiB instead of reading it from the FLASH_SIZE_REG.
This commit is contained in:
committed by
NIIBE Yutaka
parent
a4f28ee176
commit
5fe5ff36c4
4
AUTHORS
4
AUTHORS
@@ -2,6 +2,10 @@ Aidan Thornton:
|
|||||||
Added Maple Mini support.
|
Added Maple Mini support.
|
||||||
board/board-maple-mini.h
|
board/board-maple-mini.h
|
||||||
|
|
||||||
|
Jeremy Drake:
|
||||||
|
Modified STM32F103 support.
|
||||||
|
mcu/sys-stm32f103.c
|
||||||
|
|
||||||
Kaz Kojima:
|
Kaz Kojima:
|
||||||
Added STM32 Primer2 support.
|
Added STM32 Primer2 support.
|
||||||
board/board-stm32-primer2.h
|
board/board-stm32-primer2.h
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
2017-08-03 Jeremy Drake <jeremydrake+gnuk@eacceleration.com>
|
||||||
|
|
||||||
|
* mcu/sys-stm32f103.c (flash_write): Allow compile time
|
||||||
|
flash size definition by STM32F103_OVERRIDE_FLASH_SIZE_KB.
|
||||||
|
|
||||||
2017-08-02 NIIBE Yutaka <gniibe@fsij.org>
|
2017-08-02 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* contrib/adc-gnu-linux.c: New.
|
* contrib/adc-gnu-linux.c: New.
|
||||||
|
|||||||
@@ -213,7 +213,11 @@ static int
|
|||||||
flash_write (uint32_t dst_addr, const uint8_t *src, size_t len)
|
flash_write (uint32_t dst_addr, const uint8_t *src, size_t len)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
#if defined(STM32F103_OVERRIDE_FLASH_SIZE_KB)
|
||||||
|
uint32_t flash_end = FLASH_START_ADDR + STM32F103_OVERRIDE_FLASH_SIZE_KB*1024;
|
||||||
|
#else
|
||||||
uint32_t flash_end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024;
|
uint32_t flash_end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dst_addr < FLASH_START || dst_addr + len > flash_end)
|
if (dst_addr < FLASH_START || dst_addr + len > flash_end)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -269,7 +273,11 @@ static void __attribute__((naked))
|
|||||||
flash_erase_all_and_exec (void (*entry)(void))
|
flash_erase_all_and_exec (void (*entry)(void))
|
||||||
{
|
{
|
||||||
uint32_t addr = FLASH_START;
|
uint32_t addr = FLASH_START;
|
||||||
|
#if defined(STM32F103_OVERRIDE_FLASH_SIZE_KB)
|
||||||
|
uint32_t end = FLASH_START_ADDR + STM32F103_OVERRIDE_FLASH_SIZE_KB*1024;
|
||||||
|
#else
|
||||||
uint32_t end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024;
|
uint32_t end = FLASH_START_ADDR + (*FLASH_SIZE_REG)*1024;
|
||||||
|
#endif
|
||||||
uint32_t page_size = 1024;
|
uint32_t page_size = 1024;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user