aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
AgeCommit message (Collapse)Author
2014-09-12Fixed trivial include error introduced in previous commit 2e3e539b... oops...Cristian Maglie
2014-09-12Added license to USBAPI.hCristian Maglie
Close #1847
2014-09-12Merge pull request #1937 from matthijskooijman/stringindexCristian Maglie
String index fixes and cleanups
2014-09-10Fix off-by-one in String::substringMatthijs Kooijman
When checking the `left` argument, it previously allowed having left == len. However, this means the substring starts one past the last character in the string and should return the empty string. In practice, this already worked correctly, because buffer[len] contains the trailing nul, so it would (re)assign the empty string to `out`. However, fixing this check makes it a bit more logical, and prevents a fairly unlikely out-of-buffer write (to address 0x0) when calling substring on an invalidated String: String bar = (char*)NULL; bar.substring(0, 0);
2014-09-10Merge pull request #2279 from cmaglie/fix-leo-upload-osx10.9.4Cristian Maglie
Fix for upload problems on Arduino Leonardo (and derivatives) on OSX 10.9
2014-09-10Simplify String::remove(unsigned int)Matthijs Kooijman
Previously, this method calculated the length of the string from the given index onwards. However, the other remove() method called already contains code for this calculation, which is used when the count passed in is too big. This means we can just pass in a very big count that is guaranteed to point past the end of the string, shrinking the remove method by a few bytes.
2014-09-10Fix bounds check in String::remove()Matthijs Kooijman
Previously, if you passed in a very big index and/or count, the `index + count` could overflow, making the count be used as-is instead of being truncated (causing the string to be updated wrongly and potentially writing to arbitrary memory locations). We can rewrite the comparison to use `len - index` instead. Since we know that index < len, we are sure this subtraction does not overflow, regardless of what values of index and count we pass in. As an added bonus, the `len - index` value already needed be calculated inside the if, so this saves a few instructions in the generated code. To illustrate this problem, consider this code: String foo = "foo"; Serial.println(foo.length()); // Prints 3 foo.remove(1, 65535); // Should remove all but first character Serial.println(foo.length()); // Prints 4 without this patch Not shown in this is example is that some arbitrary memory is written as well.
2014-09-10Remove unneeded check in String::remove(unsigned int)Matthijs Kooijman
This check already happens in the remove(unsigned int, unsigned int) method that is caled, so there is no need to also check this here.
2014-09-06Fixed license for new.cpp and small cosmetic changesCristian Maglie
2014-09-06Correct implementation of gcc specific internal functionsCristian Maglie
The following empty stubs has been replaced by the gcc flag -fno-threadsafe-static: int __cxa_guard_acquire(__guard *); void __cxa_guard_release (__guard *); void __cxa_guard_abort (__guard *); The following empty stubs has been moved into their specific module abi.cpp: void __cxa_pure_virtual(void) __attribute ((noreturn)); void __cxa_deleted_virtual(void) __attribute ((noreturn)); Fix #107
2014-09-06Printable.h doesn't need new.h but only stdlib.h for size_t.Cristian Maglie
Probalby new.h may be removed completely.
2014-09-01Fix for upload problems on Arduino Leonardo (and derivatives) with OSX 10.9.4Cristian Maglie
2014-08-08Merge branch 'master' into ide-1.5.xCristian Maglie
2014-08-08Added replacement stub for cstdlib atexit() funciton.Christopher Andrews
This is an empty stub to simply allow use of complex types with a non global static lifetime. For more complex handling the function 'atexit' can be redefined in user code. For more information see: https://github.com/arduino/Arduino/pull/2229 https://github.com/arduino/Arduino/issues/1919
2014-07-24Merge remote-tracking branch 'arduino/master' into ide-1.5.xCristian Maglie
2014-07-24Merge pull request #2206 from amulya349/masterCristian Maglie
Fix of a bug #2199
2014-07-23Fix of a bugAmulya Kumar Sahoo
2014-07-19Merge pull request #2190 from ribbons/compiler-warningsCristian Maglie
Fix two compiler warnings generated by updated toolchain
2014-07-18Add availableForWrite() to HardwareSerialPaulStoffregen
2014-07-17Cast empty string to char* to fix compiler warningMatt Robinson
Stream::find(char *target) passes an empty terminator string to Stream::findUntil(char *target, char *terminator) which caused a compiler warning with the updated toolchain, so cast it to a char*.
2014-07-01Merge branch 'ide-1.5.x-timer-variant' of ↵Cristian Maglie
github.com:matthijskooijman/Arduino into matthijskooijman-ide-1.5.x-timer-variant
2014-06-27initVariant() is now declared as external "C" function.Cristian Maglie
See #2080 for more details.
2014-06-27Merge branch 'ide-1.5.7' into ide-1.5.xCristian Maglie
2014-06-25Support Atmega8 (and similar that define PE instead of UPE) againMatthijs Kooijman
These chips were previously supported, but since parity error checking was added, this support has broken. Most chips define UPE0 (etc.) for the parity error bit. Some chips don't have numbered UARTS so only define UPE and even fewer define PE instead of UPE. This adds support for those chips again. Closes: #2137
2014-06-25Allow variants to define an initVariant() function that is called at startup.Matthijs Kooijman
See #2080 and #2139.
2014-06-25Removed patch for old malloc bug (no more useful with updated toolchain)Cristian Maglie
2014-06-19Allow variants to define an initVariant() function that is called at startup.Cristian Maglie
See #2080
2014-06-19Merge branch 'master' into ide-1.5.xCristian Maglie
2014-06-19Fixed regression in USBAPI and CDC (xaljox)Cristian Maglie
See: https://github.com/arduino/Arduino/commit/9ac7e30252fce5b9dafde3288519b020b73c37bd#commitcomment-6718676
2014-06-13Merge branch 'master' into HEADCristian Maglie
2014-06-10Update USBAPI.hEmbedded Micro
Fixes bug where Serial.read() would always return 0 as the first byte.
2014-06-02Merge pull request #2104 from amulya349/masterCristian Maglie
Fix of a bug in Stream.cpp
2014-05-30Merge branch 'master' into HEADCristian Maglie
2014-05-30USB CDC available() method returns correct number of bytes in buffer.Cristian Maglie
See #1953
2014-05-30Fix of a bugAmulya Kumar Sahoo
Stream::find(char *target) passes NULL as “terminator” to Stream::findUntil(char *target, char *terminator), which immediately dereferences it by passing it on to strlen(): bool Stream::find(char *target) { return findUntil(target, NULL); } // as find but search ends if the terminator string is found bool Stream::findUntil(char *target, char *terminator) { return findUntil(target, strlen(target), terminator, strlen(terminator)); }
2014-05-26Merge branch 'usbcdc-improved' into ide-1.5.xCristian Maglie
2014-05-24Improve CDC read codePaul Brook
Read CDC data from USB FIFO on demand instead of in ISR. Remove superfluous ring buffer. Signed-off-by: Paul Brook <paul@nowt.org>
2014-05-24Fix race condition in USB CDC transmitPaul Brook
If the Start of Frame interrupt triggers just after the call to USB_SendSpace in USB_Send then we can get data loss. When the first bank is full and the second partially full, the SOF handler will release the second bank via USB_Flush. Data is then lost due to overflow as USB_Send continues writing data to the now-closed bank. Fix this by re-checking the FIFO status inside LockEP, immediately before doing the data write. Signed-off-by: Paul Brook <paul@nowt.org>
2014-05-24improved USB write speedsJustin Rajewski
2014-05-24Backported Print class from ide-1.5.x branchCristian Maglie
Close #1951
2014-05-23Merge branch 'ide-1.5.x-hwserial-cleanup' of ↵Cristian Maglie
github.com:matthijskooijman/Arduino into matthijskooijman-ide-1.5.x-hwserial-cleanup
2014-05-23Merge remote-tracking branch 'arduino/master' into ide-1.5.xCristian Maglie
Conflicts: build/shared/examples/01.Basics/Blink/Blink.ino build/shared/examples/09.USB/Keyboard/KeyboardReprogram/KeyboardReprogram.ino build/shared/examples/10.StarterKit/p02_SpaceshipInterface/p02_SpaceshipInterface.ino hardware/arduino/cores/arduino/HardwareSerial.cpp
2014-05-16Support TIMER1CMatthijs Kooijman
Some devices, such as the atmega2560 or the atmega256rfr2 have a timer1c output. It seems this output is not connected to anything on the Arduino Mega, but this allows using it on third party hardware nonetheless.
2014-05-07Match return value to type in available()Zachary J. Fields
2014-05-06Remove unneeded register and ISR names in HardwareSerialx.cppMatthijs Kooijman
Before, HardwareSerial1+.cpp were a copy of HardwareSerial1.cpp with all 0's replaced by the corresponding number. This would mean that e.g. the Serial1 object would use the UBRRL register instead of UBRR1L when it was defined, or the USART_RX_vect instead of USART1_RX_vect. In practice, this would neve actually cause problems, since: - No avr chip currently has both the non-numbered registers as well as numbered registers. - HardwareSerial.h would only define HAVE_HWSERIALx when the corresponding numbered register is defined (except for HAVE_HWSERIAL0, which is also defined when the unnumbered registers are present). Furthermore, before both the UARTx_xx_vect and USART_x_xx_vect was used. Looking at the include files, only UART1_xx_vect is actually used (by iom161.h), the others use USARTx_xx_vect. For this reason, HardwareSerial1.cpp keeps the preprocessor conditional to select either UART or USART and the other files use USART unconditionally. While we're here, also fix the compiler error message when no valid ISR name was found (it previously said "for the first UART" in all cases).
2014-05-06Fix comment typoMatthijs Kooijman
2014-05-02Fix EXTERNAL_NUM_INTERRUPTS for atmega128rfa1 and atmega256rfr2Matthijs Kooijman
2014-04-20Fixed other trivial warnings in AVR USB core.Cristian Maglie
See #1877
2014-04-20Removed other unused variables in CDC.cpp and HID.cppCristian Maglie
See #1877
2014-04-20Removed 'USB_MANUFACTURER' constant redefinition for known VIDs.Cristian Maglie
See #1877