Skip to content

Commit 7564830

Browse files
committed
Edits to move pinmap to flash
Initial comit, not tested, but copied from previous working folder.
1 parent 37cdca0 commit 7564830

7 files changed

Lines changed: 111 additions & 95 deletions

File tree

STM32F1/cores/maple/libmaple/adc_f1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@
3939
* Devices
4040
*/
4141

42-
static adc_dev adc1 = {
42+
adc_dev adc1 = {
4343
.regs = ADC1_BASE,
4444
.clk_id = RCC_ADC1,
4545
};
4646
/** ADC1 device. */
4747
const adc_dev *ADC1 = &adc1;
4848

49-
static adc_dev adc2 = {
49+
adc_dev adc2 = {
5050
.regs = ADC2_BASE,
5151
.clk_id = RCC_ADC2,
5252
};
5353
/** ADC2 device. */
5454
const adc_dev *ADC2 = &adc2;
5555

5656
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
57-
static adc_dev adc3 = {
57+
adc_dev adc3 = {
5858
.regs = ADC3_BASE,
5959
.clk_id = RCC_ADC3,
6060
};

STM32F1/cores/maple/libmaple/timer.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,74 +48,74 @@ static inline void enable_irq(timer_dev *dev, timer_interrupt_id iid);
4848
*/
4949

5050
#if STM32_HAVE_TIMER(1)
51-
static timer_dev timer1 = ADVANCED_TIMER(1);
51+
timer_dev timer1 = ADVANCED_TIMER(1);
5252
/** Timer 1 device (advanced) */
53-
timer_dev *TIMER1 = &timer1;
53+
timer_dev *const TIMER1 = &timer1;
5454
#endif
5555
#if STM32_HAVE_TIMER(2)
56-
static timer_dev timer2 = GENERAL_TIMER(2);
56+
timer_dev timer2 = GENERAL_TIMER(2);
5757
/** Timer 2 device (general-purpose) */
58-
timer_dev *TIMER2 = &timer2;
58+
timer_dev *const TIMER2 = &timer2;
5959
#endif
6060
#if STM32_HAVE_TIMER(3)
61-
static timer_dev timer3 = GENERAL_TIMER(3);
61+
timer_dev timer3 = GENERAL_TIMER(3);
6262
/** Timer 3 device (general-purpose) */
63-
timer_dev *TIMER3 = &timer3;
63+
timer_dev *const TIMER3 = &timer3;
6464
#endif
6565
#if STM32_HAVE_TIMER(4)
66-
static timer_dev timer4 = GENERAL_TIMER(4);
66+
timer_dev timer4 = GENERAL_TIMER(4);
6767
/** Timer 4 device (general-purpose) */
68-
timer_dev *TIMER4 = &timer4;
68+
timer_dev *const TIMER4 = &timer4;
6969
#endif
7070
#if STM32_HAVE_TIMER(5)
71-
static timer_dev timer5 = GENERAL_TIMER(5);
71+
timer_dev timer5 = GENERAL_TIMER(5);
7272
/** Timer 5 device (general-purpose) */
73-
timer_dev *TIMER5 = &timer5;
73+
timer_dev *const TIMER5 = &timer5;
7474
#endif
7575
#if STM32_HAVE_TIMER(6)
76-
static timer_dev timer6 = BASIC_TIMER(6);
76+
timer_dev timer6 = BASIC_TIMER(6);
7777
/** Timer 6 device (basic) */
78-
timer_dev *TIMER6 = &timer6;
78+
timer_dev *const TIMER6 = &timer6;
7979
#endif
8080
#if STM32_HAVE_TIMER(7)
81-
static timer_dev timer7 = BASIC_TIMER(7);
81+
timer_dev timer7 = BASIC_TIMER(7);
8282
/** Timer 7 device (basic) */
83-
timer_dev *TIMER7 = &timer7;
83+
timer_dev *const TIMER7 = &timer7;
8484
#endif
8585
#if STM32_HAVE_TIMER(8)
86-
static timer_dev timer8 = ADVANCED_TIMER(8);
86+
timer_dev timer8 = ADVANCED_TIMER(8);
8787
/** Timer 8 device (advanced) */
88-
timer_dev *TIMER8 = &timer8;
88+
timer_dev *const TIMER8 = &timer8;
8989
#endif
9090
#if STM32_HAVE_TIMER(9)
91-
static timer_dev timer9 = RESTRICTED_GENERAL_TIMER(9, TIMER_DIER_TIE_BIT);
91+
timer_dev timer9 = RESTRICTED_GENERAL_TIMER(9, TIMER_DIER_TIE_BIT);
9292
/** Timer 9 device (general-purpose) */
93-
timer_dev *TIMER9 = &timer9;
93+
timer_dev *const TIMER9 = &timer9;
9494
#endif
9595
#if STM32_HAVE_TIMER(10)
96-
static timer_dev timer10 = RESTRICTED_GENERAL_TIMER(10, TIMER_DIER_CC1IE_BIT);
96+
timer_dev timer10 = RESTRICTED_GENERAL_TIMER(10, TIMER_DIER_CC1IE_BIT);
9797
/** Timer 10 device (general-purpose) */
98-
timer_dev *TIMER10 = &timer10;
98+
timer_dev *const TIMER10 = &timer10;
9999
#endif
100100
#if STM32_HAVE_TIMER(11)
101-
static timer_dev timer11 = RESTRICTED_GENERAL_TIMER(11, TIMER_DIER_CC1IE_BIT);
101+
timer_dev timer11 = RESTRICTED_GENERAL_TIMER(11, TIMER_DIER_CC1IE_BIT);
102102
/** Timer 11 device (general-purpose) */
103-
timer_dev *TIMER11 = &timer11;
103+
timer_dev *const TIMER11 = &timer11;
104104
#endif
105105
#if STM32_HAVE_TIMER(12)
106-
static timer_dev timer12 = RESTRICTED_GENERAL_TIMER(12, TIMER_DIER_TIE_BIT);
106+
timer_dev timer12 = RESTRICTED_GENERAL_TIMER(12, TIMER_DIER_TIE_BIT);
107107
/** Timer 12 device (general-purpose) */
108-
timer_dev *TIMER12 = &timer12;
108+
timer_dev *const TIMER12 = &timer12;
109109
#endif
110110
#if STM32_HAVE_TIMER(13)
111-
static timer_dev timer13 = RESTRICTED_GENERAL_TIMER(13, TIMER_DIER_CC1IE_BIT);
111+
timer_dev timer13 = RESTRICTED_GENERAL_TIMER(13, TIMER_DIER_CC1IE_BIT);
112112
/** Timer 13 device (general-purpose) */
113-
timer_dev *TIMER13 = &timer13;
113+
timer_dev *const TIMER13 = &timer13;
114114
#endif
115115
#if STM32_HAVE_TIMER(14)
116-
static timer_dev timer14 = RESTRICTED_GENERAL_TIMER(14, TIMER_DIER_CC1IE_BIT);
116+
timer_dev timer14 = RESTRICTED_GENERAL_TIMER(14, TIMER_DIER_CC1IE_BIT);
117117
/** Timer 14 device (general-purpose) */
118-
timer_dev *TIMER14 = &timer14;
118+
timer_dev *const TIMER14 = &timer14;
119119
#endif
120120

121121
/*

STM32F1/cores/maple/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extern void init(void);
3030

3131
// Force init to be called *first*, i.e. before static object allocation.
3232
// Otherwise, statically allocated objects that need libmaple may fail.
33-
__attribute__(( constructor )) void premain() {
33+
__attribute__(( constructor (101))) void premain() {
3434
init();
3535
}
3636

STM32F1/system/libmaple/include/libmaple/timer.h

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,46 +134,60 @@ typedef struct timer_dev {
134134
} timer_dev;
135135

136136
#if STM32_HAVE_TIMER(1)
137-
extern timer_dev *TIMER1;
137+
extern timer_dev *const TIMER1;
138+
extern timer_dev timer1;
138139
#endif
139140
#if STM32_HAVE_TIMER(2)
140-
extern timer_dev *TIMER2;
141+
extern timer_dev *const TIMER2;
142+
extern timer_dev timer2;
141143
#endif
142144
#if STM32_HAVE_TIMER(3)
143-
extern timer_dev *TIMER3;
145+
extern timer_dev *const TIMER3;
146+
extern timer_dev timer3;
144147
#endif
145148
#if STM32_HAVE_TIMER(4)
146-
extern timer_dev *TIMER4;
149+
extern timer_dev *const TIMER4;
150+
extern timer_dev timer4;
147151
#endif
148152
#if STM32_HAVE_TIMER(5)
149-
extern timer_dev *TIMER5;
153+
extern timer_dev *const TIMER5;
154+
extern timer_dev timer5;
150155
#endif
151156
#if STM32_HAVE_TIMER(6)
152-
extern timer_dev *TIMER6;
157+
extern timer_dev *const TIMER6;
158+
extern timer_dev timer6;
153159
#endif
154160
#if STM32_HAVE_TIMER(7)
155-
extern timer_dev *TIMER7;
161+
extern timer_dev *const TIMER7;
162+
extern timer_dev timer7;
156163
#endif
157164
#if STM32_HAVE_TIMER(8)
158-
extern timer_dev *TIMER8;
165+
extern timer_dev *const TIMER8;
166+
extern timer_dev timer8;
159167
#endif
160168
#if STM32_HAVE_TIMER(9)
161-
extern timer_dev *TIMER9;
169+
extern timer_dev *const TIMER9;
170+
extern timer_dev timer9;
162171
#endif
163172
#if STM32_HAVE_TIMER(10)
164-
extern timer_dev *TIMER10;
173+
extern timer_dev *const TIMER10;
174+
extern timer_dev timer10;
165175
#endif
166176
#if STM32_HAVE_TIMER(11)
167-
extern timer_dev *TIMER11;
177+
extern timer_dev *const TIMER11;
178+
extern timer_dev timer11;
168179
#endif
169180
#if STM32_HAVE_TIMER(12)
170-
extern timer_dev *TIMER12;
181+
extern timer_dev *const TIMER12;
182+
extern timer_dev timer12;
171183
#endif
172184
#if STM32_HAVE_TIMER(13)
173-
extern timer_dev *TIMER13;
185+
extern timer_dev *const TIMER13;
186+
extern timer_dev timer13;
174187
#endif
175188
#if STM32_HAVE_TIMER(14)
176-
extern timer_dev *TIMER14;
189+
extern timer_dev *const TIMER14;
190+
extern timer_dev timer14;
177191
#endif
178192

179193
/*

STM32F1/system/libmaple/stm32f1/include/series/adc.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242
/*
4343
* Devices
4444
*/
45-
45+
extern adc_dev adc1;
4646
extern const struct adc_dev *ADC1;
47+
extern adc_dev adc2;
4748
extern const struct adc_dev *ADC2;
4849
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
50+
extern adc_dev adc3;
4951
extern const struct adc_dev *ADC3;
5052
#endif
5153

STM32F1/system/libmaple/stm32f1/include/series/timer.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,23 @@ struct timer_bas_reg_map;
106106

107107
struct timer_dev;
108108

109-
extern struct timer_dev *TIMER1;
110-
extern struct timer_dev *TIMER2;
111-
extern struct timer_dev *TIMER3;
112-
extern struct timer_dev *TIMER4;
109+
extern struct timer_dev *const TIMER1;
110+
extern struct timer_dev *const TIMER2;
111+
extern struct timer_dev *const TIMER3;
112+
extern struct timer_dev *const TIMER4;
113113
#if defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)
114-
extern struct timer_dev *TIMER5;
115-
extern struct timer_dev *TIMER6;
116-
extern struct timer_dev *TIMER7;
117-
extern struct timer_dev *TIMER8;
114+
extern struct timer_dev *const TIMER5;
115+
extern struct timer_dev *const TIMER6;
116+
extern struct timer_dev *const TIMER7;
117+
extern struct timer_dev *const TIMER8;
118118
#endif
119119
#ifdef STM32_XL_DENSITY
120-
extern struct timer_dev *TIMER9;
121-
extern struct timer_dev *TIMER10;
122-
extern struct timer_dev *TIMER11;
123-
extern struct timer_dev *TIMER12;
124-
extern struct timer_dev *TIMER13;
125-
extern struct timer_dev *TIMER14;
120+
extern struct timer_dev *const TIMER9;
121+
extern struct timer_dev *const TIMER10;
122+
extern struct timer_dev *const TIMER11;
123+
extern struct timer_dev *const TIMER12;
124+
extern struct timer_dev *const TIMER13;
125+
extern struct timer_dev *const TIMER14;
126126
#endif
127127

128128
#endif

STM32F1/variants/maple_mini/board.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,43 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
5454

5555
/* Top header */
5656

57-
{GPIOB, NULL, NULL, 11, 0, ADCx}, /* D0/PB11 */
58-
{GPIOB, NULL, NULL, 10, 0, ADCx}, /* D1/PB10 */
59-
{GPIOB, NULL, NULL, 2, 0, ADCx}, /* D2/PB2 */
60-
{GPIOB, TIMER3, ADC1, 0, 3, 8}, /* D3/PB0 */
61-
{GPIOA, TIMER3, ADC1, 7, 2, 7}, /* D4/PA7 */
62-
{GPIOA, TIMER3, ADC1, 6, 1, 6}, /* D5/PA6 */
63-
{GPIOA, NULL, ADC1, 5, 0, 5}, /* D6/PA5 */
64-
{GPIOA, NULL, ADC1, 4, 0, 4}, /* D7/PA4 */
65-
{GPIOA, TIMER2, ADC1, 3, 4, 3}, /* D8/PA3 */
66-
{GPIOA, TIMER2, ADC1, 2, 3, 2}, /* D9/PA2 */
67-
{GPIOA, TIMER2, ADC1, 1, 2, 1}, /* D10/PA1 */
68-
{GPIOA, TIMER2, ADC1, 0, 1, 0}, /* D11/PA0 */
69-
{GPIOC, NULL, NULL, 15, 0, ADCx}, /* D12/PC15 */
70-
{GPIOC, NULL, NULL, 14, 0, ADCx}, /* D13/PC14 */
71-
{GPIOC, NULL, NULL, 13, 0, ADCx}, /* D14/PC13 */
57+
{&gpiob, NULL, NULL, 11, 0, ADCx}, /* D0/PB11 */
58+
{&gpiob, NULL, NULL, 10, 0, ADCx}, /* D1/PB10 */
59+
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* D2/PB2 */
60+
{&gpiob, &timer3, &adc1, 0, 3, 8}, /* D3/PB0 */
61+
{&gpioa, &timer3, &adc1, 7, 2, 7}, /* D4/PA7 */
62+
{&gpioa, &timer3, &adc1, 6, 1, 6}, /* D5/PA6 */
63+
{&gpioa, NULL, &adc1, 5, 0, 5}, /* D6/PA5 */
64+
{&gpioa, NULL, &adc1, 4, 0, 4}, /* D7/PA4 */
65+
{&gpioa, &timer2, &adc1, 3, 4, 3}, /* D8/PA3 */
66+
{&gpioa, &timer2, &adc1, 2, 3, 2}, /* D9/PA2 */
67+
{&gpioa, &timer2, &adc1, 1, 2, 1}, /* D10/PA1 */
68+
{&gpioa, &timer2, &adc1, 0, 1, 0}, /* D11/PA0 */
69+
{&gpioc, NULL, NULL, 15, 0, ADCx}, /* D12/PC15 */
70+
{&gpioc, NULL, NULL, 14, 0, ADCx}, /* D13/PC14 */
71+
{&gpioc, NULL, NULL, 13, 0, ADCx}, /* D14/PC13 */
7272

7373
/* Bottom header */
7474

75-
{GPIOB, TIMER4, NULL, 7, 2, ADCx}, /* D15/PB7 */
76-
{GPIOB, TIMER4, NULL, 6, 1, ADCx}, /* D16/PB6 */
77-
{GPIOB, NULL, NULL, 5, 0, ADCx}, /* D17/PB5 */
78-
{GPIOB, NULL, NULL, 4, 0, ADCx}, /* D18/PB4 */
79-
{GPIOB, NULL, NULL, 3, 0, ADCx}, /* D19/PB3 */
80-
{GPIOA, NULL, NULL, 15, 0, ADCx}, /* D20/PA15 */
81-
{GPIOA, NULL, NULL, 14, 0, ADCx}, /* D21/PA14 */
82-
{GPIOA, NULL, NULL, 13, 0, ADCx}, /* D22/PA13 */
83-
{GPIOA, NULL, NULL, 12, 0, ADCx}, /* D23/PA12 */
84-
{GPIOA, TIMER1, NULL, 11, 4, ADCx}, /* D24/PA11 */
85-
{GPIOA, TIMER1, NULL, 10, 3, ADCx}, /* D25/PA10 */
86-
{GPIOA, TIMER1, NULL, 9, 2, ADCx}, /* D26/PA9 */
87-
{GPIOA, TIMER1, NULL, 8, 1, ADCx}, /* D27/PA8 */
88-
{GPIOB, NULL, NULL, 15, 0, ADCx}, /* D28/PB15 */
89-
{GPIOB, NULL, NULL, 14, 0, ADCx}, /* D29/PB14 */
90-
{GPIOB, NULL, NULL, 13, 0, ADCx}, /* D30/PB13 */
91-
{GPIOB, NULL, NULL, 12, 0, ADCx}, /* D31/PB12 */
92-
{GPIOB, TIMER4, NULL, 8, 3, ADCx}, /* D32/PB8 */
93-
{GPIOB, TIMER3, ADC1, 1, 4, 9}, /* D33/PB1 */
75+
{&gpiob, &timer4, NULL, 7, 2, ADCx}, /* D15/PB7 */
76+
{&gpiob, &timer4, NULL, 6, 1, ADCx}, /* D16/PB6 */
77+
{&gpiob, NULL, NULL, 5, 0, ADCx}, /* D17/PB5 */
78+
{&gpiob, NULL, NULL, 4, 0, ADCx}, /* D18/PB4 */
79+
{&gpiob, NULL, NULL, 3, 0, ADCx}, /* D19/PB3 */
80+
{&gpioa, NULL, NULL, 15, 0, ADCx}, /* D20/PA15 */
81+
{&gpioa, NULL, NULL, 14, 0, ADCx}, /* D21/PA14 */
82+
{&gpioa, NULL, NULL, 13, 0, ADCx}, /* D22/PA13 */
83+
{&gpioa, NULL, NULL, 12, 0, ADCx}, /* D23/PA12 */
84+
{&gpioa, &timer1, NULL, 11, 4, ADCx}, /* D24/PA11 */
85+
{&gpioa, &timer1, NULL, 10, 3, ADCx}, /* D25/PA10 */
86+
{&gpioa, &timer1, NULL, 9, 2, ADCx}, /* D26/PA9 */
87+
{&gpioa, &timer1, NULL, 8, 1, ADCx}, /* D27/PA8 */
88+
{&gpiob, NULL, NULL, 15, 0, ADCx}, /* D28/PB15 */
89+
{&gpiob, NULL, NULL, 14, 0, ADCx}, /* D29/PB14 */
90+
{&gpiob, NULL, NULL, 13, 0, ADCx}, /* D30/PB13 */
91+
{&gpiob, NULL, NULL, 12, 0, ADCx}, /* D31/PB12 */
92+
{&gpiob, &timer4, NULL, 8, 3, ADCx}, /* D32/PB8 */
93+
{&gpiob, &timer3, &adc1, 1, 4, 9}, /* D33/PB1 */
9494
};
9595

9696
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {

0 commit comments

Comments
 (0)