瀏覽代碼

Update to ChibiOS 17.6.x

Technically I updated to a development version somewhere between 17.6.3
and 17.6.4, but I don't doubt its stability.

This is a good update because I'd like users of the library to be
confident that it works with the latest version of ChibiOS.
Interestingly, none of the changes I made were in the library code, so
it did before, but now I know for sure.

I'm unclear as to whether I can now get rid of the INT_N thread in favor
of a pin interrupt.  I'll have to see if I can, or if that will have to
wait for still more ChibiOS updates.
Clara Hobbs 6 年之前
父節點
當前提交
1783920e6c
共有 12 個檔案被更改,包括 193 行新增69 行删除
  1. 1
    1
      .gitmodules
  2. 1
    1
      ChibiOS
  3. 12
    5
      Makefile
  4. 1
    1
      boards/PD_BUDDY_SINK/cfg/board.chcfg
  5. 42
    21
      chconf.h
  6. 12
    5
      halconf.h
  7. 46
    11
      ld/STM32F072x8.ld
  8. 46
    11
      ld/STM32F072xB.ld
  9. 16
    4
      mcuconf.h
  10. 1
    0
      src/config.h
  11. 4
    4
      src/shell.c
  12. 11
    5
      src/usbcfg.c

+ 1
- 1
.gitmodules 查看文件

@@ -1,4 +1,4 @@
1 1
 [submodule "ChibiOS"]
2 2
 	path = ChibiOS
3 3
 	url = https://github.com/ChibiOS/ChibiOS.git
4
-	branch = stable_16.1.x
4
+	branch = stable_17.6.x

+ 1
- 1
ChibiOS

@@ -1 +1 @@
1
-Subproject commit ad728cc9bce3fb2be49d67ea55e788b6772007e2
1
+Subproject commit 5b4a1f5837a83f32fd5e5e439eaa370cc7399237

+ 12
- 5
Makefile 查看文件

@@ -69,6 +69,11 @@ ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
69 69
   USE_EXCEPTIONS_STACKSIZE = 0x400
70 70
 endif
71 71
 
72
+# Enables the use of FPU (no, softfp, hard).
73
+ifeq ($(USE_FPU),)
74
+  USE_FPU = no
75
+endif
76
+
72 77
 #
73 78
 # Architecture or project specific options
74 79
 ##############################################################################
@@ -84,7 +89,7 @@ PROJECT = pd-buddy-firmware
84 89
 CHIBIOS = ChibiOS
85 90
 PDBLIB = lib
86 91
 # Startup files.
87
-include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk
92
+include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk
88 93
 # HAL-OSAL files (optional).
89 94
 include $(CHIBIOS)/os/hal/hal.mk
90 95
 include $(CHIBIOS)/os/hal/ports/STM32/STM32F0xx/platform.mk
@@ -92,7 +97,7 @@ include $(CHIBIOS)/../boards/PD_BUDDY_SINK/board.mk
92 97
 include $(CHIBIOS)/os/hal/osal/rt/osal.mk
93 98
 # RTOS files (optional).
94 99
 include $(CHIBIOS)/os/rt/rt.mk
95
-include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
100
+include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk
96 101
 # Other files (optional).
97 102
 include $(CHIBIOS)/test/rt/test.mk
98 103
 include $(PDBLIB)/pd-buddy.mk
@@ -139,9 +144,11 @@ TCSRC =
139 144
 TCPPSRC =
140 145
 
141 146
 # List ASM source files here
142
-ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
147
+ASMSRC =
148
+ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
143 149
 
144
-INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
150
+INCDIR = $(CHIBIOS)/os/license \
151
+         $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
145 152
          $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
146 153
          $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various \
147 154
 	 $(PDBINC) \
@@ -213,7 +220,7 @@ ULIBS =
213 220
 # End of user defines
214 221
 ##############################################################################
215 222
 
216
-RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
223
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
217 224
 include $(RULESPATH)/rules.mk
218 225
 
219 226
 # Special rules follow

+ 1
- 1
boards/PD_BUDDY_SINK/cfg/board.chcfg 查看文件

@@ -6,7 +6,7 @@
6 6
   <configuration_settings>
7 7
     <templates_path>resources/gencfg/processors/boards/stm32f0xx/templates</templates_path>
8 8
     <output_path>..</output_path>
