Skip to content

Commit

Permalink
V3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
felias-fogg committed Aug 29, 2023
1 parent 5aed0d0 commit a183bfb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
6 changes: 5 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -778,4 +778,8 @@ when levelshifter is true

## Version 3.0.0 (28-Aug-2023)
* restructured monitor commands so that most of them have now
one argument
one argument

## Version 3.0.1 (29-Aug-2023)
* fixed some inconsistencies in dw-link.h so that the program is again
a valid C++ program
18 changes: 10 additions & 8 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Download the dw-link firmware into a place inside the *Arduino sketchbook*. This

* open the webpage https://github.com/felias-fogg/dw-link,
* click on `Latest` in the field **Releases**,
* choose either *zip* or the *tar.gz*,
* select then either a folder in the sketchbook as the destination or copy the archive after the download to a place in the sketchbook,
* finally extract the firmware using `unzip` or `tar -xvzf`.
* choose either *zip* or *tar.gz*,
* copy the archive to a place in the sketchbook,
* extract the firmware using `unzip` or `tar -xvzf`.

In order to install the firmware,

Expand Down Expand Up @@ -108,11 +108,13 @@ Here is a table of all the connections so that you can check that you have made

The system LED gives you information about the internal state of the debugger:

* not connected (LED is off),
* waiting for power-cycling the target (LED flashes every second for 0.1 sec),
* target is connected (LED is on),
* ISP programming (LED is blinking slowly),
* error state, i.e., not possible to connect to target or internal error (LED blinks furiously every 0.1 sec).
1. not connected (LED is off),
2. waiting for power-cycling the target (LED flashes every second for 0.1 sec),3.
3. target is connected (LED is on),
4. ISP programming (LED is blinking slowly),
5. error state, i.e., not possible to connect to target or internal error (LED blinks furiously every 0.1 sec).

Note that state 2 (power-cycling) will be skipped in our configuration, where the debugger provides the power supply to the target via a GPIO line and does the power-cycling for you.

**Check:** Go through the table above and check every connection. Wrong wiring can often cause hours of useless software debugging!

Expand Down
10 changes: 7 additions & 3 deletions dw-link/dw-link.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ void setSysState(statetype);
void gdbHandleCmd();
void gdbParsePacket(const byte *);
void gdbParseMonitorPacket(const byte *);
int gdbDetermineMonitorCommand(char *, char &);
void gdbHelp();
void gdbReportLastError();
void gdbTimeoutCounter();
void gdbSetSteppingMode(boolean);
void gdbSteppingMode(char);
void gdbVersion();
void gdbSpeed(const byte []);
void gdbSpeed(char);
byte findArg(const byte []);
void gdbSetMaxBPs(byte);
void gdbGetMaxBPs();
void gdbReportFlashCount();
void gdbReportRamUsage();
boolean gdbConnect(boolean);
Expand All @@ -24,7 +26,7 @@ boolean gdbStop(boolean);
void gdbReportConnected();
boolean gdbReset();
void gdbSetFuses(Fuses);
void gdbGetFuses();
void gdbGetFuses(boolean, boolean);
void getInstruction(unsigned int &, unsigned int &);
boolean twoWordInstr(unsigned int);
void simTwoWordInstr(unsigned int, unsigned int);
Expand Down Expand Up @@ -122,6 +124,7 @@ byte ispSend(byte, byte, byte, byte, boolean, boolean);
boolean enterProgramMode();
void leaveProgramMode();
unsigned int ispGetChipId();
byte ispReadFuse(boolean);
boolean ispProgramFuse(boolean, byte, byte);
boolean ispEraseFlash();
boolean ispLocked();
Expand All @@ -130,6 +133,7 @@ char nib2hex(byte);
byte hex2nib(char);
byte parseHex(const byte *, unsigned long *);
void convNum(byte *, long);
void convBufferHex2Ascii(char *, byte *, int);
#if FREERAM
void freeRamMin();
int freeRam();
Expand Down
20 changes: 11 additions & 9 deletions dw-link/dw-link.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// because relevant input ports are not in the I/O range and therefore the tight timing
// constraints are not satisfied.

#define VERSION "3.0.0"
#define VERSION "3.0.1"

// some constants, you may want to change
#define PROGBPS 19200 // ISP programmer communication speed
Expand All @@ -57,7 +57,7 @@
// #define UNITDW 1 // enable debugWIRE unit tests
// #define UNITTG 1 // enable target unit tests
// #define UNITGDB 1 // enable gdb function unit tests
// #define NOMONITORHELP 1 // disable monitor help function
// #define NOMONITORHELP 1 // disable monitor help function
// #define NOISPPROG 1 // disable ISP programmer

#if UNITALL == 1
Expand Down Expand Up @@ -838,7 +838,7 @@ void gdbParsePacket(const byte *buff)


// parse a monitor command and execute the appropriate actions
void gdbParseMonitorPacket(byte *buf)
void gdbParseMonitorPacket(const byte *buf)
{
[[maybe_unused]] int para = 0;
char cmdbuf[40];
Expand All @@ -849,7 +849,7 @@ void gdbParseMonitorPacket(byte *buf)

gdbUpdateBreakpoints(true); // update breakpoints in memory before any monitor ops

convBufferHex2Ascii(cmdbuf, buf, 40); // conver to ASCII string
convBufferHex2Ascii(cmdbuf, buf, 40); // convert to ASCII string
mocmd = gdbDetermineMonitorCommand(cmdbuf, moopt); // get command number and option char
if (strlen(cmdbuf) == 0) mocmd = MOHELP;

Expand Down Expand Up @@ -935,7 +935,8 @@ void gdbParseMonitorPacket(byte *buf)
// determine command and option for monitor command given in 'line'
int gdbDetermineMonitorCommand(char *line, char &option)
{
int ix, cmdix;
unsigned int ix;
int cmdix;
boolean succ = false;
char *checkcmd;

Expand Down Expand Up @@ -3397,15 +3398,15 @@ byte ispTransfer (byte val, boolean fast) {
digitalWrite(TSCK, HIGH);
}
if (fast) _delay_us(4);
else _delay_us(200);
else _delay_us(800);
val = (val << 1) + digitalRead(TMISO);
if (ctx.levelshifting) {
pinMode(TSCK, OUTPUT);
} else {
digitalWrite(TSCK, LOW);
}
if (fast) _delay_us(4);
else _delay_us(200);
else _delay_us(800);
}
return val;
}
Expand Down Expand Up @@ -3670,7 +3671,7 @@ char convHex2Ascii(char char1, char char2)
}

// convert a buffer with a string of hex numbers into a string in place
void convBufferHex2Ascii(byte *outbuf, byte *buf, int maxlen)
void convBufferHex2Ascii(char *outbuf, byte *buf, int maxlen)
{
int i, clen = strlen((const char *)buf);

Expand Down Expand Up @@ -4230,7 +4231,8 @@ int targetTests(int &num) {
ctx.sp = mcu.ramsz+mcu.rambase-1; // SP to upper limit of RAM
targetRestoreRegisters();
targetStep();
if (!expectBreakAndU()) succ = false;
if (!expectBreakAndU())
succ = false;
targetSaveRegisters();
failed += testResult(succ && ctx.wpc == 0xda && ctx.regs[18] == 0x49);

Expand Down

0 comments on commit a183bfb

Please sign in to comment.