File tree 9 files changed +319
-0
lines changed
9 files changed +319
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Makefile for custom MicroPython stm32 board.
2
+
3
+ # ###############################################################################
4
+ # Define your settings here.
5
+
6
+ # The board name.
7
+ BOARD ?= CUSTOM_PYBD_SF2
8
+
9
+ # Location of MicroPython repository.
10
+ MICROPY_TOP ?= $(abspath ../../lib/micropython)
11
+
12
+ # ###############################################################################
13
+ # Define your targets here.
14
+
15
+ all : firmware
16
+
17
+ # ###############################################################################
18
+ # Items below this line do not generally need to be changed.
19
+
20
+ BOARD_DIR = $(abspath .)
21
+ BUILD = $(abspath build)
22
+
23
+ include $(MICROPY_TOP ) /py/mkenv.mk
24
+ include $(MICROPY_TOP ) /py/mkrules.mk
25
+
26
+ firmware :
27
+ $(Q )$(MAKE ) -C $(MICROPY_TOP ) /ports/stm32 \
28
+ PROJECT_TOP=$(abspath ../..) \
29
+ BOARD=$(BOARD ) \
30
+ BOARD_DIR=$(BOARD_DIR ) \
31
+ BUILD=$(BUILD )
32
+
33
+ deploy :
34
+ $(PYTHON ) $(MICROPY_TOP ) /tools/pydfu.py -u $(BUILD ) /firmware.dfu
Original file line number Diff line number Diff line change
1
+ This directory contains board definition files for a customised PYBD-SF2W board.
2
+ It customises it as follows:
3
+ - Default SYSCLK at 96MHz
4
+ - Bluetooth support not included
5
+ - Relocates ISR vector table to RAM
6
+ - Prints a message before running boot.py
7
+
8
+ First, make sure all submodules are initialised in the micropython repository:
9
+
10
+ $ git -C ../../lib/micropython submodule update --init lib/lwip lib/mbedtls lib/stm32lib
11
+
12
+ Then build the firmware with:
13
+
14
+ $ make
15
+
16
+ To deploy the firmware to the board, make sure the board is in it's bootloader then run:
17
+
18
+ $ make deploy
Original file line number Diff line number Diff line change
1
+ // Use PYBD_SF2 bdev implementation.
2
+ #include "boards/PYBD_SF2/bdev.c"
Original file line number Diff line number Diff line change
1
+ #include "py/mphal.h"
2
+ #include "boardctrl.h"
3
+
4
+ // Use PYBD_SF2 implementation, but add extra initialisation.
5
+ #include "boards/PYBD_SF2/board_init.c"
6
+
7
+ void board_early_init_custom (void ) {
8
+ // Call PYBD_SF2's board init function.
9
+ board_early_init ();
10
+
11
+ // Relocate ISR vector table to ITCM RAM (can't use memcpy because dest=0).
12
+ __disable_irq ();
13
+ const uint32_t * src = (void * )SCB -> VTOR ;
14
+ uint32_t * dest = RAMITCM_BASE ;
15
+ for (unsigned int i = 0 ; i < 128 ; ++ i ) {
16
+ * dest ++ = * src ++ ;
17
+ }
18
+ SCB -> VTOR = RAMITCM_BASE ;
19
+ __enable_irq ();
20
+ }
21
+
22
+ int board_run_boot_py (boardctrl_state_t * state ) {
23
+ mp_printf (& mp_plat_print , "Starting custom board\n" );
24
+ return boardctrl_run_boot_py (state );
25
+ }
Original file line number Diff line number Diff line change
1
+ include ("$(MPY_DIR)/extmod/uasyncio/manifest.py" )
Original file line number Diff line number Diff line change
1
+ // Take PYBD_SF2 as base configuration.
2
+ #include "boards/PYBD_SF2/mpconfigboard.h"
3
+
4
+ #undef MICROPY_HW_BOARD_NAME
5
+ #undef MICROPY_HW_CLK_PLLM
6
+ #undef MICROPY_HW_CLK_PLLN
7
+ #undef MICROPY_HW_CLK_PLLP
8
+ #undef MICROPY_HW_CLK_PLLQ
9
+ #undef MICROPY_HW_FLASH_LATENCY
10
+ #undef MICROPY_BOARD_EARLY_INIT
11
+
12
+ #define MICROPY_HW_BOARD_NAME "Custom PYBD-SF2W"
13
+ #define MICROPY_BOARD_EARLY_INIT board_early_init_custom
14
+ #define MICROPY_BOARD_RUN_BOOT_PY board_run_boot_py
15
+
16
+ // HSE is 25MHz, run SYS at 96MHz
17
+ #define MICROPY_HW_CLK_PLLM (25)
18
+ #define MICROPY_HW_CLK_PLLN (192)
19
+ #define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
20
+ #define MICROPY_HW_CLK_PLLQ (4)
21
+ #define MICROPY_HW_FLASH_LATENCY (FLASH_LATENCY_3)
22
+
23
+ struct _boardctrl_state_t ;
24
+ void board_early_init_custom (void );
25
+ int board_run_boot_py (struct _boardctrl_state_t * state );
Original file line number Diff line number Diff line change
1
+ # MCU settings
2
+ MCU_SERIES = f7
3
+ CMSIS_MCU = STM32F722xx
4
+ MICROPY_FLOAT_IMPL = single
5
+ AF_FILE = boards/stm32f722_af.csv
6
+ LD_FILES = boards/PYBD_SF2/f722_qspi.ld
7
+ TEXT0_ADDR = 0x08008000
8
+ TEXT1_ADDR = 0x90000000
9
+ TEXT0_SECTIONS = .isr_vector .text .data .ARM
10
+ TEXT1_SECTIONS = .text_ext
11
+
12
+ # MicroPython settings
13
+ MICROPY_PY_LWIP = 1
14
+ MICROPY_PY_NETWORK_CYW43 = 1
15
+ MICROPY_PY_USSL = 1
16
+ MICROPY_SSL_MBEDTLS = 1
17
+ MICROPY_VFS_LFS2 = 1
18
+
19
+ # Custom C modules
20
+ USER_C_MODULES = $(PROJECT_TOP ) /src/cmodules
21
+
22
+ # PYBD-specific frozen modules
23
+ FROZEN_MANIFEST = $(BOARD_DIR ) /manifest.py
Original file line number Diff line number Diff line change
1
+ W3,PE3
2
+ W5,PA11
3
+ W5B,PI0
4
+ W6,PA5
5
+ W7,PA4
6
+ W7B,PG7
7
+ W8,PB11
8
+ W9,PA12
9
+ W9B,PI1
10
+ W10,PA6
11
+ W11,PA3
12
+ W12,PB10
13
+ W14,PA7
14
+ W15,PA2
15
+ W16,PA15
16
+ W17,PA1
17
+ W18,PD3
18
+ W19,PA0
19
+ W20,PD0
20
+ W21,PC14
21
+ W22,PE12
22
+ W22B,PF6
23
+ W22C,PF7
24
+ W22D,PF10
25
+ W23,PE1
26
+ W24,PC1
27
+ W25,PE0
28
+ W26,PC13
29
+ W27,PA8
30
+ W27B,PC6
31
+ W28,PE6
32
+ W29,PB3
33
+ W30,PE5
34
+ W32,PE4
35
+ W33,PH2
36
+ W34,PH3
37
+ W43,PB0
38
+ W43B,PC0
39
+ W43C,PF9
40
+ W43D,PF11
41
+ W45,PB12
42
+ W45B,PE14
43
+ W45C,PH8
44
+ W46,PB5
45
+ W47,PC5
46
+ W47B,PF14
47
+ W49,PB13
48
+ W50,PB4
49
+ W51,PC4
50
+ W51B,PF15
51
+ W52,PA10
52
+ W53,PC2
53
+ W53B,PF8
54
+ W54,PA9
55
+ W55,PB9
56
+ W56,PA14
57
+ W57,PC3
58
+ W57B,PF13
59
+ W58,PG11
60
+ W59,PB8
61
+ W60,PG12
62
+ W61,PB7
63
+ W62,PD7
64
+ W63,PB1
65
+ W63B,PD9
66
+ W64,PD6
67
+ W65,PD8
68
+ W66,PG9
69
+ W67,PA13
70
+ W68,PG10
71
+ W70,PB14
72
+ W71,PE15
73
+ W72,PB15
74
+ W73,PH6
75
+ W74,PH7
76
+ X1,PA0
77
+ X2,PA1
78
+ X3,PA2
79
+ X4,PA3
80
+ X5,PA4
81
+ X5B,PG7
82
+ X6,PA5
83
+ X7,PA6
84
+ X8,PA7
85
+ X9,PB8
86
+ X10,PB9
87
+ X11,PC4
88
+ X11B,PF15
89
+ X12,PC5
90
+ X12B,PF14
91
+ Y1,PA9
92
+ Y2,PA10
93
+ Y3,PB4
94
+ Y4,PB5
95
+ Y5,PB12
96
+ Y5B,PE14
97
+ Y5C,PH8
98
+ Y6,PB13
99
+ Y7,PC2
100
+ Y7B,PF8
101
+ Y8,PC3
102
+ Y8B,PF13
103
+ Y9,PB10
104
+ Y10,PB11
105
+ Y11,PB0
106
+ Y11B,PC0
107
+ Y11C,PF9
108
+ Y11D,PF11
109
+ Y12,PB1
110
+ Y12B,PD9
111
+ EN_3V3,PF2
112
+ PULL_SCL,PF1
113
+ PULL_SDA,PH5
114
+ LED_RED,PF3
115
+ LED_GREEN,PF4
116
+ LED_BLUE,PF5
117
+ USR,PA13
118
+ USB_DM,PA11
119
+ USB_DP,PA12
120
+ USB_HS_DM,PB14
121
+ USB_HS_DP,PB15
122
+ -QSPI1_CS,PE13
123
+ -QSPI1_CLK,PE11
124
+ -QSPI1_D0,PE7
125
+ -QSPI1_D1,PE8
126
+ -QSPI1_D2,PE9
127
+ -QSPI1_D3,PE10
128
+ -QSPI2_CS,PB6
129
+ -QSPI2_CLK,PB2
130
+ -QSPI2_D0,PD11
131
+ -QSPI2_D1,PD12
132
+ -QSPI2_D2,PE2
133
+ -QSPI2_D3,PD13
134
+ -SD_D0,PG9
135
+ -SD_D1,PG10
136
+ -SD_D2,PG11
137
+ -SD_D3,PG12
138
+ -SD_CMD,PD7
139
+ -SD_CK,PD6
140
+ SD_SW,PA14
141
+ -WL_REG_ON,PD4
142
+ -WL_HOST_WAKE,PI8
143
+ -WL_RFSW_VDD,PI9
144
+ -WL_GPIO_1,PI11
145
+ -WL_GPIO_2,PI7
146
+ -WL_GPIO_4,PI9
147
+ -WL_SDIO_0,PC8
148
+ -WL_SDIO_1,PC9
149
+ -WL_SDIO_2,PC10
150
+ -WL_SDIO_3,PC11
151
+ -WL_SDIO_CMD,PD2
152
+ -WL_SDIO_CLK,PC12
153
+ -BT_RXD,PC7
154
+ -BT_TXD,PG14
155
+ -BT_CTS,PG13
156
+ -BT_RTS,PG8
157
+ -BT_GPIO_3,PG15
158
+ -BT_GPIO_4,PI5
159
+ -BT_GPIO_5,PI4
160
+ -BT_PCM_SYNC,PE4
161
+ -BT_PCM_IN,PE6
162
+ -BT_PCM_OUT,PE3
163
+ -BT_PCM_CLK,PE5
164
+ -BT_I2C_D0,PI10
165
+ -BT_REG_ON,PI6
166
+ -BT_HOST_WAKE,PD10
167
+ -BT_DEV_WAKE,PD5
168
+ ,PD1
169
+ ,PD14
170
+ ,PD15
171
+ ,PF0
172
+ ,PF12
173
+ ,PG0
174
+ ,PG1
175
+ ,PG2
176
+ ,PG3
177
+ ,PG4
178
+ ,PG5
179
+ ,PG6
180
+ ,PH4
181
+ ,PH9
182
+ ,PH10
183
+ ,PH11
184
+ ,PH12
185
+ ,PH13
186
+ ,PH14
187
+ ,PH15
188
+ ,PI2
189
+ ,PI3
Original file line number Diff line number Diff line change
1
+ // Use PYBD_SF2 configuration.
2
+ #include "boards/PYBD_SF2/stm32f7xx_hal_conf.h"
You can’t perform that action at this time.
0 commit comments