9
-    <hal_version>3.0.x</hal_version>
9
+    <hal_version>5.0.x</hal_version>
10 10
   </configuration_settings>
11 11
   <board_name>PD Buddy Sink</board_name>
12 12
   <board_id>PD_BUDDY_SINK</board_id>

+ 42
- 21
chconf.h 查看文件

@@ -17,7 +17,7 @@
17 17
  */
18 18
 
19 19
 /*
20
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
20
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
21 21
 
22 22
     Licensed under the Apache License, Version 2.0 (the "License");
23 23
     you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
33 33
 */
34 34
 
35 35
 /**
36
- * @file    chconf.h
36
+ * @file    templates/chconf.h
37 37
  * @brief   Configuration file template.
38 38
  * @details A copy of this file must be placed in each project directory, it
39 39
  *          contains the application specific kernel settings.
@@ -43,8 +43,10 @@
43 43
  * @{
44 44
  */
45 45
 
46
-#ifndef _CHCONF_H_
47
-#define _CHCONF_H_
46
+#ifndef CHCONF_H
47
+#define CHCONF_H
48
+
49
+#define _CHIBIOS_RT_CONF_
48 50
 
49 51
 /*===========================================================================*/
50 52
 /**
@@ -280,14 +282,6 @@
280 282
  */
281 283
 #define CH_CFG_USE_MAILBOXES                TRUE
282 284
 
283
-/**
284
- * @brief   I/O Queues APIs.
285
- * @details If enabled then the I/O queues APIs are included in the kernel.
286
- *
287
- * @note    The default is @p TRUE.
288
- */
289
-#define CH_CFG_USE_QUEUES                   TRUE
290
-
291 285
 /**
292 286
  * @brief   Core Memory Manager APIs.
293 287
  * @details If enabled then the core memory manager APIs are included
@@ -375,12 +369,18 @@
375 369
 
376 370
 /**
377 371
  * @brief   Debug option, trace buffer.
378
- * @details If enabled then the context switch circular trace buffer is
379
- *          activated.
372
+ * @details If enabled then the trace buffer is activated.
380 373
  *
381
- * @note    The default is @p FALSE.
374
+ * @note    The default is @p CH_DBG_TRACE_MASK_DISABLED.
375
+ */
376
+#define CH_DBG_TRACE_MASK                   CH_DBG_TRACE_MASK_DISABLED
377
+
378
+/**
379
+ * @brief   Trace buffer entries.
380
+ * @note    The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
381
+ *          different from @p CH_DBG_TRACE_MASK_DISABLED.
382 382
  */
383
-#define CH_DBG_ENABLE_TRACE                 FALSE
383
+#define CH_DBG_TRACE_BUFFER_SIZE            128
384 384
 
385 385
 /**
386 386
  * @brief   Debug option, stack checks.
@@ -445,10 +445,6 @@
445 445
 /**
446 446
  * @brief   Threads finalization hook.
447 447
  * @details User finalization code added to the @p chThdExit() API.
448
- *
449
- * @note    It is inserted into lock zone.
450
- * @note    It is also invoked when the threads simply return in order to
451
- *          terminate.
452 448
  */
453 449
 #define CH_CFG_THREAD_EXIT_HOOK(tp) {                                       \
454 450
   /* Add threads finalization code here.*/                                  \
@@ -462,6 +458,20 @@
462 458
   /* Context switch code here.*/                                            \
463 459
 }
464 460
 
461
+/**
462
+ * @brief   ISR enter hook.
463
+ */
464
+#define CH_CFG_IRQ_PROLOGUE_HOOK() {                                        \
465
+  /* IRQ prologue code here.*/                                              \
466
+}
467
+
468
+/**
469
+ * @brief   ISR exit hook.
470
+ */
471
+#define CH_CFG_IRQ_EPILOGUE_HOOK() {                                        \
472
+  /* IRQ epilogue code here.*/                                              \
473
+}
474
+
465 475
 /**
466 476
  * @brief   Idle thread enter hook.
467 477
  * @note    This hook is invoked within a critical zone, no OS functions
@@ -469,6 +479,7 @@
469 479
  * @note    This macro can be used to activate a power saving mode.
470 480
  */
471 481
 #define CH_CFG_IDLE_ENTER_HOOK() {                                          \
482
+  /* Idle-enter code here.*/                                                \
472 483
 }
473 484
 
