From 97bf2091a9a47f2bed5db66e9fa20b5d3e81d9bf Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Fri, 25 Feb 2022 20:43:07 -0500 Subject: [PATCH] Update `Packages' Patches` --- .../hardware/samd/1.7.7/cores/arduino/Print.h | 1 + .../hardware/samd/1.7.8/cores/arduino/Print.h | 1 + .../hardware/samd/1.7.9/cores/arduino/Print.h | 1 + .../hardware/samd/1.8.1/cores/arduino/Print.h | 1 + .../hardware/samd/1.8.2/cores/arduino/Print.h | 1 + .../lwipstack/include/lwipstack/lwipopts.h | 347 ++++++++++++++++++ .../2.7.2/portenta_post_install.sh | 22 ++ .../arduino/hardware/samd/1.8.13/platform.txt | 266 ++++++++++++++ .../AmebaD/3.1.2/cores/arduino/avr/pgmspace.h | 122 ++++++ 9 files changed, 762 insertions(+) create mode 100644 Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h create mode 100644 Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh create mode 100644 Packages_Patches/arduino/hardware/samd/1.8.13/platform.txt create mode 100644 Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h index 793a686..48353c4 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h @@ -20,6 +20,7 @@ #include #include // for size_t +#include // for printf #include "WString.h" #include "Printable.h" diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h index 793a686..48353c4 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h @@ -20,6 +20,7 @@ #include #include // for size_t +#include // for printf #include "WString.h" #include "Printable.h" diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h index 793a686..48353c4 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h @@ -20,6 +20,7 @@ #include #include // for size_t +#include // for printf #include "WString.h" #include "Printable.h" diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h index 793a686..48353c4 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h @@ -20,6 +20,7 @@ #include #include // for size_t +#include // for printf #include "WString.h" #include "Printable.h" diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h index 793a686..48353c4 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h @@ -20,6 +20,7 @@ #include #include // for size_t +#include // for printf #include "WString.h" #include "Printable.h" diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h new file mode 100644 index 0000000..84c18cf --- /dev/null +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -0,0 +1,347 @@ +/* Copyright (C) 2012 mbed.org, MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LWIPOPTS_H +#define LWIPOPTS_H + +// Workaround for Linux timeval +#if defined (TOOLCHAIN_GCC) +#define LWIP_TIMEVAL_PRIVATE 0 +#include +#endif +#include "nsapi_types.h" +#include "mbed_retarget.h" + +// KH fix +#include +///////////////////////// + +// Operating System +#define NO_SYS 0 + +#if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED +#error "Either IPv4 or IPv6 must be enabled." +#endif + +#define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED + +#define LWIP_IPV6 MBED_CONF_LWIP_IPV6_ENABLED + +#define LWIP_PROVIDE_ERRNO 0 + +// On dual stack configuration how long to wait for both or preferred stack +// addresses before completing bring up. +#if LWIP_IPV4 && LWIP_IPV6 +#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE +#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT +#define PREF_ADDR_TIMEOUT 0 +#else +#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT +#define BOTH_ADDR_TIMEOUT 0 +#endif +#else +#define PREF_ADDR_TIMEOUT 0 +#define BOTH_ADDR_TIMEOUT 0 +#endif + + +#define DHCP_TIMEOUT MBED_CONF_LWIP_DHCP_TIMEOUT + +#define LINK_TIMEOUT 60 + +#define PREF_IPV4 1 +#define PREF_IPV6 2 + +#if MBED_CONF_LWIP_IP_VER_PREF == 6 +#define IP_VERSION_PREF PREF_IPV6 +#elif MBED_CONF_LWIP_IP_VER_PREF == 4 +#define IP_VERSION_PREF PREF_IPV4 +#else +#error "Either IPv4 or IPv6 must be preferred." +#endif + +#undef LWIP_DEBUG +#if MBED_CONF_LWIP_DEBUG_ENABLED +#define LWIP_DEBUG 1 +#endif + +#if NO_SYS == 0 +#include "cmsis_os2.h" + +#define SYS_LIGHTWEIGHT_PROT 1 + +#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + +#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + +// Thread stacks use 8-byte alignment +#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + +#ifdef LWIP_DEBUG +// For LWIP debug, double the stack +#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) +#elif MBED_DEBUG +// When debug is enabled on the build increase stack 25 percent +#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) +#else +#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) +#endif + +// Thread priority (osPriorityNormal by default) +#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + +#ifdef LWIP_DEBUG +#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) +#else +#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) +#endif + +#define MEMP_NUM_SYS_TIMEOUT 16 + +#define sys_msleep(ms) sys_msleep(ms) + +#endif + +// 32-bit alignment +#define MEM_ALIGNMENT 4 + +#define LWIP_RAM_HEAP_POINTER lwip_ram_heap + +// Number of simultaneously queued TCP segments. +#define MEMP_NUM_TCP_SEG MBED_CONF_LWIP_MEMP_NUM_TCP_SEG + +// TCP Maximum segment size. +#define TCP_MSS MBED_CONF_LWIP_TCP_MSS + +// TCP sender buffer space (bytes). +#define TCP_SND_BUF MBED_CONF_LWIP_TCP_SND_BUF + +// TCP sender buffer space (bytes). +#define TCP_WND MBED_CONF_LWIP_TCP_WND + +#define TCP_MAXRTX MBED_CONF_LWIP_TCP_MAXRTX + +#define TCP_SYNMAXRTX MBED_CONF_LWIP_TCP_SYNMAXRTX + +// Number of pool pbufs. +// Each requires 684 bytes of RAM (if MSS=536 and PBUF_POOL_BUFSIZE defaulting to be based on MSS) +#define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE + +#ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE +#undef PBUF_POOL_BUFSIZE +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) +#else +#ifndef PBUF_POOL_BUFSIZE +#if LWIP_IPV6 +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) +#elif LWIP_IPV4 +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) +#endif +#endif +#endif + +#define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE + +// One tcp_pcb_listen is needed for each TCP server. +// Each requires 72 bytes of RAM. +#define MEMP_NUM_TCP_PCB_LISTEN MBED_CONF_LWIP_TCP_SERVER_MAX + +// One is tcp_pcb needed for each TCPSocket. +// Each requires 196 bytes of RAM. +#define MEMP_NUM_TCP_PCB MBED_CONF_LWIP_TCP_SOCKET_MAX + +// One udp_pcb is needed for each UDPSocket. +// Each requires 84 bytes of RAM (total rounded to multiple of 512). +#define MEMP_NUM_UDP_PCB MBED_CONF_LWIP_UDP_SOCKET_MAX + +// Number of non-pool pbufs. +// Each requires 92 bytes of RAM. +#define MEMP_NUM_PBUF MBED_CONF_LWIP_NUM_PBUF + +// Each netbuf requires 64 bytes of RAM. +#define MEMP_NUM_NETBUF MBED_CONF_LWIP_NUM_NETBUF + +// One netconn is needed for each UDPSocket or TCPSocket. +// Each requires 236 bytes of RAM (total rounded to multiple of 512). +#define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX + +#if MBED_CONF_LWIP_TCP_ENABLED +#define LWIP_TCP 1 +#define TCP_OVERSIZE 0 +#define LWIP_TCP_KEEPALIVE 1 + +#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + +#else +#define LWIP_TCP 0 +#endif + +#define LWIP_DNS 1 +// Only DNS address storage is enabled +#define LWIP_FULL_DNS 0 +#define LWIP_SOCKET 0 + +#define SO_REUSE 1 + +// Support Multicast +#include "stdlib.h" +#define LWIP_IGMP LWIP_IPV4 +#define LWIP_RAND() lwip_get_random() + +#define LWIP_COMPAT_SOCKETS 0 +#define LWIP_POSIX_SOCKETS_IO_NAMES 0 + +#define LWIP_BROADCAST_PING 1 + +// Fragmentation on, as per IPv4 default +#define LWIP_IPV6_FRAG LWIP_IPV6 + +// Queuing, default is "disabled", as per IPv4 default (so actually queues 1) +#define LWIP_ND6_QUEUEING MBED_CONF_ND6_QUEUEING + +// Debug Options +#define NETIF_DEBUG LWIP_DBG_OFF +#define PBUF_DEBUG LWIP_DBG_OFF +#define API_LIB_DEBUG LWIP_DBG_OFF +#define API_MSG_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define ICMP_DEBUG LWIP_DBG_OFF +#define IGMP_DEBUG LWIP_DBG_OFF +#define INET_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_OFF +#define IP_REASS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define TIMERS_DEBUG LWIP_DBG_OFF +#define TCP_DEBUG LWIP_DBG_OFF +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_FR_DEBUG LWIP_DBG_OFF +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#define TCP_WND_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_RST_DEBUG LWIP_DBG_OFF +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define SLIP_DEBUG LWIP_DBG_OFF +#define DHCP_DEBUG LWIP_DBG_OFF +#define AUTOIP_DEBUG LWIP_DBG_OFF +#define DNS_DEBUG LWIP_DBG_OFF +#define IP6_DEBUG LWIP_DBG_OFF + +#define ETHARP_DEBUG LWIP_DBG_OFF +#define UDP_LPC_EMAC LWIP_DBG_OFF + +#ifdef LWIP_DEBUG +#define MEMP_OVERFLOW_CHECK 1 +#define MEMP_SANITY_CHECK 1 +#define LWIP_DBG_TYPES_ON LWIP_DBG_ON +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL +#else +#define LWIP_NOASSERT 1 +#define LWIP_STATS 0 +#endif + +#define TRACE_TO_ASCII_HEX_DUMP 0 + +#define LWIP_PLATFORM_BYTESWAP 1 + +#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1 + +// Interface type configuration + +#if MBED_CONF_LWIP_ETHERNET_ENABLED +#define LWIP_ARP 1 +#define LWIP_ETHERNET 1 +#define LWIP_DHCP LWIP_IPV4 +#else +#define LWIP_ARP 0 +#define LWIP_ETHERNET 0 +#endif // MBED_CONF_LWIP_ETHERNET_ENABLED + +#if MBED_CONF_LWIP_L3IP_ENABLED +#define LWIP_L3IP 1 +#else +#define LWIP_L3IP 0 +#endif + +//Maximum size of network interface name +#define INTERFACE_NAME_MAX_SIZE NSAPI_INTERFACE_NAME_MAX_SIZE +// Note generic macro name used rather than MBED_CONF_LWIP_PPP_ENABLED +// to allow users like PPPCellularInterface to detect that nsapi_ppp.h is available. + +// Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration +#if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED + +#define PPP_SUPPORT 1 + +#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED +#define LWIP 0x11991199 +#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED +#error LWIP: IPv4 PPP enabled but not IPv4 +#endif +#undef LWIP +#define PPP_IPV4_SUPPORT 1 +#endif + +#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED +#define LWIP 0x11991199 +#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED +#error LWIP: IPv6 PPP enabled but not IPv6 +#endif +#undef LWIP +#define PPP_IPV6_SUPPORT 1 +// Later to be dynamic for use for multiple interfaces +#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 +#endif + +#endif + +#define LWIP_NETBUF_RECVINFO MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED + +// Make sure we default these to off, so +// LWIP doesn't default to on +#ifndef LWIP_ARP +#define LWIP_ARP 0 +#endif + +// Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 +#define LWIP_CHECKSUM_ON_COPY 0 + +#define LWIP_NETIF_HOSTNAME 1 +#define LWIP_NETIF_STATUS_CALLBACK 1 +#define LWIP_NETIF_LINK_CALLBACK 1 + +#define DNS_TABLE_SIZE 2 +#define DNS_MAX_NAME_LENGTH 128 + +#include "lwip_random.h" +#include "lwip_tcp_isn.h" +#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn +#ifdef MBEDTLS_MD5_C +#define LWIP_USE_EXTERNAL_MBEDTLS 1 +#else +#define LWIP_USE_EXTERNAL_MBEDTLS 0 +#endif + +#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS + +#endif /* LWIPOPTS_H_ */ diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh new file mode 100644 index 0000000..7fe71d6 --- /dev/null +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +portenta_h7_rules () { + echo "" + echo "# Portenta H7 bootloader mode UDEV rules" + echo "" +cat < /etc/udev/rules.d/49-portenta_h7.rules + +# reload udev rules +echo "Reload rules..." +udevadm trigger +udevadm control --reload-rules diff --git a/Packages_Patches/arduino/hardware/samd/1.8.13/platform.txt b/Packages_Patches/arduino/hardware/samd/1.8.13/platform.txt new file mode 100644 index 0000000..0e5ebb9 --- /dev/null +++ b/Packages_Patches/arduino/hardware/samd/1.8.13/platform.txt @@ -0,0 +1,266 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# Arduino SAMD Core and platform. +# +# For more info: +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification + +name=Arduino SAMD (32-bits ARM Cortex-M0+) Boards +version=1.8.13 + +# Compile variables +# ----------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall +compiler.warning_flags.all=-Wall -Wextra + +# EXPERIMENTAL feature: optimization flags +# - this is alpha and may be subject to change without notice +compiler.optimization_flags=-Os +compiler.optimization_flags.release=-Os +compiler.optimization_flags.debug=-Og -g3 + +compiler.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.optimization_flags} {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD +compiler.c.elf.cmd=arm-none-eabi-g++ +compiler.c.elf.flags={compiler.optimization_flags} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -c -g -x assembler-with-cpp -MMD +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.optimization_flags} {compiler.warning_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2hex.bin.flags=-O binary +compiler.elf2hex.hex.flags=-O ihex -R .eeprom +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align +compiler.size.cmd=arm-none-eabi-size +compiler.define=-DARDUINO= +compiler.readelf.cmd=arm-none-eabi-readelf + +# this can be overriden in boards.txt +build.extra_flags= + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +#compiler.c.elf.extra_flags=-v +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.2.0.path}/CMSIS/Device/ATMEL/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math + +compiler.libraries.ldflags= + +# USB Flags +# --------- +build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# Default usb manufacturer will be replaced at compile time using +# numeric vendor ID if available or by board's specific value. +build.usb_manufacturer="Unknown" + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add -DBOARD_NAME="{build.board}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} "-I{build.core.path}/api/deprecated" "-I{build.core.path}/api/deprecated-avr-comp" {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add -DBOARD_NAME="{build.board}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} "-I{build.core.path}/api/deprecated" "-I{build.core.path}/api/deprecated-avr-comp" {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add -DBOARD_NAME="{build.board}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} "-I{build.core.path}/api/deprecated" "-I{build.core.path}/api/deprecated-avr-comp" {includes} "{source_file}" -o "{object_file}" + +## Create archives +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value +archive_file_path={build.path}/{archive_file} +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" -Wl,--end-group + +## Create output (bin file) +recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +build.preferred_out_format=bin + +## Save hex +recipe.output.tmp_file={build.project_name}.{build.preferred_out_format} +recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format} + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +# Required discoveries and monitors +# --------------------------------- +pluggable_discovery.required.0=builtin:serial-discovery +pluggable_discovery.required.1=builtin:mdns-discovery +pluggable_monitor.required.serial=builtin:serial-monitor + +# Debugger configuration (general options) +# ---------------------------------------- +# EXPERIMENTAL feature: +# - this is alpha and may be subject to change without notice +debug.executable={build.path}/{build.project_name}.elf +debug.toolchain=gcc +debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ +debug.toolchain.prefix=arm-none-eabi- +debug.server=openocd +debug.server.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}/bin/openocd +debug.server.openocd.scripts_dir={runtime.tools.openocd-0.10.0-arduino7.path}/share/openocd/scripts/ +debug.server.openocd.script={runtime.platform.path}/variants/{build.variant}/{build.openocdscript} + +# Upload/Debug tools +# ------------------ + +# +# AVRDUDE +# +tools.avrdude.path={runtime.tools.avrdude.path} +tools.avrdude.cmd={path}/bin/avrdude +tools.avrdude.config.path={path}/etc/avrdude.conf + +tools.avrdude.upload.params.verbose=-v -v +tools.avrdude.upload.params.quiet=-q -q +tools.avrdude.upload.params.noverify=-V +tools.avrdude.upload.pattern="{cmd}" "-C{config.path}" {upload.verbose} -p{build.emu.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} "-Uflash:w:{build.path}/{build.project_name}.hex:i" + +tools.avrdude_remote.upload.pattern="openocd --version 2>&1 | grep 2016 && if opkg update; then opkg upgrade openocd; exit 1; else echo 'Please connect your board to the Internet in order to upgrade tools' >&2; exit 1; fi || /usr/bin/run-avrdude /tmp/sketch.hex" + +# The following rule is deprecated by pluggable discovery. +# We keep it to avoid breaking compatibility with the Arduino Java IDE. +tools.avrdude.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.avrdude.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b + +# +# BOSSA +# +tools.bossac.path={runtime.tools.bossac-1.7.0-arduino3.path} +tools.bossac.cmd=bossac +tools.bossac.cmd.windows=bossac.exe + +tools.bossac.upload.params.verbose=-i -d +tools.bossac.upload.params.quiet= +tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R + +tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R + +# The following rule is deprecated by pluggable discovery. +# We keep it to avoid breaking compatibility with the Arduino Java IDE. +tools.bossac.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.bossac.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b {arduinoota.extraflags} + +# +# BOSSA (ignore binary size) +# +tools.bossacI.path={runtime.tools.bossac-1.7.0-arduino3.path} +tools.bossacI.cmd=bossac +tools.bossacI.cmd.windows=bossac.exe + +tools.bossacI.upload.params.verbose=-i -d +tools.bossacI.upload.params.quiet= +tools.bossacI.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -I -U {upload.native_usb} -i -e -w "{build.path}/{build.project_name}.bin" -R + +tools.bossacI_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R + +# The following rule is deprecated by pluggable discovery. +# We keep it to avoid breaking compatibility with the Arduino Java IDE. +tools.bossacI.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.bossacI.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b + + +# +# OpenOCD sketch upload +# + +tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path} +tools.openocd.cmd=bin/openocd +tools.openocd.cmd.windows=bin/openocd.exe + +tools.openocd.upload.params.verbose=-d2 +tools.openocd.upload.params.quiet=-d0 +tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset 0x2000; shutdown" + +# The following rule is deprecated by pluggable discovery. +# We keep it to avoid breaking compatibility with the Arduino Java IDE. +tools.openocd.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.openocd.upload.network_pattern={network_cmd} -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b + +tools.openocd.program.params.verbose=-d2 +tools.openocd.program.params.quiet=-d0 +tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "interface/{protocol}" -c "set telnet_port 0" {extra_params} -f "target/at91samdXX.cfg" -c "telnet_port disabled; program {{build.path}/{build.project_name}.hex} verify reset; shutdown" + +tools.openocd.erase.params.verbose=-d3 +tools.openocd.erase.params.quiet=-d0 +tools.openocd.erase.pattern= + +tools.openocd.bootloader.params.verbose=-d2 +tools.openocd.bootloader.params.quiet=-d0 +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "interface/{protocol}" -c "set telnet_port 0" {extra_params} -f "target/at91samdXX.cfg" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" + +# +# OpenOCD sketch upload - version with configurable bootloader size +# FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences +# + +tools.openocd-withbootsize.path={runtime.tools.openocd-0.10.0-arduino7.path} +tools.openocd-withbootsize.cmd=bin/openocd +tools.openocd-withbootsize.cmd.windows=bin/openocd.exe + +tools.openocd-withbootsize.upload.params.verbose=-d2 +tools.openocd-withbootsize.upload.params.quiet=-d0 +tools.openocd-withbootsize.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset {bootloader.size}; shutdown" + +# Program flashes the binary at 0x0000, so use the linker script without_bootloader +tools.openocd-withbootsize.program.params.verbose=-d2 +tools.openocd-withbootsize.program.params.quiet=-d0 +tools.openocd-withbootsize.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.elf} verify reset; shutdown" + +tools.openocd-withbootsize.erase.params.verbose=-d3 +tools.openocd-withbootsize.erase.params.quiet=-d0 +tools.openocd-withbootsize.erase.pattern= + +tools.openocd-withbootsize.bootloader.params.verbose=-d2 +tools.openocd-withbootsize.bootloader.params.quiet=-d0 +tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" + +# +# Arduino OTA +# +arduinoota.extraflags= +tools.arduino_ota.cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.arduino_ota.upload.field.password=Password +tools.arduino_ota.upload.field.password.secret=true +tools.arduino_ota.upload.pattern="{cmd}" -address "{upload.port.address}" -port 65280 -username arduino -password "{upload.field.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b {arduinoota.extraflags} diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h new file mode 100644 index 0000000..bf87a94 --- /dev/null +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h @@ -0,0 +1,122 @@ +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif