cmsis-dap debug adapter
Dependencies: BaseDAP F042K6_USBDevice SWD USBDAP mbed
Fork of Simple-CMSIS-DAP by
CMSIS-DAP debug adapter. (not mbed-interface)
SWD | NUCLEO-F042K6 |
---|---|
SWDIO | D7 |
SWCLK | D6 |
nRESET | D3 |
main.cpp@1:2957e24bb52f, 2014-07-05 (annotated)
- Committer:
- va009039
- Date:
- Sat Jul 05 08:26:21 2014 +0000
- Revision:
- 1:2957e24bb52f
- Parent:
- 0:dbe821206b04
- Child:
- 2:6846bcae69aa
configure the product name.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:dbe821206b04 | 1 | #include "mbed.h" |
va009039 | 0:dbe821206b04 | 2 | #include "USBDAP.h" |
va009039 | 0:dbe821206b04 | 3 | #include "BaseDAP.h" |
va009039 | 0:dbe821206b04 | 4 | |
va009039 | 0:dbe821206b04 | 5 | SWD swd(D12, D10, D6); // SWDIO,SWCLK,nRESET |
va009039 | 0:dbe821206b04 | 6 | DigitalOut connected(LED_GREEN); |
va009039 | 0:dbe821206b04 | 7 | DigitalOut running(LED_RED); |
va009039 | 0:dbe821206b04 | 8 | |
va009039 | 0:dbe821206b04 | 9 | class myDAP : public BaseDAP { |
va009039 | 0:dbe821206b04 | 10 | public: |
va009039 | 0:dbe821206b04 | 11 | myDAP(SWD* swd):BaseDAP(swd){}; |
va009039 | 0:dbe821206b04 | 12 | virtual void infoLED(int select, int value) { |
va009039 | 0:dbe821206b04 | 13 | switch(select) { |
va009039 | 0:dbe821206b04 | 14 | case 0: |
va009039 | 0:dbe821206b04 | 15 | connected = value^1; |
va009039 | 0:dbe821206b04 | 16 | running = 1; |
va009039 | 0:dbe821206b04 | 17 | break; |
va009039 | 0:dbe821206b04 | 18 | case 1: |
va009039 | 0:dbe821206b04 | 19 | running = value^1; |
va009039 | 0:dbe821206b04 | 20 | connected = 1; |
va009039 | 0:dbe821206b04 | 21 | break; |
va009039 | 0:dbe821206b04 | 22 | } |
va009039 | 0:dbe821206b04 | 23 | } |
va009039 | 0:dbe821206b04 | 24 | }; |
va009039 | 0:dbe821206b04 | 25 | |
va009039 | 0:dbe821206b04 | 26 | int main() { |
va009039 | 1:2957e24bb52f | 27 | USBDAP* hid = new USBDAP("CMSIS-DAP"); |
va009039 | 0:dbe821206b04 | 28 | myDAP* dap = new myDAP(&swd); |
va009039 | 0:dbe821206b04 | 29 | while(1) { |
va009039 | 0:dbe821206b04 | 30 | HID_REPORT recv_report; |
va009039 | 0:dbe821206b04 | 31 | if(hid->readNB(&recv_report)) { |
va009039 | 0:dbe821206b04 | 32 | HID_REPORT send_report; |
va009039 | 0:dbe821206b04 | 33 | dap->Command(recv_report.data, send_report.data); |
va009039 | 0:dbe821206b04 | 34 | send_report.length = 64; |
va009039 | 0:dbe821206b04 | 35 | hid->send(&send_report); |
va009039 | 0:dbe821206b04 | 36 | } |
va009039 | 0:dbe821206b04 | 37 | } |
va009039 | 0:dbe821206b04 | 38 | } |
va009039 | 0:dbe821206b04 | 39 |