474 485
 /**
@@ -478,6 +489,7 @@
478 489
  * @note    This macro can be used to deactivate a power saving mode.
479 490
  */
480 491
 #define CH_CFG_IDLE_LEAVE_HOOK() {                                          \
492
+  /* Idle-leave code here.*/                                                \
481 493
 }
482 494
 
483 495
 /**
@@ -506,12 +518,21 @@
506 518
   /* System halt code here.*/                                               \
507 519
 }
508 520
 
521
+/**
522
+ * @brief   Trace hook.
523
+ * @details This hook is invoked each time a new record is written in the
524
+ *          trace buffer.
525
+ */
526
+#define CH_CFG_TRACE_HOOK(tep) {                                            \
527
+  /* Trace code here.*/                                                     \
528
+}
529
+
509 530
 /** @} */
510 531
 
511 532
 /*===========================================================================*/
512 533
 /* Port-specific settings (override port settings defaulted in chcore.h).    */
513 534
 /*===========================================================================*/
514 535
 
515
-#endif  /* _CHCONF_H_ */
536
+#endif  /* CHCONF_H */
516 537
 
517 538
 /** @} */

+ 12
- 5
halconf.h 查看文件

@@ -17,7 +17,7 @@
17 17
  */
18 18
 
19 19
 /*
20
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
20
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
21 21
 
22 22
     Licensed under the Apache License, Version 2.0 (the "License");
23 23
     you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
33 33
 */
34 34
 
35 35
 /**
36
- * @file    halconf.h
36
+ * @file    templates/halconf.h
37 37
  * @brief   HAL configuration header.
38 38
  * @details HAL configuration file, this file allows to enable or disable the
39 39
  *          various device drivers from your application. You may also use
@@ -43,8 +43,8 @@
43 43
  * @{
44 44
  */
45 45
 
46
-#ifndef _HALCONF_H_
47
-#define _HALCONF_H_
46
+#ifndef HALCONF_H
47
+#define HALCONF_H
48 48
 
49 49
 #include "mcuconf.h"
50 50
 
@@ -132,6 +132,13 @@
132 132
 #define HAL_USE_PWM                 FALSE
133 133
 #endif
134 134
 
135
+/**
136
+ * @brief   Enables the QSPI subsystem.
137
+ */
138
+#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
139
+#define HAL_USE_QSPI                FALSE
140
+#endif
141
+
135 142
 /**
136 143
  * @brief   Enables the RTC subsystem.
137 144
  */
@@ -394,6 +401,6 @@
394 401
 #define USB_USE_WAIT                FALSE
395 402
 #endif
396 403
 
397
-#endif /* _HALCONF_H_ */
404
+#endif /* HALCONF_H */
398 405
 
399 406
 /** @} */

+ 46
- 11
ld/STM32F072x8.ld 查看文件

@@ -1,5 +1,5 @@
1 1
 /*
2
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
2
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3 3
 
4 4
     Licensed under the Apache License, Version 2.0 (the "License");
5 5
     you may not use this file except in compliance with the License.
@@ -22,19 +22,52 @@
22 22
  */
23 23
 MEMORY
24 24
 {
25
-    flash : org = 0x08000000, len = 62k
26
-    ram0  : org = 0x20000000, len = 16k
27
-    ram1  : org = 0x00000000, len = 0
28
-    ram2  : org = 0x00000000, len = 0
29
-    ram3  : org = 0x00000000, len = 0
30
-    ram4  : org = 0x00000000, len = 0
31
-    ram5  : org = 0x00000000, len = 0
32
-    ram6  : org = 0x00000000, len = 0
33
-    ram7  : org = 0x00000000, len = 0
25
+    flash0  : org = 0x08000000, len = 62k
26
+    flash1  : org = 0x00000000, len = 0
27
+    flash2  : org = 0x00000000, len = 0
28
+    flash3  : org = 0x00000000, len = 0
29
+    flash4  : org = 0x00000000, len = 0
30
+    flash5  : org = 0x00000000, len = 0
31
+    flash6  : org = 0x00000000, len = 0
32
+    flash7  : org = 0x00000000, len = 0
33
+    ram0    : org = 0x20000000, len = 16k
34
+    ram1    : org = 0x00000000, len = 0
35
+    ram2    : org = 0x00000000, len = 0
36
+    ram3    : org = 0x00000000, len = 0
37
+    ram4    : org = 0x00000000, len = 0
38
+    ram5    : org = 0x00000000, len = 0
39
+    ram6    : org = 0x00000000, len = 0
40
+    ram7    : org = 0x00000000, len = 0
34 41
 }
