Skip to content

Commit 3f099ff

Browse files
author
Marti Bolivar
committed
Remove trailing whitespace from source files.
Command used: $ ack --files-with-matches '[ \t]+$' | xargs sed -i -E 's/[ \t]+$//' `ack' is also known as `ack-grep' on some systems and in some package managers (e.g. Ubuntu's). Signed-off-by: Marti Bolivar <[email protected]>
1 parent 213fa63 commit 3f099ff

File tree

19 files changed

+253
-253
lines changed

19 files changed

+253
-253
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp $(ASFLAGS)
8181
# file management
8282
ASRC = $(ST_LIB)/c_only_startup.s $(ST_LIB)/cortexm3_macro.s
8383

84-
STM32SRCS =
84+
STM32SRCS =
8585

8686
_STM32USBSRCS = usb_regs.c \
8787
usb_int.c \
@@ -117,7 +117,7 @@ build: elf bin lss sym
117117

118118
bin: $(TARGET).bin
119119
elf: $(TARGET).elf
120-
lss: $(TARGET).lss
120+
lss: $(TARGET).lss
121121
sym: $(TARGET).sym
122122
dfu: $(TARGET).bin
123123
sudo dfu-util -d 0110:1001 -a 0 -D $(TARGET).bin
@@ -139,15 +139,15 @@ end:
139139
@echo
140140
sizeafter:
141141
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi
142-
gccversion:
142+
gccversion:
143143
@$(CC) --version
144144

145-
program:
145+
program:
146146
@echo "Flash-programming with OpenOCD"
147147
cp $(TARGET).bin flash/tmpflash.bin
148148
cd flash && openocd -f flash.cfg
149149

150-
program_serial:
150+
program_serial:
151151
@echo "Flash-programming with stm32loader.py"
152152
./flash/stm32loader.py -p /dev/ttyUSB0 -evw build/maple_boot.bin
153153

@@ -192,7 +192,7 @@ run: $(TARGET).bin
192192

193193

194194
# Link: create ELF output file from object files.
195-
.SECONDARY : $(TARGET).elf
195+
.SECONDARY : $(TARGET).elf
196196
.PRECIOUS : $(COBJ) $(AOBJ)
197197

198198
%.elf: $(COBJ) $(AOBJ)
@@ -204,7 +204,7 @@ run: $(TARGET).bin
204204
$(COBJ) : $(BUILDDIR)/%.o : %.c
205205
@echo
206206
@echo $(MSG_COMPILING) $<
207-
$(CC) -c $(THUMB) $(ALL_CFLAGS) $< -o $@
207+
$(CC) -c $(THUMB) $(ALL_CFLAGS) $< -o $@
208208

209209
# Assemble: create object files from assembler source files. ARM/Thumb
210210
$(AOBJ) : $(BUILDDIR)/%.o : %.s

dfu.c

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @brief The principle dfu state machine as well as the data
2929
* transfer callbacks accessed by the usb library
30-
*
30+
*
3131
*
3232
*/
3333

