Skip to content

Commit 8364c60

Browse files
authored
Merge pull request #2570 from hierophect/stm32-f407-disco
STM32: Add STM32F4Discovery support
2 parents e159829 + c443691 commit 8364c60

File tree

22 files changed

+1975
-2
lines changed

22 files changed

+1975
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ jobs:
219219
- "stm32f411ce_blackpill"
220220
- "stm32f411ve_discovery"
221221
- "stm32f412zg_discovery"
222+
- "stm32f4_discovery"
222223
- "stringcar_m0_express"
223224
- "teensy40"
224225
- "teknikio_bluebird"

ports/stm32f4/boards/STM32F407_fs.ld

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

ports/stm32f4/boards/feather_stm32f405_express/mpconfigboard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
#define MICROPY_HW_NEOPIXEL (&pin_PC00)
3636

37+
#define BOARD_OSC_DIV 12
38+
3739
// On-board flash
3840
#define SPI_FLASH_MOSI_PIN (&pin_PB05)
3941
#define SPI_FLASH_MISO_PIN (&pin_PB04)

ports/stm32f4/boards/pyboard_v11/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define FLASH_SIZE (0x100000)
3333
#define FLASH_PAGE_SIZE (0x4000)
3434

35+
#define BOARD_OSC_DIV 12
3536

3637
#define DEFAULT_I2C_BUS_SCL (&pin_PB06)
3738
#define DEFAULT_I2C_BUS_SDA (&pin_PB07)

0 commit comments

Comments
 (0)