Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:e3c085ac77f1
- Parent:
- 1:4ff199bddbc1
- Child:
- 3:ccc673a10485
--- a/main.cpp Tue Mar 08 12:03:48 2016 +0900 +++ b/main.cpp Sat Mar 12 09:34:38 2016 +0900 @@ -1,23 +1,28 @@ -// main.cpp 2016/3/8 +// main.cpp 2016/3/10 +// UART ISP emulator #include "mbed.h" #include "SimpleSerial.h" #include "Memory.h" #include "BaseEmuISP.h" SimpleSerial uart(USBTX, USBRX); + #if defined(TARGET_LPC1768)||defined(TARGET_LPC4088) -SimpleSerial dbg(p9, p10); +RawSerial dbg(p9, p10); + #elif defined(TARGET_NUCLEO_L152RE)||defined(TARGET_NUCLEO_F103RB) -SimpleSerial dbg(PB_10, PB_11); +RawSerial dbg(PB_10, PB_11); + +#else +#error "target error" #endif -Memory mem(4096, 1024, 0x10000000); +Memory mem; class emuISP : public BaseEmuISP { virtual int Getch() {return uart.readable() ? uart.getc() : -1;} virtual void Putch(int c) {uart.putc(c);} virtual void DebugPutch(int c) {dbg.putc(c);} - virtual int Part() { return 0x00008242; } // LPC824M201JDH20 virtual void WriteData(int addr, int c) {mem.Write(addr, c);} virtual int ReadData(int addr) {return mem.Read(addr);} virtual void CopyData(int dst, int src, int count) {mem.Copy(dst, src, count);} @@ -25,6 +30,8 @@ int main() { uart.baud(9600); + dbg.baud(115200); + isp.Reset(); for(;;) { isp.Poll();