From 582fd42548ccb6ba6887d966f372964e76a41519 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 19:55:09 -0500 Subject: [PATCH 01/11] Compiler.java: adds options to support -W,-Wall flags, .map file and .lst file generation, avr-size output This patch adds 4 preferences.txt options to support enabling -W and -Wall flags when compiling, producing a .map file as part of the linking stage, producing a diassembly list file after linking, and a more verbose size output. Adding 'compiler.show_all_warnings=true' to preferences.txt adds the -W and -Wall flags passed to the compiler, and removes the -w flag. This produces informative verbose warnings about less than ideally constructed code, such as signed vs unsigned comparisons, unused variables, and a great deal of other useful information. Adding 'compiler.map_file=true' causes the linker to produce a detailed map file listing of the code. This file is written to the directory the sketch is located in. Adding 'compiler.lst_file=true' causes avr-objdump to be run on the produced .elf file. The listing file contains a disassembled listing of the code intermixed with the source code. The -d (Display assembler contents of executable sections) and -S (Intermix source code with disassembly) options are passed to avr-objdump. The resulting .lst file is written to the directory the sketch is located in. Adding 'compiler.detailed_size' causes avr-size to be run on the produced .elf file. This displays a more detailed report the combined sizes of the program space (.text + .data + .bootloader), and the combined sizes of data space (.data + .bss + .noinit) Unfortunately, avr-objdump does not support a command line option to specify where to write the output of the program to. Instead, EVERYTHING goes to stdout. Normally anything written to stdout by an exec'ed program is written to the status window of the Arduino IDE. To get the the stdout of avr-objdump captured to be written to an output file required a tad bit hackishness in the execAsynchronously function. See source for details. --- app/src/processing/app/debug/Compiler.java | 150 +++++++++++++++------ 1 file changed, 112 insertions(+), 38 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index f2fa5e26d30..86d15d4c363 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -44,6 +44,7 @@ public class Compiler implements MessageConsumer { String buildPath; String primaryClassName; boolean verbose; + PrintWriter outputFile = null; RunnerException exception; @@ -179,8 +180,25 @@ public boolean compile(Sketch sketch, baseCommandLinker.add("-L" + buildPath); baseCommandLinker.add("-lm"); + if (Preferences.getBoolean("compiler.map_file")) + baseCommandLinker.add("-Wl,-Map," + sketch.getFolder() + File.separator + sketch.getName() + ".map"); + execAsynchronously(baseCommandLinker); + // 4a. create the size output + if (Preferences.getBoolean("compiler.detailed_size")) { + List baseCommandsize = new ArrayList(Arrays.asList(new String[] { + avrBasePath + "avr-size", + "-C", + "--mcu=" + boardPreferences.get("build.mcu"), + buildPath + File.separator + primaryClassName + ".elf"//, + //" > ", + //sketch.getFolder() + File.separator + sketch.getName() + ".size" + })); + + execAsynchronously(baseCommandsize); + } + List baseCommandObjcopy = new ArrayList(Arrays.asList(new String[] { avrBasePath + "avr-objcopy", "-O", @@ -210,6 +228,18 @@ public boolean compile(Sketch sketch, commandObjcopy.add(buildPath + File.separator + primaryClassName + ".hex"); execAsynchronously(commandObjcopy); + // 7. produce the .lst file + if (Preferences.getBoolean("compiler.lst_file")) { + List baseCommandObjdump = new ArrayList(Arrays.asList(new String[] { + avrBasePath + "avr-objdump", + "-d", + "-S", + buildPath + File.separator + primaryClassName + ".elf" + })); + + execAsynchronously(baseCommandObjdump, sketch.getFolder() + File.separator + sketch.getName() + ".lst"); + } + return true; } @@ -261,6 +291,14 @@ private List compileFiles(String avrBasePath, * Either succeeds or throws a RunnerException fit for public consumption. */ private void execAsynchronously(List commandList) throws RunnerException { + execAsynchronouslyFile (commandList, null); + } + + private void execAsynchronously(List commandList, String outputFileName) throws RunnerException { + execAsynchronouslyFile (commandList, outputFileName); + } + + private void execAsynchronouslyFile(List commandList, String outputFileName) throws RunnerException { String[] command = new String[commandList.size()]; commandList.toArray(command); int result = 0; @@ -275,6 +313,19 @@ private void execAsynchronously(List commandList) throws RunnerException { firstErrorFound = false; // haven't found any errors yet secondErrorFound = false; + if (outputFileName != null) + { + try { + File filename = new File (outputFileName); + FileWriter fout = new FileWriter (filename); + outputFile = new PrintWriter (fout, true); + } catch (IOException e) { + RunnerException re = new RunnerException(e.getMessage()); + re.hideStackTrace(); + throw re; + } + } + Process process; try { @@ -321,9 +372,15 @@ private void execAsynchronously(List commandList) throws RunnerException { re.hideStackTrace(); throw re; } + + if (outputFile != null) + { + outputFile.flush (); + outputFile.close (); + outputFile = null; + } } - /** * Part of the MessageConsumer interface, this is called * whenever a piece (usually a line) of error message is spewed @@ -333,49 +390,54 @@ private void execAsynchronously(List commandList) throws RunnerException { public void message(String s) { int i; - // remove the build path so people only see the filename - // can't use replaceAll() because the path may have characters in it which - // have meaning in a regular expression. - if (!verbose) { - while ((i = s.indexOf(buildPath + File.separator)) != -1) { - s = s.substring(0, i) + s.substring(i + (buildPath + File.separator).length()); + if (outputFile != null) + outputFile.print (s); + else + { + // remove the build path so people only see the filename + // can't use replaceAll() because the path may have characters in it which + // have meaning in a regular expression. + if (!verbose) { + while ((i = s.indexOf(buildPath + File.separator)) != -1) { + s = s.substring(0, i) + s.substring(i + (buildPath + File.separator).length()); + } } - } - - // look for error line, which contains file name, line number, - // and at least the first line of the error message - String errorFormat = "([\\w\\d_]+.\\w+):(\\d+):\\s*error:\\s*(.*)\\s*"; - String[] pieces = PApplet.match(s, errorFormat); + + // look for error line, which contains file name, line number, + // and at least the first line of the error message + String errorFormat = "([\\w\\d_]+.\\w+):(\\d+):\\s*error:\\s*(.*)\\s*"; + String[] pieces = PApplet.match(s, errorFormat); // if (pieces != null && exception == null) { // exception = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1); // if (exception != null) exception.hideStackTrace(); // } - - if (pieces != null) { - RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1); - - // replace full file path with the name of the sketch tab (unless we're - // in verbose mode, in which case don't modify the compiler output) - if (e != null && !verbose) { - SketchCode code = sketch.getCode(e.getCodeIndex()); - String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName(); - s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage(); + + if (pieces != null) { + RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1); + + // replace full file path with the name of the sketch tab (unless we're + // in verbose mode, in which case don't modify the compiler output) + if (e != null && !verbose) { + SketchCode code = sketch.getCode(e.getCodeIndex()); + String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName(); + s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage(); + } + + if (pieces[3].trim().equals("SPI.h: No such file or directory")) { + e = new RunnerException("Please import the SPI library from the Sketch > Import Library menu."); + s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." + + "\nYou appear to be using it or another library that depends on the SPI library."; + } + + if (exception == null && e != null) { + exception = e; + exception.hideStackTrace(); + } } - - if (pieces[3].trim().equals("SPI.h: No such file or directory")) { - e = new RunnerException("Please import the SPI library from the Sketch > Import Library menu."); - s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." + - "\nYou appear to be using it or another library that depends on the SPI library."; - } - - if (exception == null && e != null) { - exception = e; - exception.hideStackTrace(); - } + + System.err.print(s); } - - System.err.print(s); } ///////////////////////////////////////////////////////////////////////////// @@ -411,13 +473,19 @@ static private List getCommandCompilerC(String avrBasePath, List includePaths, "-c", // compile, don't link "-g", // include debugging info (so errors include line numbers) "-Os", // optimize for size - "-w", // surpress all warnings "-ffunction-sections", // place each function in its own section "-fdata-sections", "-mmcu=" + boardPreferences.get("build.mcu"), "-DF_CPU=" + boardPreferences.get("build.f_cpu"), "-DARDUINO=" + Base.REVISION, })); + + if (!Preferences.getBoolean("compiler.show_all_warnings")) + baseCommandCompiler.add("-w"); // suppress all warnings + else { + baseCommandCompiler.add("-W"); // show all warnings + baseCommandCompiler.add("-Wall"); // be aggressive with warnings + } for (int i = 0; i < includePaths.size(); i++) { baseCommandCompiler.add("-I" + (String) includePaths.get(i)); @@ -439,7 +507,6 @@ static private List getCommandCompilerCPP(String avrBasePath, "-c", // compile, don't link "-g", // include debugging info (so errors include line numbers) "-Os", // optimize for size - "-w", // surpress all warnings "-fno-exceptions", "-ffunction-sections", // place each function in its own section "-fdata-sections", @@ -448,6 +515,13 @@ static private List getCommandCompilerCPP(String avrBasePath, "-DARDUINO=" + Base.REVISION, })); + if (!Preferences.getBoolean("compiler.show_all_warnings")) + baseCommandCompilerCPP.add("-w"); // suppress all warnings + else { + baseCommandCompilerCPP.add("-W"); // show all warnings + baseCommandCompilerCPP.add("-Wall"); // be aggressive with warnings + } + for (int i = 0; i < includePaths.size(); i++) { baseCommandCompilerCPP.add("-I" + (String) includePaths.get(i)); } From fe646170004876b11aeb627b0f8af85684fbfecd Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:33:05 -0500 Subject: [PATCH 02/11] Print: fix signed vs unsigned comparison Print currently uses a signed vs unsigned comparison in Print::print(const String &s) while iterating through individual characters. This causes compiler warnings when using -W -Wall. --- hardware/arduino/cores/arduino/Print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/Print.cpp b/hardware/arduino/cores/arduino/Print.cpp index 4ee556dd82d..fd689423a4a 100755 --- a/hardware/arduino/cores/arduino/Print.cpp +++ b/hardware/arduino/cores/arduino/Print.cpp @@ -45,7 +45,7 @@ void Print::write(const uint8_t *buffer, size_t size) void Print::print(const String &s) { - for (int i = 0; i < s.length(); i++) { + for (unsigned int i = 0; i < s.length(); i++) { write(s[i]); } } From bda64599c6502da751b9506d42f5e0112d5b9ea3 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:36:27 -0500 Subject: [PATCH 03/11] WInterrupts.c: warning: 'static' is not at beginning of declaration The static keyword is improperly placed in the declaration of the intFunc variable. --- hardware/arduino/cores/arduino/WInterrupts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/WInterrupts.c b/hardware/arduino/cores/arduino/WInterrupts.c index 3b3e0c9ec43..bc92a0ed128 100755 --- a/hardware/arduino/cores/arduino/WInterrupts.c +++ b/hardware/arduino/cores/arduino/WInterrupts.c @@ -33,7 +33,7 @@ #include "WConstants.h" #include "wiring_private.h" -volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; +static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; // volatile static voidFuncPtr twiIntFunc; void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { From 33597e976354143b64a8f19b83e60d332e852343 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:38:40 -0500 Subject: [PATCH 04/11] WString.cpp: 'base' variable is unused, but should be passed to ultoa() Compiling with -W -Wall flags revealed that the 'base' variable in the parameter list for String::String( const long value, const int base ) was not being passed to the ultoa() function. Instead, the parameter to ultoa() was hard-coded to 10. --- hardware/arduino/cores/arduino/WString.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/WString.cpp b/hardware/arduino/cores/arduino/WString.cpp index db5a441dc27..aab06cd5088 100644 --- a/hardware/arduino/cores/arduino/WString.cpp +++ b/hardware/arduino/cores/arduino/WString.cpp @@ -88,7 +88,7 @@ String::String( const long value, const int base ) String::String( const unsigned long value, const int base ) { char buf[33]; - ultoa(value, buf, 10); + ultoa(value, buf, base); getBuffer( _length = strlen(buf) ); if ( _buffer != NULL ) strcpy( _buffer, buf ); From 5f097c0f2f2f7078c445b6399d52b9e7b45b7f39 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:46:16 -0500 Subject: [PATCH 05/11] WString.h: fix type qualifiers ignored warning The length() function has a useless 'const' keyword in the declation, causing the compiler to throw a "type qualifiers ignored on function return type" warning when compiled with -W -Wall. --- hardware/arduino/cores/arduino/WString.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/WString.h b/hardware/arduino/cores/arduino/WString.h index cadddb9476f..56faf9a4880 100644 --- a/hardware/arduino/cores/arduino/WString.h +++ b/hardware/arduino/cores/arduino/WString.h @@ -67,7 +67,7 @@ class String int lastIndexOf( char ch, unsigned int fromIndex ) const; int lastIndexOf( const String &str ) const; int lastIndexOf( const String &str, unsigned int fromIndex ) const; - const unsigned int length( ) const { return _length; } + unsigned int length( ) const { return _length; } void setCharAt(unsigned int index, const char ch); unsigned char startsWith( const String &prefix ) const; unsigned char startsWith( const String &prefix, unsigned int toffset ) const; From 8630646d395c36bcbafc4990d156c77dbeaa8558 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:50:38 -0500 Subject: [PATCH 06/11] pins_arduino.c: integer from pointer cast warning This patch fixes the "initialization makes integer from pointer without a cast" warning generated by the compiler when using the -W -Wall flags. The data type in the array is a uint16_t, but DDRA (for example) is a pointer. A cast is required to make GCC happy. --- hardware/arduino/cores/arduino/pins_arduino.c | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/hardware/arduino/cores/arduino/pins_arduino.c b/hardware/arduino/cores/arduino/pins_arduino.c index 0c816e94d9a..9f27b9cdb95 100755 --- a/hardware/arduino/cores/arduino/pins_arduino.c +++ b/hardware/arduino/cores/arduino/pins_arduino.c @@ -81,50 +81,50 @@ #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, - &DDRA, - &DDRB, - &DDRC, - &DDRD, - &DDRE, - &DDRF, - &DDRG, - &DDRH, + (uint16_t) &DDRA, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, + (uint16_t) &DDRG, + (uint16_t) &DDRH, NOT_A_PORT, - &DDRJ, - &DDRK, - &DDRL, + (uint16_t) &DDRJ, + (uint16_t) &DDRK, + (uint16_t) &DDRL, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT, - &PORTA, - &PORTB, - &PORTC, - &PORTD, - &PORTE, - &PORTF, - &PORTG, - &PORTH, + (uint16_t) &PORTA, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, + (uint16_t) &PORTG, + (uint16_t) &PORTH, NOT_A_PORT, - &PORTJ, - &PORTK, - &PORTL, + (uint16_t) &PORTJ, + (uint16_t) &PORTK, + (uint16_t) &PORTL, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PIN, - &PINA, - &PINB, - &PINC, - &PIND, - &PINE, - &PINF, - &PING, - &PINH, + (uint16_t) &PINA, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, + (uint16_t) &PING, + (uint16_t) &PINH, NOT_A_PIN, - &PINJ, - &PINK, - &PINL, + (uint16_t) &PINJ, + (uint16_t) &PINK, + (uint16_t) &PINL, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { From 04165dab03d6d60e017070346d06aef7bb55c095 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:55:14 -0500 Subject: [PATCH 07/11] pins_arduino.h: fix compiler warning The SPI pins are declared as 'const static' instead of 'static const', causing the compiler to throw a warning with the -W -Wall flags are used. --- hardware/arduino/cores/arduino/pins_arduino.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hardware/arduino/cores/arduino/pins_arduino.h b/hardware/arduino/cores/arduino/pins_arduino.h index bc931c597c4..83eec66ebea 100644 --- a/hardware/arduino/cores/arduino/pins_arduino.h +++ b/hardware/arduino/cores/arduino/pins_arduino.h @@ -50,15 +50,15 @@ #define TIMER5C 16 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) -const static uint8_t SS = 53; -const static uint8_t MOSI = 51; -const static uint8_t MISO = 50; -const static uint8_t SCK = 52; +static const uint8_t SS = 53; +static const uint8_t MOSI = 51; +static const uint8_t MISO = 50; +static const uint8_t SCK = 52; #else -const static uint8_t SS = 10; -const static uint8_t MOSI = 11; -const static uint8_t MISO = 12; -const static uint8_t SCK = 13; +static const uint8_t SS = 10; +static const uint8_t MOSI = 11; +static const uint8_t MISO = 12; +static const uint8_t SCK = 13; #endif // On the ATmega1280, the addresses of some of the port registers are From 5bbe29103141ec294f177e59bd5efc1ac4cffd14 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 20:57:32 -0500 Subject: [PATCH 08/11] wiring_private.h: fix compiler warning When compiling with the -W -Wall flags, a warning is emitted indicating that has been moved to . This patch fixes the #include to point to the new location. --- hardware/arduino/cores/arduino/wiring_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/cores/arduino/wiring_private.h b/hardware/arduino/cores/arduino/wiring_private.h index 11f6f00f28a..3c87413b9c8 100755 --- a/hardware/arduino/cores/arduino/wiring_private.h +++ b/hardware/arduino/cores/arduino/wiring_private.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include From 05a7fca8d8eaba4a84ab54500f4628a7097f9f19 Mon Sep 17 00:00:00 2001 From: "J.C. Wren" Date: Mon, 20 Dec 2010 22:52:24 -0500 Subject: [PATCH 09/11] Sd2Card.cpp: fix compiler warning All the while() loops that check for the SPI transfer to be complete have the semi-colon immediately after the closing parenthesis. This both causes a compiler warning of "warning: suggest a space before ';' or explicit braces around empty body in 'while' statement", and is considered a less-than-ideal programming practice. This patch breaks the semi-colon on to the next line, both eliminating the compiler error and making the code more readable. In all probability the test should be moved into a macro or a inlineable sub-routine. --- libraries/SD/utility/Sd2Card.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/libraries/SD/utility/Sd2Card.cpp b/libraries/SD/utility/Sd2Card.cpp index 26c4236ac07..f91677226dd 100644 --- a/libraries/SD/utility/Sd2Card.cpp +++ b/libraries/SD/utility/Sd2Card.cpp @@ -25,7 +25,8 @@ /** Send a byte to the card */ static void spiSend(uint8_t b) { SPDR = b; - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; } /** Receive a byte from the card */ static uint8_t spiRec(void) { @@ -112,7 +113,8 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) { spiSend(crc); // wait for response - for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++); + for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++) + ; return status_; } //------------------------------------------------------------------------------ @@ -360,18 +362,21 @@ uint8_t Sd2Card::readData(uint32_t block, // skip data before offset for (;offset_ < offset; offset_++) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; SPDR = 0XFF; } // transfer data n = count - 1; for (uint16_t i = 0; i < n; i++) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; dst[i] = SPDR; SPDR = 0XFF; } // wait for last byte - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; dst[n] = SPDR; #else // OPTIMIZE_HARDWARE_SPI @@ -406,11 +411,13 @@ void Sd2Card::readEnd(void) { // optimize skip for hardware SPDR = 0XFF; while (offset_++ < 513) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; SPDR = 0XFF; } // wait for last crc byte - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; #else // OPTIMIZE_HARDWARE_SPI while (offset_++ < 514) spiRec(); #endif // OPTIMIZE_HARDWARE_SPI @@ -561,14 +568,17 @@ uint8_t Sd2Card::writeData(uint8_t token, const uint8_t* src) { // send two byte per iteration for (uint16_t i = 0; i < 512; i += 2) { - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; SPDR = src[i]; - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; SPDR = src[i+1]; } // wait for last data byte - while (!(SPSR & (1 << SPIF))); + while (!(SPSR & (1 << SPIF))) + ; #else // OPTIMIZE_HARDWARE_SPI spiSend(token); From 2bf0548c2c2db9446c46161c26a3feb5d9ca1698 Mon Sep 17 00:00:00 2001 From: JC Wren Date: Tue, 21 Dec 2010 12:00:53 -0500 Subject: [PATCH 10/11] SD.c: Fix error in comment for remove() Comment was duplicated from mkdir() and not updated. --- libraries/SD/SD.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/SD/SD.cpp b/libraries/SD/SD.cpp index 356a2986ad2..a1ad6fd7cc3 100644 --- a/libraries/SD/SD.cpp +++ b/libraries/SD/SD.cpp @@ -422,9 +422,9 @@ boolean SDClass::mkdir(char *filepath) { boolean SDClass::rmdir(char *filepath) { /* - Makes a single directory or a heirarchy of directories. + Remove a single directory or a heirarchy of directories. - A rough equivalent to `mkdir -p`. + A rough equivalent to `rm -rf`. */ return walkPath(filepath, root, callback_rmdir); @@ -434,4 +434,4 @@ boolean SDClass::remove(char *filepath) { return walkPath(filepath, root, callback_remove); } -SDClass SD; \ No newline at end of file +SDClass SD; From 924c164ff727b329f0add7667284967874a219b9 Mon Sep 17 00:00:00 2001 From: JC Wren Date: Tue, 21 Dec 2010 13:21:09 -0500 Subject: [PATCH 11/11] HardwareSerial.cpp: fix comment in flush() The comments for flush() had duplicated lines of text (probably a cut and paste error) --- hardware/arduino/cores/arduino/HardwareSerial.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hardware/arduino/cores/arduino/HardwareSerial.cpp b/hardware/arduino/cores/arduino/HardwareSerial.cpp index 4397efb7ee0..089f27ac595 100644 --- a/hardware/arduino/cores/arduino/HardwareSerial.cpp +++ b/hardware/arduino/cores/arduino/HardwareSerial.cpp @@ -257,10 +257,6 @@ int HardwareSerial::read(void) void HardwareSerial::flush() { - // don't reverse this or there may be problems if the RX interrupt - // occurs after reading the value of rx_buffer_head but before writing - // the value to rx_buffer_tail; the previous value of rx_buffer_head - // may be written to rx_buffer_tail, making it appear as if the buffer // don't reverse this or there may be problems if the RX interrupt // occurs after reading the value of rx_buffer_head but before writing // the value to rx_buffer_tail; the previous value of rx_buffer_head