Merge remote-tracking branch 'refs/remotes/rogerclarkmelbourne/master'
This commit is contained in:
commit
055db5a2c6
|
@ -1,2 +0,0 @@
|
||||||
old.0.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
|
||||||
new.0.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
|
|
@ -14,7 +14,7 @@ compiler.warning_flags.all=-Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL
|
||||||
|
|
||||||
# compiler variables
|
# compiler variables
|
||||||
# ----------------------
|
# ----------------------
|
||||||
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||||
compiler.c.cmd=arm-none-eabi-gcc
|
compiler.c.cmd=arm-none-eabi-gcc
|
||||||
compiler.c.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
compiler.c.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||||
compiler.c.elf.cmd=arm-none-eabi-g++
|
compiler.c.elf.cmd=arm-none-eabi-g++
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# STM32 Boards
|
# STM32 Boards
|
||||||
|
|
||||||
|
|
||||||
menu.device_variant=Variant
|
menu.device_variant=Variant
|
||||||
menu.bootloader_version=Bootloader version
|
menu.bootloader_version=Bootloader version
|
||||||
menu.upload_method=Upload method
|
menu.upload_method=Upload method
|
||||||
|
@ -50,15 +49,13 @@ maple.upload.usbID=1EAF:0003
|
||||||
maple.upload.altID=1
|
maple.upload.altID=1
|
||||||
maple.upload.auto_reset=true
|
maple.upload.auto_reset=true
|
||||||
|
|
||||||
|
|
||||||
maple.build.board=MAPLE_REV3
|
maple.build.board=MAPLE_REV3
|
||||||
maple.build.core=maple
|
maple.build.core=maple
|
||||||
maple.build.cpu_flags=-DMCU_STM32F103RB -DSERIAL_USB
|
maple.build.cpu_flags=-DMCU_STM32F103RB -DSERIAL_USB
|
||||||
maple.build.ldscript=ld/flash.ld
|
maple.build.ldscript=ld/flash.ld
|
||||||
maple.build.variant=maple
|
maple.build.variant=maple
|
||||||
maple.build.vect=VECT_TAB_ADDR=0x8005000
|
maple.build.vect=VECT_TAB_ADDR=0x8005000
|
||||||
|
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
mapleRET6.name=Maple (RET6)
|
mapleRET6.name=Maple (RET6)
|
||||||
|
|
||||||
|
@ -81,7 +78,6 @@ mapleRET6.upload.usbID=1EAF:0003
|
||||||
mapleRET6.upload.altID=1
|
mapleRET6.upload.altID=1
|
||||||
mapleRET6.upload.auto_reset=true
|
mapleRET6.upload.auto_reset=true
|
||||||
|
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
|
|
||||||
microduino32_flash.name=Microduino Core STM32 to Flash
|
microduino32_flash.name=Microduino Core STM32 to Flash
|
||||||
|
@ -97,12 +93,11 @@ microduino32_flash.upload.usbID=1EAF:0003
|
||||||
microduino32_flash.upload.altID=1
|
microduino32_flash.upload.altID=1
|
||||||
microduino32_flash.upload.auto_reset=true
|
microduino32_flash.upload.auto_reset=true
|
||||||
|
|
||||||
|
|
||||||
microduino32_flash.build.mcu=cortex-m3
|
microduino32_flash.build.mcu=cortex-m3
|
||||||
microduino32_flash.build.f_cpu=72000000L
|
microduino32_flash.build.f_cpu=72000000L
|
||||||
microduino32_flash.build.board=MICRODUINO_CORE_STM32
|
microduino32_flash.build.board=MICRODUINO_CORE_STM32
|
||||||
microduino32_flash.build.core=maple
|
microduino32_flash.build.core=maple
|
||||||
microduino32_flash.build.extra_flags=-DMCU_STM32F103CB -mthumb -DSERIAL_USB -march=armv7-m -D__STM32F1__
|
microduino32_flash.build.extra_flags=-DMCU_STM32F103CB -mthumb -DSERIAL_USB -march=armv7-m -D__STM32F1__
|
||||||
microduino32_flash.build.ldscript=ld/flash.ld
|
microduino32_flash.build.ldscript=ld/flash.ld
|
||||||
microduino32_flash.build.variant=microduino
|
microduino32_flash.build.variant=microduino
|
||||||
microduino32_flash.build.variant_system_lib=libmaple.a
|
microduino32_flash.build.variant_system_lib=libmaple.a
|
||||||
|
@ -133,7 +128,7 @@ nucleo_f103rb.build.mcu=cortex-m3
|
||||||
nucleo_f103rb.build.f_cpu=72000000L
|
nucleo_f103rb.build.f_cpu=72000000L
|
||||||
nucleo_f103rb.build.board=STM_NUCLEU_F103RB
|
nucleo_f103rb.build.board=STM_NUCLEU_F103RB
|
||||||
nucleo_f103rb.build.core=maple
|
nucleo_f103rb.build.core=maple
|
||||||
nucleo_f103rb.build.extra_flags=-DMCU_STM32F103RB -mthumb -march=armv7-m -D__STM32F1__
|
nucleo_f103rb.build.extra_flags=-DMCU_STM32F103RB -mthumb -march=armv7-m -D__STM32F1__
|
||||||
nucleo_f103rb.build.ldscript=ld/jtag.ld
|
nucleo_f103rb.build.ldscript=ld/jtag.ld
|
||||||
nucleo_f103rb.build.variant=nucleo_f103rb
|
nucleo_f103rb.build.variant=nucleo_f103rb
|
||||||
nucleo_f103rb.build.variant_system_lib=libmaple.a
|
nucleo_f103rb.build.variant_system_lib=libmaple.a
|
||||||
|
@ -144,7 +139,7 @@ nucleo_f103rb.build.error_led_pin=1
|
||||||
nucleo_f103rb.build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
nucleo_f103rb.build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
||||||
nucleo_f103rb.build.vect=VECT_TAB_ADDR=0x8000000
|
nucleo_f103rb.build.vect=VECT_TAB_ADDR=0x8000000
|
||||||
|
|
||||||
###################### Generic STM32F103C ########################################
|
###################### Generic STM32F103C ########################################
|
||||||
|
|
||||||
genericSTM32F103C.name=Generic STM32F103C series
|
genericSTM32F103C.name=Generic STM32F103C series
|
||||||
genericSTM32F103C.build.variant=generic_stm32f103c
|
genericSTM32F103C.build.variant=generic_stm32f103c
|
||||||
|
@ -155,23 +150,22 @@ genericSTM32F103C.upload.use_1200bps_touch=false
|
||||||
genericSTM32F103C.upload.file_type=bin
|
genericSTM32F103C.upload.file_type=bin
|
||||||
genericSTM32F103C.upload.auto_reset=true
|
genericSTM32F103C.upload.auto_reset=true
|
||||||
|
|
||||||
## STM32F103CB -------------------------
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB=STM32F103CB (20k RAM. 128k Flash)
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB.build.cpu_flags=-DMCU_STM32F103CB
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB.build.ldscript=ld/jtag.ld
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.maximum_size=131072
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.ram.maximum_size=20480
|
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.flash.maximum_size=131072
|
|
||||||
|
|
||||||
|
|
||||||
## STM32F103C8 -------------------------
|
## STM32F103C8 -------------------------
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8=STM32F103C8 (20k RAM. 64k Flash)
|
genericSTM32F103C.menu.device_variant.STM32F103C8=STM32F103C8 (20k RAM. 64k Flash)
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8.build.cpu_flags=-DMCU_STM32F103C8
|
genericSTM32F103C.menu.device_variant.STM32F103C8.build.cpu_flags=-DMCU_STM32F103C8
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8.build.ldscript=ld/jtag_c8.ld
|
genericSTM32F103C.menu.device_variant.STM32F103C8.build.ldscript=ld/jtag_c8.ld
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.maximum_size=65536
|
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.maximum_size=65536
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.ram.maximum_size=20480
|
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.ram.maximum_size=20480
|
||||||
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.flash.maximum_size=65536
|
genericSTM32F103C.menu.device_variant.STM32F103C8.upload.flash.maximum_size=65536
|
||||||
|
|
||||||
|
## STM32F103CB -------------------------
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB=STM32F103CB (20k RAM. 128k Flash)
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB.build.cpu_flags=-DMCU_STM32F103CB
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB.build.ldscript=ld/jtag.ld
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.maximum_size=131072
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.ram.maximum_size=20480
|
||||||
|
genericSTM32F103C.menu.device_variant.STM32F103CB.upload.flash.maximum_size=131072
|
||||||
|
|
||||||
#---------------------------- UPLOAD METHODS ---------------------------
|
#---------------------------- UPLOAD METHODS ---------------------------
|
||||||
|
|
||||||
genericSTM32F103C.menu.upload_method.DFUUploadMethod=STM32duino bootloader
|
genericSTM32F103C.menu.upload_method.DFUUploadMethod=STM32duino bootloader
|
||||||
|
@ -193,14 +187,12 @@ genericSTM32F103C.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
||||||
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
||||||
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
|
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103C.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
|
genericSTM32F103C.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
|
||||||
genericSTM32F103C.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
genericSTM32F103C.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
||||||
genericSTM32F103C.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
genericSTM32F103C.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
||||||
genericSTM32F103C.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
genericSTM32F103C.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
||||||
|
|
||||||
|
########################### Generic STM32F103R ###########################
|
||||||
########################### Generic STM32F103R ###########################
|
|
||||||
|
|
||||||
genericSTM32F103R.name=Generic STM32F103R series
|
genericSTM32F103R.name=Generic STM32F103R series
|
||||||
#genericSTM32F103R.build.variant=generic_stm32f103r
|
#genericSTM32F103R.build.variant=generic_stm32f103r
|
||||||
|
@ -211,10 +203,9 @@ genericSTM32F103R.upload.use_1200bps_touch=false
|
||||||
genericSTM32F103R.upload.file_type=bin
|
genericSTM32F103R.upload.file_type=bin
|
||||||
genericSTM32F103R.upload.auto_reset=true
|
genericSTM32F103R.upload.auto_reset=true
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8=STM32F103R8 (20k RAM. 64k Flash)
|
genericSTM32F103R.menu.device_variant.STM32F103R8=STM32F103R8 (20k RAM. 64k Flash)
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8.build.variant=generic_stm32f103r8
|
genericSTM32F103R.menu.device_variant.STM32F103R8.build.variant=generic_stm32f103r8
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8.build.cpu_flags=-DMCU_STM32F103R8
|
genericSTM32F103R.menu.device_variant.STM32F103R8.build.cpu_flags=-DMCU_STM32F103R8
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.maximum_size=65536
|
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.maximum_size=65536
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.ram.maximum_size=20480
|
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.ram.maximum_size=20480
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.flash.maximum_size=65536
|
genericSTM32F103R.menu.device_variant.STM32F103R8.upload.flash.maximum_size=65536
|
||||||
|
@ -222,7 +213,7 @@ genericSTM32F103R.menu.device_variant.STM32F103R8.build.ldscript=ld/stm32f103r8.
|
||||||
|
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB=STM32F103RB (20k RAM. 128k Flash)
|
genericSTM32F103R.menu.device_variant.STM32F103RB=STM32F103RB (20k RAM. 128k Flash)
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB.build.variant=generic_stm32f103r8
|
genericSTM32F103R.menu.device_variant.STM32F103RB.build.variant=generic_stm32f103r8
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB.build.cpu_flags=-DMCU_STM32F103RB
|
genericSTM32F103R.menu.device_variant.STM32F103RB.build.cpu_flags=-DMCU_STM32F103RB
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.maximum_size=131072
|
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.maximum_size=131072
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.ram.maximum_size=20480
|
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.ram.maximum_size=20480
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.flash.maximum_size=131072
|
genericSTM32F103R.menu.device_variant.STM32F103RB.upload.flash.maximum_size=131072
|
||||||
|
@ -230,7 +221,7 @@ genericSTM32F103R.menu.device_variant.STM32F103RB.build.ldscript=ld/stm32f103rb.
|
||||||
|
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC=STM32F103RC (48k RAM. 256k Flash)
|
genericSTM32F103R.menu.device_variant.STM32F103RC=STM32F103RC (48k RAM. 256k Flash)
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC.build.variant=generic_stm32f103r
|
genericSTM32F103R.menu.device_variant.STM32F103RC.build.variant=generic_stm32f103r
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC.build.cpu_flags=-DMCU_STM32F103RC
|
genericSTM32F103R.menu.device_variant.STM32F103RC.build.cpu_flags=-DMCU_STM32F103RC
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.maximum_size=262144
|
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.maximum_size=262144
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.ram.maximum_size=49152
|
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.ram.maximum_size=49152
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.flash.maximum_size=262144
|
genericSTM32F103R.menu.device_variant.STM32F103RC.upload.flash.maximum_size=262144
|
||||||
|
@ -238,13 +229,12 @@ genericSTM32F103R.menu.device_variant.STM32F103RC.build.ldscript=ld/stm32f103rc.
|
||||||
|
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE=STM32F103RE (64k RAM. 512k Flash)
|
genericSTM32F103R.menu.device_variant.STM32F103RE=STM32F103RE (64k RAM. 512k Flash)
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.build.variant=generic_stm32f103r
|
genericSTM32F103R.menu.device_variant.STM32F103RE.build.variant=generic_stm32f103r
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.build.cpu_flags=-DMCU_STM32F103RE
|
genericSTM32F103R.menu.device_variant.STM32F103RE.build.cpu_flags=-DMCU_STM32F103RE
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.maximum_size=524288
|
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.maximum_size=524288
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.ram.maximum_size=65536
|
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.ram.maximum_size=65536
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.flash.maximum_size=524288
|
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.flash.maximum_size=524288
|
||||||
genericSTM32F103R.menu.device_variant.STM32F103RE.build.ldscript=ld/stm32f103re.ld
|
genericSTM32F103R.menu.device_variant.STM32F103RE.build.ldscript=ld/stm32f103re.ld
|
||||||
|
|
||||||
|
|
||||||
#---------------------------- UPLOAD METHODS ---------------------------
|
#---------------------------- UPLOAD METHODS ---------------------------
|
||||||
|
|
||||||
genericSTM32F103R.menu.upload_method.DFUUploadMethod=STM32duino bootloader
|
genericSTM32F103R.menu.upload_method.DFUUploadMethod=STM32duino bootloader
|
||||||
|
@ -260,7 +250,6 @@ genericSTM32F103R.menu.upload_method.serialMethod=Serial
|
||||||
genericSTM32F103R.menu.upload_method.serialMethod.upload.protocol=maple_serial
|
genericSTM32F103R.menu.upload_method.serialMethod.upload.protocol=maple_serial
|
||||||
genericSTM32F103R.menu.upload_method.serialMethod.upload.tool=serial_upload
|
genericSTM32F103R.menu.upload_method.serialMethod.upload.tool=serial_upload
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103R.menu.upload_method.STLinkMethod=STLink
|
genericSTM32F103R.menu.upload_method.STLinkMethod=STLink
|
||||||
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
||||||
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
||||||
|
@ -271,6 +260,57 @@ genericSTM32F103R.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
||||||
genericSTM32F103R.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
genericSTM32F103R.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
||||||
genericSTM32F103R.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
genericSTM32F103R.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
||||||
|
|
||||||
|
###################### Generic STM32F103T ########################################
|
||||||
|
|
||||||
|
genericSTM32F103T.name=Generic STM32F103T series
|
||||||
|
genericSTM32F103T.build.variant=generic_stm32f103t
|
||||||
|
genericSTM32F103T.build.vect=VECT_TAB_ADDR=0x8000000
|
||||||
|
genericSTM32F103T.build.core=maple
|
||||||
|
genericSTM32F103T.build.board=GENERIC_STM32F103T
|
||||||
|
genericSTM32F103T.upload.use_1200bps_touch=false
|
||||||
|
genericSTM32F103T.upload.file_type=bin
|
||||||
|
genericSTM32F103T.upload.auto_reset=true
|
||||||
|
|
||||||
|
## STM32F103T8 -------------------------
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8=STM32F103T8 (20k RAM. 64k Flash)
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8.build.cpu_flags=-DMCU_STM32F103T8
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8.build.ldscript=ld/jtag_t8.ld
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.maximum_size=65536
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.ram.maximum_size=20480
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103T8.upload.flash.maximum_size=65536
|
||||||
|
|
||||||
|
## STM32F103TB -------------------------
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB=STM32F103TB (20k RAM. 128k Flash)
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB.build.cpu_flags=-DMCU_STM32F103TB
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB.build.ldscript=ld/jtag.ld
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.maximum_size=131072
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.ram.maximum_size=20480
|
||||||
|
genericSTM32F103T.menu.device_variant.STM32F103TB.upload.flash.maximum_size=131072
|
||||||
|
|
||||||
|
#---------------------------- UPLOAD METHODS ---------------------------
|
||||||
|
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod=STM32duino bootloader
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.protocol=maple_dfu
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.tool=maple_upload
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.vect=VECT_TAB_ADDR=0x8002000
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.build.ldscript=ld/bootloader_20.ld
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.usbID=1EAF:0003
|
||||||
|
genericSTM32F103T.menu.upload_method.DFUUploadMethod.upload.altID=2
|
||||||
|
|
||||||
|
genericSTM32F103T.menu.upload_method.serialMethod=Serial
|
||||||
|
genericSTM32F103T.menu.upload_method.serialMethod.upload.protocol=maple_serial
|
||||||
|
genericSTM32F103T.menu.upload_method.serialMethod.upload.tool=serial_upload
|
||||||
|
|
||||||
|
genericSTM32F103T.menu.upload_method.STLinkMethod=STLink
|
||||||
|
genericSTM32F103T.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
||||||
|
genericSTM32F103T.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
||||||
|
genericSTM32F103T.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
|
||||||
|
|
||||||
|
genericSTM32F103T.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
|
||||||
|
genericSTM32F103T.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
||||||
|
genericSTM32F103T.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
||||||
|
genericSTM32F103T.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
||||||
|
|
||||||
########################### Generic STM32F103V ###########################
|
########################### Generic STM32F103V ###########################
|
||||||
|
|
||||||
|
@ -286,23 +326,20 @@ genericSTM32F103V.upload.auto_reset=true
|
||||||
genericSTM32F103V.build.error_led_port=GPIOE
|
genericSTM32F103V.build.error_led_port=GPIOE
|
||||||
genericSTM32F103V.build.error_led_pin=6
|
genericSTM32F103V.build.error_led_pin=6
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC=STM32F103VC
|
genericSTM32F103V.menu.device_variant.STM32F103VC=STM32F103VC
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC.build.cpu_flags=-DMCU_STM32F103VC
|
genericSTM32F103V.menu.device_variant.STM32F103VC.build.cpu_flags=-DMCU_STM32F103VC
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.maximum_size=262144
|
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.maximum_size=262144
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.ram.maximum_size=492152
|
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.ram.maximum_size=492152
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.flash.maximum_size=262144
|
genericSTM32F103V.menu.device_variant.STM32F103VC.upload.flash.maximum_size=262144
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VC.build.ldscript=ld/stm32f103vc.ld
|
genericSTM32F103V.menu.device_variant.STM32F103VC.build.ldscript=ld/stm32f103vc.ld
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD=STM32F103VD
|
genericSTM32F103V.menu.device_variant.STM32F103VD=STM32F103VD
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD.build.cpu_flags=-DMCU_STM32F103VD
|
genericSTM32F103V.menu.device_variant.STM32F103VD.build.cpu_flags=-DMCU_STM32F103VD
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.maximum_size=393216
|
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.maximum_size=393216
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.ram.maximum_size=65536
|
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.ram.maximum_size=65536
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.flash.maximum_size=393216
|
genericSTM32F103V.menu.device_variant.STM32F103VD.upload.flash.maximum_size=393216
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VD.build.ldscript=ld/stm32f103vd.ld
|
genericSTM32F103V.menu.device_variant.STM32F103VD.build.ldscript=ld/stm32f103vd.ld
|
||||||
|
|
||||||
|
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VE=STM32F103VE
|
genericSTM32F103V.menu.device_variant.STM32F103VE=STM32F103VE
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VE.build.cpu_flags=-DMCU_STM32F103VE
|
genericSTM32F103V.menu.device_variant.STM32F103VE.build.cpu_flags=-DMCU_STM32F103VE
|
||||||
genericSTM32F103V.menu.device_variant.STM32F103VE.upload.maximum_size=524288
|
genericSTM32F103V.menu.device_variant.STM32F103VE.upload.maximum_size=524288
|
||||||
|
@ -335,7 +372,6 @@ genericSTM32F103V.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
||||||
genericSTM32F103V.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
genericSTM32F103V.menu.upload_method.BMPMethod.upload.tool=bmp_upload
|
||||||
genericSTM32F103V.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
genericSTM32F103V.menu.upload_method.BMPMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
||||||
|
|
||||||
|
|
||||||
########################### Generic STM32F103Z ###########################
|
########################### Generic STM32F103Z ###########################
|
||||||
|
|
||||||
genericSTM32F103Z.name=Generic STM32F103Z series
|
genericSTM32F103Z.name=Generic STM32F103Z series
|
||||||
|
@ -348,21 +384,21 @@ genericSTM32F103Z.upload.file_type=bin
|
||||||
genericSTM32F103Z.upload.auto_reset=true
|
genericSTM32F103Z.upload.auto_reset=true
|
||||||
|
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC=STM32F103ZC
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC=STM32F103ZC
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC.build.cpu_flags=-DMCU_STM32F103ZC
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC.build.cpu_flags=-DMCU_STM32F103ZC
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.maximum_size=262144
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.maximum_size=262144
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.ram.maximum_size=492152
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.ram.maximum_size=492152
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.flash.maximum_size=262144
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC.upload.flash.maximum_size=262144
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZC.build.ldscript=ld/stm32f103zc.ld
|
genericSTM32F103Z.menu.device_variant.STM32F103ZC.build.ldscript=ld/stm32f103zc.ld
|
||||||
|
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD=STM32F103ZD
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD=STM32F103ZD
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD.build.cpu_flags=-DMCU_STM32F103ZD
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD.build.cpu_flags=-DMCU_STM32F103ZD
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.maximum_size=393216
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.maximum_size=393216
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.ram.maximum_size=65536
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.ram.maximum_size=65536
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.flash.maximum_size=393216
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD.upload.flash.maximum_size=393216
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZD.build.ldscript=ld/stm32f103zd.ld
|
genericSTM32F103Z.menu.device_variant.STM32F103ZD.build.ldscript=ld/stm32f103zd.ld
|
||||||
|
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZE=STM32F103ZE
|
genericSTM32F103Z.menu.device_variant.STM32F103ZE=STM32F103ZE
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZE.build.cpu_flags=-DMCU_STM32F103ZE
|
genericSTM32F103Z.menu.device_variant.STM32F103ZE.build.cpu_flags=-DMCU_STM32F103ZE
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.maximum_size=524288
|
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.maximum_size=524288
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.ram.maximum_size=65536
|
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.ram.maximum_size=65536
|
||||||
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.flash.maximum_size=524288
|
genericSTM32F103Z.menu.device_variant.STM32F103ZE.upload.flash.maximum_size=524288
|
||||||
|
@ -386,7 +422,7 @@ genericSTM32F103Z.menu.upload_method.serialMethod.upload.tool=serial_upload
|
||||||
genericSTM32F103Z.menu.upload_method.STLinkMethod=STLink
|
genericSTM32F103Z.menu.upload_method.STLinkMethod=STLink
|
||||||
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.protocol=STLink
|
||||||
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
genericSTM32F103Z.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
|
||||||
genericSTM32F103Z.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
|
genericSTM32F103Z.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
|
||||||
|
|
||||||
genericSTM32F103Z.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
|
genericSTM32F103Z.menu.upload_method.BMPMethod=BMP (Black Magic Probe)
|
||||||
genericSTM32F103Z.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
genericSTM32F103Z.menu.upload_method.BMPMethod.upload.protocol=gdb_bmp
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
Client.h - Base class that provides Client
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef client_h
|
||||||
|
#define client_h
|
||||||
|
#include "Print.h"
|
||||||
|
#include "Stream.h"
|
||||||
|
#include "IPAddress.h"
|
||||||
|
|
||||||
|
class Client : public Stream {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual int connect(IPAddress ip, uint16_t port) =0;
|
||||||
|
virtual int connect(const char *host, uint16_t port) =0;
|
||||||
|
virtual size_t write(uint8_t) =0;
|
||||||
|
virtual size_t write(const uint8_t *buf, size_t size) =0;
|
||||||
|
virtual int available() = 0;
|
||||||
|
virtual int read() = 0;
|
||||||
|
virtual int read(uint8_t *buf, size_t size) = 0;
|
||||||
|
virtual int peek() = 0;
|
||||||
|
virtual void flush() = 0;
|
||||||
|
virtual void stop() = 0;
|
||||||
|
virtual uint8_t connected() = 0;
|
||||||
|
virtual operator bool() = 0;
|
||||||
|
protected:
|
||||||
|
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
IPAddress.cpp - Base class that provides IPAddress
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <IPAddress.h>
|
||||||
|
|
||||||
|
IPAddress::IPAddress()
|
||||||
|
{
|
||||||
|
_address.dword = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
|
||||||
|
{
|
||||||
|
_address.bytes[0] = first_octet;
|
||||||
|
_address.bytes[1] = second_octet;
|
||||||
|
_address.bytes[2] = third_octet;
|
||||||
|
_address.bytes[3] = fourth_octet;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(uint32_t address)
|
||||||
|
{
|
||||||
|
_address.dword = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress::IPAddress(const uint8_t *address)
|
||||||
|
{
|
||||||
|
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress& IPAddress::operator=(const uint8_t *address)
|
||||||
|
{
|
||||||
|
memcpy(_address.bytes, address, sizeof(_address.bytes));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress& IPAddress::operator=(uint32_t address)
|
||||||
|
{
|
||||||
|
_address.dword = address;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IPAddress::operator==(const uint8_t* addr) const
|
||||||
|
{
|
||||||
|
return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t IPAddress::printTo(Print& p) const
|
||||||
|
{
|
||||||
|
size_t n = 0;
|
||||||
|
for (int i =0; i < 3; i++)
|
||||||
|
{
|
||||||
|
n += p.print(_address.bytes[i], DEC);
|
||||||
|
n += p.print('.');
|
||||||
|
}
|
||||||
|
n += p.print(_address.bytes[3], DEC);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
IPAddress.h - Base class that provides IPAddress
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef IPAddress_h
|
||||||
|
#define IPAddress_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <Printable.h>
|
||||||
|
|
||||||
|
// A class to make it easier to handle and pass around IP addresses
|
||||||
|
|
||||||
|
class IPAddress : public Printable {
|
||||||
|
private:
|
||||||
|
union {
|
||||||
|
uint8_t bytes[4]; // IPv4 address
|
||||||
|
uint32_t dword;
|
||||||
|
} _address;
|
||||||
|
|
||||||
|
// Access the raw byte array containing the address. Because this returns a pointer
|
||||||
|
// to the internal structure rather than a copy of the address this function should only
|
||||||
|
// be used when you know that the usage of the returned uint8_t* will be transient and not
|
||||||
|
// stored.
|
||||||
|
uint8_t* raw_address() { return _address.bytes; };
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructors
|
||||||
|
IPAddress();
|
||||||
|
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
|
||||||
|
IPAddress(uint32_t address);
|
||||||
|
IPAddress(const uint8_t *address);
|
||||||
|
|
||||||
|
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
|
||||||
|
// to a four-byte uint8_t array is expected
|
||||||
|
operator uint32_t() const { return _address.dword; };
|
||||||
|
bool operator==(const IPAddress& addr) const { return _address.dword == addr._address.dword; };
|
||||||
|
bool operator==(const uint8_t* addr) const;
|
||||||
|
|
||||||
|
// Overloaded index operator to allow getting and setting individual octets of the address
|
||||||
|
uint8_t operator[](int index) const { return _address.bytes[index]; };
|
||||||
|
uint8_t& operator[](int index) { return _address.bytes[index]; };
|
||||||
|
|
||||||
|
// Overloaded copy operators to allow initialisation of IPAddress objects from other types
|
||||||
|
IPAddress& operator=(const uint8_t *address);
|
||||||
|
IPAddress& operator=(uint32_t address);
|
||||||
|
|
||||||
|
virtual size_t printTo(Print& p) const;
|
||||||
|
|
||||||
|
friend class EthernetClass;
|
||||||
|
friend class UDP;
|
||||||
|
friend class Client;
|
||||||
|
friend class Server;
|
||||||
|
friend class DhcpClass;
|
||||||
|
friend class DNSClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
const IPAddress INADDR_NONE(0,0,0,0);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
Printable.h - Interface class that allows printing of complex types
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Printable_h
|
||||||
|
#define Printable_h
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
class Print;
|
||||||
|
|
||||||
|
/** The Printable class provides a way for new classes to allow themselves to be printed.
|
||||||
|
By deriving from Printable and implementing the printTo method, it will then be possible
|
||||||
|
for users to print out instances of this class by passing them into the usual
|
||||||
|
Print::print and Print::println methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Printable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual size_t printTo(Print& p) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
Server.h - Base class that provides Server
|
||||||
|
Copyright (c) 2011 Adrian McEwen. All right reserved.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef server_h
|
||||||
|
#define server_h
|
||||||
|
|
||||||
|
#include "Print.h"
|
||||||
|
|
||||||
|
class Server : public Print {
|
||||||
|
public:
|
||||||
|
virtual void begin() =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Udp.cpp: Library to send/receive UDP packets.
|
||||||
|
*
|
||||||
|
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
|
||||||
|
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
|
||||||
|
* might not happen often in practice, but in larger network topologies, a UDP
|
||||||
|
* packet can be received out of sequence.
|
||||||
|
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
|
||||||
|
* aware of it. Again, this may not be a concern in practice on small local networks.
|
||||||
|
* For more information, see http://www.cafeaulait.org/course/week12/35.html
|
||||||
|
*
|
||||||
|
* MIT License:
|
||||||
|
* Copyright (c) 2008 Bjoern Hartmann
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* bjoern@cs.stanford.edu 12/30/2008
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef udp_h
|
||||||
|
#define udp_h
|
||||||
|
|
||||||
|
#include <Stream.h>
|
||||||
|
#include <IPAddress.h>
|
||||||
|
|
||||||
|
class UDP : public Stream {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use
|
||||||
|
virtual void stop() =0; // Finish with the UDP socket
|
||||||
|
|
||||||
|
// Sending UDP packets
|
||||||
|
|
||||||
|
// Start building up a packet to send to the remote host specific in ip and port
|
||||||
|
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
|
||||||
|
virtual int beginPacket(IPAddress ip, uint16_t port) =0;
|
||||||
|
// Start building up a packet to send to the remote host specific in host and port
|
||||||
|
// Returns 1 if successful, 0 if there was a problem resolving the hostname or port
|
||||||
|
virtual int beginPacket(const char *host, uint16_t port) =0;
|
||||||
|
// Finish off this packet and send it
|
||||||
|
// Returns 1 if the packet was sent successfully, 0 if there was an error
|
||||||
|
virtual int endPacket() =0;
|
||||||
|
// Write a single byte into the packet
|
||||||
|
virtual size_t write(uint8_t) =0;
|
||||||
|
// Write size bytes from buffer into the packet
|
||||||
|
virtual size_t write(const uint8_t *buffer, size_t size) =0;
|
||||||
|
|
||||||
|
// Start processing the next available incoming packet
|
||||||
|
// Returns the size of the packet in bytes, or 0 if no packets are available
|
||||||
|
virtual int parsePacket() =0;
|
||||||
|
// Number of bytes remaining in the current packet
|
||||||
|
virtual int available() =0;
|
||||||
|
// Read a single byte from the current packet
|
||||||
|
virtual int read() =0;
|
||||||
|
// Read up to len bytes from the current packet and place them into buffer
|
||||||
|
// Returns the number of bytes read, or 0 if none are available
|
||||||
|
virtual int read(unsigned char* buffer, size_t len) =0;
|
||||||
|
// Read up to len characters from the current packet and place them into buffer
|
||||||
|
// Returns the number of characters read, or 0 if none are available
|
||||||
|
virtual int read(char* buffer, size_t len) =0;
|
||||||
|
// Return the next byte from the current packet without moving on to the next byte
|
||||||
|
virtual int peek() =0;
|
||||||
|
virtual void flush() =0; // Finish reading the current packet
|
||||||
|
|
||||||
|
// Return the IP address of the host who sent the current incoming packet
|
||||||
|
virtual IPAddress remoteIP() =0;
|
||||||
|
// Return the port of the host who sent the current incoming packet
|
||||||
|
virtual uint16_t remotePort() =0;
|
||||||
|
protected:
|
||||||
|
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -98,5 +98,9 @@ typedef unsigned int word;
|
||||||
bitClear(value, bit))
|
bitClear(value, bit))
|
||||||
#define bit(b) (1UL << (b))
|
#define bit(b) (1UL << (b))
|
||||||
|
|
||||||
|
// Roger Clark. Added _BV macro for AVR compatibility. As requested by @sweetlilmre and @stevestrong
|
||||||
|
#ifndef _BV
|
||||||
|
#define _BV(bit) (1 << (bit))
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -15,22 +15,22 @@
|
||||||
|
|
||||||
/** NOT FOR USE WITH THE TOUCH SHIELD, ONLY FOR THE BREAKOUT! **/
|
/** NOT FOR USE WITH THE TOUCH SHIELD, ONLY FOR THE BREAKOUT! **/
|
||||||
|
|
||||||
#include <Adafruit_GFX.h> // Core graphics library
|
#include <Adafruit_GFX_AS.h> // Core graphics library
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Adafruit_ILI9341_STM.h>
|
#include <Adafruit_ILI9341_STM.h>
|
||||||
#include "TouchScreen.h"
|
#include <TouchScreen_STM.h>
|
||||||
|
|
||||||
// These are the four touchscreen analog pins
|
// These are the four touchscreen analog pins
|
||||||
#define YP A2 // must be an analog pin, use "An" notation!
|
#define YP PB0 // must be an analog pin
|
||||||
#define XM A3 // must be an analog pin, use "An" notation!
|
#define XM PA3 // must be an analog pin
|
||||||
#define YM 5 // can be a digital pin
|
#define YM PB7 // can be a digital pin
|
||||||
#define XP 4 // can be a digital pin
|
#define XP PC13 // can be a digital pin
|
||||||
|
|
||||||
// This is calibration data for the raw touch data to the screen coordinates
|
// This is calibration data for the raw touch data to the screen coordinates
|
||||||
#define TS_MINX 150
|
#define TS_MINX 3670
|
||||||
#define TS_MINY 120
|
#define TS_MINY 3790
|
||||||
#define TS_MAXX 920
|
#define TS_MAXX 640
|
||||||
#define TS_MAXY 940
|
#define TS_MAXY 300
|
||||||
|
|
||||||
#define MINPRESSURE 10
|
#define MINPRESSURE 10
|
||||||
#define MAXPRESSURE 1000
|
#define MAXPRESSURE 1000
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
This is the 4-wire resistive touch screen firmware for Arduino. Works with all Arduinos and the Mega
|
||||||
|
|
||||||
|
|
||||||
|
To install, click DOWNLOAD SOURCE in the top right corner, and rename the uncompressed folder "TouchScreen". See our tutorial at http://www.ladyada.net/library/arduino/libraries.html on Arduino Library installation
|
||||||
|
|
||||||
|
Ported to the STM32 by Jaret Burkett https://github.com/jaretburkett
|
|
@ -0,0 +1,310 @@
|
||||||
|
// Touch screen library with X Y and Z (pressure) readings as well
|
||||||
|
// as oversampling to avoid 'bouncing'
|
||||||
|
// (c) ladyada / adafruit
|
||||||
|
// Code under MIT License
|
||||||
|
|
||||||
|
// Ported to STM32 by Jaret Burkett https://github.com/jaretburkett
|
||||||
|
|
||||||
|
#include "pins_arduino.h"
|
||||||
|
#include "wiring_private.h"
|
||||||
|
#ifdef __AVR
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#elif defined(ESP8266)
|
||||||
|
#include <pgmspace.h>
|
||||||
|
#elif defined (__STM32F1__)
|
||||||
|
#include <avr/pgmspace.h>
|
||||||
|
#include <WProgram.h>
|
||||||
|
#endif
|
||||||
|
#include "TouchScreen_STM.h"
|
||||||
|
|
||||||
|
// increase or decrease the touchscreen oversampling. This is a little different than you make think:
|
||||||
|
// 1 is no oversampling, whatever data we get is immediately returned
|
||||||
|
// 2 is double-sampling and we only return valid data if both points are the same
|
||||||
|
// 3+ uses insert sort to get the median value.
|
||||||
|
// We found 2 is precise yet not too slow so we suggest sticking with it!
|
||||||
|
|
||||||
|
#define NUMSAMPLES 2
|
||||||
|
|
||||||
|
TSPoint::TSPoint(void) {
|
||||||
|
x = y = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TSPoint::TSPoint(int16_t x0, int16_t y0, int16_t z0) {
|
||||||
|
x = x0;
|
||||||
|
y = y0;
|
||||||
|
z = z0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TSPoint::operator==(TSPoint p1) {
|
||||||
|
return ((p1.x == x) && (p1.y == y) && (p1.z == z));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TSPoint::operator!=(TSPoint p1) {
|
||||||
|
return ((p1.x != x) || (p1.y != y) || (p1.z != z));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (NUMSAMPLES > 2)
|
||||||
|
static void insert_sort(int array[], uint8_t size) {
|
||||||
|
uint8_t j;
|
||||||
|
int save;
|
||||||
|
|
||||||
|
for (int i = 1; i < size; i++) {
|
||||||
|
save = array[i];
|
||||||
|
for (j = i; j >= 1 && save < array[j - 1]; j--)
|
||||||
|
array[j] = array[j - 1];
|
||||||
|
array[j] = save;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TSPoint TouchScreen::getPoint(void) {
|
||||||
|
int x, y, z;
|
||||||
|
int samples[NUMSAMPLES];
|
||||||
|
uint8_t i, valid;
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
uint8_t xp_port = digitalPinToPort(_xp);
|
||||||
|
uint8_t yp_port = digitalPinToPort(_yp);
|
||||||
|
uint8_t xm_port = digitalPinToPort(_xm);
|
||||||
|
uint8_t ym_port = digitalPinToPort(_ym);
|
||||||
|
|
||||||
|
uint8_t xp_pin = digitalPinToBitMask(_xp);
|
||||||
|
uint8_t yp_pin = digitalPinToBitMask(_yp);
|
||||||
|
uint8_t xm_pin = digitalPinToBitMask(_xm);
|
||||||
|
uint8_t ym_pin = digitalPinToBitMask(_ym);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
valid = 1;
|
||||||
|
|
||||||
|
pinMode(_yp, INPUT);
|
||||||
|
pinMode(_ym, INPUT);
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
*portOutputRegister(yp_port) &= ~yp_pin;
|
||||||
|
*portOutputRegister(ym_port) &= ~ym_pin;
|
||||||
|
|
||||||
|
pinMode(_xp, OUTPUT);
|
||||||
|
pinMode(_xm, OUTPUT);
|
||||||
|
|
||||||
|
*portOutputRegister(xp_port) |= xp_pin;
|
||||||
|
*portOutputRegister(xm_port) &= ~xm_pin;
|
||||||
|
#else
|
||||||
|
digitalWrite(_yp, LOW);
|
||||||
|
digitalWrite(_ym, LOW);
|
||||||
|
|
||||||
|
pinMode(_xp, OUTPUT);
|
||||||
|
pinMode(_xm, OUTPUT);
|
||||||
|
|
||||||
|
digitalWrite(_xp, HIGH);
|
||||||
|
digitalWrite(_xm, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (i=0; i<NUMSAMPLES; i++) {
|
||||||
|
samples[i] = analogRead(_yp);
|
||||||
|
}
|
||||||
|
#if NUMSAMPLES > 2
|
||||||
|
insert_sort(samples, NUMSAMPLES);
|
||||||
|
#endif
|
||||||
|
#if NUMSAMPLES == 2
|
||||||
|
if (samples[0] != samples[1]) { valid = 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
x = (1023-samples[NUMSAMPLES/2]);
|
||||||
|
#else
|
||||||
|
x = (4095-samples[NUMSAMPLES/2]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pinMode(_xp, INPUT);
|
||||||
|
pinMode(_xm, INPUT);
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
*portOutputRegister(xp_port) &= ~xp_pin;
|
||||||
|
#else
|
||||||
|
digitalWrite(_xp, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pinMode(_yp, OUTPUT);
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
*portOutputRegister(yp_port) |= yp_pin;
|
||||||
|
#else
|
||||||
|
digitalWrite(_yp, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pinMode(_ym, OUTPUT);
|
||||||
|
|
||||||
|
for (i=0; i<NUMSAMPLES; i++) {
|
||||||
|
samples[i] = analogRead(_xm);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NUMSAMPLES > 2
|
||||||
|
insert_sort(samples, NUMSAMPLES);
|
||||||
|
#endif
|
||||||
|
#if NUMSAMPLES == 2
|
||||||
|
if (samples[0] != samples[1]) { valid = 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
y = (1023-samples[NUMSAMPLES/2]);
|
||||||
|
#else
|
||||||
|
y = (4095-samples[NUMSAMPLES/2]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pinMode(_xp, OUTPUT);
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
// Set X+ to ground
|
||||||
|
*portOutputRegister(xp_port) &= ~xp_pin;
|
||||||
|
|
||||||
|
// Set Y- to VCC
|
||||||
|
*portOutputRegister(ym_port) |= ym_pin;
|
||||||
|
|
||||||
|
// Hi-Z X- and Y+
|
||||||
|
*portOutputRegister(yp_port) &= ~yp_pin;
|
||||||
|
#else
|
||||||
|
// Set X+ to ground
|
||||||
|
digitalWrite(_xp, LOW);
|
||||||
|
|
||||||
|
// Set Y- to VCC
|
||||||
|
digitalWrite(_ym, HIGH);
|
||||||
|
|
||||||
|
// Hi-Z X- and Y+
|
||||||
|
digitalWrite(_yp, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//digitalWrite(_yp, LOW);
|
||||||
|
pinMode(_yp, INPUT);
|
||||||
|
|
||||||
|
int z1 = analogRead(_xm);
|
||||||
|
int z2 = analogRead(_yp);
|
||||||
|
|
||||||
|
if (_rxplate != 0) {
|
||||||
|
// now read the x
|
||||||
|
float rtouch;
|
||||||
|
rtouch = z2;
|
||||||
|
rtouch /= z1;
|
||||||
|
rtouch -= 1;
|
||||||
|
rtouch *= x;
|
||||||
|
rtouch *= _rxplate;
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
rtouch /= 1024;
|
||||||
|
#else
|
||||||
|
rtouch /= 4095;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
z = rtouch;
|
||||||
|
} else {
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
z = (1023-(z2-z1));
|
||||||
|
#else
|
||||||
|
z = (4095-(z2-z1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! valid) {
|
||||||
|
z = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TSPoint(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym) {
|
||||||
|
_yp = yp;
|
||||||
|
_xm = xm;
|
||||||
|
_ym = ym;
|
||||||
|
_xp = xp;
|
||||||
|
_rxplate = 0;
|
||||||
|
pressureThreshhold = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TouchScreen::TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym,
|
||||||
|
uint16_t rxplate) {
|
||||||
|
_yp = yp;
|
||||||
|
_xm = xm;
|
||||||
|
_ym = ym;
|
||||||
|
_xp = xp;
|
||||||
|
_rxplate = rxplate;
|
||||||
|
|
||||||
|
pressureThreshhold = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TouchScreen::readTouchX(void) {
|
||||||
|
pinMode(_yp, INPUT);
|
||||||
|
pinMode(_ym, INPUT);
|
||||||
|
digitalWrite(_yp, LOW);
|
||||||
|
digitalWrite(_ym, LOW);
|
||||||
|
|
||||||
|
pinMode(_xp, OUTPUT);
|
||||||
|
digitalWrite(_xp, HIGH);
|
||||||
|
pinMode(_xm, OUTPUT);
|
||||||
|
digitalWrite(_xm, LOW);
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
return (1023-analogRead(_yp));
|
||||||
|
#else
|
||||||
|
return (4095-analogRead(_yp));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int TouchScreen::readTouchY(void) {
|
||||||
|
pinMode(_xp, INPUT);
|
||||||
|
pinMode(_xm, INPUT);
|
||||||
|
digitalWrite(_xp, LOW);
|
||||||
|
digitalWrite(_xm, LOW);
|
||||||
|
|
||||||
|
pinMode(_yp, OUTPUT);
|
||||||
|
digitalWrite(_yp, HIGH);
|
||||||
|
pinMode(_ym, OUTPUT);
|
||||||
|
digitalWrite(_ym, LOW);
|
||||||
|
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
return (1023-analogRead(_xm));
|
||||||
|
#else
|
||||||
|
return (4095-analogRead(_xm));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t TouchScreen::pressure(void) {
|
||||||
|
// Set X+ to ground
|
||||||
|
pinMode(_xp, OUTPUT);
|
||||||
|
digitalWrite(_xp, LOW);
|
||||||
|
|
||||||
|
// Set Y- to VCC
|
||||||
|
pinMode(_ym, OUTPUT);
|
||||||
|
digitalWrite(_ym, HIGH);
|
||||||
|
|
||||||
|
// Hi-Z X- and Y+
|
||||||
|
digitalWrite(_xm, LOW);
|
||||||
|
pinMode(_xm, INPUT);
|
||||||
|
digitalWrite(_yp, LOW);
|
||||||
|
pinMode(_yp, INPUT);
|
||||||
|
|
||||||
|
int z1 = analogRead(_xm);
|
||||||
|
int z2 = analogRead(_yp);
|
||||||
|
|
||||||
|
if (_rxplate != 0) {
|
||||||
|
// now read the x
|
||||||
|
float rtouch;
|
||||||
|
rtouch = z2;
|
||||||
|
rtouch /= z1;
|
||||||
|
rtouch -= 1;
|
||||||
|
rtouch *= readTouchX();
|
||||||
|
rtouch *= _rxplate;
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
rtouch /= 1024;
|
||||||
|
#else
|
||||||
|
rtouch /= 4095;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return rtouch;
|
||||||
|
} else {
|
||||||
|
#if !defined (__STM32F1__)
|
||||||
|
return (1023-(z2-z1));
|
||||||
|
#else
|
||||||
|
return (4095-(z2-z1));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Touch screen library with X Y and Z (pressure) readings as well
|
||||||
|
// as oversampling to avoid 'bouncing'
|
||||||
|
// (c) ladyada / adafruit
|
||||||
|
// Code under MIT License
|
||||||
|
|
||||||
|
// Ported to STM32 by Jaret Burkett https://github.com/jaretburkett
|
||||||
|
|
||||||
|
#ifndef _ADAFRUIT_TOUCHSCREEN_STM_H_
|
||||||
|
#define _ADAFRUIT_TOUCHSCREEN_STM_H_
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
class TSPoint {
|
||||||
|
public:
|
||||||
|
TSPoint(void);
|
||||||
|
TSPoint(int16_t x, int16_t y, int16_t z);
|
||||||
|
|
||||||
|
bool operator==(TSPoint);
|
||||||
|
bool operator!=(TSPoint);
|
||||||
|
|
||||||
|
int16_t x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TouchScreen {
|
||||||
|
public:
|
||||||
|
TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym);
|
||||||
|
TouchScreen(uint8_t xp, uint8_t yp, uint8_t xm, uint8_t ym, uint16_t rx);
|
||||||
|
|
||||||
|
bool isTouching(void);
|
||||||
|
uint16_t pressure(void);
|
||||||
|
int readTouchY();
|
||||||
|
int readTouchX();
|
||||||
|
TSPoint getPoint();
|
||||||
|
int16_t pressureThreshhold;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t _yp, _ym, _xm, _xp;
|
||||||
|
uint16_t _rxplate;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Touch screen library with X Y and Z (pressure) readings as well
|
||||||
|
// as oversampling to avoid 'bouncing'
|
||||||
|
// This demo code returns raw readings, public domain
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <TouchScreen_STM.h>
|
||||||
|
|
||||||
|
#define YP 8 // must be an analog pin
|
||||||
|
#define XM 9 // must be an analog pin
|
||||||
|
#define YM 10 // can be a digital pin
|
||||||
|
#define XP 11 // can be a digital pin
|
||||||
|
|
||||||
|
// For better pressure precision, we need to know the resistance
|
||||||
|
// between X+ and X- Use any multimeter to read it
|
||||||
|
// For the one we're using, its 300 ohms across the X plate
|
||||||
|
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
|
||||||
|
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(void) {
|
||||||
|
// a point object holds x y and z coordinates
|
||||||
|
TSPoint p = ts.getPoint();
|
||||||
|
|
||||||
|
// we have some minimum pressure we consider 'valid'
|
||||||
|
// pressure of 0 means no pressing!
|
||||||
|
if (p.z > ts.pressureThreshhold) {
|
||||||
|
Serial.print("X = "); Serial.print(p.x);
|
||||||
|
Serial.print("\tY = "); Serial.print(p.y);
|
||||||
|
Serial.print("\tPressure = "); Serial.println(p.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(100);
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
// Touch screen library with X Y and Z (pressure) readings as well
|
||||||
|
// as oversampling to avoid 'bouncing'
|
||||||
|
// This demo code returns raw readings, public domain
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <TouchScreen_STM.h>
|
||||||
|
|
||||||
|
// These are the pins for the shield!
|
||||||
|
#define YP 8 // must be an analog pin
|
||||||
|
#define XM 9 // must be an analog pin
|
||||||
|
#define YM 10 // can be a digital pin
|
||||||
|
#define XP 11 // can be a digital pin
|
||||||
|
|
||||||
|
#define MINPRESSURE 10
|
||||||
|
#define MAXPRESSURE 1000
|
||||||
|
|
||||||
|
// For better pressure precision, we need to know the resistance
|
||||||
|
// between X+ and X- Use any multimeter to read it
|
||||||
|
// For the one we're using, its 300 ohms across the X plate
|
||||||
|
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
|
||||||
|
|
||||||
|
void setup(void) {
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(void) {
|
||||||
|
// a point object holds x y and z coordinates
|
||||||
|
TSPoint p = ts.getPoint();
|
||||||
|
|
||||||
|
// we have some minimum pressure we consider 'valid'
|
||||||
|
// pressure of 0 means no pressing!
|
||||||
|
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
|
||||||
|
Serial.print("X = "); Serial.print(p.x);
|
||||||
|
Serial.print("\tY = "); Serial.print(p.y);
|
||||||
|
Serial.print("\tPressure = "); Serial.println(p.z);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +0,0 @@
|
||||||
old.0.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
|
||||||
new.0.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
|
|
@ -14,7 +14,7 @@ compiler.warning_flags.all=-Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL
|
||||||
|
|
||||||
# compiler variables
|
# compiler variables
|
||||||
# ----------------------
|
# ----------------------
|
||||||
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||||
compiler.c.cmd=arm-none-eabi-gcc
|
compiler.c.cmd=arm-none-eabi-gcc
|
||||||
compiler.c.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
compiler.c.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||||
compiler.c.elf.cmd=arm-none-eabi-g++
|
compiler.c.elf.cmd=arm-none-eabi-g++
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* &file wirish/boards/maple_mini/board.cpp
|
||||||
|
* &author Marti Bolivar <mbolivar&leaflabs.com>
|
||||||
|
* &brief Maple Mini board file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <board/board.h>
|
||||||
|
|
||||||
|
#include <libmaple/gpio.h>
|
||||||
|
#include <libmaple/timer.h>
|
||||||
|
|
||||||
|
/* Roger Clark. Added next to includes for changes to Serial */
|
||||||
|
#include <libmaple/usart.h>
|
||||||
|
#include <HardwareSerial.h>
|
||||||
|
|
||||||
|
#include <wirish_debug.h>
|
||||||
|
#include <wirish_types.h>
|
||||||
|
|
||||||
|
/* Since we want the Serial Wire/JTAG pins as GPIOs, disable both SW
|
||||||
|
* and JTAG debug support, unless configured otherwise. */
|
||||||
|
void boardInit(void) {
|
||||||
|
#ifndef CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
|
||||||
|
disableDebugPorts();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note. See the enum of pin names in board.h
|
||||||
|
|
||||||
|
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {
|
||||||
|
|
||||||
|
|
||||||
|
{&gpioa, &timer2, &adc1, 0, 1, 0}, /* PA0 */
|
||||||
|
{&gpioa, &timer2, &adc1, 1, 2, 1}, /* PA1 */
|
||||||
|
{&gpioa, &timer2, &adc1, 2, 3, 2}, /* PA2 */
|
||||||
|
{&gpioa, &timer2, &adc1, 3, 4, 3}, /* PA3 */
|
||||||
|
{&gpioa, NULL, &adc1, 4, 0, 4}, /* PA4 */
|
||||||
|
{&gpioa, NULL, &adc1, 5, 0, 5}, /* PA5 */
|
||||||
|
{&gpioa, &timer3, &adc1, 6, 1, 6}, /* PA6 */
|
||||||
|
{&gpioa, &timer3, &adc1, 7, 2, 7}, /* PA7 */
|
||||||
|
{&gpioa, &timer1, NULL, 8, 1, ADCx}, /* PA8 */
|
||||||
|
{&gpioa, &timer1, NULL, 9, 2, ADCx}, /* PA9 */
|
||||||
|
{&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
|
||||||
|
{&gpioa, &timer1, NULL, 11, 4, ADCx}, /* PA11 */
|
||||||
|
{&gpioa, NULL, NULL, 12, 0, ADCx}, /* PA12 */
|
||||||
|
{&gpioa, NULL, NULL, 13, 0, ADCx}, /* PA13 */
|
||||||
|
{&gpioa, NULL, NULL, 14, 0, ADCx}, /* PA14 */
|
||||||
|
{&gpioa, NULL, NULL, 15, 0, ADCx}, /* PA15 */
|
||||||
|
|
||||||
|
{&gpiob, &timer3, &adc1, 0, 3, 8}, /* PB0 */
|
||||||
|
{&gpiob, &timer3, &adc1, 1, 4, 9}, /* PB1 */
|
||||||
|
{&gpiob, NULL, NULL, 2, 0, ADCx}, /* PB2 */
|
||||||
|
{&gpiob, NULL, NULL, 3, 0, ADCx}, /* PB3 */
|
||||||
|
{&gpiob, NULL, NULL, 4, 0, ADCx}, /* PB4 */
|
||||||
|
{&gpiob, NULL, NULL, 5, 0, ADCx}, /* PB5 */
|
||||||
|
{&gpiob, &timer4, NULL, 6, 1, ADCx}, /* PB6 */
|
||||||
|
{&gpiob, &timer4, NULL, 7, 2, ADCx}, /* PB7 */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
|
||||||
|
PB0, PA7, PA6, PA3, PA2, PA1, PA0, PB7, PB6, PA10, PA9, PA8
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
|
||||||
|
PB0, PA7, PA6 , PA5 , PA4 , PA3 , PA2 , PA1 , PA0
|
||||||
|
};
|
||||||
|
|
||||||
|
// Note. These defines are not really used by generic boards. They are for Maple Serial USB
|
||||||
|
#define USB_DP PA12
|
||||||
|
#define USB_DM PA11
|
||||||
|
|
||||||
|
// NOte. These definitions are not really used for generic boards, they only relate to boards modified to behave like Maple boards
|
||||||
|
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
|
||||||
|
USB_DP, USB_DM
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Roger Clark
|
||||||
|
*
|
||||||
|
* 2015/05/28
|
||||||
|
*
|
||||||
|
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
|
||||||
|
* Maps to which hardware serial port on the microprocessor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef SERIAL_USB
|
||||||
|
DEFINE_HWSERIAL(Serial1, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial2, 2);
|
||||||
|
#else
|
||||||
|
DEFINE_HWSERIAL(Serial, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial1, 2);
|
||||||
|
#endif
|
|
@ -0,0 +1,75 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file wirish/boards/maple_mini/include/board/board.h
|
||||||
|
* @author Marti Bolivar <mbolivar@leaflabs.com>
|
||||||
|
* @brief Maple Mini board header.
|
||||||
|
*
|
||||||
|
* See wirish/boards/maple/include/board/board.h for more information
|
||||||
|
* on these definitions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BOARD_GENERIC_STM32F103T_H_
|
||||||
|
#define _BOARD_GENERIC_STM32F103T_H_
|
||||||
|
|
||||||
|
#define CYCLES_PER_MICROSECOND 72
|
||||||
|
#define SYSTICK_RELOAD_VAL (F_CPU/1000) - 1 /* takes a cycle to reload */
|
||||||
|
|
||||||
|
#define BOARD_NR_USARTS 2
|
||||||
|
#define BOARD_USART1_TX_PIN PA9
|
||||||
|
#define BOARD_USART1_RX_PIN PA10
|
||||||
|
#define BOARD_USART2_TX_PIN PA2
|
||||||
|
#define BOARD_USART2_RX_PIN PA3
|
||||||
|
|
||||||
|
#define BOARD_NR_SPI 1
|
||||||
|
#define BOARD_SPI1_NSS_PIN PA4
|
||||||
|
#define BOARD_SPI1_MOSI_PIN PA7
|
||||||
|
#define BOARD_SPI1_MISO_PIN PA6
|
||||||
|
#define BOARD_SPI1_SCK_PIN PA5
|
||||||
|
|
||||||
|
#define BOARD_NR_GPIO_PINS 24
|
||||||
|
#define BOARD_NR_PWM_PINS 12
|
||||||
|
#define BOARD_NR_ADC_PINS 9
|
||||||
|
#define BOARD_NR_USED_PINS 4
|
||||||
|
|
||||||
|
|
||||||
|
#define BOARD_JTMS_SWDIO_PIN 22
|
||||||
|
#define BOARD_JTCK_SWCLK_PIN 21
|
||||||
|
#define BOARD_JTDI_PIN 20
|
||||||
|
#define BOARD_JTDO_PIN 19
|
||||||
|
#define BOARD_NJTRST_PIN 18
|
||||||
|
|
||||||
|
#define BOARD_USB_DISC_DEV GPIOA
|
||||||
|
#define BOARD_USB_DISC_BIT 0
|
||||||
|
|
||||||
|
// Note this needs to match with the PIN_MAP array in board.cpp
|
||||||
|
enum {
|
||||||
|
PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13,PA14,PA15,
|
||||||
|
PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for "Flash" builds.
|
||||||
|
*
|
||||||
|
* A Flash build puts .text (and .rodata) in Flash, and
|
||||||
|
* .data/.bss/heap (of course) in SRAM, but offsets the sections by
|
||||||
|
* enough space to store the Maple bootloader, which lives in low
|
||||||
|
* Flash and uses low memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
|
||||||
|
rom (rx) : ORIGIN = 0x08002000, LENGTH = 120K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,220 @@
|
||||||
|
/*
|
||||||
|
* Linker script for libmaple.
|
||||||
|
*
|
||||||
|
* Original author "lanchon" from ST forums, with modifications by LeafLabs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configure other libraries we want in the link.
|
||||||
|
*
|
||||||
|
* libgcc, libc, and libm are common across supported toolchains.
|
||||||
|
* However, some toolchains require additional archives which aren't
|
||||||
|
* present everywhere (e.g. ARM's gcc-arm-embedded releases).
|
||||||
|
*
|
||||||
|
* To hack around this, we let the build system specify additional
|
||||||
|
* archives by putting the right extra_libs.inc (in a directory under
|
||||||
|
* toolchains/) in our search path.
|
||||||
|
*/
|
||||||
|
GROUP(libgcc.a libc.a libm.a)
|
||||||
|
INCLUDE extra_libs.inc
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These force the linker to search for vector table symbols.
|
||||||
|
*
|
||||||
|
* These symbols vary by STM32 family (and also within families).
|
||||||
|
* It's up to the build system to configure the link's search path
|
||||||
|
* properly for the target MCU.
|
||||||
|
*/
|
||||||
|
INCLUDE vector_symbols.inc
|
||||||
|
|
||||||
|
/* STM32 vector table. */
|
||||||
|
EXTERN(__stm32_vector_table)
|
||||||
|
|
||||||
|
/* C runtime initialization function. */
|
||||||
|
EXTERN(start_c)
|
||||||
|
|
||||||
|
/* main entry point */
|
||||||
|
EXTERN(main)
|
||||||
|
|
||||||
|
/* Initial stack pointer value. */
|
||||||
|
EXTERN(__msp_init)
|
||||||
|
PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram));
|
||||||
|
|
||||||
|
/* Reset vector and chip reset entry point */
|
||||||
|
EXTERN(__start__)
|
||||||
|
ENTRY(__start__)
|
||||||
|
PROVIDE(__exc_reset = __start__);
|
||||||
|
|
||||||
|
/* Heap boundaries, for libmaple */
|
||||||
|
EXTERN(_lm_heap_start);
|
||||||
|
EXTERN(_lm_heap_end);
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
__text_start__ = .;
|
||||||
|
/*
|
||||||
|
* STM32 vector table. Leave this here. Yes, really.
|
||||||
|
*/
|
||||||
|
*(.stm32.interrupt_vector)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Program code and vague linking
|
||||||
|
*/
|
||||||
|
*(.text .text.* .gnu.linkonce.t.*)
|
||||||
|
*(.plt)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.glue_7t) *(.glue_7) *(.vfp11_veneer)
|
||||||
|
|
||||||
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.eh_frame_hdr)
|
||||||
|
*(.eh_frame)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.init))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
__preinit_array_start = .;
|
||||||
|
KEEP (*(.preinit_array))
|
||||||
|
__preinit_array_end = .;
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
__init_array_start = .;
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array))
|
||||||
|
__init_array_end = .;
|
||||||
|
|
||||||
|
. = ALIGN(0x4);
|
||||||
|
KEEP (*crtbegin.o(.ctors))
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
|
||||||
|
KEEP (*(SORT(.ctors.*)))
|
||||||
|
KEEP (*crtend.o(.ctors))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.fini))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
__fini_array_start = .;
|
||||||
|
KEEP (*(.fini_array))
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
__fini_array_end = .;
|
||||||
|
|
||||||
|
KEEP (*crtbegin.o(.dtors))
|
||||||
|
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
|
||||||
|
KEEP (*(SORT(.dtors.*)))
|
||||||
|
KEEP (*crtend.o(.dtors))
|
||||||
|
} > REGION_TEXT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* End of text
|
||||||
|
*/
|
||||||
|
.text.align :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
__text_end__ = .;
|
||||||
|
} > REGION_TEXT
|
||||||
|
|
||||||
|
/*
|
||||||
|
* .ARM.exidx exception unwinding; mandated by ARM's C++ ABI
|
||||||
|
*/
|
||||||
|
__exidx_start = .;
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||||
|
} > REGION_RODATA
|
||||||
|
__exidx_end = .;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* .data
|
||||||
|
*/
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
__data_start__ = .;
|
||||||
|
LONG(0)
|
||||||
|
. = ALIGN(8);
|
||||||
|
|
||||||
|
*(.got.plt) *(.got)
|
||||||
|
*(.data .data.* .gnu.linkonce.d.*)
|
||||||
|
|
||||||
|
. = ALIGN(8);
|
||||||
|
__data_end__ = .;
|
||||||
|
} > REGION_DATA AT> REGION_RODATA
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read-only data
|
||||||
|
*/
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||||
|
/* .USER_FLASH: We allow users to allocate into Flash here */
|
||||||
|
*(.USER_FLASH)
|
||||||
|
/* ROM image configuration; for C startup */
|
||||||
|
. = ALIGN(4);
|
||||||
|
_lm_rom_img_cfgp = .;
|
||||||
|
LONG(LOADADDR(.data));
|
||||||
|
/*
|
||||||
|
* Heap: Linker scripts may choose a custom heap by overriding
|
||||||
|
* _lm_heap_start and _lm_heap_end. Otherwise, the heap is in
|
||||||
|
* internal SRAM, beginning after .bss, and growing towards
|
||||||
|
* the stack.
|
||||||
|
*
|
||||||
|
* I'm shoving these here naively; there's probably a cleaner way
|
||||||
|
* to go about this. [mbolivar]
|
||||||
|
*/
|
||||||
|
_lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end;
|
||||||
|
_lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init;
|
||||||
|
} > REGION_RODATA
|
||||||
|
|
||||||
|
/*
|
||||||
|
* .bss
|
||||||
|
*/
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
__bss_start__ = .;
|
||||||
|
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN (8);
|
||||||
|
__bss_end__ = .;
|
||||||
|
_end = __bss_end__;
|
||||||
|
} > REGION_BSS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Debugging sections
|
||||||
|
*/
|
||||||
|
.stab 0 (NOLOAD) : { *(.stab) }
|
||||||
|
.stabstr 0 (NOLOAD) : { *(.stabstr) }
|
||||||
|
/* DWARF debug sections.
|
||||||
|
* Symbols in the DWARF debugging sections are relative to the beginning
|
||||||
|
* of the section so we begin them at 0. */
|
||||||
|
/* DWARF 1 */
|
||||||
|
.debug 0 : { *(.debug) }
|
||||||
|
.line 0 : { *(.line) }
|
||||||
|
/* GNU DWARF 1 extensions */
|
||||||
|
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||||
|
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||||
|
/* DWARF 1.1 and DWARF 2 */
|
||||||
|
.debug_aranges 0 : { *(.debug_aranges) }
|
||||||
|
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||||
|
/* DWARF 2 */
|
||||||
|
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||||
|
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||||
|
.debug_line 0 : { *(.debug_line) }
|
||||||
|
.debug_frame 0 : { *(.debug_frame) }
|
||||||
|
.debug_str 0 : { *(.debug_str) }
|
||||||
|
.debug_loc 0 : { *(.debug_loc) }
|
||||||
|
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||||
|
/* SGI/MIPS DWARF 2 extensions */
|
||||||
|
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||||
|
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||||
|
.debug_typenames 0 : { *(.debug_typenames) }
|
||||||
|
.debug_varnames 0 : { *(.debug_varnames) }
|
||||||
|
|
||||||
|
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
|
||||||
|
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
|
||||||
|
/DISCARD/ : { *(.note.GNU-stack) }
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
/*
|
||||||
|
* Extra archives needed by ARM's GCC ARM Embedded arm-none-eabi-
|
||||||
|
* releases (https://launchpad.net/gcc-arm-embedded/).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is for the provided newlib. */
|
||||||
|
GROUP(libnosys.a)
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for "Flash" builds.
|
||||||
|
*
|
||||||
|
* A Flash build puts .text (and .rodata) in Flash, and
|
||||||
|
* .data/.bss/heap (of course) in SRAM, but offsets the sections by
|
||||||
|
* enough space to store the Maple bootloader, which lives in low
|
||||||
|
* Flash and uses low memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
INCLUDE mem-flash.inc
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for "Flash" builds.
|
||||||
|
*
|
||||||
|
* A Flash build puts .text (and .rodata) in Flash, and
|
||||||
|
* .data/.bss/heap (of course) in SRAM, but offsets the sections by
|
||||||
|
* enough space to store the Maple bootloader, which lives in low
|
||||||
|
* Flash and uses low memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
/*INCLUDE mem-flash.inc*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
|
||||||
|
rom (rx) : ORIGIN = 0x08000000, LENGTH = 44K
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for "JTAG" builds.
|
||||||
|
*
|
||||||
|
* A "JTAG" build puts .text (and .rodata) in Flash, and
|
||||||
|
* .data/.bss/heap (of course) in SRAM, but links starting at the
|
||||||
|
* Flash and SRAM starting addresses (0x08000000 and 0x20000000
|
||||||
|
* respectively). This will wipe out a Maple bootloader if there's one
|
||||||
|
* on the board, so only use this if you know what you're doing.
|
||||||
|
*
|
||||||
|
* Of course, a "JTAG" build is perfectly usable for upload over SWD,
|
||||||
|
* the system memory bootloader, etc. The name is just a historical
|
||||||
|
* artifact.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
INCLUDE mem-jtag.inc
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for "JTAG" builds.
|
||||||
|
*
|
||||||
|
* A "JTAG" build puts .text (and .rodata) in Flash, and
|
||||||
|
* .data/.bss/heap (of course) in SRAM, but links starting at the
|
||||||
|
* Flash and SRAM starting addresses (0x08000000 and 0x20000000
|
||||||
|
* respectively). This will wipe out a Maple bootloader if there's one
|
||||||
|
* on the board, so only use this if you know what you're doing.
|
||||||
|
*
|
||||||
|
* Of course, a "JTAG" build is perfectly usable for upload over SWD,
|
||||||
|
* the system memory bootloader, etc. The name is just a historical
|
||||||
|
* artifact.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
|
||||||
|
rom (rx) : ORIGIN = 0x08000000, LENGTH = 64K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", rom);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", rom);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,5 @@
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
|
||||||
|
rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
|
||||||
|
rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
|
||||||
|
rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for RAM builds.
|
||||||
|
*
|
||||||
|
* A Flash build puts .text, .rodata, and .data/.bss/heap (of course)
|
||||||
|
* in SRAM, but offsets the sections by enough space to store the
|
||||||
|
* Maple bootloader, which uses low memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
INCLUDE mem-ram.inc
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", ram);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", ram);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* libmaple linker script for RAM builds.
|
||||||
|
*
|
||||||
|
* A Flash build puts .text, .rodata, and .data/.bss/heap (of course)
|
||||||
|
* in SRAM, but offsets the sections by enough space to store the
|
||||||
|
* Maple bootloader, which uses low memory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This pulls in the appropriate MEMORY declaration from the right
|
||||||
|
* subdirectory of stm32/mem/ (the environment must call ld with the
|
||||||
|
* right include directory flags to make this happen). Boards can also
|
||||||
|
* use this file to use any of libmaple's memory-related hooks (like
|
||||||
|
* where the heap should live).
|
||||||
|
*/
|
||||||
|
/*INCLUDE mem-ram.inc*/
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
|
||||||
|
rom (rx) : ORIGIN = 0x08005000, LENGTH = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Provide memory region aliases for common.inc */
|
||||||
|
REGION_ALIAS("REGION_TEXT", ram);
|
||||||
|
REGION_ALIAS("REGION_DATA", ram);
|
||||||
|
REGION_ALIAS("REGION_BSS", ram);
|
||||||
|
REGION_ALIAS("REGION_RODATA", ram);
|
||||||
|
|
||||||
|
/* Let common.inc handle the real work. */
|
||||||
|
INCLUDE common.inc
|
|
@ -0,0 +1,78 @@
|
||||||
|
EXTERN(__msp_init)
|
||||||
|
EXTERN(__exc_reset)
|
||||||
|
EXTERN(__exc_nmi)
|
||||||
|
EXTERN(__exc_hardfault)
|
||||||
|
EXTERN(__exc_memmanage)
|
||||||
|
EXTERN(__exc_busfault)
|
||||||
|
EXTERN(__exc_usagefault)
|
||||||
|
EXTERN(__stm32reservedexception7)
|
||||||
|
EXTERN(__stm32reservedexception8)
|
||||||
|
EXTERN(__stm32reservedexception9)
|
||||||
|
EXTERN(__stm32reservedexception10)
|
||||||
|
EXTERN(__exc_svc)
|
||||||
|
EXTERN(__exc_debug_monitor)
|
||||||
|
EXTERN(__stm32reservedexception13)
|
||||||
|
EXTERN(__exc_pendsv)
|
||||||
|
EXTERN(__exc_systick)
|
||||||
|
|
||||||
|
EXTERN(__irq_wwdg)
|
||||||
|
EXTERN(__irq_pvd)
|
||||||
|
EXTERN(__irq_tamper)
|
||||||
|
EXTERN(__irq_rtc)
|
||||||
|
EXTERN(__irq_flash)
|
||||||
|
EXTERN(__irq_rcc)
|
||||||
|
EXTERN(__irq_exti0)
|
||||||
|
EXTERN(__irq_exti1)
|
||||||
|
EXTERN(__irq_exti2)
|
||||||
|
EXTERN(__irq_exti3)
|
||||||
|
EXTERN(__irq_exti4)
|
||||||
|
EXTERN(__irq_dma1_channel1)
|
||||||
|
EXTERN(__irq_dma1_channel2)
|
||||||
|
EXTERN(__irq_dma1_channel3)
|
||||||
|
EXTERN(__irq_dma1_channel4)
|
||||||
|
EXTERN(__irq_dma1_channel5)
|
||||||
|
EXTERN(__irq_dma1_channel6)
|
||||||
|
EXTERN(__irq_dma1_channel7)
|
||||||
|
EXTERN(__irq_adc)
|
||||||
|
EXTERN(__irq_usb_hp_can_tx)
|
||||||
|
EXTERN(__irq_usb_lp_can_rx0)
|
||||||
|
EXTERN(__irq_can_rx1)
|
||||||
|
EXTERN(__irq_can_sce)
|
||||||
|
EXTERN(__irq_exti9_5)
|
||||||
|
EXTERN(__irq_tim1_brk)
|
||||||
|
EXTERN(__irq_tim1_up)
|
||||||
|
EXTERN(__irq_tim1_trg_com)
|
||||||
|
EXTERN(__irq_tim1_cc)
|
||||||
|
EXTERN(__irq_tim2)
|
||||||
|
EXTERN(__irq_tim3)
|
||||||
|
EXTERN(__irq_tim4)
|
||||||
|
EXTERN(__irq_i2c1_ev)
|
||||||
|
EXTERN(__irq_i2c1_er)
|
||||||
|
EXTERN(__irq_i2c2_ev)
|
||||||
|
EXTERN(__irq_i2c2_er)
|
||||||
|
EXTERN(__irq_spi1)
|
||||||
|
EXTERN(__irq_spi2)
|
||||||
|
EXTERN(__irq_usart1)
|
||||||
|
EXTERN(__irq_usart2)
|
||||||
|
EXTERN(__irq_usart3)
|
||||||
|
EXTERN(__irq_exti15_10)
|
||||||
|
EXTERN(__irq_rtcalarm)
|
||||||
|
EXTERN(__irq_usbwakeup)
|
||||||
|
|
||||||
|
EXTERN(__irq_tim8_brk)
|
||||||
|
EXTERN(__irq_tim8_up)
|
||||||
|
EXTERN(__irq_tim8_trg_com)
|
||||||
|
EXTERN(__irq_tim8_cc)
|
||||||
|
EXTERN(__irq_adc3)
|
||||||
|
EXTERN(__irq_fsmc)
|
||||||
|
EXTERN(__irq_sdio)
|
||||||
|
EXTERN(__irq_tim5)
|
||||||
|
EXTERN(__irq_spi3)
|
||||||
|
EXTERN(__irq_uart4)
|
||||||
|
EXTERN(__irq_uart5)
|
||||||
|
EXTERN(__irq_tim6)
|
||||||
|
EXTERN(__irq_tim7)
|
||||||
|
EXTERN(__irq_dma2_channel1)
|
||||||
|
EXTERN(__irq_dma2_channel2)
|
||||||
|
EXTERN(__irq_dma2_channel3)
|
||||||
|
EXTERN(__irq_dma2_channel4_5)
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// API compatibility
|
||||||
|
#include "variant.h"
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef _VARIANT_ARDUINO_STM32_
|
||||||
|
#define _VARIANT_ARDUINO_STM32_
|
||||||
|
|
||||||
|
#define digitalPinToPort(P) ( PIN_MAP[P].gpio_device )
|
||||||
|
#define digitalPinToBitMask(P) ( BIT(PIN_MAP[P].gpio_bit) )
|
||||||
|
#define portOutputRegister(port) ( &(port->regs->ODR) )
|
||||||
|
#define portInputRegister(port) ( &(port->regs->IDR) )
|
||||||
|
|
||||||
|
#define portSetRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BSRR) )
|
||||||
|
#define portClearRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->BRR) )
|
||||||
|
|
||||||
|
#define portConfigRegister(pin) ( &(PIN_MAP[pin].gpio_device->regs->CRL) )
|
||||||
|
|
||||||
|
#endif /* _VARIANT_ARDUINO_STM32_ */
|
|
@ -0,0 +1,229 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 Perry Hung.
|
||||||
|
* Copyright (c) 2011, 2012 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file wirish/boards.cpp
|
||||||
|
* @brief init() and board routines.
|
||||||
|
*
|
||||||
|
* This file is mostly interesting for the init() function, which
|
||||||
|
* configures Flash, the core clocks, and a variety of other available
|
||||||
|
* peripherals on the board so the rest of Wirish doesn't have to turn
|
||||||
|
* things on before using them.
|
||||||
|
*
|
||||||
|
* Prior to returning, init() calls boardInit(), which allows boards
|
||||||
|
* to perform any initialization they need to. This file includes a
|
||||||
|
* weak no-op definition of boardInit(), so boards that don't need any
|
||||||
|
* special initialization don't have to define their own.
|
||||||
|
*
|
||||||
|
* How init() works is chip-specific. See the boards_setup.cpp files
|
||||||
|
* under e.g. wirish/stm32f1/, wirish/stmf32f2 for the details, but be
|
||||||
|
* advised: their contents are unstable, and can/will change without
|
||||||
|
* notice.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <boards.h>
|
||||||
|
#include <libmaple/libmaple_types.h>
|
||||||
|
#include <libmaple/flash.h>
|
||||||
|
#include <libmaple/nvic.h>
|
||||||
|
#include <libmaple/systick.h>
|
||||||
|
#include "boards_private.h"
|
||||||
|
|
||||||
|
static void setup_flash(void);
|
||||||
|
static void setup_clocks(void);
|
||||||
|
static void setup_nvic(void);
|
||||||
|
static void setup_adcs(void);
|
||||||
|
static void setup_timers(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exported functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
void init(void) {
|
||||||
|
setup_flash();
|
||||||
|
setup_clocks();
|
||||||
|
setup_nvic();
|
||||||
|
systick_init(SYSTICK_RELOAD_VAL);
|
||||||
|
wirish::priv::board_setup_gpio();
|
||||||
|
setup_adcs();
|
||||||
|
setup_timers();
|
||||||
|
wirish::priv::board_setup_usb();
|
||||||
|
wirish::priv::series_init();
|
||||||
|
boardInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provide a default no-op boardInit(). */
|
||||||
|
__weak void boardInit(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* You could farm this out to the files in boards/ if e.g. it takes
|
||||||
|
* too long to test on boards with lots of pins. */
|
||||||
|
bool boardUsesPin(uint8 pin) {
|
||||||
|
for (int i = 0; i < BOARD_NR_USED_PINS; i++) {
|
||||||
|
if (pin == boardUsedPins[i]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Auxiliary routines
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void setup_flash(void) {
|
||||||
|
// Turn on as many Flash "go faster" features as
|
||||||
|
// possible. flash_enable_features() just ignores any flags it
|
||||||
|
// can't support.
|
||||||
|
flash_enable_features(FLASH_PREFETCH | FLASH_ICACHE | FLASH_DCACHE);
|
||||||
|
// Configure the wait states, assuming we're operating at "close
|
||||||
|
// enough" to 3.3V.
|
||||||
|
flash_set_latency(FLASH_SAFE_WAIT_STATES);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setup_clocks(void) {
|
||||||
|
// Turn on HSI. We'll switch to and run off of this while we're
|
||||||
|
// setting up the main PLL.
|
||||||
|
rcc_turn_on_clk(RCC_CLK_HSI);
|
||||||
|
|
||||||
|
// Turn off and reset the clock subsystems we'll be using, as well
|
||||||
|
// as the clock security subsystem (CSS). Note that resetting CFGR
|
||||||
|
// to its default value of 0 implies a switch to HSI for SYSCLK.
|
||||||
|
RCC_BASE->CFGR = 0x00000000;
|
||||||
|
rcc_disable_css();
|
||||||
|
rcc_turn_off_clk(RCC_CLK_PLL);
|
||||||
|
rcc_turn_off_clk(RCC_CLK_HSE);
|
||||||
|
wirish::priv::board_reset_pll();
|
||||||
|
// Clear clock readiness interrupt flags and turn off clock
|
||||||
|
// readiness interrupts.
|
||||||
|
RCC_BASE->CIR = 0x00000000;
|
||||||
|
|
||||||
|
// Enable HSE, and wait until it's ready.
|
||||||
|
rcc_turn_on_clk(RCC_CLK_HSE);
|
||||||
|
while (!rcc_is_clk_ready(RCC_CLK_HSE))
|
||||||
|
;
|
||||||
|
|
||||||
|
// Configure AHBx, APBx, etc. prescalers and the main PLL.
|
||||||
|
wirish::priv::board_setup_clock_prescalers();
|
||||||
|
rcc_configure_pll(&wirish::priv::w_board_pll_cfg);
|
||||||
|
|
||||||
|
// Enable the PLL, and wait until it's ready.
|
||||||
|
rcc_turn_on_clk(RCC_CLK_PLL);
|
||||||
|
while(!rcc_is_clk_ready(RCC_CLK_PLL))
|
||||||
|
;
|
||||||
|
|
||||||
|
// Finally, switch to the now-ready PLL as the main clock source.
|
||||||
|
rcc_switch_sysclk(RCC_CLKSRC_PLL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These addresses are where usercode starts when a bootloader is
|
||||||
|
* present. If no bootloader is present, the user NVIC usually starts
|
||||||
|
* at the Flash base address, 0x08000000.
|
||||||
|
*/
|
||||||
|
#if defined(BOOTLOADER_maple)
|
||||||
|
#define USER_ADDR_ROM 0x08005000
|
||||||
|
#else
|
||||||
|
#if defined(BOOTLOADER_robotis)
|
||||||
|
#define USER_ADDR_ROM 0x08003000
|
||||||
|
#else
|
||||||
|
#define USER_ADDR_ROM 0x08000000
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#define USER_ADDR_RAM 0x20000C00
|
||||||
|
extern char __text_start__;
|
||||||
|
|
||||||
|
static void setup_nvic(void) {
|
||||||
|
|
||||||
|
nvic_init((uint32)VECT_TAB_ADDR, 0);
|
||||||
|
|
||||||
|
/* Roger Clark. We now control nvic vector table in boards.txt using the build.vect paramater
|
||||||
|
#ifdef VECT_TAB_FLASH
|
||||||
|
nvic_init(USER_ADDR_ROM, 0);
|
||||||
|
#elif defined VECT_TAB_RAM
|
||||||
|
nvic_init(USER_ADDR_RAM, 0);
|
||||||
|
#elif defined VECT_TAB_BASE
|
||||||
|
nvic_init((uint32)0x08000000, 0);
|
||||||
|
#elif defined VECT_TAB_ADDR
|
||||||
|
// A numerically supplied value
|
||||||
|
nvic_init((uint32)VECT_TAB_ADDR, 0);
|
||||||
|
#else
|
||||||
|
// Use the __text_start__ value from the linker script; this
|
||||||
|
// should be the start of the vector table.
|
||||||
|
nvic_init((uint32)&__text_start__, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void adc_default_config(const adc_dev *dev) {
|
||||||
|
adc_enable_single_swstart(dev);
|
||||||
|
adc_set_sample_rate(dev, wirish::priv::w_adc_smp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setup_adcs(void) {
|
||||||
|
adc_set_prescaler(wirish::priv::w_adc_pre);
|
||||||
|
adc_foreach(adc_default_config);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void timer_default_config(timer_dev *dev) {
|
||||||
|
timer_adv_reg_map *regs = (dev->regs).adv;
|
||||||
|
const uint16 full_overflow = 0xFFFF;
|
||||||
|
const uint16 half_duty = 0x8FFF;
|
||||||
|
|
||||||
|
timer_init(dev);
|
||||||
|
timer_pause(dev);
|
||||||
|
|
||||||
|
regs->CR1 = TIMER_CR1_ARPE;
|
||||||
|
regs->PSC = 1;
|
||||||
|
regs->SR = 0;
|
||||||
|
regs->DIER = 0;
|
||||||
|
regs->EGR = TIMER_EGR_UG;
|
||||||
|
switch (dev->type) {
|
||||||
|
case TIMER_ADVANCED:
|
||||||
|
regs->BDTR = TIMER_BDTR_MOE | TIMER_BDTR_LOCK_OFF;
|
||||||
|
// fall-through
|
||||||
|
case TIMER_GENERAL:
|
||||||
|
timer_set_reload(dev, full_overflow);
|
||||||
|
for (uint8 channel = 1; channel <= 4; channel++) {
|
||||||
|
if (timer_has_cc_channel(dev, channel)) {
|
||||||
|
timer_set_compare(dev, channel, half_duty);
|
||||||
|
timer_oc_set_mode(dev, channel, TIMER_OC_MODE_PWM_1,
|
||||||
|
TIMER_OC_PE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fall-through
|
||||||
|
case TIMER_BASIC:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer_generate_update(dev);
|
||||||
|
timer_resume(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setup_timers(void) {
|
||||||
|
timer_foreach(timer_default_config);
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file wirish/stm32f1/boards_setup.cpp
|
||||||
|
* @author Marti Bolivar <mbolivar@leaflabs.com>
|
||||||
|
* @brief STM32F1 chip setup.
|
||||||
|
*
|
||||||
|
* This file controls how init() behaves on the STM32F1. Be very
|
||||||
|
* careful when changing anything here. Many of these values depend
|
||||||
|
* upon each other.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "boards_private.h"
|
||||||
|
|
||||||
|
#include <libmaple/gpio.h>
|
||||||
|
#include <libmaple/timer.h>
|
||||||
|
|
||||||
|
#include <boards.h>
|
||||||
|
#include <usb_serial.h>
|
||||||
|
|
||||||
|
// Allow boards to provide a PLL multiplier. This is useful for
|
||||||
|
// e.g. STM32F100 value line MCUs, which use slower multipliers.
|
||||||
|
// (We're leaving the default to RCC_PLLMUL_9 for now, since that
|
||||||
|
// works for F103 performance line MCUs, which is all that LeafLabs
|
||||||
|
// currently officially supports).
|
||||||
|
#ifndef BOARD_RCC_PLLMUL
|
||||||
|
#define BOARD_RCC_PLLMUL RCC_PLLMUL_9
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace wirish {
|
||||||
|
namespace priv {
|
||||||
|
|
||||||
|
static stm32f1_rcc_pll_data pll_data = {BOARD_RCC_PLLMUL};
|
||||||
|
__weak rcc_pll_cfg w_board_pll_cfg = {RCC_PLLSRC_HSE, &pll_data};
|
||||||
|
__weak adc_prescaler w_adc_pre = ADC_PRE_PCLK2_DIV_6;
|
||||||
|
__weak adc_smp_rate w_adc_smp = ADC_SMPR_55_5;
|
||||||
|
|
||||||
|
__weak void board_reset_pll(void) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void board_setup_clock_prescalers(void) {
|
||||||
|
rcc_set_prescaler(RCC_PRESCALER_AHB, RCC_AHB_SYSCLK_DIV_1);
|
||||||
|
rcc_set_prescaler(RCC_PRESCALER_APB1, RCC_APB1_HCLK_DIV_2);
|
||||||
|
rcc_set_prescaler(RCC_PRESCALER_APB2, RCC_APB2_HCLK_DIV_1);
|
||||||
|
rcc_clk_disable(RCC_USB);
|
||||||
|
#if F_CPU == 72000000
|
||||||
|
rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
|
||||||
|
#elif F_CPU == 48000000
|
||||||
|
rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void board_setup_gpio(void) {
|
||||||
|
gpio_init_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void board_setup_usb(void) {
|
||||||
|
#ifdef SERIAL_USB
|
||||||
|
|
||||||
|
#ifdef GENERIC_BOOTLOADER
|
||||||
|
//Reset the USB interface on generic boards - developed by Victor PV
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
||||||
|
gpio_write_bit(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit,0);
|
||||||
|
|
||||||
|
for(volatile unsigned int i=0;i<256;i++);// Only small delay seems to be needed, and USB pins will get configured in Serial.begin
|
||||||
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_INPUT_FLOATING);
|
||||||
|
#endif
|
||||||
|
Serial.begin();// Roger Clark. Changed SerialUSB to Serial for Arduino sketch compatibility
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void series_init(void) {
|
||||||
|
// Initialize AFIO here, too, so peripheral remaps and external
|
||||||
|
// interrupts work out of the box.
|
||||||
|
afio_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is a modified version of a file obtained from
|
||||||
|
* CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the
|
||||||
|
* following text appeared:
|
||||||
|
*
|
||||||
|
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||||
|
* and license this software and its documentation for any purpose, provided
|
||||||
|
* that existing copyright notices are retained in all copies and that this
|
||||||
|
* notice is included verbatim in any distributions. No written agreement,
|
||||||
|
* license, or royalty fee is required for any of the authorized uses.
|
||||||
|
* Modifications to this software may be copyrighted by their authors
|
||||||
|
* and need not follow the licensing terms described here, provided that
|
||||||
|
* the new terms are clearly indicated on the first page of each file where
|
||||||
|
* they apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 16
|
||||||
|
.thumb_func
|
||||||
|
|
||||||
|
.globl __start__
|
||||||
|
.type __start__, %function
|
||||||
|
__start__:
|
||||||
|
.fnstart
|
||||||
|
ldr r1,=__msp_init
|
||||||
|
mov sp,r1
|
||||||
|
ldr r1,=start_c
|
||||||
|
bx r1
|
||||||
|
.pool
|
||||||
|
.cantunwind
|
||||||
|
.fnend
|
|
@ -0,0 +1,95 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is a modified version of a file obtained from
|
||||||
|
* CodeSourcery Inc. (now part of Mentor Graphics Corp.), in which the
|
||||||
|
* following text appeared:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006, 2007 CodeSourcery Inc
|
||||||
|
*
|
||||||
|
* The authors hereby grant permission to use, copy, modify, distribute,
|
||||||
|
* and license this software and its documentation for any purpose, provided
|
||||||
|
* that existing copyright notices are retained in all copies and that this
|
||||||
|
* notice is included verbatim in any distributions. No written agreement,
|
||||||
|
* license, or royalty fee is required for any of the authorized uses.
|
||||||
|
* Modifications to this software may be copyrighted by their authors
|
||||||
|
* and need not follow the licensing terms described here, provided that
|
||||||
|
* the new terms are clearly indicated on the first page of each file where
|
||||||
|
* they apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
extern void __libc_init_array(void);
|
||||||
|
|
||||||
|
extern int main(int, char**, char**);
|
||||||
|
|
||||||
|
extern void exit(int) __attribute__((noreturn, weak));
|
||||||
|
|
||||||
|
/* The linker must ensure that these are at least 4-byte aligned. */
|
||||||
|
extern char __data_start__, __data_end__;
|
||||||
|
extern char __bss_start__, __bss_end__;
|
||||||
|
|
||||||
|
struct rom_img_cfg {
|
||||||
|
int *img_start;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern char _lm_rom_img_cfgp;
|
||||||
|
|
||||||
|
void __attribute__((noreturn)) start_c(void) {
|
||||||
|
struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp;
|
||||||
|
int *src = img_cfg->img_start;
|
||||||
|
int *dst = (int*)&__data_start__;
|
||||||
|
int exit_code;
|
||||||
|
|
||||||
|
/* Initialize .data, if necessary. */
|
||||||
|
if (src != dst) {
|
||||||
|
int *end = (int*)&__data_end__;
|
||||||
|
while (dst < end) {
|
||||||
|
*dst++ = *src++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Zero .bss. */
|
||||||
|
dst = (int*)&__bss_start__;
|
||||||
|
while (dst < (int*)&__bss_end__) {
|
||||||
|
*dst++ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run initializers. */
|
||||||
|
__libc_init_array();
|
||||||
|
|
||||||
|
/* Jump to main. */
|
||||||
|
exit_code = main(0, 0, 0);
|
||||||
|
if (exit) {
|
||||||
|
exit(exit_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If exit is NULL, make sure we don't return. */
|
||||||
|
for (;;)
|
||||||
|
continue;
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 Perry Hung.
|
||||||
|
* Copyright (c) 2011, 2012 LeafLabs, LLC.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file wirish/syscalls.c
|
||||||
|
* @brief newlib stubs
|
||||||
|
*
|
||||||
|
* Low level system routines used by newlib for basic I/O and memory
|
||||||
|
* allocation. You can override most of these.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libmaple/libmaple.h>
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* If CONFIG_HEAP_START (or CONFIG_HEAP_END) isn't defined, then
|
||||||
|
* assume _lm_heap_start (resp. _lm_heap_end) is appropriately set by
|
||||||
|
* the linker */
|
||||||
|
#ifndef CONFIG_HEAP_START
|
||||||
|
extern char _lm_heap_start;
|
||||||
|
#define CONFIG_HEAP_START ((void *)&_lm_heap_start)
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_HEAP_END
|
||||||
|
extern char _lm_heap_end;
|
||||||
|
#define CONFIG_HEAP_END ((void *)&_lm_heap_end)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _sbrk -- Increment the program break.
|
||||||
|
*
|
||||||
|
* Get incr bytes more RAM (for use by the heap). malloc() and
|
||||||
|
* friends call this function behind the scenes.
|
||||||
|
*/
|
||||||
|
void *_sbrk(int incr) {
|
||||||
|
static void * pbreak = NULL; /* current program break */
|
||||||
|
void * ret;
|
||||||
|
|
||||||
|
if (pbreak == NULL) {
|
||||||
|
pbreak = CONFIG_HEAP_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((CONFIG_HEAP_END - pbreak < incr) ||
|
||||||
|
(pbreak - CONFIG_HEAP_START < -incr)) {
|
||||||
|
errno = ENOMEM;
|
||||||
|
return (void *)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = pbreak;
|
||||||
|
pbreak += incr;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _open(const char *path, int flags, ...) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _close(int fd) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _fstat(int fd, struct stat *st) {
|
||||||
|
st->st_mode = S_IFCHR;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _isatty(int fd) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int isatty(int fd) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _lseek(int fd, off_t pos, int whence) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak unsigned char getch(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__weak int _read(int fd, char *buf, size_t cnt) {
|
||||||
|
*buf = getch();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void putch(unsigned char c) {
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void cgets(char *s, int bufsize) {
|
||||||
|
char *p;
|
||||||
|
int c;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < bufsize; i++) {
|
||||||
|
*(s+i) = 0;
|
||||||
|
}
|
||||||
|
// memset(s, 0, bufsize);
|
||||||
|
|
||||||
|
p = s;
|
||||||
|
|
||||||
|
for (p = s; p < s + bufsize-1;) {
|
||||||
|
c = getch();
|
||||||
|
switch (c) {
|
||||||
|
case '\r' :
|
||||||
|
case '\n' :
|
||||||
|
putch('\r');
|
||||||
|
putch('\n');
|
||||||
|
*p = '\n';
|
||||||
|
return;
|
||||||
|
|
||||||
|
case '\b' :
|
||||||
|
if (p > s) {
|
||||||
|
*p-- = 0;
|
||||||
|
putch('\b');
|
||||||
|
putch(' ');
|
||||||
|
putch('\b');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
putch(c);
|
||||||
|
*p++ = c;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak int _write(int fd, const char *buf, size_t cnt) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < cnt; i++)
|
||||||
|
putch(buf[i]);
|
||||||
|
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Override fgets() in newlib with a version that does line editing */
|
||||||
|
__weak char *fgets(char *s, int bufsize, void *f) {
|
||||||
|
cgets(s, bufsize);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak void _exit(int exitcode) {
|
||||||
|
while (1)
|
||||||
|
;
|
||||||
|
}
|
|
@ -1,2 +0,0 @@
|
||||||
old.0.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
|
||||||
new.0.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
|
|
@ -10,7 +10,7 @@ version=0.1.0
|
||||||
# ----------------------
|
# ----------------------
|
||||||
#build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
#build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
||||||
|
|
||||||
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||||
compiler.c.cmd=arm-none-eabi-gcc
|
compiler.c.cmd=arm-none-eabi-gcc
|
||||||
compiler.c.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
compiler.c.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||||
compiler.c.elf.cmd=arm-none-eabi-g++
|
compiler.c.elf.cmd=arm-none-eabi-g++
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
old.0.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
|
||||||
new.0.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
|
|
@ -10,7 +10,7 @@ version=0.1.0
|
||||||
# ----------------------
|
# ----------------------
|
||||||
#build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
#build.gcc_ver=gcc-arm-none-eabi-4.8.3-2014q1
|
||||||
|
|
||||||
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
|
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||||
compiler.c.cmd=arm-none-eabi-gcc
|
compiler.c.cmd=arm-none-eabi-gcc
|
||||||
compiler.c.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
compiler.c.flags=-c -g -Os -w -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_{build.variant} -D{build.vect} -DERROR_LED_PORT={build.error_led_port} -DERROR_LED_PIN={build.error_led_pin}
|
||||||
compiler.c.elf.cmd=arm-none-eabi-g++
|
compiler.c.elf.cmd=arm-none-eabi-g++
|
||||||
|
|
|
@ -8,7 +8,7 @@ if [ $# -lt 4 ]; then
|
||||||
echo "Usage: $0 $# <dummy_port> <altID> <usbID> <binfile>" >&2
|
echo "Usage: $0 $# <dummy_port> <altID> <usbID> <binfile>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
dummy_port=$1; altID=$2; usbID=$3; binfile=$4; dummy_port_fullpath="/dev/$1"
|
dummy_port="$1"; altID="$2"; usbID="$3"; binfile="$4"; dummy_port_fullpath="/dev/$1"
|
||||||
if [ $# -eq 5 ]; then
|
if [ $# -eq 5 ]; then
|
||||||
dfuse_addr="--dfuse-address $5"
|
dfuse_addr="--dfuse-address $5"
|
||||||
else
|
else
|
||||||
|
@ -26,15 +26,15 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
# 750ms to 1500ms seems to work on my Mac
|
# 750ms to 1500ms seems to work on my Mac
|
||||||
|
|
||||||
|
|
||||||
${DIR}/upload-reset ${dummy_port_fullpath} 750
|
"${DIR}/upload-reset" ${dummy_port_fullpath} 750
|
||||||
|
|
||||||
|
|
||||||
#DFU_UTIL=$(dirname $0)/dfu-util/dfu-util
|
#DFU_UTIL=$(dirname $0)/dfu-util/dfu-util
|
||||||
DFU_UTIL=/usr/bin/dfu-util
|
DFU_UTIL=/usr/bin/dfu-util
|
||||||
DFU_UTIL=${DIR}/dfu-util/dfu-util
|
DFU_UTIL=${DIR}/dfu-util/dfu-util
|
||||||
if [ ! -x ${DFU_UTIL} ]; then
|
if [ ! -x "${DFU_UTIL}" ]; then
|
||||||
echo "$0: error: cannot find ${DFU_UTIL}" >&2
|
echo "$0: error: cannot find ${DFU_UTIL}" >&2
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${DFU_UTIL} -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
|
"${DFU_UTIL}" -d ${usbID} -a ${altID} -D ${binfile} ${dfuse_addr} -R
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue