Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit f20025c

Browse files
authored
Update `Packages_Patches
1 parent 557a2c7 commit f20025c

File tree

11 files changed

+2051
-0
lines changed

11 files changed

+2051
-0
lines changed

Packages_Patches/adafruit/hardware/nrf52/1.3.0/boards.txt

Lines changed: 765 additions & 0 deletions
Large diffs are not rendered by default.

Packages_Patches/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp

Lines changed: 420 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
Copyright (c) 2016 Arduino LLC. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#pragma once
20+
21+
#include <inttypes.h>
22+
#include <stdio.h> // for size_t
23+
24+
#include "WString.h"
25+
#include "Printable.h"
26+
27+
#define DEC 10
28+
#define HEX 16
29+
#define OCT 8
30+
#define BIN 2
31+
32+
class Print
33+
{
34+
private:
35+
int write_error;
36+
size_t printNumber(unsigned long, uint8_t);
37+
size_t printULLNumber(unsigned long long, uint8_t);
38+
size_t printFloat(double, int);
39+
protected:
40+
void setWriteError(int err = 1) { write_error = err; }
41+
public:
42+
Print() : write_error(0) {}
43+
44+
int getWriteError() { return write_error; }
45+
void clearWriteError() { setWriteError(0); }
46+
47+
virtual size_t write(uint8_t) = 0;
48+
size_t write(const char *str) {
49+
if (str == NULL) return 0;
50+
return write((const uint8_t *)str, strlen(str));
51+
}
52+
virtual size_t write(const uint8_t *buffer, size_t size);
53+
size_t write(const char *buffer, size_t size) {
54+
return write((const uint8_t *)buffer, size);
55+
}
56+
57+
// default to zero, meaning "a single write may block"
58+
// should be overridden by subclasses with buffering
59+
virtual int availableForWrite() { return 0; }
60+
61+
size_t print(const __FlashStringHelper *);
62+
size_t print(const String &);
63+
size_t print(const char[]);
64+
size_t print(char);
65+
size_t print(unsigned char, int = DEC);
66+
size_t print(int, int = DEC);
67+
size_t print(unsigned int, int = DEC);
68+
size_t print(long, int = DEC);
69+
size_t print(unsigned long, int = DEC);
70+
size_t print(long long, int = DEC);
71+
size_t print(unsigned long long, int = DEC);
72+
size_t print(double, int = 2);
73+
size_t print(const Printable&);
74+
75+
size_t println(const __FlashStringHelper *);
76+
size_t println(const String &s);
77+
size_t println(const char[]);
78+
size_t println(char);
79+
size_t println(unsigned char, int = DEC);
80+
size_t println(int, int = DEC);
81+
size_t println(unsigned int, int = DEC);
82+
size_t println(long, int = DEC);
83+
size_t println(unsigned long, int = DEC);
84+
size_t println(long long, int = DEC);
85+
size_t println(unsigned long long, int = DEC);
86+
size_t println(double, int = 2);
87+
size_t println(const Printable&);
88+
size_t println(void);
89+
90+
size_t printf(const char * format, ...);
91+
92+
size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0);
93+
size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0)
94+
{
95+
return printBuffer((uint8_t const*) buffer, size, delim, byteline);
96+
}
97+
98+
size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0);
99+
size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0)
100+
{
101+
return printBufferReverse((uint8_t const*) buffer, size, delim, byteline);
102+
}
103+
104+
virtual void flush() { /* Empty implementation for backward compatibility */ }
105+
};
106+
107+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Udp.cpp: Library to send/receive UDP packets.
3+
*
4+
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these)
5+
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This
6+
* might not happen often in practice, but in larger network topologies, a UDP
7+
* packet can be received out of sequence.
8+
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being
9+
* aware of it. Again, this may not be a concern in practice on small local networks.
10+
* For more information, see http://www.cafeaulait.org/course/week12/35.html
11+
*
12+
* MIT License:
13+
* Copyright (c) 2008 Bjoern Hartmann
14+
* Permission is hereby granted, free of charge, to any person obtaining a copy
15+
* of this software and associated documentation files (the "Software"), to deal
16+
* in the Software without restriction, including without limitation the rights
17+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18+
* copies of the Software, and to permit persons to whom the Software is
19+
* furnished to do so, subject to the following conditions:
20+
*
21+
* The above copyright notice and this permission notice shall be included in
22+
* all copies or substantial portions of the Software.
23+
*
24+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30+
* THE SOFTWARE.
31+
*
32+
* bjoern@cs.stanford.edu 12/30/2008
33+
*/
34+
35+
#ifndef udp_h
36+
#define udp_h
37+
38+
#include <Stream.h>
39+
#include <IPAddress.h>
40+
41+
class UDP : public Stream {
42+
43+
public:
44+
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
45+
46+
// KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.)
47+
virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure
48+
49+
virtual void stop() =0; // Finish with the UDP socket
50+
51+
// Sending UDP packets
52+
53+
// Start building up a packet to send to the remote host specific in ip and port
54+
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
55+
virtual int beginPacket(IPAddress ip, uint16_t port) =0;
56+
// Start building up a packet to send to the remote host specific in host and port
57+
// Returns 1 if successful, 0 if there was a problem resolving the hostname or port
58+
virtual int beginPacket(const char *host, uint16_t port) =0;
59+
// Finish off this packet and send it
60+
// Returns 1 if the packet was sent successfully, 0 if there was an error
61+
virtual int endPacket() =0;
62+
// Write a single byte into the packet
63+
virtual size_t write(uint8_t) =0;
64+
// Write size bytes from buffer into the packet
65+
virtual size_t write(const uint8_t *buffer, size_t size) =0;
66+
67+
// Start processing the next available incoming packet
68+
// Returns the size of the packet in bytes, or 0 if no packets are available
69+
virtual int parsePacket() =0;
70+
// Number of bytes remaining in the current packet
71+
virtual int available() =0;
72+
// Read a single byte from the current packet
73+
virtual int read() =0;
74+
// Read up to len bytes from the current packet and place them into buffer
75+
// Returns the number of bytes read, or 0 if none are available
76+
virtual int read(unsigned char* buffer, size_t len) =0;
77+
// Read up to len characters from the current packet and place them into buffer
78+
// Returns the number of characters read, or 0 if none are available
79+
virtual int read(char* buffer, size_t len) =0;
80+
// Return the next byte from the current packet without moving on to the next byte
81+
virtual int peek() =0;
82+
virtual void flush() =0; // Finish reading the current packet
83+
84+
// Return the IP address of the host who sent the current incoming packet
85+
virtual IPAddress remoteIP() =0;
86+
// Return the port of the host who sent the current incoming packet
87+
virtual uint16_t remotePort() =0;
88+
protected:
89+
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
90+
};
91+
92+
#endif
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
2+
# Copyright (c) 2016 Sandeep Mistry All right reserved.
3+
# Copyright (c) 2017 Adafruit Industries. All rights reserved.
4+
#
5+
# This library is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU Lesser General Public
7+
# License as published by the Free Software Foundation; either
8+
# version 2.1 of the License, or (at your option) any later version.
9+
#
10+
# This library is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
# See the GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public
16+
# License along with this library; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
19+
name=Adafruit nRF52 Boards
20+
version=1.3.0
21+
22+
# Compile variables
23+
# -----------------
24+
25+
compiler.warning_flags=-Werror=return-type
26+
compiler.warning_flags.none=-Werror=return-type
27+
compiler.warning_flags.default=-Werror=return-type
28+
compiler.warning_flags.more=-Wall -Werror=return-type
29+
compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith
30+
31+
# Allow changing optimization settings via platform.local.txt / boards.local.txt
32+
compiler.optimization_flag=-Ofast
33+
34+
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
35+
compiler.c.cmd=arm-none-eabi-gcc
36+
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
37+
38+
# KH, Error here to use gcc, must use g++
39+
#compiler.c.elf.cmd=arm-none-eabi-gcc
40+
compiler.c.elf.cmd=arm-none-eabi-g++
41+
42+
compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps
43+
compiler.S.cmd=arm-none-eabi-gcc
44+
compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp
45+
46+
compiler.cpp.cmd=arm-none-eabi-g++
47+
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
48+
compiler.ar.cmd=arm-none-eabi-ar
49+
compiler.ar.flags=rcs
50+
compiler.objcopy.cmd=arm-none-eabi-objcopy
51+
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
52+
compiler.elf2bin.flags=-O binary
53+
compiler.elf2bin.cmd=arm-none-eabi-objcopy
54+
compiler.elf2hex.flags=-O ihex
55+
compiler.elf2hex.cmd=arm-none-eabi-objcopy
56+
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs
57+
compiler.size.cmd=arm-none-eabi-size
58+
59+
# this can be overriden in boards.txt
60+
# Logger 0: Serial (CDC), 1 Serial1 (UART), 2 Segger RTT
61+
build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float
62+
build.debug_flags=-DCFG_DEBUG=0
63+
build.logger_flags=-DCFG_LOGGER=0
64+
build.sysview_flags=-DCFG_SYSVIEW=0
65+
66+
# USB flags
67+
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
68+
69+
# These can be overridden in platform.local.txt
70+
compiler.c.extra_flags=
71+
compiler.c.elf.extra_flags=
72+
compiler.cpp.extra_flags=
73+
compiler.S.extra_flags=
74+
compiler.ar.extra_flags=
75+
compiler.libraries.ldflags=
76+
compiler.elf2bin.extra_flags=
77+
compiler.elf2hex.extra_flags=
78+
79+
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/"
80+
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math
81+
82+
# common compiler for nrf
83+
rtos.path={build.core.path}/freertos
84+
nordic.path={build.core.path}/nordic
85+
86+
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
87+
88+
# Compile patterns
89+
# ----------------
90+
91+
## Compile c files
92+
## KH Add '-DBOARD_NAME="{build.board}"'
93+
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} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
94+
95+
## Compile c++ files
96+
## KH Add '-DBOARD_NAME="{build.board}"'
97+
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} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
98+
99+
## Compile S files
100+
## KH Add '-DBOARD_NAME="{build.board}"'
101+
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} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}"
102+
103+
## Create archives
104+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
105+
106+
## Combine gc-sections, archives, and objects
107+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group
108+
109+
## Create output (bin file)
110+
#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
111+
112+
## Create output (hex file)
113+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
114+
115+
## Create dfu package zip file
116+
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
117+
118+
## Create uf2 file
119+
#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex"
120+
121+
## Save bin
122+
recipe.output.tmp_file_bin={build.project_name}.bin
123+
recipe.output.save_file_bin={build.project_name}.save.bin
124+
125+
## Save hex
126+
recipe.output.tmp_file_hex={build.project_name}.hex
127+
recipe.output.save_file_hexu={build.project_name}.save.hex
128+
129+
## Compute size
130+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
131+
recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).*
132+
recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*
133+
134+
## Export Compiled Binary
135+
recipe.output.tmp_file={build.project_name}.hex
136+
recipe.output.save_file={build.project_name}.{build.variant}.hex
137+
138+
#***************************************************
139+
# adafruit-nrfutil for uploading
140+
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
141+
# pre-built binaries are provided for macos and windows
142+
#***************************************************
143+
tools.nrfutil.cmd=adafruit-nrfutil
144+
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
145+
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
146+
147+
tools.nrfutil.upload.params.verbose=--verbose
148+
tools.nrfutil.upload.params.quiet=
149+
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
150+
151+
#***************************************************
152+
# Burning bootloader with either jlink or nrfutil
153+
#***************************************************
154+
155+
# Bootloader version
156+
tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.2_{build.sd_name}_{build.sd_version}
157+
158+
tools.bootburn.bootloader.params.verbose=
159+
tools.bootburn.bootloader.params.quiet=
160+
tools.bootburn.bootloader.pattern={program.burn_pattern}
161+
162+
# erase flash page while programming
163+
tools.bootburn.erase.params.verbose=
164+
tools.bootburn.erase.params.quiet=
165+
tools.bootburn.erase.pattern=
166+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
This library is free software; you can redistribute it and/or
4+
modify it under the terms of the GNU Lesser General Public
5+
License as published by the Free Software Foundation; either
6+
version 2.1 of the License, or (at your option) any later version.
7+
This library is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
See the GNU Lesser General Public License for more details.
11+
You should have received a copy of the GNU Lesser General Public
12+
License along with this library; if not, write to the Free Software
13+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14+
*/
15+
16+
// API compatibility
17+
#include "variant.h"

0 commit comments

Comments
 (0)