35 42
 
43
+/* For each data/text section two region are defined, a virtual region
44
+   and a load region (_LMA suffix).*/
45
+
46
+/* Flash region to be used for exception vectors.*/
47
+REGION_ALIAS("VECTORS_FLASH", flash0);
48
+REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
49
+
50
+/* Flash region to be used for constructors and destructors.*/
51
+REGION_ALIAS("XTORS_FLASH", flash0);
52
+REGION_ALIAS("XTORS_FLASH_LMA", flash0);
53
+
54
+/* Flash region to be used for code text.*/
55
+REGION_ALIAS("TEXT_FLASH", flash0);
56
+REGION_ALIAS("TEXT_FLASH_LMA", flash0);
57
+
58
+/* Flash region to be used for read only data.*/
59
+REGION_ALIAS("RODATA_FLASH", flash0);
60
+REGION_ALIAS("RODATA_FLASH_LMA", flash0);
61
+
62
+/* Flash region to be used for various.*/
63
+REGION_ALIAS("VARIOUS_FLASH", flash0);
64
+REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
65
+
66
+/* Flash region to be used for RAM(n) initialization data.*/
67
+REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
68
+
36 69
 /* RAM region to be used for Main stack. This stack accommodates the processing
37
-   of all exceptions and interrupts*/
70
+   of all exceptions and interrupts.*/
38 71
 REGION_ALIAS("MAIN_STACK_RAM", ram0);
39 72
 
40 73
 /* RAM region to be used for the process stack. This is the stack used by
@@ -43,6 +76,7 @@ REGION_ALIAS("PROCESS_STACK_RAM", ram0);
43 76
 
44 77
 /* RAM region to be used for data segment.*/
45 78
 REGION_ALIAS("DATA_RAM", ram0);
79
+REGION_ALIAS("DATA_RAM_LMA", flash0);
46 80
 
47 81
 /* RAM region to be used for BSS segment.*/
48 82
 REGION_ALIAS("BSS_RAM", ram0);
@@ -50,4 +84,5 @@ REGION_ALIAS("BSS_RAM", ram0);
50 84
 /* RAM region to be used for the default heap.*/
51 85
 REGION_ALIAS("HEAP_RAM", ram0);
52 86
 
87
+/* Generic rules inclusion.*/
53 88
 INCLUDE rules.ld

+ 46
- 11
ld/STM32F072xB.ld 查看文件

@@ -1,5 +1,5 @@
1 1
 /*
2
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
2
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3 3
 
4 4
     Licensed under the Apache License, Version 2.0 (the "License");
5 5
     you may not use this file except in compliance with the License.
@@ -22,19 +22,52 @@
22 22
  */
23 23
 MEMORY
24 24
 {
25
-    flash : org = 0x08000000, len = 126k
26
-    ram0  : org = 0x20000000, len = 16k
27
-    ram1  : org = 0x00000000, len = 0
28
-    ram2  : org = 0x00000000, len = 0
29
-    ram3  : org = 0x00000000, len = 0
30
-    ram4  : org = 0x00000000, len = 0
31
-    ram5  : org = 0x00000000, len = 0
32
-    ram6  : org = 0x00000000, len = 0
33
-    ram7  : org = 0x00000000, len = 0
25
+    flash0  : org = 0x08000000, len = 126k
26
+    flash1  : org = 0x00000000, len = 0
27
+    flash2  : org = 0x00000000, len = 0
28
+    flash3  : org = 0x00000000, len = 0
29
+    flash4  : org = 0x00000000, len = 0
30
+    flash5  : org = 0x00000000, len = 0
31
+    flash6  : org = 0x00000000, len = 0
32
+    flash7  : org = 0x00000000, len = 0
33
+    ram0    : org = 0x20000000, len = 16k
34
+    ram1    : org = 0x00000000, len = 0
35
+    ram2    : org = 0x00000000, len = 0
36
+    ram3    : org = 0x00000000, len = 0
37
+    ram4    : org = 0x00000000, len = 0
38
+    ram5    : org = 0x00000000, len = 0
39
+    ram6    : org = 0x00000000, len = 0
40
+    ram7    : org = 0x00000000, len = 0
34 41
 }