@@ -50,9 +50,9 @@ PLOT code_copy_lock;
5050
/* todo: force dfu globals to be singleton to avoid re-inits? */
5151
void dfuInit(void) {
5252
dfuAppStatus.bStatus = OK;
53-
dfuAppStatus.bwPollTimeout0 = 0x00;
54-
dfuAppStatus.bwPollTimeout1 = 0x00;
55-
dfuAppStatus.bwPollTimeout2 = 0x00;
53+
dfuAppStatus.bwPollTimeout0 = 0x00;
54+
dfuAppStatus.bwPollTimeout1 = 0x00;
55+
dfuAppStatus.bwPollTimeout2 = 0x00;
5656
dfuAppStatus.bState = dfuIDLE;
5757
dfuAppStatus.iString = 0x00; /* all strings must be 0x00 until we make them! */
5858
userFirmwareLen = 0;
@@ -69,7 +69,7 @@ bool dfuUpdateByRequest(void) {
6969
dfuBusy = TRUE;
7070

7171
u8 startState = dfuAppStatus.bState;
72-
dfuAppStatus.bStatus = OK;
72+
dfuAppStatus.bStatus = OK;
7373
/* often leaner to nest if's then embed a switch/case */
7474
if (startState == dfuIDLE) {
7575
/* device running inside DFU mode */
@@ -84,7 +84,7 @@ bool dfuUpdateByRequest(void) {
8484
if (pInformation->Current_AlternateSetting == 1) {
8585
userAppAddr = USER_CODE_FLASH;
8686
userFlash = TRUE;
87-
87+
8888
/* make sure the flash is setup properly, unlock it */
8989
setupFLASH();
9090
flashUnlock();
@@ -95,26 +95,26 @@ bool dfuUpdateByRequest(void) {
9595
}
9696
} else {
9797
dfuAppStatus.bState = dfuERROR;
98-
dfuAppStatus.bStatus = errNOTDONE;
98+
dfuAppStatus.bStatus = errNOTDONE;
9999
}
100100
} else if (pInformation->USBbRequest == DFU_UPLOAD) {
101101
dfuAppStatus.bState = dfuUPLOAD_IDLE;
102102
} else if (pInformation->USBbRequest == DFU_ABORT) {
103103
dfuAppStatus.bState = dfuIDLE;
104-
dfuAppStatus.bStatus = OK; /* are we really ok? we were just aborted */
104+
dfuAppStatus.bStatus = OK; /* are we really ok? we were just aborted */
105105
} else if (pInformation->USBbRequest == DFU_GETSTATUS) {
106106
dfuAppStatus.bState = dfuIDLE;
107107
} else if (pInformation->USBbRequest == DFU_GETSTATE) {
108108
dfuAppStatus.bState = dfuIDLE;
109109
} else {
110110
dfuAppStatus.bState = dfuERROR;
111-
dfuAppStatus.bStatus = errSTALLEDPKT;
111+
dfuAppStatus.bStatus = errSTALLEDPKT;
112112
}
113113

114114
} else if (startState == dfuDNLOAD_SYNC) {
115115
/* device received block, waiting for DFU_GETSTATUS request */
116116

117-
if (pInformation->USBbRequest == DFU_GETSTATUS) {
117+
if (pInformation->USBbRequest == DFU_GETSTATUS) {
118118
/* todo, add routine to wait for last block write to finish */
119119
if (userFlash) {
120120
if (code_copy_lock==WAIT) {
@@ -124,7 +124,7 @@ bool dfuUpdateByRequest(void) {
124124
dfuAppStatus.bState=dfuDNBUSY;
125125

126126
} else if (code_copy_lock==BEGINNING) {
127-
dfuAppStatus.bState=dfuDNLOAD_SYNC;
127+
dfuAppStatus.bState=dfuDNLOAD_SYNC;
128128

129129
} else if (code_copy_lock==MIDDLE) {
130130
dfuAppStatus.bState=dfuDNLOAD_SYNC;
@@ -144,7 +144,7 @@ bool dfuUpdateByRequest(void) {
144144
dfuAppStatus.bState = dfuDNLOAD_SYNC;
145145
} else {
146146
dfuAppStatus.bState = dfuERROR;
147-
dfuAppStatus.bStatus = errSTALLEDPKT;
147+
dfuAppStatus.bStatus = errSTALLEDPKT;
148148
}
149149

150150
} else if (startState == dfuDNBUSY) {
@@ -165,10 +165,10 @@ bool dfuUpdateByRequest(void) {
165165
} else {
166166
/* todo, support "disagreement" if device expects more data than this */
167167
dfuAppStatus.bState = dfuMANIFEST_SYNC;
168-
168+
169169
/* relock the flash */
170170
flashLock();
171-
}
171+
}
172172
} else if (pInformation->USBbRequest == DFU_ABORT) {
173173
dfuAppStatus.bState = dfuIDLE;
174174
} else if (pInformation->USBbRequest == DFU_GETSTATUS) {
@@ -177,20 +177,20 @@ bool dfuUpdateByRequest(void) {
177177
dfuAppStatus.bState = dfuIDLE;
178178
} else {
179179
dfuAppStatus.bState = dfuERROR;
180-
dfuAppStatus.bStatus = errSTALLEDPKT;
180+
dfuAppStatus.bStatus = errSTALLEDPKT;
181181
}
182182

183183
} else if (startState == dfuMANIFEST_SYNC) {
184184
/* device has received last block, waiting DFU_GETSTATUS request */
185-
185+
186186
if (pInformation->USBbRequest == DFU_GETSTATUS) {
187187
dfuAppStatus.bState = dfuMANIFEST_WAIT_RESET;
188188
dfuAppStatus.bStatus = OK;
189189
} else if (pInformation->USBbRequest == DFU_GETSTATE) {
190190
dfuAppStatus.bState = dfuMANIFEST_SYNC;
191191
} else {
192192
dfuAppStatus.bState = dfuERROR;
193-
dfuAppStatus.bStatus = errSTALLEDPKT;
193+
dfuAppStatus.bStatus = errSTALLEDPKT;
194194
}
195195

196196
} else if (startState == dfuMANIFEST) {
@@ -210,10 +210,10 @@ bool dfuUpdateByRequest(void) {
210210
} else if (startState == dfuUPLOAD_IDLE) {
211211
/* device expecting further dfu_upload requests */
212212

213-
if (pInformation->USBbRequest == DFU_UPLOAD) {
213+
if (pInformation->USBbRequest == DFU_UPLOAD) {
214214
/* todo, add routine to wait for last block write to finish */
215215
dfuAppStatus.bState = dfuERROR;
216-
dfuAppStatus.bStatus = errSTALLEDPKT;
216+
dfuAppStatus.bStatus = errSTALLEDPKT;
217217
} else if (pInformation->USBbRequest == DFU_ABORT) {
218218
dfuAppStatus.bState = dfuIDLE;
219219
} else if (pInformation->USBbRequest == DFU_GETSTATUS) {
@@ -222,31 +222,31 @@ bool dfuUpdateByRequest(void) {
222222
dfuAppStatus.bState = dfuUPLOAD_IDLE;
223223
} else {
224224
dfuAppStatus.bState = dfuERROR;
225-
dfuAppStatus.bStatus = errSTALLEDPKT;
225+
dfuAppStatus.bStatus = errSTALLEDPKT;
226226
}
227-
227+
228228

229229
} else if (startState == dfuERROR) {
230230
/* status is in error, awaiting DFU_CLRSTATUS request */
231231

232-
if (pInformation->USBbRequest == DFU_GETSTATUS) {
232+
if (pInformation->USBbRequest == DFU_GETSTATUS) {
233233
/* todo, add routine to wait for last block write to finish */
234234
dfuAppStatus.bState = dfuERROR;
235235
} else if (pInformation->USBbRequest == DFU_GETSTATE) {
236236
dfuAppStatus.bState = dfuERROR;
237237
} else if (pInformation->USBbRequest == DFU_CLRSTATUS) {
238238
/* todo handle any cleanup we need here */
239239
dfuAppStatus.bState = dfuIDLE;
240-
dfuAppStatus.bStatus = OK;
240+
dfuAppStatus.bStatus = OK;
241241
} else {
242242
dfuAppStatus.bState = dfuERROR;
243-
dfuAppStatus.bStatus = errSTALLEDPKT;
244-
}
243+
dfuAppStatus.bStatus = errSTALLEDPKT;
244+
}
245245

246246
} else {
247247
/* some kind of error... */
248248
dfuAppStatus.bState = dfuERROR;
249-
dfuAppStatus.bStatus = errSTALLEDPKT;
249+
dfuAppStatus.bStatus = errSTALLEDPKT;
250250
}
251251

252252
if (dfuAppStatus.bStatus == OK) {
@@ -271,7 +271,7 @@ void dfuUpdateByReset(void) {
271271
/* do nothing...might be normal usb bus activity */
272272
} else {
273273
/* we reset from the dfu, reset everything and startover,
274-
which is the correct operation if this is an erroneous
274+
which is the correct operation if this is an erroneous
275275
event or properly following a MANIFEST */
276276
dfuAppStatus.bState = dfuIDLE;
277277
dfuAppStatus.bStatus = OK;

dfu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ void dfuInit(void); /* singleton dfu initializer */
100100

101101
/* should consume dfuEvent type, but for now we can use pInfo (see comment above) */
102102
bool dfuUpdateByRequest(void); /* returns if new status is OK */
103-
void dfuUpdateByReset(void);
104-
void dfuUpdateByTimeout(void);
103+
void dfuUpdateByReset(void);
104+
void dfuUpdateByTimeout(void);
105105

106106
/* usb callbacks */
107107
u8* dfuCopyState(u16);
@@ -112,7 +112,7 @@ u8* dfuCopyUPLOAD(u16);
112112
void dfuCopyBufferToExec(void);
113113
bool checkTestFile(void);
114114

115-
u8 dfuGetState(void);
115+
u8 dfuGetState(void);
116116
void dfuSetState(u8);
117117
bool dfuUploadStarted();
118118
void dfuFinishUpload();

flash/stm32loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def readMemory(self, addr, lng):
257257
if usepbar:
258258
widgets = ['Reading: ', Percentage(),', ', ETA(), ' ', Bar()]
259259
pbar = ProgressBar(widgets=widgets,maxval=lng, term_width=79).start()
260-
260+
261261
while lng > 256:
262262
if usepbar:
263263
pbar.update(pbar.maxval-lng)
@@ -279,7 +279,7 @@ def writeMemory(self, addr, data):
279279
if usepbar:
280280
widgets = ['Writing: ', Percentage(),' ', ETA(), ' ', Bar()]
281281
pbar = ProgressBar(widgets=widgets, maxval=lng, term_width=79).start()
282-
282+
283283
offs = 0
284284
while lng > 256:
285285
if usepbar:
@@ -324,7 +324,7 @@ def usage():
324324

325325

326326
if __name__ == "__main__":
327-
327+
328328
# Import Psyco if available
329329
try:
330330
import psyco

hardware.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ void strobePin(u32 bank, u8 pin, u8 count, u32 rate) {
6464
asm volatile ("nop");
6565
}
6666
resetPin(bank,pin);
67-
}
68-
}
67+
}
68+
}
6969

7070
void systemReset(void) {
7171
SET_REG(RCC_CR, GET_REG(RCC_CR) | 0x00000001);
@@ -81,15 +81,15 @@ void setupCLK (void) {
8181
/* enable HSE */
8282
SET_REG(RCC_CR,GET_REG(RCC_CR) | 0x00010001);
8383
while ((GET_REG(RCC_CR) & 0x00020000) == 0); /* for it to come on */
84-
84+
8585
/* enable flash prefetch buffer */
8686
SET_REG(FLASH_ACR, 0x00000012);
8787

8888
/* Configure PLL */
8989
SET_REG(RCC_CFGR,GET_REG(RCC_CFGR) | 0x001D0400); /* pll=72Mhz,APB1=36Mhz,AHB=72Mhz */
9090
SET_REG(RCC_CR,GET_REG(RCC_CR) | 0x01000000); /* enable the pll */
9191
while ((GET_REG(RCC_CR) & 0x03000000) == 0); /* wait for it to come on */
92-
92+
9393
/* Set SYSCLK as PLL */
9494
SET_REG(RCC_CFGR,GET_REG(RCC_CFGR) | 0x00000002);
9595
while ((GET_REG(RCC_CFGR) & 0x00000008) == 0); /* wait for it to come on */
@@ -157,18 +157,18 @@ bool checkUserCode (u32 usrAddr) {
157157
void jumpToUser (u32 usrAddr) {
158158
typedef void (*funcPtr)(void);
159159

160-
u32 jumpAddr = *(vu32*) (usrAddr + 0x04); /* reset ptr in vector table */
160+
u32 jumpAddr = *(vu32*) (usrAddr + 0x04); /* reset ptr in vector table */
161161
funcPtr usrMain = (funcPtr) jumpAddr;
162162

163163
/* tear down all the dfu related setup */
164164
// disable usb interrupts, clear them, turn off usb, set the disc pin
165-
// todo pick exactly what we want to do here, now its just a conservative
165+
// todo pick exactly what we want to do here, now its just a conservative
166166
flashLock();
167167
usbDsbISR();
168168
nvicDisableInterrupts();
169169
setPin(GPIOC,12); // disconnect usb from host. todo, macroize pin
170170
systemReset(); // resets clocks and periphs, not core regs
171-
171+
172172

173173
__MSR_MSP(*(vu32*) usrAddr); /* set the users stack ptr */
174174

@@ -186,25 +186,25 @@ void nvicInit(NVIC_InitTypeDef* NVIC_InitStruct) {
186186
NVIC_TypeDef* rNVIC = (NVIC_TypeDef *) NVIC_BASE;
187187

188188

189-
/* Compute the Corresponding IRQ Priority --------------------------------*/
189+
/* Compute the Corresponding IRQ Priority --------------------------------*/
190190
tmppriority = (0x700 - (rSCB->AIRCR & (u32)0x700))>> 0x08;
191191
tmppre = (0x4 - tmppriority);
192192
tmpsub = tmpsub >> tmppriority;
193-
193+
194194
tmppriority = (u32)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
195195
tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
196196

197197
tmppriority = tmppriority << 0x04;
198198
tmppriority = ((u32)tmppriority) << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
199-
199+
200200
tmpreg = rNVIC->IPR[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)];
201201
tmpmask = (u32)0xFF << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
202202
tmpreg &= ~tmpmask;
203-
tmppriority &= tmpmask;
203+
tmppriority &= tmpmask;
204204
tmpreg |= tmppriority;
205205

206206
rNVIC->IPR[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)] = tmpreg;
207-
207+
208208
/* Enable the Selected IRQ Channels --------------------------------------*/
209209
rNVIC->ISER[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
210210
(u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);
@@ -222,7 +222,7 @@ void nvicDisableInterrupts() {
222222

223223
void systemHardReset(void) {
224224
SCB_TypeDef* rSCB = (SCB_TypeDef *) SCB_BASE;
225-
225+
226226
/* Reset */
227227
rSCB->AIRCR = (u32)AIRCR_RESET_REQ;
228228

0 commit comments

Comments
 (0)