mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-23 19:21:59 +03:00
update AVR src
* java code not tested * Merge remote-tracking branch 'remotes/arduino/master' into esp8266 Conflicts: README.md app/src/processing/app/AbstractMonitor.java arduino-core/src/processing/app/Serial.java libraries/WiFi/examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino libraries/WiFi/library.properties
This commit is contained in:
14
hardware/arduino/avr/bootloaders/gemma/README.md
Normal file
14
hardware/arduino/avr/bootloaders/gemma/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
Arduino Gemma Bootloader
|
||||
========================
|
||||
|
||||
The Arduino Gemma Bootloader is based on the Adafruit Trinket/Gemma Bootloader. In the Arduino Gemma bootloader the USB VID&PID, the Manufacturer name and the Device name parameters are changed.
|
||||
|
||||
The source code of the bootloader of the version used at the compile time can be found at the following link: https://github.com/adafruit/Adafruit-Trinket-Gemma-Bootloader/tree/3bc1bb561273535d4d493518a233a3a1fccf6b76
|
||||
|
||||
The *'usbconfig.h'* and the *'usbconfig.patch'* files are provided if you want to recompile the bootloader.
|
||||
You only need to replace the original *'usbconfig.h'* file with this one or patch it with the provided patch file.
|
||||
|
||||
**Please note: you cannot use the Arduino USB VID/PID for your own non-Gemma products or projects. Purchase a USB VID for yourself at** http://www.usb.org/developers/vendor/
|
||||
|
||||
|
||||
|
351
hardware/arduino/avr/bootloaders/gemma/usbconfig.h
Normal file
351
hardware/arduino/avr/bootloaders/gemma/usbconfig.h
Normal file
@ -0,0 +1,351 @@
|
||||
/* Name: usbconfig.h
|
||||
* Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
|
||||
* Author: Christian Starkjohann
|
||||
* Creation Date: 2005-04-01
|
||||
* Tabsize: 4
|
||||
* Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
|
||||
* License: GNU GPL v2 or v3 (see License.txt)
|
||||
*/
|
||||
|
||||
/* Modified by me@frank-zhao.com for project GemmaBoot
|
||||
*
|
||||
* GemmaBoot is a bootloader that emulates a USBtinyISP (from Adafruit Industries)
|
||||
*
|
||||
* Gemma will use GemmaBoot
|
||||
*
|
||||
* This code is heavily derived from USBaspLoader, but also from USBtiny, with USBtinyISP's settings
|
||||
|
||||
Copyright (c) 2013 Adafruit Industries
|
||||
All rights reserved.
|
||||
|
||||
GemmaBoot is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
GemmaBoot is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with GemmaBoot. If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __usbconfig_h_included__
|
||||
#define __usbconfig_h_included__
|
||||
|
||||
/* YOU SHOULD NOT NEED TO MODIFY THIS FILE! All configurations are supposed
|
||||
* to go into bootloaderconfig.h!
|
||||
*/
|
||||
|
||||
/* ---------------------------- Hardware Config ---------------------------- */
|
||||
|
||||
/* All the port and pin assignments, as well as the clock speed and CRC
|
||||
setting are now in bootloaderconfig.h: */
|
||||
|
||||
#include "bootloaderconfig.h"
|
||||
|
||||
/* --------------------------- Functional Range ---------------------------- */
|
||||
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT 0
|
||||
/* Define this to 1 if you want to compile a version with two endpoints: The
|
||||
* default control endpoint 0 and an interrupt-in endpoint (any other endpoint
|
||||
* number).
|
||||
*/
|
||||
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
|
||||
/* Define this to 1 if you want to compile a version with three endpoints: The
|
||||
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
|
||||
* configured below) and a catch-all default interrupt-in endpoint as above.
|
||||
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
|
||||
*/
|
||||
#define USB_CFG_EP3_NUMBER 3
|
||||
/* If the so-called endpoint 3 is used, it can now be configured to any other
|
||||
* endpoint number (except 0) with this macro. Default if undefined is 3.
|
||||
*/
|
||||
/* #define USB_INITIAL_DATATOKEN USBPID_DATA1 */
|
||||
/* The above macro defines the startup condition for data toggling on the
|
||||
* interrupt/bulk endpoints 1 and 3. Defaults to USBPID_DATA1.
|
||||
* Since the token is toggled BEFORE sending any data, the first packet is
|
||||
* sent with the oposite value of this configuration!
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_HALT 0
|
||||
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
||||
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
||||
* it is required by the standard. We have made it a config option because it
|
||||
* bloats the code considerably.
|
||||
*/
|
||||
#define USB_CFG_SUPPRESS_INTR_CODE 0
|
||||
/* Define this to 1 if you want to declare interrupt-in endpoints, but don't
|
||||
* want to send any data over them. If this macro is defined to 1, functions
|
||||
* usbSetInterrupt() and usbSetInterrupt3() are omitted. This is useful if
|
||||
* you need the interrupt-in endpoints in order to comply to an interface
|
||||
* (e.g. HID), but never want to send any data. This option saves a couple
|
||||
* of bytes in flash memory and the transmit buffers in RAM.
|
||||
*/
|
||||
#define USB_CFG_INTR_POLL_INTERVAL 10
|
||||
/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
||||
* interval. The value is in milliseconds and must not be less than 10 ms for
|
||||
* low speed devices.
|
||||
*/
|
||||
#ifndef USB_CFG_IS_SELF_POWERED // allow bootloaderconfig.h to override
|
||||
#define USB_CFG_IS_SELF_POWERED 0
|
||||
#endif
|
||||
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
|
||||
* device is powered from the USB bus.
|
||||
*/
|
||||
#ifndef USB_CFG_MAX_BUS_POWER // allow bootloaderconfig.h to override
|
||||
#define USB_CFG_MAX_BUS_POWER 100
|
||||
#endif
|
||||
/* Set this variable to the maximum USB bus power consumption of your device.
|
||||
* The value is in milliamperes. [It will be divided by two since USB
|
||||
* communicates power requirements in units of 2 mA.]
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITE 1
|
||||
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
||||
* transfers. Set it to 0 if you don't need it and want to save a couple of
|
||||
* bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_READ 1
|
||||
/* Set this to 1 if you need to send control replies which are generated
|
||||
* "on the fly" when usbFunctionRead() is called. If you only want to send
|
||||
* data from a static buffer, set it to 0 and return the data from
|
||||
* usbFunctionSetup(). This saves a couple of bytes.
|
||||
*/
|
||||
#define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
||||
/* Define this to 1 if you want to use interrupt-out (or bulk out) endpoints.
|
||||
* You must implement the function usbFunctionWriteOut() which receives all
|
||||
* interrupt/bulk data sent to any endpoint other than 0. The endpoint number
|
||||
* can be found in 'usbRxToken'.
|
||||
*/
|
||||
#define USB_CFG_HAVE_FLOWCONTROL 0
|
||||
/* Define this to 1 if you want flowcontrol over USB data. See the definition
|
||||
* of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
||||
* usbdrv.h.
|
||||
*/
|
||||
#define USB_CFG_DRIVER_FLASH_PAGE 0
|
||||
/* If the device has more than 64 kBytes of flash, define this to the 64 k page
|
||||
* where the driver's constants (descriptors) are located. Or in other words:
|
||||
* Define this to 1 for boot loaders on the ATMega128.
|
||||
*/
|
||||
#define USB_CFG_LONG_TRANSFERS 0
|
||||
/* Define this to 1 if you want to send/receive blocks of more than 254 bytes
|
||||
* in a single control-in or control-out transfer. Note that the capability
|
||||
* for long transfers increases the driver size.
|
||||
*/
|
||||
#ifndef __ASSEMBLER__
|
||||
extern volatile char usbHasRxed;
|
||||
#endif
|
||||
#define USB_RX_USER_HOOK(data, len) do { usbHasRxed = 1; } while (0);
|
||||
/* This macro is a hook if you want to do unconventional things. If it is
|
||||
* defined, it's inserted at the beginning of received message processing.
|
||||
* If you eat the received message and don't want default processing to
|
||||
* proceed, do a return after doing your things. One possible application
|
||||
* (besides debugging) is to flash a status LED on each packet.
|
||||
*/
|
||||
/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
|
||||
/* This macro is a hook if you need to know when an USB RESET occurs. It has
|
||||
* one parameter which distinguishes between the start of RESET state and its
|
||||
* end.
|
||||
*/
|
||||
/* #define USB_SET_ADDRESS_HOOK() hadAddressAssigned(); */
|
||||
/* This macro (if defined) is executed when a USB SET_ADDRESS request was
|
||||
* received.
|
||||
*/
|
||||
#define USB_COUNT_SOF 0
|
||||
/* define this macro to 1 if you need the global variable "usbSofCount" which
|
||||
* counts SOF packets. This feature requires that the hardware interrupt is
|
||||
* connected to D- instead of D+.
|
||||
*/
|
||||
/* #ifdef __ASSEMBLER__
|
||||
* macro myAssemblerMacro
|
||||
* in YL, TCNT0
|
||||
* sts timer0Snapshot, YL
|
||||
* endm
|
||||
* #endif
|
||||
* #define USB_SOF_HOOK myAssemblerMacro
|
||||
* This macro (if defined) is executed in the assembler module when a
|
||||
* Start Of Frame condition is detected. It is recommended to define it to
|
||||
* the name of an assembler macro which is defined here as well so that more
|
||||
* than one assembler instruction can be used. The macro may use the register
|
||||
* YL and modify SREG. If it lasts longer than a couple of cycles, USB messages
|
||||
* immediately after an SOF pulse may be lost and must be retried by the host.
|
||||
* What can you do with this hook? Since the SOF signal occurs exactly every
|
||||
* 1 ms (unless the host is in sleep mode), you can use it to tune OSCCAL in
|
||||
* designs running on the internal RC oscillator.
|
||||
* Please note that Start Of Frame detection works only if D- is wired to the
|
||||
* interrupt, not D+. THIS IS DIFFERENT THAN MOST EXAMPLES!
|
||||
*/
|
||||
#define USB_CFG_CHECK_DATA_TOGGLING 0
|
||||
/* define this macro to 1 if you want to filter out duplicate data packets
|
||||
* sent by the host. Duplicates occur only as a consequence of communication
|
||||
* errors, when the host does not receive an ACK. Please note that you need to
|
||||
* implement the filtering yourself in usbFunctionWriteOut() and
|
||||
* usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
|
||||
* for each control- and out-endpoint to check for duplicate packets.
|
||||
*/
|
||||
#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 1
|
||||
/* define this macro to 1 if you want the function usbMeasureFrameLength()
|
||||
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
|
||||
*/
|
||||
#define USB_USE_FAST_CRC 0
|
||||
/* The assembler module has two implementations for the CRC algorithm. One is
|
||||
* faster, the other is smaller. This CRC routine is only used for transmitted
|
||||
* messages where timing is not critical. The faster routine needs 31 cycles
|
||||
* per byte while the smaller one needs 61 to 69 cycles. The faster routine
|
||||
* may be worth the 32 bytes bigger code size if you transmit lots of data and
|
||||
* run the AVR close to its limit.
|
||||
*/
|
||||
|
||||
/* -------------------------- Device Description --------------------------- */
|
||||
|
||||
#define USB_CFG_VENDOR_ID 0x41, 0x23 /* = 0x16c0 = 5824 = voti.nl */
|
||||
/* USB vendor ID for the device, low byte first. If you have registered your
|
||||
* own Vendor ID, define it here. Otherwise you may use one of obdev's free
|
||||
* shared VID/PID pairs. Be sure to read USB-IDs-for-free.txt for rules!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_ID 0x9F, 0x0c /* = 0x05dc = 1500 */
|
||||
/* This is the ID of the product, low byte first. It is interpreted in the
|
||||
* scope of the vendor ID. If you have registered your own VID with usb.org
|
||||
* or if you have licensed a PID from somebody else, define it here. Otherwise
|
||||
* you may use one of obdev's free shared VID/PID pairs. See the file
|
||||
* USB-IDs-for-free.txt for details!
|
||||
*/
|
||||
#define USB_CFG_DEVICE_VERSION 0x00, 0x01
|
||||
/* Version number of the device: Minor number first, then major number.
|
||||
*/
|
||||
#define USB_CFG_VENDOR_NAME 'A','r','d','u','i','n','o','.','c','c'
|
||||
#define USB_CFG_VENDOR_NAME_LEN 10
|
||||
/* These two values define the vendor name returned by the USB device. The name
|
||||
* must be given as a list of characters under single quotes. The characters
|
||||
* are interpreted as Unicode (UTF-16) entities.
|
||||
* If you don't want a vendor name string, undefine these macros.
|
||||
* ALWAYS define a vendor name containing your Internet domain name if you use
|
||||
* obdev's free shared VID/PID pair. See the file USB-IDs-for-free.txt for
|
||||
* details.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_NAME 'G','e','m','m','a'
|
||||
#define USB_CFG_DEVICE_NAME_LEN 5
|
||||
/* Same as above for the device name. If you don't want a device name, undefine
|
||||
* the macros. See the file USB-IDs-for-free.txt before you assign a name if
|
||||
* you use a shared VID/PID.
|
||||
*/
|
||||
/*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
|
||||
/*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
|
||||
/* Same as above for the serial number. If you don't want a serial number,
|
||||
* undefine the macros.
|
||||
* It may be useful to provide the serial number through other means than at
|
||||
* compile time. See the section about descriptor properties below for how
|
||||
* to fine tune control over USB descriptors such as the string descriptor
|
||||
* for the serial number.
|
||||
*/
|
||||
#define USB_CFG_DEVICE_CLASS 0xFF /* set to 0 if deferred to interface */
|
||||
#define USB_CFG_DEVICE_SUBCLASS 0
|
||||
/* See USB specification if you want to conform to an existing device class.
|
||||
* Class 0xff is "vendor specific".
|
||||
*/
|
||||
#define USB_CFG_INTERFACE_CLASS 0 /* define class here if not at device level */
|
||||
#define USB_CFG_INTERFACE_SUBCLASS 0
|
||||
#define USB_CFG_INTERFACE_PROTOCOL 0
|
||||
/* See USB specification if you want to conform to an existing device class or
|
||||
* protocol. The following classes must be set at interface level:
|
||||
* HID class is 3, no subclass and protocol required (but may be useful!)
|
||||
* CDC class is 2, use subclass 2 and protocol 1 for ACM
|
||||
*/
|
||||
/* #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 42 */
|
||||
/* Define this to the length of the HID report descriptor, if you implement
|
||||
* an HID device. Otherwise don't define it or define it to 0.
|
||||
* If you use this define, you must add a PROGMEM character array named
|
||||
* "usbHidReportDescriptor" to your code which contains the report descriptor.
|
||||
* Don't forget to keep the array and this define in sync!
|
||||
*/
|
||||
|
||||
#define USB_PUBLIC static
|
||||
/* Use the define above if you #include usbdrv.c instead of linking against it.
|
||||
* This technique saves a couple of bytes in flash memory.
|
||||
*/
|
||||
|
||||
/* ------------------- Fine Control over USB Descriptors ------------------- */
|
||||
/* If you don't want to use the driver's default USB descriptors, you can
|
||||
* provide our own. These can be provided as (1) fixed length static data in
|
||||
* flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
||||
* runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
||||
* information about this function.
|
||||
* Descriptor handling is configured through the descriptor's properties. If
|
||||
* no properties are defined or if they are 0, the default descriptor is used.
|
||||
* Possible properties are:
|
||||
* + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
||||
* at runtime via usbFunctionDescriptor(). If the usbMsgPtr mechanism is
|
||||
* used, the data is in FLASH by default. Add property USB_PROP_IS_RAM if
|
||||
* you want RAM pointers.
|
||||
* + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
||||
* in static memory is in RAM, not in flash memory.
|
||||
* + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
||||
* the driver must know the descriptor's length. The descriptor itself is
|
||||
* found at the address of a well known identifier (see below).
|
||||
* List of static descriptor names (must be declared PROGMEM if in flash):
|
||||
* char usbDescriptorDevice[];
|
||||
* char usbDescriptorConfiguration[];
|
||||
* char usbDescriptorHidReport[];
|
||||
* char usbDescriptorString0[];
|
||||
* int usbDescriptorStringVendor[];
|
||||
* int usbDescriptorStringDevice[];
|
||||
* int usbDescriptorStringSerialNumber[];
|
||||
* Other descriptors can't be provided statically, they must be provided
|
||||
* dynamically at runtime.
|
||||
*
|
||||
* Descriptor properties are or-ed or added together, e.g.:
|
||||
* #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
||||
*
|
||||
* The following descriptors are defined:
|
||||
* USB_CFG_DESCR_PROPS_DEVICE
|
||||
* USB_CFG_DESCR_PROPS_CONFIGURATION
|
||||
* USB_CFG_DESCR_PROPS_STRINGS
|
||||
* USB_CFG_DESCR_PROPS_STRING_0
|
||||
* USB_CFG_DESCR_PROPS_STRING_VENDOR
|
||||
* USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
||||
* USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
||||
* USB_CFG_DESCR_PROPS_HID
|
||||
* USB_CFG_DESCR_PROPS_HID_REPORT
|
||||
* USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
||||
*
|
||||
* Note about string descriptors: String descriptors are not just strings, they
|
||||
* are Unicode strings prefixed with a 2 byte header. Example:
|
||||
* int serialNumberDescriptor[] = {
|
||||
* USB_STRING_DESCRIPTOR_HEADER(6),
|
||||
* 'S', 'e', 'r', 'i', 'a', 'l'
|
||||
* };
|
||||
*/
|
||||
|
||||
#define USB_CFG_DESCR_PROPS_DEVICE 0
|
||||
#define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
||||
#define USB_CFG_DESCR_PROPS_STRINGS 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_0 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
||||
#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
||||
#define USB_CFG_DESCR_PROPS_HID 0
|
||||
#define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
||||
#define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
||||
|
||||
#define usbMsgPtr_t unsigned short // scalar type yields shortest code
|
||||
|
||||
/* ----------------------- Optional MCU Description ------------------------ */
|
||||
|
||||
/* The following configurations have working defaults in usbdrv.h. You
|
||||
* usually don't need to set them explicitly. Only if you want to run
|
||||
* the driver on a device which is not yet supported or with a compiler
|
||||
* which is not fully supported (such as IAR C) or if you use a differnt
|
||||
* interrupt than INT0, you may have to define some of these.
|
||||
*/
|
||||
#define USB_INTR_CFG PCMSK
|
||||
#define USB_INTR_CFG_SET (1 << USB_CFG_DPLUS_BIT)
|
||||
#define USB_INTR_CFG_CLR 0
|
||||
#define USB_INTR_ENABLE GIMSK
|
||||
#define USB_INTR_ENABLE_BIT PCIE
|
||||
#define USB_INTR_PENDING GIFR
|
||||
#define USB_INTR_PENDING_BIT PCIF
|
||||
#define USB_INTR_VECTOR PCINT0_vect
|
||||
|
||||
#endif /* __usbconfig_h_included__ */
|
24
hardware/arduino/avr/bootloaders/gemma/usbconfig.patch
Normal file
24
hardware/arduino/avr/bootloaders/gemma/usbconfig.patch
Normal file
@ -0,0 +1,24 @@
|
||||
203c203
|
||||
< #define USB_CFG_VENDOR_ID 0x81, 0x17 /* = 0x16c0 = 5824 = voti.nl */
|
||||
---
|
||||
> #define USB_CFG_VENDOR_ID 0x41, 0x23 /* = 0x16c0 = 5824 = voti.nl */
|
||||
208c208
|
||||
< #define USB_CFG_DEVICE_ID 0x9F, 0x0C /* = 0x05dc = 1500 */
|
||||
---
|
||||
> #define USB_CFG_DEVICE_ID 0x9F, 0x0c /* = 0x05dc = 1500 */
|
||||
215c215
|
||||
< #define USB_CFG_DEVICE_VERSION 0x05, 0x01
|
||||
---
|
||||
> #define USB_CFG_DEVICE_VERSION 0x00, 0x01
|
||||
218,219c218,219
|
||||
< #define USB_CFG_VENDOR_NAME 'A','d','a','f','r','u','i','t'
|
||||
< #define USB_CFG_VENDOR_NAME_LEN 8
|
||||
---
|
||||
> #define USB_CFG_VENDOR_NAME 'A','r','d','u','i','n','o','.','c','c'
|
||||
> #define USB_CFG_VENDOR_NAME_LEN 10
|
||||
228,229c228,229
|
||||
< #define USB_CFG_DEVICE_NAME 'T','r','i','n','k','e','t'
|
||||
< #define USB_CFG_DEVICE_NAME_LEN 7
|
||||
---
|
||||
> #define USB_CFG_DEVICE_NAME 'G','e','m','m','a'
|
||||
> #define USB_CFG_DEVICE_NAME_LEN 5
|
@ -50,7 +50,7 @@
|
||||
/* */
|
||||
/* Code builds on code, libraries and optimisations from: */
|
||||
/* stk500boot.c by Jason P. Kyle */
|
||||
/* Arduino bootloader http://arduino.cc */
|
||||
/* Arduino bootloader http://www.arduino.cc */
|
||||
/* Spiff's 1K bootloader http://spiffie.org/know/arduino_1k_bootloader/bootloader.shtml */
|
||||
/* avr-libc project http://nongnu.org/avr-libc */
|
||||
/* Adaboot http://www.ladyada.net/library/arduino/bootloader.html */
|
||||
|
@ -134,6 +134,7 @@ unsigned long micros(void);
|
||||
void delay(unsigned long);
|
||||
void delayMicroseconds(unsigned int us);
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
||||
@ -232,6 +233,7 @@ uint16_t makeWord(byte h, byte l);
|
||||
#define word(...) makeWord(__VA_ARGS__)
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
||||
void noTone(uint8_t _pin);
|
||||
@ -239,7 +241,7 @@ void noTone(uint8_t _pin);
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
long random(long, long);
|
||||
void randomSeed(unsigned int);
|
||||
void randomSeed(unsigned long);
|
||||
long map(long, long, long, long, long);
|
||||
|
||||
#endif
|
||||
|
@ -213,6 +213,7 @@ void HardwareSerial::flush()
|
||||
|
||||
size_t HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
_written = true;
|
||||
// If the buffer and the data register is empty, just write the byte
|
||||
// to the data register and be done. This shortcut helps
|
||||
// significantly improve the effective datarate at high (>
|
||||
@ -243,10 +244,8 @@ size_t HardwareSerial::write(uint8_t c)
|
||||
_tx_buffer_head = i;
|
||||
|
||||
sbi(*_ucsrb, UDRIE0);
|
||||
_written = true;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif // whole file
|
||||
|
@ -122,9 +122,7 @@ size_t Print::print(const Printable& x)
|
||||
|
||||
size_t Print::println(void)
|
||||
{
|
||||
size_t n = print('\r');
|
||||
n += print('\n');
|
||||
return n;
|
||||
return write("\r\n");
|
||||
}
|
||||
|
||||
size_t Print::println(const String &s)
|
||||
|
@ -64,6 +64,8 @@ class Stream : public Print
|
||||
bool find(uint8_t *target, size_t length) { return find ((char *)target, length); }
|
||||
// returns true if target string is found, false if timed out
|
||||
|
||||
bool find(char target) { return find (&target, 1); }
|
||||
|
||||
bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found
|
||||
bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); }
|
||||
|
||||
|
@ -223,6 +223,18 @@ void detachInterrupt(uint8_t interruptNum) {
|
||||
#warning detachInterrupt may need some more work for this cpu (case 1)
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 2:
|
||||
#if defined(EIMSK) && defined(INT2)
|
||||
EIMSK &= ~(1 << INT2);
|
||||
#elif defined(GICR) && defined(INT2)
|
||||
GICR &= ~(1 << INT2); // atmega32
|
||||
#elif defined(GIMSK) && defined(INT2)
|
||||
GIMSK &= ~(1 << INT2);
|
||||
#elif defined(INT2)
|
||||
#warning detachInterrupt may need some more work for this cpu (case 2)
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ extern "C" {
|
||||
#include "stdlib.h"
|
||||
}
|
||||
|
||||
void randomSeed(unsigned int seed)
|
||||
void randomSeed(unsigned long seed)
|
||||
{
|
||||
if (seed != 0) {
|
||||
srandom(seed);
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
//Declared weak in Arduino.h to allow user redefinitions.
|
||||
int atexit(void (*func)()) { return 0; }
|
||||
// Declared weak in Arduino.h to allow user redefinitions.
|
||||
int atexit(void (* /*func*/ )()) { return 0; }
|
||||
|
||||
// Weak empty variant initialization function.
|
||||
// May be redefined by variant files.
|
||||
|
@ -92,7 +92,6 @@ unsigned long micros() {
|
||||
#error TIMER 0 not defined
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TIFR0
|
||||
if ((TIFR0 & _BV(TOV0)) && (t < 255))
|
||||
m++;
|
||||
@ -119,65 +118,118 @@ void delay(unsigned long ms)
|
||||
}
|
||||
}
|
||||
|
||||
/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock. */
|
||||
/* Delay for the given number of microseconds. Assumes a 1, 8, 12, 16, 20 or 24 MHz clock. */
|
||||
void delayMicroseconds(unsigned int us)
|
||||
{
|
||||
// call = 4 cycles + 2 to 4 cycles to init us(2 for constant delay, 4 for variable)
|
||||
|
||||
// calling avrlib's delay_us() function with low values (e.g. 1 or
|
||||
// 2 microseconds) gives delays longer than desired.
|
||||
//delay_us(us);
|
||||
#if F_CPU >= 20000000L
|
||||
#if F_CPU >= 24000000L
|
||||
// for the 24 MHz clock for the aventurous ones, trying to overclock
|
||||
|
||||
// zero delay fix
|
||||
if (!us) return; // = 3 cycles, (4 when true)
|
||||
|
||||
// the following loop takes a 1/6 of a microsecond (4 cycles)
|
||||
// per iteration, so execute it six times for each microsecond of
|
||||
// delay requested.
|
||||
us *= 6; // x6 us, = 7 cycles
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
// we just burned 22 (24) cycles above, remove 5, (5*4=20)
|
||||
// us is at least 6 so we can substract 5
|
||||
us -= 5; //=2 cycles
|
||||
|
||||
#elif F_CPU >= 20000000L
|
||||
// for the 20 MHz clock on rare Arduino boards
|
||||
|
||||
// for a one-microsecond delay, simply wait 2 cycle and return. The overhead
|
||||
// of the function call yields a delay of exactly a one microsecond.
|
||||
// for a one-microsecond delay, simply return. the overhead
|
||||
// of the function call takes 18 (20) cycles, which is 1us
|
||||
__asm__ __volatile__ (
|
||||
"nop" "\n\t"
|
||||
"nop"); //just waiting 2 cycle
|
||||
if (--us == 0)
|
||||
return;
|
||||
"nop" "\n\t"
|
||||
"nop" "\n\t"
|
||||
"nop"); //just waiting 4 cycles
|
||||
if (us <= 1) return; // = 3 cycles, (4 when true)
|
||||
|
||||
// the following loop takes a 1/5 of a microsecond (4 cycles)
|
||||
// per iteration, so execute it five times for each microsecond of
|
||||
// delay requested.
|
||||
us = (us<<2) + us; // x5 us
|
||||
us = (us << 2) + us; // x5 us, = 7 cycles
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
us -= 2;
|
||||
// we just burned 26 (28) cycles above, remove 7, (7*4=28)
|
||||
// us is at least 10 so we can substract 7
|
||||
us -= 7; // 2 cycles
|
||||
|
||||
#elif F_CPU >= 16000000L
|
||||
// for the 16 MHz clock on most Arduino boards
|
||||
|
||||
// for a one-microsecond delay, simply return. the overhead
|
||||
// of the function call yields a delay of approximately 1 1/8 us.
|
||||
if (--us == 0)
|
||||
return;
|
||||
// of the function call takes 14 (16) cycles, which is 1us
|
||||
if (us <= 1) return; // = 3 cycles, (4 when true)
|
||||
|
||||
// the following loop takes a quarter of a microsecond (4 cycles)
|
||||
// the following loop takes 1/4 of a microsecond (4 cycles)
|
||||
// per iteration, so execute it four times for each microsecond of
|
||||
// delay requested.
|
||||
us <<= 2;
|
||||
us <<= 2; // x4 us, = 4 cycles
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
us -= 2;
|
||||
#else
|
||||
// for the 8 MHz internal clock on the ATmega168
|
||||
// we just burned 19 (21) cycles above, remove 5, (5*4=20)
|
||||
// us is at least 8 so we can substract 5
|
||||
us -= 5; // = 2 cycles,
|
||||
|
||||
// for a one- or two-microsecond delay, simply return. the overhead of
|
||||
// the function calls takes more than two microseconds. can't just
|
||||
// subtract two, since us is unsigned; we'd overflow.
|
||||
if (--us == 0)
|
||||
return;
|
||||
if (--us == 0)
|
||||
return;
|
||||
#elif F_CPU >= 12000000L
|
||||
// for the 12 MHz clock if somebody is working with USB
|
||||
|
||||
// the following loop takes half of a microsecond (4 cycles)
|
||||
// for a 1 microsecond delay, simply return. the overhead
|
||||
// of the function call takes 14 (16) cycles, which is 1.5us
|
||||
if (us <= 1) return; // = 3 cycles, (4 when true)
|
||||
|
||||
// the following loop takes 1/3 of a microsecond (4 cycles)
|
||||
// per iteration, so execute it three times for each microsecond of
|
||||
// delay requested.
|
||||
us = (us << 1) + us; // x3 us, = 5 cycles
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
// we just burned 20 (22) cycles above, remove 5, (5*4=20)
|
||||
// us is at least 6 so we can substract 5
|
||||
us -= 5; //2 cycles
|
||||
|
||||
#elif F_CPU >= 8000000L
|
||||
// for the 8 MHz internal clock
|
||||
|
||||
// for a 1 and 2 microsecond delay, simply return. the overhead
|
||||
// of the function call takes 14 (16) cycles, which is 2us
|
||||
if (us <= 2) return; // = 3 cycles, (4 when true)
|
||||
|
||||
// the following loop takes 1/2 of a microsecond (4 cycles)
|
||||
// per iteration, so execute it twice for each microsecond of
|
||||
// delay requested.
|
||||
us <<= 1;
|
||||
|
||||
// partially compensate for the time taken by the preceeding commands.
|
||||
// we can't subtract any more than this or we'd overflow w/ small delays.
|
||||
us--;
|
||||
us <<= 1; //x2 us, = 2 cycles
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
// we just burned 17 (19) cycles above, remove 4, (4*4=16)
|
||||
// us is at least 6 so we can substract 4
|
||||
us -= 4; // = 2 cycles
|
||||
|
||||
#else
|
||||
// for the 1 MHz internal clock (default settings for common Atmega microcontrollers)
|
||||
|
||||
// the overhead of the function calls is 14 (16) cycles
|
||||
if (us <= 16) return; //= 3 cycles, (4 when true)
|
||||
if (us <= 25) return; //= 3 cycles, (4 when true), (must be at least 25 if we want to substract 22)
|
||||
|
||||
// compensate for the time taken by the preceeding and next commands (about 22 cycles)
|
||||
us -= 22; // = 2 cycles
|
||||
// the following loop takes 4 microseconds (4 cycles)
|
||||
// per iteration, so execute it us/4 times
|
||||
// us is at least 4, divided by 4 gives us 1 (no zero delay bug)
|
||||
us >>= 2; // us div 4, = 4 cycles
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// busy wait
|
||||
@ -185,6 +237,7 @@ void delayMicroseconds(unsigned int us)
|
||||
"1: sbiw %0,1" "\n\t" // 2 cycles
|
||||
"brne 1b" : "=w" (us) : "0" (us) // 2 cycles
|
||||
);
|
||||
// return = 4 cycles
|
||||
}
|
||||
|
||||
void init()
|
||||
@ -199,7 +252,7 @@ void init()
|
||||
#if defined(TCCR0A) && defined(WGM01)
|
||||
sbi(TCCR0A, WGM01);
|
||||
sbi(TCCR0A, WGM00);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// set timer 0 prescale factor to 64
|
||||
#if defined(__AVR_ATmega128__)
|
||||
@ -302,14 +355,32 @@ void init()
|
||||
#endif
|
||||
|
||||
#if defined(ADCSRA)
|
||||
// set a2d prescale factor to 128
|
||||
// 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range.
|
||||
// XXX: this will not work properly for other clock speeds, and
|
||||
// this code should use F_CPU to determine the prescale factor.
|
||||
sbi(ADCSRA, ADPS2);
|
||||
sbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
|
||||
// set a2d prescaler so we are inside the desired 50-200 KHz range.
|
||||
#if F_CPU >= 16000000 // 16 MHz / 128 = 125 KHz
|
||||
sbi(ADCSRA, ADPS2);
|
||||
sbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
#elif F_CPU >= 8000000 // 8 MHz / 64 = 125 KHz
|
||||
sbi(ADCSRA, ADPS2);
|
||||
sbi(ADCSRA, ADPS1);
|
||||
cbi(ADCSRA, ADPS0);
|
||||
#elif F_CPU >= 4000000 // 4 MHz / 32 = 125 KHz
|
||||
sbi(ADCSRA, ADPS2);
|
||||
cbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
#elif F_CPU >= 2000000 // 2 MHz / 16 = 125 KHz
|
||||
sbi(ADCSRA, ADPS2);
|
||||
cbi(ADCSRA, ADPS1);
|
||||
cbi(ADCSRA, ADPS0);
|
||||
#elif F_CPU >= 1000000 // 1 MHz / 8 = 125 KHz
|
||||
cbi(ADCSRA, ADPS2);
|
||||
sbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
#else // 128 kHz / 2 = 64 KHz -> This is the closest you can get, the prescaler is 2
|
||||
cbi(ADCSRA, ADPS2);
|
||||
cbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
#endif
|
||||
// enable a2d conversions
|
||||
sbi(ADCSRA, ADEN);
|
||||
#endif
|
||||
|
@ -43,6 +43,8 @@ extern "C"{
|
||||
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
||||
#endif
|
||||
|
||||
uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops);
|
||||
|
||||
#define EXTERNAL_INT_0 0
|
||||
#define EXTERNAL_INT_1 1
|
||||
#define EXTERNAL_INT_2 2
|
||||
|
178
hardware/arduino/avr/cores/arduino/wiring_pulse.S
Normal file
178
hardware/arduino/avr/cores/arduino/wiring_pulse.S
Normal file
@ -0,0 +1,178 @@
|
||||
/*
|
||||
wiring_pulse.s - pulseInASM() function in different flavours
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2014 Martino Facchin
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following routine was generated by avr-gcc 4.8.3 with the following parameters
|
||||
* -gstabs -Wa,-ahlmsd=output.lst -dp -fverbose-asm -O2
|
||||
* on the original C function
|
||||
*
|
||||
* unsigned long pulseInSimpl(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops)
|
||||
* {
|
||||
* unsigned long width = 0;
|
||||
* // wait for any previous pulse to end
|
||||
* while ((*port & bit) == stateMask)
|
||||
* if (--maxloops == 0)
|
||||
* return 0;
|
||||
*
|
||||
* // wait for the pulse to start
|
||||
* while ((*port & bit) != stateMask)
|
||||
* if (--maxloops == 0)
|
||||
* return 0;
|
||||
*
|
||||
* // wait for the pulse to stop
|
||||
* while ((*port & bit) == stateMask) {
|
||||
* if (++width == maxloops)
|
||||
* return 0;
|
||||
* }
|
||||
* return width;
|
||||
* }
|
||||
*
|
||||
* some compiler outputs were removed but the rest of the code is untouched
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
.section .text
|
||||
|
||||
.global countPulseASM
|
||||
|
||||
countPulseASM:
|
||||
|
||||
.LM0:
|
||||
.LFBB1:
|
||||
push r12 ; ; 130 pushqi1/1 [length = 1]
|
||||
push r13 ; ; 131 pushqi1/1 [length = 1]
|
||||
push r14 ; ; 132 pushqi1/1 [length = 1]
|
||||
push r15 ; ; 133 pushqi1/1 [length = 1]
|
||||
push r16 ; ; 134 pushqi1/1 [length = 1]
|
||||
push r17 ; ; 135 pushqi1/1 [length = 1]
|
||||
/* prologue: function */
|
||||
/* frame size = 0 */
|
||||
/* stack size = 6 */
|
||||
.L__stack_usage = 6
|
||||
mov r30,r24 ; port, port ; 2 *movhi/1 [length = 2]
|
||||
mov r31,r25 ; port, port
|
||||
/* unsigned long width = 0;
|
||||
*** // wait for any previous pulse to end
|
||||
*** while ((*port & bit) == stateMask)
|
||||
*/
|
||||
.LM1:
|
||||
rjmp .L2 ; ; 181 jump [length = 1]
|
||||
.L4:
|
||||
/* if (--maxloops == 0) */
|
||||
.LM2:
|
||||
subi r16,1 ; maxloops, ; 17 addsi3/2 [length = 4]
|
||||
sbc r17, r1 ; maxloops
|
||||
sbc r18, r1 ; maxloops
|
||||
sbc r19, r1 ; maxloops
|
||||
breq .L13 ; , ; 19 branch [length = 1]
|
||||
.L2:
|
||||
/* if (--maxloops == 0) */
|
||||
.LM3:
|
||||
ld r25,Z ; D.1554, *port_7(D) ; 22 movqi_insn/4 [length = 1]
|
||||
and r25,r22 ; D.1554, bit ; 24 andqi3/1 [length = 1]
|
||||
cp r25,r20 ; D.1554, stateMask ; 25 *cmpqi/2 [length = 1]
|
||||
breq .L4 ; , ; 26 branch [length = 1]
|
||||
rjmp .L6 ; ; 184 jump [length = 1]
|
||||
.L7:
|
||||
/* return 0;
|
||||
***
|
||||
*** // wait for the pulse to start
|
||||
*** while ((*port & bit) != stateMask)
|
||||
*** if (--maxloops == 0)
|
||||
*/
|
||||
.LM4:
|
||||
subi r16,1 ; maxloops, ; 31 addsi3/2 [length = 4]
|
||||
sbc r17, r1 ; maxloops
|
||||
sbc r18, r1 ; maxloops
|
||||
sbc r19, r1 ; maxloops
|
||||
breq .L13 ; , ; 33 branch [length = 1]
|
||||
.L6:
|
||||
/* if (--maxloops == 0) */
|
||||
.LM5:
|
||||
ld r25,Z ; D.1554, *port_7(D) ; 41 movqi_insn/4 [length = 1]
|
||||
and r25,r22 ; D.1554, bit ; 43 andqi3/1 [length = 1]
|
||||
cpse r25,r20 ; D.1554, stateMask ; 44 enable_interrupt-3 [length = 1]
|
||||
rjmp .L7 ;
|
||||
mov r12, r1 ; width ; 7 *movsi/2 [length = 4]
|
||||
mov r13, r1 ; width
|
||||
mov r14, r1 ; width
|
||||
mov r15, r1 ; width
|
||||
rjmp .L9 ; ; 186 jump [length = 1]
|
||||
.L10:
|
||||
/* return 0;
|
||||
***
|
||||
*** // wait for the pulse to stop
|
||||
*** while ((*port & bit) == stateMask) {
|
||||
*** if (++width == maxloops)
|
||||
*/
|
||||
.LM6:
|
||||
ldi r24,-1 ; , ; 50 addsi3/3 [length = 5]
|
||||
sub r12,r24 ; width,
|
||||
sbc r13,r24 ; width,
|
||||
sbc r14,r24 ; width,
|
||||
sbc r15,r24 ; width,
|
||||
cp r16,r12 ; maxloops, width ; 51 *cmpsi/2 [length = 4]
|
||||
cpc r17,r13 ; maxloops, width
|
||||
cpc r18,r14 ; maxloops, width
|
||||
cpc r19,r15 ; maxloops, width
|
||||
breq .L13 ; , ; 52 branch [length = 1]
|
||||
.L9:
|
||||
/* if (++width == maxloops) */
|
||||
.LM7:
|
||||
ld r24,Z ; D.1554, *port_7(D) ; 60 movqi_insn/4 [length = 1]
|
||||
and r24,r22 ; D.1554, bit ; 62 andqi3/1 [length = 1]
|
||||
cp r24,r20 ; D.1554, stateMask ; 63 *cmpqi/2 [length = 1]
|
||||
breq .L10 ; , ; 64 branch [length = 1]
|
||||
/* return 0;
|
||||
*** }
|
||||
*** return width;
|
||||
*/
|
||||
.LM8:
|
||||
mov r22,r12 ; D.1553, width ; 108 movqi_insn/1 [length = 1]
|
||||
mov r23,r13 ; D.1553, width ; 109 movqi_insn/1 [length = 1]
|
||||
mov r24,r14 ; D.1553, width ; 110 movqi_insn/1 [length = 1]
|
||||
mov r25,r15 ; D.1553, width ; 111 movqi_insn/1 [length = 1]
|
||||
/* epilogue start */
|
||||
.LM9:
|
||||
pop r17 ; ; 171 popqi [length = 1]
|
||||
pop r16 ; ; 172 popqi [length = 1]
|
||||
pop r15 ; ; 173 popqi [length = 1]
|
||||
pop r14 ; ; 174 popqi [length = 1]
|
||||
pop r13 ; ; 175 popqi [length = 1]
|
||||
pop r12 ; ; 176 popqi [length = 1]
|
||||
ret ; 177 return_from_epilogue [length = 1]
|
||||
.L13:
|
||||
.LM10:
|
||||
ldi r22,0 ; D.1553 ; 120 movqi_insn/1 [length = 1]
|
||||
ldi r23,0 ; D.1553 ; 121 movqi_insn/1 [length = 1]
|
||||
ldi r24,0 ; D.1553 ; 122 movqi_insn/1 [length = 1]
|
||||
ldi r25,0 ; D.1553 ; 123 movqi_insn/1 [length = 1]
|
||||
/* epilogue start */
|
||||
.LM11:
|
||||
pop r17 ; ; 138 popqi [length = 1]
|
||||
pop r16 ; ; 139 popqi [length = 1]
|
||||
pop r15 ; ; 140 popqi [length = 1]
|
||||
pop r14 ; ; 141 popqi [length = 1]
|
||||
pop r13 ; ; 142 popqi [length = 1]
|
||||
pop r12 ; ; 143 popqi [length = 1]
|
||||
ret ; 144 return_from_epilogue [length = 1]
|
@ -28,7 +28,10 @@
|
||||
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
|
||||
* to 3 minutes in length, but must be called at least a few dozen microseconds
|
||||
* before the start of the pulse. */
|
||||
* before the start of the pulse.
|
||||
*
|
||||
* This function performs better with short pulses in noInterrupt() context
|
||||
*/
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout)
|
||||
{
|
||||
// cache the port and bit of the pin in order to speed up the
|
||||
@ -37,49 +40,57 @@ unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout)
|
||||
uint8_t bit = digitalPinToBitMask(pin);
|
||||
uint8_t port = digitalPinToPort(pin);
|
||||
uint8_t stateMask = (state ? bit : 0);
|
||||
unsigned long width = 0; // keep initialization out of time critical area
|
||||
|
||||
|
||||
// convert the timeout from microseconds to a number of times through
|
||||
// the initial loop; it takes approximately 16 clock cycles per iteration
|
||||
unsigned long maxloops = microsecondsToClockCycles(timeout)/16;
|
||||
|
||||
unsigned long width = countPulseASM(portInputRegister(port), bit, stateMask, maxloops);
|
||||
|
||||
// prevent clockCyclesToMicroseconds to return bogus values if countPulseASM timed out
|
||||
if (width)
|
||||
return clockCyclesToMicroseconds(width * 16 + 16);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
|
||||
* to 3 minutes in length, but must be called at least a few dozen microseconds
|
||||
* before the start of the pulse.
|
||||
*
|
||||
* ATTENTION:
|
||||
* this function relies on micros() so cannot be used in noInterrupt() context
|
||||
*/
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout)
|
||||
{
|
||||
// cache the port and bit of the pin in order to speed up the
|
||||
// pulse width measuring loop and achieve finer resolution. calling
|
||||
// digitalRead() instead yields much coarser resolution.
|
||||
uint8_t bit = digitalPinToBitMask(pin);
|
||||
uint8_t port = digitalPinToPort(pin);
|
||||
uint8_t stateMask = (state ? bit : 0);
|
||||
|
||||
// convert the timeout from microseconds to a number of times through
|
||||
// the initial loop; it takes 16 clock cycles per iteration.
|
||||
unsigned long numloops = 0;
|
||||
unsigned long maxloops = microsecondsToClockCycles(timeout) / 16;
|
||||
|
||||
unsigned long maxloops = microsecondsToClockCycles(timeout);
|
||||
|
||||
// wait for any previous pulse to end
|
||||
while ((*portInputRegister(port) & bit) == stateMask)
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
|
||||
|
||||
// wait for the pulse to start
|
||||
while ((*portInputRegister(port) & bit) != stateMask)
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
|
||||
|
||||
unsigned long start = micros();
|
||||
// wait for the pulse to stop
|
||||
while ((*portInputRegister(port) & bit) == stateMask) {
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
width++;
|
||||
}
|
||||
|
||||
// convert the reading to microseconds. There will be some error introduced by
|
||||
// the interrupt handlers.
|
||||
|
||||
// Conversion constants are compiler-dependent, different compiler versions
|
||||
// have different levels of optimization.
|
||||
#if __GNUC__==4 && __GNUC_MINOR__==3 && __GNUC_PATCHLEVEL__==2
|
||||
// avr-gcc 4.3.2
|
||||
return clockCyclesToMicroseconds(width * 21 + 16);
|
||||
#elif __GNUC__==4 && __GNUC_MINOR__==8 && __GNUC_PATCHLEVEL__==1
|
||||
// avr-gcc 4.8.1
|
||||
return clockCyclesToMicroseconds(width * 24 + 16);
|
||||
#elif __GNUC__<=4 && __GNUC_MINOR__<=3
|
||||
// avr-gcc <=4.3.x
|
||||
#warning "pulseIn() results may not be accurate"
|
||||
return clockCyclesToMicroseconds(width * 21 + 16);
|
||||
#else
|
||||
// avr-gcc >4.3.x
|
||||
#warning "pulseIn() results may not be accurate"
|
||||
return clockCyclesToMicroseconds(width * 24 + 16);
|
||||
#endif
|
||||
|
||||
return micros() - start;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ author=Arduino, Christopher Andrews
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Enables reading and writing to the permanent board storage. For all Arduino boards BUT Arduino DUE.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/EEPROM
|
||||
url=http://www.arduino.cc/en/Reference/EEPROM
|
||||
architectures=avr
|
||||
types=Arduino
|
||||
|
||||
|
@ -4,7 +4,6 @@ author=Arduino
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For all Arduino boards, BUT Arduino DUE.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/SPI
|
||||
url=http://www.arduino.cc/en/Reference/SPI
|
||||
architectures=avr
|
||||
types=Arduino
|
||||
|
||||
|
@ -4,7 +4,6 @@ author=Arduino
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Enables serial communication on digital pins. For all Arduino boards, BUT Arduino DUE.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/SoftwareSerial
|
||||
url=http://www.arduino.cc/en/Reference/SoftwareSerial
|
||||
architectures=avr
|
||||
types=Arduino
|
||||
|
||||
|
@ -4,7 +4,6 @@ author=Arduino
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For all Arduino boards, BUT Arduino DUE.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/Wire
|
||||
url=http://www.arduino.cc/en/Reference/Wire
|
||||
architectures=avr
|
||||
types=Arduino
|
||||
|
||||
|
@ -8,6 +8,10 @@
|
||||
name=Arduino AVR Boards
|
||||
version=1.6.7
|
||||
|
||||
|
||||
runtime.tools.avr-gcc.path={runtime.platform.path}/../../tools/avr
|
||||
runtime.tools.avrdude.path={runtime.platform.path}/../../tools/avr
|
||||
|
||||
# AVR compile variables
|
||||
# ---------------------
|
||||
|
||||
|
@ -51,3 +51,28 @@ usbGemma.program.tool=avrdude
|
||||
usbGemma.program.extra_params=
|
||||
usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf
|
||||
|
||||
# STK500 firmware version v1 and v2 use different serial protocols.
|
||||
# Using the 'stk500' protocol tells avrdude to try and autodetect the
|
||||
# firmware version. If this leads to problems, we might need to add
|
||||
# stk500v1 and stk500v2 entries to allow explicitely selecting the
|
||||
# firmware version.
|
||||
stk500.name=Atmel STK500 development board
|
||||
stk500.communication=serial
|
||||
stk500.protocol=stk500
|
||||
stk500.program.protocol=stk500
|
||||
stk500.program.tool=avrdude
|
||||
stk500.program.extra_params=-P{serial.port}
|
||||
|
||||
## Notes about Dangerous Prototypes Bus Pirate as ISP
|
||||
## Bus Pirate V3 need Firmware v5.10 or later
|
||||
## Bus Pirate V4 need Firmware v6.3-r2151 or later
|
||||
## Could happen that BP does not have enough current to power an Arduino board
|
||||
## through the ICSP connector. In this case disconnect the +Vcc from ICSP connector
|
||||
## and power Arduino board in the normal way.
|
||||
buspirate.name=BusPirate as ISP
|
||||
buspirate.communication=serial
|
||||
buspirate.protocol=buspirate
|
||||
buspirate.program.protocol=buspirate
|
||||
buspirate.program.tool=avrdude
|
||||
buspirate.program.extra_params=-P{serial.port}
|
||||
|
||||
|
@ -115,9 +115,7 @@ size_t Print::print(const Printable& x)
|
||||
|
||||
size_t Print::println(void)
|
||||
{
|
||||
size_t n = print('\r');
|
||||
n += print('\n');
|
||||
return n;
|
||||
return write("\r\n");
|
||||
}
|
||||
|
||||
size_t Print::println(const String &s)
|
||||
|
@ -1,3 +1,29 @@
|
||||
/*
|
||||
pgmspace.h - Definitions for compatibility with AVR pgmspace macros
|
||||
|
||||
Copyright (c) 2015 Arduino LLC
|
||||
|
||||
Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE
|
||||
*/
|
||||
|
||||
#ifndef __PGMSPACE_H_
|
||||
#define __PGMSPACE_H_ 1
|
||||
|
||||
|
@ -22,40 +22,72 @@
|
||||
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
|
||||
* to 3 minutes in length, but must be called at least a few dozen microseconds
|
||||
* before the start of the pulse. */
|
||||
extern uint32_t pulseIn( uint32_t pin, uint32_t state, uint32_t timeout )
|
||||
* before the start of the pulse.
|
||||
*
|
||||
* ATTENTION:
|
||||
* This function performs better with short pulses in noInterrupt() context
|
||||
*/
|
||||
uint32_t pulseIn( uint32_t pin, uint32_t state, uint32_t timeout )
|
||||
{
|
||||
// cache the port and bit of the pin in order to speed up the
|
||||
// pulse width measuring loop and achieve finer resolution. calling
|
||||
// digitalRead() instead yields much coarser resolution.
|
||||
PinDescription p = g_APinDescription[pin];
|
||||
uint32_t width = 0; // keep initialization out of time critical area
|
||||
uint32_t bit = p.ulPin;
|
||||
uint32_t stateMask = state ? bit : 0;
|
||||
|
||||
// convert the timeout from microseconds to a number of times through
|
||||
// the initial loop; it takes 22 clock cycles per iteration.
|
||||
uint32_t numloops = 0;
|
||||
uint32_t maxloops = microsecondsToClockCycles(timeout) / 22;
|
||||
|
||||
// wait for any previous pulse to end
|
||||
while (PIO_Get(p.pPort, PIO_INPUT, p.ulPin) == state)
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
|
||||
// wait for the pulse to start
|
||||
while (PIO_Get(p.pPort, PIO_INPUT, p.ulPin) != state)
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
|
||||
// wait for the pulse to stop
|
||||
while (PIO_Get(p.pPort, PIO_INPUT, p.ulPin) == state) {
|
||||
if (numloops++ == maxloops)
|
||||
return 0;
|
||||
width++;
|
||||
}
|
||||
// the initial loop; it takes (roughly) 18 clock cycles per iteration.
|
||||
uint32_t maxloops = microsecondsToClockCycles(timeout) / 18;
|
||||
|
||||
uint32_t width = countPulseASM(&(p.pPort->PIO_PDSR), bit, stateMask, maxloops);
|
||||
|
||||
// convert the reading to microseconds. The loop has been determined
|
||||
// to be 52 clock cycles long and have about 16 clocks between the edge
|
||||
// to be 18 clock cycles long and have about 16 clocks between the edge
|
||||
// and the start of the loop. There will be some error introduced by
|
||||
// the interrupt handlers.
|
||||
return clockCyclesToMicroseconds(width * 52 + 16);
|
||||
if (width)
|
||||
return clockCyclesToMicroseconds(width * 18 + 16);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
|
||||
* to 3 minutes in length, but must be called at least a few dozen microseconds
|
||||
* before the start of the pulse.
|
||||
*
|
||||
* ATTENTION:
|
||||
* this function relies on micros() so cannot be used in noInterrupt() context
|
||||
*/
|
||||
uint32_t pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout)
|
||||
{
|
||||
// cache the port and bit of the pin in order to speed up the
|
||||
// pulse width measuring loop and achieve finer resolution. calling
|
||||
// digitalRead() instead yields much coarser resolution.
|
||||
PinDescription p = g_APinDescription[pin];
|
||||
uint32_t bit = p.ulPin;
|
||||
uint32_t stateMask = state ? bit : 0;
|
||||
|
||||
// convert the timeout from microseconds to a number of times through
|
||||
// the initial loop; it takes 18 clock cycles per iteration.
|
||||
unsigned long maxloops = microsecondsToClockCycles(timeout) / 10;
|
||||
|
||||
// wait for any previous pulse to end
|
||||
while ((p.pPort->PIO_PDSR & bit) == stateMask)
|
||||
if (--maxloops == 0)
|
||||
return 0;
|
||||
|
||||
// wait for the pulse to start
|
||||
while ((p.pPort->PIO_PDSR & bit) != stateMask)
|
||||
if (--maxloops == 0)
|
||||
return 0;
|
||||
|
||||
unsigned long start = micros();
|
||||
// wait for the pulse to stop
|
||||
while ((p.pPort->PIO_PDSR & bit) == stateMask) {
|
||||
if (--maxloops == 0)
|
||||
return 0;
|
||||
}
|
||||
return micros() - start;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit, uint32_t stateMask, unsigned long maxloops);
|
||||
/*
|
||||
* \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH
|
||||
* or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds
|
||||
@ -30,7 +31,7 @@
|
||||
* before the start of the pulse.
|
||||
*/
|
||||
extern uint32_t pulseIn( uint32_t ulPin, uint32_t ulState, uint32_t ulTimeout = 1000000L ) ;
|
||||
|
||||
extern uint32_t pulseInLong( uint8_t pin, uint8_t state, unsigned long timeout = 1000000L ) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
166
hardware/arduino/sam/cores/arduino/wiring_pulse_asm.S
Normal file
166
hardware/arduino/sam/cores/arduino/wiring_pulse_asm.S
Normal file
@ -0,0 +1,166 @@
|
||||
/*
|
||||
Copyright (c) 2015 Arduino LLC. All right reserved.
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
The following function has been compiled to ASM with gcc
|
||||
unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit, uint32_t stateMask, unsigned long maxloops)
|
||||
{
|
||||
unsigned long width = 0;
|
||||
// wait for any previous pulse to end
|
||||
while ((*port & bit) == stateMask)
|
||||
if (--maxloops == 0)
|
||||
return 0;
|
||||
// wait for the pulse to start
|
||||
while ((*port & bit) != stateMask)
|
||||
if (--maxloops == 0)
|
||||
return 0;
|
||||
// wait for the pulse to stop
|
||||
while ((*port & bit) == stateMask) {
|
||||
if (++width == maxloops)
|
||||
return 0;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
using the command line:
|
||||
|
||||
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -c -O2 -W -ffunction-sections -fdata-sections -nostdlib \
|
||||
countPulseASM.c -Wa,-ahlmsd=output.lst -dp -fverbose-asm -S \
|
||||
-I.arduino15/packages/arduino/hardware/sam/1.6.3/cores/arduino \
|
||||
-I.arduino15/packages/arduino/hardware/sam/1.6.3/system/CMSIS/CMSIS/Include \
|
||||
-I.arduino15/packages/arduino/hardware/sam/1.6.3/system/CMSIS/Device/ATMEL \
|
||||
-I.arduino15/packages/arduino/hardware/sam/1.6.3/system/libsam/include \
|
||||
-I.arduino15/packages/arduino/hardware/sam/1.6.3/variants/arduino_due_x
|
||||
|
||||
The result has been slightly edited to increase readability.
|
||||
*/
|
||||
|
||||
.syntax unified
|
||||
.cpu cortex-m3
|
||||
.fpu softvfp
|
||||
.eabi_attribute 20, 1 @ Tag_ABI_FP_denormal
|
||||
.eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions
|
||||
.eabi_attribute 23, 3 @ Tag_ABI_FP_number_model
|
||||
.eabi_attribute 24, 1 @ Tag_ABI_align8_needed
|
||||
.eabi_attribute 25, 1 @ Tag_ABI_align8_preserved
|
||||
.eabi_attribute 26, 1 @ Tag_ABI_enum_size
|
||||
.eabi_attribute 30, 2 @ Tag_ABI_optimization_goals
|
||||
.eabi_attribute 34, 1 @ Tag_CPU_unaligned_access
|
||||
.eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t
|
||||
.file "countPulseASM.c"
|
||||
@ GNU C (GNU Tools for ARM Embedded Processors) version 4.9.3 20150303 (release) [ARM/embedded-4_9-branch revision 221220] (arm-none-eabi)
|
||||
@ compiled by GNU C version 4.7.4, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
|
||||
@ GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
|
||||
@ options passed:
|
||||
@ -I .arduino15/packages/arduino/hardware/sam/1.6.3/cores/arduino
|
||||
@ -I .arduino15/packages/arduino/hardware/sam/1.6.3/system/CMSIS/CMSIS/Include
|
||||
@ -I .arduino15/packages/arduino/hardware/sam/1.6.3/system/CMSIS/Device/ATMEL
|
||||
@ -I .arduino15/packages/arduino/hardware/sam/1.6.3/system/libsam/include
|
||||
@ -I .arduino15/packages/arduino/hardware/sam/1.6.3/variants/arduino_due_x
|
||||
@ -imultilib armv7-m -iprefix /usr/bin/../lib/gcc/arm-none-eabi/4.9.3/
|
||||
@ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ countPulseASM.c
|
||||
@ -mcpu=cortex-m3 -mthumb -O2 -Wextra -ffunction-sections -fdata-sections
|
||||
@ -fverbose-asm
|
||||
@ options enabled: -faggressive-loop-optimizations -fauto-inc-dec
|
||||
@ -fbranch-count-reg -fcaller-saves -fcombine-stack-adjustments -fcommon
|
||||
@ -fcompare-elim -fcprop-registers -fcrossjumping -fcse-follow-jumps
|
||||
@ -fdata-sections -fdefer-pop -fdelete-null-pointer-checks -fdevirtualize
|
||||
@ -fdevirtualize-speculatively -fdwarf2-cfi-asm -fearly-inlining
|
||||
@ -feliminate-unused-debug-types -fexpensive-optimizations
|
||||
@ -fforward-propagate -ffunction-cse -ffunction-sections -fgcse -fgcse-lm
|
||||
@ -fgnu-runtime -fgnu-unique -fguess-branch-probability
|
||||
@ -fhoist-adjacent-loads -fident -fif-conversion -fif-conversion2
|
||||
@ -findirect-inlining -finline -finline-atomics
|
||||
@ -finline-functions-called-once -finline-small-functions -fipa-cp
|
||||
@ -fipa-profile -fipa-pure-const -fipa-reference -fipa-sra
|
||||
@ -fira-hoist-pressure -fira-share-save-slots -fira-share-spill-slots
|
||||
@ -fisolate-erroneous-paths-dereference -fivopts -fkeep-static-consts
|
||||
@ -fleading-underscore -flifetime-dse -fmath-errno -fmerge-constants
|
||||
@ -fmerge-debug-strings -fmove-loop-invariants -fomit-frame-pointer
|
||||
@ -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole
|
||||
@ -fpeephole2 -fprefetch-loop-arrays -freg-struct-return -freorder-blocks
|
||||
@ -freorder-functions -frerun-cse-after-loop
|
||||
@ -fsched-critical-path-heuristic -fsched-dep-count-heuristic
|
||||
@ -fsched-group-heuristic -fsched-interblock -fsched-last-insn-heuristic
|
||||
@ -fsched-pressure -fsched-rank-heuristic -fsched-spec
|
||||
@ -fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fschedule-insns
|
||||
@ -fschedule-insns2 -fsection-anchors -fshow-column -fshrink-wrap
|
||||
@ -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types
|
||||
@ -fstrict-aliasing -fstrict-overflow -fstrict-volatile-bitfields
|
||||
@ -fsync-libcalls -fthread-jumps -ftoplevel-reorder -ftrapping-math
|
||||
@ -ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch
|
||||
@ -ftree-coalesce-vars -ftree-copy-prop -ftree-copyrename -ftree-cselim
|
||||
@ -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
|
||||
@ -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon
|
||||
@ -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pre
|
||||
@ -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr
|
||||
@ -ftree-sra -ftree-switch-conversion -ftree-tail-merge -ftree-ter
|
||||
@ -ftree-vrp -funit-at-a-time -fverbose-asm -fzero-initialized-in-bss
|
||||
@ -mfix-cortex-m3-ldrd -mlittle-endian -mlra -mpic-data-is-text-relative
|
||||
@ -msched-prolog -mthumb -munaligned-access -mvectorize-with-neon-quad
|
||||
|
||||
.section .text.countPulseASM,"ax",%progbits
|
||||
.align 2
|
||||
.global countPulseASM
|
||||
.thumb
|
||||
.thumb_func
|
||||
.type countPulseASM, %function
|
||||
countPulseASM:
|
||||
@ args = 0, pretend = 0, frame = 0
|
||||
@ frame_needed = 0, uses_anonymous_args = 0
|
||||
@ link register save eliminated.
|
||||
push {r4, r5} @ @ 132 *push_multi [length = 2]
|
||||
b .L2 @ @ 178 *arm_jump [length = 2]
|
||||
.L4:
|
||||
subs r3, r3, #1 @ maxloops, maxloops, @ 18 thumb2_addsi3_compare0/1 [length = 2]
|
||||
beq .L12 @, @ 19 arm_cond_branch [length = 2]
|
||||
.L2:
|
||||
ldr r4, [r0] @ D.4169, *port_7(D) @ 22 *thumb2_movsi_insn/6 [length = 4]
|
||||
ands r4, r4, r1 @, D.4169, D.4169, bit @ 24 *thumb2_alusi3_short [length = 2]
|
||||
cmp r4, r2 @ D.4169, stateMask @ 25 *arm_cmpsi_insn/2 [length = 2]
|
||||
beq .L4 @, @ 26 arm_cond_branch [length = 2]
|
||||
b .L6 @ @ 181 *arm_jump [length = 2]
|
||||
.L7:
|
||||
subs r3, r3, #1 @ maxloops, maxloops, @ 32 thumb2_addsi3_compare0/1 [length = 2]
|
||||
beq .L12 @, @ 33 arm_cond_branch [length = 2]
|
||||
.L6:
|
||||
ldr r4, [r0] @ D.4169, *port_7(D) @ 41 *thumb2_movsi_insn/6 [length = 4]
|
||||
ands r4, r4, r1 @, D.4169, D.4169, bit @ 43 *thumb2_alusi3_short [length = 2]
|
||||
cmp r4, r2 @ D.4169, stateMask @ 44 *arm_cmpsi_insn/2 [length = 2]
|
||||
bne .L7 @, @ 45 arm_cond_branch [length = 2]
|
||||
movs r5, #0 @ width, @ 7 *thumb2_movsi_shortim [length = 2]
|
||||
b .L9 @ @ 183 *arm_jump [length = 2]
|
||||
.L10:
|
||||
adds r5, r5, #1 @ width, width, @ 50 *thumb2_addsi_short/1 [length = 2]
|
||||
cmp r3, r5 @ maxloops, width @ 51 *arm_cmpsi_insn/2 [length = 2]
|
||||
beq .L22 @, @ 52 arm_cond_branch [length = 2]
|
||||
.L9:
|
||||
ldr r4, [r0] @ D.4169, *port_7(D) @ 60 *thumb2_movsi_insn/6 [length = 4]
|
||||
ands r4, r4, r1 @, D.4169, D.4169, bit @ 62 *thumb2_alusi3_short [length = 2]
|
||||
cmp r4, r2 @ D.4169, stateMask @ 63 *arm_cmpsi_insn/2 [length = 2]
|
||||
beq .L10 @, @ 64 arm_cond_branch [length = 2]
|
||||
mov r0, r5 @ D.4169, width @ 9 *thumb2_movsi_insn/1 [length = 2]
|
||||
pop {r4, r5} @ @ 165 *load_multiple_with_writeback [length = 4]
|
||||
bx lr @ @ 166 *thumb2_return [length = 4]
|
||||
.L12:
|
||||
mov r0, r3 @ D.4169, maxloops @ 8 *thumb2_movsi_insn/1 [length = 2]
|
||||
pop {r4, r5} @ @ 137 *load_multiple_with_writeback [length = 4]
|
||||
bx lr @ @ 138 *thumb2_return [length = 4]
|
||||
.L22:
|
||||
movs r0, #0 @ D.4169, @ 11 *thumb2_movsi_shortim [length = 2]
|
||||
pop {r4, r5} @ @ 173 *load_multiple_with_writeback [length = 4]
|
||||
bx lr @ @ 174 *thumb2_return [length = 4]
|
||||
.size countPulseASM, .-countPulseASM
|
||||
.ident "GCC: (GNU Tools for ARM Embedded Processors) 4.9.3 20150303 (release) [ARM/embedded-4_9-branch revision 221220]"
|
@ -4,7 +4,6 @@ author=Arduino
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For Arduino DUE only.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/SPI
|
||||
url=http://www.arduino.cc/en/Reference/SPI
|
||||
architectures=sam
|
||||
types=Arduino
|
||||
|
||||
|
@ -4,7 +4,6 @@ author=Arduino
|
||||
maintainer=Arduino <info@arduino.cc>
|
||||
sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For Arduino DUE only.
|
||||
paragraph=
|
||||
url=http://arduino.cc/en/Reference/Wire
|
||||
url=http://www.arduino.cc/en/Reference/Wire
|
||||
architectures=sam
|
||||
types=Arduino
|
||||
|
||||
|
@ -22,7 +22,8 @@ compiler.c.cmd=arm-none-eabi-gcc
|
||||
compiler.c.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -MMD
|
||||
compiler.c.elf.cmd=arm-none-eabi-gcc
|
||||
compiler.c.elf.flags=-Os -Wl,--gc-sections
|
||||
compiler.S.flags=-c -g -x assembler-with-cpp
|
||||
compiler.S.cmd=arm-none-eabi-gcc
|
||||
compiler.S.flags=-c -g -x assembler-with-cpp -mthumb
|
||||
compiler.cpp.cmd=arm-none-eabi-g++
|
||||
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD
|
||||
compiler.ar.cmd=arm-none-eabi-ar
|
||||
@ -42,6 +43,7 @@ build.extra_flags=
|
||||
compiler.c.extra_flags=
|
||||
compiler.c.elf.extra_flags=
|
||||
compiler.cpp.extra_flags=
|
||||
compiler.S.extra_flags=
|
||||
compiler.ar.extra_flags=
|
||||
compiler.elf2hex.extra_flags=
|
||||
|
||||
@ -66,6 +68,9 @@ recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={b
|
||||
## Compile c++ files
|
||||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
||||
|
||||
## Compile S files
|
||||
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
||||
|
||||
## Create archives
|
||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
|
||||
|
||||
|
Reference in New Issue
Block a user