forked from espruino/Espruino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOLIMEXINO_STM32.py
185 lines (171 loc) · 4.4 KB
/
OLIMEXINO_STM32.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <[email protected]>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ----------------------------------------------------------------------------------------
# This file contains information for a specific board - the available pins, and where LEDs,
# Buttons, and other in-built peripherals are. It is used to build documentation as well
# as various source and header files for Espruino.
# ----------------------------------------------------------------------------------------
import pinutils;
import json;
info = {
'name' : "Olimexino STM32 / Leaflabs Maple",
'link' : [ "https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/", "http://leaflabs.com/devices/maple/" ],
'variables' : 1020,
'binary_name' : 'espruino_%v_olimexino_stm32.bin',
'build' : {
'defines' : [
'USE_FILESYSTEM'
]
}
};
chip = {
'part' : "STM32F103RBT6",
'family' : "STM32F1",
'package' : "LQFP64",
'ram' : 20,
'flash' : 128,
'speed' : 72,
'usart' : 3,
'spi' : 2,
'i2c' : 2,
'adc' : 3,
'dac' : 0,
'saved_code' : {
'address' : 0x08000000 + ((128-4)*1024),
'page_size' : 1024, # size of pages
'pages' : 4, # number of pages we're using
'flash_available' : 128-4 # 4 used for code
},
};
devices = {
# 'OSC' : { 'pin_1' : 'D0',
# 'pin_2' : 'D1' },
'OSC_RTC' : { 'pin_1' : 'D22',
'pin_2' : 'D23' },
'LED1' : { 'pin' : 'D13' },
'LED2' : { 'pin' : 'D3' },
'BTN1' : { 'pin' : 'D38' }, # 'C9'
'USB' : { 'pin_disc' : 'D39',
'pin_dm' : 'D40',
'pin_dp' : 'D41'
},
'SD' : { 'pin_cs' : 'D25',#'D2',
'pin_di' : 'D34',#'B15',
'pin_do' : 'D33',#'B14',
'pin_clk' : 'D32'}, #'B13'
};
# left-right, or top-bottom order
board = {
'top' : [ 'D14', 'GND', 'D13', 'D12', 'D11','D10', 'D9', 'D8', '', 'D7', 'D6', 'D5', 'D4', 'D3', 'D2', 'D1', 'D0'],
'bottom' : [ 'RST', '3.3', '3.3A', 'GNDA', 'GND', 'VIN', '', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5'],
'right' : [ 'D23','D25','D27','D29','D31','D33','D35','D37' ],
'right2' : [ 'D24','D26','D28','D30','D32','D34','D36','GND' ],
'left' : [ '3V3','D7','D29','D12','D13' ],
'left2' : [ 'GND','D8','D20','D11','D4' ],
'_pinmap' : { 'A0':'D15', 'A1':'D16', 'A2':'D17', 'A3':'D18', 'A4':'D19', 'A5':'D20' }
};
board["left"].reverse()
board["left2"].reverse()
board["right"].reverse()
board["right2"].reverse()
board["_css"] = """
#board {
width: 540px;
height: 418px;
top: 300px;
left: 200px;
background-image: url(img/OLIMEXINO_STM32.jpg);
}
#boardcontainer {
height: 850px;
}
#top {
top: -20px;
left: 140px;
}
#bottom {
top: 431px;
left: 220px;
}
#left {
top: 155px;
right: 520px;
}
#left2 {
top:155px;
left: 20px;
}
#right {
top: 155px;
left: 520px;
}
#right2 {
top: 155px;
right: 20px;
}
""";
def get_pins():
pins = pinutils.scan_pin_file([], 'stm32f103xb.csv', 6, 10, 11)
# Olimexino/Maple pins have stupid names
pinmapping = {
'D0' :'PA3',
'D1' :'PA2',
'D2' :'PA0',
'D3' :'PA1',
'D4' :'PB5',
'D5' :'PB6',
'D6' :'PA8',
'D7' :'PA9',
'D8' :'PA10',
'D9' :'PB7',
'D10':'PA4',
'D11':'PA7',
'D12':'PA6',
'D13':'PA5',
'D14':'PB8',
'D15':'PC0', # shared with A0-A15
'D16':'PC1',
'D17':'PC2',
'D18':'PC3',
'D19':'PC4',
'D20':'PC5',
'D21':'PC13',
'D22':'PC14',
'D23':'PC15',
'D24':'PB9',
'D25':'PD2',
'D26':'PC10',
'D27':'PB0',
'D28':'PB1',
'D29':'PB10',
'D30':'PB11',
'D31':'PB12',
'D32':'PB13',
'D33':'PB14',
'D34':'PB15',
'D35':'PC6',
'D36':'PC7',
'D37':'PC8',
'D38':'PC9', # for button
'D39':'PC12', # for USB disc
'D40':'PA11', # for USB dm
'D41':'PA12', # for USB dp
};
newpins = []
for newname in pinmapping:
# print newname
pin = pinutils.findpin(pins, pinmapping[newname], True)
pin["name"] = "P"+newname
pin["sortingname"] = newname[0] + newname[1:].rjust(2,'0')
newpins.append(pin)
# Because 'pinmapping' is NOT stored in order!!!
newpins = sorted(newpins, key=lambda pin: pin["sortingname"])
# print(json.dumps(newpins, sort_keys=True, indent=2))
return newpins