├── .gitignore ├── Arduino └── hardware │ └── maple-asp │ ├── Maple │ ├── boards.txt │ ├── cores │ │ └── maple │ │ │ ├── Arduino.h │ │ │ ├── HardwareSPI.cpp │ │ │ ├── HardwareSerial.cpp │ │ │ ├── HardwareTimer.cpp │ │ │ ├── Print.cpp │ │ │ ├── WProgram.h │ │ │ ├── bits.h │ │ │ ├── boards_private.h │ │ │ ├── cxxabi-compat.cpp │ │ │ ├── ext_interrupts.cpp │ │ │ ├── main.cpp │ │ │ ├── pwm.cpp │ │ │ ├── rules.mk │ │ │ ├── stm32f1 │ │ │ ├── util_hooks.c │ │ │ ├── wirish_debug.cpp │ │ │ └── wirish_digital_f1.cpp │ │ │ ├── usb_serial.cpp │ │ │ ├── wirish │ │ │ ├── HardwareSPI.h │ │ │ ├── HardwareSerial.h │ │ │ ├── HardwareTimer.h │ │ │ ├── Print.h │ │ │ ├── bit_constants.h │ │ │ ├── boards.h │ │ │ ├── ext_interrupts.h │ │ │ ├── io.h │ │ │ ├── pwm.h │ │ │ ├── usb_serial.h │ │ │ ├── wirish.h │ │ │ ├── wirish_debug.h │ │ │ ├── wirish_math.h │ │ │ ├── wirish_time.h │ │ │ └── wirish_types.h │ │ │ ├── wirish_analog.cpp │ │ │ ├── wirish_digital.cpp │ │ │ ├── wirish_math.cpp │ │ │ ├── wirish_shift.cpp │ │ │ └── wirish_time.cpp │ ├── platform.txt │ ├── system │ │ ├── Makefile │ │ ├── build-targets.mk │ │ ├── libmaple │ │ │ ├── adc.c │ │ │ ├── dac.c │ │ │ ├── dma.c │ │ │ ├── dma_private.h │ │ │ ├── exc.S │ │ │ ├── exti.c │ │ │ ├── exti_private.h │ │ │ ├── flash.c │ │ │ ├── gpio.c │ │ │ ├── i2c.c │ │ │ ├── i2c_private.h │ │ │ ├── include │ │ │ │ └── libmaple │ │ │ │ │ ├── adc.h │ │ │ │ │ ├── bitband.h │ │ │ │ │ ├── bkp.h │ │ │ │ │ ├── dac.h │ │ │ │ │ ├── delay.h │ │ │ │ │ ├── dma.h │ │ │ │ │ ├── dma_common.h │ │ │ │ │ ├── exti.h │ │ │ │ │ ├── flash.h │ │ │ │ │ ├── fsmc.h │ │ │ │ │ ├── gpio.h │ │ │ │ │ ├── i2c.h │ │ │ │ │ ├── i2c_common.h │ │ │ │ │ ├── iwdg.h │ │ │ │ │ ├── libmaple.h │ │ │ │ │ ├── libmaple_types.h │ │ │ │ │ ├── nvic.h │ │ │ │ │ ├── pwr.h │ │ │ │ │ ├── rcc.h │ │ │ │ │ ├── ring_buffer.h │ │ │ │ │ ├── scb.h │ │ │ │ │ ├── spi.h │ │ │ │ │ ├── stm32.h │ │ │ │ │ ├── syscfg.h │ │ │ │ │ ├── systick.h │ │ │ │ │ ├── timer.h │ │ │ │ │ ├── usart.h │ │ │ │ │ ├── usb.h │ │ │ │ │ ├── usb_cdcacm.h │ │ │ │ │ └── util.h │ │ │ ├── iwdg.c │ │ │ ├── nvic.c │ │ │ ├── pwr.c │ │ │ ├── rcc.c │ │ │ ├── rcc_private.h │ │ │ ├── rules.mk │ │ │ ├── spi.c │ │ │ ├── spi_private.h │ │ │ ├── stm32_private.h │ │ │ ├── stm32f1 │ │ │ │ ├── adc.c │ │ │ │ ├── bkp.c │ │ │ │ ├── dma.c │ │ │ │ ├── exti.c │ │ │ │ ├── fsmc.c │ │ │ │ ├── gpio.c │ │ │ │ ├── i2c.c │ │ │ │ ├── include │ │ │ │ │ └── series │ │ │ │ │ │ ├── adc.h │ │ │ │ │ │ ├── dac.h │ │ │ │ │ │ ├── dma.h │ │ │ │ │ │ ├── exti.h │ │ │ │ │ │ ├── flash.h │ │ │ │ │ │ ├── gpio.h │ │ │ │ │ │ ├── i2c.h │ │ │ │ │ │ ├── nvic.h │ │ │ │ │ │ ├── pwr.h │ │ │ │ │ │ ├── rcc.h │ │ │ │ │ │ ├── spi.h │ │ │ │ │ │ ├── stm32.h │ │ │ │ │ │ ├── timer.h │ │ │ │ │ │ └── usart.h │ │ │ │ ├── performance │ │ │ │ │ ├── isrs.S │ │ │ │ │ └── vector_table.S │ │ │ │ ├── rcc.c │ │ │ │ ├── rules.mk │ │ │ │ ├── spi.c │ │ │ │ ├── timer.c │ │ │ │ ├── usart.c │ │ │ │ └── value │ │ │ │ │ ├── isrs.S │ │ │ │ │ └── vector_table.S │ │ │ ├── stm32f2 │ │ │ │ ├── adc.c │ │ │ │ ├── dma.c │ │ │ │ ├── exti.c │ │ │ │ ├── fsmc.c │ │ │ │ ├── gpio.c │ │ │ │ ├── include │ │ │ │ │ └── series │ │ │ │ │ │ ├── adc.h │ │ │ │ │ │ ├── dac.h │ │ │ │ │ │ ├── dma.h │ │ │ │ │ │ ├── exti.h │ │ │ │ │ │ ├── flash.h │ │ │ │ │ │ ├── gpio.h │ │ │ │ │ │ ├── nvic.h │ │ │ │ │ │ ├── pwr.h │ │ │ │ │ │ ├── rcc.h │ │ │ │ │ │ ├── spi.h │ │ │ │ │ │ ├── stm32.h │ │ │ │ │ │ ├── timer.h │ │ │ │ │ │ └── usart.h │ │ │ │ ├── isrs.S │ │ │ │ ├── rcc.c │ │ │ │ ├── rules.mk │ │ │ │ ├── spi.c │ │ │ │ ├── syscfg.c │ │ │ │ ├── timer.c │ │ │ │ ├── usart.c │ │ │ │ └── vector_table.S │ │ │ ├── systick.c │ │ │ ├── timer.c │ │ │ ├── timer_private.h │ │ │ ├── usart.c │ │ │ ├── usart_private.c │ │ │ ├── usart_private.h │ │ │ ├── usb │ │ │ │ ├── README │ │ │ │ ├── rules.mk │ │ │ │ ├── stm32f1 │ │ │ │ │ ├── usb.c │ │ │ │ │ ├── usb_cdcacm.c │ │ │ │ │ ├── usb_lib_globals.h │ │ │ │ │ ├── usb_reg_map.c │ │ │ │ │ └── usb_reg_map.h │ │ │ │ └── usb_lib │ │ │ │ │ ├── usb_core.c │ │ │ │ │ ├── usb_core.h │ │ │ │ │ ├── usb_def.h │ │ │ │ │ ├── usb_init.c │ │ │ │ │ ├── usb_init.h │ │ │ │ │ ├── usb_lib.h │ │ │ │ │ ├── usb_mem.c │ │ │ │ │ ├── usb_mem.h │ │ │ │ │ ├── usb_regs.c │ │ │ │ │ ├── usb_regs.h │ │ │ │ │ └── usb_type.h │ │ │ └── util.c │ │ └── support │ │ │ ├── doxygen │ │ │ ├── Doxyfile │ │ │ └── evil_mangler.awk │ │ │ ├── gdb │ │ │ ├── gpio │ │ │ │ └── gpio.gdb │ │ │ └── i2c │ │ │ │ └── test.gdb │ │ │ ├── ld │ │ │ ├── common.inc │ │ │ ├── flash.ld │ │ │ ├── jtag.ld │ │ │ ├── ram.ld │ │ │ ├── stm32 │ │ │ │ ├── mem │ │ │ │ │ ├── maple_native │ │ │ │ │ │ ├── maple_native_heap.inc │ │ │ │ │ │ ├── mem-flash.inc │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ │ ├── sram_112k_flash_1024k │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ │ ├── sram_20k_flash_128k │ │ │ │ │ │ ├── mem-flash.inc │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ │ ├── sram_20k_flash_128k_robotis │ │ │ │ │ │ ├── mem-flash.inc │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ │ ├── sram_64k_flash_512k │ │ │ │ │ │ ├── mem-flash.inc │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ │ └── sram_8k_flash_128k │ │ │ │ │ │ ├── mem-flash.inc │ │ │ │ │ │ ├── mem-jtag.inc │ │ │ │ │ │ └── mem-ram.inc │ │ │ │ └── series │ │ │ │ │ ├── stm32f1 │ │ │ │ │ ├── performance │ │ │ │ │ │ └── vector_symbols.inc │ │ │ │ │ └── value │ │ │ │ │ │ └── vector_symbols.inc │ │ │ │ │ └── stm32f2 │ │ │ │ │ └── vector_symbols.inc │ │ │ └── toolchains │ │ │ │ ├── gcc-arm-embedded │ │ │ │ └── extra_libs.inc │ │ │ │ └── generic │ │ │ │ └── extra_libs.inc │ │ │ ├── make │ │ │ ├── board-includes │ │ │ │ ├── VLDiscovery.mk │ │ │ │ ├── cm900.mk │ │ │ │ ├── maple.mk │ │ │ │ ├── maple_RET6.mk │ │ │ │ ├── maple_mini.mk │ │ │ │ ├── maple_native.mk │ │ │ │ ├── olimex_stm32_h103.mk │ │ │ │ ├── opencm904.mk │ │ │ │ └── st_stm3220g_eval.mk │ │ │ ├── build-rules.mk │ │ │ ├── build-templates.mk │ │ │ ├── footer.mk │ │ │ ├── header.mk │ │ │ └── target-config.mk │ │ │ ├── scripts │ │ │ ├── 45-maple.rules │ │ │ ├── copy-to-ide │ │ │ ├── reset.py │ │ │ ├── robotis-loader.py │ │ │ └── win-list-com-ports.py │ │ │ └── stm32loader.py │ └── variants │ │ ├── maple │ │ ├── board.cpp │ │ ├── board │ │ │ └── board.h │ │ ├── ld │ │ │ ├── common.inc │ │ │ ├── extra_libs.inc │ │ │ ├── flash.ld │ │ │ ├── jtag.ld │ │ │ ├── mem-flash.inc │ │ │ ├── mem-jtag.inc │ │ │ ├── mem-ram.inc │ │ │ ├── ram.ld │ │ │ └── vector_symbols.inc │ │ ├── libmaple │ │ │ ├── adc.c │ │ │ ├── adc_f1.c │ │ │ ├── bkp_f1.c │ │ │ ├── dac.c │ │ │ ├── dma.c │ │ │ ├── dma_f1.c │ │ │ ├── exc.S │ │ │ ├── exti.c │ │ │ ├── exti_f1.c │ │ │ ├── flash.c │ │ │ ├── fsmc_f1.c │ │ │ ├── gpio.c │ │ │ ├── gpio_f1.c │ │ │ ├── i2c.c │ │ │ ├── i2c_f1.c │ │ │ ├── iwdg.c │ │ │ ├── nvic.c │ │ │ ├── pwr.c │ │ │ ├── rcc.c │ │ │ ├── rcc_f1.c │ │ │ ├── spi.c │ │ │ ├── spi_f1.c │ │ │ ├── stm32f1 │ │ │ │ └── performance │ │ │ │ │ ├── isrs.S │ │ │ │ │ └── vector_table.S │ │ │ ├── systick.c │ │ │ ├── timer.c │ │ │ ├── timer_f1.c │ │ │ ├── usart.c │ │ │ ├── usart_f1.c │ │ │ ├── usart_private.c │ │ │ ├── usb │ │ │ │ ├── README │ │ │ │ ├── rules.mk │ │ │ │ ├── stm32f1 │ │ │ │ │ ├── usb.c │ │ │ │ │ ├── usb_cdcacm.c │ │ │ │ │ └── usb_reg_map.c │ │ │ │ └── usb_lib │ │ │ │ │ ├── usb_core.c │ │ │ │ │ ├── usb_init.c │ │ │ │ │ ├── usb_mem.c │ │ │ │ │ └── usb_regs.c │ │ │ └── util.c │ │ └── wirish │ │ │ ├── boards.cpp │ │ │ ├── boards_setup.cpp │ │ │ ├── start.S │ │ │ ├── start_c.c │ │ │ └── syscalls.c │ │ └── maple_mini │ │ ├── board.cpp │ │ ├── board │ │ └── board.h │ │ ├── ld │ │ ├── common.inc │ │ ├── extra_libs.inc │ │ ├── flash.ld │ │ ├── jtag.ld │ │ ├── mem-flash.inc │ │ ├── mem-jtag.inc │ │ ├── mem-ram.inc │ │ ├── ram.ld │ │ └── vector_symbols.inc │ │ ├── libmaple │ │ ├── adc.c │ │ ├── adc_f1.c │ │ ├── bkp_f1.c │ │ ├── dac.c │ │ ├── dma.c │ │ ├── dma_f1.c │ │ ├── exc.S │ │ ├── exti.c │ │ ├── exti_f1.c │ │ ├── flash.c │ │ ├── fsmc_f1.c │ │ ├── gpio.c │ │ ├── gpio_f1.c │ │ ├── i2c.c │ │ ├── i2c_f1.c │ │ ├── iwdg.c │ │ ├── nvic.c │ │ ├── pwr.c │ │ ├── rcc.c │ │ ├── rcc_f1.c │ │ ├── spi.c │ │ ├── spi_f1.c │ │ ├── stm32f1 │ │ │ └── performance │ │ │ │ ├── isrs.S │ │ │ │ └── vector_table.S │ │ ├── systick.c │ │ ├── timer.c │ │ ├── timer_f1.c │ │ ├── usart.c │ │ ├── usart_f1.c │ │ ├── usart_private.c │ │ ├── usb │ │ │ ├── README │ │ │ ├── rules.mk │ │ │ ├── stm32f1 │ │ │ │ ├── usb.c │ │ │ │ ├── usb_cdcacm.c │ │ │ │ └── usb_reg_map.c │ │ │ └── usb_lib │ │ │ │ ├── usb_core.c │ │ │ │ ├── usb_init.c │ │ │ │ ├── usb_mem.c │ │ │ │ └── usb_regs.c │ │ └── util.c │ │ └── wirish │ │ ├── boards.cpp │ │ ├── boards_setup.cpp │ │ ├── start.S │ │ ├── start_c.c │ │ └── syscalls.c │ ├── drivers │ └── win │ │ ├── maple-dfu │ │ ├── Maple_003.inf │ │ ├── amd64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ ├── ia64 │ │ │ ├── libusb0.dll │ │ │ └── libusb0.sys │ │ ├── installer_x64.exe │ │ ├── installer_x86.exe │ │ ├── license │ │ │ └── libusb0 │ │ │ │ └── installer_license.txt │ │ └── x86 │ │ │ ├── libusb0.sys │ │ │ └── libusb0_x86.dll │ │ └── serial │ │ ├── maple_serial.inf │ │ ├── msports.dll │ │ ├── serenum.sys │ │ └── usbser.sys │ └── tools │ └── win │ ├── cygiconv-2.dll │ ├── cygwin1.dll │ ├── dfu-util.exe │ ├── lib │ └── jssc.jar │ ├── libusb0.dll │ ├── maple_loader.jar │ └── maple_upload.bat ├── README.md └── installer └── maple_loader ├── build.xml ├── build ├── built-jar.properties └── classes │ ├── CliTemplate │ ├── CliMain.class │ ├── DFUUploader.class │ └── ExecCommand.class │ └── processing │ └── app │ ├── Base.class │ ├── Preferences.class │ ├── Serial.class │ ├── SerialException.class │ ├── debug │ ├── MessageConsumer.class │ ├── MessageSiphon.class │ └── RunnerException.class │ └── helpers │ └── ProcessUtils.class ├── dist ├── README.TXT ├── lib │ └── jssc.jar └── maple_loader.jar ├── manifest.mf ├── nbproject ├── build-impl.xml ├── genfiles.properties ├── private │ ├── config.properties │ ├── private.properties │ └── private.xml ├── project.properties └── project.xml └── src ├── CliTemplate ├── CliMain.java ├── DFUUploader.java └── ExecCommand.java └── processing └── app ├── Base.java ├── Preferences.java ├── Serial.java ├── SerialException.java ├── debug ├── MessageConsumer.java ├── MessageSiphon.java └── RunnerException.java └── helpers └── ProcessUtils.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/Arduino.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 LeafLabs LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _WIRISH_WPROGRAM_H_ 28 | #define _WIRISH_WPROGRAM_H_ 29 | 30 | #include 31 | 32 | void setup(); 33 | void loop(); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/WProgram.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 LeafLabs LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _WIRISH_WPROGRAM_H_ 28 | #define _WIRISH_WPROGRAM_H_ 29 | 30 | #include 31 | 32 | void setup(); 33 | void loop(); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/bits.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /* Note: Use of this header file is deprecated. Use bit_constants.h 28 | instead. */ 29 | 30 | #ifndef _WIRISH_BITS_H_ 31 | #define _WIRISH_BITS_H_ 32 | 33 | #include 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/boards_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file wirish/boards_private.h 29 | * @author Marti Bolivar 30 | * @brief Private board support header. 31 | * 32 | * This file declares chip-specific variables and functions which 33 | * determine how init() behaves. It is not part of the public Wirish 34 | * API, and can change without notice. 35 | */ 36 | 37 | #ifndef _WIRISH_BOARDS_PRIVATE_H_ 38 | #define _WIRISH_BOARDS_PRIVATE_H_ 39 | 40 | #include 41 | #include 42 | 43 | /* Makes the PIN_MAP rows more human-readable. */ 44 | #define PMAP_ROW(gpio_dev, gpio_bit, timer_dev, timer_ch, adc_dev, adc_ch) \ 45 | { gpio_dev, timer_dev, adc_dev, gpio_bit, timer_ch, adc_ch } 46 | 47 | namespace wirish { 48 | namespace priv { 49 | 50 | /* 51 | * Chip-specific initialization data 52 | */ 53 | 54 | extern rcc_pll_cfg w_board_pll_cfg; 55 | extern adc_prescaler w_adc_pre; 56 | extern adc_smp_rate w_adc_smp; 57 | 58 | /* 59 | * Chip-specific initialization routines and helper functions. 60 | */ 61 | 62 | void board_reset_pll(void); 63 | void board_setup_clock_prescalers(void); 64 | void board_setup_gpio(void); 65 | void board_setup_usb(void); 66 | void series_init(void); 67 | 68 | } 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/cxxabi-compat.cpp: -------------------------------------------------------------------------------- 1 | /* We compile with nodefaultlibs, so we need to provide an error 2 | * handler for an empty pure virtual function */ 3 | extern "C" void __cxa_pure_virtual(void) { 4 | while(1) 5 | ; 6 | } 7 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/main.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 LeafLabs LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | extern void setup(void); 28 | extern void loop(void); 29 | extern void init(void); 30 | 31 | // Force init to be called *first*, i.e. before static object allocation. 32 | // Otherwise, statically allocated objects that need libmaple may fail. 33 | __attribute__(( constructor )) void premain() { 34 | init(); 35 | } 36 | 37 | int main(void) { 38 | setup(); 39 | 40 | while (1) { 41 | loop(); 42 | } 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/pwm.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file wirish/pwm.cpp 30 | * @brief Wiring-style pwmWrite(). 31 | */ 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | void pwmWrite(uint8 pin, uint16 duty_cycle) { 41 | if (pin >= BOARD_NR_GPIO_PINS) { 42 | return; 43 | } 44 | timer_dev *dev = PIN_MAP[pin].timer_device; 45 | uint8 cc_channel = PIN_MAP[pin].timer_channel; 46 | ASSERT(dev && cc_channel); 47 | timer_set_compare(dev, cc_channel, duty_cycle); 48 | } 49 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Add board directory and MCU-specific directory to BUILDDIRS. These 8 | # are in subdirectories, but they're logically part of the Wirish 9 | # submodule. 10 | WIRISH_BOARD_PATH := boards/$(BOARD) 11 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(WIRISH_BOARD_PATH) 12 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(MCU_SERIES) 13 | 14 | # Safe includes for Wirish. 15 | WIRISH_INCLUDES := -I$(d)/include -I$(d)/$(WIRISH_BOARD_PATH)/include 16 | 17 | # Local flags. Add -I$(d) to allow for private includes. 18 | CFLAGS_$(d) := $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -I$(d) 19 | 20 | # Local rules and targets 21 | sSRCS_$(d) := start.S 22 | cSRCS_$(d) := start_c.c 23 | cSRCS_$(d) += syscalls.c 24 | cSRCS_$(d) += $(MCU_SERIES)/util_hooks.c 25 | cppSRCS_$(d) := boards.cpp 26 | cppSRCS_$(d) += cxxabi-compat.cpp 27 | cppSRCS_$(d) += ext_interrupts.cpp 28 | cppSRCS_$(d) += HardwareSerial.cpp 29 | cppSRCS_$(d) += HardwareTimer.cpp 30 | cppSRCS_$(d) += Print.cpp 31 | cppSRCS_$(d) += pwm.cpp 32 | ifeq ($(MCU_SERIES), stm32f1) 33 | cppSRCS_$(d) += usb_serial.cpp # HACK: this is currently STM32F1 only. 34 | cppSRCS_$(d) += HardwareSPI.cpp # FIXME: port to F2 and fix wirish.h 35 | endif 36 | cppSRCS_$(d) += wirish_analog.cpp 37 | cppSRCS_$(d) += wirish_digital.cpp 38 | cppSRCS_$(d) += wirish_math.cpp 39 | cppSRCS_$(d) += wirish_shift.cpp 40 | cppSRCS_$(d) += wirish_time.cpp 41 | cppSRCS_$(d) += $(MCU_SERIES)/boards_setup.cpp 42 | cppSRCS_$(d) += $(MCU_SERIES)/wirish_digital.cpp 43 | cppSRCS_$(d) += $(MCU_SERIES)/wirish_debug.cpp 44 | cppSRCS_$(d) += $(WIRISH_BOARD_PATH)/board.cpp 45 | 46 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 47 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 48 | cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%) 49 | 50 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 51 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \ 52 | $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o) 53 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 54 | 55 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 56 | 57 | TGT_BIN += $(OBJS_$(d)) 58 | 59 | # Standard things 60 | -include $(DEPS_$(d)) 61 | d := $(dirstack_$(sp)) 62 | sp := $(basename $(sp)) 63 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/stm32f1/wirish_debug.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file wirish/stm32f1/wirish_debug.cpp 29 | * @brief High level debug port configuration 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | void disableDebugPorts(void) { 36 | afio_cfg_debug_ports(AFIO_DEBUG_NONE); 37 | } 38 | 39 | void enableDebugPorts(void) { 40 | afio_cfg_debug_ports(AFIO_DEBUG_FULL_SWJ); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Print.h - Base class that provides print() and println() 3 | * Copyright (c) 2008 David A. Mellis. All right reserved. 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public License 7 | * as published by the Free Software Foundation; either version 2.1 of 8 | * the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | * 02110-1301 USA. 19 | * 20 | * Modified 12 April 2011 by Marti Bolivar 21 | */ 22 | 23 | #ifndef _WIRISH_PRINT_H_ 24 | #define _WIRISH_PRINT_H_ 25 | 26 | #include 27 | 28 | enum { 29 | BYTE = 0, 30 | BIN = 2, 31 | OCT = 8, 32 | DEC = 10, 33 | HEX = 16 34 | }; 35 | 36 | class Print { 37 | public: 38 | virtual void write(uint8 ch) = 0; 39 | virtual void write(const char *str); 40 | virtual void write(const void *buf, uint32 len); 41 | void print(char); 42 | void print(const char[]); 43 | void print(uint8, int=DEC); 44 | void print(int, int=DEC); 45 | void print(unsigned int, int=DEC); 46 | void print(long, int=DEC); 47 | void print(unsigned long, int=DEC); 48 | void print(long long, int=DEC); 49 | void print(unsigned long long, int=DEC); 50 | void print(double, int=2); 51 | void println(void); 52 | void println(char); 53 | void println(const char[]); 54 | void println(uint8, int=DEC); 55 | void println(int, int=DEC); 56 | void println(unsigned int, int=DEC); 57 | void println(long, int=DEC); 58 | void println(unsigned long, int=DEC); 59 | void println(long long, int=DEC); 60 | void println(unsigned long long, int=DEC); 61 | void println(double, int=2); 62 | private: 63 | void printNumber(unsigned long long, uint8); 64 | void printFloat(double, uint8); 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish/pwm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file wirish/include/wirish/pwm.h 29 | * @brief Wiring-style PWM interface. 30 | */ 31 | 32 | #ifndef _WIRISH_PWM_H_ 33 | #define _WIRISH_PWM_H_ 34 | 35 | #include 36 | 37 | /** 38 | * As a convenience, analogWrite is an alias of pwmWrite to ease 39 | * porting Arduino code. However, period and duty will have to be 40 | * recalibrated. 41 | */ 42 | #define analogWrite pwmWrite 43 | 44 | /** 45 | * Set the PWM duty on the given pin. 46 | * 47 | * User code is expected to determine and honor the maximum value 48 | * (based on the configured period). 49 | * 50 | * @param pin PWM output pin 51 | * @param duty_cycle Duty cycle to set. 52 | */ 53 | void pwmWrite(uint8 pin, uint16 duty_cycle); 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish/usb_serial.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @brief Wirish USB virtual serial port (SerialUSB). 29 | */ 30 | 31 | #ifndef _WIRISH_USB_SERIAL_H_ 32 | #define _WIRISH_USB_SERIAL_H_ 33 | 34 | #include 35 | #include 36 | 37 | /** 38 | * @brief Virtual serial terminal. 39 | */ 40 | class USBSerial : public Print { 41 | public: 42 | USBSerial(void); 43 | 44 | void begin(void); 45 | void end(void); 46 | 47 | uint32 available(void); 48 | 49 | uint32 read(void *buf, uint32 len); 50 | uint8 read(void); 51 | 52 | void write(uint8); 53 | void write(const char *str); 54 | void write(const void*, uint32); 55 | 56 | uint8 getRTS(); 57 | uint8 getDTR(); 58 | uint8 isConnected(); 59 | uint8 pending(); 60 | }; 61 | 62 | #if BOARD_HAVE_SERIALUSB 63 | extern USBSerial SerialUSB; 64 | #endif 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish/wirish_debug.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file wirish/include/wirish/wirish_debug.h 29 | * @brief High level debug port configuration 30 | */ 31 | 32 | #ifndef _WIRISH_WIRISH_DEBUG_H_ 33 | #define _WIRISH_WIRISH_DEBUG_H_ 34 | 35 | #include 36 | 37 | /** 38 | * @brief Disable the JTAG and Serial Wire (SW) debug ports. 39 | * 40 | * You can call this function in order to use the JTAG and SW debug 41 | * pins as ordinary GPIOs. 42 | * 43 | * @see enableDebugPorts() 44 | */ 45 | void disableDebugPorts(void); 46 | 47 | /** 48 | * @brief Enable the JTAG and Serial Wire (SW) debug ports. 49 | * 50 | * After you call this function, the JTAG and SW debug pins will no 51 | * longer be usable as GPIOs. 52 | * 53 | * @see disableDebugPorts() 54 | */ 55 | void enableDebugPorts(void); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish/wirish_types.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file wirish/include/wirish/wirish_types.h 29 | * @author Marti Bolivar 30 | * @brief Wirish library type definitions. 31 | */ 32 | 33 | #ifndef _WIRISH_WIRISH_TYPES_H_ 34 | #define _WIRISH_WIRISH_TYPES_H_ 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | /** 42 | * Invalid stm32_pin_info adc_channel value. 43 | * @see stm32_pin_info 44 | */ 45 | #define ADCx 0xFF 46 | 47 | /** 48 | * @brief Stores STM32-specific information related to a given Maple pin. 49 | * @see PIN_MAP 50 | */ 51 | typedef struct stm32_pin_info { 52 | gpio_dev *gpio_device; /**< Maple pin's GPIO device */ 53 | timer_dev *timer_device; /**< Pin's timer device, if any. */ 54 | const adc_dev *adc_device; /**< ADC device, if any. */ 55 | uint8 gpio_bit; /**< Pin's GPIO port bit. */ 56 | uint8 timer_channel; /**< Timer channel, or 0 if none. */ 57 | uint8 adc_channel; /**< Pin ADC channel, or ADCx if none. */ 58 | } stm32_pin_info; 59 | 60 | /** 61 | * Variable attribute, instructs the linker to place the marked 62 | * variable in Flash instead of RAM. */ 63 | #define __FLASH__ __attr_flash 64 | 65 | typedef uint8 boolean; 66 | typedef uint8 byte; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish_analog.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file wirish/wirish_analog.cpp 30 | * @brief Wiring-style analogRead() implementation. 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | /* Unlike Wiring and Arduino, this assumes that the pin's mode is set 38 | * to INPUT_ANALOG. That's faster, but it does require some extra work 39 | * on the user's part. Not too much, we think ;). */ 40 | uint16 analogRead(uint8 pin) { 41 | const adc_dev *dev = PIN_MAP[pin].adc_device; 42 | if (dev == NULL) { 43 | return 0; 44 | } 45 | 46 | return adc_read(dev, PIN_MAP[pin].adc_channel); 47 | } 48 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish_math.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Modified by LeafLabs, LLC. 3 | * 4 | * Part of the Wiring project - http://wiring.org.co Copyright (c) 5 | * 2004-06 Hernando Barragan Modified 13 August 2006, David A. Mellis 6 | * for Arduino - http://www.arduino.cc/ 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public License 10 | * as published by the Free Software Foundation; either version 2.1 of 11 | * the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 21 | * USA 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | void randomSeed(unsigned int seed) { 28 | if (seed != 0) { 29 | srand(seed); 30 | } 31 | } 32 | 33 | long random(long howbig) { 34 | if (howbig == 0) { 35 | return 0; 36 | } 37 | 38 | return rand() % howbig; 39 | } 40 | 41 | long random(long howsmall, long howbig) { 42 | if (howsmall >= howbig) { 43 | return howsmall; 44 | } 45 | 46 | long diff = howbig - howsmall; 47 | return random(diff) + howsmall; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish_shift.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #include 28 | 29 | void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, uint8 value) { 30 | digitalWrite(clockPin, LOW); 31 | for (int i = 0; i < 8; i++) { 32 | int bit = bitOrder == LSBFIRST ? i : (7 - i); 33 | digitalWrite(dataPin, (value >> bit) & 0x1); 34 | togglePin(clockPin); 35 | togglePin(clockPin); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/cores/maple/wirish_time.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @brief Delay implementation. 29 | */ 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | void delay(unsigned long ms) { 37 | uint32 i; 38 | for (i = 0; i < ms; i++) { 39 | delayMicroseconds(1000); 40 | } 41 | } 42 | 43 | void delayMicroseconds(uint32 us) { 44 | delay_us(us); 45 | } 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/build-targets.mk: -------------------------------------------------------------------------------- 1 | # main project target 2 | $(BUILD_PATH)/main.o: $(SRCROOT)/main.cpp 3 | $(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $< 4 | 5 | $(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN) 6 | - rm -f $@ 7 | $(AR) crv $(BUILD_PATH)/libmaple.a $(TGT_BIN) 8 | 9 | library: $(BUILD_PATH)/libmaple.a 10 | 11 | .PHONY: library 12 | 13 | $(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(BUILD_PATH)/main.o 14 | $(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o -Wl,-Map,$(BUILD_PATH)/$(BOARD).map 15 | 16 | $(BUILD_PATH)/$(BOARD).bin: $(BUILD_PATH)/$(BOARD).elf 17 | $(SILENT_OBJCOPY) $(OBJCOPY) -v -Obinary $(BUILD_PATH)/$(BOARD).elf $@ 1>/dev/null 18 | $(SILENT_DISAS) $(DISAS) -d $(BUILD_PATH)/$(BOARD).elf > $(BUILD_PATH)/$(BOARD).disas 19 | @echo " " 20 | @echo "Object file sizes:" 21 | @find $(BUILD_PATH) -iname *.o | xargs $(SIZE) -t > $(BUILD_PATH)/$(BOARD).sizes 22 | @cat $(BUILD_PATH)/$(BOARD).sizes 23 | @echo " " 24 | @echo "Final Size:" 25 | @$(SIZE) $< 26 | @echo $(MEMORY_TARGET) > $(BUILD_PATH)/build-type 27 | 28 | $(BUILDDIRS): 29 | @mkdir -p $@ 30 | 31 | MSG_INFO: 32 | @echo "================================================================================" 33 | @echo "" 34 | @echo " Build info:" 35 | @echo " BOARD: " $(BOARD) 36 | @echo " MCU: " $(MCU) 37 | @echo " MEMORY_TARGET: " $(MEMORY_TARGET) 38 | @echo "" 39 | @echo " See 'make help' for all possible targets" 40 | @echo "" 41 | @echo "================================================================================" 42 | @echo "" 43 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/dma_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _LIBMAPLE_DMA_PRIVATE_H_ 28 | #define _LIBMAPLE_DMA_PRIVATE_H_ 29 | 30 | #include 31 | #include 32 | 33 | /* 34 | * IRQ handling 35 | */ 36 | 37 | /* Wrap this in an ifdef to shut up GCC. (We provide DMA_GET_HANDLER 38 | * in the series support files, which need dma_irq_handler().) */ 39 | #ifdef DMA_GET_HANDLER 40 | static __always_inline void dma_irq_handler(dma_dev *dev, dma_tube tube) { 41 | dma_clear_isr_bits(dev, tube); /* in case handler doesn't */ 42 | void (*handler)(void) = DMA_GET_HANDLER(dev, tube); 43 | if (handler) { 44 | handler(); 45 | } 46 | } 47 | #endif 48 | 49 | /* 50 | * Conveniences for dealing with tube sources/destinations 51 | */ 52 | 53 | enum dma_atype { 54 | DMA_ATYPE_MEM, 55 | DMA_ATYPE_PER, 56 | DMA_ATYPE_OTHER, 57 | }; 58 | 59 | enum dma_atype _dma_addr_type(__io void *addr); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/exti_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _LIBMAPLE_EXTI_PRIVATE_H_ 28 | #define _LIBMAPLE_EXTI_PRIVATE_H_ 29 | 30 | #include 31 | 32 | void exti_do_select(__io uint32 *exti_cr, exti_num num, exti_cfg port); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/flash.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/flash.c 30 | * @brief Flash management functions 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * @brief Set flash wait states 38 | * 39 | * Note that not all wait states are available on every MCU. See the 40 | * Flash programming manual for your MCU for restrictions on the 41 | * allowed value of wait_states for a given system clock (SYSCLK) 42 | * frequency. 43 | * 44 | * @param wait_states number of wait states (one of 45 | * FLASH_WAIT_STATE_0, FLASH_WAIT_STATE_1, 46 | * ..., FLASH_WAIT_STATE_7). 47 | */ 48 | void flash_set_latency(uint32 wait_states) { 49 | uint32 val = FLASH_BASE->ACR; 50 | 51 | val &= ~FLASH_ACR_LATENCY; 52 | val |= wait_states; 53 | 54 | FLASH_BASE->ACR = val; 55 | } 56 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/gpio.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/gpio.c 30 | * @brief Generic STM32 GPIO support. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /* 37 | * GPIO routines 38 | */ 39 | 40 | /** 41 | * Initialize a GPIO device. 42 | * 43 | * Enables the clock for and resets the given device. 44 | * 45 | * @param dev GPIO device to initialize. 46 | */ 47 | void gpio_init(gpio_dev *dev) { 48 | rcc_clk_enable(dev->clk_id); 49 | rcc_reset_dev(dev->clk_id); 50 | } 51 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/include/libmaple/delay.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/include/libmaple/delay.h 30 | * @brief Delay implementation 31 | */ 32 | 33 | #ifndef _LIBMAPLE_DELAY_H_ 34 | #define _LIBMAPLE_DELAY_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #include 41 | #include 42 | 43 | /** 44 | * @brief Delay the given number of microseconds. 45 | * 46 | * @param us Number of microseconds to delay. 47 | */ 48 | static inline void delay_us(uint32 us) { 49 | us *= STM32_DELAY_US_MULT; 50 | 51 | /* fudge for function call overhead */ 52 | us--; 53 | asm volatile(" mov r0, %[us] \n\t" 54 | "1: subs r0, #1 \n\t" 55 | " bhi 1b \n\t" 56 | : 57 | : [us] "r" (us) 58 | : "r0"); 59 | } 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/include/libmaple/libmaple.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/include/libmaple/libmaple.h 29 | * @brief General include file for libmaple 30 | */ 31 | 32 | #ifndef _LIBMAPLE_LIBMAPLE_H_ 33 | #define _LIBMAPLE_LIBMAPLE_H_ 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/include/libmaple/libmaple_types.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/include/libmaple/libmaple_types.h 29 | * 30 | * @brief libmaple's types, and operations on types. 31 | */ 32 | 33 | #ifndef _LIBMAPLE_LIBMAPLE_TYPES_H_ 34 | #define _LIBMAPLE_LIBMAPLE_TYPES_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | typedef unsigned char uint8; 41 | typedef unsigned short uint16; 42 | typedef unsigned int uint32; 43 | typedef unsigned long long uint64; 44 | 45 | typedef signed char int8; 46 | typedef short int16; 47 | typedef int int32; 48 | typedef long long int64; 49 | 50 | typedef void (*voidFuncPtr)(void); 51 | typedef void (*voidArgumentFuncPtr)(void *); 52 | 53 | #define __io volatile 54 | #define __attr_flash __attribute__((section (".USER_FLASH"))) 55 | #define __packed __attribute__((__packed__)) 56 | #define __deprecated __attribute__((__deprecated__)) 57 | #define __weak __attribute__((weak)) 58 | #define __always_inline inline __attribute__((always_inline)) 59 | #define __unused __attribute__((unused)) 60 | 61 | #ifndef NULL 62 | #define NULL 0 63 | #endif 64 | 65 | #ifndef offsetof 66 | #define offsetof(type, member) __builtin_offsetof(type, member) 67 | #endif 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/iwdg.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Michael Hope. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/iwdg.c 29 | * @brief Independent watchdog (IWDG) support 30 | */ 31 | 32 | #include 33 | 34 | /** 35 | * @brief Initialise and start the watchdog 36 | * 37 | * The prescaler and reload set the timeout. For example, a prescaler 38 | * of IWDG_PRE_32 divides the 40 kHz clock by 32 and gives roughly 1 39 | * ms per reload. 40 | * 41 | * @param prescaler Prescaler for the 40 kHz IWDG clock. 42 | * @param reload Independent watchdog counter reload value. 43 | */ 44 | void iwdg_init(iwdg_prescaler prescaler, uint16 reload) { 45 | IWDG_BASE->KR = IWDG_KR_UNLOCK; 46 | IWDG_BASE->PR = prescaler; 47 | IWDG_BASE->RLR = reload; 48 | 49 | /* Start things off */ 50 | IWDG_BASE->KR = IWDG_KR_START; 51 | iwdg_feed(); 52 | } 53 | 54 | /** 55 | * @brief Reset the IWDG counter. 56 | * 57 | * Calling this function will cause the IWDG counter to be reset to 58 | * its reload value. 59 | */ 60 | void iwdg_feed(void) { 61 | IWDG_BASE->KR = IWDG_KR_FEED; 62 | } 63 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/pwr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/pwr.c 29 | * @brief Power control (PWR) support. 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | /** 36 | * Enables the power interface clock, and resets the power device. 37 | */ 38 | void pwr_init(void) { 39 | rcc_clk_enable(RCC_PWR); 40 | rcc_reset_dev(RCC_PWR); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/rcc_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /* 28 | * RCC private header. 29 | */ 30 | 31 | #ifndef _LIBMAPLE_PRIVATE_RCC_H_ 32 | #define _LIBMAPLE_PRIVATE_RCC_H_ 33 | 34 | #include 35 | 36 | struct rcc_dev_info { 37 | const rcc_clk_domain clk_domain; 38 | const uint8 line_num; 39 | }; 40 | 41 | extern const struct rcc_dev_info rcc_dev_table[]; 42 | 43 | static inline void rcc_do_clk_enable(__io uint32** enable_regs, 44 | rcc_clk_id id) { 45 | __io uint32 *enable_reg = enable_regs[rcc_dev_clk(id)]; 46 | uint8 line_num = rcc_dev_table[id].line_num; 47 | bb_peri_set_bit(enable_reg, line_num, 1); 48 | } 49 | 50 | static inline void rcc_do_reset_dev(__io uint32** reset_regs, 51 | rcc_clk_id id) { 52 | __io uint32 *reset_reg = reset_regs[rcc_dev_clk(id)]; 53 | uint8 line_num = rcc_dev_table[id].line_num; 54 | bb_peri_set_bit(reset_reg, line_num, 1); 55 | bb_peri_set_bit(reset_reg, line_num, 0); 56 | } 57 | 58 | static inline void rcc_do_set_prescaler(const uint32 *masks, 59 | rcc_prescaler prescaler, 60 | uint32 divider) { 61 | uint32 cfgr = RCC_BASE->CFGR; 62 | cfgr &= ~masks[prescaler]; 63 | cfgr |= divider; 64 | RCC_BASE->CFGR = cfgr; 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH)/include -I$(LIBMAPLE_MODULE_SERIES)/include 8 | LIBMAPLE_PRIVATE_INCLUDES := -I$(LIBMAPLE_PATH) 9 | 10 | # Local flags 11 | CFLAGS_$(d) = $(LIBMAPLE_PRIVATE_INCLUDES) $(LIBMAPLE_INCLUDES) -Wall -Werror 12 | 13 | # Local rules and targets 14 | cSRCS_$(d) := adc.c 15 | cSRCS_$(d) += dac.c 16 | cSRCS_$(d) += dma.c 17 | cSRCS_$(d) += exti.c 18 | cSRCS_$(d) += flash.c 19 | cSRCS_$(d) += gpio.c 20 | cSRCS_$(d) += iwdg.c 21 | cSRCS_$(d) += nvic.c 22 | cSRCS_$(d) += pwr.c 23 | cSRCS_$(d) += rcc.c 24 | cSRCS_$(d) += spi.c 25 | cSRCS_$(d) += systick.c 26 | cSRCS_$(d) += timer.c 27 | cSRCS_$(d) += usart.c 28 | cSRCS_$(d) += usart_private.c 29 | cSRCS_$(d) += util.c 30 | sSRCS_$(d) := exc.S 31 | # I2C support must be ported to F2: 32 | ifeq ($(MCU_SERIES),stm32f1) 33 | cSRCS_$(d) += i2c.c 34 | endif 35 | 36 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 37 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 38 | 39 | OBJS_$(d) := $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) 40 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 41 | 42 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 43 | $(OBJS_$(d)): TGT_ASFLAGS := 44 | 45 | TGT_BIN += $(OBJS_$(d)) 46 | 47 | # Standard things 48 | -include $(DEPS_$(d)) 49 | d := $(dirstack_$(sp)) 50 | sp := $(basename $(sp)) 51 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/spi_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _LIBMAPLE_SPI_PRIVATE_H_ 28 | #define _LIBMAPLE_SPI_PRIVATE_H_ 29 | 30 | #define SPI_DEV(num) \ 31 | { \ 32 | .regs = SPI##num##_BASE, \ 33 | .clk_id = RCC_SPI##num, \ 34 | .irq_num = NVIC_SPI##num, \ 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _LIBMAPLE_STM32_PRIVATE_H_ 28 | #define _LIBMAPLE_STM32_PRIVATE_H_ 29 | 30 | typedef enum stm32_mem_block_purpose { 31 | STM32_BLOCK_CODE, 32 | STM32_BLOCK_SRAM, 33 | STM32_BLOCK_PERIPH, 34 | STM32_BLOCK_FSMC_1_2, 35 | STM32_BLOCK_FSMC_3_4, 36 | STM32_BLOCK_FSMC_REG, 37 | STM32_BLOCK_UNUSED, 38 | STM32_BLOCK_CORTEX_INTERNAL, 39 | } stm32_mem_block_purpose; 40 | 41 | static inline stm32_mem_block_purpose stm32_block_purpose(void *addr) { 42 | return (stm32_mem_block_purpose)((unsigned)addr >> 29); 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f1/exti.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #include 28 | #include "exti_private.h" 29 | 30 | void exti_select(exti_num num, exti_cfg port) { 31 | exti_do_select(&AFIO_BASE->EXTICR1 + num / 4, num, port); 32 | } 33 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f1/include/series/exti.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f1/include/series/exti.h 29 | * @brief STM32F1 external interrupts 30 | */ 31 | 32 | #ifndef _LIBMAPLE_STM32F1_EXTI_H_ 33 | #define _LIBMAPLE_STM32F1_EXTI_H_ 34 | 35 | #ifdef __cpluspus 36 | extern "C" { 37 | #endif 38 | 39 | struct exti_reg_map; 40 | #define EXTI_BASE ((struct exti_reg_map*)0x40010400) 41 | 42 | #ifdef __cpluspus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f1/include/series/pwr.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f1/include/series/pwr.h 29 | * @author Marti Bolivar 30 | * @brief STM32F1 Power control (PWR) support. 31 | */ 32 | 33 | #ifndef _LIBMAPLE_STM32F1_PWR_H_ 34 | #define _LIBMAPLE_STM32F1_PWR_H_ 35 | 36 | /* 37 | * Register bit definitions 38 | */ 39 | 40 | /* Control register */ 41 | 42 | /* PVD level selection */ 43 | #define PWR_CR_PLS_2_2V (0x0 << 5) 44 | #define PWR_CR_PLS_2_3V (0x1 << 5) 45 | #define PWR_CR_PLS_2_4V (0x2 << 5) 46 | #define PWR_CR_PLS_2_5V (0x3 << 5) 47 | #define PWR_CR_PLS_2_6V (0x4 << 5) 48 | #define PWR_CR_PLS_2_7V (0x5 << 5) 49 | #define PWR_CR_PLS_2_8V (0x6 << 5) 50 | #define PWR_CR_PLS_2_9V (0x7 << 5) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f1/include/series/usart.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f1/include/series/usart.h 29 | * @author Marti Bolivar 30 | * @brief STM32F1 USART support. 31 | */ 32 | 33 | #ifndef _LIBMAPLE_STM32F1_USART_H_ 34 | #define _LIBMAPLE_STM32F1_USART_H_ 35 | 36 | #ifdef __cplusplus 37 | extern "C"{ 38 | #endif 39 | 40 | /* 41 | * Register map base pointers 42 | */ 43 | 44 | struct usart_reg_map; 45 | 46 | /** USART1 register map base pointer */ 47 | #define USART1_BASE ((struct usart_reg_map*)0x40013800) 48 | /** USART2 register map base pointer */ 49 | #define USART2_BASE ((struct usart_reg_map*)0x40004400) 50 | /** USART3 register map base pointer */ 51 | #define USART3_BASE ((struct usart_reg_map*)0x40004800) 52 | #ifdef STM32_HIGH_DENSITY 53 | /** UART4 register map base pointer */ 54 | #define UART4_BASE ((struct usart_reg_map*)0x40004C00) 55 | /** UART5 register map base pointer */ 56 | #define UART5_BASE ((struct usart_reg_map*)0x40005000) 57 | #endif 58 | 59 | /* 60 | * Devices 61 | */ 62 | 63 | struct usart_dev; 64 | extern struct usart_dev *USART1; 65 | extern struct usart_dev *USART2; 66 | extern struct usart_dev *USART3; 67 | #ifdef STM32_HIGH_DENSITY 68 | extern struct usart_dev *UART4; 69 | extern struct usart_dev *UART5; 70 | #endif 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f1/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Local flags 8 | CFLAGS_$(d) = -I$(d) $(LIBMAPLE_PRIVATE_INCLUDES) $(LIBMAPLE_INCLUDES) -Wall -Werror 9 | ASFLAGS_$(d) = -I$(d) $(LIBMAPLE_PRIVATE_INCLUDES) $(LIBMAPLE_INCLUDES) -Wall -Werror 10 | 11 | # Extra BUILDDIRS 12 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(MCU_F1_LINE) 13 | 14 | # Local rules and targets 15 | sSRCS_$(d) := $(MCU_F1_LINE)/isrs.S 16 | sSRCS_$(d) += $(MCU_F1_LINE)/vector_table.S 17 | 18 | cSRCS_$(d) := adc.c 19 | cSRCS_$(d) += bkp.c 20 | cSRCS_$(d) += dma.c 21 | cSRCS_$(d) += exti.c 22 | cSRCS_$(d) += fsmc.c 23 | cSRCS_$(d) += gpio.c 24 | cSRCS_$(d) += i2c.c 25 | cSRCS_$(d) += rcc.c 26 | cSRCS_$(d) += spi.c 27 | cSRCS_$(d) += timer.c 28 | cSRCS_$(d) += usart.c 29 | 30 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 31 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 32 | 33 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 34 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) 35 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 36 | 37 | $(OBJS_$(d)): TGT_ASFLAGS := $(ASFLAGS_$(d)) 38 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 39 | 40 | TGT_BIN += $(OBJS_$(d)) 41 | 42 | # Standard things 43 | -include $(DEPS_$(d)) 44 | d := $(dirstack_$(sp)) 45 | sp := $(basename $(sp)) 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/adc.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f2/adc.c 29 | * @brief STM32F2 ADC. 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | /* 36 | * Devices 37 | */ 38 | 39 | static adc_dev adc1 = { 40 | .regs = ADC1_BASE, 41 | .clk_id = RCC_ADC1, 42 | }; 43 | /** ADC1 device. */ 44 | const adc_dev *ADC1 = &adc1; 45 | 46 | static adc_dev adc2 = { 47 | .regs = ADC2_BASE, 48 | .clk_id = RCC_ADC2, 49 | }; 50 | /** ADC2 device. */ 51 | const adc_dev *ADC2 = &adc2; 52 | 53 | static adc_dev adc3 = { 54 | .regs = ADC3_BASE, 55 | .clk_id = RCC_ADC3, 56 | }; 57 | /** ADC3 device. */ 58 | const adc_dev *ADC3 = &adc3; 59 | 60 | /* 61 | * Common routines 62 | */ 63 | 64 | void adc_set_prescaler(adc_prescaler pre) { 65 | uint32 ccr = ADC_COMMON_BASE->CCR; 66 | ccr &= ~ADC_CCR_ADCPRE; 67 | ccr |= (uint32)pre; 68 | ADC_COMMON_BASE->CCR = ccr; 69 | } 70 | 71 | void adc_foreach(void (*fn)(const adc_dev*)) { 72 | fn(ADC1); 73 | fn(ADC2); 74 | fn(ADC3); 75 | } 76 | 77 | void adc_config_gpio(const adc_dev *ignored, gpio_dev *gdev, uint8 bit) { 78 | gpio_set_modef(gdev, bit, GPIO_MODE_ANALOG, GPIO_MODEF_PUPD_NONE); 79 | } 80 | 81 | void adc_enable_single_swstart(const adc_dev *dev) { 82 | adc_init(dev); 83 | adc_enable(dev); 84 | } 85 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/exti.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include "exti_private.h" 30 | 31 | void exti_select(exti_num num, exti_cfg cfg) { 32 | exti_do_select(&SYSCFG_BASE->EXTICR[num / 4], num, cfg); 33 | } 34 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/include/series/exti.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f1/include/series/exti.h 29 | * @brief STM32F2 external interrupts 30 | */ 31 | 32 | #ifndef _LIBMAPLE_STM32F2_EXTI_H_ 33 | #define _LIBMAPLE_STM32F2_EXTI_H_ 34 | 35 | #ifdef __cpluspus 36 | extern "C" { 37 | #endif 38 | 39 | struct exti_reg_map; 40 | #define EXTI_BASE ((struct exti_reg_map*)0x40013C00) 41 | 42 | #ifdef __cpluspus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/include/series/spi.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f2/include/series/spi.h 29 | * @author Marti Bolivar 30 | * @brief STM32F2 SPI/I2S series header. 31 | */ 32 | 33 | #ifndef _LIBMAPLE_STM32F2_SPI_H_ 34 | #define _LIBMAPLE_STM32F2_SPI_H_ 35 | 36 | #include /* for gpio_af */ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* 43 | * Register map base pointers 44 | */ 45 | 46 | struct spi_reg_map; 47 | 48 | #define SPI1_BASE ((struct spi_reg_map*)0x40013000) 49 | #define SPI2_BASE ((struct spi_reg_map*)0x40003800) 50 | #define SPI3_BASE ((struct spi_reg_map*)0x40003C00) 51 | 52 | /* 53 | * Register bit definitions 54 | */ 55 | 56 | /* Control register 2 */ 57 | 58 | #define SPI_CR2_FRF_BIT 4 59 | 60 | #define SPI_CR2_FRF (1U << SPI_CR2_FRF_BIT) 61 | 62 | /* Status register */ 63 | 64 | #define SPI_SR_TIFRFE_BIT 8 65 | 66 | #define SPI_SR_TIFRFE (1U << SPI_SR_TIFRFE_BIT) 67 | 68 | /* 69 | * Device pointers 70 | */ 71 | 72 | struct spi_dev; 73 | 74 | extern struct spi_dev *SPI1; 75 | extern struct spi_dev *SPI2; 76 | extern struct spi_dev *SPI3; 77 | 78 | /* 79 | * Routines 80 | */ 81 | 82 | gpio_af spi_get_af(struct spi_dev *dev); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/include/series/stm32.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f2/include/series/stm32.h 29 | * @brief STM32F2 chip- and series-specific definitions. 30 | */ 31 | 32 | #ifndef _LIBMAPLE_STM32F2_STM32_H_ 33 | #define _LIBMAPLE_STM32F2_STM32_H_ 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* 40 | * Chip configuration 41 | */ 42 | 43 | #ifndef STM32_PCLK1 44 | #define STM32_PCLK1 30000000U 45 | #endif 46 | 47 | #ifndef STM32_PCLK2 48 | #define STM32_PCLK2 60000000U 49 | #endif 50 | 51 | #ifndef STM32_DELAY_US_MULT 52 | #define STM32_DELAY_US_MULT 20 /* FIXME: dummy value. */ 53 | #endif 54 | 55 | /* 56 | * Series- and MCU-specific values 57 | */ 58 | 59 | #define STM32_MCU_SERIES STM32_SERIES_F2 60 | #define STM32_NR_INTERRUPTS 81 61 | #define STM32_HAVE_FSMC 1 62 | #define STM32_HAVE_USB 1 63 | #define STM32_HAVE_DAC 1 64 | 65 | #if defined(MCU_STM32F207IC) || defined(MCU_STM32F207IG) 66 | # define STM32_NR_GPIO_PORTS 9 67 | # define STM32_TIMER_MASK 0x7FFE /* TIMER1-TIMER14. */ 68 | # define STM32_SRAM_END ((void*)0x20020000) 69 | #else 70 | #warning "Unsupported or unspecified STM32F2 MCU." 71 | #endif 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Local flags 8 | CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) $(LIBMAPLE_PRIVATE_INCLUDES) -Wall -Werror 9 | 10 | # Local rules and targets 11 | sSRCS_$(d) := isrs.S 12 | sSRCS_$(d) += vector_table.S 13 | 14 | cSRCS_$(d) := adc.c 15 | cSRCS_$(d) += dma.c 16 | cSRCS_$(d) += exti.c 17 | cSRCS_$(d) += fsmc.c 18 | cSRCS_$(d) += gpio.c 19 | cSRCS_$(d) += rcc.c 20 | cSRCS_$(d) += spi.c 21 | cSRCS_$(d) += syscfg.c 22 | cSRCS_$(d) += timer.c 23 | cSRCS_$(d) += usart.c 24 | 25 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 26 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 27 | 28 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 29 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) 30 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 31 | 32 | $(OBJS_$(d)): TGT_ASFLAGS := 33 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 34 | 35 | TGT_BIN += $(OBJS_$(d)) 36 | 37 | # Standard things 38 | -include $(DEPS_$(d)) 39 | d := $(dirstack_$(sp)) 40 | sp := $(basename $(sp)) 41 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/stm32f2/syscfg.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/stm32f2/syscfg.c 29 | * @brief SYSCFG routines. 30 | */ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | /** 37 | * @brief Initialize the SYSCFG peripheral. 38 | */ 39 | void syscfg_init(void) { 40 | rcc_clk_enable(RCC_SYSCFG); 41 | rcc_reset_dev(RCC_SYSCFG); 42 | } 43 | 44 | /** 45 | * @brief Turn on the I/O compensation cell. 46 | * 47 | * It's only safe to do this when the supply voltage is between 2.4 V 48 | * and 3.6 V. 49 | */ 50 | void syscfg_enable_io_compensation(void) { 51 | bb_peri_set_bit(&SYSCFG_BASE->CMPCR, SYSCFG_CMPCR_CMP_PD_BIT, 1); 52 | while (!(SYSCFG_BASE->CMPCR & SYSCFG_CMPCR_READY)) 53 | ; 54 | } 55 | 56 | /** 57 | * @brief Turn off the I/O compensation cell. 58 | */ 59 | void syscfg_disable_io_compensation(void) { 60 | bb_peri_set_bit(&SYSCFG_BASE->CMPCR, SYSCFG_CMPCR_CMP_PD_BIT, 0); 61 | } 62 | 63 | /** 64 | * @brief Set the memory to be mapped at address 0x00000000. 65 | * 66 | * This function can be used to override the BOOT pin 67 | * configuration. Some restrictions apply; see your chip's reference 68 | * manual for the details. 69 | * 70 | * @param mode Mode to set 71 | * @see syscfg_mem_mode 72 | */ 73 | void syscfg_set_mem_mode(syscfg_mem_mode mode) { 74 | uint32 memrmp = SYSCFG_BASE->MEMRMP; 75 | memrmp &= ~SYSCFG_MEMRMP_MEM_MODE; 76 | memrmp |= (uint32)mode; 77 | SYSCFG_BASE->MEMRMP = memrmp; 78 | } 79 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usart_private.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/usart_private.c 29 | * @author Marti Bolivar 30 | * @brief Private USART routines. 31 | */ 32 | 33 | #include "usart_private.h" 34 | #include 35 | #include 36 | 37 | uint32 _usart_clock_freq(usart_dev *dev) { 38 | rcc_clk_domain domain = rcc_dev_clk(dev->clk_id); 39 | return (domain == RCC_APB1 ? STM32_PCLK1 : 40 | (domain == RCC_APB2 ? STM32_PCLK2 : 0)); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usart_private.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * Copyright (c) 2010 Perry Hung. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/usart_private.h 30 | * @author Marti Bolivar 31 | * @brief Private USART header. 32 | */ 33 | 34 | #ifndef _LIBMAPLE_USART_PRIVATE_H_ 35 | #define _LIBMAPLE_USART_PRIVATE_H_ 36 | 37 | #include 38 | #include 39 | 40 | static __always_inline void usart_irq(ring_buffer *rb, usart_reg_map *regs) { 41 | #ifdef USART_SAFE_INSERT 42 | /* If the buffer is full and the user defines USART_SAFE_INSERT, 43 | * ignore new bytes. */ 44 | rb_safe_insert(rb, (uint8)regs->DR); 45 | #else 46 | /* By default, push bytes around in the ring buffer. */ 47 | rb_push_insert(rb, (uint8)regs->DR); 48 | #endif 49 | } 50 | 51 | uint32 _usart_clock_freq(usart_dev *dev); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usb/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Local flags 8 | CFLAGS_$(d) = -I$(d) -I$(d)/$(MCU_SERIES) -I$(d)/usb_lib $(LIBMAPLE_INCLUDES) $(LIBMAPLE_PRIVATE_INCLUDES) -Wall 9 | 10 | # Add usblib and series subdirectory to BUILDDIRS. 11 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(MCU_SERIES) 12 | BUILDDIRS += $(BUILD_PATH)/$(d)/usb_lib 13 | 14 | # Local rules and targets 15 | sSRCS_$(d) := 16 | cSRCS_$(d) := 17 | # We currently only have F1 performance line support. Sigh. 18 | ifeq ($(MCU_SERIES), stm32f1) 19 | ifeq ($(MCU_F1_LINE), performance) 20 | cSRCS_$(d) += $(MCU_SERIES)/usb.c 21 | cSRCS_$(d) += $(MCU_SERIES)/usb_reg_map.c 22 | cSRCS_$(d) += $(MCU_SERIES)/usb_cdcacm.c 23 | cSRCS_$(d) += usb_lib/usb_core.c 24 | cSRCS_$(d) += usb_lib/usb_init.c 25 | cSRCS_$(d) += usb_lib/usb_mem.c 26 | cSRCS_$(d) += usb_lib/usb_regs.c 27 | endif 28 | endif 29 | 30 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 31 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 32 | 33 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 34 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) 35 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 36 | 37 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 38 | $(OBJS_$(d)): TGT_ASFLAGS := 39 | 40 | TGT_BIN += $(OBJS_$(d)) 41 | 42 | # Standard things 43 | -include $(DEPS_$(d)) 44 | d := $(dirstack_$(sp)) 45 | sp := $(basename $(sp)) 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usb/stm32f1/usb_lib_globals.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #ifndef _USB_LIB_GLOBALS_H_ 28 | #define _USB_LIB_GLOBALS_H_ 29 | 30 | /* usb_lib headers */ 31 | #include "usb_type.h" 32 | #include "usb_core.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | extern USER_STANDARD_REQUESTS User_Standard_Requests; 39 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 40 | 41 | extern DEVICE_PROP Device_Property; 42 | extern DEVICE_PROP *pProperty; 43 | 44 | extern DEVICE_INFO Device_Info; 45 | extern DEVICE_INFO *pInformation; 46 | 47 | extern DEVICE Device_Table; 48 | extern u16 SaveRState; 49 | extern u16 SaveTState; 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usb/usb_lib/usb_init.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** 2 | * File Name : usb_init.h 3 | * Author : MCD Application Team 4 | * Version : V2.2.1 5 | * Date : 09/22/2008 6 | * Description : Initialization routines & global variables 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __USB_INIT_H 18 | #define __USB_INIT_H 19 | 20 | #if defined(__cplusplus) 21 | extern "C" { 22 | #endif 23 | 24 | /* Includes ------------------------------------------------------------------*/ 25 | /* Exported types ------------------------------------------------------------*/ 26 | /* Exported constants --------------------------------------------------------*/ 27 | /* Exported macro ------------------------------------------------------------*/ 28 | /* Exported functions ------------------------------------------------------- */ 29 | void USB_Init(void); 30 | 31 | /* External variables --------------------------------------------------------*/ 32 | /* The number of current endpoint, it will be used to specify an endpoint */ 33 | extern u8 EPindex; 34 | /* The number of current device, it is an index to the Device_Table */ 35 | /*extern u8 Device_no; */ 36 | /* Points to the DEVICE_INFO structure of current device */ 37 | /* The purpose of this register is to speed up the execution */ 38 | extern DEVICE_INFO* pInformation; 39 | /* Points to the DEVICE_PROP structure of current device */ 40 | /* The purpose of this register is to speed up the execution */ 41 | extern DEVICE_PROP* pProperty; 42 | /* Temporary save the state of Rx & Tx status. */ 43 | /* Whenever the Rx or Tx state is changed, its value is saved */ 44 | /* in this variable first and will be set to the EPRB or EPRA */ 45 | /* at the end of interrupt process */ 46 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 47 | 48 | extern u16 SaveState ; 49 | extern u16 wInterrupt_Mask; 50 | 51 | #if defined(__cplusplus) 52 | } 53 | #endif 54 | 55 | #endif /* __USB_INIT_H */ 56 | 57 | /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ 58 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usb/usb_lib/usb_lib.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** 2 | * File Name : usb_lib.h 3 | * Author : MCD Application Team 4 | * Version : V2.2.1 5 | * Date : 09/22/2008 6 | * Description : USB library include files 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __USB_LIB_H 18 | #define __USB_LIB_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "usb_type.h" 22 | #include "usb_regs.h" 23 | #include "usb_def.h" 24 | #include "usb_core.h" 25 | #include "usb_init.h" 26 | #include "usb_mem.h" 27 | 28 | /* Exported types ------------------------------------------------------------*/ 29 | /* Exported constants --------------------------------------------------------*/ 30 | /* Exported macro ------------------------------------------------------------*/ 31 | /* Exported functions ------------------------------------------------------- */ 32 | /* External variables --------------------------------------------------------*/ 33 | 34 | #endif /* __USB_LIB_H */ 35 | 36 | /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ 37 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/libmaple/usb/usb_lib/usb_mem.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** 2 | * File Name : usb_mem.h 3 | * Author : MCD Application Team 4 | * Version : V2.2.1 5 | * Date : 09/22/2008 6 | * Description : Utility prototypes functions for memory/PMA transfers 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __USB_MEM_H 18 | #define __USB_MEM_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | /* Exported types ------------------------------------------------------------*/ 22 | /* Exported constants --------------------------------------------------------*/ 23 | /* Exported macro ------------------------------------------------------------*/ 24 | /* Exported functions ------------------------------------------------------- */ 25 | #if defined(__cplusplus) 26 | extern "C" { 27 | #endif 28 | 29 | void UserToPMABufferCopy(const u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes); 30 | void PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes); 31 | 32 | #if defined(__cplusplus) 33 | } 34 | #endif 35 | 36 | /* External variables --------------------------------------------------------*/ 37 | 38 | #endif /*__USB_MEM_H*/ 39 | 40 | /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ 41 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/doxygen/evil_mangler.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/awk -f 2 | 3 | # libmaple's own Evil Mangler 4 | # 5 | # Input filter hack to trick Doxygen into thinking that a series 6 | # header is in a separate namespace. This is necessary because Doxygen 7 | # doesn't know how to cope with two data structures with the same name 8 | # in different places in the project. (We do that all the time, 9 | # e.g. for foo_reg_map structs.) 10 | # 11 | # E.g., an STM32F1 header gets transformed into: 12 | # 13 | # namespace stm32f1 { 14 | # 15 | # } 16 | 17 | BEGIN { 18 | # For extracting series component from header FILENAME. 19 | series_regex = "/stm32[flw][0-9]*/"; 20 | # Holds header FILENAME. Cargo-culted; not sure why it's necessary. 21 | f = ""; 22 | # Holds series component. 23 | series = ""; 24 | } 25 | { 26 | if (f != FILENAME) { 27 | f = FILENAME; 28 | match(f, series_regex); 29 | series = substr(f, RSTART + 1, RLENGTH - 2); 30 | printf("namespace %s {\n", series); 31 | } 32 | print; 33 | } 34 | END { 35 | if (series != "") { 36 | print "}" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/gdb/gpio/gpio.gdb: -------------------------------------------------------------------------------- 1 | set print pretty on 2 | 3 | print "GPIOA registers:" 4 | p/x *GPIOA->regs 5 | print "GPIOB registers:" 6 | p/x *GPIOB->regs 7 | print "GPIOC registers:" 8 | p/x *GPIOC->regs 9 | print "GPIOD registers:" 10 | p/x *GPIOD->regs 11 | print "AFIO registers:" 12 | p/x *(struct afio_reg_map*)0x40010000 13 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/gdb/i2c/test.gdb: -------------------------------------------------------------------------------- 1 | define i2c_sr1_flags 2 | set $s = $arg0 3 | printf "SR1: " 4 | 5 | if (($s & (1 << 15))) 6 | printf "SMBALERT " 7 | end 8 | 9 | if (($s & (1 << 14))) 10 | printf "TIMEOUT " 11 | end 12 | 13 | if (($s & (1 << 12))) 14 | printf "PECERR " 15 | end 16 | 17 | if (($s & (1 << 11))) 18 | printf "OVR " 19 | end 20 | 21 | if (($s & (1 << 10))) 22 | printf "AF " 23 | end 24 | 25 | if (($s & (1 << 9))) 26 | printf "ARLO " 27 | end 28 | 29 | if (($s & (1 << 8))) 30 | printf "BERR " 31 | end 32 | 33 | if (($s & (1 << 7))) 34 | printf "TXE " 35 | end 36 | 37 | if (($s & (1 << 6))) 38 | printf "RXNE " 39 | end 40 | 41 | if (($s & (1 << 4))) 42 | printf "STOPF " 43 | end 44 | 45 | if (($s & (1 << 3))) 46 | printf "ADD10 " 47 | end 48 | 49 | if (($s & (1 << 2))) 50 | printf "BTF " 51 | end 52 | 53 | if (($s & (1 << 1))) 54 | printf "ADDR " 55 | end 56 | 57 | if (($s & (1 << 0))) 58 | printf "SB " 59 | end 60 | end 61 | 62 | define i2c_sr2_flags 63 | set $s = $arg0 64 | printf "SR2: " 65 | 66 | if (($s & (1 << 7))) 67 | printf "DUALF " 68 | end 69 | 70 | if (($s & (1 << 6))) 71 | printf "SMBHOST " 72 | end 73 | 74 | if (($s & (1 << 5))) 75 | printf "SMBDEFAULT " 76 | end 77 | 78 | if (($s & (1 << 4))) 79 | printf "GENCALL " 80 | end 81 | 82 | 83 | if (($s & (1 << 2))) 84 | printf "TRA " 85 | end 86 | 87 | if (($s & (1 << 1))) 88 | printf "BUSY " 89 | end 90 | 91 | if (($s & (1 << 0))) 92 | printf "MSL " 93 | end 94 | 95 | end 96 | 97 | define pbc 98 | set $c = crumbs 99 | while ($c->event) 100 | if ($c->event != 0) 101 | printf "Event: %d ", $c->event 102 | if ($c->event == 1) 103 | i2c_sr1_flags $c->sr1 104 | printf "\t" 105 | i2c_sr2_flags $c->sr2 106 | end 107 | printf "\n" 108 | end 109 | set $c = $c + 1 110 | end 111 | 112 | 113 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "Flash" builds. 3 | * 4 | * A Flash build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but offsets the sections by 6 | * enough space to store the Maple bootloader, which lives in low 7 | * Flash and uses low memory. 8 | */ 9 | 10 | /* 11 | * This pulls in the appropriate MEMORY declaration from the right 12 | * subdirectory of stm32/mem/ (the environment must call ld with the 13 | * right include directory flags to make this happen). Boards can also 14 | * use this file to use any of libmaple's memory-related hooks (like 15 | * where the heap should live). 16 | */ 17 | INCLUDE mem-flash.inc 18 | 19 | /* Provide memory region aliases for common.inc */ 20 | REGION_ALIAS("REGION_TEXT", rom); 21 | REGION_ALIAS("REGION_DATA", ram); 22 | REGION_ALIAS("REGION_BSS", ram); 23 | REGION_ALIAS("REGION_RODATA", rom); 24 | 25 | /* Let common.inc handle the real work. */ 26 | INCLUDE common.inc 27 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/jtag.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "JTAG" builds. 3 | * 4 | * A "JTAG" build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but links starting at the 6 | * Flash and SRAM starting addresses (0x08000000 and 0x20000000 7 | * respectively). This will wipe out a Maple bootloader if there's one 8 | * on the board, so only use this if you know what you're doing. 9 | * 10 | * Of course, a "JTAG" build is perfectly usable for upload over SWD, 11 | * the system memory bootloader, etc. The name is just a historical 12 | * artifact. 13 | */ 14 | 15 | /* 16 | * This pulls in the appropriate MEMORY declaration from the right 17 | * subdirectory of stm32/mem/ (the environment must call ld with the 18 | * right include directory flags to make this happen). Boards can also 19 | * use this file to use any of libmaple's memory-related hooks (like 20 | * where the heap should live). 21 | */ 22 | INCLUDE mem-jtag.inc 23 | 24 | /* Provide memory region aliases for common.inc */ 25 | REGION_ALIAS("REGION_TEXT", rom); 26 | REGION_ALIAS("REGION_DATA", ram); 27 | REGION_ALIAS("REGION_BSS", ram); 28 | REGION_ALIAS("REGION_RODATA", rom); 29 | 30 | /* Let common.inc handle the real work. */ 31 | INCLUDE common.inc 32 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/ram.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for RAM builds. 3 | * 4 | * A Flash build puts .text, .rodata, and .data/.bss/heap (of course) 5 | * in SRAM, but offsets the sections by enough space to store the 6 | * Maple bootloader, which uses low memory. 7 | */ 8 | 9 | /* 10 | * This pulls in the appropriate MEMORY declaration from the right 11 | * subdirectory of stm32/mem/ (the environment must call ld with the 12 | * right include directory flags to make this happen). Boards can also 13 | * use this file to use any of libmaple's memory-related hooks (like 14 | * where the heap should live). 15 | */ 16 | INCLUDE mem-ram.inc 17 | 18 | /* Provide memory region aliases for common.inc */ 19 | REGION_ALIAS("REGION_TEXT", ram); 20 | REGION_ALIAS("REGION_DATA", ram); 21 | REGION_ALIAS("REGION_BSS", ram); 22 | REGION_ALIAS("REGION_RODATA", ram); 23 | 24 | /* Let common.inc handle the real work. */ 25 | INCLUDE common.inc 26 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/maple_native/maple_native_heap.inc: -------------------------------------------------------------------------------- 1 | /* Specify heap boundary addresses on the external SRAM chip */ 2 | _lm_heap_start = 0x60000000; 3 | _lm_heap_end = 0x60100000; 4 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/maple_native/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K 5 | } 6 | 7 | INCLUDE maple_native_heap.inc 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/maple_native/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K 5 | } 6 | 7 | INCLUDE maple_native_heap.inc 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/maple_native/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | 7 | INCLUDE maple_native_heap.inc 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_112k_flash_1024k/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 1024K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_112k_flash_1024k/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k_robotis/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08003000, LENGTH = 108K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k_robotis/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_20k_flash_128k_robotis/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_64k_flash_512k/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_64k_flash_512k/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_64k_flash_512k/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 61K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_8k_flash_128k/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_8k_flash_128k/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/mem/sram_8k_flash_128k/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/series/stm32f1/performance/vector_symbols.inc: -------------------------------------------------------------------------------- 1 | EXTERN(__msp_init) 2 | EXTERN(__exc_reset) 3 | EXTERN(__exc_nmi) 4 | EXTERN(__exc_hardfault) 5 | EXTERN(__exc_memmanage) 6 | EXTERN(__exc_busfault) 7 | EXTERN(__exc_usagefault) 8 | EXTERN(__stm32reservedexception7) 9 | EXTERN(__stm32reservedexception8) 10 | EXTERN(__stm32reservedexception9) 11 | EXTERN(__stm32reservedexception10) 12 | EXTERN(__exc_svc) 13 | EXTERN(__exc_debug_monitor) 14 | EXTERN(__stm32reservedexception13) 15 | EXTERN(__exc_pendsv) 16 | EXTERN(__exc_systick) 17 | 18 | EXTERN(__irq_wwdg) 19 | EXTERN(__irq_pvd) 20 | EXTERN(__irq_tamper) 21 | EXTERN(__irq_rtc) 22 | EXTERN(__irq_flash) 23 | EXTERN(__irq_rcc) 24 | EXTERN(__irq_exti0) 25 | EXTERN(__irq_exti1) 26 | EXTERN(__irq_exti2) 27 | EXTERN(__irq_exti3) 28 | EXTERN(__irq_exti4) 29 | EXTERN(__irq_dma1_channel1) 30 | EXTERN(__irq_dma1_channel2) 31 | EXTERN(__irq_dma1_channel3) 32 | EXTERN(__irq_dma1_channel4) 33 | EXTERN(__irq_dma1_channel5) 34 | EXTERN(__irq_dma1_channel6) 35 | EXTERN(__irq_dma1_channel7) 36 | EXTERN(__irq_adc) 37 | EXTERN(__irq_usb_hp_can_tx) 38 | EXTERN(__irq_usb_lp_can_rx0) 39 | EXTERN(__irq_can_rx1) 40 | EXTERN(__irq_can_sce) 41 | EXTERN(__irq_exti9_5) 42 | EXTERN(__irq_tim1_brk) 43 | EXTERN(__irq_tim1_up) 44 | EXTERN(__irq_tim1_trg_com) 45 | EXTERN(__irq_tim1_cc) 46 | EXTERN(__irq_tim2) 47 | EXTERN(__irq_tim3) 48 | EXTERN(__irq_tim4) 49 | EXTERN(__irq_i2c1_ev) 50 | EXTERN(__irq_i2c1_er) 51 | EXTERN(__irq_i2c2_ev) 52 | EXTERN(__irq_i2c2_er) 53 | EXTERN(__irq_spi1) 54 | EXTERN(__irq_spi2) 55 | EXTERN(__irq_usart1) 56 | EXTERN(__irq_usart2) 57 | EXTERN(__irq_usart3) 58 | EXTERN(__irq_exti15_10) 59 | EXTERN(__irq_rtcalarm) 60 | EXTERN(__irq_usbwakeup) 61 | 62 | EXTERN(__irq_tim8_brk) 63 | EXTERN(__irq_tim8_up) 64 | EXTERN(__irq_tim8_trg_com) 65 | EXTERN(__irq_tim8_cc) 66 | EXTERN(__irq_adc3) 67 | EXTERN(__irq_fsmc) 68 | EXTERN(__irq_sdio) 69 | EXTERN(__irq_tim5) 70 | EXTERN(__irq_spi3) 71 | EXTERN(__irq_uart4) 72 | EXTERN(__irq_uart5) 73 | EXTERN(__irq_tim6) 74 | EXTERN(__irq_tim7) 75 | EXTERN(__irq_dma2_channel1) 76 | EXTERN(__irq_dma2_channel2) 77 | EXTERN(__irq_dma2_channel3) 78 | EXTERN(__irq_dma2_channel4_5) 79 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/series/stm32f1/value/vector_symbols.inc: -------------------------------------------------------------------------------- 1 | EXTERN(__msp_init) 2 | EXTERN(__exc_reset) 3 | EXTERN(__exc_nmi) 4 | EXTERN(__exc_hardfault) 5 | EXTERN(__exc_memmanage) 6 | EXTERN(__exc_busfault) 7 | EXTERN(__exc_usagefault) 8 | EXTERN(__stm32reservedexception7) 9 | EXTERN(__stm32reservedexception8) 10 | EXTERN(__stm32reservedexception9) 11 | EXTERN(__stm32reservedexception10) 12 | EXTERN(__exc_svc) 13 | EXTERN(__exc_debug_monitor) 14 | EXTERN(__stm32reservedexception13) 15 | EXTERN(__exc_pendsv) 16 | EXTERN(__exc_systick) 17 | 18 | EXTERN(__irq_wwdg) 19 | EXTERN(__irq_pvd) 20 | EXTERN(__irq_tamper) 21 | EXTERN(__irq_rtc) 22 | EXTERN(__irq_flash) 23 | EXTERN(__irq_rcc) 24 | EXTERN(__irq_exti0) 25 | EXTERN(__irq_exti1) 26 | EXTERN(__irq_exti2) 27 | EXTERN(__irq_exti3) 28 | EXTERN(__irq_exti4) 29 | EXTERN(__irq_dma1_channel1) 30 | EXTERN(__irq_dma1_channel2) 31 | EXTERN(__irq_dma1_channel3) 32 | EXTERN(__irq_dma1_channel4) 33 | EXTERN(__irq_dma1_channel5) 34 | EXTERN(__irq_dma1_channel6) 35 | EXTERN(__irq_dma1_channel7) 36 | EXTERN(__irq_adc1) 37 | EXTERN(__stm32reservedexception14) 38 | EXTERN(__stm32reservedexception15) 39 | EXTERN(__stm32reservedexception16) 40 | EXTERN(__stm32reservedexception17) 41 | EXTERN(__irq_exti9_5) 42 | EXTERN(__irq_tim1_brk) 43 | EXTERN(__irq_tim1_up) 44 | EXTERN(__irq_tim1_trg_com) 45 | EXTERN(__irq_tim1_cc) 46 | EXTERN(__irq_tim2) 47 | EXTERN(__irq_tim3) 48 | EXTERN(__irq_tim4) 49 | EXTERN(__irq_i2c1_ev) 50 | EXTERN(__irq_i2c1_er) 51 | EXTERN(__irq_i2c2_ev) 52 | EXTERN(__irq_i2c2_er) 53 | EXTERN(__irq_spi1) 54 | EXTERN(__irq_spi2) 55 | EXTERN(__irq_usart1) 56 | EXTERN(__irq_usart2) 57 | EXTERN(__irq_usart3) 58 | EXTERN(__irq_exti15_10) 59 | EXTERN(__irq_rtcalarm) 60 | EXTERN(__irq_cec) 61 | EXTERN(__irq_tim12) 62 | EXTERN(__irq_tim13) 63 | EXTERN(__irq_tim14) 64 | EXTERN(__stm32reservedexception18) 65 | EXTERN(__stm32reservedexception19) 66 | EXTERN(__irq_fsmc) 67 | EXTERN(__stm32reservedexception20) 68 | EXTERN(__irq_tim5) 69 | EXTERN(__irq_spi3) 70 | EXTERN(__irq_uart4) 71 | EXTERN(__irq_uart5) 72 | EXTERN(__irq_tim6) 73 | EXTERN(__irq_tim7) 74 | EXTERN(__irq_dma2_channel1) 75 | EXTERN(__irq_dma2_channel2) 76 | EXTERN(__irq_dma2_channel3) 77 | EXTERN(__irq_dma2_channel4_5) 78 | EXTERN(__irq_dma2_channel5) /* on remap only */ 79 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/stm32/series/stm32f2/vector_symbols.inc: -------------------------------------------------------------------------------- 1 | EXTERN(__msp_init) 2 | EXTERN(__exc_reset) 3 | EXTERN(__exc_nmi) 4 | EXTERN(__exc_hardfault) 5 | EXTERN(__exc_memmanage) 6 | EXTERN(__exc_busfault) 7 | EXTERN(__exc_usagefault) 8 | EXTERN(__stm32reservedexception7) 9 | EXTERN(__stm32reservedexception8) 10 | EXTERN(__stm32reservedexception9) 11 | EXTERN(__stm32reservedexception10) 12 | EXTERN(__exc_svc) 13 | EXTERN(__exc_debug_monitor) 14 | EXTERN(__stm32reservedexception13) 15 | EXTERN(__exc_pendsv) 16 | EXTERN(__exc_systick) 17 | 18 | EXTERN(__irq_wwdg) 19 | EXTERN(__irq_pvd) 20 | EXTERN(__irq_tamp_stamp) 21 | EXTERN(__irq_rtc_wkup) 22 | EXTERN(__irq_flash) 23 | EXTERN(__irq_rcc) 24 | EXTERN(__irq_exti0) 25 | EXTERN(__irq_exti1) 26 | EXTERN(__irq_exti2) 27 | EXTERN(__irq_exti3) 28 | EXTERN(__irq_exti4) 29 | EXTERN(__irq_dma1_stream0) 30 | EXTERN(__irq_dma1_stream1) 31 | EXTERN(__irq_dma1_stream2) 32 | EXTERN(__irq_dma1_stream3) 33 | EXTERN(__irq_dma1_stream4) 34 | EXTERN(__irq_dma1_stream5) 35 | EXTERN(__irq_dma1_stream6) 36 | EXTERN(__irq_adc) 37 | EXTERN(__irq_can1_tx) 38 | EXTERN(__irq_can1_rx0) 39 | EXTERN(__irq_can1_rx1) 40 | EXTERN(__irq_can1_sce) 41 | EXTERN(__irq_exti9_5) 42 | EXTERN(__irq_tim1_brk_tim9) 43 | EXTERN(__irq_tim1_up_tim10) 44 | EXTERN(__irq_tim1_trg_com_tim11) 45 | EXTERN(__irq_tim1_cc) 46 | EXTERN(__irq_tim2) 47 | EXTERN(__irq_tim3) 48 | EXTERN(__irq_tim4) 49 | EXTERN(__irq_i2c1_ev) 50 | EXTERN(__irq_i2c1_er) 51 | EXTERN(__irq_i2c2_ev) 52 | EXTERN(__irq_i2c2_er) 53 | EXTERN(__irq_spi1) 54 | EXTERN(__irq_spi2) 55 | EXTERN(__irq_usart1) 56 | EXTERN(__irq_usart2) 57 | EXTERN(__irq_usart3) 58 | EXTERN(__irq_exti15_10) 59 | EXTERN(__irq_rtc_alarm) 60 | EXTERN(__irq_otg_fs_wkup) 61 | EXTERN(__irq_tim8_brk_tim12) 62 | EXTERN(__irq_tim8_up_tim13) 63 | EXTERN(__irq_tim8_trg_com_tim14) 64 | EXTERN(__irq_tim8_cc) 65 | EXTERN(__irq_dma1_stream7) 66 | EXTERN(__irq_fsmc) 67 | EXTERN(__irq_sdio) 68 | EXTERN(__irq_tim5) 69 | EXTERN(__irq_spi3) 70 | EXTERN(__irq_uart4) 71 | EXTERN(__irq_uart5) 72 | EXTERN(__irq_tim6_dac) 73 | EXTERN(__irq_tim7) 74 | EXTERN(__irq_dma2_stream0) 75 | EXTERN(__irq_dma2_stream1) 76 | EXTERN(__irq_dma2_stream2) 77 | EXTERN(__irq_dma2_stream3) 78 | EXTERN(__irq_dma2_stream4) 79 | EXTERN(__irq_eth) 80 | EXTERN(__irq_eth_wkup) 81 | EXTERN(__irq_can2_tx) 82 | EXTERN(__irq_can2_rx0) 83 | EXTERN(__irq_can2_rx1) 84 | EXTERN(__irq_can2_sce) 85 | EXTERN(__irq_otg_fs) 86 | EXTERN(__irq_dma2_stream5) 87 | EXTERN(__irq_dma2_stream6) 88 | EXTERN(__irq_dma2_stream7) 89 | EXTERN(__irq_usart6) 90 | EXTERN(__irq_i2c3_ev) 91 | EXTERN(__irq_i2c3_er) 92 | EXTERN(__irq_otg_hs_ep1_out) 93 | EXTERN(__irq_otg_hs_ep1_in) 94 | EXTERN(__irq_otg_hs_wkup) 95 | EXTERN(__irq_otg_hs) 96 | EXTERN(__irq_dcmi) 97 | EXTERN(__irq_cryp) 98 | EXTERN(__irq_hash_rng) 99 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/toolchains/gcc-arm-embedded/extra_libs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- 3 | * releases (https://launchpad.net/gcc-arm-embedded/). 4 | */ 5 | 6 | /* This is for the provided newlib. */ 7 | GROUP(libnosys.a) 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/ld/toolchains/generic/extra_libs.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/Maple/system/support/ld/toolchains/generic/extra_libs.inc -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/VLDiscovery.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F100RB 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOC 4 | ERROR_LED_PIN := 9 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := value 7 | LD_MEM_DIR := sram_8k_flash_128k 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/cm900.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103C8 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOB 4 | ERROR_LED_PIN := 2 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | # This crap is due to ld-script limitations. If you know of a better 8 | # way to go about this (like some magic ld switches to specify MEMORY 9 | # at the command line), please tell us! 10 | ifeq ($(BOOTLOADER),maple) 11 | LD_MEM_DIR := sram_20k_flash_128k 12 | endif 13 | ifeq ($(BOOTLOADER),robotis) 14 | LD_MEM_DIR := sram_20k_flash_128k_robotis 15 | endif 16 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/maple.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103RB 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOA 4 | ERROR_LED_PIN := 5 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | # This crap is due to ld-script limitations. If you know of a better 8 | # way to go about this (like some magic ld switches to specify MEMORY 9 | # at the command line), please tell us! 10 | LD_MEM_DIR := sram_20k_flash_128k 11 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/maple_RET6.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103RE 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOA 4 | ERROR_LED_PIN := 5 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | LD_MEM_DIR := sram_64k_flash_512k 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/maple_mini.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103CB 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOB 4 | ERROR_LED_PIN := 1 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | LD_MEM_DIR := sram_20k_flash_128k 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/maple_native.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103ZE 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOC 4 | ERROR_LED_PIN := 15 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | LD_MEM_DIR := maple_native # The SRAM chip makes this board special 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/olimex_stm32_h103.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103RB 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOC 4 | ERROR_LED_PIN := 12 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | LD_MEM_DIR := sram_20k_flash_128k 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/opencm904.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F103CB 2 | PRODUCT_ID := 0003 3 | ERROR_LED_PORT := GPIOB 4 | ERROR_LED_PIN := 9 5 | MCU_SERIES := stm32f1 6 | MCU_F1_LINE := performance 7 | # This crap is due to ld-script limitations. If you know of a better 8 | # way to go about this (like some magic ld switches to specify MEMORY 9 | # at the command line), please tell us! 10 | ifeq ($(BOOTLOADER),maple) 11 | LD_MEM_DIR := sram_20k_flash_128k 12 | endif 13 | ifeq ($(BOOTLOADER),robotis) 14 | LD_MEM_DIR := sram_20k_flash_128k_robotis 15 | endif 16 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/board-includes/st_stm3220g_eval.mk: -------------------------------------------------------------------------------- 1 | MCU := STM32F207IG 2 | ERROR_LED_PORT := GPIOG 3 | ERROR_LED_PIN := 6 4 | MCU_SERIES := stm32f2 5 | LD_MEM_DIR := sram_112k_flash_1024k 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/build-rules.mk: -------------------------------------------------------------------------------- 1 | # Useful tools 2 | CROSS_COMPILE ?= arm-none-eabi- 3 | 4 | CC := $(CROSS_COMPILE)gcc 5 | CXX := $(CROSS_COMPILE)g++ 6 | LD := $(CROSS_COMPILE)ld -v 7 | AR := $(CROSS_COMPILE)ar 8 | AS := $(CROSS_COMPILE)gcc 9 | OBJCOPY := $(CROSS_COMPILE)objcopy 10 | DISAS := $(CROSS_COMPILE)objdump 11 | OBJDUMP := $(CROSS_COMPILE)objdump 12 | SIZE := $(CROSS_COMPILE)size 13 | DFU ?= dfu-util 14 | 15 | # Suppress annoying output unless V is set 16 | ifndef V 17 | SILENT_CC = @echo ' [CC] ' $(@:$(BUILD_PATH)/%.o=%.c); 18 | SILENT_AS = @echo ' [AS] ' $(@:$(BUILD_PATH)/%.o=%.S); 19 | SILENT_CXX = @echo ' [CXX] ' $(@:$(BUILD_PATH)/%.o=%.cpp); 20 | SILENT_LD = @echo ' [LD] ' $(@F); 21 | SILENT_AR = @echo ' [AR] ' 22 | SILENT_OBJCOPY = @echo ' [OBJCOPY] ' $(@F); 23 | SILENT_DISAS = @echo ' [DISAS] ' $(@:$(BUILD_PATH)/%.bin=%).disas; 24 | SILENT_OBJDUMP = @echo ' [OBJDUMP] ' $(OBJDUMP); 25 | endif 26 | 27 | # Extra build configuration 28 | 29 | BUILDDIRS := 30 | TGT_BIN := 31 | 32 | CFLAGS = $(GLOBAL_CFLAGS) $(TGT_CFLAGS) 33 | CXXFLAGS = $(GLOBAL_CXXFLAGS) $(TGT_CXXFLAGS) 34 | ASFLAGS = $(GLOBAL_ASFLAGS) $(TGT_ASFLAGS) 35 | 36 | # Hacks to determine extra libraries we need to link against based on 37 | # the toolchain. The default specifies no extra libraries, but it can 38 | # be overridden. 39 | LD_TOOLCHAIN_PATH := $(LDDIR)/toolchains/generic 40 | ifneq ($(findstring ARM/embedded,$(shell $(CC) --version)),) 41 | # GCC ARM Embedded, https://launchpad.net/gcc-arm-embedded/ 42 | LD_TOOLCHAIN_PATH := $(LDDIR)/toolchains/gcc-arm-embedded 43 | endif 44 | ifneq ($(findstring Linaro GCC,$(shell $(CC) --version)),) 45 | # Summon/Linaro GCC ARM Embedded, https://github.com/esden/summon-arm-toolchain 46 | LD_TOOLCHAIN_PATH := $(LDDIR)/toolchains/gcc-arm-embedded 47 | endif 48 | # Add toolchain directory to LD search path 49 | TOOLCHAIN_LDFLAGS := -L $(LD_TOOLCHAIN_PATH) 50 | 51 | # General directory independent build rules, generate dependency information 52 | $(BUILD_PATH)/%.o: %.c 53 | $(SILENT_CC) $(CC) $(CFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $< 54 | 55 | $(BUILD_PATH)/%.o: %.cpp 56 | $(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $< 57 | 58 | $(BUILD_PATH)/%.o: %.S 59 | $(SILENT_AS) $(AS) $(ASFLAGS) -MMD -MP -MF $(@:%.o=%.d) -MT $@ -o $@ -c $< 60 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/build-templates.mk: -------------------------------------------------------------------------------- 1 | define LIBMAPLE_MODULE_template 2 | dir := $(1) 3 | include $$(dir)/rules.mk 4 | endef 5 | 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/footer.mk: -------------------------------------------------------------------------------- 1 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 2 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 3 | cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%) 4 | 5 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 6 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \ 7 | $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o) 8 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 9 | 10 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 11 | $(OBJS_$(d)): TGT_CXXFLAGS := $(CXXFLAGS_$(d)) 12 | $(OBJS_$(d)): TGT_ASFLAGS := $(ASFLAGS_$(d)) 13 | 14 | TGT_BIN += $(OBJS_$(d)) 15 | 16 | -include $(DEPS_$(d)) 17 | d := $(dirstack_$(sp)) 18 | sp := $(basename $(sp)) 19 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/header.mk: -------------------------------------------------------------------------------- 1 | sp := $(sp).x 2 | dirstack_$(sp) := $(d) 3 | d := $(dir) 4 | BUILDDIRS += $(BUILD_PATH)/$(d) 5 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/make/target-config.mk: -------------------------------------------------------------------------------- 1 | # TARGET_FLAGS are to be passed while compiling, assembling, linking. 2 | TARGET_FLAGS := 3 | # TARGET_LDFLAGS go to the linker 4 | TARGET_LDFLAGS := 5 | 6 | # Configuration derived from $(MEMORY_TARGET) 7 | 8 | LD_SCRIPT_PATH := $(LDDIR)/$(MEMORY_TARGET).ld 9 | 10 | ifeq ($(MEMORY_TARGET), ram) 11 | VECT_BASE_ADDR := VECT_TAB_RAM 12 | endif 13 | ifeq ($(MEMORY_TARGET), flash) 14 | VECT_BASE_ADDR := VECT_TAB_FLASH 15 | endif 16 | ifeq ($(MEMORY_TARGET), jtag) 17 | VECT_BASE_ADDR := VECT_TAB_BASE 18 | endif 19 | 20 | # Pull in the board configuration file here, so it can override the 21 | # above. 22 | 23 | include $(BOARD_INCLUDE_DIR)/$(BOARD).mk 24 | 25 | # Configuration derived from $(BOARD).mk 26 | 27 | LD_SERIES_PATH := $(LDDIR)/stm32/series/$(MCU_SERIES) 28 | LD_MEM_PATH := $(LDDIR)/stm32/mem/$(LD_MEM_DIR) 29 | ifeq ($(MCU_SERIES), stm32f1) 30 | # Due to the Balkanization on F1, we need to specify the line when 31 | # making linker decisions. 32 | LD_SERIES_PATH := $(LD_SERIES_PATH)/$(MCU_F1_LINE) 33 | endif 34 | 35 | ifeq ($(MCU_SERIES), stm32f1) 36 | TARGET_FLAGS += -mcpu=cortex-m3 -march=armv7-m 37 | endif 38 | ifeq ($(MCU_SERIES), stm32f2) 39 | TARGET_FLAGS += -mcpu=cortex-m3 -march=armv7-m 40 | endif 41 | ifeq ($(MCU_SERIES), stm32f4) 42 | TARGET_FLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 43 | endif 44 | 45 | TARGET_LDFLAGS += -Xlinker -T$(LD_SCRIPT_PATH) \ 46 | -L $(LD_SERIES_PATH) \ 47 | -L $(LD_MEM_PATH) \ 48 | -L $(LDDIR) 49 | TARGET_FLAGS += -mthumb -DBOARD_$(BOARD) -DMCU_$(MCU) \ 50 | -DERROR_LED_PORT=$(ERROR_LED_PORT) \ 51 | -DERROR_LED_PIN=$(ERROR_LED_PIN) \ 52 | -D$(VECT_BASE_ADDR) 53 | 54 | LIBMAPLE_MODULE_SERIES := $(LIBMAPLE_PATH)/$(MCU_SERIES) 55 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/scripts/45-maple.rules: -------------------------------------------------------------------------------- 1 | ATTRS{idProduct}=="1001", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev" 2 | ATTRS{idProduct}=="1002", ATTRS{idVendor}=="0110", MODE="664", GROUP="plugdev" 3 | ATTRS{idProduct}=="0003", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple" 4 | ATTRS{idProduct}=="0004", ATTRS{idVendor}=="1eaf", MODE="664", GROUP="plugdev" SYMLINK+="maple" 5 | 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/scripts/copy-to-ide: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This hack copies libmaple's source, linker scripts, and support 4 | # libraries into the Maple IDE repository (which is expected as its 5 | # first argument). 6 | 7 | DEST=$1 8 | 9 | DEST_CORES=$DEST/hardware/leaflabs/cores/maple 10 | DEST_LIBS=$DEST/libraries 11 | 12 | LMAPLE_SRC="LICENSE 13 | ./libmaple/*.h 14 | ./libmaple/*.c 15 | ./libmaple/*.S 16 | ./libmaple/usb/*.h 17 | ./libmaple/usb/*.c 18 | ./libmaple/usb/usb_lib/*.h 19 | ./libmaple/usb/usb_lib/*.c 20 | ./wirish/*.h 21 | ./wirish/main.cxx 22 | ./wirish/*.cpp 23 | ./wirish/comm/*.cpp 24 | ./wirish/comm/*.h 25 | ./wirish/boards/*.h 26 | ./wirish/boards/*.cpp 27 | ./support/ld/common.inc 28 | ./support/ld/maple 29 | ./support/ld/maple_mini 30 | ./support/ld/maple_native 31 | ./support/ld/maple_RET6 32 | ./support/ld/names.inc" 33 | 34 | echo "First make sure DEST exists: $DEST" 35 | if !(test -d $DEST) 36 | then 37 | echo "Nope! Make sure you're doing this right?" 38 | exit -1 39 | fi 40 | 41 | # source 42 | echo Copying libmaple source 43 | rm -rf $DEST_CORES/*.c $DEST_CORES/*.cpp $DEST_CORES/*.h $DEST_CORES/*.cxx $DEST_CORES/*.S 44 | rm -rf $DEST_CORES/*.inc $DEST_CORES/*.a $DEST_CORES/maple $DEST_CORES/maple_* 45 | cp -R $LMAPLE_SRC $DEST_CORES 46 | 47 | echo Copying over libraries 48 | cp -R libraries/* $DEST_LIBS 49 | 50 | # libmaple version 51 | echo Creating libmaple-version.txt 52 | git show-ref HEAD | cut -c 1-10 > $DEST/libmaple-version.txt 53 | 54 | echo Done. 55 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/scripts/robotis-loader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # This script sends a program on a robotis board (OpenCM9.04 or CM900) 4 | # using the robotis bootloader (used in OpenCM IDE) 5 | # 6 | # Usage: 7 | # python robotis-loader.py 8 | # 9 | # Example: 10 | # python robotis-loader.py /dev/ttyACM0 firmware.bin 11 | # 12 | # https://github.com/Gregwar/robotis-loader 13 | 14 | import serial, sys, os, time 15 | 16 | print('~~ Robotis loader ~~') 17 | print('') 18 | 19 | # Reading command line 20 | if len(sys.argv) != 3: 21 | exit('! Usage: robotis-loader.py ') 22 | pgm, port, binary = sys.argv 23 | 24 | # Helper to prints a progress bar 25 | def progressBar(percent, precision=65): 26 | threshold=precision*percent/100.0 27 | sys.stdout.write('[ ') 28 | for x in xrange(0, precision): 29 | if x < threshold: sys.stdout.write('#') 30 | else: sys.stdout.write(' ') 31 | sys.stdout.write(' ] ') 32 | sys.stdout.flush() 33 | 34 | # Opening the firmware file 35 | try: 36 | stat = os.stat(binary) 37 | size = stat.st_size 38 | firmware = file(binary, 'rb') 39 | print('* Opening %s, size=%d' % (binary, size)) 40 | except: 41 | exit('! Unable to open file %s' % binary) 42 | 43 | # Opening serial port 44 | try: 45 | s = serial.Serial(port, baudrate=115200) 46 | except: 47 | exit('! Unable to open serial port %s' % port) 48 | 49 | print('* Resetting the board') 50 | s.setRTS(True) 51 | s.setDTR(False) 52 | time.sleep(0.1) 53 | s.setRTS(False) 54 | s.write('CM9X') 55 | s.close() 56 | time.sleep(1.0); 57 | 58 | print('* Connecting...') 59 | s = serial.Serial(port, baudrate=115200) 60 | s.write('AT&LD') 61 | print('* Download signal transmitted, waiting...') 62 | 63 | # Entering bootloader sequence 64 | while True: 65 | line = s.readline().strip() 66 | if line.endswith('Ready..'): 67 | print('* Board ready, sending data') 68 | cs = 0 69 | pos = 0 70 | while True: 71 | c = firmware.read(2048) 72 | if len(c): 73 | pos += len(c) 74 | sys.stdout.write("\r") 75 | progressBar(100*float(pos)/float(size)) 76 | s.write(c) 77 | for k in range(0,len(c)): 78 | cs = (cs+ord(c[k]))%256 79 | else: 80 | break 81 | print('') 82 | s.setDTR(True) 83 | print('* Checksum: %d' % (cs)) 84 | s.write(chr(cs)) 85 | print('* Firmware was sent') 86 | else: 87 | if line == 'Success..': 88 | print('* Success, running the code') 89 | print('') 90 | s.write('AT&RST') 91 | s.close() 92 | exit() 93 | else: 94 | print('Board -> '+line) 95 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/system/support/scripts/win-list-com-ports.py: -------------------------------------------------------------------------------- 1 | # Windows program for listing COM (serial) ports. 2 | # 3 | # enumerate_serial_ports() is by Eli Bendersky: 4 | # 5 | # http://eli.thegreenplace.net/2009/07/31/listing-all-serial-ports-on-windows-with-python/ 6 | 7 | import _winreg as winreg 8 | import itertools 9 | 10 | def enumerate_serial_ports(): 11 | """ Uses the Win32 registry to return an 12 | iterator of serial (COM) ports 13 | existing on this computer. 14 | """ 15 | path = 'HARDWARE\\DEVICEMAP\\SERIALCOMM' 16 | try: 17 | key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, path) 18 | except WindowsError: 19 | raise IterationError 20 | 21 | for i in itertools.count(): 22 | try: 23 | val = winreg.EnumValue(key, i) 24 | yield str(val[1]) 25 | except EnvironmentError: 26 | break 27 | 28 | for com in enumerate_serial_ports(): 29 | print com 30 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/extra_libs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- 3 | * releases (https://launchpad.net/gcc-arm-embedded/). 4 | */ 5 | 6 | /* This is for the provided newlib. */ 7 | GROUP(libnosys.a) 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "Flash" builds. 3 | * 4 | * A Flash build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but offsets the sections by 6 | * enough space to store the Maple bootloader, which lives in low 7 | * Flash and uses low memory. 8 | */ 9 | 10 | /* 11 | * This pulls in the appropriate MEMORY declaration from the right 12 | * subdirectory of stm32/mem/ (the environment must call ld with the 13 | * right include directory flags to make this happen). Boards can also 14 | * use this file to use any of libmaple's memory-related hooks (like 15 | * where the heap should live). 16 | */ 17 | INCLUDE mem-flash.inc 18 | 19 | /* Provide memory region aliases for common.inc */ 20 | REGION_ALIAS("REGION_TEXT", rom); 21 | REGION_ALIAS("REGION_DATA", ram); 22 | REGION_ALIAS("REGION_BSS", ram); 23 | REGION_ALIAS("REGION_RODATA", rom); 24 | 25 | /* Let common.inc handle the real work. */ 26 | INCLUDE common.inc 27 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/jtag.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "JTAG" builds. 3 | * 4 | * A "JTAG" build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but links starting at the 6 | * Flash and SRAM starting addresses (0x08000000 and 0x20000000 7 | * respectively). This will wipe out a Maple bootloader if there's one 8 | * on the board, so only use this if you know what you're doing. 9 | * 10 | * Of course, a "JTAG" build is perfectly usable for upload over SWD, 11 | * the system memory bootloader, etc. The name is just a historical 12 | * artifact. 13 | */ 14 | 15 | /* 16 | * This pulls in the appropriate MEMORY declaration from the right 17 | * subdirectory of stm32/mem/ (the environment must call ld with the 18 | * right include directory flags to make this happen). Boards can also 19 | * use this file to use any of libmaple's memory-related hooks (like 20 | * where the heap should live). 21 | */ 22 | INCLUDE mem-jtag.inc 23 | 24 | /* Provide memory region aliases for common.inc */ 25 | REGION_ALIAS("REGION_TEXT", rom); 26 | REGION_ALIAS("REGION_DATA", ram); 27 | REGION_ALIAS("REGION_BSS", ram); 28 | REGION_ALIAS("REGION_RODATA", rom); 29 | 30 | /* Let common.inc handle the real work. */ 31 | INCLUDE common.inc 32 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/ram.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for RAM builds. 3 | * 4 | * A Flash build puts .text, .rodata, and .data/.bss/heap (of course) 5 | * in SRAM, but offsets the sections by enough space to store the 6 | * Maple bootloader, which uses low memory. 7 | */ 8 | 9 | /* 10 | * This pulls in the appropriate MEMORY declaration from the right 11 | * subdirectory of stm32/mem/ (the environment must call ld with the 12 | * right include directory flags to make this happen). Boards can also 13 | * use this file to use any of libmaple's memory-related hooks (like 14 | * where the heap should live). 15 | */ 16 | INCLUDE mem-ram.inc 17 | 18 | /* Provide memory region aliases for common.inc */ 19 | REGION_ALIAS("REGION_TEXT", ram); 20 | REGION_ALIAS("REGION_DATA", ram); 21 | REGION_ALIAS("REGION_BSS", ram); 22 | REGION_ALIAS("REGION_RODATA", ram); 23 | 24 | /* Let common.inc handle the real work. */ 25 | INCLUDE common.inc 26 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/ld/vector_symbols.inc: -------------------------------------------------------------------------------- 1 | EXTERN(__msp_init) 2 | EXTERN(__exc_reset) 3 | EXTERN(__exc_nmi) 4 | EXTERN(__exc_hardfault) 5 | EXTERN(__exc_memmanage) 6 | EXTERN(__exc_busfault) 7 | EXTERN(__exc_usagefault) 8 | EXTERN(__stm32reservedexception7) 9 | EXTERN(__stm32reservedexception8) 10 | EXTERN(__stm32reservedexception9) 11 | EXTERN(__stm32reservedexception10) 12 | EXTERN(__exc_svc) 13 | EXTERN(__exc_debug_monitor) 14 | EXTERN(__stm32reservedexception13) 15 | EXTERN(__exc_pendsv) 16 | EXTERN(__exc_systick) 17 | 18 | EXTERN(__irq_wwdg) 19 | EXTERN(__irq_pvd) 20 | EXTERN(__irq_tamper) 21 | EXTERN(__irq_rtc) 22 | EXTERN(__irq_flash) 23 | EXTERN(__irq_rcc) 24 | EXTERN(__irq_exti0) 25 | EXTERN(__irq_exti1) 26 | EXTERN(__irq_exti2) 27 | EXTERN(__irq_exti3) 28 | EXTERN(__irq_exti4) 29 | EXTERN(__irq_dma1_channel1) 30 | EXTERN(__irq_dma1_channel2) 31 | EXTERN(__irq_dma1_channel3) 32 | EXTERN(__irq_dma1_channel4) 33 | EXTERN(__irq_dma1_channel5) 34 | EXTERN(__irq_dma1_channel6) 35 | EXTERN(__irq_dma1_channel7) 36 | EXTERN(__irq_adc) 37 | EXTERN(__irq_usb_hp_can_tx) 38 | EXTERN(__irq_usb_lp_can_rx0) 39 | EXTERN(__irq_can_rx1) 40 | EXTERN(__irq_can_sce) 41 | EXTERN(__irq_exti9_5) 42 | EXTERN(__irq_tim1_brk) 43 | EXTERN(__irq_tim1_up) 44 | EXTERN(__irq_tim1_trg_com) 45 | EXTERN(__irq_tim1_cc) 46 | EXTERN(__irq_tim2) 47 | EXTERN(__irq_tim3) 48 | EXTERN(__irq_tim4) 49 | EXTERN(__irq_i2c1_ev) 50 | EXTERN(__irq_i2c1_er) 51 | EXTERN(__irq_i2c2_ev) 52 | EXTERN(__irq_i2c2_er) 53 | EXTERN(__irq_spi1) 54 | EXTERN(__irq_spi2) 55 | EXTERN(__irq_usart1) 56 | EXTERN(__irq_usart2) 57 | EXTERN(__irq_usart3) 58 | EXTERN(__irq_exti15_10) 59 | EXTERN(__irq_rtcalarm) 60 | EXTERN(__irq_usbwakeup) 61 | 62 | EXTERN(__irq_tim8_brk) 63 | EXTERN(__irq_tim8_up) 64 | EXTERN(__irq_tim8_trg_com) 65 | EXTERN(__irq_tim8_cc) 66 | EXTERN(__irq_adc3) 67 | EXTERN(__irq_fsmc) 68 | EXTERN(__irq_sdio) 69 | EXTERN(__irq_tim5) 70 | EXTERN(__irq_spi3) 71 | EXTERN(__irq_uart4) 72 | EXTERN(__irq_uart5) 73 | EXTERN(__irq_tim6) 74 | EXTERN(__irq_tim7) 75 | EXTERN(__irq_dma2_channel1) 76 | EXTERN(__irq_dma2_channel2) 77 | EXTERN(__irq_dma2_channel3) 78 | EXTERN(__irq_dma2_channel4_5) 79 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/exti_f1.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #include 28 | #include "exti_private.h" 29 | 30 | void exti_select(exti_num num, exti_cfg port) { 31 | exti_do_select(&AFIO_BASE->EXTICR1 + num / 4, num, port); 32 | } 33 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/flash.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/flash.c 30 | * @brief Flash management functions 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * @brief Set flash wait states 38 | * 39 | * Note that not all wait states are available on every MCU. See the 40 | * Flash programming manual for your MCU for restrictions on the 41 | * allowed value of wait_states for a given system clock (SYSCLK) 42 | * frequency. 43 | * 44 | * @param wait_states number of wait states (one of 45 | * FLASH_WAIT_STATE_0, FLASH_WAIT_STATE_1, 46 | * ..., FLASH_WAIT_STATE_7). 47 | */ 48 | void flash_set_latency(uint32 wait_states) { 49 | uint32 val = FLASH_BASE->ACR; 50 | 51 | val &= ~FLASH_ACR_LATENCY; 52 | val |= wait_states; 53 | 54 | FLASH_BASE->ACR = val; 55 | } 56 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/gpio.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/gpio.c 30 | * @brief Generic STM32 GPIO support. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /* 37 | * GPIO routines 38 | */ 39 | 40 | /** 41 | * Initialize a GPIO device. 42 | * 43 | * Enables the clock for and resets the given device. 44 | * 45 | * @param dev GPIO device to initialize. 46 | */ 47 | void gpio_init(gpio_dev *dev) { 48 | rcc_clk_enable(dev->clk_id); 49 | rcc_reset_dev(dev->clk_id); 50 | } 51 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/iwdg.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Michael Hope. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/iwdg.c 29 | * @brief Independent watchdog (IWDG) support 30 | */ 31 | 32 | #include 33 | 34 | /** 35 | * @brief Initialise and start the watchdog 36 | * 37 | * The prescaler and reload set the timeout. For example, a prescaler 38 | * of IWDG_PRE_32 divides the 40 kHz clock by 32 and gives roughly 1 39 | * ms per reload. 40 | * 41 | * @param prescaler Prescaler for the 40 kHz IWDG clock. 42 | * @param reload Independent watchdog counter reload value. 43 | */ 44 | void iwdg_init(iwdg_prescaler prescaler, uint16 reload) { 45 | IWDG_BASE->KR = IWDG_KR_UNLOCK; 46 | IWDG_BASE->PR = prescaler; 47 | IWDG_BASE->RLR = reload; 48 | 49 | /* Start things off */ 50 | IWDG_BASE->KR = IWDG_KR_START; 51 | iwdg_feed(); 52 | } 53 | 54 | /** 55 | * @brief Reset the IWDG counter. 56 | * 57 | * Calling this function will cause the IWDG counter to be reset to 58 | * its reload value. 59 | */ 60 | void iwdg_feed(void) { 61 | IWDG_BASE->KR = IWDG_KR_FEED; 62 | } 63 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/pwr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/pwr.c 29 | * @brief Power control (PWR) support. 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | /** 36 | * Enables the power interface clock, and resets the power device. 37 | */ 38 | void pwr_init(void) { 39 | rcc_clk_enable(RCC_PWR); 40 | rcc_reset_dev(RCC_PWR); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/usart_private.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/usart_private.c 29 | * @author Marti Bolivar 30 | * @brief Private USART routines. 31 | */ 32 | 33 | #include "usart_private.h" 34 | #include 35 | #include 36 | 37 | uint32 _usart_clock_freq(usart_dev *dev) { 38 | rcc_clk_domain domain = rcc_dev_clk(dev->clk_id); 39 | return (domain == RCC_APB1 ? STM32_PCLK1 : 40 | (domain == RCC_APB2 ? STM32_PCLK2 : 0)); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/libmaple/usb/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Local flags 8 | CFLAGS_$(d) = -I$(d) -I$(d)/$(MCU_SERIES) -I$(d)/usb_lib $(LIBMAPLE_INCLUDES) $(LIBMAPLE_PRIVATE_INCLUDES) -Wall 9 | 10 | # Add usblib and series subdirectory to BUILDDIRS. 11 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(MCU_SERIES) 12 | BUILDDIRS += $(BUILD_PATH)/$(d)/usb_lib 13 | 14 | # Local rules and targets 15 | sSRCS_$(d) := 16 | cSRCS_$(d) := 17 | # We currently only have F1 performance line support. Sigh. 18 | ifeq ($(MCU_SERIES), stm32f1) 19 | ifeq ($(MCU_F1_LINE), performance) 20 | cSRCS_$(d) += $(MCU_SERIES)/usb.c 21 | cSRCS_$(d) += $(MCU_SERIES)/usb_reg_map.c 22 | cSRCS_$(d) += $(MCU_SERIES)/usb_cdcacm.c 23 | cSRCS_$(d) += usb_lib/usb_core.c 24 | cSRCS_$(d) += usb_lib/usb_init.c 25 | cSRCS_$(d) += usb_lib/usb_mem.c 26 | cSRCS_$(d) += usb_lib/usb_regs.c 27 | endif 28 | endif 29 | 30 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 31 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 32 | 33 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 34 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) 35 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 36 | 37 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 38 | $(OBJS_$(d)): TGT_ASFLAGS := 39 | 40 | TGT_BIN += $(OBJS_$(d)) 41 | 42 | # Standard things 43 | -include $(DEPS_$(d)) 44 | d := $(dirstack_$(sp)) 45 | sp := $(basename $(sp)) 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple/wirish/start.S: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /* 28 | * This file is a modified version of a file obtained from 29 | * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the 30 | * following text appeared: 31 | * 32 | * The authors hereby grant permission to use, copy, modify, distribute, 33 | * and license this software and its documentation for any purpose, provided 34 | * that existing copyright notices are retained in all copies and that this 35 | * notice is included verbatim in any distributions. No written agreement, 36 | * license, or royalty fee is required for any of the authorized uses. 37 | * Modifications to this software may be copyrighted by their authors 38 | * and need not follow the licensing terms described here, provided that 39 | * the new terms are clearly indicated on the first page of each file where 40 | * they apply. 41 | */ 42 | 43 | .text 44 | .code 16 45 | .thumb_func 46 | 47 | .globl __start__ 48 | .type __start__, %function 49 | __start__: 50 | .fnstart 51 | ldr r1,=__msp_init 52 | mov sp,r1 53 | ldr r1,=start_c 54 | bx r1 55 | .pool 56 | .cantunwind 57 | .fnend 58 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/extra_libs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi- 3 | * releases (https://launchpad.net/gcc-arm-embedded/). 4 | */ 5 | 6 | /* This is for the provided newlib. */ 7 | GROUP(libnosys.a) 8 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/flash.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "Flash" builds. 3 | * 4 | * A Flash build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but offsets the sections by 6 | * enough space to store the Maple bootloader, which lives in low 7 | * Flash and uses low memory. 8 | */ 9 | 10 | /* 11 | * This pulls in the appropriate MEMORY declaration from the right 12 | * subdirectory of stm32/mem/ (the environment must call ld with the 13 | * right include directory flags to make this happen). Boards can also 14 | * use this file to use any of libmaple's memory-related hooks (like 15 | * where the heap should live). 16 | */ 17 | INCLUDE mem-flash.inc 18 | 19 | /* Provide memory region aliases for common.inc */ 20 | REGION_ALIAS("REGION_TEXT", rom); 21 | REGION_ALIAS("REGION_DATA", ram); 22 | REGION_ALIAS("REGION_BSS", ram); 23 | REGION_ALIAS("REGION_RODATA", rom); 24 | 25 | /* Let common.inc handle the real work. */ 26 | INCLUDE common.inc 27 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/jtag.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for "JTAG" builds. 3 | * 4 | * A "JTAG" build puts .text (and .rodata) in Flash, and 5 | * .data/.bss/heap (of course) in SRAM, but links starting at the 6 | * Flash and SRAM starting addresses (0x08000000 and 0x20000000 7 | * respectively). This will wipe out a Maple bootloader if there's one 8 | * on the board, so only use this if you know what you're doing. 9 | * 10 | * Of course, a "JTAG" build is perfectly usable for upload over SWD, 11 | * the system memory bootloader, etc. The name is just a historical 12 | * artifact. 13 | */ 14 | 15 | /* 16 | * This pulls in the appropriate MEMORY declaration from the right 17 | * subdirectory of stm32/mem/ (the environment must call ld with the 18 | * right include directory flags to make this happen). Boards can also 19 | * use this file to use any of libmaple's memory-related hooks (like 20 | * where the heap should live). 21 | */ 22 | INCLUDE mem-jtag.inc 23 | 24 | /* Provide memory region aliases for common.inc */ 25 | REGION_ALIAS("REGION_TEXT", rom); 26 | REGION_ALIAS("REGION_DATA", ram); 27 | REGION_ALIAS("REGION_BSS", ram); 28 | REGION_ALIAS("REGION_RODATA", rom); 29 | 30 | /* Let common.inc handle the real work. */ 31 | INCLUDE common.inc 32 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/mem-flash.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/mem-jtag.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K 4 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/mem-ram.inc: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K 4 | rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K 5 | } 6 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/ram.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * libmaple linker script for RAM builds. 3 | * 4 | * A Flash build puts .text, .rodata, and .data/.bss/heap (of course) 5 | * in SRAM, but offsets the sections by enough space to store the 6 | * Maple bootloader, which uses low memory. 7 | */ 8 | 9 | /* 10 | * This pulls in the appropriate MEMORY declaration from the right 11 | * subdirectory of stm32/mem/ (the environment must call ld with the 12 | * right include directory flags to make this happen). Boards can also 13 | * use this file to use any of libmaple's memory-related hooks (like 14 | * where the heap should live). 15 | */ 16 | INCLUDE mem-ram.inc 17 | 18 | /* Provide memory region aliases for common.inc */ 19 | REGION_ALIAS("REGION_TEXT", ram); 20 | REGION_ALIAS("REGION_DATA", ram); 21 | REGION_ALIAS("REGION_BSS", ram); 22 | REGION_ALIAS("REGION_RODATA", ram); 23 | 24 | /* Let common.inc handle the real work. */ 25 | INCLUDE common.inc 26 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/ld/vector_symbols.inc: -------------------------------------------------------------------------------- 1 | EXTERN(__msp_init) 2 | EXTERN(__exc_reset) 3 | EXTERN(__exc_nmi) 4 | EXTERN(__exc_hardfault) 5 | EXTERN(__exc_memmanage) 6 | EXTERN(__exc_busfault) 7 | EXTERN(__exc_usagefault) 8 | EXTERN(__stm32reservedexception7) 9 | EXTERN(__stm32reservedexception8) 10 | EXTERN(__stm32reservedexception9) 11 | EXTERN(__stm32reservedexception10) 12 | EXTERN(__exc_svc) 13 | EXTERN(__exc_debug_monitor) 14 | EXTERN(__stm32reservedexception13) 15 | EXTERN(__exc_pendsv) 16 | EXTERN(__exc_systick) 17 | 18 | EXTERN(__irq_wwdg) 19 | EXTERN(__irq_pvd) 20 | EXTERN(__irq_tamper) 21 | EXTERN(__irq_rtc) 22 | EXTERN(__irq_flash) 23 | EXTERN(__irq_rcc) 24 | EXTERN(__irq_exti0) 25 | EXTERN(__irq_exti1) 26 | EXTERN(__irq_exti2) 27 | EXTERN(__irq_exti3) 28 | EXTERN(__irq_exti4) 29 | EXTERN(__irq_dma1_channel1) 30 | EXTERN(__irq_dma1_channel2) 31 | EXTERN(__irq_dma1_channel3) 32 | EXTERN(__irq_dma1_channel4) 33 | EXTERN(__irq_dma1_channel5) 34 | EXTERN(__irq_dma1_channel6) 35 | EXTERN(__irq_dma1_channel7) 36 | EXTERN(__irq_adc) 37 | EXTERN(__irq_usb_hp_can_tx) 38 | EXTERN(__irq_usb_lp_can_rx0) 39 | EXTERN(__irq_can_rx1) 40 | EXTERN(__irq_can_sce) 41 | EXTERN(__irq_exti9_5) 42 | EXTERN(__irq_tim1_brk) 43 | EXTERN(__irq_tim1_up) 44 | EXTERN(__irq_tim1_trg_com) 45 | EXTERN(__irq_tim1_cc) 46 | EXTERN(__irq_tim2) 47 | EXTERN(__irq_tim3) 48 | EXTERN(__irq_tim4) 49 | EXTERN(__irq_i2c1_ev) 50 | EXTERN(__irq_i2c1_er) 51 | EXTERN(__irq_i2c2_ev) 52 | EXTERN(__irq_i2c2_er) 53 | EXTERN(__irq_spi1) 54 | EXTERN(__irq_spi2) 55 | EXTERN(__irq_usart1) 56 | EXTERN(__irq_usart2) 57 | EXTERN(__irq_usart3) 58 | EXTERN(__irq_exti15_10) 59 | EXTERN(__irq_rtcalarm) 60 | EXTERN(__irq_usbwakeup) 61 | 62 | EXTERN(__irq_tim8_brk) 63 | EXTERN(__irq_tim8_up) 64 | EXTERN(__irq_tim8_trg_com) 65 | EXTERN(__irq_tim8_cc) 66 | EXTERN(__irq_adc3) 67 | EXTERN(__irq_fsmc) 68 | EXTERN(__irq_sdio) 69 | EXTERN(__irq_tim5) 70 | EXTERN(__irq_spi3) 71 | EXTERN(__irq_uart4) 72 | EXTERN(__irq_uart5) 73 | EXTERN(__irq_tim6) 74 | EXTERN(__irq_tim7) 75 | EXTERN(__irq_dma2_channel1) 76 | EXTERN(__irq_dma2_channel2) 77 | EXTERN(__irq_dma2_channel3) 78 | EXTERN(__irq_dma2_channel4_5) 79 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/exti_f1.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | #include 28 | #include "exti_private.h" 29 | 30 | void exti_select(exti_num num, exti_cfg port) { 31 | exti_do_select(&AFIO_BASE->EXTICR1 + num / 4, num, port); 32 | } 33 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/flash.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/flash.c 30 | * @brief Flash management functions 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /** 37 | * @brief Set flash wait states 38 | * 39 | * Note that not all wait states are available on every MCU. See the 40 | * Flash programming manual for your MCU for restrictions on the 41 | * allowed value of wait_states for a given system clock (SYSCLK) 42 | * frequency. 43 | * 44 | * @param wait_states number of wait states (one of 45 | * FLASH_WAIT_STATE_0, FLASH_WAIT_STATE_1, 46 | * ..., FLASH_WAIT_STATE_7). 47 | */ 48 | void flash_set_latency(uint32 wait_states) { 49 | uint32 val = FLASH_BASE->ACR; 50 | 51 | val &= ~FLASH_ACR_LATENCY; 52 | val |= wait_states; 53 | 54 | FLASH_BASE->ACR = val; 55 | } 56 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/gpio.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Perry Hung. 5 | * Copyright (c) 2011, 2012 LeafLabs, LLC. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, copy, 11 | * modify, merge, publish, distribute, sublicense, and/or sell copies 12 | * of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | *****************************************************************************/ 27 | 28 | /** 29 | * @file libmaple/gpio.c 30 | * @brief Generic STM32 GPIO support. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | /* 37 | * GPIO routines 38 | */ 39 | 40 | /** 41 | * Initialize a GPIO device. 42 | * 43 | * Enables the clock for and resets the given device. 44 | * 45 | * @param dev GPIO device to initialize. 46 | */ 47 | void gpio_init(gpio_dev *dev) { 48 | rcc_clk_enable(dev->clk_id); 49 | rcc_reset_dev(dev->clk_id); 50 | } 51 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/iwdg.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2010 Michael Hope. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/iwdg.c 29 | * @brief Independent watchdog (IWDG) support 30 | */ 31 | 32 | #include 33 | 34 | /** 35 | * @brief Initialise and start the watchdog 36 | * 37 | * The prescaler and reload set the timeout. For example, a prescaler 38 | * of IWDG_PRE_32 divides the 40 kHz clock by 32 and gives roughly 1 39 | * ms per reload. 40 | * 41 | * @param prescaler Prescaler for the 40 kHz IWDG clock. 42 | * @param reload Independent watchdog counter reload value. 43 | */ 44 | void iwdg_init(iwdg_prescaler prescaler, uint16 reload) { 45 | IWDG_BASE->KR = IWDG_KR_UNLOCK; 46 | IWDG_BASE->PR = prescaler; 47 | IWDG_BASE->RLR = reload; 48 | 49 | /* Start things off */ 50 | IWDG_BASE->KR = IWDG_KR_START; 51 | iwdg_feed(); 52 | } 53 | 54 | /** 55 | * @brief Reset the IWDG counter. 56 | * 57 | * Calling this function will cause the IWDG counter to be reset to 58 | * its reload value. 59 | */ 60 | void iwdg_feed(void) { 61 | IWDG_BASE->KR = IWDG_KR_FEED; 62 | } 63 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/pwr.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/pwr.c 29 | * @brief Power control (PWR) support. 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | /** 36 | * Enables the power interface clock, and resets the power device. 37 | */ 38 | void pwr_init(void) { 39 | rcc_clk_enable(RCC_PWR); 40 | rcc_reset_dev(RCC_PWR); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/usart_private.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2012 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /** 28 | * @file libmaple/usart_private.c 29 | * @author Marti Bolivar 30 | * @brief Private USART routines. 31 | */ 32 | 33 | #include "usart_private.h" 34 | #include 35 | #include 36 | 37 | uint32 _usart_clock_freq(usart_dev *dev) { 38 | rcc_clk_domain domain = rcc_dev_clk(dev->clk_id); 39 | return (domain == RCC_APB1 ? STM32_PCLK1 : 40 | (domain == RCC_APB2 ? STM32_PCLK2 : 0)); 41 | } 42 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/libmaple/usb/rules.mk: -------------------------------------------------------------------------------- 1 | # Standard things 2 | sp := $(sp).x 3 | dirstack_$(sp) := $(d) 4 | d := $(dir) 5 | BUILDDIRS += $(BUILD_PATH)/$(d) 6 | 7 | # Local flags 8 | CFLAGS_$(d) = -I$(d) -I$(d)/$(MCU_SERIES) -I$(d)/usb_lib $(LIBMAPLE_INCLUDES) $(LIBMAPLE_PRIVATE_INCLUDES) -Wall 9 | 10 | # Add usblib and series subdirectory to BUILDDIRS. 11 | BUILDDIRS += $(BUILD_PATH)/$(d)/$(MCU_SERIES) 12 | BUILDDIRS += $(BUILD_PATH)/$(d)/usb_lib 13 | 14 | # Local rules and targets 15 | sSRCS_$(d) := 16 | cSRCS_$(d) := 17 | # We currently only have F1 performance line support. Sigh. 18 | ifeq ($(MCU_SERIES), stm32f1) 19 | ifeq ($(MCU_F1_LINE), performance) 20 | cSRCS_$(d) += $(MCU_SERIES)/usb.c 21 | cSRCS_$(d) += $(MCU_SERIES)/usb_reg_map.c 22 | cSRCS_$(d) += $(MCU_SERIES)/usb_cdcacm.c 23 | cSRCS_$(d) += usb_lib/usb_core.c 24 | cSRCS_$(d) += usb_lib/usb_init.c 25 | cSRCS_$(d) += usb_lib/usb_mem.c 26 | cSRCS_$(d) += usb_lib/usb_regs.c 27 | endif 28 | endif 29 | 30 | sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) 31 | cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) 32 | 33 | OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ 34 | $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) 35 | DEPS_$(d) := $(OBJS_$(d):%.o=%.d) 36 | 37 | $(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) 38 | $(OBJS_$(d)): TGT_ASFLAGS := 39 | 40 | TGT_BIN += $(OBJS_$(d)) 41 | 42 | # Standard things 43 | -include $(DEPS_$(d)) 44 | d := $(dirstack_$(sp)) 45 | sp := $(basename $(sp)) 46 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/Maple/variants/maple_mini/wirish/start.S: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * 4 | * Copyright (c) 2011 LeafLabs, LLC. 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, copy, 10 | * modify, merge, publish, distribute, sublicense, and/or sell copies 11 | * of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | * SOFTWARE. 25 | *****************************************************************************/ 26 | 27 | /* 28 | * This file is a modified version of a file obtained from 29 | * CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the 30 | * following text appeared: 31 | * 32 | * The authors hereby grant permission to use, copy, modify, distribute, 33 | * and license this software and its documentation for any purpose, provided 34 | * that existing copyright notices are retained in all copies and that this 35 | * notice is included verbatim in any distributions. No written agreement, 36 | * license, or royalty fee is required for any of the authorized uses. 37 | * Modifications to this software may be copyrighted by their authors 38 | * and need not follow the licensing terms described here, provided that 39 | * the new terms are clearly indicated on the first page of each file where 40 | * they apply. 41 | */ 42 | 43 | .text 44 | .code 16 45 | .thumb_func 46 | 47 | .globl __start__ 48 | .type __start__, %function 49 | __start__: 50 | .fnstart 51 | ldr r1,=__msp_init 52 | mov sp,r1 53 | ldr r1,=start_c 54 | bx r1 55 | .pool 56 | .cantunwind 57 | .fnend 58 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/Maple_003.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/Maple_003.inf -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/amd64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/amd64/libusb0.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/amd64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/amd64/libusb0.sys -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/ia64/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/ia64/libusb0.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/ia64/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/ia64/libusb0.sys -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/installer_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/installer_x64.exe -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/installer_x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/installer_x86.exe -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/x86/libusb0.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/x86/libusb0.sys -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/maple-dfu/x86/libusb0_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/maple-dfu/x86/libusb0_x86.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/serial/maple_serial.inf: -------------------------------------------------------------------------------- 1 | ; 2 | ; STMicroelectronics Comunication Device Class driver instalation file 3 | ; (C)2006 Copyright STMicroelectronics 4 | ; 5 | 6 | [Version] 7 | Signature="$Windows NT$" 8 | Class=Ports 9 | ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} 10 | Provider=%STM% 11 | LayoutFile=layout.inf 12 | 13 | [Manufacturer] 14 | %MFGNAME%=VirComDevice,NT,NTamd64 15 | 16 | [DestinationDirs] 17 | DefaultDestDir = 12 18 | 19 | [VirComDevice.NT] 20 | %DESCRIPTION%=DriverInstall,USB\VID_1EAF&PID_0004 21 | %DESCRIPTION%=DriverInstall,USB\VID_1EAF&PID_0004 22 | 23 | [VirComDevice.NTamd64] 24 | %DESCRIPTION%=DriverInstall,USB\VID_1EAF&PID_0004 25 | %DESCRIPTION%=DriverInstall,USB\VID_1EAF&PID_0004 26 | 27 | [DriverInstall.NT] 28 | Include=mdmcpq.inf 29 | CopyFiles=FakeModemCopyFileSection 30 | AddReg=DriverInstall.NT.AddReg 31 | 32 | [DriverInstall.NT.AddReg] 33 | HKR,,DevLoader,,*ntkern 34 | HKR,,NTMPDriver,,usbser.sys 35 | HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 36 | 37 | [DriverInstall.NT.Services] 38 | AddService=usbser, 0x00000002, DriverServiceInst 39 | 40 | [DriverServiceInst] 41 | DisplayName=%SERVICE% 42 | ServiceType=1 43 | StartType=3 44 | ErrorControl=1 45 | ServiceBinary=%12%\usbser.sys 46 | 47 | ;------------------------------------------------------------------------------ 48 | ; String Definitions 49 | ;------------------------------------------------------------------------------ 50 | 51 | 52 | [Strings] 53 | STM = "LeafLabs" 54 | MFGNAME = "LeafLabs" 55 | DESCRIPTION = "Maple R3" 56 | SERVICE = "USB Virtual COM port" 57 | -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/serial/msports.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/serial/msports.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/serial/serenum.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/serial/serenum.sys -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/drivers/win/serial/usbser.sys: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/drivers/win/serial/usbser.sys -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/cygiconv-2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/cygiconv-2.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/cygwin1.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/dfu-util.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/dfu-util.exe -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/lib/jssc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/lib/jssc.jar -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/libusb0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/libusb0.dll -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/maple_loader.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/Arduino/hardware/maple-asp/tools/win/maple_loader.jar -------------------------------------------------------------------------------- /Arduino/hardware/maple-asp/tools/win/maple_upload.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem 4 | rem 5 | rem parameters are: 6 | 7 | rem Note: %~dp0 get path of this batch file, so path parameter is no longer required 8 | 9 | cd %~dp0 10 | java -jar maple_loader.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Arduino Support Package For Maple 2 | ================================= 3 | 4 | Background 5 | ---------- 6 | 7 | Maple is a series of Arduino like boards created by LeafLabs (http://www.leaflabs.com/). 8 | LeafLabs provided a version of the Arduino IDE tailored for Maple https://github.com/leaflabs/maple-ide 9 | but it is no longer supported, and uses an old version of the Arduino IDE. 10 | 11 | maple-asp provides support for Maple compatible boards for use with the "new" Arduino IDE 1.5.x, without requiring 12 | any modifications to the Arduino IDE. 13 | The bulk of maple-asp is the libmaple code https://github.com/leaflabs/libmaple, in the form of an Arduino add on package. 14 | 15 | maple-asp 16 | --------- 17 | 18 | Currently the following boards are supported: 19 | 20 | - Maple Rev 3+ 21 | 22 | 23 | Installing 24 | ---------- 25 | 26 | Pre-requisites: 27 | 28 | - Arduino IDE version 1.5.7 or later 29 | 30 | Installation procedure: 31 | 32 | 1. Copy the Arduino/hardware/ folder to your sketchbook folder (e.g. ~/Arduino) 33 | 2. Restart Arduino IDE 34 | 35 | Note: maple-asp is designed to be installed into your sketchbook, not the Arduino program folder, otherwise 36 | it will not work properly. 37 | 38 | TODO 39 | ---- 40 | 41 | - Implement all the board/memory variants 42 | - create wrapper utility for DFU download 43 | - support for linux 44 | - build and test examples 45 | 46 | Licenses 47 | -------- 48 | 49 | maple-asp is an Open Source project. 50 | 51 | libmaple is mostly licensed with MIT license. 52 | 53 | Other files are licensed as GPL or BSD. 54 | 55 | Please see individual files for Copyright notices. 56 | 57 | Main Contributors 58 | ----------------- 59 | 60 | - LeafLabs (maple-ide, libmaple) 61 | - Bob Cousins 62 | -------------------------------------------------------------------------------- /installer/maple_loader/build/built-jar.properties: -------------------------------------------------------------------------------- 1 | #Sat, 18 Oct 2014 13:33:13 +0100 2 | 3 | 4 | C\:\\Users\\bob\\Documents\\NetBeansProjects\\maple_loader= 5 | -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/CliTemplate/CliMain.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/CliTemplate/CliMain.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/CliTemplate/DFUUploader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/CliTemplate/DFUUploader.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/CliTemplate/ExecCommand.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/CliTemplate/ExecCommand.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/Base.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/Base.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/Preferences.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/Preferences.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/Serial.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/Serial.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/SerialException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/SerialException.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/debug/MessageConsumer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/debug/MessageConsumer.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/debug/MessageSiphon.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/debug/MessageSiphon.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/debug/RunnerException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/debug/RunnerException.class -------------------------------------------------------------------------------- /installer/maple_loader/build/classes/processing/app/helpers/ProcessUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/build/classes/processing/app/helpers/ProcessUtils.class -------------------------------------------------------------------------------- /installer/maple_loader/dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "maple_loader.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /installer/maple_loader/dist/lib/jssc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/dist/lib/jssc.jar -------------------------------------------------------------------------------- /installer/maple_loader/dist/maple_loader.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/dist/maple_loader.jar -------------------------------------------------------------------------------- /installer/maple_loader/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=9194ed84 2 | build.xml.script.CRC32=4676ee6b 3 | build.xml.stylesheet.CRC32=8064a381@1.74.2.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=9194ed84 7 | nbproject/build-impl.xml.script.CRC32=70594474 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.2.48 9 | -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/private/config.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bobc/maple-asp/b3b57daa42133f0038e6269c09f837edd907ef45/installer/maple_loader/nbproject/private/config.properties -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | do.depend=false 3 | do.jar=true 4 | javac.debug=true 5 | javadoc.preview=true 6 | user.properties.file=C:\\Users\\bob\\AppData\\Roaming\\NetBeans\\8.0\\build.properties 7 | -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/C:/Users/bob/Documents/NetBeansProjects/maple_loader/src/CliTemplate/DFUUploader.java 7 | file:/C:/Users/bob/Documents/NetBeansProjects/maple_loader/src/CliTemplate/ExecCommand.java 8 | file:/C:/Users/bob/Documents/NetBeansProjects/maple_loader/src/CliTemplate/CliMain.java 9 | file:/C:/Users/bob/Documents/NetBeansProjects/maple_loader/src/processing/app/Preferences.java 10 | file:/C:/Users/bob/Documents/NetBeansProjects/maple_loader/src/processing/app/Serial.java 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processors.list= 4 | annotation.processing.run.all.processors=true 5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 6 | application.title=maple_loader 7 | application.vendor=bob 8 | build.classes.dir=${build.dir}/classes 9 | build.classes.excludes=**/*.java,**/*.form 10 | # This directory is removed when the project is cleaned: 11 | build.dir=build 12 | build.generated.dir=${build.dir}/generated 13 | build.generated.sources.dir=${build.dir}/generated-sources 14 | # Only compile against the classpath explicitly listed here: 15 | build.sysclasspath=ignore 16 | build.test.classes.dir=${build.dir}/test/classes 17 | build.test.results.dir=${build.dir}/test/results 18 | # Uncomment to specify the preferred debugger connection transport: 19 | #debug.transport=dt_socket 20 | debug.classpath=\ 21 | ${run.classpath} 22 | debug.test.classpath=\ 23 | ${run.test.classpath} 24 | # Files in build.classes.dir which should be excluded from distribution jar 25 | dist.archive.excludes= 26 | # This directory is removed when the project is cleaned: 27 | dist.dir=dist 28 | dist.jar=${dist.dir}/maple_loader.jar 29 | dist.javadoc.dir=${dist.dir}/javadoc 30 | endorsed.classpath= 31 | excludes= 32 | includes=** 33 | jar.compress=false 34 | javac.classpath=\ 35 | ${libs.JSSC-2.8.0.classpath} 36 | # Space-separated list of extra javac options 37 | javac.compilerargs= 38 | javac.deprecation=false 39 | javac.processorpath=\ 40 | ${javac.classpath} 41 | javac.source=1.7 42 | javac.target=1.7 43 | javac.test.classpath=\ 44 | ${javac.classpath}:\ 45 | ${build.classes.dir} 46 | javac.test.processorpath=\ 47 | ${javac.test.classpath} 48 | javadoc.additionalparam= 49 | javadoc.author=false 50 | javadoc.encoding=${source.encoding} 51 | javadoc.noindex=false 52 | javadoc.nonavbar=false 53 | javadoc.notree=false 54 | javadoc.private=false 55 | javadoc.splitindex=true 56 | javadoc.use=true 57 | javadoc.version=false 58 | javadoc.windowtitle= 59 | main.class=CliTemplate.CliMain 60 | manifest.file=manifest.mf 61 | meta.inf.dir=${src.dir}/META-INF 62 | mkdist.disabled=false 63 | platform.active=JDK_1.7 64 | run.classpath=\ 65 | ${javac.classpath}:\ 66 | ${build.classes.dir} 67 | # Space-separated list of JVM arguments used when running the project. 68 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 69 | # To set system properties for unit tests define test-sys-prop.name=value: 70 | run.jvmargs= 71 | run.test.classpath=\ 72 | ${javac.test.classpath}:\ 73 | ${build.test.classes.dir} 74 | source.encoding=UTF-8 75 | src.dir=src 76 | test.src.dir=test 77 | -------------------------------------------------------------------------------- /installer/maple_loader/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | maple_loader 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /installer/maple_loader/src/CliTemplate/CliMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package CliTemplate; 7 | 8 | import java.io.IOException; 9 | import java.text.MessageFormat; 10 | import java.util.ArrayList; 11 | import java.util.Arrays; 12 | import java.util.List; 13 | import processing.app.Preferences; 14 | 15 | //import processing.app.I18n; 16 | import processing.app.helpers.ProcessUtils; 17 | 18 | /** 19 | * 20 | * @author cousinr 21 | */ 22 | public class CliMain { 23 | 24 | 25 | /** 26 | * @param args the command line arguments 27 | */ 28 | public static void main(String[] args) { 29 | 30 | String comPort = args[0]; // 31 | String altIf = args[1]; // 32 | String usbID = args[2]; // "1EAF:0003"; 33 | String binFile = args[3]; // bin file 34 | 35 | System.out.println("maple_loader v0.1"); 36 | 37 | Preferences.set ("serial.port",comPort); 38 | Preferences.set ("serial.parity","N"); 39 | Preferences.setInteger ("serial.databits", 8); 40 | Preferences.setInteger ("serial.debug_rate",9600); 41 | Preferences.setInteger ("serial.stopbits",1); 42 | 43 | Preferences.setInteger ("programDelay",1200); 44 | 45 | Preferences.set ("upload.usbID", usbID); 46 | Preferences.set ("upload.altID", altIf); 47 | Preferences.setBoolean ("upload.auto_reset", true); 48 | Preferences.setBoolean ("upload.verbose", false); 49 | 50 | // 51 | DFUUploader dfuUploader = new DFUUploader(); 52 | try { 53 | //dfuUploader.uploadViaDFU(binFile); 54 | dfuUploader.uploadViaDFU(binFile); 55 | } catch (Exception e) 56 | { 57 | System.err.print (MessageFormat.format("an error occurred! {0}\n", e.getMessage())); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /installer/maple_loader/src/processing/app/Base.java: -------------------------------------------------------------------------------- 1 | /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Processing project - http://processing.org 5 | 6 | Copyright (c) 2004-10 Ben Fry and Casey Reas 7 | Copyright (c) 2001-04 Massachusetts Institute of Technology 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License version 2 11 | as published by the Free Software Foundation. 12 | 13 | This program is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | GNU General Public License for more details. 17 | 18 | You should have received a copy of the GNU General Public License 19 | along with this program; if not, write to the Free Software Foundation, 20 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | package processing.app; 24 | 25 | 26 | /** 27 | * The base class for the main processing application. 28 | * Primary role of this class is for platform identification and 29 | * general interaction with the system (launching URLs, loading 30 | * files and images, etc) that comes from that. 31 | */ 32 | public class Base { 33 | 34 | /** 35 | * returns true if running on windows. 36 | */ 37 | static public boolean isWindows() { 38 | //return PApplet.platform == PConstants.WINDOWS; 39 | return System.getProperty("os.name").indexOf("Windows") != -1; 40 | } 41 | 42 | 43 | /** 44 | * true if running on linux. 45 | */ 46 | static public boolean isLinux() { 47 | //return PApplet.platform == PConstants.LINUX; 48 | return System.getProperty("os.name").indexOf("Linux") != -1; 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /installer/maple_loader/src/processing/app/SerialException.java: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Copyright (c) 2007 David A. Mellis 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program; if not, write to the Free Software Foundation, 18 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | package processing.app; 22 | 23 | public class SerialException extends Exception { 24 | public SerialException() { 25 | super(); 26 | } 27 | 28 | public SerialException(String message) { 29 | super(message); 30 | } 31 | 32 | public SerialException(String message, Throwable cause) { 33 | super(message, cause); 34 | } 35 | 36 | public SerialException(Throwable cause) { 37 | super(cause); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /installer/maple_loader/src/processing/app/debug/MessageConsumer.java: -------------------------------------------------------------------------------- 1 | /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Processing project - http://processing.org 5 | 6 | Copyright (c) 2004-06 Ben Fry and Casey Reas 7 | Copyright (c) 2001-04 Massachusetts Institute of Technology 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software Foundation, 21 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | */ 23 | 24 | package processing.app.debug; 25 | 26 | 27 | /** 28 | * Interface for dealing with parser/compiler output. 29 | *

