-
Notifications
You must be signed in to change notification settings - Fork 548
/
hw_config.h
1653 lines (1358 loc) · 66.2 KB
/
hw_config.h
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* hw_config.h
*
* Created on: May 17, 2015
* Author: david_s5
*/
#ifndef HW_CONFIG_H_
#define HW_CONFIG_H_
/****************************************************************************
* 10-8--2016:
* To simplify the ripple effect on the tools, we will be using
* /dev/serial/by-id/<asterisk>PX4<asterisk> to locate PX4 devices. Therefore
* moving forward all Bootloaders must contain the prefix "PX4 BL "
* in the USBDEVICESTRING
* This Change will be made in an upcoming BL release
****************************************************************************/
/*
* Define usage to configure a bootloader
*
*
* Constant example Usage
* APP_LOAD_ADDRESS 0x08004000 - The address in Linker Script, where the app fw is org-ed
* BOOTLOADER_DELAY 5000 - Ms to wait while under USB pwr or bootloader request
* BOARD_FMUV2
* INTERFACE_USB 1 - (Optional) Scan and use the USB interface for bootloading
* INTERFACE_USART 1 - (Optional) Scan and use the Serial interface for bootloading
* USBDEVICESTRING "PX4 BL FMU v2.x" - USB id string
* USBPRODUCTID 0x0011 - PID Should match defconfig
* BOOT_DELAY_ADDRESS 0x000001a0 - (Optional) From the linker script from Linker Script to get a custom
* delay provided by an APP FW
* BOARD_TYPE 9 - Must match .prototype boad_id
* _FLASH_KBYTES (*(uint16_t *)0x1fff7a22) - Run time flash size detection
* BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23) - Run time determine the physical last sector
* BOARD_FLASH_SECTORS 11 - Hard coded zero based last sector
* BOARD_FLASH_SIZE (_FLASH_KBYTES*1024)- Total Flash size of device, determined at run time.
* (1024 * 1024) - Hard coded Total Flash of device - The bootloader and app reserved will be deducted
* programmatically
*
* BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2 - Optional sectors index in the flash_sectors table (F4 only), to begin erasing.
* This is to allow sectors to be reserved for app fw usage. That will NOT be erased
* during a FW upgrade.
* The default is 0, and selects the first sector to be erased, as the 0th entry in the
* flash_sectors table. Which is the second physical sector of FLASH in the device.
* The first physical sector of FLASH is used by the bootloader, and is not defined
* in the table.
*
* APP_RESERVATION_SIZE (BOARD_FIRST_FLASH_SECTOR_TO_ERASE * 16 * 1024) - Number of bytes reserved by the APP FW. This number plus
* BOOTLOADER_RESERVATION_SIZE will be deducted from
* BOARD_FLASH_SIZE to determine the size of the App FW
* and hence the address space of FLASH to erase and program.
* USBMFGSTRING "PX4 AP" - Optional USB MFG string (default is '3D Robotics' if not defined.)
* SERIAL_BREAK_DETECT_DISABLED - Optional prevent break selection on Serial port from entering or staying in BL
*
* * Other defines are somewhat self explanatory.
*/
/* Boot device selection list*/
#define USB0_DEV 0x01
#define SERIAL0_DEV 0x02
#define SERIAL1_DEV 0x04
#if defined(TARGET_HW_PX4_FMU_V1)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMU
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v1.x"
# define USBPRODUCTID 0x0010
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 5
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO15
# define BOARD_PIN_LED_BOOTLOADER GPIO14
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART1
# define BOARD_USART_CLOCK_REGISTER RCC_APB2ENR
# define BOARD_USART_CLOCK_BIT RCC_APB2ENR_USART1EN
# define BOARD_PORT_USART GPIOB
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO6
# define BOARD_PIN_RX GPIO7
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPBEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* the PPM-in pin. Some receivers pull their PPM output low
* when the transmitter is off, resulting in a stuck bootup,
* so this feature is best disabled.
*
* # define BOARD_FORCE_BL_PIN GPIO10
* # define BOARD_FORCE_BL_PORT GPIOA
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPAEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
* # define BOARD_FORCE_BL_STATE 0
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V2
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V2)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v2.x"
# define USBPRODUCTID 0x0011
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 9
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
# define BOARD_PIN_LED_BOOTLOADER GPIO12
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V3
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V3)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v3.x"
# define USBPRODUCTID 0x0011
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 9
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
# define BOARD_PIN_LED_BOOTLOADER GPIO12
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V4
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V4)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v4.x"
# define USBPRODUCTID 0x0012
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 11
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO3
# define BOARD_PIN_LED_BOOTLOADER GPIO11|GPIO1
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART1
# define BOARD_USART_CLOCK_REGISTER RCC_APB2ENR
# define BOARD_USART_CLOCK_BIT RCC_APB2ENR_USART1EN
# define BOARD_PORT_USART GPIOB
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO6
# define BOARD_PIN_RX GPIO7
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPBEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V4_PRO
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V4_PRO)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v4.x PRO"
# define USBPRODUCTID 0x0013
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 13
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO3
# define BOARD_PIN_LED_BOOTLOADER GPIO11|GPIO1
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V5
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V5)
# define APP_LOAD_ADDRESS 0x08008000
# define BOOTLOADER_DELAY 5000
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v5.x"
# define USBPRODUCTID 0x0032
# define BOOT_DELAY_ADDRESS 0x00000200
# define BOARD_TYPE 50
# define _FLASH_KBYTES (*(uint16_t *)0x1ff0f442)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 7 : 11)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 16
# define BOARD_PIN_LED_ACTIVITY GPIO7 // BLUE
# define BOARD_PIN_LED_BOOTLOADER GPIO6 // GREEN
# define BOARD_PORT_LEDS GPIOC
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOCEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_GPIODEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FMU_V5X
****************************************************************************/
#elif defined(TARGET_HW_PX4_FMU_V5X)
# define APP_LOAD_ADDRESS 0x08008000
# define BOOTLOADER_DELAY 5000
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL FMU v5X.x"
# define USBPRODUCTID 0x0033
# define USBVENDORID 0x3185
# define USBMFGSTRING "Auterion"
# define BOOT_DELAY_ADDRESS 0x00000200
# define BOARD_TYPE 51
# define _FLASH_KBYTES (*(uint16_t *)0x1ff0f442)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 7 : 11)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 16
# define BOARD_PIN_LED_ACTIVITY GPIO5 // BLUE
# define BOARD_PIN_LED_BOOTLOADER GPIO4 // GREEN
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART UART5
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_UART5EN
# define BOARD_PORT_USART_AF_TX GPIO_AF7
# define BOARD_PORT_USART_TX GPIOB
# define BOARD_PIN_TX GPIO9
# define BOARD_PORT_USART_AF_RX GPIO_AF8
# define BOARD_PORT_USART_RX GPIOD
# define BOARD_PIN_RX GPIO2
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT_TX RCC_AHB1ENR_GPIOBEN
# define BOARD_USART_PIN_CLOCK_BIT_RX RCC_AHB1ENR_GPIODEN
# define SERIAL_BREAK_DETECT_DISABLED 1
# define OVERRIDE_USART_BAUDRATE 1500000
/****************************************************************************
* TARGET_HW_MINDPX_V2
****************************************************************************/
#elif defined(TARGET_HW_MINDPX_V2)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "MindPX BL FMU v2.x"
# define USBPRODUCTID 0x0030
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 88
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
# define BOARD_PIN_LED_BOOTLOADER GPIO8
# define BOARD_PORT_LEDS GPIOA
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPAEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
/****************************************************************************
* TARGET_HW_PX4_FLOW_V1
****************************************************************************/
#elif defined(TARGET_HW_PX4_FLOW_V1)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FLOW
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "PX4 BL FLOW v1.3"
# define USBPRODUCTID 0x0015
# define BOARD_TYPE 6
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO3
# define BOARD_PIN_LED_BOOTLOADER GPIO2
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
/****************************************************************************
* TARGET_HW_PX4_DISCOVERY_V1
****************************************************************************/
#elif defined(TARGET_HW_PX4_DISCOVERY_V1)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_DISCOVERY
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "PX4 BL DISCOVERY"
# define USBPRODUCTID 0x0001
# define BOARD_TYPE 99
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY GPIO12
# define BOARD_PIN_LED_BOOTLOADER GPIO13
# define BOARD_PORT_LEDS GPIOD
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPDEN
# define BOARD_LED_ON gpio_set
# define BOARD_LED_OFF gpio_clear
/****************************************************************************
* TARGET_HW_PX4_PIO_V1 or TARGET_HW_PX4_PIO_V2
****************************************************************************/
#elif defined(TARGET_HW_PX4_PIO_V1) || defined(TARGET_HW_PX4_PIO_V2)
# define APP_LOAD_ADDRESS 0x08001000
# define APP_SIZE_MAX 0xf000
# define BOOTLOADER_DELAY 200
# define BOARD_PIO
# define INTERFACE_USB 0
# define INTERFACE_USART 1
# define USBDEVICESTRING ""
# define USBPRODUCTID -1
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO14
# define BOARD_PIN_LED_BOOTLOADER GPIO15
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS_REGISTER RCC_APB2ENR
# define BOARD_CLOCK_LEDS RCC_APB2ENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOA
# define BOARD_PIN_TX GPIO_USART2_TX
# define BOARD_PIN_RX GPIO_USART2_RX
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_APB2ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_APB2ENR_IOPAEN
# define BOARD_FORCE_BL_PIN GPIO5
# define BOARD_FORCE_BL_PORT GPIOB
# define BOARD_FORCE_BL_CLOCK_REGISTER RCC_APB2ENR
# define BOARD_FORCE_BL_CLOCK_BIT RCC_APB2ENR_IOPBEN
# define BOARD_FORCE_BL_PULL GPIO_CNF_INPUT_FLOAT // depend on external pull
# define BOARD_FORCE_BL_VALUE BOARD_FORCE_BL_PIN
# define BOARD_FLASH_SECTORS 60
# define BOARD_TYPE 10
# define FLASH_SECTOR_SIZE 0x400
# define NO_OTP_SN_CHIP 1
/****************************************************************************
* TARGET_HW_PX4_PIO_V3
****************************************************************************/
#elif defined(TARGET_HW_PX4_PIO_V3)
# define APP_LOAD_ADDRESS 0x08001000
# define APP_SIZE_MAX 0x3f000
# define BOOTLOADER_DELAY 200
# define BOARD_PIO
# define INTERFACE_USB 0
# define INTERFACE_USART 1
# define USBDEVICESTRING ""
# define USBPRODUCTID -1
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY 0
# define BOARD_PIN_LED_BOOTLOADER GPIO13
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS_REGISTER RCC_AHBENR
# define BOARD_CLOCK_LEDS RCC_AHBENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOA
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO2
# define BOARD_PIN_RX GPIO3
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHBENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHBENR_IOPAEN
# define BOARD_FORCE_BL_PIN GPIO5
# define BOARD_FORCE_BL_PORT GPIOB
# define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHBENR
# define BOARD_FORCE_BL_CLOCK_BIT RCC_AHBENR_IOPBEN
# define BOARD_FORCE_BL_PULL GPIO_PUPD_NONE // depend on external pull
# define BOARD_FORCE_BL_VALUE BOARD_FORCE_BL_PIN
# define BOARD_FLASH_SECTORS (128-4) /* application #sec - bootloader - sec */
# define BOARD_TYPE 13
# define FLASH_SECTOR_SIZE 0x800
/****************************************************************************
* TARGET_HW_PX4_AEROCORE_V1
****************************************************************************/
#elif defined(TARGET_HW_PX4_AEROCORE_V1)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_AEROCORE
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "Gumstix BL AEROCORE"
# define USBPRODUCTID 0x1001
# define BOARD_TYPE 98
# define BOARD_FLASH_SECTORS 23
# define BOARD_FLASH_SIZE (2048 * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY GPIO10 // Yellow
# define BOARD_PIN_LED_BOOTLOADER GPIO9 // Blue
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_FORCE_BL_PIN_OUT GPIO0 // J11 header, pin 1
# define BOARD_FORCE_BL_PIN_IN GPIO1 // J11 header, pin 3
# define BOARD_FORCE_BL_PORT GPIOB
# define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPBEN
# define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
/****************************************************************************
* TARGET_HW_TAP_V1
****************************************************************************/
#elif defined(TARGET_HW_TAP_V1)
# define APP_LOAD_ADDRESS 0x0800C000
# define BOOTLOADER_DELAY 5000
# define BOARD_TAP
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL TAP v1.x"
# define USBPRODUCTID 0x0040
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 64
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
# define APP_RESERVATION_SIZE (2 * 16 * 1024) /* 2 16 Kib Sectors */
# define OSC_FREQ 16
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOA
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO2
# define BOARD_PIN_RX GPIO3
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPAEN
# define BOARD_PIN_LED_ACTIVITY GPIO4
# define BOARD_PIN_LED_BOOTLOADER GPIO5
# define BOARD_PORT_LEDS GPIOC
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPCEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_POWER_PIN_OUT GPIO4
# define BOARD_POWER_PORT GPIOA
# define BOARD_POWER_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_POWER_CLOCK_BIT RCC_AHB1ENR_IOPAEN
# define BOARD_POWER_ON gpio_set
# define BOARD_POWER_OFF gpio_clear
# undef BOARD_POWER_PIN_RELEASE /* Leave pin enabling Power - un comment to release (disable power)*/
# define USBMFGSTRING "The Autopilot"
# define USB_FORCE_DISCONNECT 1
#define SERIAL_BREAK_DETECT_DISABLED 1
/****************************************************************************
* TARGET_HW_CRAZYFLIE
****************************************************************************/
#elif defined(TARGET_HW_CRAZYFLIE)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_CRAZYFLIE
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "Crazyflie BL"
# define USBPRODUCTID 0x0016
# define BOARD_TYPE 12
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY GPIO0
# define BOARD_PIN_LED_BOOTLOADER GPIO2
# define BOARD_PORT_LEDS GPIOC
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPCEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USB_VBUS_SENSE_DISABLED
# define USBMFGSTRING "Bitcraze AB"
#elif defined(TARGET_HW_CRAZYFLIE21)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_CRAZYFLIE21
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "Crazyflie21 BL"
# define USBPRODUCTID 0x0016
# define BOARD_TYPE 14
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY GPIO0
# define BOARD_PIN_LED_BOOTLOADER GPIO2
# define BOARD_PORT_LEDS GPIOC
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPCEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USB_VBUS_SENSE_DISABLED
# define USBMFGSTRING "Bitcraze AB"
/****************************************************************************
* TARGET_HW_OMNIBUS_NXT
****************************************************************************/
#elif defined(TARGET_HW_OMNIBUSF4SD)
# define APP_LOAD_ADDRESS 0x08008000
# define BOOTLOADER_DELAY 5000
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "PX4 OmnibusF4SD"
# define USBPRODUCTID 0x0016
# define BOARD_TYPE 42
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 1
# define APP_RESERVATION_SIZE (1 * 16 * 1024) /* 1 16 Kib Sectors */
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY GPIO5
# define BOARD_PIN_LED_BOOTLOADER GPIO4
# define BOARD_PORT_LEDS GPIOB
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USB_VBUS_SENSE_DISABLED
# define USBMFGSTRING "Vertile"
/****************************************************************************
* TARGET_HW_KAKUTEF7
****************************************************************************/
#elif defined(TARGET_HW_KAKUTEF7)
# define APP_LOAD_ADDRESS 0x08018000
# define BOOTLOADER_DELAY 5000
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING "PX4 KakuteF7"
# define USBPRODUCTID 0x0016
# define BOOT_DELAY_ADDRESS 0x00000200
# define BOARD_TYPE 123
# define BOARD_FLASH_SECTORS 7
# define BOARD_FLASH_SIZE (1024 * 1024)
# define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
# define APP_RESERVATION_SIZE (2 * 32 * 1024) /* 2 32 Kib Sectors */
# define OSC_FREQ 8
# define BOARD_PIN_LED_ACTIVITY 0
# define BOARD_PIN_LED_BOOTLOADER GPIO2 // BLUE
# define BOARD_PORT_LEDS GPIOA
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_GPIOAEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define USBMFGSTRING "Holybro"
// VBUS sense is connected to PA8 instead of PA9
# define BOARD_USB_VBUS_SENSE_DISABLED
# define BOARD_PORT_VBUS GPIOA
# define BOARD_PIN_VBUS GPIO8
# define BOARD_USART USART3 // labeled as UART3
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART3EN
# define BOARD_PORT_USART GPIOB
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO10
# define BOARD_PIN_RX GPIO11
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_GPIOBEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/****************************************************************************
* TARGET_HW_AUAV_X2V1
****************************************************************************/
#elif defined(TARGET_HW_AUAV_X2V1)
# define APP_LOAD_ADDRESS 0x08004000
# define BOOTLOADER_DELAY 5000
# define BOARD_FMUV2
# define INTERFACE_USB 1
# define INTERFACE_USART 1
# define USBDEVICESTRING "PX4 BL AUAV X2.1"
# define USBPRODUCTID 0x0021
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 33
# define _FLASH_KBYTES (*(uint16_t *)0x1fff7a22)
# define BOARD_FLASH_SECTORS ((_FLASH_KBYTES == 0x400) ? 11 : 23)
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define OSC_FREQ 24
# define BOARD_PIN_LED_ACTIVITY 0 // no activity LED
# define BOARD_PIN_LED_BOOTLOADER GPIO12
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOD
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO5
# define BOARD_PIN_RX GPIO6
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPDEN
# define SERIAL_BREAK_DETECT_DISABLED 1
/*
* Uncommenting this allows to force the bootloader through
* a PWM output pin. As this can accidentally initialize
* an ESC prematurely, it is not recommended. This feature
* has not been used and hence defaults now to off.
*
* # define BOARD_FORCE_BL_PIN_OUT GPIO14
* # define BOARD_FORCE_BL_PIN_IN GPIO11
* # define BOARD_FORCE_BL_PORT GPIOE
* # define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
* # define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPEEN
* # define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLUP
*/
# define USBMFGSTRING "AUAV"
/****************************************************************************
* TARGET_HW_PX4_AEROFC_V1
****************************************************************************/
#elif defined(TARGET_HW_AEROFC_V1)
# define APP_LOAD_ADDRESS 0x0800C000
# define BOOTLOADER_DELAY 5000
# define INTERFACE_USB 0
# define USBDEVICESTRING ""
# define USBPRODUCTID 0
# define INTERFACE_USART 1
# define BOOT_DELAY_ADDRESS 0x000001a0
# define BOARD_TYPE 65
# define BOARD_FLASH_SECTORS 11
# define BOARD_FLASH_SIZE (1024 * 1024)
# define BOARD_FIRST_FLASH_SECTOR_TO_ERASE 2
# define APP_RESERVATION_SIZE (2 * 16 * 1024) /* 2 16 Kib Sectors */
# define OSC_FREQ 16
# define BOARD_PIN_LED_ACTIVITY GPIO12
# define BOARD_PIN_LED_BOOTLOADER GPIO9 | GPIO10 | GPIO11 | GPIO13 | GPIO14 | GPIO15
# define BOARD_PORT_LEDS GPIOE
# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPEEN
# define BOARD_LED_ON gpio_clear
# define BOARD_LED_OFF gpio_set
# define BOARD_USART USART2
# define BOARD_USART_CLOCK_REGISTER RCC_APB1ENR
# define BOARD_USART_CLOCK_BIT RCC_APB1ENR_USART2EN
# define BOARD_PORT_USART GPIOA
# define BOARD_PORT_USART_AF GPIO_AF7
# define BOARD_PIN_TX GPIO2
# define BOARD_PIN_RX GPIO3
# define BOARD_USART_PIN_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_USART_PIN_CLOCK_BIT RCC_AHB1ENR_IOPAEN
# define BOARD_FORCE_BL_PIN GPIO11
# define BOARD_FORCE_BL_PORT GPIOA
# define BOARD_FORCE_BL_CLOCK_REGISTER RCC_AHB1ENR
# define BOARD_FORCE_BL_CLOCK_BIT RCC_AHB1ENR_IOPAEN
# define BOARD_FORCE_BL_PULL GPIO_PUPD_PULLDOWN
# define BOARD_FORCE_BL_STATE 1
/****************************************************************************
* TARGET_HW_FMUK66_V3
****************************************************************************/
#elif defined(TARGET_HW_FMUK66_V3)
# define APP_LOAD_ADDRESS 0x00006000 // Reserve 24K for BL
# define BOOTLOADER_DELAY 5000
# define BOARD_NXPHLITEV3
# define INTERFACE_USB 1
# define INTERFACE_USART 0
# define USBDEVICESTRING // See kinetis/usb_device_descriptor.c
# define USBPRODUCTID 0x001c
# define USBVENDORID 0x1fc9
# define BOARD_TYPE 28
# define _FLASH_KBYTES 2048
# define FLASH_SECTOR_SIZE 4096
# define BOARD_FLASH_SIZE (_FLASH_KBYTES * 1024)
# define BOARD_FLASH_SECTORS ((BOARD_FLASH_SIZE / FLASH_SECTOR_SIZE)- (BOOTLOADER_RESERVATION_SIZE/FLASH_SECTOR_SIZE))
# define OSC_FREQ 16
# define BOARD_PIN_LED_ACTIVITY 14 // green LED
# define BOARD_PIN_LED_BOOTLOADER 13 // Amber LED
# define BOARD_PORT_LEDS D
# define BOARD_LED_ON GPIO_ClearPinsOutput
# define BOARD_LED_OFF GPIO_SetPinsOutput
# define BOARD_UART 4
# define BOARD_PORT_UART C
# define BOARD_PORT_UART_AF kPORT_MuxAlt3
# define BOARD_PIN_TX 15
# define BOARD_PIN_RX 14
# define BOARD_PORT_VBUS E
# define BOARD_PIN_VBUS 8
# define BOARD_PORT_UART_RTS E