35 42
 
43
+/* For each data/text section two region are defined, a virtual region
44
+   and a load region (_LMA suffix).*/
45
+
46
+/* Flash region to be used for exception vectors.*/
47
+REGION_ALIAS("VECTORS_FLASH", flash0);
48
+REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
49
+
50
+/* Flash region to be used for constructors and destructors.*/
51
+REGION_ALIAS("XTORS_FLASH", flash0);
52
+REGION_ALIAS("XTORS_FLASH_LMA", flash0);
53
+
54
+/* Flash region to be used for code text.*/
55
+REGION_ALIAS("TEXT_FLASH", flash0);
56
+REGION_ALIAS("TEXT_FLASH_LMA", flash0);
57
+
58
+/* Flash region to be used for read only data.*/
59
+REGION_ALIAS("RODATA_FLASH", flash0);
60
+REGION_ALIAS("RODATA_FLASH_LMA", flash0);
61
+
62
+/* Flash region to be used for various.*/
63
+REGION_ALIAS("VARIOUS_FLASH", flash0);
64
+REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
65
+
66
+/* Flash region to be used for RAM(n) initialization data.*/
67
+REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
68
+
36 69
 /* RAM region to be used for Main stack. This stack accommodates the processing
37
-   of all exceptions and interrupts*/
70
+   of all exceptions and interrupts.*/
38 71
 REGION_ALIAS("MAIN_STACK_RAM", ram0);
39 72
 
40 73
 /* RAM region to be used for the process stack. This is the stack used by
@@ -43,6 +76,7 @@ REGION_ALIAS("PROCESS_STACK_RAM", ram0);
43 76
 
44 77
 /* RAM region to be used for data segment.*/
45 78
 REGION_ALIAS("DATA_RAM", ram0);
79
+REGION_ALIAS("DATA_RAM_LMA", flash0);
46 80
 
47 81
 /* RAM region to be used for BSS segment.*/
48 82
 REGION_ALIAS("BSS_RAM", ram0);
@@ -50,4 +84,5 @@ REGION_ALIAS("BSS_RAM", ram0);
50 84
 /* RAM region to be used for the default heap.*/
51 85
 REGION_ALIAS("HEAP_RAM", ram0);
52 86
 
87
+/* Generic rules inclusion.*/
53 88
 INCLUDE rules.ld

+ 16
- 4
mcuconf.h 查看文件

@@ -17,7 +17,7 @@
17 17
  */
18 18
 
19 19
 /*
20
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
20
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
21 21
 
22 22
     Licensed under the Apache License, Version 2.0 (the "License");
23 23
     you may not use this file except in compliance with the License.
@@ -32,8 +32,8 @@
32 32
     limitations under the License.
33 33
 */
34 34
 
35
-#ifndef _MCUCONF_H_
36
-#define _MCUCONF_H_
35
+#ifndef MCUCONF_H
36
+#define MCUCONF_H
37 37
 
38 38
 /*
39 39
  * STM32F0xx drivers configuration.
@@ -211,8 +211,11 @@
211 211
  */
212 212
 #define STM32_SERIAL_USE_USART1             FALSE
213 213
 #define STM32_SERIAL_USE_USART2             FALSE
214
+#define STM32_SERIAL_USE_USART3             FALSE
215
+#define STM32_SERIAL_USE_UART4              FALSE
214 216
 #define STM32_SERIAL_USART1_PRIORITY        3
215 217
 #define STM32_SERIAL_USART2_PRIORITY        3
218
+#define STM32_SERIAL_USART3_8_PRIORITY      3
216 219
 
217 220
 /*
218 221
  * SPI driver system settings.
@@ -240,14 +243,23 @@
240 243
  */
241 244
 #define STM32_UART_USE_USART1               FALSE
242 245
 #define STM32_UART_USE_USART2               FALSE
246
+#define STM32_UART_USE_USART3               FALSE
247
+#define STM32_UART_USE_UART4                FALSE
243 248
 #define STM32_UART_USART1_IRQ_PRIORITY      3
244 249
 #define STM32_UART_USART2_IRQ_PRIORITY      3
250
+#define STM32_UART_USART3_8_IRQ_PRIORITY    3
245 251
 #define STM32_UART_USART1_DMA_PRIORITY      0
