Skip to content

Commit ba19cd9

Browse files
committed
Internal filesystem displayIO test
1 parent f136ef2 commit ba19cd9

File tree

4 files changed

+124
-9
lines changed

4 files changed

+124
-9
lines changed

ports/stm32f4/boards/STM32F401_fs.ld

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
GNU linker script for STM32F401 with bootloader (such as the Meowbit)
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */
9+
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */
10+
FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */
11+
FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */
12+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K
13+
}
14+
15+
/* produce a link error if there is not this amount of RAM for these sections */
16+
_minimum_stack_size = 2K;
17+
_minimum_heap_size = 16K;
18+
19+
/* Define tho top end of the stack. The stack is full descending so begins just
20+
above last byte of RAM. Note that EABI requires the stack to be 8-byte
21+
aligned for a call. */
22+
_estack = ORIGIN(RAM) + LENGTH(RAM);
23+
24+
/* RAM extents for the garbage collector */
25+
_ram_start = ORIGIN(RAM);
26+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
27+
28+
ENTRY(Reset_Handler)
29+
30+
/* define output sections */
31+
SECTIONS
32+
{
33+
/* The startup code goes first into FLASH */
34+
.isr_vector :
35+
{
36+
. = ALIGN(4);
37+
KEEP(*(.isr_vector)) /* Startup code */
38+
39+
/* This first flash block is 16K annd the isr vectors only take up
40+
about 400 bytes. Micropython pads this with files, but this didn't
41+
work with the size of Circuitpython's ff object. */
42+
43+
. = ALIGN(4);
44+
} >FLASH_ISR
45+
46+
/* The program code and other data goes into FLASH */
47+
.text :
48+
{
49+
. = ALIGN(4);
50+
*(.text*) /* .text* sections (code) */
51+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
52+
/* *(.glue_7) */ /* glue arm to thumb code */
53+
/* *(.glue_7t) */ /* glue thumb to arm code */
54+
55+
. = ALIGN(4);
56+
_etext = .; /* define a global symbol at end of code */
57+
} >FLASH_TEXT
58+
59+
/* used by the startup to initialize data */
60+
_sidata = LOADADDR(.data);
61+
62+
/* This is the initialized data section
63+
The program executes knowing that the data is in the RAM
64+
but the loader puts the initial values in the FLASH (inidata).
65+
It is one task of the startup to copy the initial values from FLASH to RAM. */
66+
.data :
67+
{
68+
. = ALIGN(4);
69+
_sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
70+
*(.data*) /* .data* sections */
71+
72+
. = ALIGN(4);
73+
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
74+
} >RAM AT> FLASH_TEXT
75+
76+
/* Uninitialized data section */
77+
.bss :
78+
{
79+
. = ALIGN(4);
80+
_sbss = .; /* define a global symbol at bss start; used by startup code */
81+
*(.bss*)
82+
*(COMMON)
83+
84+
. = ALIGN(4);
85+
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
86+
} >RAM
87+
88+
/* this is to define the start of the heap, and make sure we have a minimum size */
89+
.heap :
90+
{
91+
. = ALIGN(4);
92+
. = . + _minimum_heap_size;
93+
. = ALIGN(4);
94+
} >RAM
95+
96+
/* this just checks there is enough RAM for the stack */
97+
.stack :
98+
{
99+
. = ALIGN(4);
100+
. = . + _minimum_stack_size;
101+
. = ALIGN(4);
102+
} >RAM
103+
104+
.ARM.attributes 0 : { *(.ARM.attributes) }
105+
}
106+
107+

ports/stm32f4/boards/meowbit_v121/mpconfigboard.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define BOARD_NO_VBUS
4040

4141
// On-board flash
42-
#define SPI_FLASH_MOSI_PIN (&pin_PB15)
43-
#define SPI_FLASH_MISO_PIN (&pin_PB14)
44-
#define SPI_FLASH_SCK_PIN (&pin_PB13)
45-
#define SPI_FLASH_CS_PIN (&pin_PB01)
42+
// #define SPI_FLASH_MOSI_PIN (&pin_PB15)
43+
// #define SPI_FLASH_MISO_PIN (&pin_PB14)
44+
// #define SPI_FLASH_SCK_PIN (&pin_PB13)
45+
// #define SPI_FLASH_CS_PIN (&pin_PB01)

ports/stm32f4/boards/meowbit_v121/mpconfigboard.mk

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ USB_PRODUCT = "Meowbit"
44
USB_MANUFACTURER = "Kittenbot"
55
USB_DEVICES = "CDC,MSC"
66

7-
SPI_FLASH_FILESYSTEM = 1
8-
EXTERNAL_FLASH_DEVICE_COUNT = 1
9-
EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
10-
LONGINT_IMPL = MPZ
7+
# SPI_FLASH_FILESYSTEM = 1
8+
# EXTERNAL_FLASH_DEVICE_COUNT = 1
9+
# EXTERNAL_FLASH_DEVICES = W25Q16JV_IQ
10+
# LONGINT_IMPL = MPZ
11+
12+
INTERNAL_FLASH_FILESYSTEM = 1
13+
LONGINT_IMPL = NONE
1114

1215
MCU_SERIES = m4
1316
MCU_VARIANT = stm32f4
1417
MCU_SUB_VARIANT = stm32f401xe
1518
MCU_PACKAGE = 64
1619
CMSIS_MCU = STM32F401xE
17-
LD_FILE = boards/STM32F401.ld
20+
LD_FILE = boards/STM32F401_fs.ld
1821
TEXT0_ADDR = 0x08010000
1922
TEXT1_ADDR = 0x08020000

ports/stm32f4/supervisor/internal_flash.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232

3333
#include "py/mpconfig.h"
3434

35+
#ifdef STM32F401xE
36+
#define STM32_FLASH_SIZE 0x80000 //512KiB
37+
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB
38+
#endif
39+
3540
#ifdef STM32F411xE
3641
#define STM32_FLASH_SIZE 0x80000 //512KiB
3742
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 //48KiB

0 commit comments

Comments
 (0)