30 | * Different instances of MessageStream need to do different things with 31 | * messages. In particular, a stream instance used for parsing output from 32 | * the compiler compiler has to interpret its messages differently than one 33 | * parsing output from the runtime. 34 | *

35 | * Classes which consume messages and do something with them 36 | * should implement this interface. 37 | */ 38 | public interface MessageConsumer { 39 | 40 | public void message(String s); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /installer/maple_loader/src/processing/app/helpers/ProcessUtils.java: -------------------------------------------------------------------------------- 1 | package processing.app.helpers; 2 | 3 | //import processing.app.Base; 4 | 5 | import java.io.IOException; 6 | import java.util.Map; 7 | 8 | import processing.app.Base; 9 | 10 | public class ProcessUtils { 11 | 12 | public static Process exec(String[] command) throws IOException { 13 | // No problems on linux and mac 14 | if (!Base.isWindows()) { 15 | return Runtime.getRuntime().exec(command); 16 | } 17 | 18 | // Brutal hack to workaround windows command line parsing. 19 | // http://stackoverflow.com/questions/5969724/java-runtime-exec-fails-to-escape-characters-properly 20 | // http://msdn.microsoft.com/en-us/library/a1y7w461.aspx 21 | // http://bugs.sun.com/view_bug.do?bug_id=6468220 22 | // http://bugs.sun.com/view_bug.do?bug_id=6518827 23 | String[] cmdLine = new String[command.length]; 24 | for (int i = 0; i < command.length; i++) 25 | cmdLine[i] = command[i].replace("\"", "\\\""); 26 | 27 | ProcessBuilder pb = new ProcessBuilder(cmdLine); 28 | Map env = pb.environment(); 29 | env.put("CYGWIN", "nodosfilewarning"); 30 | return pb.start(); 31 | } 32 | } 33 | --------------------------------------------------------------------------------