246 252
 #define STM32_UART_USART2_DMA_PRIORITY      0
253
+#define STM32_UART_USART3_DMA_PRIORITY      0
254
+#define STM32_UART_UART4_DMA_PRIORITY       0
247 255
 #define STM32_UART_USART1_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 3)
248 256
 #define STM32_UART_USART1_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 2)
249 257
 #define STM32_UART_USART2_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 5)
250 258
 #define STM32_UART_USART2_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 4)
259
+#define STM32_UART_USART3_RX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 3)
260
+#define STM32_UART_USART3_TX_DMA_STREAM     STM32_DMA_STREAM_ID(1, 2)
261
+#define STM32_UART_UART4_RX_DMA_STREAM      STM32_DMA_STREAM_ID(1, 6)
262
+#define STM32_UART_UART4_TX_DMA_STREAM      STM32_DMA_STREAM_ID(1, 7)
251 263
 #define STM32_UART_DMA_ERROR_HOOK(uartp)    osalSysHalt("DMA failure")
252 264
 
253 265
 /*
@@ -262,4 +274,4 @@
262 274
  */
263 275
 #define STM32_WDG_USE_IWDG                  FALSE
264 276
 
265
-#endif /* _MCUCONF_H_ */
277
+#endif /* MCUCONF_H */

+ 1
- 0
src/config.h 查看文件

@@ -22,6 +22,7 @@
22 22
 #include <stdint.h>
23 23
 
24 24
 #include <ch.h>
25
+#include <hal.h>
25 26
 
26 27
 
27 28
 /*

+ 4
- 4
src/shell.c 查看文件

@@ -674,9 +674,9 @@ bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size)
674 674
         /* Delete a character if ASCII backspace or delete is received */
675 675
         if ((c == '\b') || (c == '\x7F')) {
676 676
             if (p != line) {
677
-                chSequentialStreamPut(chp, 0x08);
678
-                chSequentialStreamPut(chp, 0x20);
679
-                chSequentialStreamPut(chp, 0x08);
677
+                streamPut(chp, 0x08);
678
+                streamPut(chp, 0x20);
679
+                streamPut(chp, 0x08);
680 680
                 p--;
681 681
             }
682 682
             continue;
@@ -692,7 +692,7 @@ bool shellGetLine(BaseSequentialStream *chp, char *line, unsigned size)
692 692
             continue;
693 693
         /* If there's room in the line buffer, append the new character */
694 694
         if (p < line + size - 1) {
695
-            chSequentialStreamPut(chp, c);
695
+            streamPut(chp, c);
696 696
             *p++ = (char)c;
697 697
         }
698 698
     }

+ 11
- 5
src/usbcfg.c 查看文件

@@ -17,7 +17,7 @@
17 17
  */
18 18
 
19 19
 /*
20
-    ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
20
+    ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
21 21
 
22 22
     Licensed under the Apache License, Version 2.0 (the "License");
23 23
     you may not use this file except in compliance with the License.
@@ -292,8 +292,6 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
292 292
     extern SerialUSBDriver SDU1;
293 293
 
294 294
     switch (event) {
295
-        case USB_EVENT_RESET:
296
-            return;
297 295
         case USB_EVENT_ADDRESS:
298 296
             return;
299 297
         case USB_EVENT_CONFIGURED:
@@ -310,17 +308,25 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
310 308
 
311 309
             chSysUnlockFromISR();
312 310
             return;
311
+        case USB_EVENT_RESET:
312
+            /* Falls into.*/
313 313
         case USB_EVENT_UNCONFIGURED:
314
-            return;
314
+            /* Falls into.*/
315 315
         case USB_EVENT_SUSPEND:
316 316
             chSysLockFromISR();
317 317
 
318 318
             /* Disconnection event on suspend.*/
319
-            sduDisconnectI(&SDU1);
319
+            sduSuspendHookI(&SDU1);
320 320
 
321 321
             chSysUnlockFromISR();
322 322
             return;
323 323
         case USB_EVENT_WAKEUP:
324
+            chSysLockFromISR();
325
+
326
+            /* Disconnection event on suspend.*/
327
+            sduWakeupHookI(&SDU1);
328
+
329
+            chSysUnlockFromISR();
324 330
             return;
325 331
         case USB_EVENT_STALLED:
326 332
             return;

Loading…
取消
儲存