Skip to content

Commit 47a5d83

Browse files
committed
Implement F7 Nucleo
1 parent 80b08bf commit 47a5d83

27 files changed

+3038
-28
lines changed

ports/mimxrt10xx/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ __attribute__((used, naked)) void Reset_Handler(void) {
154154
/* Disable MPU */
155155
ARM_MPU_Disable();
156156

157-
// Copy all of the code to run from ITCM. Do this while the MPU is disabled because we write
157+
// Copy all of the itcm code to run from ITCM. Do this while the MPU is disabled because we write
158158
// protect it.
159159
for (uint32_t i = 0; i < ((size_t) &_ld_itcm_size) / 4; i++) {
160160
(&_ld_itcm_destination)[i] = (&_ld_itcm_flash_copy)[i];

ports/stm/Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,8 @@ C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)
9696
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
9797

9898
# Undo some warnings.
99-
# STM32 apparently also uses undefined preprocessor variables quite casually,
100-
# so we can't do warning checks for these.
101-
CFLAGS += -Wno-undef
102-
# STM32 might do casts that increase alignment requirements.
103-
CFLAGS += -Wno-cast-align
99+
# STM32 HAL uses undefined preprocessor variables, shadowed variables, casts that change alignment reqs
100+
CFLAGS += -Wno-undef -Wno-shadow -Wno-cast-align
104101

105102
CFLAGS += -mthumb -mabi=aapcs-linux
106103

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
/*
2+
******************************************************************************
3+
**
4+
5+
** File : LinkerScript.ld
6+
**
7+
** Author : Auto-generated by System Workbench for STM32
8+
**
9+
** Abstract : Linker script for STM32F767ZITx series
10+
** 2048Kbytes FLASH and 512Kbytes RAM
11+
**
12+
** Set heap size, stack size and stack location according
13+
** to application requirements.
14+
**
15+
** Set memory bank area and size if external memory is used.
16+
**
17+
** Target : STMicroelectronics STM32
18+
**
19+
** Distribution: The file is distributed “as is,” without any warranty
20+
** of any kind.
21+
**
22+
*****************************************************************************
23+
** @attention
24+
**
25+
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
26+
**
27+
** Redistribution and use in source and binary forms, with or without modification,
28+
** are permitted provided that the following conditions are met:
29+
** 1. Redistributions of source code must retain the above copyright notice,
30+
** this list of conditions and the following disclaimer.
31+
** 2. Redistributions in binary form must reproduce the above copyright notice,
32+
** this list of conditions and the following disclaimer in the documentation
33+
** and/or other materials provided with the distribution.
34+
** 3. Neither the name of STMicroelectronics nor the names of its contributors
35+
** may be used to endorse or promote products derived from this software
36+
** without specific prior written permission.
37+
**
38+
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39+
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40+
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41+
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42+
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43+
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44+
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45+
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46+
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47+
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48+
**
49+
*****************************************************************************
50+
*/
51+
52+
/* Entry Point */
53+
ENTRY(Reset_Handler)
54+
55+
/* Highest address of the user mode stack */
56+
_estack = 0x20080000; /* end of RAM */
57+
/* Generate a link error if heap and stack don't fit into RAM */
58+
_Min_Heap_Size = 0x200; /* required amount of heap */
59+
_Min_Stack_Size = 0x400; /* required amount of stack */
60+
61+
/* Specify the memory areas */
62+
MEMORY
63+
{
64+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
65+
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 2048K
66+
}
67+
68+
/* Define output sections */
69+
SECTIONS
70+
{
71+
/* The startup code goes first into FLASH */
72+
.isr_vector :
73+
{
74+
. = ALIGN(4);
75+
KEEP(*(.isr_vector)) /* Startup code */
76+
. = ALIGN(4);
77+
} >FLASH
78+
79+
/* The program code and other data goes into FLASH */
80+
.text :
81+
{
82+
. = ALIGN(4);
83+
*(.text) /* .text sections (code) */
84+
*(.text*) /* .text* sections (code) */
85+
*(.glue_7) /* glue arm to thumb code */
86+
*(.glue_7t) /* glue thumb to arm code */
87+
*(.eh_frame)
88+
89+
KEEP (*(.init))
90+
KEEP (*(.fini))
91+
92+
. = ALIGN(4);
93+
_etext = .; /* define a global symbols at end of code */
94+
} >FLASH
95+
96+
/* Constant data goes into FLASH */
97+
.rodata :
98+
{
99+
. = ALIGN(4);
100+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
101+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
102+
. = ALIGN(4);
103+
} >FLASH
104+
105+
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
106+
.ARM : {
107+
__exidx_start = .;
108+
*(.ARM.exidx*)
109+
__exidx_end = .;
110+
} >FLASH
111+
112+
.preinit_array :
113+
{
114+
PROVIDE_HIDDEN (__preinit_array_start = .);
115+
KEEP (*(.preinit_array*))
116+
PROVIDE_HIDDEN (__preinit_array_end = .);
117+
} >FLASH
118+
.init_array :
119+
{
120+
PROVIDE_HIDDEN (__init_array_start = .);
121+
KEEP (*(SORT(.init_array.*)))
122+
KEEP (*(.init_array*))
123+
PROVIDE_HIDDEN (__init_array_end = .);
124+
} >FLASH
125+
.fini_array :
126+
{
127+
PROVIDE_HIDDEN (__fini_array_start = .);
128+
KEEP (*(SORT(.fini_array.*)))
129+
KEEP (*(.fini_array*))
130+
PROVIDE_HIDDEN (__fini_array_end = .);
131+
} >FLASH
132+
133+
/* used by the startup to initialize data */
134+
_sidata = LOADADDR(.data);
135+
136+
/* Initialized data sections goes into RAM, load LMA copy after code */
137+
.data :
138+
{
139+
. = ALIGN(4);
140+
_sdata = .; /* create a global symbol at data start */
141+
*(.data) /* .data sections */
142+
*(.data*) /* .data* sections */
143+
144+
. = ALIGN(4);
145+
_edata = .; /* define a global symbol at data end */
146+
} >RAM AT> FLASH
147+
148+
149+
/* Uninitialized data section */
150+
. = ALIGN(4);
151+
.bss :
152+
{
153+
/* This is used by the startup in order to initialize the .bss secion */
154+
_sbss = .; /* define a global symbol at bss start */
155+
__bss_start__ = _sbss;
156+
*(.bss)
157+
*(.bss*)
158+
*(COMMON)
159+
160+
. = ALIGN(4);
161+
_ebss = .; /* define a global symbol at bss end */
162+
__bss_end__ = _ebss;
163+
} >RAM
164+
165+
/* User_heap_stack section, used to check that there is enough RAM left */
166+
._user_heap_stack :
167+
{
168+
. = ALIGN(8);
169+
PROVIDE ( end = . );
170+
PROVIDE ( _end = . );
171+
. = . + _Min_Heap_Size;
172+
. = . + _Min_Stack_Size;
173+
. = ALIGN(8);
174+
} >RAM
175+
176+
177+
178+
/* Remove information from the standard libraries */
179+
/DISCARD/ :
180+
{
181+
libc.a ( * )
182+
libm.a ( * )
183+
libgcc.a ( * )
184+
}
185+
186+
.ARM.attributes 0 : { *(.ARM.attributes) }
187+
}
188+
189+

ports/stm/boards/STM32F767_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 STM32F405 via Micropython
3+
*/
4+
5+
/* Specify the memory areas */
6+
MEMORY
7+
{
8+
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */
9+
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 32K /* sector 0 */
10+
FLASH_FS (rx) : ORIGIN = 0x08008000, LENGTH = 96K /* sectors 1,2,3 are 32K */
11+
FLASH_TEXT (rx) : ORIGIN = 0x08010000, LENGTH = 1920K /* sector 4 is 128K, sectors 5,6,7 are 256K */
12+
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 512K
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+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "boards/board.h"
28+
29+
void board_init(void) {
30+
}
31+
32+
bool board_requests_safe_mode(void) {
33+
return false;
34+
}
35+
36+
void reset_board(void) {
37+
38+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2020 Lucian Copeland for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
//Micropython setup
28+
29+
#define MICROPY_HW_BOARD_NAME "NUCLEO STM32F767"
30+
#define MICROPY_HW_MCU_NAME "STM32F767"
31+
32+
#define FLASH_SIZE (0x200000)
33+
#define FLASH_PAGE_SIZE (0x4000)
34+
35+
#define BOARD_OSC_DIV (8)

0 commit comments

Comments
 (0)